*Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget --HG-- branch : trunk
This commit is contained in:
@@ -17,20 +17,14 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef TRINITYCORE_GUILD_H
|
||||
#define TRINITYCORE_GUILD_H
|
||||
|
||||
#define WITHDRAW_MONEY_UNLIMITED 0xFFFFFFFF
|
||||
#define WITHDRAW_SLOT_UNLIMITED 0xFFFFFFFF
|
||||
|
||||
#include "Item.h"
|
||||
|
||||
class Item;
|
||||
|
||||
#define GUILD_RANKS_MIN_COUNT 5
|
||||
#define GUILD_RANKS_MAX_COUNT 10
|
||||
|
||||
enum GuildDefaultRanks
|
||||
{
|
||||
//these ranks can be modified, but they cannot be deleted
|
||||
@@ -42,7 +36,6 @@ enum GuildDefaultRanks
|
||||
//When promoting member server does: rank--;!
|
||||
//When demoting member server does: rank++;!
|
||||
};
|
||||
|
||||
enum GuildRankRights
|
||||
{
|
||||
GR_RIGHT_EMPTY = 0x00000040,
|
||||
@@ -65,7 +58,6 @@ enum GuildRankRights
|
||||
GR_RIGHT_CREATE_GUILD_EVENT = 0x00100000, // wotlk
|
||||
GR_RIGHT_ALL = 0x001DF1FF
|
||||
};
|
||||
|
||||
enum Typecommand
|
||||
{
|
||||
GUILD_CREATE_S = 0x00,
|
||||
@@ -76,7 +68,6 @@ enum Typecommand
|
||||
GUILD_BANK_S = 0x15,
|
||||
GUILD_UNK3 = 0x16
|
||||
};
|
||||
|
||||
enum CommandErrors
|
||||
{
|
||||
GUILD_PLAYER_NO_MORE_IN_GUILD = 0x00,
|
||||
@@ -104,7 +95,6 @@ enum CommandErrors
|
||||
GUILD_BANK_TAB_IS_FULL = 0x1B,
|
||||
GUILD_BANK_ITEM_NOT_FOUND = 0x1C
|
||||
};
|
||||
|
||||
enum GuildEvents
|
||||
{
|
||||
GE_PROMOTION = 0x00,
|
||||
@@ -127,14 +117,12 @@ enum GuildEvents
|
||||
GE_UNK6 = 0x11, // string 0000000000002710 is 1 gold
|
||||
GE_UNK7 = 0x12
|
||||
};
|
||||
|
||||
enum PetitionTurns
|
||||
{
|
||||
PETITION_TURN_OK = 0,
|
||||
PETITION_TURN_ALREADY_IN_GUILD = 2,
|
||||
PETITION_TURN_NEED_MORE_SIGNATURES = 4,
|
||||
};
|
||||
|
||||
enum PetitionSigns
|
||||
{
|
||||
PETITION_SIGN_OK = 0,
|
||||
@@ -143,17 +131,14 @@ enum PetitionSigns
|
||||
PETITION_SIGN_CANT_SIGN_OWN = 3,
|
||||
PETITION_SIGN_NOT_SERVER = 4,
|
||||
};
|
||||
|
||||
enum GuildBankRights
|
||||
{
|
||||
GUILD_BANK_RIGHT_VIEW_TAB = 0x01,
|
||||
GUILD_BANK_RIGHT_PUT_ITEM = 0x02,
|
||||
GUILD_BANK_RIGHT_UPDATE_TEXT = 0x04,
|
||||
|
||||
GUILD_BANK_RIGHT_DEPOSIT_ITEM = GUILD_BANK_RIGHT_VIEW_TAB | GUILD_BANK_RIGHT_PUT_ITEM,
|
||||
GUILD_BANK_RIGHT_FULL = 0xFF,
|
||||
};
|
||||
|
||||
enum GuildBankEventLogTypes
|
||||
{
|
||||
GUILD_BANK_LOG_DEPOSIT_ITEM = 1,
|
||||
@@ -166,7 +151,6 @@ enum GuildBankEventLogTypes
|
||||
GUILD_BANK_LOG_UNK1 = 8,
|
||||
GUILD_BANK_LOG_UNK2 = 9,
|
||||
};
|
||||
|
||||
enum GuildEventLogTypes
|
||||
{
|
||||
GUILD_EVENT_LOG_INVITE_PLAYER = 1,
|
||||
@@ -176,7 +160,6 @@ enum GuildEventLogTypes
|
||||
GUILD_EVENT_LOG_UNINVITE_PLAYER = 5,
|
||||
GUILD_EVENT_LOG_LEAVE_GUILD = 6,
|
||||
};
|
||||
|
||||
enum GuildEmblem
|
||||
{
|
||||
ERR_GUILDEMBLEM_SUCCESS = 0,
|
||||
@@ -186,7 +169,6 @@ enum GuildEmblem
|
||||
ERR_GUILDEMBLEM_NOTENOUGHMONEY = 4,
|
||||
ERR_GUILDEMBLEM_INVALIDVENDOR = 5
|
||||
};
|
||||
|
||||
inline uint32 GetGuildBankTabPrice(uint8 Index)
|
||||
{
|
||||
switch(Index)
|
||||
@@ -202,7 +184,6 @@ inline uint32 GetGuildBankTabPrice(uint8 Index)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct GuildEventLogEntry
|
||||
{
|
||||
uint8 EventType;
|
||||
@@ -211,7 +192,6 @@ struct GuildEventLogEntry
|
||||
uint8 NewRank;
|
||||
uint64 TimeStamp;
|
||||
};
|
||||
|
||||
struct GuildBankEventLogEntry
|
||||
{
|
||||
uint8 EventType;
|
||||
@@ -220,7 +200,6 @@ struct GuildBankEventLogEntry
|
||||
uint8 ItemStackCount;
|
||||
uint8 DestTabId;
|
||||
uint64 TimeStamp;
|
||||
|
||||
const bool isMoneyEvent()
|
||||
{
|
||||
return EventType == GUILD_BANK_LOG_DEPOSIT_MONEY ||
|
||||
@@ -228,7 +207,6 @@ struct GuildBankEventLogEntry
|
||||
EventType == GUILD_BANK_LOG_REPAIR_MONEY;
|
||||
}
|
||||
};
|
||||
|
||||
struct GuildBankTab
|
||||
{
|
||||
Item* Slots[GUILD_BANK_MAX_SLOTS];
|
||||
@@ -236,18 +214,14 @@ struct GuildBankTab
|
||||
std::string Icon;
|
||||
std::string Text;
|
||||
};
|
||||
|
||||
struct GuildItemPosCount
|
||||
{
|
||||
GuildItemPosCount(uint8 _slot, uint32 _count) : Slot(_slot), Count(_count) {}
|
||||
|
||||
bool isContainedIn(std::vector<GuildItemPosCount> const& vec) const;
|
||||
|
||||
uint8 Slot;
|
||||
uint32 Count;
|
||||
};
|
||||
typedef std::vector<GuildItemPosCount> GuildItemPosCountVec;
|
||||
|
||||
struct MemberSlot
|
||||
{
|
||||
uint64 LogoutTime;
|
||||
@@ -263,7 +237,6 @@ struct MemberSlot
|
||||
uint32 BankResetTimeTab[GUILD_BANK_MAX_TABS];
|
||||
uint32 BankRemSlotsTab[GUILD_BANK_MAX_TABS];
|
||||
};
|
||||
|
||||
struct RankInfo
|
||||
{
|
||||
RankInfo(const std::string& _name, uint32 _rights, uint32 _money) : Name(_name), Rights(_rights), BankMoneyPerDay(_money)
|
||||
@@ -274,71 +247,57 @@ struct RankInfo
|
||||
TabSlotPerDay[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::string Name;
|
||||
uint32 Rights;
|
||||
uint32 BankMoneyPerDay;
|
||||
uint32 TabRight[GUILD_BANK_MAX_TABS];
|
||||
uint32 TabSlotPerDay[GUILD_BANK_MAX_TABS];
|
||||
};
|
||||
|
||||
class Guild
|
||||
{
|
||||
public:
|
||||
Guild();
|
||||
~Guild();
|
||||
|
||||
bool Create(Player* leader, std::string gname);
|
||||
void CreateDefaultGuildRanks(int locale_idx);
|
||||
void Disband();
|
||||
|
||||
typedef std::map<uint32, MemberSlot> MemberList;
|
||||
typedef std::vector<RankInfo> RankList;
|
||||
|
||||
uint32 GetId(){ return m_Id; }
|
||||
const uint64& GetLeader(){ return m_LeaderGuid; }
|
||||
std::string const& GetName() const { return m_Name; }
|
||||
std::string const& GetMOTD() const { return MOTD; }
|
||||
std::string const& GetGINFO() const { return GINFO; }
|
||||
|
||||
|
||||
uint32 GetCreatedYear() const { return m_CreatedYear; }
|
||||
uint32 GetCreatedMonth() const { return m_CreatedMonth; }
|
||||
uint32 GetCreatedDay() const { return m_CreatedDay; }
|
||||
|
||||
|
||||
uint32 GetEmblemStyle() const { return m_EmblemStyle; }
|
||||
uint32 GetEmblemColor() const { return m_EmblemColor; }
|
||||
uint32 GetBorderStyle() const { return m_BorderStyle; }
|
||||
uint32 GetBorderColor() const { return m_BorderColor; }
|
||||
uint32 GetBackgroundColor() const { return m_BackgroundColor; }
|
||||
|
||||
void SetLeader(uint64 guid);
|
||||
bool AddMember(uint64 plGuid, uint32 plRank);
|
||||
void ChangeRank(uint64 guid, uint32 newRank);
|
||||
void DelMember(uint64 guid, bool isDisbanding = false);
|
||||
//lowest rank is the count of ranks - 1 (the highest rank_id in table)
|
||||
uint32 GetLowestRank() const { return m_Ranks.size() - 1; }
|
||||
|
||||
void SetMOTD(std::string motd);
|
||||
void SetGINFO(std::string ginfo);
|
||||
void SetPNOTE(uint64 guid, std::string pnote);
|
||||
void SetOFFNOTE(uint64 guid, std::string offnote);
|
||||
void SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor);
|
||||
|
||||
uint32 GetMemberSize() const { return members.size(); }
|
||||
|
||||
bool LoadGuildFromDB(uint32 GuildId);
|
||||
bool LoadRanksFromDB(uint32 GuildId);
|
||||
bool LoadMembersFromDB(uint32 GuildId);
|
||||
|
||||
void SetMemberStats(uint64 guid);
|
||||
|
||||
void BroadcastToGuild(WorldSession *session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
|
||||
void BroadcastToOfficers(WorldSession *session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
|
||||
void BroadcastPacketToRank(WorldPacket *packet, uint32 rankId);
|
||||
void BroadcastPacket(WorldPacket *packet);
|
||||
|
||||
template<class Do>
|
||||
void BroadcastWorker(Do& _do, Player* except = NULL)
|
||||
{
|
||||
@@ -347,13 +306,11 @@ class Guild
|
||||
if(player != except)
|
||||
_do(player);
|
||||
}
|
||||
|
||||
void CreateRank(std::string name,uint32 rights);
|
||||
void DelRank();
|
||||
std::string GetRankName(uint32 rankId);
|
||||
uint32 GetRankRights(uint32 rankId);
|
||||
uint32 GetRanksSize() const { return m_Ranks.size(); }
|
||||
|
||||
void SetRankName(uint32 rankId, std::string name);
|
||||
void SetRankRights(uint32 rankId, uint32 rights);
|
||||
bool HasRankRight(uint32 rankId, uint32 right)
|
||||
@@ -377,25 +334,20 @@ class Guild
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Roster(WorldSession *session = NULL); // NULL = broadcast
|
||||
void Query(WorldSession *session);
|
||||
|
||||
void UpdateLogoutTime(uint64 guid);
|
||||
// Guild EventLog
|
||||
void LoadGuildEventLogFromDB();
|
||||
void UnloadGuildEventLog();
|
||||
void DisplayGuildEventLog(WorldSession *session);
|
||||
void LogGuildEvent(uint8 EventType, uint32 PlayerGuid1, uint32 PlayerGuid2, uint8 NewRank);
|
||||
|
||||
// ** Guild bank **
|
||||
// Content & item deposit/withdraw
|
||||
void DisplayGuildBankContent(WorldSession *session, uint8 TabId);
|
||||
|
||||
void SwapItems( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTabDst, uint8 BankTabSlotDst, uint32 SplitedAmount);
|
||||
void MoveFromBankToChar( Player * pl, uint8 BankTab, uint8 BankTabSlot, uint8 PlayerBag, uint8 PlayerSlot, uint32 SplitedAmount);
|
||||
void MoveFromCharToBank( Player * pl, uint8 PlayerBag, uint8 PlayerSlot, uint8 BankTab, uint8 BankTabSlot, uint32 SplitedAmount);
|
||||
|
||||
// Tabs
|
||||
void DisplayGuildBankTabsInfo(WorldSession *session);
|
||||
void CreateNewBankTab();
|
||||
@@ -432,10 +384,8 @@ class Guild
|
||||
void DisplayGuildBankLogs(WorldSession *session, uint8 TabId);
|
||||
void LogBankEvent(uint8 EventType, uint8 TabId, uint32 PlayerGuidLow, uint32 ItemOrMoney, uint8 ItemStackCount=0, uint8 DestTabId=0);
|
||||
bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry );
|
||||
|
||||
protected:
|
||||
void AddRank(const std::string& name,uint32 rights,uint32 money);
|
||||
|
||||
uint32 m_Id;
|
||||
std::string m_Name;
|
||||
uint64 m_LeaderGuid;
|
||||
@@ -444,37 +394,29 @@ class Guild
|
||||
uint32 m_CreatedYear;
|
||||
uint32 m_CreatedMonth;
|
||||
uint32 m_CreatedDay;
|
||||
|
||||
uint32 m_EmblemStyle;
|
||||
uint32 m_EmblemColor;
|
||||
uint32 m_BorderStyle;
|
||||
uint32 m_BorderColor;
|
||||
uint32 m_BackgroundColor;
|
||||
|
||||
RankList m_Ranks;
|
||||
|
||||
MemberList members;
|
||||
|
||||
typedef std::vector<GuildBankTab*> TabListMap;
|
||||
TabListMap m_TabListMap;
|
||||
|
||||
/** These are actually ordered lists. The first element is the oldest entry.*/
|
||||
typedef std::list<GuildEventLogEntry> GuildEventLog;
|
||||
typedef std::list<GuildBankEventLogEntry> GuildBankEventLog;
|
||||
GuildEventLog m_GuildEventLog;
|
||||
GuildBankEventLog m_GuildBankEventLog_Money;
|
||||
GuildBankEventLog m_GuildBankEventLog_Item[GUILD_BANK_MAX_TABS];
|
||||
|
||||
uint32 m_GuildEventLogNextGuid;
|
||||
uint32 m_GuildBankEventLogNextGuid_Money;
|
||||
uint32 m_GuildBankEventLogNextGuid_Item[GUILD_BANK_MAX_TABS];
|
||||
|
||||
bool m_GuildBankLoaded;
|
||||
bool m_EventLogLoaded;
|
||||
uint32 m_OnlineMembers;
|
||||
uint64 m_GuildBankMoney;
|
||||
uint8 m_PurchasedTabs;
|
||||
|
||||
private:
|
||||
// used only from high level Swap/Move functions
|
||||
Item* GetItem(uint8 TabId, uint8 SlotId);
|
||||
@@ -483,7 +425,6 @@ class Guild
|
||||
void RemoveItem(uint8 tab, uint8 slot );
|
||||
void DisplayGuildBankContentUpdate(uint8 TabId, int32 slot1, int32 slot2 = -1);
|
||||
void DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec const& slots);
|
||||
|
||||
// internal common parts for CanStore/StoreItem functions
|
||||
void AppendDisplayGuildBankSlot( WorldPacket& data, GuildBankTab const *tab, int32 slot );
|
||||
uint8 _CanStoreItem_InSpecificSlot( uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32& count, bool swap, Item *pSrcItem ) const;
|
||||
|
||||
Reference in New Issue
Block a user