mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Fixed group loot display bug.
This commit is contained in:
parent
f451298784
commit
de73c52a77
7 changed files with 115 additions and 89 deletions
|
|
@ -818,7 +818,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT:
|
||||
{
|
||||
uint32 counter =0;
|
||||
for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++)
|
||||
for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); ++itr)
|
||||
if(itr->second.m_rewarded)
|
||||
counter++;
|
||||
SetCriteriaProgress(achievementCriteria, counter);
|
||||
|
|
@ -831,7 +831,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
continue;
|
||||
|
||||
uint32 counter =0;
|
||||
for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++)
|
||||
for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); ++itr)
|
||||
{
|
||||
Quest const* quest = objmgr.GetQuestTemplate(itr->first);
|
||||
if(itr->second.m_rewarded && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ Group::Group()
|
|||
m_lootThreshold = ITEM_QUALITY_UNCOMMON;
|
||||
m_subGroupsCounts = NULL;
|
||||
|
||||
for (int i=0; i<TARGETICONCOUNT; ++i)
|
||||
for (int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
m_targetIcons[i] = 0;
|
||||
}
|
||||
|
||||
|
|
@ -53,9 +53,12 @@ Group::~Group()
|
|||
if(m_bgGroup)
|
||||
{
|
||||
sLog.outDebug("Group::~Group: battleground group being deleted.");
|
||||
if(m_bgGroup->GetBgRaid(ALLIANCE) == this) m_bgGroup->SetBgRaid(ALLIANCE, NULL);
|
||||
else if(m_bgGroup->GetBgRaid(HORDE) == this) m_bgGroup->SetBgRaid(HORDE, NULL);
|
||||
else sLog.outError("Group::~Group: battleground group is not linked to the correct battleground.");
|
||||
if(m_bgGroup->GetBgRaid(ALLIANCE) == this)
|
||||
m_bgGroup->SetBgRaid(ALLIANCE, NULL);
|
||||
else if(m_bgGroup->GetBgRaid(HORDE) == this)
|
||||
m_bgGroup->SetBgRaid(HORDE, NULL);
|
||||
else
|
||||
sLog.outError("Group::~Group: battleground group is not linked to the correct battleground.");
|
||||
}
|
||||
Rolls::iterator itr;
|
||||
while(!RollId.empty())
|
||||
|
|
@ -118,7 +121,8 @@ bool Group::Create(const uint64 &guid, const char * name)
|
|||
if(!AddMember(guid, name))
|
||||
return false;
|
||||
|
||||
if(!isBGGroup()) CharacterDatabase.CommitTransaction();
|
||||
if(!isBGGroup())
|
||||
CharacterDatabase.CommitTransaction();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -168,9 +172,10 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
|
|||
m_looterGuid = MAKE_NEW_GUID((*result)[3].GetUInt32(), 0, HIGHGUID_PLAYER);
|
||||
m_lootThreshold = (ItemQualities)(*result)[4].GetUInt16();
|
||||
|
||||
for(int i=0; i<TARGETICONCOUNT; ++i)
|
||||
for(int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
m_targetIcons[i] = (*result)[5+i].GetUInt64();
|
||||
if(!external) delete result;
|
||||
if(!external)
|
||||
delete result;
|
||||
|
||||
if(loadMembers)
|
||||
{
|
||||
|
|
@ -474,15 +479,16 @@ void Group::Disband(bool hideDestroy)
|
|||
|
||||
void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4));
|
||||
WorldPacket data(SMSG_LOOT_START_ROLL, (8+4+4+4+4+4+4));
|
||||
data << uint64(r.itemGUID); // guid of rolled item
|
||||
data << uint32(r.totalPlayersRolling); // maybe the number of players rolling for it???
|
||||
data << uint32(r.itemid); // the itemEntryId for the item that shall be rolled for
|
||||
data << uint32(r.itemRandomSuffix); // randomSuffix
|
||||
data << uint32(r.itemRandomPropId); // item random property ID
|
||||
data << uint32(r.itemCount); // items in stack
|
||||
data << uint32(CountDown); // the countdown time to choose "need" or "greed"
|
||||
|
||||
for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
|
||||
for (Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = objmgr.GetPlayer(itr->first);
|
||||
if(!p || !p->GetSession())
|
||||
|
|
@ -495,7 +501,7 @@ void Group::SendLootStartRoll(uint32 CountDown, const Roll &r)
|
|||
|
||||
void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r)
|
||||
{
|
||||
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1));
|
||||
WorldPacket data(SMSG_LOOT_ROLL, (8+4+8+4+4+4+1+1+1));
|
||||
data << uint64(SourceGuid); // guid of the item rolled
|
||||
data << uint32(0); // unknown, maybe amount of players
|
||||
data << uint64(TargetGuid);
|
||||
|
|
@ -506,7 +512,7 @@ void Group::SendLootRoll(const uint64& SourceGuid, const uint64& TargetGuid, uin
|
|||
data << uint8(RollType); // 0: "Need for: [item name]" 0: "You have selected need for [item name] 1: need roll 2: greed roll
|
||||
data << uint8(0); // 2.4.0
|
||||
|
||||
for( Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
|
||||
for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = objmgr.GetPlayer(itr->first);
|
||||
if(!p || !p->GetSession())
|
||||
|
|
@ -529,7 +535,7 @@ void Group::SendLootRollWon(const uint64& SourceGuid, const uint64& TargetGuid,
|
|||
data << uint8(RollNumber); // rollnumber realted to SMSG_LOOT_ROLL
|
||||
data << uint8(RollType); // Rolltype related to SMSG_LOOT_ROLL
|
||||
|
||||
for( Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr!=r.playerVote.end(); ++itr)
|
||||
for( Roll::PlayerVote::const_iterator itr = r.playerVote.begin(); itr != r.playerVote.end(); ++itr)
|
||||
{
|
||||
Player *p = objmgr.GetPlayer(itr->first);
|
||||
if(!p || !p->GetSession())
|
||||
|
|
@ -568,7 +574,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
Player *player = objmgr.GetPlayer(playerGUID);
|
||||
Group *group = player->GetGroup();
|
||||
|
||||
for (i=loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
|
||||
for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot)
|
||||
{
|
||||
item = objmgr.GetItemPrototype(i->itemid);
|
||||
if (!item)
|
||||
|
|
@ -580,8 +586,8 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
//roll for over-threshold item if it's one-player loot
|
||||
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
|
||||
{
|
||||
uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM),0,HIGHGUID_ITEM);
|
||||
Roll* r=new Roll(newitemGUID,*i);
|
||||
uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
|
||||
Roll* r = new Roll(newitemGUID, *i);
|
||||
|
||||
//a vector is filled with only near party members
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
|
|
@ -591,7 +597,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
continue;
|
||||
if ( i->AllowedForPlayer(member) )
|
||||
{
|
||||
if (member->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
if (member->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
r->playerVote[member->GetGUID()] = NOT_EMITED_YET;
|
||||
++r->totalPlayersRolling;
|
||||
|
|
@ -611,8 +617,7 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
RollId.push_back(r);
|
||||
}
|
||||
else
|
||||
i->is_underthreshold=1;
|
||||
|
||||
i->is_underthreshold = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -630,8 +635,8 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
|
|||
//only roll for one-player items, not for ones everyone can get
|
||||
if (item->Quality >= uint32(m_lootThreshold) && !i->freeforall)
|
||||
{
|
||||
uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM),0,HIGHGUID_ITEM);
|
||||
Roll* r=new Roll(newitemGUID,*i);
|
||||
uint64 newitemGUID = MAKE_NEW_GUID(objmgr.GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM);
|
||||
Roll* r = new Roll(newitemGUID, *i);
|
||||
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
|
|
@ -641,7 +646,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
|
|||
|
||||
if (playerToRoll->CanUseItem(item) && i->AllowedForPlayer(playerToRoll) )
|
||||
{
|
||||
if (playerToRoll->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
if (playerToRoll->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
r->playerVote[playerToRoll->GetGUID()] = NOT_EMITED_YET;
|
||||
++r->totalPlayersRolling;
|
||||
|
|
@ -666,7 +671,7 @@ void Group::NeedBeforeGreed(const uint64& playerGUID, Loot *loot, Creature *crea
|
|||
}
|
||||
}
|
||||
else
|
||||
i->is_underthreshold=1;
|
||||
i->is_underthreshold = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -689,19 +694,19 @@ void Group::MasterLoot(const uint64& playerGUID, Loot* /*loot*/, Creature *creat
|
|||
if (!looter->IsInWorld())
|
||||
continue;
|
||||
|
||||
if (looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
if (looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
data << looter->GetGUID();
|
||||
++real_count;
|
||||
}
|
||||
}
|
||||
|
||||
data.put<uint8>(0,real_count);
|
||||
data.put<uint8>(0, real_count);
|
||||
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player *looter = itr->getSource();
|
||||
if (looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
if (looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
looter->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
@ -724,23 +729,23 @@ void Group::CountRollVote(const uint64& playerGUID, const uint64& Guid, uint32 N
|
|||
|
||||
switch (Choise)
|
||||
{
|
||||
case 0: //Player choose pass
|
||||
case ROLL_PASS: // Player choose pass
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 128, 128, *roll);
|
||||
SendLootRoll(0, playerGUID, 0, ROLL_PASS, *roll);
|
||||
++roll->totalPass;
|
||||
itr->second = PASS;
|
||||
}
|
||||
break;
|
||||
case 1: //player choose Need
|
||||
case ROLL_NEED: // player choose Need
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 0, 0, *roll);
|
||||
SendLootRoll(0, playerGUID, 0, ROLL_NEED, *roll);
|
||||
++roll->totalNeed;
|
||||
itr->second = NEED;
|
||||
}
|
||||
break;
|
||||
case 2: //player choose Greed
|
||||
case ROLL_GREED: // player choose Greed
|
||||
{
|
||||
SendLootRoll(0, playerGUID, 128, 2, *roll);
|
||||
SendLootRoll(0, playerGUID, 128, ROLL_GREED, *roll);
|
||||
++roll->totalGreed;
|
||||
itr->second = GREED;
|
||||
}
|
||||
|
|
@ -782,20 +787,20 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
uint64 maxguid = (*roll->playerVote.begin()).first;
|
||||
Player *player;
|
||||
|
||||
for( Roll::PlayerVote::const_iterator itr=roll->playerVote.begin(); itr!=roll->playerVote.end(); ++itr)
|
||||
for( Roll::PlayerVote::const_iterator itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
|
||||
{
|
||||
if (itr->second != NEED)
|
||||
continue;
|
||||
|
||||
uint8 randomN = urand(1, 99);
|
||||
SendLootRoll(0, itr->first, randomN, 1, *roll);
|
||||
SendLootRoll(0, itr->first, randomN, ROLL_NEED, *roll);
|
||||
if (maxresul < randomN)
|
||||
{
|
||||
maxguid = itr->first;
|
||||
maxresul = randomN;
|
||||
}
|
||||
}
|
||||
SendLootRollWon(0, maxguid, maxresul, 1, *roll);
|
||||
SendLootRollWon(0, maxguid, maxresul, ROLL_NEED, *roll);
|
||||
player = objmgr.GetPlayer(maxguid);
|
||||
|
||||
if(player && player->GetSession())
|
||||
|
|
@ -829,20 +834,20 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
Player *player;
|
||||
|
||||
Roll::PlayerVote::iterator itr;
|
||||
for (itr=roll->playerVote.begin(); itr!=roll->playerVote.end(); ++itr)
|
||||
for (itr = roll->playerVote.begin(); itr != roll->playerVote.end(); ++itr)
|
||||
{
|
||||
if (itr->second != GREED)
|
||||
continue;
|
||||
|
||||
uint8 randomN = urand(1, 99);
|
||||
SendLootRoll(0, itr->first, randomN, 2, *roll);
|
||||
SendLootRoll(0, itr->first, randomN, ROLL_GREED, *roll);
|
||||
if (maxresul < randomN)
|
||||
{
|
||||
maxguid = itr->first;
|
||||
maxresul = randomN;
|
||||
}
|
||||
}
|
||||
SendLootRollWon(0, maxguid, maxresul, 2, *roll);
|
||||
SendLootRollWon(0, maxguid, maxresul, ROLL_GREED, *roll);
|
||||
player = objmgr.GetPlayer(maxguid);
|
||||
|
||||
if(player && player->GetSession())
|
||||
|
|
@ -884,7 +889,7 @@ void Group::SetTargetIcon(uint8 id, uint64 guid)
|
|||
|
||||
// clean other icons
|
||||
if( guid != 0 )
|
||||
for(int i=0; i<TARGETICONCOUNT; ++i)
|
||||
for(int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
if( m_targetIcons[i] == guid )
|
||||
SetTargetIcon(i, 0);
|
||||
|
||||
|
|
@ -928,7 +933,7 @@ void Group::SendTargetIconList(WorldSession *session)
|
|||
WorldPacket data(MSG_RAID_TARGET_UPDATE, (1+TARGETICONCOUNT*9));
|
||||
data << (uint8)1;
|
||||
|
||||
for(int i=0; i<TARGETICONCOUNT; ++i)
|
||||
for(int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
{
|
||||
if(m_targetIcons[i] == 0)
|
||||
continue;
|
||||
|
|
@ -1011,7 +1016,7 @@ void Group::BroadcastPacket(WorldPacket *packet, bool ignorePlayersInBGRaid, int
|
|||
if(!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this) )
|
||||
continue;
|
||||
|
||||
if (pl->GetSession() && (group==-1 || itr->getSubGroup()==group))
|
||||
if (pl->GetSession() && (group == -1 || itr->getSubGroup() == group))
|
||||
pl->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
|
@ -1049,7 +1054,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant)
|
|||
if (m_subGroupsCounts)
|
||||
{
|
||||
bool groupFound = false;
|
||||
for (; groupid < MAXRAIDSIZE/MAXGROUPSIZE; ++groupid)
|
||||
for (; groupid < MAXRAIDSIZE / MAXGROUPSIZE; ++groupid)
|
||||
{
|
||||
if (m_subGroupsCounts[groupid] < MAXGROUPSIZE)
|
||||
{
|
||||
|
|
@ -1104,7 +1109,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u
|
|||
|
||||
if(!isRaidGroup()) // reset targetIcons for non-raid-groups
|
||||
{
|
||||
for(int i=0; i<TARGETICONCOUNT; ++i)
|
||||
for(int i = 0; i < TARGETICONCOUNT; ++i)
|
||||
m_targetIcons[i] = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1225,28 +1230,33 @@ void Group::_removeRolls(const uint64 &guid)
|
|||
if(itr2 == roll->playerVote.end())
|
||||
continue;
|
||||
|
||||
if (itr2->second == GREED) --roll->totalGreed;
|
||||
if (itr2->second == NEED) --roll->totalNeed;
|
||||
if (itr2->second == PASS) --roll->totalPass;
|
||||
if (itr2->second != NOT_VALID) --roll->totalPlayersRolling;
|
||||
if (itr2->second == GREED)
|
||||
--roll->totalGreed;
|
||||
if (itr2->second == NEED)
|
||||
--roll->totalNeed;
|
||||
if (itr2->second == PASS)
|
||||
--roll->totalPass;
|
||||
if (itr2->second != NOT_VALID)
|
||||
--roll->totalPlayersRolling;
|
||||
|
||||
roll->playerVote.erase(itr2);
|
||||
|
||||
CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, 3);
|
||||
CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, MAX_ROLL_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group)
|
||||
{
|
||||
member_witerator slot = _getMemberWSlot(guid);
|
||||
if(slot==m_memberSlots.end())
|
||||
if(slot == m_memberSlots.end())
|
||||
return false;
|
||||
|
||||
slot->group = group;
|
||||
|
||||
SubGroupCounterIncrease(group);
|
||||
|
||||
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
|
||||
if(!isBGGroup())
|
||||
CharacterDatabase.PExecute("UPDATE group_member SET subgroup='%u' WHERE memberGuid='%u'", group, GUID_LOPART(guid));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1254,45 +1264,51 @@ bool Group::_setMembersGroup(const uint64 &guid, const uint8 &group)
|
|||
bool Group::_setAssistantFlag(const uint64 &guid, const bool &state)
|
||||
{
|
||||
member_witerator slot = _getMemberWSlot(guid);
|
||||
if(slot==m_memberSlots.end())
|
||||
if(slot == m_memberSlots.end())
|
||||
return false;
|
||||
|
||||
slot->assistant = state;
|
||||
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE group_member SET assistant='%u' WHERE memberGuid='%u'", (state==true)?1:0, GUID_LOPART(guid));
|
||||
if(!isBGGroup())
|
||||
CharacterDatabase.PExecute("UPDATE group_member SET assistant='%u' WHERE memberGuid='%u'", (state==true)?1:0, GUID_LOPART(guid));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Group::_setMainTank(const uint64 &guid)
|
||||
{
|
||||
member_citerator slot = _getMemberCSlot(guid);
|
||||
if(slot==m_memberSlots.end())
|
||||
if(slot == m_memberSlots.end())
|
||||
return false;
|
||||
|
||||
if(m_mainAssistant == guid)
|
||||
_setMainAssistant(0);
|
||||
m_mainTank = guid;
|
||||
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE leaderGuid='%u'", GUID_LOPART(m_mainTank), GUID_LOPART(m_leaderGuid));
|
||||
if(!isBGGroup())
|
||||
CharacterDatabase.PExecute("UPDATE groups SET mainTank='%u' WHERE leaderGuid='%u'", GUID_LOPART(m_mainTank), GUID_LOPART(m_leaderGuid));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Group::_setMainAssistant(const uint64 &guid)
|
||||
{
|
||||
member_witerator slot = _getMemberWSlot(guid);
|
||||
if(slot==m_memberSlots.end())
|
||||
if(slot == m_memberSlots.end())
|
||||
return false;
|
||||
|
||||
if(m_mainTank == guid)
|
||||
_setMainTank(0);
|
||||
m_mainAssistant = guid;
|
||||
if(!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE leaderGuid='%u'", GUID_LOPART(m_mainAssistant), GUID_LOPART(m_leaderGuid));
|
||||
if(!isBGGroup())
|
||||
CharacterDatabase.PExecute("UPDATE groups SET mainAssistant='%u' WHERE leaderGuid='%u'", GUID_LOPART(m_mainAssistant), GUID_LOPART(m_leaderGuid));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Group::SameSubGroup(Player const* member1, Player const* member2) const
|
||||
{
|
||||
if(!member1 || !member2) return false;
|
||||
if (member1->GetGroup() != this || member2->GetGroup() != this) return false;
|
||||
else return member1->GetSubGroup() == member2->GetSubGroup();
|
||||
if(!member1 || !member2)
|
||||
return false;
|
||||
if (member1->GetGroup() != this || member2->GetGroup() != this)
|
||||
return false;
|
||||
else
|
||||
return member1->GetSubGroup() == member2->GetSubGroup();
|
||||
}
|
||||
|
||||
// allows setting subgroup for offline members
|
||||
|
|
@ -1359,7 +1375,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
{
|
||||
// not update if only update if need and ok
|
||||
Player* looter = ObjectAccessor::FindPlayer(guid_itr->guid);
|
||||
if(looter && looter->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
if(looter && looter->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
return;
|
||||
}
|
||||
++guid_itr;
|
||||
|
|
@ -1372,16 +1388,16 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
{
|
||||
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
||||
{
|
||||
if (pl->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
bool refresh = pl->GetLootGUID()==creature->GetGUID();
|
||||
bool refresh = pl->GetLootGUID() == creature->GetGUID();
|
||||
|
||||
//if(refresh) // update loot for new looter
|
||||
// pl->GetSession()->DoLootRelease(pl->GetLootGUID());
|
||||
SetLooterGuid(pl->GetGUID());
|
||||
SendUpdate();
|
||||
if(refresh) // update loot for new looter
|
||||
pl->SendLoot(creature->GetGUID(),LOOT_CORPSE);
|
||||
pl->SendLoot(creature->GetGUID(), LOOT_CORPSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1393,7 +1409,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
{
|
||||
if(Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
||||
{
|
||||
if (pl->IsWithinDist(creature,sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE),false))
|
||||
if (pl->IsWithinDist(creature, sWorld.getConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||
{
|
||||
bool refresh = pl->GetLootGUID()==creature->GetGUID();
|
||||
|
||||
|
|
@ -1402,7 +1418,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
|
|||
SetLooterGuid(pl->GetGUID());
|
||||
SendUpdate();
|
||||
if(refresh) // update loot for new looter
|
||||
pl->SendLoot(creature->GetGUID(),LOOT_CORPSE);
|
||||
pl->SendLoot(creature->GetGUID(), LOOT_CORPSE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1551,15 +1567,19 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
|
|||
|
||||
if(SendMsgTo)
|
||||
{
|
||||
if(isEmpty) SendMsgTo->SendResetInstanceSuccess(p->GetMapId());
|
||||
else SendMsgTo->SendResetInstanceFailed(0, p->GetMapId());
|
||||
if(isEmpty)
|
||||
SendMsgTo->SendResetInstanceSuccess(p->GetMapId());
|
||||
else
|
||||
SendMsgTo->SendResetInstanceFailed(0, p->GetMapId());
|
||||
}
|
||||
|
||||
if(isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY)
|
||||
{
|
||||
// do not reset the instance, just unbind if others are permanently bound to it
|
||||
if(p->CanReset()) p->DeleteFromDB();
|
||||
else CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", p->GetInstanceId());
|
||||
if(p->CanReset())
|
||||
p->DeleteFromDB();
|
||||
else
|
||||
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", p->GetInstanceId());
|
||||
// i don't know for sure if hash_map iterators
|
||||
m_boundInstances[diff].erase(itr);
|
||||
itr = m_boundInstances[diff].begin();
|
||||
|
|
@ -1619,20 +1639,23 @@ InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, boo
|
|||
{
|
||||
// when a boss is killed or when copying the players's binds to the group
|
||||
if(permanent != bind.perm || save != bind.save)
|
||||
if(!load) CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId());
|
||||
if(!load)
|
||||
CharacterDatabase.PExecute("UPDATE group_instance SET instance = '%u', permanent = '%u' WHERE leaderGuid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GUID_LOPART(GetLeaderGUID()), bind.save->GetInstanceId());
|
||||
}
|
||||
else
|
||||
if(!load) CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent);
|
||||
else if(!load)
|
||||
CharacterDatabase.PExecute("INSERT INTO group_instance (leaderGuid, instance, permanent) VALUES ('%u', '%u', '%u')", GUID_LOPART(GetLeaderGUID()), save->GetInstanceId(), permanent);
|
||||
|
||||
if(bind.save != save)
|
||||
{
|
||||
if(bind.save) bind.save->RemoveGroup(this);
|
||||
if(bind.save)
|
||||
bind.save->RemoveGroup(this);
|
||||
save->AddGroup(this);
|
||||
}
|
||||
|
||||
bind.save = save;
|
||||
bind.perm = permanent;
|
||||
if(!load) sLog.outDebug("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
|
||||
if(!load)
|
||||
sLog.outDebug("Group::BindToInstance: %d is now bound to map %d, instance %d, difficulty %d", GUID_LOPART(GetLeaderGUID()), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
|
||||
return &bind;
|
||||
}
|
||||
else
|
||||
|
|
@ -1644,7 +1667,8 @@ void Group::UnbindInstance(uint32 mapid, uint8 difficulty, bool unload)
|
|||
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
|
||||
if(itr != m_boundInstances[difficulty].end())
|
||||
{
|
||||
if(!unload) CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId());
|
||||
if(!unload)
|
||||
CharacterDatabase.PExecute("DELETE FROM group_instance WHERE leaderGuid = '%u' AND instance = '%u'", GUID_LOPART(GetLeaderGUID()), itr->second.save->GetInstanceId());
|
||||
itr->second.save->RemoveGroup(this); // save can become invalid
|
||||
m_boundInstances[difficulty].erase(itr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ class Roll : public LootValidatorRef
|
|||
{
|
||||
public:
|
||||
Roll(uint64 _guid, LootItem const& li)
|
||||
: itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix),
|
||||
: itemGUID(_guid), itemid(li.itemid), itemRandomPropId(li.randomPropertyId), itemRandomSuffix(li.randomSuffix), itemCount(li.count),
|
||||
totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0) {}
|
||||
~Roll() { }
|
||||
void setLoot(Loot *pLoot) { link(pLoot, this); }
|
||||
|
|
@ -110,6 +110,7 @@ class Roll : public LootValidatorRef
|
|||
uint32 itemid;
|
||||
int32 itemRandomPropId;
|
||||
uint32 itemRandomSuffix;
|
||||
uint8 itemCount;
|
||||
typedef std::map<uint64, RollVote> PlayerVote;
|
||||
PlayerVote playerVote; //vote position correspond with player position (in group)
|
||||
uint8 totalPlayersRolling;
|
||||
|
|
|
|||
|
|
@ -368,26 +368,26 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
|
|||
|
||||
uint64 Guid;
|
||||
uint32 NumberOfPlayers;
|
||||
uint8 Choise;
|
||||
uint8 rollType;
|
||||
recv_data >> Guid; //guid of the item rolled
|
||||
recv_data >> NumberOfPlayers;
|
||||
recv_data >> Choise; //0: pass, 1: need, 2: greed
|
||||
recv_data >> rollType;
|
||||
|
||||
//sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, Choise:%u", (uint32)Guid, NumberOfPlayers, Choise);
|
||||
//sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, rollType:%u", (uint32)Guid, NumberOfPlayers, rollType);
|
||||
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if(!group)
|
||||
return;
|
||||
|
||||
// everything's fine, do it
|
||||
group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, Choise);
|
||||
group->CountRollVote(GetPlayer()->GetGUID(), Guid, NumberOfPlayers, rollType);
|
||||
|
||||
switch (Choise)
|
||||
switch (rollType)
|
||||
{
|
||||
case 1:
|
||||
case ROLL_NEED:
|
||||
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED, 1);
|
||||
break;
|
||||
case 2:
|
||||
case ROLL_GREED:
|
||||
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED, 1);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ enum RollType
|
|||
{
|
||||
ROLL_PASS = 0,
|
||||
ROLL_NEED = 1,
|
||||
ROLL_GREED = 2
|
||||
ROLL_GREED = 2,
|
||||
MAX_ROLL_TYPE = 3
|
||||
};
|
||||
|
||||
#define MAX_NR_LOOT_ITEMS 16
|
||||
|
|
|
|||
|
|
@ -6205,7 +6205,7 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real)
|
|||
((m_removeMode == AURA_REMOVE_BY_DEFAULT && !m_modifier.m_amount) || m_removeMode == AURA_REMOVE_BY_DISPEL))
|
||||
{
|
||||
Unit::AuraList const& vDummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY);
|
||||
for(Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); itr++)
|
||||
for(Unit::AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr)
|
||||
{
|
||||
SpellEntry const* vSpell = (*itr)->GetSpellProto();
|
||||
|
||||
|
|
|
|||
|
|
@ -895,7 +895,7 @@ void WorldSession::SendAddonsInfo()
|
|||
if (unk1)
|
||||
{
|
||||
uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
|
||||
data << uint8(unk2);
|
||||
data << uint8(unk2); // if 1, than add addon public signature
|
||||
if (unk2) // if CRC is wrong, add public key (client need it)
|
||||
data.append(tdata, sizeof(tdata));
|
||||
|
||||
|
|
@ -903,7 +903,7 @@ void WorldSession::SendAddonsInfo()
|
|||
}
|
||||
|
||||
uint8 unk3 = 0; // 0 is sent here
|
||||
data << uint8(unk3);
|
||||
data << uint8(unk3); // use <Addon>\<Addon>.url file or not
|
||||
if (unk3)
|
||||
{
|
||||
// String, 256 (null terminated?)
|
||||
|
|
@ -914,7 +914,7 @@ void WorldSession::SendAddonsInfo()
|
|||
m_addonsList.clear();
|
||||
|
||||
uint32 count = 0;
|
||||
data << uint32(count);
|
||||
data << uint32(count); // BannedAddons count
|
||||
/*for(uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
uint32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue