Skip to content

Commit

Permalink
fix hateforge
Browse files Browse the repository at this point in the history
  • Loading branch information
hatersgit committed Feb 5, 2024
1 parent 70912f6 commit 020b89e
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions modules/mod-Forge/src/ForgeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ struct ForgeCharacterXmog
std::unordered_map<uint8, uint32> slottedItems;
};

// hater: custom stats
#define MAINSTATS 3
#define TANKDIST 0

class ForgeCache : public DatabaseScript
{
Expand Down Expand Up @@ -1046,6 +1049,11 @@ class ForgeCache : public DatabaseScript

std::unordered_map<uint32 /*class*/, uint32 /*spec*/> _playerClassFirstSpec;

// hater: custom items
std::unordered_map<InventoryType, float /*value*/> _forgeItemSlotValues;
std::unordered_map<ItemModType, float /*value*/> _forgeItemStatValues;
std::unordered_map<uint8, std::vector<ItemModType>> _forgeItemSecondaryStatPools;

void AddDefaultLoadout(Player* player)
{
std::list<ForgeTalentTab*> tabs;
Expand Down Expand Up @@ -2043,6 +2051,61 @@ class ForgeCache : public DatabaseScript
_playerActiveTalentLoadouts[guid] = plo;
} while (loadouts->NextRow());
}

// hater: custom items
void AddItemSlotValue() {
_forgeItemSlotValues.clear();

QueryResult values = WorldDatabase.Query("select * from `acore_world`.`forge_item_slot_value`");

if (!values)
return;

do
{
Field* valuesFields = values->Fetch();
InventoryType inv = InventoryType(valuesFields[0].Get<uint32>());
float value = valuesFields[1].Get<float>();

_forgeItemSlotValues[inv] = value;
} while (values->NextRow());
}

void AddItemStatValue() {
_forgeItemStatValues.clear();

QueryResult values = WorldDatabase.Query("select * from `acore_world`.`forge_item_stat_value`");

if (!values)
return;

do
{
Field* valuesFields = values->Fetch();
ItemModType stat = ItemModType(valuesFields[0].Get<uint32>());
float value = valuesFields[1].Get<float>();

_forgeItemStatValues[stat] = value;
} while (values->NextRow());
}

void AddItemStatPools() {
_forgeItemSecondaryStatPools.clear();

QueryResult values = WorldDatabase.Query("select * from `acore_world`.`forge_item_stat_pool`");

if (!values)
return;

do
{
Field* valuesFields = values->Fetch();
uint8 mainstat = valuesFields[0].Get<uint8>();
ItemModType secondarystat = ItemModType(valuesFields[1].Get<uint32>());

_forgeItemSecondaryStatPools[mainstat].emplace_back(secondarystat);
} while (values->NextRow());
}
};

#define sForgeCache ForgeCache::instance()

0 comments on commit 020b89e

Please sign in to comment.