TrinityCore
Loading...
Searching...
No Matches
LootRoll Class Reference

#include <Loot.h>

Public Types

using RollVoteMap = std::unordered_map< ObjectGuid, PlayerRollVote >
 

Public Member Functions

 LootRoll ()
 
 ~LootRoll ()
 
 LootRoll (LootRoll const &)=delete
 
 LootRoll (LootRoll &&)=delete
 
LootRoll & operator= (LootRoll const &)=delete
 
LootRoll & operator= (LootRoll &&)=delete
 
bool TryToStart (Map *map, Loot &loot, uint32 lootListId, uint16 enchantingSkill)
 
bool PlayerVote (Player *player, RollVote vote)
 
bool UpdateRoll ()
 
bool IsLootItem (ObjectGuid const &lootObject, uint32 lootListId) const
 

Private Member Functions

void SendStartRoll ()
 
void SendAllPassed ()
 
void SendRoll (ObjectGuid const &targetGuid, int32 rollNumber, RollVote rollType, Optional< ObjectGuid > const &rollWinner)
 
void SendLootRollWon (ObjectGuid const &targetGuid, int32 rollNumber, RollVote rollType)
 
void FillPacket (WorldPackets::Loot::LootItemData &lootItem) const
 
void Finish (RollVoteMap::const_iterator winnerItr)
 
bool AllPlayerVoted (RollVoteMap::const_iterator &winnerItr)
 Check if all player have voted and return true in that case. Also return current winner.
 
Optional< uint32 > GetItemDisenchantLootId () const
 
Optional< uint16 > GetItemDisenchantSkillRequired () const
 

Private Attributes

Map * m_map
 
RollVoteMap m_rollVoteMap
 
bool m_isStarted
 
LootItem * m_lootItem
 
Loot * m_loot
 
RollMask m_voteMask
 
TimePoint m_endTime
 

Detailed Description

Definition at line 247 of file Loot.h.

Member Typedef Documentation

◆ RollVoteMap

using LootRoll::RollVoteMap = std::unordered_map<ObjectGuid, PlayerRollVote>

Definition at line 250 of file Loot.h.

Constructor & Destructor Documentation

◆ LootRoll() [1/3]

LootRoll::LootRoll ( )
inline

Definition at line 252 of file Loot.h.

◆ ~LootRoll()

LootRoll::~LootRoll ( )

◆ LootRoll() [2/3]

LootRoll::LootRoll ( LootRoll const &  )
delete

◆ LootRoll() [3/3]

LootRoll::LootRoll ( LootRoll &&  )
delete

Member Function Documentation

◆ AllPlayerVoted()

bool LootRoll::AllPlayerVoted ( RollVoteMap::const_iterator &  winnerItr)
private

Check if all player have voted and return true in that case. Also return current winner.

Parameters
winnerItr> will be different than m_rollCoteMap.end() if winner exist. (Someone voted greed or need)
Returns
true if all players voted

Definition at line 587 of file Loot.cpp.

References Disenchant, Greed, m_rollVoteMap, Need, NotEmitedYet, and Pass.

Referenced by UpdateRoll().

◆ FillPacket()

◆ Finish()

◆ GetItemDisenchantLootId()

◆ GetItemDisenchantSkillRequired()

◆ IsLootItem()

bool LootRoll::IsLootItem ( ObjectGuid const &  lootObject,
uint32  lootListId 
) const

Definition at line 577 of file Loot.cpp.

References Loot::GetGUID(), LootItem::LootListId, m_loot, and m_lootItem.

◆ operator=() [1/2]

LootRoll & LootRoll::operator= ( LootRoll &&  )
delete

◆ operator=() [2/2]

LootRoll & LootRoll::operator= ( LootRoll const &  )
delete

◆ PlayerVote()

bool LootRoll::PlayerVote ( Player *  player,
RollVote  vote 
)

◆ SendAllPassed()

◆ SendLootRollWon()

◆ SendRoll()

◆ SendStartRoll()

◆ TryToStart()

◆ UpdateRoll()

bool LootRoll::UpdateRoll ( )

Definition at line 565 of file Loot.cpp.

References AllPlayerVoted(), Finish(), m_endTime, m_rollVoteMap, and GameTime::Now().

Member Data Documentation

◆ m_endTime

TimePoint LootRoll::m_endTime
private

Definition at line 282 of file Loot.h.

Referenced by TryToStart(), and UpdateRoll().

◆ m_isStarted

bool LootRoll::m_isStarted
private

Definition at line 278 of file Loot.h.

Referenced by Finish(), TryToStart(), and ~LootRoll().

◆ m_loot

Loot* LootRoll::m_loot
private

◆ m_lootItem

LootItem* LootRoll::m_lootItem
private

◆ m_map

Map* LootRoll::m_map
private

◆ m_rollVoteMap

RollVoteMap LootRoll::m_rollVoteMap
private

◆ m_voteMask

RollMask LootRoll::m_voteMask
private

Definition at line 281 of file Loot.h.

Referenced by SendStartRoll(), and TryToStart().


The documentation for this class was generated from the following files: