diff --git a/changelog.txt b/changelog.txt index 842d66f9a..1a0be1590 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,22 @@ 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. +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) + == 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/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 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" 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 diff --git a/common/database.cpp b/common/database.cpp index 4cafc56d1..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; @@ -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..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 @@ -33,23 +35,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 +69,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) @@ -426,6 +409,8 @@ namespace Convert { uint32 aug3; uint32 aug4; uint32 aug5; + uint32 aug6; + uint8 attuned; }; } 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: 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 f92bc6a67..df4997470 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; } @@ -1397,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; @@ -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) { @@ -1422,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 @@ -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) { @@ -1445,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; @@ -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 @@ -1469,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; @@ -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..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; @@ -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? @@ -361,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); @@ -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(); @@ -432,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; @@ -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/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 fc35e36cd..1659dbd1c 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); @@ -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 @@ -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; @@ -4856,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; @@ -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) @@ -5062,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]; @@ -5070,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 32a3fc592..fbbceda2c 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); @@ -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); @@ -4851,7 +4850,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; @@ -4860,10 +4858,10 @@ 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 = 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 +4879,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 +4892,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 +4910,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 +4923,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) @@ -5066,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]; @@ -5074,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/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_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/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/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/random.h b/common/random.h index ef2b3ef73..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 @@ -33,35 +36,45 @@ 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; } + // 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 @@ -76,7 +89,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; }; } diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 57141f205..fce8dbae4 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); @@ -197,16 +197,17 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const ItemInst* inst, i charges = 0x7FFF; // 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) " - "VALUES( %lu, %lu, %lu, %lu, %lu, '%s', %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()); + std::string query = StringFormat("REPLACE INTO inventory " + "(charid, slotid, itemid, charges, instnodrop, custom_data, color, " + "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)", + (unsigned long)char_id, (unsigned long)slot_id, (unsigned long)inst->GetItem()->ID, + (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)augslot[5], (unsigned long)inst->GetOrnamentationIcon(), + (unsigned long)inst->GetOrnamentationIDFile(), (unsigned long)inst->GetOrnamentHeroModel()); auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents @@ -226,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); @@ -241,15 +242,16 @@ bool SharedDatabase::UpdateSharedBankSlot(uint32 char_id, const ItemInst* inst, 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); + std::string query = StringFormat("REPLACE INTO sharedbank " + "(acctid, slotid, itemid, charges, custom_data, " + "augslot1, augslot2, augslot3, augslot4, augslot5, augslot6) " + "VALUES( %lu, %lu, %lu, %lu, '%s', " + "%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[5]); + auto results = QueryDatabase(query); // Save bag contents, if slot supports bag contents if (inst->IsType(ItemClassContainer) && Inventory::SupportsContainers(slot_id)) @@ -393,20 +395,20 @@ 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 " - "FROM sharedbank sb INNER JOIN character_data ch " - "ON ch.account_id=sb.acctid WHERE ch.id = %i", id); + "sb.augslot1, sb.augslot2, sb.augslot3, " + "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 " - "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; - } + "augslot1, augslot2, augslot3, " + "augslot4, augslot5, augslot6, 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; + } for (auto row = results.begin(); row != results.end(); ++row) { int16 slot_id = (int16)atoi(row[0]); @@ -414,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); @@ -440,13 +443,13 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory* inv, bool is_charid) { } } - if(!row[8]) - continue; + if(!row[9]) + continue; - std::string data_str(row[8]); - std::string idAsString; - std::string value; - bool use_id = true; + std::string data_str(row[9]); + std::string idAsString; + std::string value; + bool use_id = true; for(int i = 0; i < data_str.length(); ++i) { if(data_str[i] == '^') { @@ -488,14 +491,14 @@ 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 " - "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; - } + "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()) { + 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; + } for (auto row = results.begin(); row != results.end(); ++row) { int16 slot_id = atoi(row[0]); @@ -505,16 +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_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); @@ -527,11 +532,11 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) { ItemInst* inst = CreateBaseItem(item, charges); - if(row[10]) { - std::string data_str(row[10]); - std::string idAsString; - std::string value; - bool use_id = true; + if(row[11]) { + std::string data_str(row[11]); + std::string idAsString; + std::string value; + bool use_id = true; for(int i = 0; i < data_str.length(); ++i) { if(data_str[i] == '^') { @@ -552,14 +557,13 @@ 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); + if (instnodrop || (((slot_id >= EmuConstants::EQUIPMENT_BEGIN && slot_id <= EmuConstants::EQUIPMENT_END) || slot_id == MainPowerSource) && inst->GetItem()->Attuneable)) + inst->SetAttuned(true); if (color > 0) inst->SetColor(color); @@ -599,12 +603,12 @@ 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 " - "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()){ + "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); + 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; @@ -617,30 +621,32 @@ bool SharedDatabase::GetInventory(uint32 account_id, char* name, Inventory* inv) 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]); + 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[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]); + 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; if(!item) continue; - ItemInst* inst = CreateBaseItem(item, charges); - inst->SetInstNoDrop(instnodrop); + ItemInst* inst = CreateBaseItem(item, charges); + inst->SetAttuned(instnodrop); - if(row[10]) { - std::string data_str(row[10]); - std::string idAsString; - std::string value; - bool use_id = true; + if(row[11]) { + std::string data_str(row[11]); + std::string idAsString; + std::string value; + bool use_id = true; for(int i = 0; i < data_str.length(); ++i) { if(data_str[i] == '^') { @@ -663,11 +669,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 +858,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]); @@ -912,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]); @@ -1024,11 +1014,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)); } @@ -1197,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; @@ -1209,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; @@ -1216,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) { @@ -1226,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 c21229389..5b3aeddcd 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); // Web Token Verification diff --git a/common/version.h b/common/version.h index 78aa9fcf0..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 9060 +#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 a06a9d94e..54c82c8d9 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -314,6 +314,8 @@ 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| +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 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_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 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/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/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..ad41fc3ae 100644 --- a/zone/aa.h +++ b/zone/aa.h @@ -5,6 +5,7 @@ struct AA_Ability; struct SendAA_Struct; + #define MANA_BURN 664 #include @@ -2155,6 +2156,7 @@ enum { //values of AA_Action.action }; class Timer; +class Mob; class AA_SwarmPetInfo { public: AA_SwarmPetInfo(); diff --git a/zone/attack.cpp b/zone/attack.cpp index ab1f2a3e7..5652b8bf8 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -39,6 +39,10 @@ #include #include +#ifdef BOTS +#include "bot.h" +#endif + extern QueryServ* QServ; extern WorldServer worldserver; 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: 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() { diff --git a/zone/bot.cpp b/zone/bot.cpp index 11bbf44c7..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); @@ -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].material = 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].material = 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 (slotid == 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..be503fccc 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 @@ -805,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); + 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_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 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 { diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 46a67df52..0bf31a7e1 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -61,6 +61,10 @@ #include "remote_call.h" #include "remote_call_subscribe.h" +#ifdef BOTS +#include "bot.h" +#endif + extern QueryServ* QServ; extern Zone* zone; extern volatile bool ZoneLoaded; @@ -1486,9 +1490,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())); } @@ -2726,7 +2749,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 */ @@ -3069,7 +3092,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."); @@ -3085,6 +3107,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) { @@ -3107,15 +3130,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 @@ -3169,6 +3193,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) @@ -3177,9 +3202,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)) @@ -6977,7 +7003,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); @@ -8043,17 +8069,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; } } @@ -8224,7 +8248,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); @@ -8380,7 +8404,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 59a786a19..d5d781e02 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)) { @@ -5513,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); } @@ -5550,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/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/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/corpse.cpp b/zone/corpse.cpp index a16f0906d..1a40befa8 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,25 @@ 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 #include "remote_call_subscribe.h" @@ -446,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. @@ -457,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); } @@ -689,7 +695,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; @@ -706,6 +712,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); } @@ -1049,7 +1057,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); @@ -1164,7 +1172,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); @@ -1436,7 +1444,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/corpse.h b/zone/corpse.h index 3a3d2bce9..9c898976c 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 @@ -79,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/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: 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) { 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/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; diff --git a/zone/entity.cpp b/zone/entity.cpp index f3263bea9..fb2eed2a3 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -32,7 +32,7 @@ #include "../common/features.h" #include "../common/guilds.h" -#include "../common/spdat.h" + #include "guild_mgr.h" #include "net.h" #include "petitions.h" @@ -49,6 +49,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/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; diff --git a/zone/exp.cpp b/zone/exp.cpp index 0e01a4c0e..1aafb8a3f 100644 --- a/zone/exp.cpp +++ b/zone/exp.cpp @@ -15,14 +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/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" + +#ifdef BOTS +#include "bot.h" +#endif extern QueryServ* QServ; 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 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 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; 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/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); diff --git a/zone/inventory.cpp b/zone/inventory.cpp index bb9802e1c..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) { +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,12 +546,11 @@ 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); - 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))) { @@ -559,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; } @@ -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(); @@ -853,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); @@ -1617,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); } } } @@ -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/loottables.cpp b/zone/loottables.cpp index c5fda890e..b6a2c8092 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 @@ -201,6 +206,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/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 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; 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 diff --git a/zone/mob.cpp b/zone/mob.cpp index ebacfeb3f..5175b16e8 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; @@ -972,36 +976,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 +1006,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. @@ -2627,8 +2610,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]; } @@ -2640,20 +2623,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); @@ -2697,7 +2669,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; @@ -2724,48 +2696,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 @@ -2794,19 +2817,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/mob_ai.cpp b/zone/mob_ai.cpp index 657d5045c..b6c2fb111 100644 --- a/zone/mob_ai.cpp +++ b/zone/mob_ai.cpp @@ -15,27 +15,27 @@ 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 "remote_call.h" #include "remote_call_subscribe.h" +#include +#include +#include + extern EntityList entity_list; extern Zone *zone; @@ -1090,7 +1090,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 { 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) 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) 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 833a6ef96..c01cb6853 100644 --- a/zone/pathing.h +++ b/zone/pathing.h @@ -1,13 +1,12 @@ #ifndef PATHING_H #define PATHING_H -#include + #include "map.h" -#include "../common/timer.h" + #include -#include -#include class Client; +class Mob; #define PATHNODENEIGHBOURS 50 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/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" 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); 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; 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; 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(); 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 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, 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; 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 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 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 diff --git a/zone/spells.cpp b/zone/spells.cpp index baae446c8..0828d6388 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 @@ -89,6 +91,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/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; 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; diff --git a/zone/tradeskills.cpp b/zone/tradeskills.cpp index 58774f4b1..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" @@ -287,7 +288,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 +308,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..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; @@ -878,14 +884,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/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 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 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); diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 410e76f3f..e2604a3af 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -21,13 +21,15 @@ #endif #include "../common/features.h" -#include "../common/misc_functions.h" #include "../common/rulesys.h" #include "../common/string_util.h" +#include "../common/misc_functions.h" + #include "map.h" #include "npc.h" #include "quest_parser_collection.h" #include "water_map.h" + #include #include diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index d0c6db522..ed6b8242b 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 "../common/eq_packet_structs.h" -#include "../common/packet_dump.h" #include "../common/misc_functions.h" -#include "../common/packet_functions.h" -#include "../common/md5.h" #include "../common/rulesys.h" -#include "worldserver.h" -#include "zonedb.h" -#include "zone.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 "zone_config.h" +#include "raids.h" #include "string_ids.h" -#include "guild_mgr.h" #include "titles.h" -#include "qglobals.h" +#include "worldserver.h" +#include "zone.h" +#include "zone_config.h" #include "remote_call_subscribe.h" #include "remote_call.h" diff --git a/zone/zone.cpp b/zone/zone.cpp index 4453422a8..8d8085f22 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" #include "remote_call_subscribe.h" #ifdef _WINDOWS 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 { 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 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()) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 17b5ff508..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 @@ -427,7 +430,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 +443,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 +482,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 +493,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 +3572,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 +3582,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 +3598,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 +3751,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 +3774,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; // }; diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 71ea65dc8..55d4d3366 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -19,12 +19,17 @@ #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" #include "worldserver.h" #include "zone.h" +#ifdef BOTS +#include "bot.h" +#endif + extern QueryServ* QServ; extern WorldServer worldserver; extern Zone* zone;