From eb7d77bcac0d6e617fc654cef22ac5aaa7b3630b Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 31 Jan 2015 03:48:59 -0500 Subject: [PATCH 1/7] Shared Bank bug fix? --- common/shareddb.cpp | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/common/shareddb.cpp b/common/shareddb.cpp index c6158a7c2..159ce13fc 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -438,30 +438,29 @@ bool SharedDatabase::GetSharedBank(uint32 id, Inventory *inv, bool is_charid) } } - if (!row[9]) - continue; + if (row[9]) { + std::string data_str(row[9]); + 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] == '^') { - if (!use_id) { - inst->SetCustomData(idAsString, value); - idAsString.clear(); - value.clear(); + for (int i = 0; i < data_str.length(); ++i) { + if (data_str[i] == '^') { + if (!use_id) { + inst->SetCustomData(idAsString, value); + idAsString.clear(); + value.clear(); + } + use_id = !use_id; + continue; } - use_id = !use_id; - continue; - } - char v = data_str[i]; - if (use_id) - idAsString.push_back(v); - else - value.push_back(v); + char v = data_str[i]; + if (use_id) + idAsString.push_back(v); + else + value.push_back(v); + } } put_slot_id = inv->PutItem(slot_id, *inst); From fe6fa75385bb749ea25dc541aa78a779c89439a3 Mon Sep 17 00:00:00 2001 From: Trevius Date: Sat, 31 Jan 2015 11:44:25 -0600 Subject: [PATCH 2/7] Fixed FindGroundZ() and GetGroundZ() to once again utilize the X and Y arguments that are passed to them. --- changelog.txt | 3 +++ zone/mob.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1eb484f8f..88180df59 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 01/31/2015 == +Trevius: Fixed FindGroundZ() and GetGroundZ() to once again utilize the X and Y arguments that are passed to them. + == 01/30/2015 == Akkadius: Implemented event type "EVENT_ENVIRONMENTAL_DAMAGE" - This event triggers when taking any sort of environmental damage. Example use: diff --git a/zone/mob.cpp b/zone/mob.cpp index c42f26fe4..65419530b 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -3092,8 +3092,8 @@ float Mob::FindGroundZ(float new_x, float new_y, float z_offset) if (zone->zonemap != nullptr) { glm::vec3 me; - me.x = m_Position.x; - me.y = m_Position.y; + me.x = new_x; + me.y = new_y; me.z = m_Position.z + z_offset; glm::vec3 hit; float best_z = zone->zonemap->FindBestZ(me, &hit); @@ -3112,8 +3112,8 @@ float Mob::GetGroundZ(float new_x, float new_y, float z_offset) if (zone->zonemap != 0) { glm::vec3 me; - me.x = m_Position.x; - me.y = m_Position.y; + me.x = new_x; + me.y = new_y; me.z = m_Position.z+z_offset; glm::vec3 hit; float best_z = zone->zonemap->FindBestZ(me, &hit); From 1e8916ee9856ffd040c25170fa828cedf64bbf1e Mon Sep 17 00:00:00 2001 From: Russell Kinasz Date: Sat, 31 Jan 2015 11:11:06 -0800 Subject: [PATCH 3/7] RoF+ can send 200 items in merchantlist --- zone/client_process.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 1f3db5631..57a8c0eeb 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -960,6 +960,9 @@ void Client::BulkSendInventoryItems() void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { const Item_Struct* handyitem = nullptr; uint32 numItemSlots = 80; //The max number of items passed in the transaction. + if (ClientVersionBit & BIT_RoFAndLater) { // RoF+ can send 200 items + numItemSlots = 200; + } const Item_Struct *item; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; From 2763fe36a34d8686a6650009e3b2c09fab8172de Mon Sep 17 00:00:00 2001 From: Russell Kinasz Date: Sat, 31 Jan 2015 11:17:28 -0800 Subject: [PATCH 4/7] RoF+ can send 200 items in merchantlist --- zone/client_process.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 57a8c0eeb..bddc874c2 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -960,9 +960,9 @@ void Client::BulkSendInventoryItems() void Client::BulkSendMerchantInventory(int merchant_id, int npcid) { const Item_Struct* handyitem = nullptr; uint32 numItemSlots = 80; //The max number of items passed in the transaction. - if (ClientVersionBit & BIT_RoFAndLater) { // RoF+ can send 200 items - numItemSlots = 200; - } + if (ClientVersionBit & BIT_RoFAndLater) { // RoF+ can send 200 items + numItemSlots = 200; + } const Item_Struct *item; std::list merlist = zone->merchanttable[merchant_id]; std::list::const_iterator itr; From 17d276cd4e051a399c905ee71bab5a25d91e0428 Mon Sep 17 00:00:00 2001 From: JJ Date: Sat, 31 Jan 2015 15:22:03 -0500 Subject: [PATCH 5/7] Finish proper SQL. [skip ci] --- utils/sql/git/required/2015_01_28_quest_debug_log_category.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/sql/git/required/2015_01_28_quest_debug_log_category.sql b/utils/sql/git/required/2015_01_28_quest_debug_log_category.sql index 0f4f22807..98f030dff 100644 --- a/utils/sql/git/required/2015_01_28_quest_debug_log_category.sql +++ b/utils/sql/git/required/2015_01_28_quest_debug_log_category.sql @@ -1 +1 @@ -INSERT INTO `logsys_categories` (`log_category_id`, `log_category_description`, `log_to_gmsay`) VALUES ('38', 'Quest Debug', '1') \ No newline at end of file +INSERT INTO `logsys_categories` (`log_category_id`, `log_category_description`, `log_to_gmsay`) VALUES ('38', 'Quest Debug', '1'); From 96925f0dde74ccf88209232a1d10319469374d28 Mon Sep 17 00:00:00 2001 From: JJ Date: Sat, 31 Jan 2015 17:03:44 -0500 Subject: [PATCH 6/7] Some minor cleanup. [skip ci] --- common/database.h | 6 +++--- common/eq_constants.h | 2 +- common/eq_packet_structs.h | 8 ++++---- common/eqemu_logsys.cpp | 10 +++++----- common/eqemu_logsys.h | 8 ++++---- common/patches/rof2_structs.h | 6 +++--- common/patches/rof_structs.h | 6 +++--- common/patches/sod_structs.h | 8 ++++---- common/patches/sof_structs.h | 8 ++++---- common/patches/titanium_structs.h | 8 ++++---- common/patches/uf_structs.h | 6 +++--- common/spdat.cpp | 2 +- common/spdat.h | 2 +- common/string_util.cpp | 2 +- world/client.cpp | 8 ++++---- world/worlddb.cpp | 2 +- world/zoneserver.cpp | 2 +- zone/aggro.cpp | 8 ++++---- zone/attack.cpp | 6 +++--- zone/beacon.cpp | 4 ++-- zone/bot.cpp | 4 ++-- zone/client_packet.cpp | 9 --------- zone/common.h | 2 +- zone/corpse.cpp | 2 +- zone/effects.cpp | 4 ++-- zone/inventory.cpp | 4 ++-- zone/mob.cpp | 2 +- zone/mob.h | 2 +- zone/special_attacks.cpp | 2 +- zone/worldserver.cpp | 2 +- 30 files changed, 68 insertions(+), 77 deletions(-) diff --git a/common/database.h b/common/database.h index b0be7b846..f3b8ba8c1 100644 --- a/common/database.h +++ b/common/database.h @@ -107,9 +107,9 @@ public: /* General Information Queries */ - bool AddBannedIP(char* bannedIP, const char* notes); //Lieka Edit: Add IP address to the Banned_IPs table. + bool AddBannedIP(char* bannedIP, const char* notes); //Add IP address to the Banned_IPs table. bool AddGMIP(char* ip_address, char* name); - bool CheckBannedIPs(const char* loginIP); //Lieka Edit: Check incoming connection against banned IP table. + bool CheckBannedIPs(const char* loginIP); //Check incoming connection against banned IP table. bool CheckGMIPs(const char* loginIP, uint32 account_id); bool CheckNameFilter(const char* name, bool surname = false); bool CheckUsedName(const char* name); @@ -118,7 +118,7 @@ public: uint32 GetAccountIDByChar(uint32 char_id); uint32 GetAccountIDByName(const char* accname, int16* status = 0, uint32* lsid = 0); uint32 GetCharacterID(const char *name); - uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0,float* oX = 0, float* oY = 0, float* oZ = 0); + uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0, float* oX = 0, float* oY = 0, float* oZ = 0); uint32 GetGuildIDByCharID(uint32 char_id); void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0); diff --git a/common/eq_constants.h b/common/eq_constants.h index 3ff7abd6b..14f695069 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -368,7 +368,7 @@ enum { #define AT_DamageState 44 // The damage state of a destructible object (0 through 4) //#define AT_Trader 300 // Bazzar Trader Mode -// solar: animations for AT_Anim +// animations for AT_Anim #define ANIM_FREEZE 102 #define ANIM_STAND 0x64 #define ANIM_SIT 0x6e diff --git a/common/eq_packet_structs.h b/common/eq_packet_structs.h index a85e45be4..62f6072b3 100644 --- a/common/eq_packet_structs.h +++ b/common/eq_packet_structs.h @@ -540,7 +540,7 @@ struct SpawnAppearance_Struct }; -// solar: this is used inside profile +// this is used inside profile struct SpellBuff_Struct { /*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise @@ -1268,7 +1268,7 @@ struct Animation_Struct { /*04*/ }; -// solar: this is what causes the caster to animate and the target to +// this is what causes the caster to animate and the target to // get the particle effects around them when a spell is cast // also causes a buff icon struct Action_Struct @@ -1292,7 +1292,7 @@ struct Action_Struct /* 31 */ }; -// solar: this is what prints the You have been struck. and the regular +// this is what prints the You have been struck. and the regular // melee messages like You try to pierce, etc. It's basically the melee // and spell damage message struct CombatDamage_Struct @@ -1811,7 +1811,7 @@ struct RandomReq_Struct { uint32 high; }; -/* solar: 9/23/03 reply to /random command; struct from Zaphod */ +/* 9/23/03 reply to /random command */ struct RandomReply_Struct { /* 00 */ uint32 low; /* 04 */ uint32 high; diff --git a/common/eqemu_logsys.cpp b/common/eqemu_logsys.cpp index 7f462696b..51b069f28 100644 --- a/common/eqemu_logsys.cpp +++ b/common/eqemu_logsys.cpp @@ -72,7 +72,7 @@ namespace Console { LightRed = 12, LightMagenta = 13, Yellow = 14, - White = 15, + White = 15 }; } @@ -174,7 +174,7 @@ void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const process_log << time_stamp << " " << message << std::endl; } -uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){ +uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category) { switch (log_category) { case Logs::Status: case Logs::Normal: @@ -197,7 +197,7 @@ uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category){ } } -std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category){ +std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category) { switch (log_category) { case Logs::Status: case Logs::Normal: @@ -220,7 +220,7 @@ std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category){ } } -uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category){ +uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) { switch (log_category) { case Logs::Status: case Logs::Normal: @@ -317,7 +317,7 @@ void EQEmuLogSys::MakeDirectory(const std::string &directory_name) void EQEmuLogSys::CloseFileLogs() { - if (process_log.is_open()){ + if (process_log.is_open()) { process_log.close(); } } diff --git a/common/eqemu_logsys.h b/common/eqemu_logsys.h index 1bd63d5b5..97aaebe62 100644 --- a/common/eqemu_logsys.h +++ b/common/eqemu_logsys.h @@ -26,11 +26,11 @@ #include "types.h" -namespace Logs{ +namespace Logs { enum DebugLevel { General = 1, /* 1 - Low-Level general debugging, useful info on single line */ Moderate, /* 2 - Informational based, used in functions, when particular things load */ - Detail, /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ + Detail /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */ }; /* @@ -121,7 +121,7 @@ namespace Logs{ "MySQL Error", "MySQL Query", "Mercenaries", - "Quest Debug", + "Quest Debug" }; } @@ -156,7 +156,7 @@ public: log_to_gmsay[category_id] = [1-3] - Sets debug level for category to output to gmsay */ - struct LogSettings{ + struct LogSettings { uint8 log_to_file; uint8 log_to_console; uint8 log_to_gmsay; diff --git a/common/patches/rof2_structs.h b/common/patches/rof2_structs.h index d3b3a852d..dd9bfb587 100644 --- a/common/patches/rof2_structs.h +++ b/common/patches/rof2_structs.h @@ -1394,7 +1394,7 @@ struct Animation_Struct { /*04*/ }; -// solar: this is what causes the caster to animate and the target to +// this is what causes the caster to animate and the target to // get the particle effects around them when a spell is cast // also causes a buff icon struct Action_Struct @@ -1445,7 +1445,7 @@ struct ActionAlt_Struct /*56*/ }; -// solar: this is what prints the You have been struck. and the regular +// this is what prints the You have been struck. and the regular // melee messages like You try to pierce, etc. It's basically the melee // and spell damage message struct CombatDamage_Struct @@ -1997,7 +1997,7 @@ struct RandomReq_Struct { uint32 high; }; -/* solar: 9/23/03 reply to /random command; struct from Zaphod */ +/* 9/23/03 reply to /random command */ struct RandomReply_Struct { /* 00 */ uint32 low; /* 04 */ uint32 high; diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index b2c1c3c6c..eb531e4d5 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -1425,7 +1425,7 @@ struct Animation_Struct { /*04*/ }; -// solar: this is what causes the caster to animate and the target to +// this is what causes the caster to animate and the target to // get the particle effects around them when a spell is cast // also causes a buff icon struct Action_Struct @@ -1476,7 +1476,7 @@ struct ActionAlt_Struct /*56*/ }; -// solar: this is what prints the You have been struck. and the regular +// this is what prints the You have been struck. and the regular // melee messages like You try to pierce, etc. It's basically the melee // and spell damage message struct CombatDamage_Struct @@ -2028,7 +2028,7 @@ struct RandomReq_Struct { uint32 high; }; -/* solar: 9/23/03 reply to /random command; struct from Zaphod */ +/* 9/23/03 reply to /random command */ struct RandomReply_Struct { /* 00 */ uint32 low; /* 04 */ uint32 high; diff --git a/common/patches/sod_structs.h b/common/patches/sod_structs.h index 46cfa871e..810c59b1e 100644 --- a/common/patches/sod_structs.h +++ b/common/patches/sod_structs.h @@ -538,7 +538,7 @@ struct SpawnAppearance_Struct }; -// solar: this is used inside profile +// this is used inside profile struct SpellBuff_Struct { /*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise @@ -1196,7 +1196,7 @@ struct Animation_Struct { /*04*/ }; -// solar: this is what causes the caster to animate and the target to +// this is what causes the caster to animate and the target to // get the particle effects around them when a spell is cast // also causes a buff icon struct Action_Struct @@ -1248,7 +1248,7 @@ struct ActionAlt_Struct // ActionAlt_Struct - Size: 56 bytes /*0056*/ }; -// solar: this is what prints the You have been struck. and the regular +// this is what prints the You have been struck. and the regular // melee messages like You try to pierce, etc. It's basically the melee // and spell damage message struct CombatDamage_Struct @@ -1791,7 +1791,7 @@ struct RandomReq_Struct { uint32 high; }; -/* solar: 9/23/03 reply to /random command; struct from Zaphod */ +/* 9/23/03 reply to /random command */ struct RandomReply_Struct { /* 00 */ uint32 low; /* 04 */ uint32 high; diff --git a/common/patches/sof_structs.h b/common/patches/sof_structs.h index c5b354ca1..32b275716 100644 --- a/common/patches/sof_structs.h +++ b/common/patches/sof_structs.h @@ -515,7 +515,7 @@ struct SpawnAppearance_Struct }; -// solar: this is used inside profile +// this is used inside profile struct SpellBuff_Struct { /*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise @@ -1172,7 +1172,7 @@ struct Animation_Struct { /*04*/ }; -// solar: this is what causes the caster to animate and the target to +// this is what causes the caster to animate and the target to // get the particle effects around them when a spell is cast // also causes a buff icon struct Action_Struct @@ -1224,7 +1224,7 @@ struct ActionAlt_Struct // ActionAlt_Struct - Size: 56 bytes /*0056*/ }; -// solar: this is what prints the You have been struck. and the regular +// this is what prints the You have been struck. and the regular // melee messages like You try to pierce, etc. It's basically the melee // and spell damage message struct CombatDamage_Struct @@ -1768,7 +1768,7 @@ struct RandomReq_Struct { uint32 high; }; -/* solar: 9/23/03 reply to /random command; struct from Zaphod */ +/* 9/23/03 reply to /random command */ struct RandomReply_Struct { /* 00 */ uint32 low; /* 04 */ uint32 high; diff --git a/common/patches/titanium_structs.h b/common/patches/titanium_structs.h index 54aae91ec..19d82d6af 100644 --- a/common/patches/titanium_structs.h +++ b/common/patches/titanium_structs.h @@ -438,7 +438,7 @@ struct SpawnAppearance_Struct }; -// solar: this is used inside profile +// this is used inside profile struct SpellBuff_Struct { /*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise @@ -1054,7 +1054,7 @@ struct Animation_Struct { /*04*/ }; -// solar: this is what causes the caster to animate and the target to +// this is what causes the caster to animate and the target to // get the particle effects around them when a spell is cast // also causes a buff icon struct Action_Struct @@ -1078,7 +1078,7 @@ struct Action_Struct /* 31 */ }; -// solar: this is what prints the You have been struck. and the regular +// this is what prints the You have been struck. and the regular // melee messages like You try to pierce, etc. It's basically the melee // and spell damage message struct CombatDamage_Struct @@ -1516,7 +1516,7 @@ struct RandomReq_Struct { uint32 high; }; -/* solar: 9/23/03 reply to /random command; struct from Zaphod */ +/* 9/23/03 reply to /random command */ struct RandomReply_Struct { /* 00 */ uint32 low; /* 04 */ uint32 high; diff --git a/common/patches/uf_structs.h b/common/patches/uf_structs.h index 964c0da99..fb4d00de3 100644 --- a/common/patches/uf_structs.h +++ b/common/patches/uf_structs.h @@ -1250,7 +1250,7 @@ struct Animation_Struct { /*04*/ }; -// solar: this is what causes the caster to animate and the target to +// this is what causes the caster to animate and the target to // get the particle effects around them when a spell is cast // also causes a buff icon struct Action_Struct @@ -1305,7 +1305,7 @@ struct ActionAlt_Struct /*64*/ }; -// solar: this is what prints the You have been struck. and the regular +// this is what prints the You have been struck. and the regular // melee messages like You try to pierce, etc. It's basically the melee // and spell damage message struct CombatDamage_Struct @@ -1849,7 +1849,7 @@ struct RandomReq_Struct { uint32 high; }; -/* solar: 9/23/03 reply to /random command; struct from Zaphod */ +/* 9/23/03 reply to /random command */ struct RandomReply_Struct { /* 00 */ uint32 low; /* 04 */ uint32 high; diff --git a/common/spdat.cpp b/common/spdat.cpp index 4b847b75e..e52a06e2e 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -19,7 +19,7 @@ /* - solar: General outline of spell casting process + General outline of spell casting process 1. a) Client clicks a spell bar gem, ability, or item. client_process.cpp diff --git a/common/spdat.h b/common/spdat.h index ed8a86e20..b70d708f0 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -618,7 +618,7 @@ typedef enum { #define DF_Permanent 50 -// solar: note this struct is historical, we don't actually need it to be +// note this struct is historical, we don't actually need it to be // aligned to anything, but for maintaining it it is kept in the order that // the fields in the text file are. the numbering is not offset, but field // number. note that the id field is counted as 0, this way the numbers diff --git a/common/string_util.cpp b/common/string_util.cpp index eb1f333f0..a7e5f2af1 100644 --- a/common/string_util.cpp +++ b/common/string_util.cpp @@ -256,7 +256,7 @@ bool atobool(const char* iBool) { return false; } -// solar: removes the crap and turns the underscores into spaces. +// removes the crap and turns the underscores into spaces. char *CleanMobName(const char *in, char *out) { unsigned i, j; diff --git a/world/client.cpp b/world/client.cpp index 5d6f07b11..ace58ffea 100644 --- a/world/client.cpp +++ b/world/client.cpp @@ -1616,7 +1616,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) int Charerrors = 0; -// solar: if this is increased you'll have to add a column to the classrace +// if this is increased you'll have to add a column to the classrace // table below #define _TABLE_RACES 16 @@ -1678,7 +1678,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) { /*Enchanter*/ true, false, true, false, true, true, false, false, false, false, false, true, false, false, false, true}, { /*Beastlord*/ false, true, false, false, false, false, false, false, true, true, false, false, true, true, false, false}, { /*Berserker*/ false, true, false, false, false, false, false, true, true, true, false, false, false, true, false, false} - };//Initial table by kathgar, editted by Wiz for accuracy, solar too + }; if (!cc) return false; @@ -1711,7 +1711,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) return false; } - // solar: add up the base values for this class/race + // add up the base values for this class/race // this is what they start with, and they have stat_points more // that can distributed bSTR = BaseClass[classtemp][0] + BaseRace[racetemp][0]; @@ -1725,7 +1725,7 @@ bool CheckCharCreateInfoTitanium(CharCreate_Struct *cc) bTOTAL = bSTR + bSTA + bAGI + bDEX + bWIS + bINT + bCHA; cTOTAL = cc->STR + cc->STA + cc->AGI + cc->DEX + cc->WIS + cc->INT + cc->CHA; - // solar: the first check makes sure the total is exactly what was expected. + // the first check makes sure the total is exactly what was expected. // this will catch all the stat cheating, but there's still the issue // of reducing CHA or INT or something, to use for STR, so we check // that none are lower than the base or higher than base + stat_points diff --git a/world/worlddb.cpp b/world/worlddb.cpp index c8b95d0a9..223ae89d6 100644 --- a/world/worlddb.cpp +++ b/world/worlddb.cpp @@ -32,7 +32,7 @@ extern std::vector character_create_allocations; extern std::vector character_create_race_class_combos; -// solar: the current stuff is at the bottom of this function +// the current stuff is at the bottom of this function void WorldDatabase::GetCharSelectInfo(uint32 account_id, CharacterSelect_Struct* cs, uint32 ClientVersion) { Inventory *inv; uint8 has_home = 0; diff --git a/world/zoneserver.cpp b/world/zoneserver.cpp index 3efb7e4be..e24dc421c 100644 --- a/world/zoneserver.cpp +++ b/world/zoneserver.cpp @@ -665,7 +665,7 @@ bool ZoneServer::Process() { } case ServerOP_ZoneToZoneRequest: { // - // solar: ZoneChange is received by the zone the player is in, then the + // ZoneChange is received by the zone the player is in, then the // zone sends a ZTZ which ends up here. This code then find the target // (ingress point) and boots it if needed, then sends the ZTZ to it. // The ingress server will decide wether the player can enter, then will diff --git a/zone/aggro.cpp b/zone/aggro.cpp index 9ba9f6c8f..e983b8ea9 100644 --- a/zone/aggro.cpp +++ b/zone/aggro.cpp @@ -481,7 +481,7 @@ void EntityList::AIYellForHelp(Mob* sender, Mob* attacker) { } /* -solar: returns false if attack should not be allowed +returns false if attack should not be allowed I try to list every type of conflict that's possible here, so it's easy to see how the decision is made. Yea, it could be condensed and made faster, but I'm doing it this way to make it readable and easy to modify @@ -550,7 +550,7 @@ bool Mob::IsAttackAllowed(Mob *target, bool isSpellAttack) } } - // solar: the format here is a matrix of mob type vs mob type. + // the format here is a matrix of mob type vs mob type. // redundant ones are omitted and the reverse is tried if it falls through. // first figure out if we're pets. we always look at the master's flags. @@ -701,7 +701,7 @@ type', in which case, the answer is yes. } -// solar: this is to check if non detrimental things are allowed to be done +// this is to check if non detrimental things are allowed to be done // to the target. clients cannot affect npcs and vice versa, and clients // cannot affect other clients that are not of the same pvp flag as them. // also goes for their pets @@ -717,7 +717,7 @@ bool Mob::IsBeneficialAllowed(Mob *target) if (target->GetAllowBeneficial()) return true; - // solar: see IsAttackAllowed for notes + // see IsAttackAllowed for notes // first figure out if we're pets. we always look at the master's flags. // no need to compare pets to anything diff --git a/zone/attack.cpp b/zone/attack.cpp index eae49c57a..25dc88688 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -343,7 +343,7 @@ bool Mob::CheckHitChance(Mob* other, SkillUseTypes skillinuse, int Hand, int16 c bool Mob::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) { - /* solar: called when a mob is attacked, does the checks to see if it's a hit + /* called when a mob is attacked, does the checks to see if it's a hit * and does other mitigation checks. 'this' is the mob being attacked. * * special return values: @@ -1378,7 +1378,7 @@ void Client::Damage(Mob* other, int32 damage, uint16 spell_id, SkillUseTypes att if(spell_id==0) spell_id = SPELL_UNKNOWN; - // cut all PVP spell damage to 2/3 -solar + // cut all PVP spell damage to 2/3 // Blasting ourselfs is considered PvP //Don't do PvP mitigation if the caster is damaging himself if(other && other->IsClient() && (other != this) && damage > 0) { @@ -2545,7 +2545,7 @@ void Mob::AddToHateList(Mob* other, uint32 hate /*= 0*/, int32 damage /*= 0*/, b } } -// solar: this is called from Damage() when 'this' is attacked by 'other. +// this is called from Damage() when 'this' is attacked by 'other. // 'this' is the one being attacked // 'other' is the attacker // a damage shield causes damage (or healing) to whoever attacks the wearer diff --git a/zone/beacon.cpp b/zone/beacon.cpp index aa44b2504..5a952dc9d 100644 --- a/zone/beacon.cpp +++ b/zone/beacon.cpp @@ -18,7 +18,7 @@ /* -solar: Beacon class, extends Mob. Used for AE rain spells to have a mob +Beacon class, extends Mob. Used for AE rain spells to have a mob target to center around. */ @@ -48,7 +48,7 @@ class Zone; extern EntityList entity_list; extern Zone* zone; -// solar: if lifetime is 0 this is a permanent beacon.. not sure if that'll be +// if lifetime is 0 this is a permanent beacon.. not sure if that'll be // useful for anything Beacon::Beacon(Mob *at_mob, int lifetime) :Mob diff --git a/zone/bot.cpp b/zone/bot.cpp index f7e6dbc32..c39696576 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -7406,7 +7406,7 @@ float Bot::GetProcChances(float ProcBonus, uint16 hand) { bool Bot::AvoidDamage(Mob* other, int32 &damage, bool CanRiposte) { - /* solar: called when a mob is attacked, does the checks to see if it's a hit + /* called when a mob is attacked, does the checks to see if it's a hit * and does other mitigation checks. 'this' is the mob being attacked. * * special return values: @@ -7781,7 +7781,7 @@ void Bot::TryBackstab(Mob *other, int ReuseTime) { if (bIsBehind || bCanFrontalBS){ // Bot is behind other OR can do Frontal Backstab - // solar - chance to assassinate + // chance to assassinate int chance = 10 + (GetDEX()/10) + (itembonuses.HeroicDEX/10); //18.5% chance at 85 dex 40% chance at 300 dex if( level >= 60 && // bot is 60 or higher diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index ea919f344..c4e449db5 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -413,15 +413,6 @@ int Client::HandlePacket(const EQApplicationPacket *app) std::cout << "Received 0x" << std::hex << std::setw(4) << std::setfill('0') << opcode << ", size=" << std::dec << app->size << std::endl; #endif - #ifdef SOLAR - if(0 && opcode != OP_ClientUpdate) - { - Log.LogDebug(Logs::General,"HandlePacket() OPCODE debug enabled client %s", GetName()); - std::cerr << "OPCODE: " << std::hex << std::setw(4) << std::setfill('0') << opcode << std::dec << ", size: " << app->size << std::endl; - DumpPacket(app); - } - #endif - switch(client_state) { case CLIENT_CONNECTING: { if(ConnectingOpcodes.count(opcode) != 1) { diff --git a/zone/common.h b/zone/common.h index 8ec520646..19237d99c 100644 --- a/zone/common.h +++ b/zone/common.h @@ -7,7 +7,7 @@ #define HIGHEST_RESIST 9 //Max resist type value #define MAX_SPELL_PROJECTILE 10 //Max amount of spell projectiles that can be active by a single mob. -/* solar: macros for IsAttackAllowed, IsBeneficialAllowed */ +/* macros for IsAttackAllowed, IsBeneficialAllowed */ #define _CLIENT(x) (x && x->IsClient() && !x->CastToClient()->IsBecomeNPC()) #define _NPC(x) (x && x->IsNPC() && !x->CastToMob()->GetOwnerID()) #define _BECOMENPC(x) (x && x->IsClient() && x->CastToClient()->IsBecomeNPC()) diff --git a/zone/corpse.cpp b/zone/corpse.cpp index 261a4ce02..36e585ea2 100644 --- a/zone/corpse.cpp +++ b/zone/corpse.cpp @@ -318,7 +318,7 @@ Corpse::Corpse(Client* client, int32 in_rezexp) : Mob ( // get their tints memcpy(item_tint, &client->GetPP().item_tint, sizeof(item_tint)); - // solar: TODO soulbound items need not be added to corpse, but they need + // TODO soulbound items need not be added to corpse, but they need // to go into the regular slots on the player, out of bags std::list removed_list; diff --git a/zone/effects.cpp b/zone/effects.cpp index cc5f6ebdc..802fce796 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -684,7 +684,7 @@ void EntityList::AETaunt(Client* taunter, float range) } } -// solar: causes caster to hit every mob within dist range of center with +// causes caster to hit every mob within dist range of center with // spell_id. // NPC spells will only affect other NPCs with compatible faction void EntityList::AESpell(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster, int16 resist_adjust) @@ -820,7 +820,7 @@ void EntityList::MassGroupBuff(Mob *caster, Mob *center, uint16 spell_id, bool a } } -// solar: causes caster to hit every mob within dist range of center with +// causes caster to hit every mob within dist range of center with // a bard pulse of spell_id. // NPC spells will only affect other NPCs with compatible faction void EntityList::AEBardPulse(Mob *caster, Mob *center, uint16 spell_id, bool affect_caster) diff --git a/zone/inventory.cpp b/zone/inventory.cpp index b5ca717d3..1da2fb13d 100644 --- a/zone/inventory.cpp +++ b/zone/inventory.cpp @@ -879,7 +879,7 @@ void Client::PutLootInInventory(int16 slot_id, const ItemInst &inst, ServerLootI if(bag_item_data) { // bag contents int16 interior_slot; - // solar: our bag went into slot_id, now let's pack the contents in + // our bag went into slot_id, now let's pack the contents in for(int i = SUB_BEGIN; i < EmuConstants::ITEM_CONTAINER_SIZE; i++) { if(bag_item_data[i] == nullptr) continue; @@ -993,7 +993,7 @@ bool Client::AutoPutLootInInventory(ItemInst& inst, bool try_worn, bool try_curs return false; } -// solar: helper function for AutoPutLootInInventory +// helper function for AutoPutLootInInventory void Client::MoveItemCharges(ItemInst &from, int16 to_slot, uint8 type) { ItemInst *tmp_inst = m_inv.GetItem(to_slot); diff --git a/zone/mob.cpp b/zone/mob.cpp index 65419530b..a54881298 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -2792,7 +2792,7 @@ void Mob::Say(const char *format, ...) } // -// solar: this is like the above, but the first parameter is a string id +// this is like the above, but the first parameter is a string id // void Mob::Say_StringID(uint32 string_id, const char *message3, const char *message4, const char *message5, const char *message6, const char *message7, const char *message8, const char *message9) { diff --git a/zone/mob.h b/zone/mob.h index 51717d50b..9641a2ffb 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -123,7 +123,7 @@ public: //Attack virtual void RogueBackstab(Mob* other, bool min_damage = false, int ReuseTime = 10); - virtual void RogueAssassinate(Mob* other); // solar + virtual void RogueAssassinate(Mob* other); float MobAngle(Mob *other = 0, float ourx = 0.0f, float oury = 0.0f) const; // greater than 90 is behind inline bool BehindMob(Mob *other = 0, float ourx = 0.0f, float oury = 0.0f) const diff --git a/zone/special_attacks.cpp b/zone/special_attacks.cpp index f0dc413e1..c0844c2ac 100644 --- a/zone/special_attacks.cpp +++ b/zone/special_attacks.cpp @@ -663,7 +663,7 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime) DoAnim(animPiercing); } -// solar - assassinate [Kayen: No longer used for regular assassinate 6-29-14] +// assassinate [No longer used for regular assassinate 6-29-14] void Mob::RogueAssassinate(Mob* other) { //can you dodge, parry, etc.. an assassinate?? diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 9ee1fe3a6..ec2893e05 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -647,7 +647,7 @@ void WorldServer::Process() { case ServerOP_Petition: { std::cout << "Got Server Requested Petition List Refresh" << std::endl; ServerPetitionUpdate_Struct* sus = (ServerPetitionUpdate_Struct*) pack->pBuffer; - // solar: this was typoed to = instead of ==, not that it acts any different now though.. + // this was typoed to = instead of ==, not that it acts any different now though.. if (sus->status == 0) petition_list.ReadDatabase(); else if (sus->status == 1) petition_list.ReadDatabase(); // Until I fix this to be better.... break; From b5d45effec32893794a31a0346160389a067a469 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 31 Jan 2015 17:33:41 -0500 Subject: [PATCH 7/7] Fix some zone/npc.cpp functions --- zone/npc.cpp | 337 +++++++++++++++++++++++---------------------------- 1 file changed, 153 insertions(+), 184 deletions(-) diff --git a/zone/npc.cpp b/zone/npc.cpp index 1375559a5..9a142f128 100644 --- a/zone/npc.cpp +++ b/zone/npc.cpp @@ -987,298 +987,267 @@ NPC* NPC::SpawnNPC(const char* spawncommand, const glm::vec4& position, Client* } } -uint32 ZoneDatabase::CreateNewNPCCommand(const char* zone, uint32 zone_version,Client *client, NPC* spawn, uint32 extra) { +uint32 ZoneDatabase::CreateNewNPCCommand(const char *zone, uint32 zone_version, Client *client, NPC *spawn, + uint32 extra) +{ + uint32 npc_type_id = 0; - uint32 npc_type_id = 0; - - if (extra && client && client->GetZoneID()) - { + if (extra && client && client->GetZoneID()) { // Set an npc_type ID within the standard range for the current zone if possible (zone_id * 1000) int starting_npc_id = client->GetZoneID() * 1000; std::string query = StringFormat("SELECT MAX(id) FROM npc_types WHERE id >= %i AND id < %i", - starting_npc_id, starting_npc_id + 1000); - auto results = QueryDatabase(query); + starting_npc_id, starting_npc_id + 1000); + auto results = QueryDatabase(query); if (results.Success()) { - if (results.RowCount() != 0) - { - auto row = results.begin(); - npc_type_id = atoi(row[0]) + 1; - // Prevent the npc_type id from exceeding the range for this zone - if (npc_type_id >= (starting_npc_id + 1000)) - npc_type_id = 0; - } - else // No npc_type IDs set in this range yet - npc_type_id = starting_npc_id; - } - } + if (results.RowCount() != 0) { + auto row = results.begin(); + npc_type_id = atoi(row[0]) + 1; + // Prevent the npc_type id from exceeding the range for this zone + if (npc_type_id >= (starting_npc_id + 1000)) + npc_type_id = 0; + } else // No npc_type IDs set in this range yet + npc_type_id = starting_npc_id; + } + } char tmpstr[64]; EntityList::RemoveNumbers(strn0cpy(tmpstr, spawn->GetName(), sizeof(tmpstr))); std::string query; - if (npc_type_id) - { - query = StringFormat("INSERT INTO npc_types (id, name, level, race, class, hp, gender, " - "texture, helmtexture, size, loottable_id, merchant_id, face, " - "runspeed, prim_melee_type, sec_melee_type) " - "VALUES(%i, \"%s\" , %i, %i, %i, %i, %i, %i, %i, %f, %i, %i, %i, %f, %i, %i)", - npc_type_id, tmpstr, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), - spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), - spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), - spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); - auto results = QueryDatabase(query); + if (npc_type_id) { + query = StringFormat("INSERT INTO npc_types (id, name, level, race, class, hp, gender, " + "texture, helmtexture, size, loottable_id, merchant_id, face, " + "runspeed, prim_melee_type, sec_melee_type) " + "VALUES(%i, \"%s\" , %i, %i, %i, %i, %i, %i, %i, %f, %i, %i, %i, %f, %i, %i)", + npc_type_id, tmpstr, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), + spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), + spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), + spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); + auto results = QueryDatabase(query); + if (!results.Success()) { + return false; + } + npc_type_id = results.LastInsertedID(); + } else { + query = StringFormat("INSERT INTO npc_types (name, level, race, class, hp, gender, " + "texture, helmtexture, size, loottable_id, merchant_id, face, " + "runspeed, prim_melee_type, sec_melee_type) " + "VALUES(\"%s\", %i, %i, %i, %i, %i, %i, %i, %f, %i, %i, %i, %f, %i, %i)", + tmpstr, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), spawn->GetMaxHP(), + spawn->GetGender(), spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(), + spawn->GetLoottableID(), spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); + auto results = QueryDatabase(query); if (!results.Success()) { return false; } npc_type_id = results.LastInsertedID(); } - else - { - query = StringFormat("INSERT INTO npc_types (name, level, race, class, hp, gender, " - "texture, helmtexture, size, loottable_id, merchant_id, face, " - "runspeed, prim_melee_type, sec_melee_type) " - "VALUES(\"%s\", %i, %i, %i, %i, %i, %i, %i, %f, %i, %i, %i, %f, %i, %i)", - tmpstr, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), - spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), - spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), - spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); - auto results = QueryDatabase(query); - if (!results.Success()) { - return false; - } - npc_type_id = results.LastInsertedID(); - } - - if(client) query = StringFormat("INSERT INTO spawngroup (id, name) VALUES(%i, '%s-%s')", 0, zone, spawn->GetName()); - auto results = QueryDatabase(query); + auto results = QueryDatabase(query); if (!results.Success()) { return false; } - uint32 spawngroupid = results.LastInsertedID(); + uint32 spawngroupid = results.LastInsertedID(); - if(client) - - query = StringFormat("INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) " - "VALUES('%s', %u, %f, %f, %f, %i, %f, %i)", - zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(), 1200, - spawn->GetHeading(), spawngroupid); - results = QueryDatabase(query); + query = StringFormat("INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) " + "VALUES('%s', %u, %f, %f, %f, %i, %f, %i)", + zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(), 1200, spawn->GetHeading(), + spawngroupid); + results = QueryDatabase(query); if (!results.Success()) { return false; } - if(client) - - query = StringFormat("INSERT INTO spawnentry (spawngroupID, npcID, chance) VALUES(%i, %i, %i)", - spawngroupid, npc_type_id, 100); - results = QueryDatabase(query); + query = StringFormat("INSERT INTO spawnentry (spawngroupID, npcID, chance) VALUES(%i, %i, %i)", spawngroupid, + npc_type_id, 100); + results = QueryDatabase(query); if (!results.Success()) { return false; } - if(client) - return true; } -uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 respawnTime) { - uint32 last_insert_id = 0; +uint32 ZoneDatabase::AddNewNPCSpawnGroupCommand(const char *zone, uint32 zone_version, Client *client, NPC *spawn, + uint32 respawnTime) +{ + uint32 last_insert_id = 0; - std::string query = StringFormat("INSERT INTO spawngroup (name) VALUES('%s%s%i')", - zone, spawn->GetName(), Timer::GetCurrentTime()); - auto results = QueryDatabase(query); + std::string query = StringFormat("INSERT INTO spawngroup (name) VALUES('%s%s%i')", zone, spawn->GetName(), + Timer::GetCurrentTime()); + auto results = QueryDatabase(query); if (!results.Success()) { return 0; } - last_insert_id = results.LastInsertedID(); + last_insert_id = results.LastInsertedID(); - uint32 respawntime = 0; - uint32 spawnid = 0; - if (respawnTime) - respawntime = respawnTime; - else if(spawn->respawn2 && spawn->respawn2->RespawnTimer() != 0) - respawntime = spawn->respawn2->RespawnTimer(); - else - respawntime = 1200; + uint32 respawntime = 0; + uint32 spawnid = 0; + if (respawnTime) + respawntime = respawnTime; + else if (spawn->respawn2 && spawn->respawn2->RespawnTimer() != 0) + respawntime = spawn->respawn2->RespawnTimer(); + else + respawntime = 1200; - query = StringFormat("INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) " - "VALUES('%s', %u, %f, %f, %f, %i, %f, %i)", - zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(), respawntime, - spawn->GetHeading(), last_insert_id); - results = QueryDatabase(query); - if (!results.Success()) { - return 0; - } - spawnid = results.LastInsertedID(); + query = StringFormat("INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) " + "VALUES('%s', %u, %f, %f, %f, %i, %f, %i)", + zone, zone_version, spawn->GetX(), spawn->GetY(), spawn->GetZ(), respawntime, + spawn->GetHeading(), last_insert_id); + results = QueryDatabase(query); + if (!results.Success()) { + return 0; + } + spawnid = results.LastInsertedID(); - if(client) + query = StringFormat("INSERT INTO spawnentry (spawngroupID, npcID, chance) VALUES(%i, %i, %i)", last_insert_id, + spawn->GetNPCTypeID(), 100); + results = QueryDatabase(query); + if (!results.Success()) { + return 0; + } - query = StringFormat("INSERT INTO spawnentry (spawngroupID, npcID, chance) VALUES(%i, %i, %i)", - last_insert_id, spawn->GetNPCTypeID(), 100); - results = QueryDatabase(query); - if (!results.Success()) { - return 0; - } - - if(client) - - return spawnid; + return spawnid; } -uint32 ZoneDatabase::UpdateNPCTypeAppearance(Client *client, NPC* spawn) { - - std::string query = StringFormat("UPDATE npc_types SET name = \"%s\", level = %i, race = %i, class = %i, " - "hp = %i, gender = %i, texture = %i, helmtexture = %i, size = %i, " - "loottable_id = %i, merchant_id = %i, face = %i, WHERE id = %i", - spawn->GetName(), spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), - spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), - spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), - spawn->MerchantType, spawn->GetNPCTypeID()); - auto results = QueryDatabase(query); - if (!results.Success() && client) - - return results.Success() == true? 1: 0; +uint32 ZoneDatabase::UpdateNPCTypeAppearance(Client *client, NPC *spawn) +{ + std::string query = + StringFormat("UPDATE npc_types SET name = \"%s\", level = %i, race = %i, class = %i, " + "hp = %i, gender = %i, texture = %i, helmtexture = %i, size = %i, " + "loottable_id = %i, merchant_id = %i, face = %i, WHERE id = %i", + spawn->GetName(), spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), spawn->GetMaxHP(), + spawn->GetGender(), spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(), + spawn->GetLoottableID(), spawn->MerchantType, spawn->GetNPCTypeID()); + auto results = QueryDatabase(query); + return results.Success() == true ? 1 : 0; } -uint32 ZoneDatabase::DeleteSpawnLeaveInNPCTypeTable(const char* zone, Client *client, NPC* spawn) { +uint32 ZoneDatabase::DeleteSpawnLeaveInNPCTypeTable(const char *zone, Client *client, NPC *spawn) +{ uint32 id = 0; uint32 spawngroupID = 0; std::string query = StringFormat("SELECT id, spawngroupID FROM spawn2 WHERE " - "zone='%s' AND spawngroupID=%i", zone, spawn->GetSp2()); - auto results = QueryDatabase(query); - if (!results.Success()) + "zone='%s' AND spawngroupID=%i", + zone, spawn->GetSp2()); + auto results = QueryDatabase(query); + if (!results.Success()) return 0; - if (results.RowCount() == 0) - return 0; + if (results.RowCount() == 0) + return 0; auto row = results.begin(); if (row[0]) - id = atoi(row[0]); + id = atoi(row[0]); if (row[1]) - spawngroupID = atoi(row[1]); + spawngroupID = atoi(row[1]); - query = StringFormat("DELETE FROM spawn2 WHERE id = '%i'", id); - results = QueryDatabase(query); + query = StringFormat("DELETE FROM spawn2 WHERE id = '%i'", id); + results = QueryDatabase(query); if (!results.Success()) return 0; - if(client) - - query = StringFormat("DELETE FROM spawngroup WHERE id = '%i'", spawngroupID); - results = QueryDatabase(query); + query = StringFormat("DELETE FROM spawngroup WHERE id = '%i'", spawngroupID); + results = QueryDatabase(query); if (!results.Success()) return 0; - if(client) - - query = StringFormat("DELETE FROM spawnentry WHERE spawngroupID = '%i'", spawngroupID); - results = QueryDatabase(query); + query = StringFormat("DELETE FROM spawnentry WHERE spawngroupID = '%i'", spawngroupID); + results = QueryDatabase(query); if (!results.Success()) return 0; - if(client) - return 1; } -uint32 ZoneDatabase::DeleteSpawnRemoveFromNPCTypeTable(const char* zone, uint32 zone_version, Client *client, NPC* spawn) { - +uint32 ZoneDatabase::DeleteSpawnRemoveFromNPCTypeTable(const char *zone, uint32 zone_version, Client *client, + NPC *spawn) +{ uint32 id = 0; uint32 spawngroupID = 0; std::string query = StringFormat("SELECT id, spawngroupID FROM spawn2 WHERE zone = '%s' " - "AND version = %u AND spawngroupID = %i", - zone, zone_version, spawn->GetSp2()); - auto results = QueryDatabase(query); - if (!results.Success()) + "AND version = %u AND spawngroupID = %i", + zone, zone_version, spawn->GetSp2()); + auto results = QueryDatabase(query); + if (!results.Success()) return 0; - if (results.RowCount() == 0) - return 0; + if (results.RowCount() == 0) + return 0; auto row = results.begin(); if (row[0]) - id = atoi(row[0]); + id = atoi(row[0]); if (row[1]) - spawngroupID = atoi(row[1]); + spawngroupID = atoi(row[1]); - query = StringFormat("DELETE FROM spawn2 WHERE id = '%i'", id); - results = QueryDatabase(query); - if (!results.Success()) - return 0; - - if(client) - - query = StringFormat("DELETE FROM spawngroup WHERE id = '%i'", spawngroupID); + query = StringFormat("DELETE FROM spawn2 WHERE id = '%i'", id); results = QueryDatabase(query); if (!results.Success()) return 0; - if(client) - - query = StringFormat("DELETE FROM spawnentry WHERE spawngroupID = '%i'", spawngroupID); + query = StringFormat("DELETE FROM spawngroup WHERE id = '%i'", spawngroupID); results = QueryDatabase(query); if (!results.Success()) return 0; - if(client) - - query = StringFormat("DELETE FROM npc_types WHERE id = '%i'", spawn->GetNPCTypeID()); + query = StringFormat("DELETE FROM spawnentry WHERE spawngroupID = '%i'", spawngroupID); results = QueryDatabase(query); if (!results.Success()) return 0; - if(client) + query = StringFormat("DELETE FROM npc_types WHERE id = '%i'", spawn->GetNPCTypeID()); + results = QueryDatabase(query); + if (!results.Success()) + return 0; return 1; } -uint32 ZoneDatabase::AddSpawnFromSpawnGroup(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID) { - +uint32 ZoneDatabase::AddSpawnFromSpawnGroup(const char *zone, uint32 zone_version, Client *client, NPC *spawn, + uint32 spawnGroupID) +{ uint32 last_insert_id = 0; - std::string query = StringFormat("INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) " - "VALUES('%s', %u, %f, %f, %f, %i, %f, %i)", - zone, zone_version, client->GetX(), client->GetY(), client->GetZ(), - 120, client->GetHeading(), spawnGroupID); - auto results = QueryDatabase(query); - if (!results.Success()) + std::string query = + StringFormat("INSERT INTO spawn2 (zone, version, x, y, z, respawntime, heading, spawngroupID) " + "VALUES('%s', %u, %f, %f, %f, %i, %f, %i)", + zone, zone_version, client->GetX(), client->GetY(), client->GetZ(), 120, client->GetHeading(), + spawnGroupID); + auto results = QueryDatabase(query); + if (!results.Success()) return 0; - if(client) - - return 1; + return 1; } -uint32 ZoneDatabase::AddNPCTypes(const char* zone, uint32 zone_version, Client *client, NPC* spawn, uint32 spawnGroupID) { - - uint32 npc_type_id; +uint32 ZoneDatabase::AddNPCTypes(const char *zone, uint32 zone_version, Client *client, NPC *spawn, uint32 spawnGroupID) +{ + uint32 npc_type_id; char numberlessName[64]; EntityList::RemoveNumbers(strn0cpy(numberlessName, spawn->GetName(), sizeof(numberlessName))); - std::string query = StringFormat("INSERT INTO npc_types (name, level, race, class, hp, gender, " - "texture, helmtexture, size, loottable_id, merchant_id, face, " - "runspeed, prim_melee_type, sec_melee_type) " - "VALUES(\"%s\", %i, %i, %i, %i, %i, %i, %i, %f, %i, %i, %i, %f, %i, %i)", - numberlessName, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), - spawn->GetMaxHP(), spawn->GetGender(), spawn->GetTexture(), - spawn->GetHelmTexture(), spawn->GetSize(), spawn->GetLoottableID(), - spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); - auto results = QueryDatabase(query); + std::string query = + StringFormat("INSERT INTO npc_types (name, level, race, class, hp, gender, " + "texture, helmtexture, size, loottable_id, merchant_id, face, " + "runspeed, prim_melee_type, sec_melee_type) " + "VALUES(\"%s\", %i, %i, %i, %i, %i, %i, %i, %f, %i, %i, %i, %f, %i, %i)", + numberlessName, spawn->GetLevel(), spawn->GetRace(), spawn->GetClass(), spawn->GetMaxHP(), + spawn->GetGender(), spawn->GetTexture(), spawn->GetHelmTexture(), spawn->GetSize(), + spawn->GetLoottableID(), spawn->MerchantType, 0, spawn->GetRunspeed(), 28, 28); + auto results = QueryDatabase(query); if (!results.Success()) return 0; - npc_type_id = results.LastInsertedID(); + npc_type_id = results.LastInsertedID(); - if(client) - - if(client) - client->Message(0, "%s npc_type ID %i created successfully!", numberlessName, npc_type_id); + if (client) + client->Message(0, "%s npc_type ID %i created successfully!", numberlessName, npc_type_id); return 1; }