Advertisement
skillz79

Transmogrification.h

Aug 10th, 2013
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.46 KB | None | 0 0
  1. #ifndef DEF_TRANSMOGRIFICATION_H
  2. #define DEF_TRANSMOGRIFICATION_H
  3.  
  4. #define PRESETS // comment this line to disable preset feature totally
  5.  
  6. #include "ScriptPCH.h"
  7. #include "Language.h"
  8. #include "Config.h"
  9.  
  10. #define MAX_OPTIONS 25 // do not alter
  11.  
  12. enum TransmogTrinityStrings // Language.h might have same entries, appears when executing SQL, change if needed
  13. {
  14. LANG_ERR_TRANSMOG_OK = 11100, // change this
  15. LANG_ERR_TRANSMOG_INVALID_SLOT,
  16. LANG_ERR_TRANSMOG_INVALID_SRC_ENTRY,
  17. LANG_ERR_TRANSMOG_MISSING_SRC_ITEM,
  18. LANG_ERR_TRANSMOG_MISSING_DEST_ITEM,
  19. LANG_ERR_TRANSMOG_INVALID_ITEMS,
  20. LANG_ERR_TRANSMOG_NOT_ENOUGH_MONEY,
  21. LANG_ERR_TRANSMOG_NOT_ENOUGH_TOKENS,
  22.  
  23. LANG_ERR_UNTRANSMOG_OK,
  24. LANG_ERR_UNTRANSMOG_NO_TRANSMOGS,
  25.  
  26. #ifdef PRESETS
  27. LANG_PRESET_ERR_INVALID_NAME,
  28. #endif
  29. };
  30.  
  31. class Transmogrification
  32. {
  33. public:
  34. typedef UNORDERED_MAP<uint64, uint64> transmogData;
  35. typedef UNORDERED_MAP<uint64, transmogData> transmogMap;
  36. transmogMap entryMap; // entryMap[pGUID][iGUID] = entry
  37. transmogData dataMap; // dataMap[iGUID] = pGUID
  38.  
  39. #ifdef PRESETS
  40. typedef std::map<uint8, uint32> slotMap;
  41. typedef std::map<uint8, slotMap> presetData;
  42. typedef UNORDERED_MAP<uint64, presetData> presetDataMap;
  43. presetDataMap presetById; // presetById[pGUID][presetID][slot] = entry
  44. typedef std::map<uint8, std::string> presetIdMap;
  45. typedef UNORDERED_MAP<uint64, presetIdMap> presetNameMap;
  46. presetNameMap presetByName; // presetByName[pGUID][presetID] = presetName
  47.  
  48. void PresetTransmog(Player* player, Item* itemTransmogrified, uint32 fakeEntry, uint8 slot);
  49.  
  50. bool EnableSets;
  51. uint8 MaxSets;
  52. float SetCostModifier;
  53. int32 SetCopperCost;
  54.  
  55. bool GetEnableSets() const;
  56. uint8 GetMaxSets() const;
  57. float GetSetCostModifier() const;
  58. int32 GetSetCopperCost() const;
  59.  
  60. void LoadPlayerSets(uint64 pGUID);
  61. void UnloadPlayerSets(uint64 pGUID);
  62. #endif
  63.  
  64. std::string GetItemIcon(uint32 entry, uint32 width, uint32 height, int x, int y);
  65. std::string GetSlotIcon(uint8 slot, uint32 width, uint32 height, int x, int y);
  66. const char * GetSlotName(uint8 slot, WorldSession* session) const;
  67. std::string GetItemLink(Item* item, WorldSession* session);
  68. std::string GetItemLink(uint32 entry, WorldSession* session);
  69. uint32 GetFakeEntry(uint64 itemGUID) const;
  70. void DeleteFakeFromDB(uint64 itemGUID, SQLTransaction* trans = NULL);
  71. void DeleteFakeEntry(Player* player, uint8 slot, Item* itemTransmogrified, SQLTransaction* trans = NULL);
  72. void SetFakeEntry(Player* player, uint32 newEntry, uint8 slot, Item* itemTransmogrified);
  73.  
  74. TransmogTrinityStrings Transmogrify(Player* player, uint64 itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost = false);
  75. bool CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* destination, ItemTemplate const* source);
  76. bool SuitableForTransmogrification(Player* player, ItemTemplate const* proto);
  77. // bool CanBeTransmogrified(Item const* item);
  78. // bool CanTransmogrify(Item const* item);
  79. uint32 GetSpecialPrice(ItemTemplate const* proto) const;
  80. bool IsRangedWeapon(uint32 Class, uint32 SubClass) const;
  81.  
  82. // config values
  83. bool EnableTransmogInfo;
  84. uint32 TransmogNpcText;
  85. bool EnableSetInfo;
  86. uint32 SetNpcText;
  87.  
  88. std::set<uint32> Allowed;
  89. std::set<uint32> NotAllowed;
  90.  
  91. float ScaledCostModifier;
  92. int32 CopperCost;
  93.  
  94. bool RequireToken;
  95. uint32 TokenEntry;
  96. uint32 TokenAmount;
  97.  
  98. bool AllowPoor;
  99. bool AllowCommon;
  100. bool AllowUncommon;
  101. bool AllowRare;
  102. bool AllowEpic;
  103. bool AllowLegendary;
  104. bool AllowArtifact;
  105. bool AllowHeirloom;
  106. bool AllowMixedArmorTypes;
  107. bool AllowMixedWeaponTypes;
  108.  
  109. // Config
  110. bool GetEnableTransmogInfo() const;
  111. uint32 GetTransmogNpcText() const;
  112. bool GetEnableSetInfo() const;
  113. uint32 GetSetNpcText() const;
  114.  
  115. bool IsAllowed(uint32 entry) const;
  116. bool IsNotAllowed(uint32 entry) const;
  117.  
  118. float GetScaledCostModifier() const;
  119. int32 GetCopperCost() const;
  120.  
  121. bool GetRequireToken() const;
  122. uint32 GetTokenEntry() const;
  123. uint32 GetTokenAmount() const;
  124.  
  125. bool IsAllowedQuality(uint32 quality) const;
  126. bool GetAllowMixedArmorTypes() const;
  127. bool GetAllowMixedWeaponTypes() const;
  128.  
  129. void LoadConfig(bool reload);
  130. };
  131. #define sTransmogrification ACE_Singleton<Transmogrification, ACE_Null_Mutex>::instance()
  132.  
  133. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement