mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
Merge commit 'origin/master' into 310 (at [7360])
This commit is contained in:
commit
ce8bd43bef
69 changed files with 2352 additions and 1751 deletions
|
|
@ -366,6 +366,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
|
|||
m_DetectInvTimer = 1000;
|
||||
|
||||
m_bgBattleGroundID = 0;
|
||||
m_bgTypeID = BATTLEGROUND_TYPE_NONE;
|
||||
for (int j=0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; j++)
|
||||
{
|
||||
m_bgBattleGroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
|
||||
|
|
@ -3857,12 +3858,12 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
|||
SetPower(POWER_ENERGY, uint32(GetMaxPower(POWER_ENERGY)*restore_percent));
|
||||
}
|
||||
|
||||
// trigger update zone for alive state zone updates
|
||||
UpdateZone(GetZoneId());
|
||||
|
||||
// update visibility
|
||||
ObjectAccessor::UpdateVisibilityForPlayer(this);
|
||||
|
||||
// some items limited to specific map
|
||||
DestroyZoneLimitedItem( true, GetZoneId());
|
||||
|
||||
if(!applySickness)
|
||||
return;
|
||||
|
||||
|
|
@ -4231,7 +4232,7 @@ void Player::RepopAtGraveyard()
|
|||
WorldSafeLocsEntry const *ClosestGrave = NULL;
|
||||
|
||||
// Special handle for battleground maps
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(GetBattleGroundId());
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgTypeID);
|
||||
|
||||
if(bg && (bg->GetTypeID() == BATTLEGROUND_AB || bg->GetTypeID() == BATTLEGROUND_EY))
|
||||
ClosestGrave = bg->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetTeam());
|
||||
|
|
@ -6004,7 +6005,7 @@ void Player::RewardReputation(Quest const *pQuest)
|
|||
{
|
||||
if(pQuest->RewRepFaction[i] && pQuest->RewRepValue[i] )
|
||||
{
|
||||
int32 rep = CalculateReputationGain(pQuest->GetQuestLevel(),pQuest->RewRepValue[i],true);
|
||||
int32 rep = CalculateReputationGain(GetQuestLevel(pQuest),pQuest->RewRepValue[i],true);
|
||||
FactionEntry const* factionEntry = sFactionStore.LookupEntry(pQuest->RewRepFaction[i]);
|
||||
if(factionEntry)
|
||||
ModifyFactionReputation(factionEntry, rep);
|
||||
|
|
@ -6566,7 +6567,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
|
|||
if(slot >= INVENTORY_SLOT_BAG_END || !proto)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
for (int i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
{
|
||||
uint32 statType = 0;
|
||||
int32 val = 0;
|
||||
|
|
@ -6899,7 +6900,7 @@ void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change)
|
|||
if(!proto)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
{
|
||||
_Spell const& spellData = proto->Spells[i];
|
||||
|
||||
|
|
@ -7012,7 +7013,7 @@ void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attTy
|
|||
if (!Target || Target == this )
|
||||
return;
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
{
|
||||
_Spell const& spellData = proto->Spells[i];
|
||||
|
||||
|
|
@ -7110,7 +7111,7 @@ void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 c
|
|||
int count = 0;
|
||||
|
||||
// item spells casted at use
|
||||
for(int i = 0; i < 5; ++i)
|
||||
for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
{
|
||||
_Spell const& spellData = proto->Spells[i];
|
||||
|
||||
|
|
@ -12621,6 +12622,19 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
|
|||
if(questGiver && pQuest->GetQuestStartScript()!=0)
|
||||
sWorld.ScriptsStart(sQuestStartScripts, pQuest->GetQuestStartScript(), questGiver, this);
|
||||
|
||||
// Some spells applied at quest activation
|
||||
SpellAreaForQuestMapBounds saBounds = spellmgr.GetSpellAreaForQuestMapBounds(quest_id,true);
|
||||
if(saBounds.first != saBounds.second)
|
||||
{
|
||||
uint32 zone = GetZoneId();
|
||||
uint32 area = GetAreaId();
|
||||
|
||||
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
|
||||
if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
|
||||
if( !HasAura(itr->second->spellId,0) )
|
||||
CastSpell(this,itr->second->spellId,true);
|
||||
}
|
||||
|
||||
UpdateForQuestsGO();
|
||||
}
|
||||
|
||||
|
|
@ -12811,6 +12825,34 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
|
|||
if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED;
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT);
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST);
|
||||
|
||||
uint32 zone = 0;
|
||||
uint32 area = 0;
|
||||
|
||||
// remove auras from spells with quest reward state limitations
|
||||
SpellAreaForQuestMapBounds saEndBounds = spellmgr.GetSpellAreaForQuestEndMapBounds(quest_id);
|
||||
if(saEndBounds.first != saEndBounds.second)
|
||||
{
|
||||
uint32 zone = GetZoneId();
|
||||
uint32 area = GetAreaId();
|
||||
|
||||
for(SpellAreaForAreaMap::const_iterator itr = saEndBounds.first; itr != saEndBounds.second; ++itr)
|
||||
if(!itr->second->IsFitToRequirements(this,zone,area))
|
||||
RemoveAurasDueToSpell(itr->second->spellId);
|
||||
}
|
||||
|
||||
// Some spells applied at quest reward
|
||||
SpellAreaForQuestMapBounds saBounds = spellmgr.GetSpellAreaForQuestMapBounds(quest_id,false);
|
||||
if(saBounds.first != saBounds.second)
|
||||
{
|
||||
if(!zone) zone = GetZoneId();
|
||||
if(!area) area = GetAreaId();
|
||||
|
||||
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
|
||||
if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
|
||||
if( !HasAura(itr->second->spellId,0) )
|
||||
CastSpell(this,itr->second->spellId,true);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::FailQuest( uint32 quest_id )
|
||||
|
|
@ -14179,14 +14221,14 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
if(!mapEntry || mapEntry->Instanceable() || !MapManager::IsValidMapCoord(m_bgEntryPoint))
|
||||
SetBattleGroundEntryPoint(m_homebindMapId,m_homebindX,m_homebindY,m_homebindZ,0.0f);
|
||||
|
||||
BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(bgid);
|
||||
BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(bgid, BATTLEGROUND_TYPE_NONE);
|
||||
|
||||
if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID()))
|
||||
{
|
||||
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
|
||||
uint32 queueSlot = AddBattleGroundQueueId(bgQueueTypeId);
|
||||
|
||||
SetBattleGroundId(currentBg->GetInstanceID());
|
||||
SetBattleGroundId(currentBg->GetInstanceID(), currentBg->GetTypeID());
|
||||
SetBGTeam(bgteam);
|
||||
|
||||
//join player to battleground group
|
||||
|
|
@ -15560,8 +15602,7 @@ void Player::SaveToDB()
|
|||
uint32 tmp_displayid = GetDisplayId();
|
||||
|
||||
// Set player sit state to standing on save, also stealth and shifted form
|
||||
SetStandState(UNIT_STAND_STATE_STAND); // stand state
|
||||
RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // stand flags?
|
||||
SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND);
|
||||
SetByteValue(UNIT_FIELD_BYTES_2, 3, 0); // shapeshift
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
SetDisplayId(GetNativeDisplayId());
|
||||
|
|
@ -18169,7 +18210,7 @@ void Player::SendInstanceResetWarning(uint32 mapid, uint32 time)
|
|||
|
||||
void Player::ApplyEquipCooldown( Item * pItem )
|
||||
{
|
||||
for(int i = 0; i <5; ++i)
|
||||
for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
{
|
||||
_Spell const& spellData = pItem->GetProto()->Spells[i];
|
||||
|
||||
|
|
@ -18419,7 +18460,7 @@ BattleGround* Player::GetBattleGround() const
|
|||
if(GetBattleGroundId()==0)
|
||||
return NULL;
|
||||
|
||||
return sBattleGroundMgr.GetBattleGround(GetBattleGroundId());
|
||||
return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgTypeID);
|
||||
}
|
||||
|
||||
bool Player::InArena() const
|
||||
|
|
@ -18444,34 +18485,20 @@ bool Player::GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const
|
|||
return true;
|
||||
}
|
||||
|
||||
uint32 Player::GetMinLevelForBattleGroundQueueId(uint32 queue_id, BattleGroundTypeId bgTypeId)
|
||||
BGQueueIdBasedOnLevel Player::GetBattleGroundQueueIdFromLevel(BattleGroundTypeId bgTypeId) const
|
||||
{
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
assert(bg);
|
||||
return (queue_id*10)+bg->GetMinLevel();
|
||||
}
|
||||
//returned to hardcoded version of this function, because there is no way to code it dynamic
|
||||
uint32 level = getLevel();
|
||||
if( bgTypeId == BATTLEGROUND_AV )
|
||||
level--;
|
||||
|
||||
uint32 Player::GetMaxLevelForBattleGroundQueueId(uint32 queue_id, BattleGroundTypeId bgTypeId)
|
||||
{
|
||||
return GetMinLevelForBattleGroundQueueId(queue_id, bgTypeId)+10;
|
||||
}
|
||||
|
||||
uint32 Player::GetBattleGroundQueueIdFromLevel(BattleGroundTypeId bgTypeId) const
|
||||
{
|
||||
BattleGround *bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId);
|
||||
assert(bg);
|
||||
if(getLevel()<bg->GetMinLevel())
|
||||
uint32 queue_id = (level / 10) - 1; // for ranges 0 - 19, 20 - 29, 30 - 39, 40 - 49, 50 - 59, 60 - 69, 70 -79, 80
|
||||
if( queue_id >= MAX_BATTLEGROUND_QUEUES )
|
||||
{
|
||||
sLog.outError("getting queue_id for player who doesn't meet the requirements - this shouldn't happen");
|
||||
return 0;
|
||||
sLog.outError("BattleGround: too high queue_id %u this shouldn't happen", queue_id);
|
||||
return QUEUE_ID_MAX_LEVEL_80;
|
||||
}
|
||||
uint32 queue_id = (getLevel() - bg->GetMinLevel()) / 10;
|
||||
if(queue_id>MAX_BATTLEGROUND_QUEUES)
|
||||
{
|
||||
sLog.outError("to high queue_id %u this shouldn't happen",queue_id);
|
||||
return 0;
|
||||
}
|
||||
return queue_id;
|
||||
return BGQueueIdBasedOnLevel(queue_id);
|
||||
}
|
||||
|
||||
float Player::GetReputationPriceDiscount( Creature const* pCreature ) const
|
||||
|
|
@ -18966,26 +18993,12 @@ void Player::UpdateZoneDependentAuras( uint32 newZone )
|
|||
RemoveSpellsCausingAura(SPELL_AURA_FLY);
|
||||
}
|
||||
|
||||
// Some spells applied at enter into zone (with subzones)
|
||||
switch(newZone)
|
||||
{
|
||||
case 2367: // Old Hillsbrad Foothills
|
||||
{
|
||||
// Human Illusion
|
||||
// NOTE: these are removed by RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP);
|
||||
uint32 spellid = 0;
|
||||
// all horde races
|
||||
if( GetTeam() == HORDE )
|
||||
spellid = getGender() == GENDER_FEMALE ? 35481 : 35480;
|
||||
// and some alliance races
|
||||
else if( getRace() == RACE_NIGHTELF || getRace() == RACE_DRAENEI )
|
||||
spellid = getGender() == GENDER_FEMALE ? 35483 : 35482;
|
||||
|
||||
if(spellid && !HasAura(spellid,0) )
|
||||
CastSpell(this,spellid,true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update
|
||||
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newZone);
|
||||
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
|
||||
if(itr->second->autocast && itr->second->IsFitToRequirements(this,newZone,0))
|
||||
if( !HasAura(itr->second->spellId,0) )
|
||||
CastSpell(this,itr->second->spellId,true);
|
||||
}
|
||||
|
||||
void Player::UpdateAreaDependentAuras( uint32 newArea )
|
||||
|
|
@ -18994,42 +19007,18 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
|
|||
for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();)
|
||||
{
|
||||
// use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date
|
||||
if(GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea,GetBattleGroundId())!=0)
|
||||
if(spellmgr.GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea,this)!=0)
|
||||
RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
|
||||
// some auras applied at subzone enter
|
||||
switch(newArea)
|
||||
{
|
||||
// Dragonmaw Illusion
|
||||
case 3759: // Netherwing Ledge
|
||||
case 3939: // Dragonmaw Fortress
|
||||
case 3966: // Dragonmaw Base Camp
|
||||
if( GetDummyAura(40214) )
|
||||
{
|
||||
if( !HasAura(40216,0) )
|
||||
CastSpell(this,40216,true);
|
||||
if( !HasAura(42016,0) )
|
||||
CastSpell(this,42016,true);
|
||||
}
|
||||
break;
|
||||
// Dominion Over Acherus
|
||||
case 4281: // Acherus: The Ebon Hold
|
||||
case 4342: // Acherus: The Ebon Hold
|
||||
if( HasSpell(51721) )
|
||||
if( !HasAura(51721,0) )
|
||||
CastSpell(this,51721,true);
|
||||
break;
|
||||
// Mist of the Kvaldir
|
||||
case 4028: //Riplash Strand
|
||||
case 4029: //Riplash Ruins
|
||||
case 4106: //Garrosh's Landing
|
||||
case 4031: //Pal'ea
|
||||
CastSpell(this,54119,true);
|
||||
break;
|
||||
}
|
||||
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newArea);
|
||||
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
|
||||
if(itr->second->autocast && itr->second->IsFitToRequirements(this,m_zoneUpdateId,newArea))
|
||||
if( !HasAura(itr->second->spellId,0) )
|
||||
CastSpell(this,itr->second->spellId,true);
|
||||
}
|
||||
|
||||
uint32 Player::GetCorpseReclaimDelay(bool pvp) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue