refactor(DB/reputation_spillover_template): Reputation spillover table expansion (#14763)

* Update ObjectMgr.cpp

Rework to `ObjectMgr::LoadReputationSpilloverTemplate()` allowing more factons to be added.

* Create reputation_spillover_template-update.sql

Alteration to `reputation_spillover_template` table, update allowing to add two more factions.

* Update SharedDefines.h

`MAX_SPILLOVER_FACTIONS` is now equal 6 instead of 4.

* Update reputation_spillover_template-update.sql

Now it alters table instead recreating it.
This commit is contained in:
Alyst3r
2023-10-22 04:45:50 +02:00
committed by GitHub
parent 900ca087c9
commit 2e55cad450
3 changed files with 16 additions and 3 deletions

View File

@@ -0,0 +1,7 @@
ALTER TABLE `reputation_spillover_template`
ADD COLUMN `faction5` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
ADD COLUMN `rate_5` FLOAT NOT NULL DEFAULT '0',
ADD COLUMN `rank_5` TINYINT UNSIGNED NOT NULL DEFAULT '0',
ADD COLUMN `faction6` SMALLINT UNSIGNED NOT NULL DEFAULT '0',
ADD COLUMN `rate_6` FLOAT NOT NULL DEFAULT '0',
ADD COLUMN `rank_6` TINYINT UNSIGNED NOT NULL DEFAULT '0';

View File

@@ -7676,8 +7676,8 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
_repSpilloverTemplateStore.clear(); // for reload case
uint32 count = 0; // 0 1 2 3 4 5 6 7 8 9 10 11 12
QueryResult result = WorldDatabase.Query("SELECT faction, faction1, rate_1, rank_1, faction2, rate_2, rank_2, faction3, rate_3, rank_3, faction4, rate_4, rank_4 FROM reputation_spillover_template");
uint32 count = 0; // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
QueryResult result = WorldDatabase.Query("SELECT faction, faction1, rate_1, rank_1, faction2, rate_2, rank_2, faction3, rate_3, rank_3, faction4, rate_4, rank_4, faction5, rate_5, rank_5, faction6, rate_6, rank_6 FROM reputation_spillover_template");
if (!result)
{
@@ -7706,6 +7706,12 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
repTemplate.faction[3] = fields[10].Get<uint16>();
repTemplate.faction_rate[3] = fields[11].Get<float>();
repTemplate.faction_rank[3] = fields[12].Get<uint8>();
repTemplate.faction[4] = fields[13].Get<uint16>();
repTemplate.faction_rate[4] = fields[14].Get<float>();
repTemplate.faction_rank[4] = fields[15].Get<uint8>();
repTemplate.faction[5] = fields[16].Get<uint16>();
repTemplate.faction_rate[5] = fields[17].Get<float>();
repTemplate.faction_rank[5] = fields[18].Get<uint8>();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);

View File

@@ -216,7 +216,7 @@ enum FactionTemplates
#define MIN_REPUTATION_RANK (REP_HATED)
#define MAX_REPUTATION_RANK 8
#define MAX_SPILLOVER_FACTIONS 4
#define MAX_SPILLOVER_FACTIONS 6
enum MoneyConstants
{