mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 23:01:30 +00:00
Add hot_zone filtering for global loot
We do this in GlobalLootEntry::PassesRules since we want to check if the hot zone status changes during run time Value can be null, if null it's not checked. If the value is 0 the zone must not be a hot zone (I guess one might want that) and if it's not 0, the zone must be a hot zone
This commit is contained in:
parent
8bcef6c2e7
commit
501204a4d2
@ -34,7 +34,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 9148
|
#define CURRENT_BINARY_DATABASE_VERSION 9149
|
||||||
|
|
||||||
#ifdef BOTS
|
#ifdef BOTS
|
||||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9026
|
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9026
|
||||||
|
|||||||
@ -402,6 +402,7 @@
|
|||||||
9146|2020_01_10_character_soft_deletes.sql|SHOW COLUMNS FROM `character_data` LIKE 'deleted_at'|empty|
|
9146|2020_01_10_character_soft_deletes.sql|SHOW COLUMNS FROM `character_data` LIKE 'deleted_at'|empty|
|
||||||
9147|2020_01_24_grid_centerpoint_wp.sql|SHOW COLUMNS FROM `grid_entries` LIKE 'centerpoint'|empty|
|
9147|2020_01_24_grid_centerpoint_wp.sql|SHOW COLUMNS FROM `grid_entries` LIKE 'centerpoint'|empty|
|
||||||
9148|2020_01_28_corpse_guild_consent_id.sql|SHOW COLUMNS FROM `character_corpses` LIKE 'guild_consent_id'|empty|
|
9148|2020_01_28_corpse_guild_consent_id.sql|SHOW COLUMNS FROM `character_corpses` LIKE 'guild_consent_id'|empty|
|
||||||
|
9149|2020_02_06_globalloot.sql|SHOW COLUMNS FROM `global_loot` LIKE 'hot_zone'|empty|
|
||||||
|
|
||||||
# Upgrade conditions:
|
# Upgrade conditions:
|
||||||
# This won't be needed after this system is implemented, but it is used database that are not
|
# This won't be needed after this system is implemented, but it is used database that are not
|
||||||
|
|||||||
2
utils/sql/git/required/2020_02_06_globalloot.sql
Normal file
2
utils/sql/git/required/2020_02_06_globalloot.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE `global_loot` ADD `hot_zone` TINYINT NULL;
|
||||||
|
|
||||||
@ -1,6 +1,9 @@
|
|||||||
#include "global_loot_manager.h"
|
#include "global_loot_manager.h"
|
||||||
#include "npc.h"
|
#include "npc.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "zone.h"
|
||||||
|
|
||||||
|
extern Zone *zone;
|
||||||
|
|
||||||
std::vector<int> GlobalLootManager::GetGlobalLootTables(NPC *mob) const
|
std::vector<int> GlobalLootManager::GetGlobalLootTables(NPC *mob) const
|
||||||
{
|
{
|
||||||
@ -78,6 +81,12 @@ bool GlobalLootEntry::PassesRules(NPC *mob) const
|
|||||||
if (mob->GetBodyType() == r.value)
|
if (mob->GetBodyType() == r.value)
|
||||||
bPassesBodyType = true;
|
bPassesBodyType = true;
|
||||||
break;
|
break;
|
||||||
|
case GlobalLoot::RuleTypes::HotZone: // value == 0 must not be hot_zone, value != must be hot_zone
|
||||||
|
if (zone->IsHotzone() && !r.value)
|
||||||
|
return false;
|
||||||
|
if (!zone->IsHotzone() && r.value)
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,7 @@ enum class RuleTypes {
|
|||||||
BodyType = 4,
|
BodyType = 4,
|
||||||
Rare = 5,
|
Rare = 5,
|
||||||
Raid = 6,
|
Raid = 6,
|
||||||
|
HotZone = 7,
|
||||||
Max
|
Max
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -464,7 +464,7 @@ void NPC::CheckGlobalLootTables()
|
|||||||
void ZoneDatabase::LoadGlobalLoot()
|
void ZoneDatabase::LoadGlobalLoot()
|
||||||
{
|
{
|
||||||
auto query = StringFormat("SELECT id, loottable_id, description, min_level, max_level, rare, raid, race, "
|
auto query = StringFormat("SELECT id, loottable_id, description, min_level, max_level, rare, raid, race, "
|
||||||
"class, bodytype, zone FROM global_loot WHERE enabled = 1");
|
"class, bodytype, zone, hot_zone FROM global_loot WHERE enabled = 1");
|
||||||
|
|
||||||
auto results = QueryDatabase(query);
|
auto results = QueryDatabase(query);
|
||||||
if (!results.Success() || results.RowCount() == 0)
|
if (!results.Success() || results.RowCount() == 0)
|
||||||
@ -482,6 +482,7 @@ void ZoneDatabase::LoadGlobalLoot()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GlobalLootEntry e(atoi(row[0]), atoi(row[1]), row[2] ? row[2] : "");
|
GlobalLootEntry e(atoi(row[0]), atoi(row[1]), row[2] ? row[2] : "");
|
||||||
|
|
||||||
auto min_level = atoi(row[3]);
|
auto min_level = atoi(row[3]);
|
||||||
@ -521,6 +522,10 @@ void ZoneDatabase::LoadGlobalLoot()
|
|||||||
e.AddRule(GlobalLoot::RuleTypes::BodyType, std::stoi(b));
|
e.AddRule(GlobalLoot::RuleTypes::BodyType, std::stoi(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// null is not used
|
||||||
|
if (row[11])
|
||||||
|
e.AddRule(GlobalLoot::RuleTypes::HotZone, atoi(row[11]));
|
||||||
|
|
||||||
zone->AddGlobalLootEntry(e);
|
zone->AddGlobalLootEntry(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user