mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Merge branch 'master' into 310
Conflicts: src/game/BattleGroundHandler.cpp src/game/Unit.cpp
This commit is contained in:
commit
769a24252b
22 changed files with 795 additions and 774 deletions
|
|
@ -22,7 +22,7 @@
|
|||
DROP TABLE IF EXISTS `db_version`;
|
||||
CREATE TABLE `db_version` (
|
||||
`version` varchar(120) default NULL,
|
||||
`required_7627_01_mangos_achievement_criteria_data` bit(1) default NULL
|
||||
`required_7633_01_mangos_achievement_criteria_data` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -46,7 +46,7 @@ CREATE TABLE `achievement_criteria_data` (
|
|||
`type` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`value1` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
`value2` mediumint(8) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`criteria_id`)
|
||||
PRIMARY KEY (`criteria_id`,`type`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Achievment system';
|
||||
|
||||
--
|
||||
|
|
|
|||
5
sql/updates/7633_01_mangos_achievement_criteria_data.sql
Normal file
5
sql/updates/7633_01_mangos_achievement_criteria_data.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_7627_01_mangos_achievement_criteria_data required_7633_01_mangos_achievement_criteria_data bit;
|
||||
|
||||
ALTER TABLE `achievement_criteria_data`
|
||||
DROP PRIMARY KEY,
|
||||
ADD PRIMARY KEY (`criteria_id`,`type`);
|
||||
|
|
@ -218,6 +218,7 @@ pkgdata_DATA = \
|
|||
7622_02_mangos_creature_ai_summons.sql \
|
||||
7622_03_mangos_creature_ai_texts.sql \
|
||||
7627_01_mangos_achievement_criteria_data.sql \
|
||||
7633_01_mangos_achievement_criteria_data.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -416,4 +417,5 @@ EXTRA_DIST = \
|
|||
7622_02_mangos_creature_ai_summons.sql \
|
||||
7622_03_mangos_creature_ai_texts.sql \
|
||||
7627_01_mangos_achievement_criteria_data.sql \
|
||||
7633_01_mangos_achievement_criteria_data.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -79,17 +79,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
|||
switch(criteria->requiredType)
|
||||
{
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
|
||||
switch(dataType)
|
||||
{
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH:
|
||||
break;
|
||||
default:
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` for criteria (Entry: %u Type: %u) have wrong data type (%u), ignore.", criteria->ID, criteria->requiredType,dataType);
|
||||
return false;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
|
||||
break;
|
||||
default:
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` have data for not supported criteria type (Entry: %u Type: %u), ignore.", criteria->ID, criteria->requiredType);
|
||||
|
|
@ -100,7 +90,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
|||
{
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE:
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
|
||||
if(!creature.id || !objmgr.GetCreatureTemplate(creature.id))
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) have not existed creature id in value1 (%u), ignore.",
|
||||
|
|
@ -108,7 +98,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
|
||||
if(!classRace.class_id && !classRace.race_id)
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE (%u) must have not 0 in one from value fields, ignore.",
|
||||
|
|
@ -128,14 +118,48 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
|
||||
if(health.percent < 1 || health.percent > 100)
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) have prong percent value in value1 (%u), ignore.",
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) have wrong percent value in value1 (%u), ignore.",
|
||||
criteria->ID, criteria->requiredType,dataType,health.percent);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA:
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA:
|
||||
{
|
||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(aura.spell_id);
|
||||
if(!spellEntry)
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong spell id in value1 (%u), ignore.",
|
||||
criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.spell_id);
|
||||
return false;
|
||||
}
|
||||
if(aura.effect_idx >= 3)
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have wrong spell effect index in value2 (%u), ignore.",
|
||||
criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.effect_idx);
|
||||
return false;
|
||||
}
|
||||
if(!spellEntry->EffectApplyAuraName[aura.effect_idx])
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) have non-aura spell effect (ID: %u Effect: %u), ignore.",
|
||||
criteria->ID, criteria->requiredType,(dataType==ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"),dataType,aura.spell_id,aura.effect_idx);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA:
|
||||
if(!GetAreaEntryByAreaID(area.id))
|
||||
{
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) have wrong area id in value1 (%u), ignore.",
|
||||
criteria->ID, criteria->requiredType,dataType,area.id);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) have data for not supported data type (%u), ignore.", criteria->ID, criteria->requiredType,dataType);
|
||||
return false;
|
||||
|
|
@ -143,38 +167,56 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool AchievementCriteriaData::Meets( Unit const* target ) const
|
||||
bool AchievementCriteriaData::Meets(Player const* source, Unit const* target) const
|
||||
{
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
switch(dataType)
|
||||
{
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE:
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE:
|
||||
if (target->GetTypeId()!=TYPEID_UNIT)
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
|
||||
if (!target || target->GetTypeId()!=TYPEID_UNIT)
|
||||
return false;
|
||||
if (target->GetEntry() != creature.id)
|
||||
return false;
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE:
|
||||
if (target->GetTypeId()!=TYPEID_PLAYER)
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
|
||||
if (!target || target->GetTypeId()!=TYPEID_PLAYER)
|
||||
return false;
|
||||
if(classRace.class_id && classRace.class_id != ((Player*)target)->getClass())
|
||||
return false;
|
||||
if(classRace.race_id && classRace.race_id != ((Player*)target)->getRace())
|
||||
return false;
|
||||
return true;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH:
|
||||
if (target->GetTypeId()!=TYPEID_PLAYER)
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
|
||||
if (!target || target->GetTypeId()!=TYPEID_PLAYER)
|
||||
return false;
|
||||
return target->GetHealth()*100 <= health.percent*target->GetMaxHealth();
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
|
||||
return target && target->GetTypeId() == TYPEID_PLAYER && !target->isAlive() && ((Player*)target)->GetDeathTimer() != 0;
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA:
|
||||
return source->HasAura(aura.spell_id,aura.effect_idx);
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA:
|
||||
{
|
||||
uint32 zone_id,area_id;
|
||||
source->GetZoneAndAreaId(zone_id,area_id);
|
||||
return area.id==zone_id || area.id==area_id;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA:
|
||||
return target && target->HasAura(aura.spell_id,aura.effect_idx);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AchievementCriteriaDataSet::Meets(Player const* source, Unit const* target) const
|
||||
{
|
||||
for(Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr)
|
||||
if(!itr->Meets(source,target))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
AchievementMgr::AchievementMgr(Player *player)
|
||||
{
|
||||
m_player = player;
|
||||
|
|
@ -863,22 +905,18 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
|
||||
{
|
||||
// miscvalue1 = emote
|
||||
// miscvalue2 = achievement->ID for special requirement
|
||||
if(!miscvalue1)
|
||||
continue;
|
||||
if(miscvalue1 != achievementCriteria->do_emote.emoteID)
|
||||
continue;
|
||||
if(achievementCriteria->do_emote.count)
|
||||
{
|
||||
// harcoded case
|
||||
if(achievement->ID==247)
|
||||
{
|
||||
if (!unit || unit->GetTypeId() != TYPEID_PLAYER ||
|
||||
unit->isAlive() || ((Player*)unit)->GetDeathTimer() == 0)
|
||||
continue;
|
||||
}
|
||||
// expected as scripted case
|
||||
else if(!miscvalue2 || !achievement->ID != miscvalue2)
|
||||
// those requirements couldn't be found in the dbc
|
||||
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
|
||||
if(!data)
|
||||
continue;
|
||||
|
||||
if(!data->Meets(GetPlayer(),unit))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -949,11 +987,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
|||
continue;
|
||||
|
||||
// those requirements couldn't be found in the dbc
|
||||
AchievementCriteriaData const* data = achievementmgr.GetCriteriaData(achievementCriteria);
|
||||
AchievementCriteriaDataSet const* data = achievementmgr.GetCriteriaDataSet(achievementCriteria);
|
||||
if(!data)
|
||||
continue;
|
||||
|
||||
if(!data->Meets(unit))
|
||||
if(!data->Meets(GetPlayer(),unit))
|
||||
continue;
|
||||
|
||||
SetCriteriaProgress(achievementCriteria, 1, PROGRESS_ACCUMULATE);
|
||||
|
|
@ -1478,7 +1516,14 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
|||
if(!data.IsValid(criteria))
|
||||
continue;
|
||||
|
||||
m_criteriaDataMap[criteria_id] = data;
|
||||
// this will allocate empty data set storage
|
||||
AchievementCriteriaDataSet& dataSet = m_criteriaDataMap[criteria_id];
|
||||
|
||||
// add real data only for not NONE data types
|
||||
if(data.dataType!=ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE)
|
||||
dataSet.Add(data);
|
||||
|
||||
// counting data by and data types
|
||||
++count;
|
||||
} while(result->NextRow());
|
||||
|
||||
|
|
@ -1494,7 +1539,11 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
|
|||
switch(criteria->requiredType)
|
||||
{
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
|
||||
if(!GetCriteriaData(criteria))
|
||||
if(!GetCriteriaDataSet(criteria))
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType);
|
||||
break;
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE: // need skip generic cases
|
||||
if(criteria->do_emote.count && !GetCriteriaDataSet(criteria))
|
||||
sLog.outErrorDb( "Table `achievement_criteria_data` not have expected data for for criteria (Entry: %u Type: %u).", criteria->ID, criteria->requiredType);
|
||||
break;
|
||||
default: // unexpected case processed in IsValid check
|
||||
|
|
|
|||
|
|
@ -41,15 +41,20 @@ struct CriteriaProgress
|
|||
};
|
||||
|
||||
enum AchievementCriteriaDataType
|
||||
{ // value1 value2 for the Condition enumed
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0, // 0 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE = 1, // creature_id
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE = 2, // class_id race_id
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH = 3, // health_percent
|
||||
{ // value1 value2 comment
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE = 0, // 0 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE = 1, // creature_id 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE = 2, // class_id race_id
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH= 3, // health_percent 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD = 4, // 0 0 not corpse (not released body)
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA = 5, // spell_id effect_idx
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA = 6, // area id 0
|
||||
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA = 7, // spell_id effect_idx
|
||||
};
|
||||
|
||||
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 4 // maximum value in AchievementCriteriaDataType enum
|
||||
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 8 // maximum value in AchievementCriteriaDataType enum
|
||||
|
||||
class Player;
|
||||
class Unit;
|
||||
|
||||
struct AchievementCriteriaData
|
||||
|
|
@ -57,27 +62,39 @@ struct AchievementCriteriaData
|
|||
AchievementCriteriaDataType dataType;
|
||||
union
|
||||
{
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE
|
||||
struct
|
||||
{
|
||||
uint32 id;
|
||||
uint32 id;
|
||||
} creature;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_CLASS_RACE
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE
|
||||
struct
|
||||
{
|
||||
uint32 class_id;
|
||||
uint32 race_id;
|
||||
uint32 class_id;
|
||||
uint32 race_id;
|
||||
} classRace;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH
|
||||
struct
|
||||
{
|
||||
uint32 percent;
|
||||
uint32 percent;
|
||||
} health;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA
|
||||
struct
|
||||
{
|
||||
uint32 value1;
|
||||
uint32 value2;
|
||||
uint32 spell_id;
|
||||
uint32 effect_idx;
|
||||
} aura;
|
||||
// ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA
|
||||
struct
|
||||
{
|
||||
uint32 id;
|
||||
} area;
|
||||
// ...
|
||||
struct
|
||||
{
|
||||
uint32 value1;
|
||||
uint32 value2;
|
||||
} raw;
|
||||
};
|
||||
|
||||
|
|
@ -94,11 +111,20 @@ struct AchievementCriteriaData
|
|||
}
|
||||
|
||||
bool IsValid(AchievementCriteriaEntry const* criteria);
|
||||
// Checks correctness of values
|
||||
bool Meets(Unit const* target) const;// Checks if the target meets the requirement
|
||||
bool Meets(Player const* source, Unit const* target) const;
|
||||
};
|
||||
|
||||
typedef std::map<uint32,AchievementCriteriaData> AchievementCriteriaDataMap;
|
||||
struct AchievementCriteriaDataSet
|
||||
{
|
||||
typedef std::vector<AchievementCriteriaData> Storage;
|
||||
void Add(AchievementCriteriaData const& data) { storage.push_back(data); }
|
||||
bool Meets(Player const* source, Unit const* target) const;
|
||||
private:
|
||||
Storage storage;
|
||||
};
|
||||
|
||||
|
||||
typedef std::map<uint32,AchievementCriteriaDataSet> AchievementCriteriaDataMap;
|
||||
|
||||
struct AchievementReward
|
||||
{
|
||||
|
|
@ -194,7 +220,7 @@ class AchievementGlobalMgr
|
|||
return iter!=m_achievementRewardLocales.end() ? &iter->second : NULL;
|
||||
}
|
||||
|
||||
AchievementCriteriaData const* GetCriteriaData(AchievementCriteriaEntry const *achievementCriteria)
|
||||
AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const *achievementCriteria)
|
||||
{
|
||||
AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID);
|
||||
return iter!=m_criteriaDataMap.end() ? &iter->second : NULL;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace MaNGOS
|
|||
{
|
||||
char const* text = objmgr.GetMangosString(i_textId,loc_idx);
|
||||
|
||||
if(i_args)
|
||||
if (i_args)
|
||||
{
|
||||
// we need copy va_list before use or original va_list will corrupted
|
||||
va_list ap;
|
||||
|
|
@ -119,7 +119,7 @@ template<class Do>
|
|||
void BattleGround::BroadcastWorker(Do& _do)
|
||||
{
|
||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if(Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
|
||||
if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)))
|
||||
_do(plr);
|
||||
}
|
||||
|
||||
|
|
@ -219,8 +219,8 @@ BattleGround::~BattleGround()
|
|||
|
||||
sBattleGroundMgr.RemoveBattleGround(GetInstanceID(), GetTypeID());
|
||||
// unload map
|
||||
if(Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID()))
|
||||
if(map->IsBattleGroundOrArena())
|
||||
if (Map * map = MapManager::Instance().FindMap(GetMapId(), GetInstanceID()))
|
||||
if (map->IsBattleGroundOrArena())
|
||||
((BattleGroundMap*)map)->SetUnload();
|
||||
// remove from bg free slot queue
|
||||
this->RemoveFromBGFreeSlotQueue();
|
||||
|
|
@ -228,17 +228,17 @@ BattleGround::~BattleGround()
|
|||
|
||||
void BattleGround::Update(uint32 diff)
|
||||
{
|
||||
if(!GetPlayersSize() && !GetReviveQueueSize())
|
||||
if (!GetPlayersSize() && !GetReviveQueueSize())
|
||||
//BG is empty
|
||||
return;
|
||||
|
||||
// remove offline players from bg after 5 minutes
|
||||
if( !m_OfflineQueue.empty() )
|
||||
if (!m_OfflineQueue.empty())
|
||||
{
|
||||
BattleGroundPlayerMap::iterator itr = m_Players.find(*(m_OfflineQueue.begin()));
|
||||
if( itr != m_Players.end() )
|
||||
if (itr != m_Players.end())
|
||||
{
|
||||
if( itr->second.OfflineRemoveTime <= sWorld.GetGameTime() )
|
||||
if (itr->second.OfflineRemoveTime <= sWorld.GetGameTime())
|
||||
{
|
||||
RemovePlayerAtLeave(itr->first, true, true);// remove player from BG
|
||||
m_OfflineQueue.pop_front(); // remove from offline queue
|
||||
|
|
@ -255,7 +255,7 @@ void BattleGround::Update(uint32 diff)
|
|||
m_LastResurrectTime += diff;
|
||||
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
|
||||
{
|
||||
if(GetReviveQueueSize())
|
||||
if (GetReviveQueueSize())
|
||||
{
|
||||
for(std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr)
|
||||
{
|
||||
|
|
@ -263,7 +263,7 @@ void BattleGround::Update(uint32 diff)
|
|||
for(std::vector<uint64>::iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(*itr2);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
continue;
|
||||
|
||||
if (!sh)
|
||||
|
|
@ -292,7 +292,7 @@ void BattleGround::Update(uint32 diff)
|
|||
for(std::vector<uint64>::iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(*itr);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
continue;
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
plr->CastSpell(plr, SPELL_SPIRIT_HEAL_MANA, true);
|
||||
|
|
@ -306,20 +306,20 @@ void BattleGround::Update(uint32 diff)
|
|||
/*********************************************************/
|
||||
|
||||
// if less then minimum players are in on one side, then start premature finish timer
|
||||
if(GetStatus() == STATUS_IN_PROGRESS && !isArena() && sBattleGroundMgr.GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam()))
|
||||
if (GetStatus() == STATUS_IN_PROGRESS && !isArena() && sBattleGroundMgr.GetPrematureFinishTime() && (GetPlayersCountByTeam(ALLIANCE) < GetMinPlayersPerTeam() || GetPlayersCountByTeam(HORDE) < GetMinPlayersPerTeam()))
|
||||
{
|
||||
if(!m_PrematureCountDown)
|
||||
if (!m_PrematureCountDown)
|
||||
{
|
||||
m_PrematureCountDown = true;
|
||||
m_PrematureCountDownTimer = sBattleGroundMgr.GetPrematureFinishTime();
|
||||
}
|
||||
else if(m_PrematureCountDownTimer < diff)
|
||||
else if (m_PrematureCountDownTimer < diff)
|
||||
{
|
||||
// time's up!
|
||||
uint32 winner = 0;
|
||||
if( GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam() )
|
||||
if (GetPlayersCountByTeam(ALLIANCE) >= GetMinPlayersPerTeam())
|
||||
winner = ALLIANCE;
|
||||
else if( GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam() )
|
||||
else if (GetPlayersCountByTeam(HORDE) >= GetMinPlayersPerTeam())
|
||||
winner = HORDE;
|
||||
|
||||
EndBattleGround(winner);
|
||||
|
|
@ -329,15 +329,15 @@ void BattleGround::Update(uint32 diff)
|
|||
{
|
||||
uint32 newtime = m_PrematureCountDownTimer - diff;
|
||||
// announce every minute
|
||||
if( newtime > (MINUTE * IN_MILISECONDS) )
|
||||
if (newtime > (MINUTE * IN_MILISECONDS))
|
||||
{
|
||||
if( newtime / (MINUTE * IN_MILISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS) )
|
||||
if (newtime / (MINUTE * IN_MILISECONDS) != m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / (MINUTE * IN_MILISECONDS)));
|
||||
}
|
||||
else
|
||||
{
|
||||
//announce every 15 seconds
|
||||
if( newtime / (15 * IN_MILISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILISECONDS) )
|
||||
if (newtime / (15 * IN_MILISECONDS) != m_PrematureCountDownTimer / (15 * IN_MILISECONDS))
|
||||
PSendMessageToAll(LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS, CHAT_MSG_SYSTEM, NULL, (uint32)(m_PrematureCountDownTimer / IN_MILISECONDS));
|
||||
}
|
||||
m_PrematureCountDownTimer = newtime;
|
||||
|
|
@ -359,7 +359,7 @@ void BattleGround::Update(uint32 diff)
|
|||
m_Events |= BG_STARTING_EVENT_1;
|
||||
|
||||
// setup here, only when at least one player has ported to the map
|
||||
if(!SetupBattleGround())
|
||||
if (!SetupBattleGround())
|
||||
{
|
||||
EndNow();
|
||||
return;
|
||||
|
|
@ -394,12 +394,12 @@ void BattleGround::Update(uint32 diff)
|
|||
SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FOURTH]);
|
||||
|
||||
//remove preparation
|
||||
if( isArena() )
|
||||
if (isArena())
|
||||
{
|
||||
//TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if(Player *plr = objmgr.GetPlayer(itr->first))
|
||||
if (Player *plr = objmgr.GetPlayer(itr->first))
|
||||
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||
|
||||
CheckArenaWinConditions();
|
||||
|
|
@ -410,10 +410,10 @@ void BattleGround::Update(uint32 diff)
|
|||
PlaySoundToAll(SOUND_BG_START);
|
||||
|
||||
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if(Player* plr = objmgr.GetPlayer(itr->first))
|
||||
if (Player* plr = objmgr.GetPlayer(itr->first))
|
||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||
//Announce BG starting
|
||||
if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
|
||||
if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
|
||||
{
|
||||
sWorld.SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel());
|
||||
}
|
||||
|
|
@ -425,11 +425,11 @@ void BattleGround::Update(uint32 diff)
|
|||
/*** BATTLEGROUND ENDING SYSTEM ***/
|
||||
/*********************************************************/
|
||||
|
||||
if(GetStatus() == STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
{
|
||||
// remove all players from battleground after 2 minutes
|
||||
m_EndTime -= diff;
|
||||
if( m_EndTime <= 0)
|
||||
if (m_EndTime <= 0)
|
||||
{
|
||||
m_EndTime = 0;
|
||||
BattleGroundPlayerMap::iterator itr, next;
|
||||
|
|
@ -462,7 +462,7 @@ void BattleGround::SendPacketToAll(WorldPacket *packet)
|
|||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
if(plr)
|
||||
if (plr)
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
else
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
|
|
@ -475,19 +475,19 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *
|
|||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!self && sender == plr)
|
||||
if (!self && sender == plr)
|
||||
continue;
|
||||
|
||||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
plr->GetSession()->SendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
|
@ -507,7 +507,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
|||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
|
|
@ -516,7 +516,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID)
|
|||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
{
|
||||
sBattleGroundMgr.BuildPlaySoundPacket(&data, SoundID);
|
||||
plr->GetSession()->SendPacket(&data);
|
||||
|
|
@ -530,7 +530,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
|||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
|
|
@ -539,7 +539,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID)
|
|||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
plr->CastSpell(plr, SpellID, true);
|
||||
}
|
||||
}
|
||||
|
|
@ -550,7 +550,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
|
|||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
|
|
@ -559,7 +559,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID)
|
|||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
UpdatePlayerScore(plr, SCORE_BONUS_HONOR, Honor);
|
||||
}
|
||||
}
|
||||
|
|
@ -568,14 +568,14 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||
{
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id);
|
||||
|
||||
if(!factionEntry)
|
||||
if (!factionEntry)
|
||||
return;
|
||||
|
||||
for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGround: Player " I64FMTD " not found!", itr->first);
|
||||
continue;
|
||||
|
|
@ -584,7 +584,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation,
|
|||
uint32 team = itr->second.Team;
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
if(team == TeamID)
|
||||
if (team == TeamID)
|
||||
plr->GetReputationMgr().ModifyReputation(factionEntry, Reputation);
|
||||
}
|
||||
}
|
||||
|
|
@ -614,7 +614,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
WorldPacket data;
|
||||
int32 winmsg_id = 0;
|
||||
|
||||
if(winner == ALLIANCE)
|
||||
if (winner == ALLIANCE)
|
||||
{
|
||||
winmsg_id = isBattleGround() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS;
|
||||
|
||||
|
|
@ -622,7 +622,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
|
||||
SetWinner(WINNER_ALLIANCE);
|
||||
}
|
||||
else if(winner == HORDE)
|
||||
else if (winner == HORDE)
|
||||
{
|
||||
winmsg_id = isBattleGround() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS;
|
||||
|
||||
|
|
@ -640,11 +640,11 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
m_EndTime = TIME_TO_AUTOREMOVE;
|
||||
|
||||
// arena rating calculation
|
||||
if(isArena() && isRated())
|
||||
if (isArena() && isRated())
|
||||
{
|
||||
winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(winner));
|
||||
loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(winner)));
|
||||
if( winner_arena_team && loser_arena_team )
|
||||
if (winner_arena_team && loser_arena_team)
|
||||
{
|
||||
loser_rating = loser_arena_team->GetStats().rating;
|
||||
winner_rating = winner_arena_team->GetStats().rating;
|
||||
|
|
@ -666,12 +666,12 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
uint32 team = itr->second.Team;
|
||||
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
//if rated arena match - make member lost!
|
||||
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
{
|
||||
if(team == winner)
|
||||
if (team == winner)
|
||||
winner_arena_team->OfflineMemberLost(itr->first, loser_rating);
|
||||
else
|
||||
loser_arena_team->OfflineMemberLost(itr->first, winner_rating);
|
||||
|
|
@ -681,10 +681,10 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
}
|
||||
|
||||
// should remove spirit of redemption
|
||||
if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
if(!plr->isAlive())
|
||||
if (!plr->isAlive())
|
||||
{
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
plr->SpawnCorpseBones();
|
||||
|
|
@ -694,15 +694,15 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
//if(!team) team = plr->GetTeam();
|
||||
|
||||
// per player calculation
|
||||
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
{
|
||||
if(team == winner)
|
||||
if (team == winner)
|
||||
winner_arena_team->MemberWon(plr,loser_rating);
|
||||
else
|
||||
loser_arena_team->MemberLost(plr,winner_rating);
|
||||
}
|
||||
|
||||
if(team == winner)
|
||||
if (team == winner)
|
||||
{
|
||||
RewardMark(plr,ITEM_WINNER_COUNT);
|
||||
RewardQuest(plr);
|
||||
|
|
@ -725,7 +725,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
plr->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND, 1);
|
||||
}
|
||||
|
||||
if(isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
if (isArena() && isRated() && winner_arena_team && loser_arena_team)
|
||||
{
|
||||
// update arena points only after increasing the player's match count!
|
||||
//obsolete: winner_arena_team->UpdateArenaPointsHelper();
|
||||
|
|
@ -739,10 +739,7 @@ void BattleGround::EndBattleGround(uint32 winner)
|
|||
loser_arena_team->NotifyStatsChanged();
|
||||
}
|
||||
|
||||
// inform invited players about the removal
|
||||
sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
|
||||
|
||||
if(winmsg_id)
|
||||
if (winmsg_id)
|
||||
SendMessageToAll(winmsg_id, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
|
||||
|
|
@ -768,7 +765,7 @@ uint32 BattleGround::GetBattlemasterEntry() const
|
|||
void BattleGround::RewardMark(Player *plr,uint32 count)
|
||||
{
|
||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||
if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
return;
|
||||
|
||||
BattleGroundMarks mark;
|
||||
|
|
@ -777,21 +774,21 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
|||
{
|
||||
case BATTLEGROUND_AV:
|
||||
IsSpell = true;
|
||||
if(count == ITEM_WINNER_COUNT)
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
mark = SPELL_AV_MARK_WINNER;
|
||||
else
|
||||
mark = SPELL_AV_MARK_LOSER;
|
||||
break;
|
||||
case BATTLEGROUND_WS:
|
||||
IsSpell = true;
|
||||
if(count == ITEM_WINNER_COUNT)
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
mark = SPELL_WS_MARK_WINNER;
|
||||
else
|
||||
mark = SPELL_WS_MARK_LOSER;
|
||||
break;
|
||||
case BATTLEGROUND_AB:
|
||||
IsSpell = true;
|
||||
if(count == ITEM_WINNER_COUNT)
|
||||
if (count == ITEM_WINNER_COUNT)
|
||||
mark = SPELL_AB_MARK_WINNER;
|
||||
else
|
||||
mark = SPELL_AB_MARK_LOSER;
|
||||
|
|
@ -804,9 +801,9 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
|||
return;
|
||||
}
|
||||
|
||||
if(IsSpell)
|
||||
if (IsSpell)
|
||||
plr->CastSpell(plr, mark, true);
|
||||
else if ( objmgr.GetItemPrototype( mark ) )
|
||||
else if (objmgr.GetItemPrototype( mark ) )
|
||||
{
|
||||
ItemPosCountVec dest;
|
||||
uint32 no_space_count = 0;
|
||||
|
|
@ -815,10 +812,10 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
|||
count -= no_space_count;
|
||||
|
||||
if( count != 0 && !dest.empty()) // can add some
|
||||
if(Item* item = plr->StoreNewItem( dest, mark, true, 0))
|
||||
if (Item* item = plr->StoreNewItem( dest, mark, true, 0))
|
||||
plr->SendNewItem(item,count,false,true);
|
||||
|
||||
if(no_space_count > 0)
|
||||
if (no_space_count > 0)
|
||||
SendRewardMarkByMail(plr,mark,no_space_count);
|
||||
}
|
||||
}
|
||||
|
|
@ -826,14 +823,14 @@ void BattleGround::RewardMark(Player *plr,uint32 count)
|
|||
void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
||||
{
|
||||
uint32 bmEntry = GetBattlemasterEntry();
|
||||
if(!bmEntry)
|
||||
if (!bmEntry)
|
||||
return;
|
||||
|
||||
ItemPrototype const* markProto = objmgr.GetItemPrototype(mark);
|
||||
if(!markProto)
|
||||
if (!markProto)
|
||||
return;
|
||||
|
||||
if(Item* markItem = Item::CreateItem(mark,count,plr))
|
||||
if (Item* markItem = Item::CreateItem(mark,count,plr))
|
||||
{
|
||||
// save new item before send
|
||||
markItem->SaveToDB(); // save for prevent lost at next mail load, if send fail then item will deleted
|
||||
|
|
@ -845,8 +842,8 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
|||
// subject: item name
|
||||
std::string subject = markProto->Name1;
|
||||
int loc_idx = plr->GetSession()->GetSessionDbLocaleIndex();
|
||||
if ( loc_idx >= 0 )
|
||||
if(ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId))
|
||||
if (loc_idx >= 0 )
|
||||
if (ItemLocale const *il = objmgr.GetItemLocale(markProto->ItemId))
|
||||
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
|
||||
subject = il->Name[loc_idx];
|
||||
|
||||
|
|
@ -863,7 +860,7 @@ void BattleGround::SendRewardMarkByMail(Player *plr,uint32 mark, uint32 count)
|
|||
void BattleGround::RewardQuest(Player *plr)
|
||||
{
|
||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||
if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
if (plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE))
|
||||
return;
|
||||
|
||||
uint32 quest;
|
||||
|
|
@ -899,7 +896,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
bool participant = false;
|
||||
// Remove from lists/maps
|
||||
BattleGroundPlayerMap::iterator itr = m_Players.find(guid);
|
||||
if(itr != m_Players.end())
|
||||
if (itr != m_Players.end())
|
||||
{
|
||||
UpdatePlayersCountByTeam(team, true); // -1 player
|
||||
m_Players.erase(itr);
|
||||
|
|
@ -908,7 +905,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
}
|
||||
|
||||
std::map<uint64, BattleGroundScore*>::iterator itr2 = m_PlayerScores.find(guid);
|
||||
if(itr2 != m_PlayerScores.end())
|
||||
if (itr2 != m_PlayerScores.end())
|
||||
{
|
||||
delete itr2->second; // delete player's score
|
||||
m_PlayerScores.erase(itr2);
|
||||
|
|
@ -919,7 +916,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
Player *plr = objmgr.GetPlayer(guid);
|
||||
|
||||
// should remove spirit of redemption
|
||||
if(plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
if (plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
if(plr && !plr->isAlive()) // resurrect on exit
|
||||
|
|
@ -934,38 +931,38 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
{
|
||||
BattleGroundTypeId bgTypeId = GetTypeID();
|
||||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType());
|
||||
if(plr)
|
||||
if (plr)
|
||||
{
|
||||
plr->ClearAfkReports();
|
||||
|
||||
if(!team) team = plr->GetTeam();
|
||||
|
||||
// if arena, remove the specific arena auras
|
||||
if(isArena())
|
||||
if (isArena())
|
||||
{
|
||||
plr->RemoveArenaAuras(true); // removes debuffs / dots etc., we don't want the player to die after porting out
|
||||
bgTypeId=BATTLEGROUND_AA; // set the bg type to all arenas (it will be used for queue refreshing)
|
||||
|
||||
// summon old pet if there was one and there isn't a current pet
|
||||
if(!plr->GetPet() && plr->GetTemporaryUnsummonedPetNumber())
|
||||
if (!plr->GetPet() && plr->GetTemporaryUnsummonedPetNumber())
|
||||
{
|
||||
Pet* NewPet = new Pet;
|
||||
if(!NewPet->LoadPetFromDB(plr, 0, (plr)->GetTemporaryUnsummonedPetNumber(), true))
|
||||
if (!NewPet->LoadPetFromDB(plr, 0, (plr)->GetTemporaryUnsummonedPetNumber(), true))
|
||||
delete NewPet;
|
||||
|
||||
(plr)->SetTemporaryUnsummonedPetNumber(0);
|
||||
}
|
||||
|
||||
if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
//left a rated match while the encounter was in progress, consider as loser
|
||||
ArenaTeam * winner_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam * loser_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if(winner_arena_team && loser_arena_team)
|
||||
if (winner_arena_team && loser_arena_team)
|
||||
loser_arena_team->MemberLost(plr,winner_arena_team->GetRating());
|
||||
}
|
||||
}
|
||||
if(SendPacket)
|
||||
if (SendPacket)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, this, plr->GetBattleGroundQueueIndex(bgQueueTypeId), STATUS_NONE, 0, 0, 0);
|
||||
|
|
@ -978,18 +975,18 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
else
|
||||
// removing offline participant
|
||||
{
|
||||
if(isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (isRated() && GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
//left a rated match while the encounter was in progress, consider as loser
|
||||
ArenaTeam * others_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team)));
|
||||
ArenaTeam * players_arena_team = objmgr.GetArenaTeamById(GetArenaTeamIdForTeam(team));
|
||||
if( others_arena_team && players_arena_team )
|
||||
if (others_arena_team && players_arena_team)
|
||||
players_arena_team->OfflineMemberLost(guid, others_arena_team->GetRating());
|
||||
}
|
||||
}
|
||||
|
||||
// remove from raid group if player is member
|
||||
if(Group *group = GetBgRaid(team))
|
||||
if (Group *group = GetBgRaid(team))
|
||||
{
|
||||
if( !group->RemoveMember(guid, 0) ) // group was disbanded
|
||||
{
|
||||
|
|
@ -999,7 +996,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
}
|
||||
DecreaseInvitedCount(team);
|
||||
//we should update battleground queue, but only if bg isn't ending
|
||||
if( isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE )
|
||||
if (isBattleGround() && GetStatus() < STATUS_WAIT_LEAVE)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId());
|
||||
// Let others know
|
||||
WorldPacket data;
|
||||
|
|
@ -1007,20 +1004,20 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
|
|||
SendPacketToTeam(team, &data, plr, false);
|
||||
}
|
||||
|
||||
if( plr )
|
||||
if (plr)
|
||||
{
|
||||
// Do next only if found in battleground
|
||||
plr->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE); // We're not in BG.
|
||||
// reset destination bg team
|
||||
plr->SetBGTeam(0);
|
||||
|
||||
if(Transport)
|
||||
if (Transport)
|
||||
plr->TeleportTo(plr->GetBattleGroundEntryPoint());
|
||||
|
||||
sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName());
|
||||
}
|
||||
|
||||
if(!GetPlayersSize() && !GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
|
||||
if (!GetPlayersSize() && !GetInvitedCount(HORDE) && !GetInvitedCount(ALLIANCE))
|
||||
{
|
||||
// if no players left AND no invitees left, set this bg to delete in next update
|
||||
// direct deletion could cause crashes
|
||||
|
|
@ -1087,21 +1084,21 @@ void BattleGround::AddPlayer(Player *plr)
|
|||
SendPacketToTeam(team, &data, plr, false);
|
||||
|
||||
// add arena specific auras
|
||||
if(isArena())
|
||||
if (isArena())
|
||||
{
|
||||
plr->RemoveArenaSpellCooldowns();
|
||||
plr->RemoveArenaAuras();
|
||||
plr->RemoveAllEnchantments(TEMP_ENCHANTMENT_SLOT);
|
||||
if(team == ALLIANCE) // gold
|
||||
{
|
||||
if(plr->GetTeam() == HORDE)
|
||||
if (plr->GetTeam() == HORDE)
|
||||
plr->CastSpell(plr, SPELL_HORDE_GOLD_FLAG,true);
|
||||
else
|
||||
plr->CastSpell(plr, SPELL_ALLIANCE_GOLD_FLAG,true);
|
||||
}
|
||||
else // green
|
||||
{
|
||||
if(plr->GetTeam() == HORDE)
|
||||
if (plr->GetTeam() == HORDE)
|
||||
plr->CastSpell(plr, SPELL_HORDE_GREEN_FLAG,true);
|
||||
else
|
||||
plr->CastSpell(plr, SPELL_ALLIANCE_GREEN_FLAG,true);
|
||||
|
|
@ -1110,9 +1107,9 @@ void BattleGround::AddPlayer(Player *plr)
|
|||
plr->DestroyConjuredItems(true);
|
||||
|
||||
Pet* pet = plr->GetPet();
|
||||
if(pet)
|
||||
if (pet)
|
||||
{
|
||||
if(pet->getPetType() == SUMMON_PET || pet->getPetType() == HUNTER_PET)
|
||||
if (pet->getPetType() == SUMMON_PET || pet->getPetType() == HUNTER_PET)
|
||||
{
|
||||
(plr)->SetTemporaryUnsummonedPetNumber(pet->GetCharmInfo()->GetPetNumber());
|
||||
(plr)->SetOldPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL));
|
||||
|
|
@ -1156,7 +1153,7 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
|
|||
}
|
||||
else // raid already exist
|
||||
{
|
||||
if(group->IsMember(plr_guid))
|
||||
if (group->IsMember(plr_guid))
|
||||
{
|
||||
uint8 subgroup = group->GetMemberGroup(plr_guid);
|
||||
plr->SetBattleGroundRaid(group, subgroup);
|
||||
|
|
@ -1164,8 +1161,8 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
|
|||
else
|
||||
{
|
||||
group->AddMember(plr_guid, plr->GetName());
|
||||
if( Group* originalGroup = plr->GetOriginalGroup() )
|
||||
if( originalGroup->IsLeader(plr_guid) )
|
||||
if (Group* originalGroup = plr->GetOriginalGroup())
|
||||
if (originalGroup->IsLeader(plr_guid))
|
||||
group->ChangeLeader(plr_guid);
|
||||
}
|
||||
}
|
||||
|
|
@ -1177,7 +1174,7 @@ void BattleGround::EventPlayerLoggedIn(Player* player, uint64 plr_guid)
|
|||
// player is correct pointer
|
||||
for(std::deque<uint64>::iterator itr = m_OfflineQueue.begin(); itr != m_OfflineQueue.end(); ++itr)
|
||||
{
|
||||
if( *itr == plr_guid )
|
||||
if (*itr == plr_guid)
|
||||
{
|
||||
m_OfflineQueue.erase(itr);
|
||||
break;
|
||||
|
|
@ -1195,14 +1192,14 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
|
|||
// player is correct pointer, it is checked in WorldSession::LogoutPlayer()
|
||||
m_OfflineQueue.push_back(player->GetGUID());
|
||||
m_Players[player->GetGUID()].OfflineRemoveTime = sWorld.GetGameTime() + MAX_OFFLINE_TIME;
|
||||
if( GetStatus() == STATUS_IN_PROGRESS )
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
if( isBattleGround() )
|
||||
if (isBattleGround())
|
||||
EventPlayerDroppedFlag(player);
|
||||
else
|
||||
{
|
||||
//1 player is logging out, if it is the last, then end arena!
|
||||
if( GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())) )
|
||||
if (GetAlivePlayersCountByTeam(player->GetTeam()) <= 1 && GetPlayersCountByTeam(GetOtherTeam(player->GetTeam())))
|
||||
EndBattleGround(GetOtherTeam(player->GetTeam()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1212,7 +1209,7 @@ void BattleGround::EventPlayerLoggedOut(Player* player)
|
|||
void BattleGround::AddToBGFreeSlotQueue()
|
||||
{
|
||||
// make sure to add only once
|
||||
if(!m_InBGFreeSlotQueue && isBattleGround())
|
||||
if (!m_InBGFreeSlotQueue && isBattleGround())
|
||||
{
|
||||
sBattleGroundMgr.BGFreeSlotQueue[m_TypeID].push_front(this);
|
||||
m_InBGFreeSlotQueue = true;
|
||||
|
|
@ -1272,10 +1269,10 @@ void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
|
|||
break;
|
||||
case SCORE_BONUS_HONOR: // Honor bonus
|
||||
// do not add honor in arenas
|
||||
if(isBattleGround())
|
||||
if (isBattleGround())
|
||||
{
|
||||
// reward honor instantly
|
||||
if(Source->RewardHonor(NULL, 1, value))
|
||||
if (Source->RewardHonor(NULL, 1, value))
|
||||
itr->second->BonusHonor += value;
|
||||
}
|
||||
break;
|
||||
|
|
@ -1297,12 +1294,12 @@ void BattleGround::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
|
|||
m_ReviveQueue[npc_guid].push_back(player_guid);
|
||||
|
||||
Player *plr = objmgr.GetPlayer(player_guid);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
plr->CastSpell(plr, SPELL_WAITING_FOR_RESURRECT, true);
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry( SPELL_WAITING_FOR_RESURRECT );
|
||||
if(spellInfo)
|
||||
if (spellInfo)
|
||||
{
|
||||
Aura *Aur = CreateAura(spellInfo, 0, NULL, plr);
|
||||
plr->AddAura(Aur);
|
||||
|
|
@ -1315,12 +1312,12 @@ void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid)
|
|||
{
|
||||
for(std::vector<uint64>::iterator itr2 =(itr->second).begin(); itr2 != (itr->second).end(); ++itr2)
|
||||
{
|
||||
if(*itr2 == player_guid)
|
||||
if (*itr2 == player_guid)
|
||||
{
|
||||
(itr->second).erase(itr2);
|
||||
|
||||
Player *plr = objmgr.GetPlayer(player_guid);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
return;
|
||||
|
||||
plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
|
||||
|
|
@ -1334,7 +1331,7 @@ void BattleGround::RemovePlayerFromResurrectQueue(uint64 player_guid)
|
|||
bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return false;
|
||||
|
||||
// must be created this way, adding to godatamap would add it to the base map of the instance
|
||||
|
|
@ -1382,10 +1379,10 @@ bool BattleGround::AddObject(uint32 type, uint32 entry, float x, float y, float
|
|||
void BattleGround::DoorClose(uint32 type)
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
//if doors are open, close it
|
||||
if( obj->getLootState() == GO_ACTIVATED && !obj->GetGoState() )
|
||||
if (obj->getLootState() == GO_ACTIVATED && !obj->GetGoState())
|
||||
{
|
||||
//change state to allow door to be closed
|
||||
obj->SetLootState(GO_READY);
|
||||
|
|
@ -1401,7 +1398,7 @@ void BattleGround::DoorClose(uint32 type)
|
|||
void BattleGround::DoorOpen(uint32 type)
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
//change state to be sure they will be opened
|
||||
obj->SetLootState(GO_READY);
|
||||
|
|
@ -1416,15 +1413,15 @@ void BattleGround::DoorOpen(uint32 type)
|
|||
void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return;
|
||||
if( respawntime == 0 )
|
||||
if (respawntime == 0)
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
//we need to change state from GO_JUST_DEACTIVATED to GO_READY in case battleground is starting again
|
||||
if( obj->getLootState() == GO_JUST_DEACTIVATED )
|
||||
if (obj->getLootState() == GO_JUST_DEACTIVATED)
|
||||
obj->SetLootState(GO_READY);
|
||||
obj->SetRespawnTime(0);
|
||||
map->Add(obj);
|
||||
|
|
@ -1433,7 +1430,7 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
|
|||
else
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
map->Add(obj);
|
||||
obj->SetRespawnTime(respawntime);
|
||||
|
|
@ -1445,7 +1442,7 @@ void BattleGround::SpawnBGObject(uint32 type, uint32 respawntime)
|
|||
Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, float x, float y, float z, float o, uint32 respawntime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceID());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return NULL;
|
||||
|
||||
Creature* pCreature = new Creature;
|
||||
|
|
@ -1458,7 +1455,7 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
|
|||
|
||||
pCreature->Relocate(x, y, z, o);
|
||||
|
||||
if(!pCreature->IsPositionValid())
|
||||
if (!pCreature->IsPositionValid())
|
||||
{
|
||||
sLog.outError("Creature (guidlow %d, entry %d) not added to battleground. Suggested coordinates isn't valid (X: %f Y: %f)",pCreature->GetGUIDLow(),pCreature->GetEntry(),pCreature->GetPositionX(),pCreature->GetPositionY());
|
||||
return NULL;
|
||||
|
|
@ -1477,13 +1474,13 @@ Creature* BattleGround::AddCreature(uint32 entry, uint32 type, uint32 teamval, f
|
|||
void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
|
||||
{
|
||||
Map * map = MapManager::Instance().FindMap(GetMapId(),GetInstanceId());
|
||||
if(!map)
|
||||
if (!map)
|
||||
return false;
|
||||
|
||||
if(respawntime == 0)
|
||||
if (respawntime == 0)
|
||||
{
|
||||
Creature *obj = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
//obj->Respawn(); // bugged
|
||||
obj->SetRespawnTime(0);
|
||||
|
|
@ -1494,7 +1491,7 @@ void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
|
|||
else
|
||||
{
|
||||
Creature *obj = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
obj->setDeathState(DEAD);
|
||||
obj->SetRespawnTime(respawntime);
|
||||
|
|
@ -1505,11 +1502,11 @@ void BattleGround::SpawnBGCreature(uint32 type, uint32 respawntime)
|
|||
*/
|
||||
bool BattleGround::DelCreature(uint32 type)
|
||||
{
|
||||
if(!m_BgCreatures[type])
|
||||
if (!m_BgCreatures[type])
|
||||
return true;
|
||||
|
||||
Creature *cr = HashMapHolder<Creature>::Find(m_BgCreatures[type]);
|
||||
if(!cr)
|
||||
if (!cr)
|
||||
{
|
||||
sLog.outError("Can't find creature guid: %u",GUID_LOPART(m_BgCreatures[type]));
|
||||
return false;
|
||||
|
|
@ -1522,11 +1519,11 @@ bool BattleGround::DelCreature(uint32 type)
|
|||
|
||||
bool BattleGround::DelObject(uint32 type)
|
||||
{
|
||||
if(!m_BgObjects[type])
|
||||
if (!m_BgObjects[type])
|
||||
return true;
|
||||
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]);
|
||||
if(!obj)
|
||||
if (!obj)
|
||||
{
|
||||
sLog.outError("Can't find gobject guid: %u",GUID_LOPART(m_BgObjects[type]));
|
||||
return false;
|
||||
|
|
@ -1541,13 +1538,13 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float
|
|||
{
|
||||
uint32 entry = 0;
|
||||
|
||||
if(team == ALLIANCE)
|
||||
if (team == ALLIANCE)
|
||||
entry = 13116;
|
||||
else
|
||||
entry = 13117;
|
||||
|
||||
Creature* pCreature = AddCreature(entry,type,team,x,y,z,o);
|
||||
if(!pCreature)
|
||||
if (!pCreature)
|
||||
{
|
||||
sLog.outError("Can't create Spirit guide. BattleGround not created!");
|
||||
EndNow();
|
||||
|
|
@ -1603,8 +1600,6 @@ void BattleGround::EndNow()
|
|||
RemoveFromBGFreeSlotQueue();
|
||||
SetStatus(STATUS_WAIT_LEAVE);
|
||||
SetEndTime(0);
|
||||
// inform invited players about the removal
|
||||
sBattleGroundMgr.m_BattleGroundQueues[BattleGroundMgr::BGQueueTypeId(GetTypeID(), GetArenaType())].BGEndedRemoveInvites(this);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -1615,7 +1610,7 @@ buffs are in their positions when battleground starts
|
|||
void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
|
||||
{
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(go_guid);
|
||||
if(!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
|
||||
if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned())
|
||||
return;
|
||||
|
||||
//change buff type, when buff is used:
|
||||
|
|
@ -1631,13 +1626,13 @@ void BattleGround::HandleTriggerBuff(uint64 const& go_guid)
|
|||
//randomly select new buff
|
||||
uint8 buff = urand(0, 2);
|
||||
uint32 entry = obj->GetEntry();
|
||||
if( m_BuffChange && entry != Buff_Entries[buff] )
|
||||
if (m_BuffChange && entry != Buff_Entries[buff])
|
||||
{
|
||||
//despawn current buff
|
||||
SpawnBGObject(index, RESPAWN_ONE_DAY);
|
||||
//set index for new one
|
||||
for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex)
|
||||
if( entry == Buff_Entries[currBuffTypeIndex] )
|
||||
if (entry == Buff_Entries[currBuffTypeIndex])
|
||||
{
|
||||
index -= currBuffTypeIndex;
|
||||
index += buff;
|
||||
|
|
@ -1655,7 +1650,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
|||
UpdatePlayerScore(player, SCORE_DEATHS, 1);
|
||||
|
||||
// add +1 kills to group and +1 killing_blows to killer
|
||||
if( killer )
|
||||
if (killer)
|
||||
{
|
||||
UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1);
|
||||
UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1);
|
||||
|
|
@ -1664,16 +1659,16 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
|||
{
|
||||
Player *plr = objmgr.GetPlayer(itr->first);
|
||||
|
||||
if(!plr || plr == killer)
|
||||
if (!plr || plr == killer)
|
||||
continue;
|
||||
|
||||
if( plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player) )
|
||||
if (plr->GetTeam() == killer->GetTeam() && plr->IsAtGroupRewardDistance(player))
|
||||
UpdatePlayerScore(plr, SCORE_HONORABLE_KILLS, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// to be able to remove insignia -- ONLY IN BattleGrounds
|
||||
if( !isArena() )
|
||||
if (!isArena())
|
||||
player->SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE );
|
||||
}
|
||||
|
||||
|
|
@ -1682,7 +1677,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer )
|
|||
uint32 BattleGround::GetPlayerTeam(uint64 guid)
|
||||
{
|
||||
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
||||
if(itr!=m_Players.end())
|
||||
if (itr!=m_Players.end())
|
||||
return itr->second.Team;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1695,14 +1690,14 @@ uint32 BattleGround::GetOtherTeam(uint32 teamId)
|
|||
bool BattleGround::IsPlayerInBattleGround(uint64 guid)
|
||||
{
|
||||
BattleGroundPlayerMap::const_iterator itr = m_Players.find(guid);
|
||||
if(itr != m_Players.end())
|
||||
if (itr != m_Players.end())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void BattleGround::PlayerAddedToBGCheckIfBGIsRunning(Player* plr)
|
||||
{
|
||||
if(GetStatus() != STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() != STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
|
|
@ -1722,10 +1717,10 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
|
|||
int count = 0;
|
||||
for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
if(itr->second.Team == Team)
|
||||
if (itr->second.Team == Team)
|
||||
{
|
||||
Player * pl = objmgr.GetPlayer(itr->first);
|
||||
if(pl && pl->isAlive())
|
||||
if (pl && pl->isAlive())
|
||||
++count;
|
||||
}
|
||||
}
|
||||
|
|
@ -1734,9 +1729,9 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
|
|||
|
||||
void BattleGround::CheckArenaWinConditions()
|
||||
{
|
||||
if( !GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE) )
|
||||
if (!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
||||
EndBattleGround(HORDE);
|
||||
else if( GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE) )
|
||||
else if (GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
|
||||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ class BattleGround
|
|||
void IncreaseInvitedCount(uint32 team) { (team == ALLIANCE) ? ++m_InvitedAlliance : ++m_InvitedHorde; }
|
||||
uint32 GetInvitedCount(uint32 team) const
|
||||
{
|
||||
if( team == ALLIANCE )
|
||||
if (team == ALLIANCE)
|
||||
return m_InvitedAlliance;
|
||||
else
|
||||
return m_InvitedHorde;
|
||||
|
|
@ -434,7 +434,7 @@ class BattleGround
|
|||
uint32 GetAlivePlayersCountByTeam(uint32 Team) const; // used in arenas to correctly handle death in spirit of redemption / last stand etc. (killer = killed) cases
|
||||
void UpdatePlayersCountByTeam(uint32 Team, bool remove)
|
||||
{
|
||||
if(remove)
|
||||
if (remove)
|
||||
--m_PlayersCount[GetTeamIndexByTeamId(Team)];
|
||||
else
|
||||
++m_PlayersCount[GetTeamIndexByTeamId(Team)];
|
||||
|
|
|
|||
|
|
@ -46,16 +46,16 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if( GetStatus() == STATUS_IN_PROGRESS )
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
|
||||
|
||||
for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
{
|
||||
// 3 sec delay to spawn new banner instead previous despawned one
|
||||
if( m_BannerTimers[node].timer )
|
||||
if (m_BannerTimers[node].timer)
|
||||
{
|
||||
if( m_BannerTimers[node].timer > diff )
|
||||
if (m_BannerTimers[node].timer > diff)
|
||||
m_BannerTimers[node].timer -= diff;
|
||||
else
|
||||
{
|
||||
|
|
@ -65,9 +65,9 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
}
|
||||
|
||||
// 1-minute to occupy a node from contested state
|
||||
if( m_NodeTimers[node] )
|
||||
if (m_NodeTimers[node])
|
||||
{
|
||||
if( m_NodeTimers[node] > diff )
|
||||
if (m_NodeTimers[node] > diff)
|
||||
m_NodeTimers[node] -= diff;
|
||||
else
|
||||
{
|
||||
|
|
@ -84,7 +84,7 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
|
||||
// Message to chatlog
|
||||
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_AB_ALLY,_GetNodeNameId(node));
|
||||
|
|
@ -100,7 +100,7 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
}
|
||||
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
if( m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED )
|
||||
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
|
||||
++team_points[team];
|
||||
}
|
||||
|
||||
|
|
@ -108,28 +108,28 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
{
|
||||
int points = team_points[team];
|
||||
if( !points )
|
||||
if (!points)
|
||||
continue;
|
||||
m_lastTick[team] += diff;
|
||||
if( m_lastTick[team] > BG_AB_TickIntervals[points] )
|
||||
if (m_lastTick[team] > BG_AB_TickIntervals[points])
|
||||
{
|
||||
m_lastTick[team] -= BG_AB_TickIntervals[points];
|
||||
m_TeamScores[team] += BG_AB_TickPoints[points];
|
||||
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
|
||||
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
|
||||
if( m_ReputationScoreTics[team] >= m_ReputationTics )
|
||||
if (m_ReputationScoreTics[team] >= m_ReputationTics)
|
||||
{
|
||||
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
|
||||
m_ReputationScoreTics[team] -= m_ReputationTics;
|
||||
}
|
||||
if( m_HonorScoreTics[team] >= m_HonorTics )
|
||||
if (m_HonorScoreTics[team] >= m_HonorTics)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
|
||||
m_HonorScoreTics[team] -= m_HonorTics;
|
||||
}
|
||||
if( !m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE )
|
||||
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if( team == BG_TEAM_ALLIANCE )
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
|
|
@ -137,19 +137,19 @@ void BattleGroundAB::Update(uint32 diff)
|
|||
m_IsInformedNearVictory = true;
|
||||
}
|
||||
|
||||
if( m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE )
|
||||
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
|
||||
if( team == BG_TEAM_ALLIANCE )
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
|
||||
if( team == BG_TEAM_HORDE )
|
||||
if (team == BG_TEAM_HORDE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
|
||||
}
|
||||
}
|
||||
|
||||
// Test win condition
|
||||
if( m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE )
|
||||
if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleGround(ALLIANCE);
|
||||
if( m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE )
|
||||
if (m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleGround(HORDE);
|
||||
}
|
||||
}
|
||||
|
|
@ -204,19 +204,19 @@ void BattleGroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
|
|||
|
||||
void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if( GetStatus() != STATUS_IN_PROGRESS )
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
switch(Trigger)
|
||||
{
|
||||
case 3948: // Arathi Basin Alliance Exit.
|
||||
if( Source->GetTeam() != ALLIANCE )
|
||||
if (Source->GetTeam() != ALLIANCE)
|
||||
Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
|
||||
else
|
||||
Source->LeaveBattleground();
|
||||
break;
|
||||
case 3949: // Arathi Basin Horde Exit.
|
||||
if( Source->GetTeam() != HORDE )
|
||||
if (Source->GetTeam() != HORDE)
|
||||
Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
|
||||
else
|
||||
Source->LeaveBattleground();
|
||||
|
|
@ -241,7 +241,7 @@ void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
|
||||
{
|
||||
// Just put it into the queue
|
||||
if( delay )
|
||||
if (delay)
|
||||
{
|
||||
m_BannerTimers[node].timer = 2000;
|
||||
m_BannerTimers[node].type = type;
|
||||
|
|
@ -254,7 +254,7 @@ void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool
|
|||
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
|
||||
|
||||
// handle aura with banner
|
||||
if( !type )
|
||||
if (!type)
|
||||
return;
|
||||
obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
|
||||
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
|
||||
|
|
@ -266,7 +266,7 @@ void BattleGroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex)
|
|||
SpawnBGObject(obj, RESPAWN_ONE_DAY);
|
||||
|
||||
// handle aura with banner
|
||||
if( !type )
|
||||
if (!type)
|
||||
return;
|
||||
obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
|
||||
SpawnBGObject(obj, RESPAWN_ONE_DAY);
|
||||
|
|
@ -303,9 +303,9 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data)
|
|||
// How many bases each team owns
|
||||
uint8 ally = 0, horde = 0;
|
||||
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
if( m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED )
|
||||
if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||
++ally;
|
||||
else if( m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED )
|
||||
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||
++horde;
|
||||
|
||||
data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(ally);
|
||||
|
|
@ -326,7 +326,7 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
|||
// Send node owner state update to refresh map icons on client
|
||||
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
||||
|
||||
if( m_prevNodes[node] )
|
||||
if (m_prevNodes[node])
|
||||
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0);
|
||||
else
|
||||
UpdateWorldState(BG_AB_OP_NODEICONS[node], 0);
|
||||
|
|
@ -336,9 +336,9 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
|||
// How many bases each team owns
|
||||
uint8 ally = 0, horde = 0;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if( m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED )
|
||||
if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||
++ally;
|
||||
else if( m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED )
|
||||
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||
++horde;
|
||||
|
||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
||||
|
|
@ -347,30 +347,30 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
|||
|
||||
void BattleGroundAB::_NodeOccupied(uint8 node,Team team)
|
||||
{
|
||||
if( !AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team) )
|
||||
if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team))
|
||||
sLog.outError("Failed to spawn spirit guide! point: %u, team: %u,", node, team);
|
||||
// SpawnBGCreature(node,RESPAWN_IMMEDIATELY);
|
||||
|
||||
uint8 capturedNodes = 0;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if( m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
||||
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
||||
++capturedNodes;
|
||||
}
|
||||
if(capturedNodes >= 5)
|
||||
if (capturedNodes >= 5)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
|
||||
if(capturedNodes >= 4)
|
||||
if (capturedNodes >= 4)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
|
||||
}
|
||||
|
||||
void BattleGroundAB::_NodeDeOccupied(uint8 node)
|
||||
{
|
||||
if( node >= BG_AB_DYNAMIC_NODES_COUNT)
|
||||
if (node >= BG_AB_DYNAMIC_NODES_COUNT)
|
||||
return;
|
||||
|
||||
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
|
||||
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
|
||||
if( !ghost_list.empty() )
|
||||
if (!ghost_list.empty())
|
||||
{
|
||||
WorldSafeLocsEntry const *ClosestGrave = NULL;
|
||||
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
|
||||
|
|
@ -387,7 +387,7 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node)
|
|||
}
|
||||
}
|
||||
|
||||
if( m_BgCreatures[node] )
|
||||
if (m_BgCreatures[node])
|
||||
DelCreature(node);
|
||||
|
||||
// buff object isn't despawned
|
||||
|
|
@ -396,7 +396,7 @@ void BattleGroundAB::_NodeDeOccupied(uint8 node)
|
|||
/* Invoked if a player used a banner as a gameobject */
|
||||
void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/)
|
||||
{
|
||||
if( GetStatus() != STATUS_IN_PROGRESS )
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint8 node = BG_AB_NODE_STABLES;
|
||||
|
|
@ -407,7 +407,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
|||
obj=HashMapHolder<GameObject>::Find(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
|
||||
}
|
||||
|
||||
if( node == BG_AB_DYNAMIC_NODES_COUNT)
|
||||
if (node == BG_AB_DYNAMIC_NODES_COUNT)
|
||||
{
|
||||
// this means our player isn't close to any of banners - maybe cheater ??
|
||||
return;
|
||||
|
|
@ -416,13 +416,13 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
|||
uint8 teamIndex = GetTeamIndexByTeamId(source->GetTeam());
|
||||
|
||||
// Check if player really could use this banner, not cheated
|
||||
if( !(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2) )
|
||||
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
|
||||
return;
|
||||
|
||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
uint32 sound = 0;
|
||||
// If node is neutral, change to contested
|
||||
if( m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL )
|
||||
if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL)
|
||||
{
|
||||
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
|
|
@ -435,7 +435,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
|||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: team and node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY);
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE);
|
||||
|
|
@ -443,10 +443,10 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
|||
sound = BG_AB_SOUND_NODE_CLAIMED;
|
||||
}
|
||||
// If node is contested
|
||||
else if( (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED) )
|
||||
else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED))
|
||||
{
|
||||
// If last state is NOT occupied, change node to enemy-contested
|
||||
if( m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED )
|
||||
if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{
|
||||
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
|
|
@ -459,7 +459,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
|||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
|
|
@ -479,7 +479,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
|||
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
|
||||
|
||||
// FIXME: node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
|
|
@ -501,7 +501,7 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
|||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
|
|
@ -510,10 +510,10 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*targ
|
|||
}
|
||||
|
||||
// If node is occupied again, send "X has taken the Y" msg.
|
||||
if( m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED )
|
||||
if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
if(teamIndex == 0)
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node));
|
||||
|
|
@ -525,7 +525,7 @@ bool BattleGroundAB::SetupBattleGround()
|
|||
{
|
||||
for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if( !AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i,BG_AB_OBJECTID_BANNER_CONT_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i,BG_AB_OBJECTID_BANNER_CONT_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i,BG_AB_OBJECTID_BANNER_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|
|
@ -539,7 +539,7 @@ bool BattleGroundAB::SetupBattleGround()
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if( !AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_AB_OBJECT_GATE_H,BG_AB_OBJECTID_GATE_H,BG_AB_DoorPositions[1][0],BG_AB_DoorPositions[1][1],BG_AB_DoorPositions[1][2],BG_AB_DoorPositions[1][3],BG_AB_DoorPositions[1][4],BG_AB_DoorPositions[1][5],BG_AB_DoorPositions[1][6],BG_AB_DoorPositions[1][7],RESPAWN_IMMEDIATELY)
|
||||
)
|
||||
{
|
||||
|
|
@ -549,7 +549,7 @@ bool BattleGroundAB::SetupBattleGround()
|
|||
//buffs
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if( !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
)
|
||||
|
|
@ -586,16 +586,16 @@ void BattleGroundAB::Reset()
|
|||
}
|
||||
|
||||
for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT; ++i)
|
||||
if(m_BgCreatures[i])
|
||||
if (m_BgCreatures[i])
|
||||
DelCreature(i);
|
||||
}
|
||||
|
||||
void BattleGroundAB::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
|
|
@ -611,12 +611,12 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
|||
// Is there any occupied node for this team?
|
||||
std::vector<uint8> nodes;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if( m_Nodes[i] == teamIndex + 3 )
|
||||
if (m_Nodes[i] == teamIndex + 3)
|
||||
nodes.push_back(i);
|
||||
|
||||
WorldSafeLocsEntry const* good_entry = NULL;
|
||||
// If so, select the closest node to place ghost on
|
||||
if( !nodes.empty() )
|
||||
if (!nodes.empty())
|
||||
{
|
||||
float plr_x = player->GetPositionX();
|
||||
float plr_y = player->GetPositionY();
|
||||
|
|
@ -625,10 +625,10 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
|||
for (uint8 i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[nodes[i]] );
|
||||
if( !entry )
|
||||
if (!entry)
|
||||
continue;
|
||||
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
|
||||
if( mindist > dist )
|
||||
if (mindist > dist)
|
||||
{
|
||||
mindist = dist;
|
||||
good_entry = entry;
|
||||
|
|
@ -637,7 +637,7 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
|||
nodes.clear();
|
||||
}
|
||||
// If not, place ghost on starting location
|
||||
if( !good_entry )
|
||||
if (!good_entry)
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry( BG_AB_GraveyardIds[teamIndex+5] );
|
||||
|
||||
return good_entry;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ void BattleGroundAV::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
|
|||
void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 SpellId = 0;
|
||||
|
|
@ -89,7 +89,7 @@ void BattleGroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
break;
|
||||
}
|
||||
|
||||
if(SpellId)
|
||||
if (SpellId)
|
||||
Source->CastSpell(Source, SpellId, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void BattleGroundBE::Update(uint32 diff)
|
|||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
|
|
@ -86,7 +86,7 @@ void BattleGroundBE::AddPlayer(Player *plr)
|
|||
|
||||
void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if(GetStatus() == STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
|
|
@ -97,10 +97,10 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
|||
|
||||
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if(!killer)
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("Killer player not found");
|
||||
return;
|
||||
|
|
@ -123,7 +123,7 @@ bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
|
|||
void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
|
|
@ -142,7 +142,7 @@ void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
break;
|
||||
}
|
||||
|
||||
//if(buff_guid)
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ void BattleGroundBE::Reset()
|
|||
bool BattleGroundBE::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if( !AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_2, BG_BE_OBJECT_TYPE_DOOR_2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_3, BG_BE_OBJECT_TYPE_DOOR_3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_BE_OBJECT_DOOR_4, BG_BE_OBJECT_TYPE_DOOR_4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ void BattleGroundEY::Update(uint32 diff)
|
|||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if( GetStatus() == STATUS_IN_PROGRESS )
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
m_PointAddingTimer -= diff;
|
||||
if(m_PointAddingTimer <= 0)
|
||||
if (m_PointAddingTimer <= 0)
|
||||
{
|
||||
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
|
||||
if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
|
||||
|
|
@ -62,11 +62,11 @@ void BattleGroundEY::Update(uint32 diff)
|
|||
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
|
||||
}
|
||||
|
||||
if(m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsTimer -= diff;
|
||||
|
||||
if(m_FlagsTimer < 0)
|
||||
if (m_FlagsTimer < 0)
|
||||
{
|
||||
m_FlagsTimer = 0;
|
||||
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN)
|
||||
|
|
@ -77,7 +77,7 @@ void BattleGroundEY::Update(uint32 diff)
|
|||
}
|
||||
|
||||
m_TowerCapCheckTimer -= diff;
|
||||
if(m_TowerCapCheckTimer <= 0)
|
||||
if (m_TowerCapCheckTimer <= 0)
|
||||
{
|
||||
//check if player joined point
|
||||
/*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times
|
||||
|
|
@ -141,7 +141,7 @@ void BattleGroundEY::CheckSomeoneJoinedPoint()
|
|||
while (j < m_PlayersNearPoint[EY_POINTS_MAX].size())
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Player " I64FMTD " not found!", m_PlayersNearPoint[EY_POINTS_MAX][j]);
|
||||
++j;
|
||||
|
|
@ -175,7 +175,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
|
|||
for(uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REALVER + i]);
|
||||
if(obj)
|
||||
if (obj)
|
||||
{
|
||||
uint8 j = 0;
|
||||
while (j < m_PlayersNearPoint[i].size())
|
||||
|
|
@ -259,9 +259,9 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
|
|||
{
|
||||
uint32 score = GetTeamScore(Team);
|
||||
//TODO there should be some sound played when one team is near victory!! - and define variables
|
||||
/*if( !m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE )
|
||||
/*if (!m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if( Team == ALLIANCE )
|
||||
if (Team == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
|
|
@ -269,13 +269,13 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
|
|||
m_IsInformedNearVictory = true;
|
||||
}*/
|
||||
|
||||
if( score >= BG_EY_MAX_TEAM_SCORE )
|
||||
if (score >= BG_EY_MAX_TEAM_SCORE)
|
||||
{
|
||||
score = BG_EY_MAX_TEAM_SCORE;
|
||||
EndBattleGround(Team);
|
||||
}
|
||||
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(EY_ALLIANCE_RESOURCES, score);
|
||||
else
|
||||
UpdateWorldState(EY_HORDE_RESOURCES, score);
|
||||
|
|
@ -284,9 +284,9 @@ void BattleGroundEY::UpdateTeamScore(uint32 Team)
|
|||
void BattleGroundEY::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map reward
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
|
|
@ -297,7 +297,7 @@ void BattleGroundEY::EndBattleGround(uint32 winner)
|
|||
|
||||
void BattleGroundEY::UpdatePointsCount(uint32 Team)
|
||||
{
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]);
|
||||
else
|
||||
UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]);
|
||||
|
|
@ -309,14 +309,14 @@ void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
|
|||
if (m_PointState[Point] == EY_POINT_UNDER_CONTROL)
|
||||
{
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateControlIndex, 0);
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 1);
|
||||
else
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 0);
|
||||
else
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 0);
|
||||
|
|
@ -341,14 +341,14 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
|
|||
for (int j = EY_POINTS_MAX; j >= 0; --j)
|
||||
{
|
||||
for(int i = 0; i < m_PlayersNearPoint[j].size(); ++i)
|
||||
if(m_PlayersNearPoint[j][i] == guid)
|
||||
if (m_PlayersNearPoint[j][i] == guid)
|
||||
m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i);
|
||||
}
|
||||
if(IsFlagPickedup())
|
||||
if (IsFlagPickedup())
|
||||
{
|
||||
if(m_FlagKeeper == guid)
|
||||
if (m_FlagKeeper == guid)
|
||||
{
|
||||
if(plr)
|
||||
if (plr)
|
||||
EventPlayerDroppedFlag(plr);
|
||||
else
|
||||
{
|
||||
|
|
@ -361,7 +361,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
|
|||
|
||||
void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if(!Source->isAlive()) //hack code, must be removed later
|
||||
|
|
@ -370,23 +370,23 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
switch(Trigger)
|
||||
{
|
||||
case TR_BLOOD_ELF_POINT:
|
||||
if(m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam())
|
||||
if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_BLOOD_ELF);
|
||||
break;
|
||||
case TR_FEL_REALVER_POINT:
|
||||
if(m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam())
|
||||
if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_FEL_REALVER);
|
||||
break;
|
||||
case TR_MAGE_TOWER_POINT:
|
||||
if(m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam())
|
||||
if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_MAGE_TOWER);
|
||||
break;
|
||||
case TR_DRAENEI_RUINS_POINT:
|
||||
if(m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam())
|
||||
if(m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_DRAENEI_RUINS);
|
||||
break;
|
||||
case 4512:
|
||||
|
|
@ -410,7 +410,7 @@ void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
bool BattleGroundEY::SetupBattleGround()
|
||||
{
|
||||
// doors
|
||||
if( !AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_EY_OBJECT_DOOR_H, BG_OBJECT_H_DOOR_EY_ENTRY, 1803.21f, 1539.49f, 1261.09f, 3.14159f, 0.173648f, 0, 0.984808f, 0, RESPAWN_IMMEDIATELY)
|
||||
// banners (alliance)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY)
|
||||
|
|
@ -472,12 +472,12 @@ bool BattleGroundEY::SetupBattleGround()
|
|||
for (int i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]);
|
||||
if( !at )
|
||||
if (!at)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
|
||||
continue;
|
||||
}
|
||||
if ( !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
)
|
||||
|
|
@ -486,14 +486,14 @@ bool BattleGroundEY::SetupBattleGround()
|
|||
|
||||
WorldSafeLocsEntry const *sg = NULL;
|
||||
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE);
|
||||
if( !sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE) )
|
||||
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE);
|
||||
if( !sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE) )
|
||||
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
|
|
@ -543,7 +543,7 @@ void BattleGroundEY::RespawnFlag(bool send_message)
|
|||
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_IMMEDIATELY);
|
||||
|
||||
if(send_message)
|
||||
if (send_message)
|
||||
{
|
||||
SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound...
|
||||
|
|
@ -557,7 +557,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
|||
RespawnFlag(true);
|
||||
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID());
|
||||
if(obj)
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID()));
|
||||
|
|
@ -567,7 +567,7 @@ void BattleGroundEY::RespawnFlagAfterDrop()
|
|||
|
||||
void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
BattleGround::HandleKillPlayer(player, killer);
|
||||
|
|
@ -576,11 +576,11 @@ void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
|||
|
||||
void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player, neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if(IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID())
|
||||
if (IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
|
|
@ -588,10 +588,10 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
|||
return;
|
||||
}
|
||||
|
||||
if(!IsFlagPickedup())
|
||||
if (!IsFlagPickedup())
|
||||
return;
|
||||
|
||||
if(GetFlagPickerGUID() != Source->GetGUID())
|
||||
if (GetFlagPickerGUID() != Source->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
|
|
@ -604,7 +604,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
|||
UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
|
||||
|
|
@ -612,10 +612,10 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
|||
|
||||
void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
|
||||
return;
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_PLAYER);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE);
|
||||
|
|
@ -636,7 +636,7 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||
Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true);
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName());
|
||||
else
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName());
|
||||
|
|
@ -644,13 +644,13 @@ void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||
|
||||
void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//Natural point
|
||||
uint32 Team = m_PointOwnedByTeam[Point];
|
||||
|
||||
if(!Team)
|
||||
if (!Team)
|
||||
return;
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
|
|
@ -688,7 +688,7 @@ void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
|
|||
|
||||
void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 Team = Source->GetTeam();
|
||||
|
|
@ -722,12 +722,12 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
|||
else
|
||||
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
|
||||
if(m_BgCreatures[Point])
|
||||
if (m_BgCreatures[Point])
|
||||
DelCreature(Point);
|
||||
|
||||
WorldSafeLocsEntry const *sg = NULL;
|
||||
sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId);
|
||||
if(!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
|
||||
if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
|
||||
sLog.outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
|
||||
Point, Team, m_CapturingPointTypes[Point].GraveYardId);
|
||||
|
||||
|
|
@ -739,7 +739,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
|||
|
||||
void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID())
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
|
|
@ -748,7 +748,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
|
|||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
else
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
|
||||
|
|
@ -759,7 +759,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
|
|||
m_FlagCapturedBgObjectType = BgObjectType;
|
||||
|
||||
uint8 team_id = 0;
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
team_id = BG_TEAM_ALLIANCE;
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
|
|
@ -770,7 +770,7 @@ void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType
|
|||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
}
|
||||
|
||||
if(m_TeamPointsCount[team_id] > 0)
|
||||
if (m_TeamPointsCount[team_id] > 0)
|
||||
AddPoints(Source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]);
|
||||
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
|
||||
|
|
@ -862,7 +862,7 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
|||
entry = sWorldSafeLocsStore.LookupEntry(g_id);
|
||||
nearestEntry = entry;
|
||||
|
||||
if(!entry)
|
||||
if (!entry)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Not found the main team graveyard. Graveyard system isn't working!");
|
||||
return NULL;
|
||||
|
|
@ -878,15 +878,15 @@ WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
|||
|
||||
for(uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
if(m_PointOwnedByTeam[i]==player->GetTeam() && m_PointState[i]==EY_POINT_UNDER_CONTROL)
|
||||
if (m_PointOwnedByTeam[i]==player->GetTeam() && m_PointState[i]==EY_POINT_UNDER_CONTROL)
|
||||
{
|
||||
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
|
||||
if(!entry)
|
||||
if (!entry)
|
||||
sLog.outError("BattleGroundEY: Not found graveyard: %u",m_CapturingPointTypes[i].GraveYardId);
|
||||
else
|
||||
{
|
||||
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
|
||||
if(distance < nearestDistance)
|
||||
if (distance < nearestDistance)
|
||||
{
|
||||
nearestDistance = distance;
|
||||
nearestEntry = entry;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
|||
sLog.outDebug( "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from: " I64FMT, guid);
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battlemaster
|
||||
|
|
@ -52,7 +52,7 @@ void WorldSession::HandleBattleGroundHelloOpcode( WorldPacket & recv_data )
|
|||
|
||||
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(unit->GetEntry());
|
||||
|
||||
if(!_player->GetBGAccessByLevel(bgTypeId))
|
||||
if (!_player->GetBGAccessByLevel(bgTypeId))
|
||||
{
|
||||
// temp, must be gossip message...
|
||||
SendNotification(LANG_YOUR_BG_LEVEL_REQ_ERROR);
|
||||
|
|
@ -85,7 +85,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
recv_data >> instanceId; // instance id, 0 if First Available selected
|
||||
recv_data >> joinAsGroup; // join as group
|
||||
|
||||
if(!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype (%u) received. possible cheater? player guid %u",bgTypeId_,_player->GetGUIDLow());
|
||||
return;
|
||||
|
|
@ -99,25 +99,25 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, 0);
|
||||
|
||||
// ignore if player is already in BG
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
// get bg instance or bg template if instance not found
|
||||
BattleGround * bg = NULL;
|
||||
if(instanceId)
|
||||
if (instanceId)
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundThroughClientInstance(instanceId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
|
||||
if(!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||
if (!bg && !(bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId)))
|
||||
{
|
||||
sLog.outError("Battleground: no available bg / template found");
|
||||
return;
|
||||
}
|
||||
|
||||
// check queueing conditions
|
||||
if(!joinAsGroup)
|
||||
if (!joinAsGroup)
|
||||
{
|
||||
// check Deserter debuff
|
||||
if( !_player->CanJoinToBattleground() )
|
||||
if (!_player->CanJoinToBattleground())
|
||||
{
|
||||
WorldPacket data(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
data << uint32(0xFFFFFFFE);
|
||||
|
|
@ -129,14 +129,14 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
//player is already in this queue
|
||||
return;
|
||||
// check if has free queue slots
|
||||
if(!_player->HasFreeBattleGroundQueueId())
|
||||
if (!_player->HasFreeBattleGroundQueueId())
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
grp = _player->GetGroup();
|
||||
// no group found, error
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
return;
|
||||
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
|
||||
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
|
||||
|
|
@ -151,7 +151,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
// _player->GetGroup() was already checked, grp is already initialized
|
||||
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, 0, false, isPremade, 0);
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(joinAsGroup /* && _player->GetGroup()*/)
|
||||
if (joinAsGroup /* && _player->GetGroup()*/)
|
||||
{
|
||||
sLog.outDebug("Battleground: the following players are joining as group:");
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
|
|
@ -191,7 +191,7 @@ void WorldSession::HandleBattleGroundJoinOpcode( WorldPacket & recv_data )
|
|||
sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName());
|
||||
}
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(!ginfo->IsInvitedToBGInstanceGUID)
|
||||
if (!ginfo->IsInvitedToBGInstanceGUID)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true);
|
||||
}
|
||||
|
||||
|
|
@ -212,11 +212,11 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
|
|||
uint32 count2 = 0; //count of next fields
|
||||
|
||||
Player *ali_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetAllianceFlagPickerGUID());
|
||||
if( ali_plr )
|
||||
if (ali_plr)
|
||||
++count2;
|
||||
|
||||
Player *horde_plr = objmgr.GetPlayer(((BattleGroundWS*)bg)->GetHordeFlagPickerGUID());
|
||||
if( horde_plr )
|
||||
if (horde_plr)
|
||||
++count2;
|
||||
|
||||
WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2));
|
||||
|
|
@ -228,13 +228,13 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv
|
|||
data << (float)0; // y
|
||||
}*/
|
||||
data << count2; // horde flag holders count - obsolete, now count of next fields
|
||||
if( ali_plr )
|
||||
if (ali_plr)
|
||||
{
|
||||
data << (uint64)ali_plr->GetGUID();
|
||||
data << (float)ali_plr->GetPositionX();
|
||||
data << (float)ali_plr->GetPositionY();
|
||||
}
|
||||
if( horde_plr )
|
||||
if (horde_plr)
|
||||
{
|
||||
data << (uint64)horde_plr->GetGUID();
|
||||
data << (float)horde_plr->GetPositionX();
|
||||
|
|
@ -268,7 +268,7 @@ void WorldSession::HandleBattleGroundPVPlogdataOpcode( WorldPacket & /*recv_data
|
|||
sLog.outDebug( "WORLD: Recvd MSG_PVP_LOG_DATA Message");
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
|
|
@ -291,7 +291,7 @@ void WorldSession::HandleBattleGroundListOpcode( WorldPacket &recv_data )
|
|||
recv_data >> fromWhere; // 0 - battlemaster, 1 - UI
|
||||
|
||||
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
|
||||
if(!bl)
|
||||
if (!bl)
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype received.");
|
||||
return;
|
||||
|
|
@ -317,25 +317,25 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
|
||||
recv_data >> type >> unk2 >> bgTypeId_ >> unk >> action;
|
||||
|
||||
if( !sBattlemasterListStore.LookupEntry(bgTypeId_) )
|
||||
if (!sBattlemasterListStore.LookupEntry(bgTypeId_))
|
||||
{
|
||||
sLog.outError("Battleground: invalid bgtype (%u) received.", bgTypeId_);
|
||||
// update battleground slots for the player to fix his UI and sent data.
|
||||
// this is a HACK, I don't know why the client starts sending invalid packets in the first place.
|
||||
// it usually happens with extremely high latency (if debugging / stepping in the code for example)
|
||||
if( _player->InBattleGroundQueue() )
|
||||
if (_player->InBattleGroundQueue())
|
||||
{
|
||||
// update all queues, send invitation info if player is invited, queue info if queued
|
||||
for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if( !bgQueueTypeId )
|
||||
if (!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
// if the player is not in queue, continue or no group information - this should never happen
|
||||
if( itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo )
|
||||
if (itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo)
|
||||
continue;
|
||||
|
||||
BattleGround * bg = NULL;
|
||||
|
|
@ -344,7 +344,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
uint8 israted = itrPlayerStatus->second.GroupInfo->IsRated;
|
||||
uint8 status = 0;
|
||||
|
||||
if( !itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID )
|
||||
if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
// not invited to bg, get template
|
||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
|
|
@ -358,7 +358,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
}
|
||||
|
||||
// if bg not found, then continue, don't invite if already in the instance
|
||||
if( !bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID()) )
|
||||
if (!bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID()))
|
||||
continue;
|
||||
|
||||
// re - invite player with proper data
|
||||
|
|
@ -375,7 +375,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type);
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
if( itrPlayerStatus == qpMap.end() )
|
||||
if (itrPlayerStatus == qpMap.end())
|
||||
{
|
||||
sLog.outError("Battleground: itrplayerstatus not found.");
|
||||
return;
|
||||
|
|
@ -383,7 +383,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
|
||||
instanceId = itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID;
|
||||
// if action == 1, then instanceId is required
|
||||
if( !instanceId && action == 1 )
|
||||
if (!instanceId && action == 1)
|
||||
{
|
||||
sLog.outError("Battleground: instance not found.");
|
||||
return;
|
||||
|
|
@ -392,15 +392,15 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId, bgTypeId);
|
||||
|
||||
// bg template might and must be used in case of leaving queue, when instance is not created yet
|
||||
if( !bg && action == 0 )
|
||||
if (!bg && action == 0)
|
||||
bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
{
|
||||
sLog.outError("Battleground: bg_template not found for type id %u.", bgTypeId);
|
||||
return;
|
||||
}
|
||||
|
||||
if( _player->InBattleGroundQueue() )
|
||||
if (_player->InBattleGroundQueue())
|
||||
{
|
||||
//we must use temporary variables, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function!
|
||||
uint32 team = itrPlayerStatus->second.GroupInfo->Team;
|
||||
|
|
@ -410,10 +410,10 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
uint32 opponentsRating = itrPlayerStatus->second.GroupInfo->OpponentsTeamRating;
|
||||
|
||||
//some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it
|
||||
if( action == 1 && arenaType == 0)
|
||||
if (action == 1 && arenaType == 0)
|
||||
{
|
||||
//if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue
|
||||
if( !_player->CanJoinToBattleground() )
|
||||
if (!_player->CanJoinToBattleground())
|
||||
{
|
||||
//send bg command result to show nice message
|
||||
WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4);
|
||||
|
|
@ -423,7 +423,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
|
||||
}
|
||||
//if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue
|
||||
if( _player->getLevel() > bg->GetMaxLevel() )
|
||||
if (_player->getLevel() > bg->GetMaxLevel())
|
||||
{
|
||||
sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow());
|
||||
action = 0;
|
||||
|
|
@ -434,16 +434,16 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
switch( action )
|
||||
{
|
||||
case 1: // port to battleground
|
||||
if( !_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId) )
|
||||
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
|
||||
return; // cheating?
|
||||
// resurrect the player
|
||||
if( !_player->isAlive() )
|
||||
if (!_player->isAlive())
|
||||
{
|
||||
_player->ResurrectPlayer(1.0f);
|
||||
_player->SpawnCorpseBones();
|
||||
}
|
||||
// stop taxi flight at port
|
||||
if(_player->isInFlight())
|
||||
if (_player->isInFlight())
|
||||
{
|
||||
_player->GetMotionMaster()->MovementExpired();
|
||||
_player->m_taxi.ClearTaxiDestinations();
|
||||
|
|
@ -455,7 +455,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), false);
|
||||
// this is still needed here if battleground "jumping" shouldn't add deserter debuff
|
||||
// also this is required to prevent stuck at old battleground after SetBattleGroundId set to new
|
||||
if( BattleGround *currentBg = _player->GetBattleGround() )
|
||||
if (BattleGround *currentBg = _player->GetBattleGround())
|
||||
currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true);
|
||||
|
||||
// set the destination instance id
|
||||
|
|
@ -470,10 +470,10 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
break;
|
||||
case 0: // leave queue
|
||||
// if player leaves rated arena match before match start, it is counted as he played but he lost
|
||||
if( isRated )
|
||||
if (isRated)
|
||||
{
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(team);
|
||||
if( at )
|
||||
if (at)
|
||||
{
|
||||
sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), opponentsRating);
|
||||
at->MemberLost(_player, opponentsRating);
|
||||
|
|
@ -484,7 +484,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
|
|||
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0);
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), true);
|
||||
// player left queue, we should update it - do not update Arena Queue
|
||||
if( !arenaType )
|
||||
if (!arenaType)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(bgTypeId), arenaType, isRated, rating);
|
||||
SendPacket(&data);
|
||||
sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId);
|
||||
|
|
@ -512,9 +512,9 @@ void WorldSession::HandleBattleGroundLeaveOpcode( WorldPacket & /*recv_data*/ )
|
|||
// return;
|
||||
|
||||
// not allow leave battleground in combat
|
||||
if(_player->isInCombat())
|
||||
if(BattleGround* bg = _player->GetBattleGround())
|
||||
if(bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
if (_player->isInCombat())
|
||||
if (BattleGround* bg = _player->GetBattleGround())
|
||||
if (bg->GetStatus() != STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
_player->LeaveBattleground();
|
||||
|
|
@ -531,16 +531,16 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++)
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i);
|
||||
if( !bgQueueTypeId )
|
||||
if (!bgQueueTypeId)
|
||||
continue;
|
||||
BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId);
|
||||
uint8 arenaType = BattleGroundMgr::BGArenaType(bgQueueTypeId);
|
||||
if( bgTypeId == _player->GetBattleGroundTypeId() )
|
||||
if (bgTypeId == _player->GetBattleGroundTypeId())
|
||||
{
|
||||
bg = _player->GetBattleGround();
|
||||
//i cannot check any variable from player class because player class doesn't know if player is in 2v2 / 3v3 or 5v5 arena
|
||||
//so i must use bg pointer to get that information
|
||||
if( bg && bg->GetArenaType() == arenaType )
|
||||
if (bg && bg->GetArenaType() == arenaType)
|
||||
{
|
||||
// this line is checked, i only don't know if GetStartTime is changing itself after bg end!
|
||||
// send status in BattleGround
|
||||
|
|
@ -553,12 +553,12 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
//get GroupQueueInfo for queue status
|
||||
BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers;
|
||||
BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID());
|
||||
if( itrPlayerStatus == qpMap.end() )
|
||||
if (itrPlayerStatus == qpMap.end())
|
||||
continue;
|
||||
if( itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID )
|
||||
if (itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
continue;
|
||||
uint32 remainingTime = getMSTimeDiff(getMSTime(), itrPlayerStatus->second.GroupInfo->RemoveInviteTime);
|
||||
// send status invited to BattleGround
|
||||
|
|
@ -568,7 +568,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ )
|
|||
else
|
||||
{
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
if( !bg )
|
||||
if (!bg)
|
||||
continue;
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
// send status in BattleGround Queue
|
||||
|
|
@ -585,14 +585,14 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode( WorldPacket & recv_data )
|
|||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isSpiritService()) // it's not spirit service
|
||||
|
|
@ -608,14 +608,14 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode( WorldPacket & recv_data )
|
|||
CHECK_PACKET_SIZE(recv_data, 8);
|
||||
|
||||
BattleGround *bg = _player->GetBattleGround();
|
||||
if(!bg)
|
||||
if (!bg)
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isSpiritService()) // it's not spirit service
|
||||
|
|
@ -632,7 +632,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
recv_data.hexlike();
|
||||
|
||||
// ignore if we already in BG or BG queue
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
return;
|
||||
|
||||
uint64 guid; // arena Battlemaster guid
|
||||
|
|
@ -644,7 +644,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
recv_data >> guid >> arenaslot >> asGroup >> isRated;
|
||||
|
||||
Creature *unit = ObjectAccessor::GetCreature(*_player, guid);
|
||||
if(!unit)
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if(!unit->isBattleMaster()) // it's not battle master
|
||||
|
|
@ -671,7 +671,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
|
||||
//check existance
|
||||
BattleGround* bg = NULL;
|
||||
if( !(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA)) )
|
||||
if (!(bg = sBattleGroundMgr.GetBattleGroundTemplate(BATTLEGROUND_AA)))
|
||||
{
|
||||
sLog.outError("Battleground: template bg (all arenas) not found");
|
||||
return;
|
||||
|
|
@ -681,21 +681,21 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, arenatype);
|
||||
|
||||
// check queueing conditions
|
||||
if(!asGroup)
|
||||
if (!asGroup)
|
||||
{
|
||||
// check if already in queue
|
||||
if (_player->GetBattleGroundQueueIndex(bgQueueTypeId) < PLAYER_MAX_BATTLEGROUND_QUEUES)
|
||||
//player is already in this queue
|
||||
return;
|
||||
// check if has free queue slots
|
||||
if(!_player->HasFreeBattleGroundQueueId())
|
||||
if (!_player->HasFreeBattleGroundQueueId())
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
grp = _player->GetGroup();
|
||||
// no group found, error
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
return;
|
||||
uint32 err = grp->CanJoinBattleGroundQueue(bgTypeId, bgQueueTypeId, arenatype, arenatype, (bool)isRated, arenaslot);
|
||||
if (err != BG_JOIN_ERR_OK)
|
||||
|
|
@ -707,12 +707,12 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
|
||||
uint32 ateamId = 0;
|
||||
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
{
|
||||
ateamId = _player->GetArenaTeamId(arenaslot);
|
||||
// check real arenateam existence only here (if it was moved to group->CanJoin .. () then we would ahve to get it twice)
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(ateamId);
|
||||
if(!at)
|
||||
if (!at)
|
||||
{
|
||||
_player->GetSession()->SendNotInArenaTeamPacket(arenatype);
|
||||
return;
|
||||
|
|
@ -730,20 +730,20 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
avg_pers_rating += member->GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (arenaslot*6) + 5);
|
||||
}
|
||||
|
||||
if( arenatype )
|
||||
if (arenatype)
|
||||
avg_pers_rating /= arenatype;
|
||||
|
||||
// if avg personal rating is more than 150 points below the teams rating, the team will be queued against an opponent matching or similar to the average personal rating
|
||||
if(avg_pers_rating + 150 < arenaRating)
|
||||
if (avg_pers_rating + 150 < arenaRating)
|
||||
arenaRating = avg_pers_rating;
|
||||
}
|
||||
|
||||
GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId);
|
||||
uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel(bgTypeId));
|
||||
if(asGroup)
|
||||
if (asGroup)
|
||||
{
|
||||
sLog.outDebug("Battleground: arena join as group start");
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
sLog.outDebug("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(arenaslot),_player->GetName(),arenaRating,arenatype);
|
||||
for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
|
|
@ -765,7 +765,7 @@ void WorldSession::HandleBattleGroundArenaJoin( WorldPacket & recv_data )
|
|||
sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName());
|
||||
}
|
||||
sLog.outDebug("Battleground: arena join as group end");
|
||||
if(isRated)
|
||||
if (isRated)
|
||||
sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true);
|
||||
}
|
||||
else
|
||||
|
|
@ -793,7 +793,7 @@ void WorldSession::HandleBattleGroundReportAFK( WorldPacket & recv_data )
|
|||
recv_data >> playerGuid;
|
||||
Player *reportedPlayer = objmgr.GetPlayer(playerGuid);
|
||||
|
||||
if(!reportedPlayer)
|
||||
if (!reportedPlayer)
|
||||
{
|
||||
sLog.outDebug("WorldSession::HandleBattleGroundReportAFK: player not found");
|
||||
return;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -84,7 +84,6 @@ class BattleGroundQueue
|
|||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id);
|
||||
|
||||
void DecreaseGroupLength(uint32 queueId, uint32 AsGroup);
|
||||
void BGEndedRemoveInvites(BattleGround * bg);
|
||||
void AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue);
|
||||
|
||||
typedef std::map<uint64, PlayerQueueInfo> QueuedPlayersMap;
|
||||
|
|
@ -136,8 +135,8 @@ class BattleGroundQueue
|
|||
class BGQueueInviteEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId)
|
||||
BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint32 removeTime) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_RemoveTime(removeTime)
|
||||
{
|
||||
};
|
||||
virtual ~BGQueueInviteEvent() {};
|
||||
|
|
@ -147,17 +146,20 @@ class BGQueueInviteEvent : public BasicEvent
|
|||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
uint32 m_RemoveTime;
|
||||
BattleGroundTypeId m_BgTypeId;
|
||||
};
|
||||
|
||||
/*
|
||||
This class is used to remove player from BG queue after 2 minutes from first invitation
|
||||
This class is used to remove player from BG queue after 1 minute 20 seconds from first invitation
|
||||
We must store removeInvite time in case player left queue and joined and is invited again
|
||||
We must store bgQueueTypeId, because battleground can be deleted already, when player entered it
|
||||
*/
|
||||
class BGQueueRemoveEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, uint32 playersTeam) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_BgTypeId(BgTypeId), m_PlayersTeam(playersTeam)
|
||||
BGQueueRemoveEvent(const uint64& pl_guid, uint32 bgInstanceGUID, BattleGroundTypeId BgTypeId, BattleGroundQueueTypeId bgQueueTypeId, uint32 removeTime) :
|
||||
m_PlayerGuid(pl_guid), m_BgInstanceGUID(bgInstanceGUID), m_BgTypeId(BgTypeId), m_BgQueueTypeId(bgQueueTypeId), m_RemoveTime(removeTime)
|
||||
{
|
||||
};
|
||||
virtual ~BGQueueRemoveEvent() {};
|
||||
|
|
@ -167,8 +169,9 @@ class BGQueueRemoveEvent : public BasicEvent
|
|||
private:
|
||||
uint64 m_PlayerGuid;
|
||||
uint32 m_BgInstanceGUID;
|
||||
uint32 m_PlayersTeam;
|
||||
uint32 m_RemoveTime;
|
||||
BattleGroundTypeId m_BgTypeId;
|
||||
BattleGroundQueueTypeId m_BgQueueTypeId;
|
||||
};
|
||||
|
||||
class BattleGroundMgr
|
||||
|
|
@ -190,10 +193,6 @@ class BattleGroundMgr
|
|||
void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player *pl, BattleGround *bg, const uint64& guid);
|
||||
|
||||
/* Player invitation */
|
||||
// called from Queue update, or from Addplayer to queue
|
||||
void InvitePlayer(Player* plr, uint32 bgInstanceGUID, BattleGroundTypeId bgTypeId, uint32 team);
|
||||
|
||||
/* Battlegrounds */
|
||||
BattleGround* GetBattleGroundThroughClientInstance(uint32 instanceId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id);
|
||||
BattleGround* GetBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId); //there must be uint32 because MAX_BATTLEGROUND_TYPE_ID means unknown
|
||||
|
|
@ -231,7 +230,7 @@ class BattleGroundMgr
|
|||
BattleGroundTypeId GetBattleMasterBG(uint32 entry) const
|
||||
{
|
||||
BattleMastersMap::const_iterator itr = mBattleMastersMap.find(entry);
|
||||
if(itr != mBattleMastersMap.end())
|
||||
if (itr != mBattleMastersMap.end())
|
||||
return itr->second;
|
||||
return BATTLEGROUND_WS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void BattleGroundNA::Update(uint32 diff)
|
|||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
|
|
@ -83,7 +83,7 @@ void BattleGroundNA::AddPlayer(Player *plr)
|
|||
|
||||
void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if(GetStatus() == STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
|
|
@ -94,10 +94,10 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
|||
|
||||
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if(!killer)
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("BattleGroundNA: Killer player not found");
|
||||
return;
|
||||
|
|
@ -119,7 +119,7 @@ bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
|
|||
|
||||
void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
|
|
@ -135,7 +135,7 @@ void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
break;
|
||||
}
|
||||
|
||||
//if(buff_guid)
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ void BattleGroundNA::Reset()
|
|||
bool BattleGroundNA::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if( !AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_2, BG_NA_OBJECT_TYPE_DOOR_2, 4081.179, 2874.97, 12.39171, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_3, BG_NA_OBJECT_TYPE_DOOR_3, 4023.709, 2981.777, 10.70117, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_4, BG_NA_OBJECT_TYPE_DOOR_4, 4090.064, 2858.438, 10.23631, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ void BattleGroundRL::Update(uint32 diff)
|
|||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
|
|
@ -83,7 +83,7 @@ void BattleGroundRL::AddPlayer(Player *plr)
|
|||
|
||||
void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if(GetStatus() == STATUS_WAIT_LEAVE)
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
|
|
@ -94,10 +94,10 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
|||
|
||||
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if(!killer)
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("Killer player not found");
|
||||
return;
|
||||
|
|
@ -120,7 +120,7 @@ bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
|
|||
void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
|
|
@ -136,7 +136,7 @@ void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
break;
|
||||
}
|
||||
|
||||
//if(buff_guid)
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ void BattleGroundRL::Reset()
|
|||
bool BattleGroundRL::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if( !AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY)
|
||||
if (!AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648, 1730.557, 31.60557, 1.684245, 0, 0, 0.7460582, 0.6658807, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971, 1632.719971, 36.730400, -1.448624, 0, 0, 0.6626201, -0.7489557, 120)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
|
|||
void BattleGroundSA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,43 +45,43 @@ void BattleGroundWS::Update(uint32 diff)
|
|||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if(m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
RespawnFlag(ALLIANCE, true);
|
||||
}
|
||||
}
|
||||
if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if(m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
RespawnFlagAfterDrop(ALLIANCE);
|
||||
}
|
||||
}
|
||||
if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if(m_FlagsTimer[BG_TEAM_HORDE] < 0)
|
||||
if (m_FlagsTimer[BG_TEAM_HORDE] < 0)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_HORDE] = 0;
|
||||
RespawnFlag(HORDE, true);
|
||||
}
|
||||
}
|
||||
if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if(m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
|
||||
if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_HORDE] = 0;
|
||||
RespawnFlagAfterDrop(HORDE);
|
||||
|
|
@ -128,7 +128,7 @@ void BattleGroundWS::AddPlayer(Player *plr)
|
|||
|
||||
void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
{
|
||||
if(Team == ALLIANCE)
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
sLog.outDebug("Respawn Alliance flag");
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
|
|
@ -139,7 +139,7 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
|
|||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
}
|
||||
|
||||
if(captured)
|
||||
if (captured)
|
||||
{
|
||||
//when map_update will be allowed for battlegrounds this code will be useless
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
|
|
@ -151,11 +151,11 @@ void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
|
|||
|
||||
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
RespawnFlag(team,false);
|
||||
if(team == ALLIANCE)
|
||||
if (team == ALLIANCE)
|
||||
{
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
|
|
@ -169,7 +169,7 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
|
|||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID(team));
|
||||
if(obj)
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team)));
|
||||
|
|
@ -179,13 +179,13 @@ void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
|
|||
|
||||
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 winner = 0;
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
|
|
@ -194,7 +194,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
|||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Horde Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if(GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(ALLIANCE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
|
||||
|
|
@ -208,7 +208,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
|||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Alliance Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if(GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(HORDE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
||||
|
|
@ -219,7 +219,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
|||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
|
|
@ -229,13 +229,13 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
|||
// only flag capture should be updated
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
|
||||
if(GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = ALLIANCE;
|
||||
|
||||
if(GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
|
||||
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = HORDE;
|
||||
|
||||
if(winner)
|
||||
if (winner)
|
||||
{
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
|
||||
|
|
@ -252,15 +252,15 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
|||
|
||||
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if(!this->IsHordeFlagPickedup())
|
||||
if (!this->IsHordeFlagPickedup())
|
||||
return;
|
||||
if(GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
|
|
@ -268,9 +268,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(!this->IsAllianceFlagPickedup())
|
||||
if (!this->IsAllianceFlagPickedup())
|
||||
return;
|
||||
if(GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
|
|
@ -281,11 +281,11 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
|||
|
||||
bool set = false;
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if(!IsHordeFlagPickedup())
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if(GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
|
|
@ -296,9 +296,9 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
|||
}
|
||||
else
|
||||
{
|
||||
if(!IsAllianceFlagPickedup())
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if(GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
|
|
@ -313,7 +313,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
|||
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
UpdateFlagState(Source->GetTeam(), 1);
|
||||
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1));
|
||||
|
|
@ -330,7 +330,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
|||
|
||||
void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
int32 message_id = 0;
|
||||
|
|
@ -369,9 +369,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||
}
|
||||
|
||||
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
|
||||
if(GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
|
||||
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
|
||||
{
|
||||
if(Source->GetTeam() == ALLIANCE)
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
message_id = LANG_BG_WS_RETURNED_AF;
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
|
|
@ -398,9 +398,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||
}
|
||||
|
||||
//Horde flag on ground(not in base) (returned or picked up again)
|
||||
if(GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
|
||||
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
|
||||
{
|
||||
if(Source->GetTeam() == HORDE)
|
||||
if (Source->GetTeam() == HORDE)
|
||||
{
|
||||
message_id = LANG_BG_WS_RETURNED_HF;
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
|
|
@ -436,9 +436,9 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
|
|||
void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
if(IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
||||
{
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
|
||||
SetAllianceFlagPicker(0);
|
||||
|
|
@ -447,9 +447,9 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
|
|||
else
|
||||
EventPlayerDroppedFlag(plr);
|
||||
}
|
||||
if(IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
|
||||
{
|
||||
if(!plr)
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
|
||||
SetHordeFlagPicker(0);
|
||||
|
|
@ -462,7 +462,7 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
|
|||
|
||||
void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
if (team == ALLIANCE)
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
|
||||
else
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
|
||||
|
|
@ -470,7 +470,7 @@ void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
|
|||
|
||||
void BattleGroundWS::UpdateTeamScore(uint32 team)
|
||||
{
|
||||
if(team == ALLIANCE)
|
||||
if (team == ALLIANCE)
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team));
|
||||
else
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
|
||||
|
|
@ -479,7 +479,7 @@ void BattleGroundWS::UpdateTeamScore(uint32 team)
|
|||
void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
|
|
@ -505,13 +505,13 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||
break;
|
||||
case 3646: // Alliance Flag spawn
|
||||
if(m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
|
||||
if(GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source);
|
||||
break;
|
||||
case 3647: // Horde Flag spawn
|
||||
if(m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
|
||||
if(GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source);
|
||||
break;
|
||||
case 3649: // unk1
|
||||
|
|
@ -525,14 +525,14 @@ void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
|||
break;
|
||||
}
|
||||
|
||||
//if(buff_guid)
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
bool BattleGroundWS::SetupBattleGround()
|
||||
{
|
||||
// flags
|
||||
if( !AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
|
||||
if (!AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
|
||||
|| !AddObject(BG_WS_OBJECT_H_FLAG, BG_OBJECT_H_FLAG_WS_ENTRY, 916.0226f, 1434.405f, 345.413f, 0.01745329f, 0, 0, 0.008726535f, 0.9999619f, BG_WS_FLAG_RESPAWN_TIME/1000)
|
||||
// buffs
|
||||
|| !AddObject(BG_WS_OBJECT_SPEEDBUFF_1, BG_OBJECTID_SPEEDBUFF_ENTRY, 1449.93f, 1470.71f, 342.6346f, -1.64061f, 0, 0, 0.7313537f, -0.6819983f, BUFF_RESPAWN_TIME)
|
||||
|
|
@ -560,14 +560,14 @@ bool BattleGroundWS::SetupBattleGround()
|
|||
}
|
||||
|
||||
WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||
if(!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
|
||||
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||
if(!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
|
||||
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
|
|
@ -597,9 +597,9 @@ void BattleGroundWS::Reset()
|
|||
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
|
||||
|
||||
/* Spirit nodes is static at this BG and then not required deleting at BG reset.
|
||||
if(m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
|
||||
if(m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
|
||||
DelCreature(WS_SPIRIT_MAIN_HORDE);
|
||||
*/
|
||||
}
|
||||
|
|
@ -607,9 +607,9 @@ void BattleGroundWS::Reset()
|
|||
void BattleGroundWS::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if( winner == ALLIANCE )
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
|
||||
if( winner == HORDE )
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
|
||||
|
|
@ -620,7 +620,7 @@ void BattleGroundWS::EndBattleGround(uint32 winner)
|
|||
|
||||
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if(GetStatus() != STATUS_IN_PROGRESS)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
EventPlayerDroppedFlag(player);
|
||||
|
|
@ -657,16 +657,16 @@ WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
|
|||
//if a player dies in preparation phase - then the player can't cheat
|
||||
//and teleport to the graveyard outside the flagroom
|
||||
//and start running around, while the doors are still closed
|
||||
if(player->GetTeam() == ALLIANCE)
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||
else
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetStatus() == STATUS_IN_PROGRESS)
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||
else
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE);
|
||||
|
|
@ -678,14 +678,14 @@ void BattleGroundWS::FillInitialWorldStates(WorldPacket& data)
|
|||
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
|
||||
|
||||
if(m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1);
|
||||
else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0);
|
||||
|
||||
if(m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1);
|
||||
else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1);
|
||||
|
|
|
|||
|
|
@ -583,37 +583,34 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
|
|||
if (!Create(guid,entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state) )
|
||||
return false;
|
||||
|
||||
switch(GetGOInfo()->type)
|
||||
if(!GetDespawnPossibility())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR:
|
||||
case GAMEOBJECT_TYPE_BUTTON:
|
||||
/* this code (in comment) isn't correct because in battlegrounds we need despawnable doors and buttons, pls remove
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
|
||||
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
|
||||
m_spawnedByDefault = true;
|
||||
m_respawnDelayTime = 0;
|
||||
m_respawnTime = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(data->spawntimesecs >= 0)
|
||||
{
|
||||
m_spawnedByDefault = true;
|
||||
m_respawnDelayTime = 0;
|
||||
m_respawnTime = 0;
|
||||
break;*/
|
||||
default:
|
||||
if(data->spawntimesecs >= 0)
|
||||
{
|
||||
m_spawnedByDefault = true;
|
||||
m_respawnDelayTime = data->spawntimesecs;
|
||||
m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId());
|
||||
m_respawnDelayTime = data->spawntimesecs;
|
||||
m_respawnTime = objmgr.GetGORespawnTime(m_DBTableGuid, map->GetInstanceId());
|
||||
|
||||
// ready to respawn
|
||||
if(m_respawnTime && m_respawnTime <= time(NULL))
|
||||
{
|
||||
m_respawnTime = 0;
|
||||
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
|
||||
}
|
||||
}
|
||||
else
|
||||
// ready to respawn
|
||||
if(m_respawnTime && m_respawnTime <= time(NULL))
|
||||
{
|
||||
m_spawnedByDefault = false;
|
||||
m_respawnDelayTime = -data->spawntimesecs;
|
||||
m_respawnTime = 0;
|
||||
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_spawnedByDefault = false;
|
||||
m_respawnDelayTime = -data->spawntimesecs;
|
||||
m_respawnTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -479,6 +479,20 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
|||
}
|
||||
}
|
||||
|
||||
bool GetDespawnPossibility() const
|
||||
{
|
||||
switch(GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: return GetGOInfo()->door.noDamageImmune;
|
||||
case GAMEOBJECT_TYPE_BUTTON: return GetGOInfo()->button.noDamageImmune;
|
||||
case GAMEOBJECT_TYPE_QUESTGIVER: return GetGOInfo()->questgiver.noDamageImmune;
|
||||
case GAMEOBJECT_TYPE_GOOBER: return GetGOInfo()->goober.noDamageImmune;
|
||||
case GAMEOBJECT_TYPE_FLAGSTAND: return GetGOInfo()->flagstand.noDamageImmune;
|
||||
case GAMEOBJECT_TYPE_FLAGDROP: return GetGOInfo()->flagdrop.noDamageImmune;
|
||||
default: return true;
|
||||
}
|
||||
}
|
||||
|
||||
time_t GetRespawnTime() const { return m_respawnTime; }
|
||||
time_t GetRespawnTimeEx() const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2516,7 +2516,7 @@ SpellMissInfo Unit::MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell)
|
|||
HitChance -= int32(((Player*)pVictim)->GetRatingBonusValue(CR_HIT_TAKEN_SPELL)*100.0f);
|
||||
|
||||
if (HitChance < 100) HitChance = 100;
|
||||
if (HitChance > 9900) HitChance = 9900;
|
||||
if (HitChance > 10000) HitChance = 10000;
|
||||
|
||||
int32 tmp = 10000 - HitChance;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7630"
|
||||
#define REVISION_NR "7635"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue