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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -170,7 +174,8 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
|
|||
|
||||
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,12 +479,13 @@ 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)
|
||||
|
|
@ -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);
|
||||
|
|
@ -612,7 +618,6 @@ void Group::GroupLoot(const uint64& playerGUID, Loot *loot, Creature *creature)
|
|||
}
|
||||
else
|
||||
i->is_underthreshold = 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -788,14 +793,14 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
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())
|
||||
|
|
@ -835,14 +840,14 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers)
|
|||
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())
|
||||
|
|
@ -1225,14 +1230,18 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1246,7 +1255,8 @@ bool Group::_setMembersGroup(const uint64 &guid, const uint8 &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;
|
||||
}
|
||||
|
|
@ -1258,7 +1268,8 @@ bool Group::_setAssistantFlag(const uint64 &guid, const bool &state)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1271,7 +1282,8 @@ bool Group::_setMainTank(const uint64 &guid)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1284,15 +1296,19 @@ bool Group::_setMainAssistant(const uint64 &guid)
|
|||
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
|
||||
|
|
@ -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