aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/GossipDef.cpp20
-rw-r--r--src/game/GossipDef.h1
-rw-r--r--src/game/GridDefines.h1
-rw-r--r--src/game/GridNotifiers.h1
-rw-r--r--src/game/Group.cpp168
-rw-r--r--src/game/Group.h25
-rw-r--r--src/game/GroupHandler.cpp15
7 files changed, 150 insertions, 81 deletions
diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp
index 418f27dc4ea..5b0d0bd1dc8 100644
--- a/src/game/GossipDef.cpp
+++ b/src/game/GossipDef.cpp
@@ -547,13 +547,13 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
WorldPacket data( SMSG_QUEST_QUERY_RESPONSE, 100 ); // guess size
- data << uint32(pQuest->GetQuestId());
+ data << uint32(pQuest->GetQuestId()); // quest id
data << uint32(pQuest->GetQuestMethod()); // Accepted values: 0, 1 or 2. 0==IsAutoComplete() (skip objectives/details)
data << uint32(pQuest->GetQuestLevel()); // may be -1, static data, in other cases must be used dynamic level: Player::GetQuestLevel (0 is not known, but assuming this is no longer valid for quest intended for client)
data << uint32(pQuest->GetZoneOrSort()); // zone or sort to display in quest log
- data << uint32(pQuest->GetType());
- data << uint32(pQuest->GetSuggestedPlayers());
+ data << uint32(pQuest->GetType()); // quest type
+ data << uint32(pQuest->GetSuggestedPlayers()); // suggested players count
data << uint32(pQuest->GetRepObjectiveFaction()); // shown in quest log as part of quest objective
data << uint32(pQuest->GetRepObjectiveValue()); // shown in quest log as part of quest objective
@@ -566,7 +566,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS))
data << uint32(0); // Hide money rewarded
else
- data << uint32(pQuest->GetRewOrReqMoney());
+ data << uint32(pQuest->GetRewOrReqMoney()); // reward money (below max lvl)
data << uint32(pQuest->GetRewMoneyMaxLevel()); // used in XP calculation at client
data << uint32(pQuest->GetRewSpell()); // reward spell, this spell will display (icon) (casted if RewSpellCast==0)
@@ -574,8 +574,8 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
// rewarded honor points
data << uint32(Trinity::Honor::hk_honor_at_level(pSession->GetPlayer()->getLevel(), pQuest->GetRewHonorableKills()));
- data << uint32(pQuest->GetSrcItemId());
- data << uint32(pQuest->GetFlags() & 0xFFFF);
+ data << uint32(pQuest->GetSrcItemId()); // source item id
+ data << uint32(pQuest->GetFlags() & 0xFFFF); // quest flags
data << uint32(pQuest->GetCharTitleId()); // CharTitleId, new 2.4.0, player gets this title (id from CharTitles)
data << uint32(pQuest->GetPlayersSlain()); // players slain
data << uint32(pQuest->GetBonusTalents()); // bonus talents
@@ -628,15 +628,12 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest )
data << uint32(pQuest->ReqSourceId[iI]);
}
- for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI)
+ for (iI = 0; iI < QUEST_ITEM_OBJECTIVES_COUNT; ++iI)
{
data << uint32(pQuest->ReqItemId[iI]);
data << uint32(pQuest->ReqItemCount[iI]);
}
- data << uint32(0); // TODO: 5 item objective
- data << uint32(0);
-
for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI)
data << ObjectiveText[iI];
@@ -782,7 +779,7 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID
data << uint32( pQuest->GetReqItemsCount() );
ItemPrototype const *pItem;
- for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
+ for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
if ( !pQuest->ReqItemId[i] ) continue;
pItem = objmgr.GetItemPrototype(pQuest->ReqItemId[i]);
@@ -807,4 +804,3 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID
pSession->SendPacket( &data );
sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId() );
}
-
diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h
index 88c15f334a1..5e4c2e8b65a 100644
--- a/src/game/GossipDef.h
+++ b/src/game/GossipDef.h
@@ -207,4 +207,3 @@ class TRINITY_DLL_SPEC PlayerMenu
void SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID, bool Completable, bool CloseOnCancel );
};
#endif
-
diff --git a/src/game/GridDefines.h b/src/game/GridDefines.h
index c51b507fcbd..968118431a7 100644
--- a/src/game/GridDefines.h
+++ b/src/game/GridDefines.h
@@ -191,4 +191,3 @@ namespace Trinity
}
}
#endif
-
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index ed6232b101f..9deb5cb2e24 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -1244,4 +1244,3 @@ namespace Trinity
#endif
}
#endif
-
diff --git a/src/game/Group.cpp b/src/game/Group.cpp
index 9face6d0e7d..a3fe884a645 100644
--- a/src/game/Group.cpp
+++ b/src/game/Group.cpp
@@ -71,7 +71,7 @@ Group::~Group()
// it is undefined whether objectmgr (which stores the groups) or instancesavemgr
// will be unloaded first so we must be prepared for both cases
// this may unload some instance saves
- for (uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i)
+ for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2)
itr2->second.save->RemoveGroup(this);
@@ -94,22 +94,27 @@ bool Group::Create(const uint64 &guid, const char * name)
m_lootThreshold = ITEM_QUALITY_UNCOMMON;
m_looterGuid = guid;
- m_difficulty = DIFFICULTY_NORMAL;
+ m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
+ m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
if(!isBGGroup())
{
Player *leader = objmgr.GetPlayer(guid);
- if(leader) m_difficulty = leader->GetDifficulty();
-
+ if(leader)
+ {
+ m_dungeonDifficulty = leader->GetDungeonDifficulty();
+ m_raidDifficulty = leader->GetRaidDifficulty();
+ }
+
Player::ConvertInstancesToGroup(leader, this, guid);
// store group in database
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid));
CharacterDatabase.PExecute("DELETE FROM group_member WHERE leaderGuid ='%u'", GUID_LOPART(m_leaderGuid));
- CharacterDatabase.PExecute("INSERT INTO groups(leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty) "
- "VALUES('%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u')",
+ CharacterDatabase.PExecute("INSERT INTO groups (leaderGuid,mainTank,mainAssistant,lootMethod,looterGuid,lootThreshold,icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,isRaid,difficulty,raiddifficulty) "
+ "VALUES ('%u','%u','%u','%u','%u','%u','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','" UI64FMTD "','%u','%u','%u')",
GUID_LOPART(m_leaderGuid), GUID_LOPART(m_mainTank), GUID_LOPART(m_mainAssistant), uint32(m_lootMethod),
- GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), m_difficulty);
+ GUID_LOPART(m_looterGuid), uint32(m_lootThreshold), m_targetIcons[0], m_targetIcons[1], m_targetIcons[2], m_targetIcons[3], m_targetIcons[4], m_targetIcons[5], m_targetIcons[6], m_targetIcons[7], isRaidGroup(), uint32(m_dungeonDifficulty), m_raidDifficulty);
}
if(!AddMember(guid, name))
@@ -129,8 +134,8 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
if(!result)
{
external = false;
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
- result = CharacterDatabase.PQuery("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid));
+ // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
+ result = CharacterDatabase.PQuery("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, isRaid, difficulty, raiddifficulty FROM groups WHERE leaderGuid ='%u'", GUID_LOPART(leaderGuid));
if(!result)
return false;
}
@@ -149,7 +154,16 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
if (m_groupType == GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
- m_difficulty = (*result)[14].GetUInt8();
+ uint32 diff = (*result)[14].GetUInt8();
+ if (diff >= MAX_DUNGEON_DIFFICULTY)
+ diff = DUNGEON_DIFFICULTY_NORMAL;
+ m_dungeonDifficulty = Difficulty(diff);
+
+ uint32 r_diff = (*result)[15].GetUInt8();
+ if (r_diff >= MAX_RAID_DIFFICULTY)
+ r_diff = RAID_DIFFICULTY_10MAN_NORMAL;
+ m_raidDifficulty = Difficulty(r_diff);
+
m_mainTank = (*result)[0].GetUInt64();
m_mainAssistant = (*result)[1].GetUInt64();
m_lootMethod = (LootMethod)(*result)[2].GetUInt8();
@@ -291,12 +305,21 @@ bool Group::AddMember(const uint64 &guid, const char* name)
{
// reset the new member's instances, unless he is currently in one of them
// including raid/heroic instances that they are not permanently bound to!
- player->ResetInstances(INSTANCE_RESET_GROUP_JOIN);
+ player->ResetInstances(INSTANCE_RESET_GROUP_JOIN,false);
+ player->ResetInstances(INSTANCE_RESET_GROUP_JOIN,true);
- if(player->getLevel() >= LEVELREQUIREMENT_HEROIC && player->GetDifficulty() != GetDifficulty() )
+ if (player->getLevel() >= LEVELREQUIREMENT_HEROIC)
{
- player->SetDifficulty(m_difficulty);
- player->SendDungeonDifficulty(true);
+ if (player->GetDungeonDifficulty() != GetDungeonDifficulty())
+ {
+ player->SetDungeonDifficulty(GetDungeonDifficulty());
+ player->SendDungeonDifficulty(true);
+ }
+ if (player->GetRaidDifficulty() != GetRaidDifficulty())
+ {
+ player->SetRaidDifficulty(GetRaidDifficulty());
+ player->SendRaidDifficulty(true);
+ }
}
}
player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
@@ -441,7 +464,8 @@ void Group::Disband(bool hideDestroy)
CharacterDatabase.PExecute("DELETE FROM groups WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid));
CharacterDatabase.PExecute("DELETE FROM group_member WHERE leaderGuid='%u'", GUID_LOPART(m_leaderGuid));
CharacterDatabase.CommitTransaction();
- ResetInstances(INSTANCE_RESET_GROUP_DISBAND, NULL);
+ ResetInstances(INSTANCE_RESET_GROUP_DISBAND, false, NULL);
+ ResetInstances(INSTANCE_RESET_GROUP_DISBAND, true, NULL);
}
m_leaderGuid = 0;
@@ -454,12 +478,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)
@@ -475,7 +500,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);
@@ -704,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;
}
@@ -768,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())
@@ -815,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())
@@ -959,7 +984,8 @@ void Group::SendUpdate()
data << (uint8)m_lootMethod; // loot method
data << (uint64)m_looterGuid; // looter guid
data << (uint8)m_lootThreshold; // loot threshold
- data << (uint8)m_difficulty; // Heroic Mod Group
+ data << (uint8)m_dungeonDifficulty; // Dungeon Difficulty
+ data << (uint8)m_raidDifficulty; // Raid Difficulty
}
player->GetSession()->SendPacket( &data );
}
@@ -1076,7 +1102,7 @@ bool Group::_addMember(const uint64 &guid, const char* name, bool isAssistant, u
else
player->SetGroup(this, group);
// if the same group invites the player back, cancel the homebind timer
- InstanceGroupBind *bind = GetBoundInstance(player->GetMapId(), player->GetDifficulty());
+ InstanceGroupBind *bind = GetBoundInstance(player);
if(bind && bind->save->GetInstanceId() == player->GetInstanceId())
player->m_InstanceValid = true;
}
@@ -1162,7 +1188,7 @@ void Group::_setLeader(const uint64 &guid)
Player *player = objmgr.GetPlayer(slot->guid);
if(player)
{
- for (uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i)
+ for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();)
{
@@ -1211,7 +1237,7 @@ void Group::_removeRolls(const uint64 &guid)
roll->playerVote.erase(itr2);
- CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, 3);
+ CountRollVote(guid, roll->itemGUID, GetMembersCount()-1, MAX_ROLL_TYPE);
}
}
@@ -1449,19 +1475,38 @@ void Roll::targetObjectBuildLink()
getTarget()->addLootValidatorRef(this);
}
-void Group::SetDifficulty(uint8 difficulty)
+void Group::SetDungeonDifficulty(Difficulty difficulty)
{
- m_difficulty = difficulty;
- if (!isBGGroup())
- CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE leaderGuid ='%u'", m_difficulty, GUID_LOPART(m_leaderGuid));
-
+ m_dungeonDifficulty = difficulty;
+ if(!isBGGroup())
+ CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE leaderGuid ='%u'", m_dungeonDifficulty, GUID_LOPART(m_leaderGuid));
+
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *player = itr->getSource();
if(!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
continue;
- player->SetDifficulty(difficulty);
+ player->SetDungeonDifficulty(difficulty);
player->SendDungeonDifficulty(true);
+ //send player to recall positio nis a dungeon (to avoid an exploit)
+ if (sMapStore.LookupEntry(player->GetMap()->IsDungeon()))
+ player->TeleportTo(player->m_recallMap, player->m_recallX, player->m_recallY, player->m_recallZ, player->m_recallO);
+ }
+}
+
+void Group::SetRaidDifficulty(Difficulty difficulty)
+{
+ m_raidDifficulty = difficulty;
+ if(!isBGGroup())
+ CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE leaderGuid ='%u'", m_raidDifficulty, GUID_LOPART(m_leaderGuid));
+
+ for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
+ {
+ Player *player = itr->getSource();
+ if(!player->GetSession() || player->getLevel() < LEVELREQUIREMENT_HEROIC)
+ continue;
+ player->SetRaidDifficulty(difficulty);
+ player->SendRaidDifficulty(true);
}
}
@@ -1470,7 +1515,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
{
Player *pPlayer = itr->getSource();
- if(pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaid() || pPlayer->GetMap()->IsHeroic()))
+ if(pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon()))
for (std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i!=pPlayer->getAttackers().end(); ++i)
if((*i) && (*i)->GetTypeId() == TYPEID_UNIT && ((Creature*)(*i))->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
return true;
@@ -1478,7 +1523,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
return false;
}
-void Group::ResetInstances(uint8 method, Player* SendMsgTo)
+void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
if(isBGGroup())
return;
@@ -1486,13 +1531,13 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo)
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
// we assume that when the difficulty changes, all instances that can be reset will be
- uint8 dif = GetDifficulty();
+ Difficulty diff = GetDifficulty(isRaid);
- for (BoundInstancesMap::iterator itr = m_boundInstances[dif].begin(); itr != m_boundInstances[dif].end();)
+ for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end(); )
{
InstanceSave *p = itr->second.save;
const MapEntry *entry = sMapStore.LookupEntry(itr->first);
- if(!entry || (!p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND))
+ if(!entry || entry->IsRaid() != isRaid || !p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)
{
++itr;
continue;
@@ -1501,7 +1546,7 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo)
if(method == INSTANCE_RESET_ALL)
{
// the "reset all instances" method can only reset normal maps
- if(dif == DIFFICULTY_HEROIC || entry->map_type == MAP_RAID)
+ if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC)
{
++itr;
continue;
@@ -1531,8 +1576,8 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo)
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[dif].erase(itr);
- itr = m_boundInstances[dif].begin();
+ m_boundInstances[diff].erase(itr);
+ itr = m_boundInstances[diff].begin();
// this unloads the instance save unless online players are bound to it
// (eg. permanent binds or GM solo binds)
p->RemoveGroup(this);
@@ -1542,11 +1587,19 @@ void Group::ResetInstances(uint8 method, Player* SendMsgTo)
}
}
-InstanceGroupBind* Group::GetBoundInstance(uint32 mapid, uint8 difficulty)
+InstanceGroupBind* Group::GetBoundInstance(Player* player)
{
+ uint32 mapid = player->GetMapId();
+ MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
+ if(!mapEntry)
+ return NULL;
+
+ Difficulty difficulty = player->GetDifficulty(mapEntry->IsRaid());
+
// some instances only have one difficulty
- const MapEntry* entry = sMapStore.LookupEntry(mapid);
- if(!entry || !entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL;
+ MapDifficulty const* mapDiff = GetMapDifficultyData(mapid,difficulty);
+ if(!mapDiff)
+ difficulty = DUNGEON_DIFFICULTY_NORMAL;
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
if(itr != m_boundInstances[difficulty].end())
@@ -1555,6 +1608,24 @@ InstanceGroupBind* Group::GetBoundInstance(uint32 mapid, uint8 difficulty)
return NULL;
}
+InstanceGroupBind* Group::GetBoundInstance(Map* aMap)
+{
+ // Currently spawn numbering not different from map difficulty
+ Difficulty difficulty = GetDifficulty(aMap->IsRaid());
+
+ // some instances only have one difficulty
+ MapDifficulty const* mapDiff = GetMapDifficultyData(aMap->GetId(),difficulty);
+ if(!mapDiff)
+ return NULL;
+
+ BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(aMap->GetId());
+ if(itr != m_boundInstances[difficulty].end())
+ return &itr->second;
+ else
+ return NULL;
+}
+
+
InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, bool load)
{
if(save && !isBGGroup())
@@ -1624,4 +1695,3 @@ void Group::BroadcastGroupUpdate(void)
}
}
}
-
diff --git a/src/game/Group.h b/src/game/Group.h
index e38d39ecd7b..26c2ea878e6 100644
--- a/src/game/Group.h
+++ b/src/game/Group.h
@@ -25,6 +25,7 @@
#include "GroupRefManager.h"
#include "BattleGround.h"
#include "LootMgr.h"
+#include "DBCEnums.h"
#include <map>
#include <vector>
@@ -100,7 +101,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); }
@@ -111,6 +112,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;
@@ -281,11 +283,15 @@ class TRINITY_DLL_SPEC Group
}
void SetTargetIcon(uint8 id, uint64 guid);
- void SetDifficulty(uint8 difficulty);
- uint8 GetDifficulty() { return m_difficulty; }
+
+ Difficulty GetDifficulty(bool isRaid) const { return isRaid ? m_raidDifficulty : m_dungeonDifficulty; }
+ Difficulty GetDungeonDifficulty() const { return m_dungeonDifficulty; }
+ Difficulty GetRaidDifficulty() const { return m_raidDifficulty; }
+ void SetDungeonDifficulty(Difficulty difficulty);
+ void SetRaidDifficulty(Difficulty difficulty);
uint16 InInstance();
bool InCombatToInstance(uint32 instanceId);
- void ResetInstances(uint8 method, Player* SendMsgTo);
+ void ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo);
// -no description-
//void SendInit(WorldSession *session);
@@ -329,8 +335,9 @@ class TRINITY_DLL_SPEC Group
InstanceGroupBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false);
void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false);
- InstanceGroupBind* GetBoundInstance(uint32 mapid, uint8 difficulty);
- BoundInstancesMap& GetBoundInstances(uint8 difficulty) { return m_boundInstances[difficulty]; }
+ InstanceGroupBind* GetBoundInstance(Player* player);
+ InstanceGroupBind* GetBoundInstance(Map* aMap);
+ BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; }
// FG: evil hacks
void BroadcastGroupUpdate(void);
@@ -402,15 +409,15 @@ class TRINITY_DLL_SPEC Group
uint64 m_mainTank;
uint64 m_mainAssistant;
GroupType m_groupType;
- uint8 m_difficulty;
+ Difficulty m_dungeonDifficulty;
+ Difficulty m_raidDifficulty;
BattleGround* m_bgGroup;
uint64 m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
uint64 m_looterGuid;
Rolls RollId;
- BoundInstancesMap m_boundInstances[TOTAL_DIFFICULTIES];
+ BoundInstancesMap m_boundInstances[MAX_DIFFICULTY];
uint8* m_subGroupsCounts;
};
#endif
-
diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index fab192bbedc..f8bdc008e51 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -96,7 +96,7 @@ void WorldSession::HandleGroupInviteOpcode( WorldPacket & recv_data )
return;
}
// just ignore us
- if(player->GetInstanceId() != 0 && player->GetDifficulty() != GetPlayer()->GetDifficulty())
+ if(player->GetInstanceId() != 0 && player->GetDungeonDifficulty() != GetPlayer()->GetDungeonDifficulty())
{
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_TARGET_IGNORE_YOU);
return;
@@ -386,10 +386,10 @@ 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; //0: pass, 1: need, 2: greed
//sLog.outDebug("WORLD RECIEVE CMSG_LOOT_ROLL, From:%u, Numberofplayers:%u, Choise:%u", (uint32)Guid, NumberOfPlayers, Choise);
@@ -398,14 +398,14 @@ void WorldSession::HandleLootRoll( WorldPacket &recv_data )
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;
}
@@ -919,4 +919,3 @@ void WorldSession::HandleOptOutOfLootOpcode( WorldPacket & recv_data )
if(unkn!=0)
sLog.outError("CMSG_GROUP_PASS_ON_LOOT: activation not implemented!");
}
-