Core/DataStores: Implemented RewardPackXCurrencyType.db2

This commit is contained in:
joschiwald
2018-04-15 21:25:24 +02:00
parent 6f0078a89d
commit c1d865f09b
8 changed files with 63 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
--
-- Table structure for table `reward_pack_x_currency_type`
--
DROP TABLE IF EXISTS `reward_pack_x_currency_type`;
CREATE TABLE `reward_pack_x_currency_type` (
`ID` int(10) unsigned NOT NULL DEFAULT '0',
`CurrencyTypeID` int(10) unsigned NOT NULL DEFAULT '0',
`Quantity` int(11) NOT NULL DEFAULT '0',
`RewardPackID` int(10) unsigned NOT NULL DEFAULT '0',
`VerifiedBuild` smallint(6) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

View File

@@ -746,6 +746,10 @@ void HotfixDatabaseConnection::DoPrepareStatements()
PrepareStatement(HOTFIX_SEL_REWARD_PACK, "SELECT ID, Money, ArtifactXPMultiplier, ArtifactXPDifficulty, ArtifactXPCategoryID, CharTitleID, "
"TreasurePickerID FROM reward_pack ORDER BY ID DESC", CONNECTION_SYNCH);
// RewardPackXCurrencyType.db2
PrepareStatement(HOTFIX_SEL_REWARD_PACK_X_CURRENCY_TYPE, "SELECT ID, CurrencyTypeID, Quantity, RewardPackID FROM reward_pack_x_currency_type"
" ORDER BY ID DESC", CONNECTION_SYNCH);
// RewardPackXItem.db2
PrepareStatement(HOTFIX_SEL_REWARD_PACK_X_ITEM, "SELECT ID, ItemID, ItemQuantity, RewardPackID FROM reward_pack_x_item ORDER BY ID DESC", CONNECTION_SYNCH);

View File

@@ -395,6 +395,8 @@ enum HotfixDatabaseStatements : uint32
HOTFIX_SEL_REWARD_PACK,
HOTFIX_SEL_REWARD_PACK_X_CURRENCY_TYPE,
HOTFIX_SEL_REWARD_PACK_X_ITEM,
HOTFIX_SEL_RULESET_ITEM_UPGRADE,

View File

@@ -3760,6 +3760,22 @@ struct RewardPackLoadInfo
}
};
struct RewardPackXCurrencyTypeLoadInfo
{
static DB2LoadInfo const* Instance()
{
static DB2FieldMeta const fields[] =
{
{ false, FT_INT, "ID" },
{ false, FT_INT, "CurrencyTypeID" },
{ true, FT_INT, "Quantity" },
{ false, FT_INT, "RewardPackID" },
};
static DB2LoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, RewardPackXCurrencyTypeMeta::Instance(), HOTFIX_SEL_REWARD_PACK_X_CURRENCY_TYPE);
return &loadInfo;
}
};
struct RewardPackXItemLoadInfo
{
static DB2LoadInfo const* Instance()

View File

@@ -194,6 +194,7 @@ DB2Storage<QuestV2Entry> sQuestV2Store("QuestV2.db2", Que
DB2Storage<QuestXPEntry> sQuestXPStore("QuestXP.db2", QuestXpLoadInfo::Instance());
DB2Storage<RandPropPointsEntry> sRandPropPointsStore("RandPropPoints.db2", RandPropPointsLoadInfo::Instance());
DB2Storage<RewardPackEntry> sRewardPackStore("RewardPack.db2", RewardPackLoadInfo::Instance());
DB2Storage<RewardPackXCurrencyTypeEntry> sRewardPackXCurrencyTypeStore("RewardPackXCurrencyType.db2", RewardPackXCurrencyTypeLoadInfo::Instance());
DB2Storage<RewardPackXItemEntry> sRewardPackXItemStore("RewardPackXItem.db2", RewardPackXItemLoadInfo::Instance());
DB2Storage<RulesetItemUpgradeEntry> sRulesetItemUpgradeStore("RulesetItemUpgrade.db2", RulesetItemUpgradeLoadInfo::Instance());
DB2Storage<SandboxScalingEntry> sSandboxScalingStore("SandboxScaling.db2", SandboxScalingLoadInfo::Instance());
@@ -370,6 +371,7 @@ namespace
PvpTalentsByPosition _pvpTalentsByPosition;
uint32 _pvpTalentUnlock[MAX_PVP_TALENT_TIERS][MAX_PVP_TALENT_COLUMNS];
QuestPackageItemContainer _questPackages;
std::unordered_map<uint32, std::vector<RewardPackXCurrencyTypeEntry const*>> _rewardPackCurrencyTypes;
std::unordered_map<uint32, std::vector<RewardPackXItemEntry const*>> _rewardPackItems;
RulesetItemUpgradeContainer _rulesetItemUpgrade;
SkillRaceClassInfoContainer _skillRaceClassInfoBySkill;
@@ -626,6 +628,7 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
LOAD_DB2(sQuestXPStore);
LOAD_DB2(sRandPropPointsStore);
LOAD_DB2(sRewardPackStore);
LOAD_DB2(sRewardPackXCurrencyTypeStore);
LOAD_DB2(sRewardPackXItemStore);
LOAD_DB2(sRulesetItemUpgradeStore);
LOAD_DB2(sSandboxScalingStore);
@@ -985,6 +988,9 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
_questPackages[questPackageItem->PackageID].second.push_back(questPackageItem);
}
for (RewardPackXCurrencyTypeEntry const* rewardPackXCurrencyType : sRewardPackXCurrencyTypeStore)
_rewardPackCurrencyTypes[rewardPackXCurrencyType->RewardPackID].push_back(rewardPackXCurrencyType);
for (RewardPackXItemEntry const* rewardPackXItem : sRewardPackXItemStore)
_rewardPackItems[rewardPackXItem->RewardPackID].push_back(rewardPackXItem);
@@ -2004,6 +2010,15 @@ uint8 DB2Manager::GetPvpItemLevelBonus(uint32 itemId) const
return 0;
}
std::vector<RewardPackXCurrencyTypeEntry const*> const* DB2Manager::GetRewardPackCurrencyTypesByRewardID(uint32 rewardPackID) const
{
auto itr = _rewardPackCurrencyTypes.find(rewardPackID);
if (itr != _rewardPackCurrencyTypes.end())
return &itr->second;
return nullptr;
}
std::vector<RewardPackXItemEntry const*> const* DB2Manager::GetRewardPackItemsByRewardID(uint32 rewardPackID) const
{
auto itr = _rewardPackItems.find(rewardPackID);

View File

@@ -316,6 +316,7 @@ public:
std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItems(uint32 questPackageID) const;
std::vector<QuestPackageItemEntry const*> const* GetQuestPackageItemsFallback(uint32 questPackageID) const;
uint32 GetQuestUniqueBitFlag(uint32 questId);
std::vector<RewardPackXCurrencyTypeEntry const*> const* GetRewardPackCurrencyTypesByRewardID(uint32 rewardPackID) const;
std::vector<RewardPackXItemEntry const*> const* GetRewardPackItemsByRewardID(uint32 rewardPackID) const;
uint32 GetRulesetItemUpgrade(uint32 itemId) const;
SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, uint8 class_);

