diff --git a/common/ruletypes.h b/common/ruletypes.h index 5c6ff6d3a..37f47b21d 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -419,6 +419,7 @@ RULE_BOOL(Combat, EnableFearPathing, true) RULE_REAL(Combat, FleeMultiplier, 2.0) // Determines how quickly a NPC will slow down while fleeing. Decrease multiplier to slow NPC down quicker. RULE_BOOL(Combat, FleeGray, true) // If true FleeGrayHPRatio will be used. RULE_INT(Combat, FleeGrayHPRatio, 50) //HP % when a Gray NPC begins to flee. +RULE_INT(Combat, FleeGrayMaxLevel, 18) // NPC's above this level won't do gray/green con flee RULE_INT(Combat, FleeHPRatio, 25) //HP % when a NPC begins to flee. RULE_BOOL(Combat, FleeIfNotAlone, false) // If false, mobs won't flee if other mobs are in combat with it. RULE_BOOL(Combat, AdjustProcPerMinute, true) diff --git a/common/version.h b/common/version.h index 4caca5b38..e5603c247 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 9129 +#define CURRENT_BINARY_DATABASE_VERSION 9130 #ifdef BOTS #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9021 #else diff --git a/utils/sql/db_update_manifest.txt b/utils/sql/db_update_manifest.txt index 1d0a22cf2..017407752 100644 --- a/utils/sql/db_update_manifest.txt +++ b/utils/sql/db_update_manifest.txt @@ -383,7 +383,8 @@ 9127|2018_09_07_NPCMaxAggroDist.sql|SHOW COLUMNS FROM `zone` LIKE 'npc_max_aggro_dist'|empty| 9128|2018_08_13_inventory_version_update.sql|SHOW TABLES LIKE 'inventory_version'|not_empty| 9129|2018_08_13_inventory_update.sql|SHOW TABLES LIKE 'inventory_versions'|empty| -9130|2018_11_11_StuckBehavior.sql|SHOW COLUMNS FROM `npc_types` LIKE 'stuck_behavior'|empty| +9130|2018_11_25_name_filter_update.sql|SHOW COLUMS FROM `name_filter` LIKE 'id'|empty| +9131|2018_11_25_StuckBehavior.sql|SHOW COLUMNS FROM `npc_types` LIKE 'stuck_behavior'|empty| # Upgrade conditions: # This won't be needed after this system is implemented, but it is used database that are not diff --git a/utils/sql/git/required/2018_11_11_StuckBehavior.sql b/utils/sql/git/required/2018_11_25_StuckBehavior.sql similarity index 100% rename from utils/sql/git/required/2018_11_11_StuckBehavior.sql rename to utils/sql/git/required/2018_11_25_StuckBehavior.sql diff --git a/utils/sql/git/required/2018_11_25_name_filter_update.sql b/utils/sql/git/required/2018_11_25_name_filter_update.sql new file mode 100644 index 000000000..51a6ca86d --- /dev/null +++ b/utils/sql/git/required/2018_11_25_name_filter_update.sql @@ -0,0 +1,5 @@ +ALTER TABLE `name_filter` +ADD COLUMN `id` INT(11) NULL AUTO_INCREMENT FIRST, +DROP PRIMARY KEY, +ADD PRIMARY KEY (`id`) USING BTREE, +ADD INDEX `name_search_index`(`name`); diff --git a/utils/sql/system_tables.txt b/utils/sql/system_tables.txt index a5692dabd..4822f8f97 100644 --- a/utils/sql/system_tables.txt +++ b/utils/sql/system_tables.txt @@ -10,6 +10,7 @@ adventure_template_entry adventure_template_entry_flavor altadv_vars alternate_currency +auras base_data blocked_spells books diff --git a/zone/aa.cpp b/zone/aa.cpp index 4ea307a0d..1f5f9328d 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1172,7 +1172,7 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) { return; //check cooldown - if(!p_timers.Expired(&database, rank->spell_type + pTimerAAStart)) { + if(!p_timers.Expired(&database, rank->spell_type + pTimerAAStart, false)) { uint32 aaremain = p_timers.GetRemainingTime(rank->spell_type + pTimerAAStart); uint32 aaremain_hr = aaremain / (60 * 60); uint32 aaremain_min = (aaremain / 60) % 60; @@ -1208,6 +1208,17 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) { if (spells[rank->spell].targettype == ST_Pet || spells[rank->spell].targettype == ST_SummonedPet) target_id = GetPetID(); + // extra handling for cast_not_standing spells + if (!spells[rank->spell].cast_not_standing) { + if (GetAppearance() == eaSitting) // we need to stand! + SetAppearance(eaStanding, false); + + if (GetAppearance() != eaStanding) { + Message_StringID(MT_SpellFailure, STAND_TO_CAST); + return; + } + } + // Bards can cast instant cast AAs while they are casting another song if(spells[rank->spell].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) { if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), EQEmu::CastingSlot::AltAbility, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) { diff --git a/zone/embparser_api.cpp b/zone/embparser_api.cpp index b469731c8..7ec3ecc5a 100644 --- a/zone/embparser_api.cpp +++ b/zone/embparser_api.cpp @@ -3692,6 +3692,7 @@ EXTERN_C XS(boot_quest) { newXS(strcpy(buf, "GetZoneID"), XS__GetZoneID, file); newXS(strcpy(buf, "GetZoneLongName"), XS__GetZoneLongName, file); newXS(strcpy(buf, "get_data"), XS__get_data, file); + newXS(strcpy(buf, "get_data_expires"), XS__get_data_expires, file); newXS(strcpy(buf, "set_data"), XS__set_data, file); newXS(strcpy(buf, "delete_data"), XS__delete_data, file); newXS(strcpy(buf, "IsBeneficialSpell"), XS__IsBeneficialSpell, file); diff --git a/zone/fearpath.cpp b/zone/fearpath.cpp index eacd92484..3f14b059a 100644 --- a/zone/fearpath.cpp +++ b/zone/fearpath.cpp @@ -62,7 +62,7 @@ void Mob::CheckFlee() { } // If no special flee_percent check for Gray or Other con rates - if(GetLevelCon(hate_top->GetLevel(), GetLevel()) == CON_GRAY && fleeratio == 0 && RuleB(Combat, FleeGray)) { + if(GetLevelCon(hate_top->GetLevel(), GetLevel()) == CON_GRAY && fleeratio == 0 && RuleB(Combat, FleeGray) && GetLevel() <= RuleI(Combat, FleeGrayMaxLevel)) { fleeratio = RuleI(Combat, FleeGrayHPRatio); } else if(fleeratio == 0) { fleeratio = RuleI(Combat, FleeHPRatio ); diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 09ba0b092..5ee89f210 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -1680,6 +1680,7 @@ luabind::scope lua_register_general() { luabind::def("say_link", (std::string(*)(const char*,bool))&lua_say_link), luabind::def("say_link", (std::string(*)(const char*))&lua_say_link), luabind::def("get_data", (std::string(*)(std::string))&lua_get_data), + luabind::def("get_data_expires", (std::string(*)(std::string))&lua_get_data_expires), luabind::def("set_data", (void(*)(std::string, std::string))&lua_set_data), luabind::def("set_data", (void(*)(std::string, std::string, std::string))&lua_set_data), luabind::def("delete_data", (bool(*)(std::string))&lua_delete_data), diff --git a/zone/string_ids.h b/zone/string_ids.h index 2c223ffbd..acab3df22 100644 --- a/zone/string_ids.h +++ b/zone/string_ids.h @@ -418,6 +418,7 @@ #define NO_LONGER_HIDDEN 12337 //You are no longer hidden. #define STOP_SNEAKING 12338 //You stop sneaking #define NOT_IN_CONTROL 12368 //You do not have control of yourself right now. +#define STAND_TO_CAST 12441 //You must be standing to cast a spell. #define ALREADY_CASTING 12442 //You are already casting a spell! #define SHIMMERS_BRIEFLY 12444 //Your %1 shimmers briefly. #define SENSE_CORPSE_NOT_NAME 12446 //You don't sense any corpses of that name. diff --git a/zone/trading.cpp b/zone/trading.cpp index 8c07db9fc..154fdf148 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -1295,7 +1295,7 @@ EQEmu::ItemInstance* Client::FindTraderItemBySerialNumber(int32 SerialNumber){ GetItems_Struct* Client::GetTraderItems(){ const EQEmu::ItemInstance* item = nullptr; - uint16 SlotID = 0; + uint16 SlotID = INVALID_INDEX; auto gis = new GetItems_Struct; @@ -1304,9 +1304,14 @@ GetItems_Struct* Client::GetTraderItems(){ uint8 ndx = 0; for (int i = EQEmu::invslot::GENERAL_BEGIN; i <= EQEmu::invslot::GENERAL_END; i++) { + if (ndx >= 80) + break; item = this->GetInv().GetItem(i); if(item && item->GetItem()->ID == 17899){ //Traders Satchel for (int x = EQEmu::invbag::SLOT_BEGIN; x <= EQEmu::invbag::SLOT_END; x++) { + if (ndx >= 80) + break; + SlotID = EQEmu::InventoryProfile::CalcSlotId(i, x); item = this->GetInv().GetItem(SlotID); diff --git a/zone/zone.cpp b/zone/zone.cpp index ebc08ef09..a2ab032c3 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -1864,26 +1864,22 @@ bool Zone::RemoveSpawnGroup(uint32 in_id) { return false; } - -// Added By Hogie -bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes) { - - const std::string query = "SELECT varname, value FROM variables WHERE varname LIKE 'decaytime%%' ORDER BY varname"; +bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct *npcCorpseDecayTimes) +{ + const std::string query = + "SELECT varname, value FROM variables WHERE varname LIKE 'decaytime%%' ORDER BY varname"; auto results = QueryDatabase(query); if (!results.Success()) - return false; + return false; int index = 0; - for (auto row = results.begin(); row != results.end(); ++row, ++index) { - Seperator sep(row[0]); - npcCorpseDecayTimes[index].minlvl = atoi(sep.arg[1]); - npcCorpseDecayTimes[index].maxlvl = atoi(sep.arg[2]); + for (auto row = results.begin(); row != results.end(); ++row, ++index) { + Seperator sep(row[0]); + npcCorpseDecayTimes[index].minlvl = atoi(sep.arg[1]); + npcCorpseDecayTimes[index].maxlvl = atoi(sep.arg[2]); - if (atoi(row[1]) > 7200) - npcCorpseDecayTimes[index].seconds = 720; - else - npcCorpseDecayTimes[index].seconds = atoi(row[1]); - } + npcCorpseDecayTimes[index].seconds = std::min(24 * 60 * 60, atoi(row[1])); + } return true; } diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index db1da7868..52f726c36 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -4358,15 +4358,15 @@ uint32 ZoneDatabase::GetCharacterCorpseCount(uint32 char_id) { } uint32 ZoneDatabase::GetCharacterCorpseID(uint32 char_id, uint8 corpse) { - std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u'", char_id); - auto results = QueryDatabase(query); + std::string query = StringFormat("SELECT `id` FROM `character_corpses` WHERE `charid` = '%u' limit %d, 1", char_id, corpse); - for (auto row = results.begin(); row != results.end(); ++row) { - for (int i = 0; i < corpse; i++) { - return atoul(row[0]); - } - } - return 0; + auto results = QueryDatabase(query); + auto row = results.begin(); + + if (row != results.end()) + return atoul(row[0]); + else + return 0; } uint32 ZoneDatabase::GetCharacterCorpseItemCount(uint32 corpse_id){