mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-16 00:22:25 +00:00
Changed expansions to min_expansion/max_expansion
This commit is contained in:
parent
aac73c6558
commit
297599a779
@ -934,9 +934,9 @@ uint32 Database::GetMiniLoginAccount(char* ip)
|
||||
}
|
||||
|
||||
// Get zone starting points from DB
|
||||
bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe_x, float* safe_y, float* safe_z, int16* minstatus, uint8* minlevel, uint32* expansions, char *flag_needed) {
|
||||
bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe_x, float* safe_y, float* safe_z, int16* minstatus, uint8* minlevel, uint32* minexpansion, uint32* maxexpansion, char *flag_needed) {
|
||||
|
||||
std::string query = StringFormat("SELECT safe_x, safe_y, safe_z, min_status, min_level, flag_needed, expansions FROM zone "
|
||||
std::string query = StringFormat("SELECT safe_x, safe_y, safe_z, min_status, min_level, flag_needed, min_expansion, max_expansion FROM zone "
|
||||
" WHERE short_name='%s' AND (version=%i OR version=0) ORDER BY version DESC", short_name, version);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
@ -960,15 +960,17 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe
|
||||
*minlevel = atoi(row[4]);
|
||||
if (flag_needed != nullptr)
|
||||
strcpy(flag_needed, row[5]);
|
||||
if (expansions != nullptr)
|
||||
*expansions = atoi(row[6]);
|
||||
if (minexpansion != nullptr)
|
||||
*minexpansion = atoi(row[6]);
|
||||
if (maxexpansion != nullptr)
|
||||
*maxexpansion = atoi(row[7]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::GetZoneLongName(const char* short_name, char** long_name, char* file_name, float* safe_x, float* safe_y, float* safe_z, uint32* graveyard_id, uint32* maxclients) {
|
||||
|
||||
std::string query = StringFormat("SELECT long_name, file_name, safe_x, safe_y, safe_z, graveyard_id, maxclients FROM zone WHERE short_name='%s' AND version=0 AND %i & expansions = expansions", short_name, RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT long_name, file_name, safe_x, safe_y, safe_z, graveyard_id, maxclients FROM zone WHERE short_name='%s' AND version=0", short_name);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success()) {
|
||||
@ -1093,7 +1095,7 @@ const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
|
||||
|
||||
uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){
|
||||
|
||||
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) AND %i & expansions = expansions ORDER BY version DESC", zoneID, version, RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success()) {
|
||||
|
||||
@ -237,8 +237,8 @@ public:
|
||||
|
||||
/* General Queries */
|
||||
|
||||
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, uint32* expansions = 0, char *flag_needed = nullptr);
|
||||
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, uint32* expansions = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, expansions, flag_needed); }
|
||||
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, uint32* minexpansion = 0, uint32* maxexpansion = 0, char *flag_needed = nullptr);
|
||||
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, uint32* minexpansion = 0, uint32* maxexpansion = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, minexpansion, maxexpansion, flag_needed); }
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||
|
||||
@ -413,17 +413,16 @@ bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) {
|
||||
bool SharedDatabase::SetStartingItems(PlayerProfile_Struct* pp, EQEmu::InventoryProfile* inv, uint32 si_race, uint32 si_class, uint32 si_deity, uint32 si_current_zone, char* si_name, int admin_level) {
|
||||
|
||||
const EQEmu::ItemData* myitem;
|
||||
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT itemid, item_charges, slot FROM starting_items "
|
||||
"WHERE (race = %i or race = 0) AND (class = %i or class = 0) AND "
|
||||
"(deityid = %i or deityid = 0) AND (zoneid = %i or zoneid = 0) AND "
|
||||
"gm <= %i AND %i & expansions = expansions ORDER BY id",
|
||||
si_race, si_class, si_deity, si_current_zone, admin_level, RuleI(World, ExpansionSettings));
|
||||
"gm <= %i AND min_expansion <= %i AND max_expansion >= %i ORDER BY id",
|
||||
si_race, si_class, si_deity, si_current_zone, admin_level, latest_expansion, latest_expansion);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
int32 itemid = atoi(row[0]);
|
||||
int32 charges = atoi(row[1]);
|
||||
@ -1937,7 +1936,8 @@ void SharedDatabase::GetLootTableInfo(uint32 &loot_table_count, uint32 &max_loot
|
||||
loot_table_count = 0;
|
||||
max_loot_table = 0;
|
||||
loot_table_entries = 0;
|
||||
const std::string query = StringFormat("SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable WHERE %d & expansions = expansions", RuleI(World, ExpansionSettings));
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
const std::string query = StringFormat("SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM loottable_entries) FROM loottable WHERE min_expansion <= %i AND max_expansion >= %i", latest_expansion, latest_expansion);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
@ -1957,8 +1957,9 @@ void SharedDatabase::GetLootDropInfo(uint32 &loot_drop_count, uint32 &max_loot_d
|
||||
loot_drop_count = 0;
|
||||
max_loot_drop = 0;
|
||||
loot_drop_entries = 0;
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
|
||||
const std::string query = StringFormat("SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop WHERE %d & expansions = expansions", RuleI(World, ExpansionSettings));
|
||||
const std::string query = StringFormat("SELECT COUNT(*), MAX(id), (SELECT COUNT(*) FROM lootdrop_entries) FROM lootdrop WHERE min_expansion <= %i AND max_expansion >= %i", latest_expansion, latest_expansion);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
@ -2033,10 +2034,11 @@ void SharedDatabase::LoadLootDrops(void *data, uint32 size) {
|
||||
uint8 loot_drop[sizeof(LootDrop_Struct) + (sizeof(LootDropEntries_Struct) * 1260)];
|
||||
LootDrop_Struct *ld = reinterpret_cast<LootDrop_Struct*>(loot_drop);
|
||||
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
const std::string query = StringFormat("SELECT lootdrop.id, lootdrop_entries.item_id, lootdrop_entries.item_charges, "
|
||||
"lootdrop_entries.equip_item, lootdrop_entries.chance, lootdrop_entries.minlevel, "
|
||||
"lootdrop_entries.maxlevel, lootdrop_entries.multiplier FROM lootdrop JOIN lootdrop_entries "
|
||||
"ON lootdrop.id = lootdrop_entries.lootdrop_id WHERE %d & expansions = expansions ORDER BY lootdrop_id", RuleI(World, ExpansionSettings));
|
||||
"ON lootdrop.id = lootdrop_entries.lootdrop_id WHERE min_expansion <= %i AND max_expansion >= %i ORDER BY lootdrop_id", latest_expansion, latest_expansion);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
|
||||
@ -146,9 +146,10 @@ bool load_spawns_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns)
|
||||
bool load_doors_from_db(MYSQL *m, const char *zone, list<PathNode*> &db_spawns) {
|
||||
char query[512];
|
||||
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
sprintf(query,
|
||||
"SELECT pos_x,pos_y,pos_z FROM doors "
|
||||
"WHERE zone='%s' AND %d & expansions = expansions", zone, RuleI(World, ExpansionSettings));
|
||||
"WHERE zone='%s' AND min_expansion <= %i AND max_expansion >= %i", zone, latest_expansion, latest_expansion);
|
||||
if(mysql_query(m, query) != 0) {
|
||||
printf("Unable to query: %s\n", mysql_error(m));
|
||||
return(false);
|
||||
|
||||
@ -1,18 +1,36 @@
|
||||
ALTER TABLE `adventure_template` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `graveyard_radius`;
|
||||
ALTER TABLE `doors` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `is_ldon_door`;
|
||||
ALTER TABLE `fishing` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `npc_chance`;
|
||||
ALTER TABLE `forage` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `chance`;
|
||||
ALTER TABLE `global_loot` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `zone`;
|
||||
ALTER TABLE `ground_spawns` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `respawn_timer`;
|
||||
ALTER TABLE `loottable` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `done`;
|
||||
ALTER TABLE `lootdrop` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `name`;
|
||||
ALTER TABLE `merchantlist` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `probability`;
|
||||
ALTER TABLE `object` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `display_name`;
|
||||
ALTER TABLE `spawn2` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `animation`;
|
||||
ALTER TABLE `starting_items` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `slot`;
|
||||
ALTER TABLE `start_zones` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `select_rank`;
|
||||
ALTER TABLE `titles` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `title_set`;
|
||||
ALTER TABLE `tradeskill_recipe` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '4' AFTER `enabled`;
|
||||
ALTER TABLE `traps` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `undetectable`;
|
||||
ALTER TABLE `tributes` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `isguild`;
|
||||
ALTER TABLE `zone` ADD `expansions` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `npc_max_aggro_dist`;
|
||||
ALTER TABLE `adventure_template` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `graveyard_radius`;
|
||||
ALTER TABLE `adventure_template` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `doors` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `is_ldon_door`;
|
||||
ALTER TABLE `doors` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `fishing` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `npc_chance`;
|
||||
ALTER TABLE `fishing` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `forage` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `chance`;
|
||||
ALTER TABLE `forage` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `global_loot` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `zone`;
|
||||
ALTER TABLE `global_loot` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `ground_spawns` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `respawn_timer`;
|
||||
ALTER TABLE `ground_spawns` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `loottable` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `done`;
|
||||
ALTER TABLE `loottable` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `lootdrop` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `name`;
|
||||
ALTER TABLE `lootdrop` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `merchantlist` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `probability`;
|
||||
ALTER TABLE `merchantlist` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `object` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `display_name`;
|
||||
ALTER TABLE `object` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `spawn2` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `animation`;
|
||||
ALTER TABLE `spawn2` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `starting_items` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `slot`;
|
||||
ALTER TABLE `starting_items` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `start_zones` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `select_rank`;
|
||||
ALTER TABLE `start_zones` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `titles` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `title_set`;
|
||||
ALTER TABLE `titles` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `tradeskill_recipe` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '4' AFTER `enabled`;
|
||||
ALTER TABLE `tradeskill_recipe` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `traps` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `undetectable`;
|
||||
ALTER TABLE `traps` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `tributes` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `isguild`;
|
||||
ALTER TABLE `tributes` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
ALTER TABLE `zone` ADD `min_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '0' AFTER `npc_max_aggro_dist`;
|
||||
ALTER TABLE `zone` ADD `max_expansion` TINYINT(4) UNSIGNED NOT NULL DEFAULT '99' AFTER `min_expansion`;
|
||||
|
||||
@ -9472,6 +9472,7 @@ void command_object(Client *c, const Seperator *sep)
|
||||
uint32 newid = 0;
|
||||
uint16 radius;
|
||||
EQApplicationPacket *app;
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
|
||||
bool bNewObject = false;
|
||||
|
||||
@ -9503,8 +9504,10 @@ void command_object(Client *c, const Seperator *sep)
|
||||
else
|
||||
c->Message(0, "Objects within %u units of your current location:", radius);
|
||||
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query;
|
||||
if (radius)
|
||||
|
||||
query = StringFormat(
|
||||
"SELECT id, xpos, ypos, zpos, heading, itemid, "
|
||||
"objectname, type, icon, unknown08, unknown10, unknown20 "
|
||||
@ -9512,18 +9515,18 @@ void command_object(Client *c, const Seperator *sep)
|
||||
"AND (xpos BETWEEN %.1f AND %.1f) "
|
||||
"AND (ypos BETWEEN %.1f AND %.1f) "
|
||||
"AND (zpos BETWEEN %.1f AND %.1f) "
|
||||
"AND %d & expansions = expansions"
|
||||
"AND min_expansion <= %i AND max_expansion >= %i "
|
||||
"ORDER BY id",
|
||||
zone->GetZoneID(), zone->GetInstanceVersion(),
|
||||
c->GetX() - radius, // Yes, we're actually using a bounding box instead of a radius.
|
||||
c->GetX() + radius, // Much less processing power used this way.
|
||||
c->GetY() - radius, c->GetY() + radius, c->GetZ() - radius, c->GetZ() + radius, RuleI(World, ExpansionSettings));
|
||||
c->GetY() - radius, c->GetY() + radius, c->GetZ() - radius, c->GetZ() + radius, latest_expansion, latest_expansion);
|
||||
else
|
||||
query = StringFormat("SELECT id, xpos, ypos, zpos, heading, itemid, "
|
||||
"objectname, type, icon, unknown08, unknown10, unknown20 "
|
||||
"FROM object WHERE zoneid = %u AND version = %u AND %d & expansions = expansions"
|
||||
"FROM object WHERE zoneid = %u AND version = %u AND min_expansion <= %i AND max_expansion >= %i"
|
||||
"ORDER BY id",
|
||||
zone->GetZoneID(), zone->GetInstanceVersion(), RuleI(World, ExpansionSettings));
|
||||
zone->GetZoneID(), zone->GetInstanceVersion(), latest_expansion, latest_expansion);
|
||||
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
|
||||
@ -54,9 +54,10 @@ uint32 ZoneDatabase::GetZoneForage(uint32 ZoneID, uint8 skill) {
|
||||
}
|
||||
|
||||
uint32 chancepool = 0;
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT itemid, chance FROM "
|
||||
"forage WHERE zoneid = '%i' AND level <= '%i' AND %d & expansions = expansions "
|
||||
"LIMIT %i", ZoneID, skill, RuleI(World, ExpansionSettings), FORAGE_ITEM_LIMIT);
|
||||
"forage WHERE zoneid = '%i' AND level <= '%i' AND min_expansion <= %i AND max_expansion >= %i "
|
||||
"LIMIT %i", ZoneID, skill, latest_expansion, latest_expansion, FORAGE_ITEM_LIMIT);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return 0;
|
||||
@ -109,9 +110,10 @@ uint32 ZoneDatabase::GetZoneFishing(uint32 ZoneID, uint8 skill, uint32 &npc_id,
|
||||
chance[c]=0;
|
||||
}
|
||||
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT itemid, chance, npc_id, npc_chance "
|
||||
"FROM fishing WHERE (zoneid = '%i' || zoneid = 0) AND skill_level <= '%i' AND %d & expansions = expansions",
|
||||
ZoneID, skill, RuleI(World, ExpansionSettings));
|
||||
"FROM fishing WHERE (zoneid = '%i' || zoneid = 0) AND skill_level <= '%i' AND min_expansion <= %i AND max_expansion >= %i",
|
||||
ZoneID, skill, latest_expansion, latest_expansion);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return 0;
|
||||
|
||||
@ -463,8 +463,9 @@ void NPC::CheckGlobalLootTables()
|
||||
|
||||
void ZoneDatabase::LoadGlobalLoot()
|
||||
{
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
auto query = StringFormat("SELECT id, loottable_id, description, min_level, max_level, rare, raid, race, "
|
||||
"class, bodytype, zone FROM global_loot WHERE enabled = 1 AND %d & expansions = expansions", RuleI(World, ExpansionSettings));
|
||||
"class, bodytype, zone FROM global_loot WHERE enabled = 1 AND min_expansion <= %i AND max_expansion >= %i", latest_expansion, latest_expansion);
|
||||
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success() || results.RowCount() == 0)
|
||||
|
||||
@ -694,13 +694,13 @@ void ZoneDatabase::UpdateObject(uint32 id, uint32 type, uint32 icon, const Objec
|
||||
}
|
||||
|
||||
Ground_Spawns* ZoneDatabase::LoadGroundSpawns(uint32 zone_id, int16 version, Ground_Spawns* gs) {
|
||||
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT max_x, max_y, max_z, "
|
||||
"min_x, min_y, heading, name, "
|
||||
"item, max_allowed, respawn_timer "
|
||||
"FROM ground_spawns "
|
||||
"WHERE zoneid = %i AND (version = %u OR version = -1) AND %d & expansions = expansions"
|
||||
"LIMIT 50", zone_id, version, RuleI(World, ExpansionSettings));
|
||||
"WHERE zoneid = %i AND (version = %u OR version = -1) AND min_expansion <= %i AND max_expansion >= %i"
|
||||
"LIMIT 50", zone_id, version, latest_expansion, latest_expansion);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return gs;
|
||||
|
||||
@ -639,10 +639,11 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList<Spawn2*> &spa
|
||||
|
||||
Spawn2* ZoneDatabase::LoadSpawn2(LinkedList<Spawn2*> &spawn2_list, uint32 spawn2id, uint32 timeleft) {
|
||||
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT id, spawngroupID, x, y, z, heading, "
|
||||
"respawntime, variance, pathgrid, _condition, "
|
||||
"cond_value, enabled, animation FROM spawn2 "
|
||||
"WHERE id = %i AND %d & expansions = expansions", spawn2id, RuleI(World, ExpansionSettings));
|
||||
"WHERE id = %i AND min_expansion <= %i AND max_expansion >= %i", spawn2id, latest_expansion, latest_expansion);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return nullptr;
|
||||
|
||||
@ -164,15 +164,16 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//this really loads the objects into entity_list
|
||||
bool Zone::LoadZoneObjects()
|
||||
{
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query =
|
||||
StringFormat("SELECT id, zoneid, xpos, ypos, zpos, heading, itemid, charges, objectname, type, icon, "
|
||||
"unknown08, unknown10, unknown20, unknown24, unknown76, size, tilt_x, tilt_y, display_name "
|
||||
"FROM object WHERE zoneid = %i AND (version = %u OR version = -1) AND %d & expansions = expansions",
|
||||
zoneid, instanceversion, RuleI(World, ExpansionSettings));
|
||||
"FROM object WHERE zoneid = %i AND (version = %u OR version = -1) AND min_expansion <= %i AND max_expansion >= %i",
|
||||
zoneid, instanceversion, latest_expansion, latest_expansion);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
Log(Logs::General, Logs::Error, "Error Loading Objects from DB: %s",
|
||||
@ -464,8 +465,9 @@ void Zone::LoadTempMerchantData() {
|
||||
void Zone::LoadNewMerchantData(uint32 merchantid) {
|
||||
|
||||
std::list<MerchantList> merlist;
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT item, slot, faction_required, level_required, alt_currency_cost, "
|
||||
"classes_required, probability FROM merchantlist WHERE merchantid=%d AND %d & expansions = expansions ORDER BY slot", merchantid, RuleI(World, ExpansionSettings));
|
||||
"classes_required, probability FROM merchantlist WHERE merchantid=%d AND min_expansion <= %i AND max_expansion >= %i ORDER BY slot", merchantid, latest_expansion, latest_expansion);
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
@ -1703,12 +1705,13 @@ bool ZoneDatabase::LoadStaticZonePoints(LinkedList<ZonePoint*>* zone_point_list,
|
||||
{
|
||||
zone_point_list->Clear();
|
||||
zone->numzonepoints = 0;
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT x, y, z, target_x, target_y, "
|
||||
"target_z, target_zone_id, heading, target_heading, "
|
||||
"number, target_instance, client_version_mask "
|
||||
"FROM zone_points WHERE zone='%s' AND (version=%i OR version=-1) AND %d & expansions = expansions "
|
||||
"FROM zone_points WHERE zone='%s' AND (version=%i OR version=-1) AND min_expansion <= %i AND max_expansion >= %i "
|
||||
"ORDER BY number",
|
||||
zonename, version, RuleI(World, ExpansionSettings));
|
||||
zonename, version, latest_expansion, latest_expansion);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
@ -2344,7 +2347,7 @@ uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) {
|
||||
|
||||
void Zone::UpdateHotzone()
|
||||
{
|
||||
std::string query = StringFormat("SELECT hotzone FROM zone WHERE short_name = '%s' AND %d & expansions = expansions", GetShortName(), RuleI(World, ExpansionSettings));
|
||||
std::string query = StringFormat("SELECT hotzone FROM zone WHERE short_name = '%s'", GetShortName());
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
@ -169,9 +169,10 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
|
||||
float safe_x, safe_y, safe_z;
|
||||
int16 minstatus = 0;
|
||||
uint8 minlevel = 0;
|
||||
uint32 expansions = 0;
|
||||
uint32 minexpansion = 0;
|
||||
uint32 maxexpansion = 0;
|
||||
char flag_needed[128];
|
||||
if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, &expansions, flag_needed)) {
|
||||
if(!database.GetSafePoints(target_zone_name, database.GetInstanceVersion(target_instance_id), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, &minexpansion, &maxexpansion, flag_needed)) {
|
||||
//invalid zone...
|
||||
Message(13, "Invalid target zone while getting safe points.");
|
||||
Log(Logs::General, Logs::Error, "Zoning %s: Unable to get safe coordinates for zone '%s'.", GetName(), target_zone_name);
|
||||
@ -268,8 +269,10 @@ void Client::Handle_OP_ZoneChange(const EQApplicationPacket *app) {
|
||||
|
||||
//not sure when we would use ZONE_ERROR_NOTREADY
|
||||
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
|
||||
//enforce min status and level
|
||||
if (!ignorerestrictions && (Admin() < minstatus || GetLevel() < minlevel))
|
||||
if (!ignorerestrictions && (Admin() < minstatus || GetLevel() < minlevel || (uint32)latest_expansion <= minexpansion || (uint32)latest_expansion >= maxexpansion))
|
||||
{
|
||||
myerror = ZONE_ERROR_NOEXPERIENCE;
|
||||
}
|
||||
@ -839,9 +842,10 @@ void Client::SendZoneFlagInfo(Client *to) const {
|
||||
float safe_x, safe_y, safe_z;
|
||||
int16 minstatus = 0;
|
||||
uint8 minlevel = 0;
|
||||
uint32 expansions = 0;
|
||||
uint32 minexpansion = 0;
|
||||
uint32 maxexpansion = 0;
|
||||
char flag_name[128];
|
||||
if(!database.GetSafePoints(short_name, 0, &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, &expansions, flag_name)) {
|
||||
if(!database.GetSafePoints(short_name, 0, &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, &minexpansion, &maxexpansion, flag_name)) {
|
||||
strcpy(flag_name, "(ERROR GETTING NAME)");
|
||||
}
|
||||
|
||||
@ -862,9 +866,10 @@ bool Client::CanBeInZone() {
|
||||
float safe_x, safe_y, safe_z;
|
||||
int16 minstatus = 0;
|
||||
uint8 minlevel = 0;
|
||||
uint32 expansions = 0;
|
||||
uint32 minexpansion = 0;
|
||||
uint32 maxexpansion = 0;
|
||||
char flag_needed[128];
|
||||
if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, &expansions, flag_needed)) {
|
||||
if(!database.GetSafePoints(zone->GetShortName(), zone->GetInstanceVersion(), &safe_x, &safe_y, &safe_z, &minstatus, &minlevel, &minexpansion, &maxexpansion, flag_needed)) {
|
||||
//this should not happen...
|
||||
Log(Logs::Detail, Logs::None, "[CLIENT] Unable to query zone info for ourself '%s'", zone->GetShortName());
|
||||
return(false);
|
||||
@ -878,8 +883,9 @@ bool Client::CanBeInZone() {
|
||||
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not meet min status requirement (%d < %d)!", Admin(), minstatus);
|
||||
return(false);
|
||||
}
|
||||
if(Admin() < 150 && RuleI(World, ExpansionSettings) & expansions != expansions) {
|
||||
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not have expansion", Admin(), expansions);
|
||||
auto latest_expansion = EQEmu::expansions::ConvertExpansionBitToExpansion(RuleI(World, ExpansionSettings));
|
||||
if(Admin() < 150 && (uint32)latest_expansion < minexpansion && (uint32)latest_expansion > maxexpansion) {
|
||||
Log(Logs::Detail, Logs::None, "[CLIENT] Character does not have expansion");
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user