View File

@@ -2207,6 +2207,14 @@ struct RewardPackEntry
uint32 TreasurePickerID;
};
struct RewardPackXCurrencyTypeEntry
{
uint32 ID;
uint32 CurrencyTypeID;
int32 Quantity;
uint32 RewardPackID;
};
struct RewardPackXItemEntry
{
uint32 ID;

View File

@@ -6446,6 +6446,11 @@ void Player::RewardPlayerWithRewardPack(RewardPackEntry const* rewardPackEntry)
SetTitle(charTitlesEntry);
ModifyMoney(rewardPackEntry->Money);
if (std::vector<RewardPackXCurrencyTypeEntry const*> const* rewardCurrencyTypes = sDB2Manager.GetRewardPackCurrencyTypesByRewardID(rewardPackEntry->ID))
for (RewardPackXCurrencyTypeEntry const* currency : *rewardCurrencyTypes)
ModifyCurrency(currency->CurrencyTypeID, currency->Quantity);
if (std::vector<RewardPackXItemEntry const*> const* rewardPackXItems = sDB2Manager.GetRewardPackItemsByRewardID(rewardPackEntry->ID))
for (RewardPackXItemEntry const* rewardPackXItem : *rewardPackXItems)
AddItem(rewardPackXItem->ItemID, rewardPackXItem->ItemQuantity);