mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-06 10:22:26 +00:00
[Feature] Add Expansion and Content Flag support to Blocked Spells (#3638)
* [Feature] Add Expansion and Content Flag support to Blocked Spells # Notes - Allows operators to filter blocked spells behind expansions or content flags. - Requested in https://github.com/EQEmu/Server/issues/3582 * [Tradeskills] Add learned_by_item_id field (#3637) * [Feature] Add Expansion and Content Flag support to Blocked Spells - Allows operators to filter blocked spells behind expansions or content flags. - Requested in https://github.com/EQEmu/Server/issues/3582 --------- Co-authored-by: Chris Miles <akkadius1@gmail.com>
This commit is contained in:
parent
0667fe435f
commit
52d64781b5
@ -4967,6 +4967,20 @@ ALTER TABLE `items`
|
|||||||
.sql = R"(
|
.sql = R"(
|
||||||
ALTER TABLE `tradeskill_recipe`
|
ALTER TABLE `tradeskill_recipe`
|
||||||
ADD COLUMN `learned_by_item_id` int(11) NOT NULL DEFAULT 0 AFTER `must_learn`;
|
ADD COLUMN `learned_by_item_id` int(11) NOT NULL DEFAULT 0 AFTER `must_learn`;
|
||||||
|
)"
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9239,
|
||||||
|
.description = "2023_10_18_blocked_spells_expansions_content_flags.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `blocked_spells` LIKE 'min_expansion'",
|
||||||
|
.condition = "",
|
||||||
|
.match = "empty",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `blocked_spells`
|
||||||
|
ADD COLUMN `min_expansion` tinyint(4) NOT NULL DEFAULT -1 AFTER `description`,
|
||||||
|
ADD COLUMN `max_expansion` tinyint(4) NOT NULL DEFAULT -1 AFTER `min_expansion`,
|
||||||
|
ADD COLUMN `content_flags` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `max_expansion`,
|
||||||
|
ADD COLUMN `content_flags_disabled` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `content_flags`;
|
||||||
)"
|
)"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CURRENT_BINARY_DATABASE_VERSION 9238
|
#define CURRENT_BINARY_DATABASE_VERSION 9239
|
||||||
|
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9040
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9040
|
||||||
|
|
||||||
|
|||||||
@ -2197,12 +2197,21 @@ void Zone::LoadZoneBlockedSpells()
|
|||||||
if (zone_total_blocked_spells > 0) {
|
if (zone_total_blocked_spells > 0) {
|
||||||
blocked_spells = new ZoneSpellsBlocked[zone_total_blocked_spells];
|
blocked_spells = new ZoneSpellsBlocked[zone_total_blocked_spells];
|
||||||
if (!content_db.LoadBlockedSpells(zone_total_blocked_spells, blocked_spells, GetZoneID())) {
|
if (!content_db.LoadBlockedSpells(zone_total_blocked_spells, blocked_spells, GetZoneID())) {
|
||||||
LogError(" Failed to load blocked spells");
|
LogError(
|
||||||
|
"Failed to load blocked spells for {} ({}).",
|
||||||
|
zone_store.GetZoneName(GetZoneID(), true),
|
||||||
|
GetZoneID()
|
||||||
|
);
|
||||||
ClearBlockedSpells();
|
ClearBlockedSpells();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo("Loaded [{}] blocked spells(s)", Strings::Commify(zone_total_blocked_spells));
|
LogInfo(
|
||||||
|
"Loaded [{}] blocked spells(s) for {} ({}).",
|
||||||
|
Strings::Commify(zone_total_blocked_spells),
|
||||||
|
zone_store.GetZoneName(GetZoneID(), true),
|
||||||
|
GetZoneID()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#include "zone.h"
|
#include "zone.h"
|
||||||
#include "zonedb.h"
|
#include "zonedb.h"
|
||||||
#include "aura.h"
|
#include "aura.h"
|
||||||
|
#include "../common/repositories/blocked_spells_repository.h"
|
||||||
#include "../common/repositories/character_tribute_repository.h"
|
#include "../common/repositories/character_tribute_repository.h"
|
||||||
#include "../common/repositories/character_disciplines_repository.h"
|
#include "../common/repositories/character_disciplines_repository.h"
|
||||||
#include "../common/repositories/npc_types_repository.h"
|
#include "../common/repositories/npc_types_repository.h"
|
||||||
@ -19,6 +20,7 @@
|
|||||||
#include "../common/repositories/character_pet_inventory_repository.h"
|
#include "../common/repositories/character_pet_inventory_repository.h"
|
||||||
#include "../common/repositories/character_pet_info_repository.h"
|
#include "../common/repositories/character_pet_info_repository.h"
|
||||||
#include "../common/repositories/character_buffs_repository.h"
|
#include "../common/repositories/character_buffs_repository.h"
|
||||||
|
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -2845,50 +2847,55 @@ uint8 ZoneDatabase::RaidGroupCount(uint32 raidid, uint32 groupid) {
|
|||||||
return Strings::ToInt(row[0]);
|
return Strings::ToInt(row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 ZoneDatabase::GetBlockedSpellsCount(uint32 zoneid)
|
int64 ZoneDatabase::GetBlockedSpellsCount(uint32 zone_id)
|
||||||
{
|
{
|
||||||
std::string query = StringFormat("SELECT count(*) FROM blocked_spells WHERE zoneid = %d", zoneid);
|
return BlockedSpellsRepository::Count(
|
||||||
auto results = QueryDatabase(query);
|
database,
|
||||||
if (!results.Success()) {
|
fmt::format(
|
||||||
return -1;
|
"zoneid = {} {}",
|
||||||
}
|
zone_id,
|
||||||
|
ContentFilterCriteria::apply()
|
||||||
if (results.RowCount() == 0)
|
)
|
||||||
return -1;
|
);
|
||||||
|
|
||||||
auto& row = results.begin();
|
|
||||||
|
|
||||||
return Strings::ToInt(row[0]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneDatabase::LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid)
|
bool ZoneDatabase::LoadBlockedSpells(int64 blocked_spells_count, ZoneSpellsBlocked* into, uint32 zone_id)
|
||||||
{
|
{
|
||||||
LogInfo("Loading Blocked Spells from database");
|
LogInfo("Loading Blocked Spells from database for {} ({}).", zone_store.GetZoneName(zone_id, true), zone_id);
|
||||||
|
|
||||||
std::string query = StringFormat("SELECT id, spellid, type, x, y, z, x_diff, y_diff, z_diff, message "
|
const auto& l = BlockedSpellsRepository::GetWhere(
|
||||||
"FROM blocked_spells WHERE zoneid = %d ORDER BY id ASC", zoneid);
|
database,
|
||||||
auto results = QueryDatabase(query);
|
fmt::format(
|
||||||
if (!results.Success()) {
|
"zoneid = {} {} ORDER BY id ASC",
|
||||||
return false;
|
zone_id,
|
||||||
}
|
ContentFilterCriteria::apply()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (results.RowCount() == 0)
|
if (l.empty()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int32 index = 0;
|
int64 i = 0;
|
||||||
for(auto& row = results.begin(); row != results.end(); ++row, ++index) {
|
|
||||||
if(index >= blockedSpellsCount) {
|
|
||||||
std::cerr << "Error, Blocked Spells Count of " << blockedSpellsCount << " exceeded." << std::endl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(&into[index], 0, sizeof(ZoneSpellsBlocked));
|
for (const auto& e : l) {
|
||||||
into[index].spellid = Strings::ToInt(row[1]);
|
if (i >= blocked_spells_count) {
|
||||||
into[index].type = Strings::ToInt(row[2]);
|
LogError(
|
||||||
into[index].m_Location = glm::vec3(Strings::ToFloat(row[3]), Strings::ToFloat(row[4]), Strings::ToFloat(row[5]));
|
"Blocked spells count of {} exceeded for {} ({}).",
|
||||||
into[index].m_Difference = glm::vec3(Strings::ToFloat(row[6]), Strings::ToFloat(row[7]), Strings::ToFloat(row[8]));
|
blocked_spells_count,
|
||||||
strn0cpy(into[index].message, row[9], 255);
|
zone_store.GetZoneName(zone_id, true),
|
||||||
}
|
zone_id
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&into[i], 0, sizeof(ZoneSpellsBlocked));
|
||||||
|
into[i].spellid = e.spellid;
|
||||||
|
into[i].type = e.type;
|
||||||
|
into[i].m_Location = glm::vec3(e.x, e.y, e.z);
|
||||||
|
into[i].m_Difference = glm::vec3(e.x_diff, e.y_diff, e.z_diff);
|
||||||
|
strn0cpy(into[i].message, e.message.c_str(), sizeof(into[i].message));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -619,8 +619,8 @@ public:
|
|||||||
int GetDoorsDBCountPlusOne(std::string zone_short_name, int16 version);
|
int GetDoorsDBCountPlusOne(std::string zone_short_name, int16 version);
|
||||||
|
|
||||||
/* Blocked Spells */
|
/* Blocked Spells */
|
||||||
int32 GetBlockedSpellsCount(uint32 zoneid);
|
int64 GetBlockedSpellsCount(uint32 zone_id);
|
||||||
bool LoadBlockedSpells(int32 blockedSpellsCount, ZoneSpellsBlocked* into, uint32 zoneid);
|
bool LoadBlockedSpells(int64 blocked_spells_count, ZoneSpellsBlocked* into, uint32 zone_id);
|
||||||
|
|
||||||
/* Traps */
|
/* Traps */
|
||||||
bool LoadTraps(const char* zonename, int16 version);
|
bool LoadTraps(const char* zonename, int16 version);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user