mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Added placeholders for new battlegrounds, some other stuff.
This commit is contained in:
parent
7df6372458
commit
02bcc56919
43 changed files with 567 additions and 113 deletions
|
|
@ -69,7 +69,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 < TOTAL_DUNGEON_DIFFICULTIES; ++i)
|
||||
for(BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2)
|
||||
itr2->second.save->RemoveGroup(this);
|
||||
|
||||
|
|
@ -92,11 +92,16 @@ 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);
|
||||
|
||||
|
|
@ -104,10 +109,10 @@ bool Group::Create(const uint64 &guid, const char * name)
|
|||
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) "
|
||||
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')",
|
||||
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(), m_dungeonDifficulty, m_raidDifficulty);
|
||||
}
|
||||
|
||||
if(!AddMember(guid, name))
|
||||
|
|
@ -127,8 +132,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;
|
||||
}
|
||||
|
|
@ -147,7 +152,8 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool
|
|||
if (m_groupType == GROUPTYPE_RAID)
|
||||
_initRaidSubGroupsCounter();
|
||||
|
||||
m_difficulty = (*result)[14].GetUInt8();
|
||||
m_dungeonDifficulty = (*result)[14].GetUInt8();
|
||||
m_raidDifficulty = (*result)[15].GetUInt8();
|
||||
m_mainTank = (*result)[0].GetUInt64();
|
||||
m_mainAssistant = (*result)[1].GetUInt64();
|
||||
m_lootMethod = (LootMethod)(*result)[2].GetUInt8();
|
||||
|
|
@ -291,16 +297,16 @@ bool Group::AddMember(const uint64 &guid, const char* name)
|
|||
// including raid/heroic instances that they are not permanently bound to!
|
||||
player->ResetInstances(INSTANCE_RESET_GROUP_JOIN);
|
||||
|
||||
if(player->getLevel() >= LEVELREQUIREMENT_HEROIC && player->GetDifficulty() != GetDifficulty() )
|
||||
if(player->getLevel() >= LEVELREQUIREMENT_HEROIC && player->GetDungeonDifficulty() != GetDungeonDifficulty() )
|
||||
{
|
||||
player->SetDifficulty(m_difficulty);
|
||||
player->SetDungeonDifficulty(m_dungeonDifficulty);
|
||||
player->SendDungeonDifficulty(true);
|
||||
}
|
||||
}
|
||||
player->SetGroupUpdateFlag(GROUP_UPDATE_FULL);
|
||||
UpdatePlayerOutOfRange(player);
|
||||
|
||||
// quest related GO state dependent from raid memebership
|
||||
// quest related GO state dependent from raid membership
|
||||
if(isRaidGroup())
|
||||
player->UpdateForQuestWorldObjects();
|
||||
}
|
||||
|
|
@ -364,7 +370,7 @@ void Group::ChangeLeader(const uint64 &guid)
|
|||
{
|
||||
member_citerator slot = _getMemberCSlot(guid);
|
||||
|
||||
if(slot==m_memberSlots.end())
|
||||
if(slot == m_memberSlots.end())
|
||||
return;
|
||||
|
||||
_setLeader(guid);
|
||||
|
|
@ -955,7 +961,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 );
|
||||
}
|
||||
|
|
@ -1072,7 +1079,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->GetMapId(), player->GetDungeonDifficulty());
|
||||
if(bind && bind->save->GetInstanceId() == player->GetInstanceId())
|
||||
player->m_InstanceValid = true;
|
||||
}
|
||||
|
|
@ -1158,7 +1165,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 < TOTAL_DUNGEON_DIFFICULTIES; ++i)
|
||||
{
|
||||
for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();)
|
||||
{
|
||||
|
|
@ -1445,21 +1452,36 @@ void Roll::targetObjectBuildLink()
|
|||
getTarget()->addLootValidatorRef(this);
|
||||
}
|
||||
|
||||
void Group::SetDifficulty(uint8 difficulty)
|
||||
void Group::SetDungeonDifficulty(uint8 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);
|
||||
}
|
||||
}
|
||||
|
||||
void Group::SetRaidDifficulty(uint8 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);
|
||||
}
|
||||
}
|
||||
|
||||
bool Group::InCombatToInstance(uint32 instanceId)
|
||||
{
|
||||
for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
|
|
@ -1479,7 +1501,7 @@ 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();
|
||||
uint8 dif = GetDungeonDifficulty();
|
||||
|
||||
for(BoundInstancesMap::iterator itr = m_boundInstances[dif].begin(); itr != m_boundInstances[dif].end();)
|
||||
{
|
||||
|
|
@ -1494,7 +1516,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(dif == DUNGEON_DIFFICULTY_HEROIC || entry->map_type == MAP_RAID)
|
||||
{
|
||||
++itr;
|
||||
continue;
|
||||
|
|
@ -1534,7 +1556,7 @@ InstanceGroupBind* Group::GetBoundInstance(uint32 mapid, uint8 difficulty)
|
|||
{
|
||||
// some instances only have one difficulty
|
||||
const MapEntry* entry = sMapStore.LookupEntry(mapid);
|
||||
if(!entry || !entry->SupportsHeroicMode()) difficulty = DIFFICULTY_NORMAL;
|
||||
if(!entry || !entry->SupportsHeroicMode()) difficulty = DUNGEON_DIFFICULTY_NORMAL;
|
||||
|
||||
BoundInstancesMap::iterator itr = m_boundInstances[difficulty].find(mapid);
|
||||
if(itr != m_boundInstances[difficulty].end())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue