Core/Battlefield: Add missing stuff for wintergrasp

This commit is contained in:
Vincent-Michael committed 2012-08-21 23:03:30 +02:00
1 parent 984493108b
commit 6891fe6248
20 files changed
+139 -106

No files matched your search

+31 -31
View File
@@ -104,7 +104,7 @@ bool Group::Create(Player* leader)
m_leaderGuid = leaderGuid;
m_leaderName = leader->GetName();
m_groupType = isBGGroup() ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
m_groupType = (isBGGroup() || isBFGroup()) ? GROUPTYPE_BGRAID : GROUPTYPE_NORMAL;
if (m_groupType & GROUPTYPE_RAID)
_initRaidSubGroupsCounter();
@@ -116,7 +116,7 @@ bool Group::Create(Player* leader)
m_dungeonDifficulty = DUNGEON_DIFFICULTY_NORMAL;
m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL;
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
m_dungeonDifficulty = leader->GetDungeonDifficulty();
m_raidDifficulty = leader->GetRaidDifficulty();
@@ -232,7 +232,7 @@ void Group::ConvertToLFG()
{
m_groupType = GroupType(m_groupType | GROUPTYPE_LFG | GROUPTYPE_UNK1);
m_lootMethod = NEED_BEFORE_GREED;
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
@@ -251,7 +251,7 @@ void Group::ConvertToRaid()
_initRaidSubGroupsCounter();
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_TYPE);
@@ -274,7 +274,7 @@ bool Group::AddInvite(Player* player)
if (!player || player->GetGroupInvite())
return false;
Group* group = player->GetGroup();
if (group && group->isBGGroup())
if (group && (group->isBGGroup() || group->isBFGroup()))
group = player->GetOriginalGroup();
if (group)
return false;
@@ -371,8 +371,8 @@ bool Group::AddMember(Player* player)
if (player)
{
player->SetGroupInvite(NULL);
if (player->GetGroup() && isBGGroup()) //if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
player->SetBattlegroundRaid(this, subGroup);
if (player->GetGroup() && (isBGGroup() || isBFGroup())) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
else if (player->GetGroup()) //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
player->SetOriginalGroup(this, subGroup);
else //if player is not in group, then call set group
@@ -391,7 +391,7 @@ bool Group::AddMember(Player* player)
}
// insert into the table if we're not a battleground group
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GROUP_MEMBER);
@@ -410,7 +410,7 @@ bool Group::AddMember(Player* player)
if (player)
{
if (!IsLeader(player->GetGUID()) && !isBGGroup())
if (!IsLeader(player->GetGUID()) && !isBGGroup() && !isBFGroup())
{
// 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!
@@ -496,15 +496,15 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
return m_memberSlots.size();
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group)
if (GetMembersCount() > ((isBGGroup() || isLFGGroup()) ? 1u : 2u))
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG/BF allow 1 member group)
if (GetMembersCount() > ((isBGGroup() || isLFGGroup() || isBFGroup()) ? 1u : 2u))
{
Player* player = ObjectAccessor::FindPlayer(guid);
if (player)
{
// Battleground group handling
if (isBGGroup())
player->RemoveFromBattlegroundRaid();
if (isBGGroup() || isBFGroup())
player->RemoveFromBattlegroundOrBattlefieldRaid();
else
// Regular group
{
@@ -535,13 +535,13 @@ bool Group::RemoveMember(uint64 guid, const RemoveMethod &method /*= GROUP_REMOV
}
// Remove player from group in DB
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
stmt->setUInt32(0, GUID_LOPART(guid));
CharacterDatabase.Execute(stmt);
DelinkMember(guid);
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GROUP_MEMBER);
stmt->setUInt32(0, GUID_LOPART(guid));
CharacterDatabase.Execute(stmt);
DelinkMember(guid);
}
// Reevaluate group enchanter if the leaving player had enchanting skill or the player is offline
if ((player && player->GetSkillValue(SKILL_ENCHANTING)) || !player)
@@ -632,7 +632,7 @@ void Group::ChangeLeader(uint64 guid)
sScriptMgr->OnGroupChangeLeader(this, m_leaderGuid, guid);
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
// Remove the groups permanent instance bindings
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
@@ -692,8 +692,8 @@ void Group::Disband(bool hideDestroy /* = false */)
//we cannot call _removeMember because it would invalidate member iterator
//if we are removing player from battleground raid
if (isBGGroup())
player->RemoveFromBattlegroundRaid();
if (isBGGroup() || isBFGroup())
player->RemoveFromBattlegroundOrBattlefieldRaid();
else
{
//we can remove player who is in battleground from his original group
@@ -737,7 +737,7 @@ void Group::Disband(bool hideDestroy /* = false */)
RemoveAllInvites();
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -1507,7 +1507,7 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot)
Player* member = ObjectAccessor::FindPlayer(citr->guid);
uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE;
onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0);
onlineState = onlineState | ((isBGGroup() || isBFGroup()) ? MEMBER_STATUS_PVP : 0);
data << citr->name;
data << uint64(citr->guid); // guid
@@ -1598,7 +1598,7 @@ bool Group::_setMembersGroup(uint64 guid, uint8 group)
SubGroupCounterIncrease(group);
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
@@ -1649,7 +1649,7 @@ void Group::ChangeMembersGroup(uint64 guid, uint8 group)
SubGroupCounterDecrease(prevSubGroup);
// Preserve new sub group in database for non-raid groups
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_MEMBER_SUBGROUP);
@@ -1844,7 +1844,7 @@ void Roll::targetObjectBuildLink()
void Group::SetDungeonDifficulty(Difficulty difficulty)
{
m_dungeonDifficulty = difficulty;
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_DIFFICULTY);
@@ -1868,7 +1868,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty)
void Group::SetRaidDifficulty(Difficulty difficulty)
{
m_raidDifficulty = difficulty;
if (!isBGGroup())
if (!isBGGroup() && !isBFGroup())
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GROUP_RAID_DIFFICULTY);
@@ -1904,7 +1904,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
{
if (isBGGroup())
if (isBGGroup() || isBFGroup())
return;
// method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND
@@ -2019,7 +2019,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry)
InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, bool load)
{
if (!save || isBGGroup())
if (!save || isBGGroup() || isBFGroup())
return NULL;
InstanceGroupBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];