Untitled diff

Created Diff never expires
44 removals
Lines
Total
Removed
Words
Total
Removed
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
108 lines
97 additions
Lines
Total
Added
Words
Total
Added
To continue using this feature, upgrade to
Diffchecker logo
Diffchecker Pro
161 lines
#ifndef PREMIUM_SYSTEM_H
#ifndef PREMIUM_SYSTEM_H
#define PREMIUM_SYSTEM_H
#define PREMIUM_SYSTEM_H


#include <unordered_map>

struct PremiumElements
struct PremiumElements
{
{
uint32 id;
uint32 id;
uint8 premium;
uint8 premium;
uint32 hp;
uint32 hp;
uint32 power_max;
uint32 power_max;
uint64 time;
uint64 time;
bool chat;
bool chat;
uint64 chat_time;
uint64 chat_time;
std::string last_message;
std::string last_message;
};
};


struct PremiumItemElements
struct PremiumItemElements
{
{
uint32 id;
uint32 id;
uint8 premium;
uint8 premium;
};
};


struct PremiumLocationElements
struct PremiumLocationElements
{
{
uint8 id;
uint8 id;
uint32 map_id;
uint32 map_id;
float x;
float x;
float y;
float y;
float z;
float z;
float o;
float o;
};
};


struct PremiumPlayerLocationElements
struct PremiumPlayerLocationElements
{
{
uint32 guid;
uint32 guid;
uint32 map_id;
uint32 map_id;
float x;
float x;
float y;
float y;
float z;
float z;
float o;
float o;
};
};


struct PremiumTeamLocationElements
struct PremiumTeamLocationElements
{
{
uint8 team;
uint8 team;
uint32 map_id;
uint32 map_id;
float x;
float x;
float y;
float y;
float z;
float z;
float o;
float o;
};
};


