diff options
| author | Shauren <shauren.trinity@gmail.com> | 2021-06-04 19:27:26 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-06-04 19:27:26 +0200 |
| commit | 80a6347b7a0e8dfbe5e690504ed373f75c4f4c76 (patch) | |
| tree | 3642bbd6c7ce37bc212d1811368e3c8cbead80c6 /src/server/game/DataStores | |
| parent | ad683a356a173f47fd9cd1f9860d5ea5d6da868c (diff) | |
Core/Reputation: Implemented "friendship reputation"
Diffstat (limited to 'src/server/game/DataStores')
| -rw-r--r-- | src/server/game/DataStores/DB2LoadInfo.h | 35 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2Stores.cpp | 18 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2Stores.h | 4 | ||||
| -rw-r--r-- | src/server/game/DataStores/DB2Structure.h | 21 | ||||
| -rw-r--r-- | src/server/game/DataStores/DBCEnums.h | 11 |
5 files changed, 89 insertions, 0 deletions
diff --git a/src/server/game/DataStores/DB2LoadInfo.h b/src/server/game/DataStores/DB2LoadInfo.h index 9f55b36f2fe..516842ab861 100644 --- a/src/server/game/DataStores/DB2LoadInfo.h +++ b/src/server/game/DataStores/DB2LoadInfo.h @@ -1998,6 +1998,41 @@ struct FactionTemplateLoadInfo } }; +struct FriendshipRepReactionLoadInfo +{ + static DB2LoadInfo const* Instance() + { + static DB2FieldMeta const fields[] = + { + { false, FT_INT, "ID" }, + { false, FT_STRING, "Reaction" }, + { false, FT_INT, "FriendshipRepID" }, + { false, FT_SHORT, "ReactionThreshold" }, + }; + static DB2LoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, FriendshipRepReactionMeta::Instance(), HOTFIX_SEL_FRIENDSHIP_REP_REACTION); + return &loadInfo; + } +}; + +struct FriendshipReputationLoadInfo +{ + static DB2LoadInfo const* Instance() + { + static DB2FieldMeta const fields[] = + { + { false, FT_STRING, "Description" }, + { false, FT_STRING, "StandingModified" }, + { false, FT_STRING, "StandingChanged" }, + { false, FT_INT, "ID" }, + { true, FT_INT, "FactionID" }, + { true, FT_INT, "TextureFileID" }, + { true, FT_INT, "Flags" }, + }; + static DB2LoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, FriendshipReputationMeta::Instance(), HOTFIX_SEL_FRIENDSHIP_REPUTATION); + return &loadInfo; + } +}; + struct GameobjectDisplayInfoLoadInfo { static DB2LoadInfo const* Instance() diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index 865afd679d4..bd8bba408b8 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -130,6 +130,8 @@ DB2Storage<ExpectedStatEntry> sExpectedStatStore("ExpectedStat DB2Storage<ExpectedStatModEntry> sExpectedStatModStore("ExpectedStatMod.db2", ExpectedStatModLoadInfo::Instance()); DB2Storage<FactionEntry> sFactionStore("Faction.db2", FactionLoadInfo::Instance()); DB2Storage<FactionTemplateEntry> sFactionTemplateStore("FactionTemplate.db2", FactionTemplateLoadInfo::Instance()); +DB2Storage<FriendshipRepReactionEntry> sFriendshipRepReactionStore("FriendshipRepReaction.db2", FriendshipRepReactionLoadInfo::Instance()); +DB2Storage<FriendshipReputationEntry> sFriendshipReputationStore("FriendshipReputation.db2", FriendshipReputationLoadInfo::Instance()); DB2Storage<GameObjectDisplayInfoEntry> sGameObjectDisplayInfoStore("GameObjectDisplayInfo.db2", GameobjectDisplayInfoLoadInfo::Instance()); DB2Storage<GameObjectsEntry> sGameObjectsStore("GameObjects.db2", GameobjectsLoadInfo::Instance()); DB2Storage<GarrAbilityEntry> sGarrAbilityStore("GarrAbility.db2", GarrAbilityLoadInfo::Instance()); @@ -411,6 +413,7 @@ namespace std::unordered_map<std::pair<uint32 /*level*/, int32 /*expansion*/>, ExpectedStatEntry const*> _expectedStatsByLevel; std::unordered_map<uint32 /*contentTuningId*/, std::vector<ExpectedStatModEntry const*>> _expectedStatModsByContentTuning; FactionTeamContainer _factionTeams; + std::unordered_map<uint32, std::set<FriendshipRepReactionEntry const*>> _friendshipRepReactions; HeirloomItemsContainer _heirlooms; GlyphBindableSpellsContainer _glyphBindableSpells; GlyphRequiredSpecsContainer _glyphRequiredSpecs; @@ -669,6 +672,8 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul LOAD_DB2(sExpectedStatModStore); LOAD_DB2(sFactionStore); LOAD_DB2(sFactionTemplateStore); + LOAD_DB2(sFriendshipRepReactionStore); + LOAD_DB2(sFriendshipReputationStore); LOAD_DB2(sGameObjectsStore); LOAD_DB2(sGameObjectDisplayInfoStore); LOAD_DB2(sGarrAbilityStore); @@ -1077,6 +1082,9 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul if (faction->ParentFactionID) _factionTeams[faction->ParentFactionID].push_back(faction->ID); + for (FriendshipRepReactionEntry const* friendshipRepReaction : sFriendshipRepReactionStore) + _friendshipRepReactions[friendshipRepReaction->FriendshipRepID].insert(friendshipRepReaction); + for (GameObjectDisplayInfoEntry const* gameObjectDisplayInfo : sGameObjectDisplayInfoStore) { if (gameObjectDisplayInfo->GeoBoxMax.X < gameObjectDisplayInfo->GeoBoxMin.X) @@ -2219,6 +2227,11 @@ std::vector<uint32> const* DB2Manager::GetFactionTeamList(uint32 faction) const return Trinity::Containers::MapGetValuePtr(_factionTeams, faction); } +std::set<FriendshipRepReactionEntry const*> const* DB2Manager::GetFriendshipRepReactions(uint32 friendshipRepID) const +{ + return Trinity::Containers::MapGetValuePtr(_friendshipRepReactions, friendshipRepID); +} + uint32 DB2Manager::GetGlobalCurveId(GlobalCurve globalCurveType) const { for (GlobalCurveEntry const* globalCurveEntry : sGlobalCurveStore) @@ -3222,6 +3235,11 @@ bool ItemLevelSelectorQualityEntryComparator::Compare(ItemLevelSelectorQualityEn return left->Quality < right->Quality; } +bool DB2Manager::FriendshipRepReactionEntryComparator::Compare(FriendshipRepReactionEntry const* left, FriendshipRepReactionEntry const* right) +{ + return left->ReactionThreshold < right->ReactionThreshold; +} + bool DB2Manager::MountTypeXCapabilityEntryComparator::Compare(MountTypeXCapabilityEntry const* left, MountTypeXCapabilityEntry const* right) { if (left->MountTypeID == right->MountTypeID) diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h index c39479ee847..640fe011a3d 100644 --- a/src/server/game/DataStores/DB2Stores.h +++ b/src/server/game/DataStores/DB2Stores.h @@ -100,6 +100,8 @@ TC_GAME_API extern DB2Storage<EmotesEntry> sEmotesStore TC_GAME_API extern DB2Storage<EmotesTextEntry> sEmotesTextStore; TC_GAME_API extern DB2Storage<FactionEntry> sFactionStore; TC_GAME_API extern DB2Storage<FactionTemplateEntry> sFactionTemplateStore; +TC_GAME_API extern DB2Storage<FriendshipRepReactionEntry> sFriendshipRepReactionStore; +TC_GAME_API extern DB2Storage<FriendshipReputationEntry> sFriendshipReputationStore; TC_GAME_API extern DB2Storage<GameObjectDisplayInfoEntry> sGameObjectDisplayInfoStore; TC_GAME_API extern DB2Storage<GameObjectsEntry> sGameObjectsStore; TC_GAME_API extern DB2Storage<GarrAbilityEntry> sGarrAbilityStore; @@ -278,6 +280,7 @@ TC_GAME_API extern TaxiPathNodesByPath sTaxiPathNod class TC_GAME_API DB2Manager { public: + DEFINE_DB2_SET_COMPARATOR(FriendshipRepReactionEntry) DEFINE_DB2_SET_COMPARATOR(MountTypeXCapabilityEntry) struct HotfixRecord @@ -357,6 +360,7 @@ public: EmotesTextSoundEntry const* GetTextSoundEmoteFor(uint32 emote, uint8 race, uint8 gender, uint8 class_) const; float EvaluateExpectedStat(ExpectedStatType stat, uint32 level, int32 expansion, uint32 contentTuningId, Classes unitClass) const; std::vector<uint32> const* GetFactionTeamList(uint32 faction) const; + std::set<FriendshipRepReactionEntry const*> const* GetFriendshipRepReactions(uint32 friendshipRepID) const; uint32 GetGlobalCurveId(GlobalCurve globalCurveType) const; std::vector<uint32> const* GetGlyphBindableSpells(uint32 glyphPropertiesId) const; std::vector<uint32> const* GetGlyphRequiredSpecs(uint32 glyphPropertiesId) const; diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h index dcc563884b2..101a5db0656 100644 --- a/src/server/game/DataStores/DB2Structure.h +++ b/src/server/game/DataStores/DB2Structure.h @@ -1401,6 +1401,27 @@ struct FactionTemplateEntry bool IsContestedGuardFaction() const { return (Flags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD) != 0; } }; +struct FriendshipRepReactionEntry +{ + uint32 ID; + LocalizedString Reaction; + uint32 FriendshipRepID; + uint16 ReactionThreshold; +}; + +struct FriendshipReputationEntry +{ + LocalizedString Description; + LocalizedString StandingModified; + LocalizedString StandingChanged; + uint32 ID; + int32 FactionID; + int32 TextureFileID; + int32 Flags; + + EnumFlag<FriendshipReputationFlags> GetFlags() const { return static_cast<FriendshipReputationFlags>(Flags); } +}; + struct GameObjectDisplayInfoEntry { uint32 ID; diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index eae6227809c..875576fe4c5 100644 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -997,6 +997,17 @@ enum FactionMasks // if none flags set then non-aggressive creature }; +enum class FriendshipReputationFlags : int32 +{ + NoFXOnReactionChange = 0x01, + NoLogTextOnRepGain = 0x02, + NoLogTextOnReactionChange = 0x04, + ShowRepGainandReactionChangeForHiddenFaction = 0x08, + NoRepGainModifiers = 0x10 +}; + +DEFINE_ENUM_FLAG(FriendshipReputationFlags); + enum class GlobalCurve : int32 { CritDiminishing = 0, |