class PREM
class PremiumSystemMgr
{
{
private:
PremiumSystemMgr();
~PremiumSystemMgr();


public:
public:
PREM();
static PremiumSystemMgr* instance();
~PREM();


// Toolz
uint8 GetPremiumType() { return premiumType; }
static uint64 ConvertStringToNumber(std::string arg);
uint8 GetChatTeam() { return premiumChatTeam; }
static std::string ConvertNumberToString(uint64 numberX);
uint8 GetGMMinRank() { return premiumGMMinRank; }
float GetModifier() { return premiumMod; }
bool IsTimed() { return premiumTimerEnabled != 0; }
bool CanWaterBreathe() { return premiumWaterBreathe != 0; }
bool CanDecreaseSpellCost() { return premiumSpellCostDecrease != 0; }
bool IsItemsEnabled() { return premiumItemsEnabled != 0; }
bool IsTalentPointBonusEnabled() { return premiumTPEnabled != 0; }
bool IsHealthPointBonusEnabled() { return premiumHPEnabled != 0; }
bool IsManaPointBonusEnabled() { return premiumManaEnabled != 0; }
bool IsRagePointBonusEnabled() { return premiumRageEnabled != 0; }
uint64 GetDurationInSeconds() { return premiumTimerDuration; }
uint32 GetDurationInDays() { return ((((premiumTimerDuration) / 60) / 60) / 24); }
uint32 GetTalentPointBonus() { return premiumTPBonus; }
uint32 GetUpgradeItem() { return premiumUpgradeItem; }
uint32 GetTitleId() { return premiumTitleId; }
uint32 GetTitleMaskId() { return premiumTitleMaskId; }
uint32 GetChatDelay() { return premiumChatDelay; }


// Global Getterz
void SetPremiumType(uint8 v) { premiumType = v; }
static uint8 GetPremiumType();
void SetTimerEnabled(bool v) { premiumTimerEnabled = v; }
static float PREM::GetPremiumModifier();
void SetTimerDuration(uint64 v) { premiumTimerDuration *= v; }
static bool IsPremiumTimed();
void SetGMMinRank(uint8 v) { premiumGMMinRank = v; }
static bool CanWaterBreathe();
void SetItemEnabled(bool v) { premiumItemsEnabled = v; }
static bool CanDecreaseSpellCost();
void SetModifier(float v) { premiumMod = v; }
static uint64 GetPremiumDurationInSeconds();
void SetChatDelay(uint32 v) { premiumChatDelay = v; }
static uint32 GetPremiumDurationInDays();
void SetChatTeam(uint8 v) { premiumChatTeam = v; }
static bool IsPremiumItemsEnabled();
void SetTPEnabled(bool v) { premiumTPEnabled = v; }
static bool IsPremiumTalentPointBonusEnabled();
void SetTPBonus(uint32 v) { premiumTPBonus = v; }
static uint32 GetPremiumTalentPointBonus();
void SetHPEnabled(bool v) { premiumHPEnabled = v; }
static bool IsPremiumHealthPointBonusEnabled();
void SetManaEnabled(bool v) { premiumManaEnabled = v; }
static bool IsPremiumManaPointBonusEnabled();
void SetRageEnabled(bool v) { premiumRageEnabled = v; }
static bool IsPremiumRagePointBonusEnabled();
void SetTitleId(uint32 v) { premiumTitleId = v; }
static std::string GetAmountInString(uint32 amount);
void SetTitleMaskId(uint32 v) { premiumTitleMaskId = v; }
void SetWaterBreathe(uint8 v) { premiumWaterBreathe = v; }
void SetSpellCostDecrease(uint8 v) { premiumSpellCostDecrease = v; }
void SetUpgradeItem(uint32 v) { premiumUpgradeItem = v; }


// Player Getterz
// Player
static uint32 GetPlayerPremiumId(Player* player);
uint32 GetPlayerPremiumId(Player* player);
static bool IsPlayerPremium(Player* player);
uint32 GetPlayerPremiumTimeInDays(Player* player);
static void UpdatePlayerCustomHomeTeleport(uint32 guid, uint32 map_id, float x, float y, float z, float o);
uint32 IncreaseValueWithModifier(Player* player, uint32 value);
static uint64 GetPlayerPremiumStartTimeInSeconds(Player* player);
uint32 DecreaseValueWithModifier(Player* player, uint32 value);
static uint64 GetPlayerPremiumRemainingTimeInSeconds(Player* player);
uint64 GetPlayerPremiumStartTimeInSeconds(Player* player);
static std::string GetPlayerPremiumTimeLeftInString(Player* player);
uint64 GetPlayerPremiumRemainingTimeInSeconds(Player* player);
static uint32 GetPlayerPremiumTimeInDays(Player* player);
std::string GetPlayerPremiumTimeLeftInString(Player* player);
static void DepositGoldToPlayerGuildBank(Player* player, uint32 amount);
bool IsPlayerPremium(Player* player);
static uint32 IncreaseValueWithModifier(Player* player, uint32 value);
void UpdatePlayerCustomHomeTeleport(uint32 guid, uint32 map_id, float x, float y, float z, float o);
static uint32 DecreaseValueWithModifier(Player* player, uint32 value);
void DepositGoldToPlayerGuildBank(Player* player, uint32 amount);
void AddPremiumToPlayer(Player* player);
void RemovePremiumFromPlayer(Player* player);
void UpdatePlayerPremiumValue(Player* player, uint8 value, uint64 time);


// Player Setterz
// Item
static void AddPremiumToPlayer(Player* player);
bool IsItemPremium(Item* item);
static void RemovePremiumFromPlayer(Player* player);
void UpdateItemPremiumValue(uint32 item_id, uint8 value);
static void UpdatePlayerPremiumValue(Player* player, uint8 value, uint64 time);
void RemoveItem(uint32 id, Player* player);


// Item Getters
// Misc
static bool IsItemPremium(Item* item);
void DeletePremium(Player* player);
// Item Setterz
uint64 ConvertStringToNumber(std::string arg);
static void UpdateItemPremiumValue(uint32 item_id, uint8 value);
std::string ConvertNumberToString(uint64 numberX);
std::string GetAmountInString(uint32 amount);
bool CheckIfPlayerInCombatOrDead(Player* player);
void TeleportPlayer(Player* player, uint8 id);

std::unordered_map<uint32, PremiumElements> Premium;
std::unordered_map<uint32, PremiumItemElements> PremiumItem;
std::unordered_map<uint32, PremiumLocationElements> PremiumLocations;
std::unordered_map<uint32, PremiumLocationElements> PremiumMallLocations;
std::unordered_map<uint32, PremiumLocationElements> PremiumPublicMallLocations;
std::unordered_map<uint32, PremiumPlayerLocationElements> PremiumPlayerLocations;
std::unordered_map<uint32, PremiumTeamLocationElements> PremiumTeamLocations;


private:
private:
// Tools
uint8 premiumType;
static bool CheckIfPlayerInCombatOrDead(Player* player);
uint8 premiumTimerEnabled;
static void TeleportPlayer(Player* player, uint8 id);
uint8 premiumItemsEnabled;
static void RemoveItem(uint32 id, Player* player);
uint8 premiumTPEnabled;
uint8 premiumHPEnabled;
uint8 premiumManaEnabled;
uint8 premiumRageEnabled;
uint8 premiumGMMinRank;
uint8 premiumChatTeam;
uint8 premiumWaterBreathe;
uint8 premiumSpellCostDecrease;
uint32 premiumTitleId;
uint32 premiumTitleMaskId;
uint32 premiumTPBonus;
uint32 premiumUpgradeItem;
uint32 premiumChatDelay;
uint64 premiumTimerDuration;

float premiumMod;
};
};


#define sPremiumSystemMgr PremiumSystemMgr::instance()
#endif
#endif