mirror of
https://github.com/mangosfour/server.git
synced 2025-12-23 16:37:03 +00:00
Implemented Phase Definitions, Terrainswap and multiphasing
* fixes cataclysm aura effect SPELL_AURA_PHASE without phasemasks defined in miscValueA NOTE: - Need some more test and feedback! Thanks to: - Naios: Main Author - Cyberbrest: For the hard research work about multiphasing. - Venugh: He helped me with a lot of strange compile Errors. - Shauren: For the 4.3.4 phaseshift packet. - Booksize: He showed me how terrainswap works - Zakamurite: For Backporting some to MaNGOS - All other Author
This commit is contained in:
parent
7c485a9ccc
commit
ab2c78ba59
29 changed files with 418 additions and 210 deletions
|
|
@ -67,6 +67,7 @@
|
|||
#include "SQLStorages.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Calendar.h"
|
||||
#include "PhaseMgr.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
@ -558,6 +559,8 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
|
|||
m_cachedGS = 0;
|
||||
|
||||
m_slot = 255;
|
||||
|
||||
phaseMgr = new PhaseMgr(this);
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
|
|
@ -598,6 +601,8 @@ Player::~Player()
|
|||
|
||||
delete m_declinedname;
|
||||
delete m_runes;
|
||||
|
||||
delete phaseMgr;
|
||||
}
|
||||
|
||||
void Player::CleanupsBeforeDelete()
|
||||
|
|
@ -839,9 +844,6 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
}
|
||||
// all item positions resolved
|
||||
|
||||
if (info->phaseMap != 0)
|
||||
CharacterDatabase.PExecute("REPLACE INTO `character_phase_data` (`guid`, `map`) VALUES (%u, %u)", guidlow, info->phaseMap);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2427,15 +2429,7 @@ void Player::SetGameMaster(bool on)
|
|||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
|
||||
|
||||
// restore phase
|
||||
AuraList const& phases = GetAurasByType(SPELL_AURA_PHASE);
|
||||
AuraList const& phases2 = GetAurasByType(SPELL_AURA_PHASE_2);
|
||||
|
||||
if (!phases.empty())
|
||||
SetPhaseMask(phases.front()->GetMiscValue(), false);
|
||||
else if (!phases2.empty())
|
||||
SetPhaseMask(phases2.front()->GetMiscValue(), false);
|
||||
else
|
||||
SetPhaseMask(PHASEMASK_NORMAL, false);
|
||||
SetPhaseMask(phaseMgr->GetCurrentPhasemask(), false);
|
||||
|
||||
CallForAllControlledUnits(SetGameMasterOffHelper(getFaction()), CONTROLLED_PET | CONTROLLED_TOTEMS | CONTROLLED_GUARDIANS | CONTROLLED_CHARM);
|
||||
|
||||
|
|
@ -2447,6 +2441,9 @@ void Player::SetGameMaster(bool on)
|
|||
UpdateArea(m_areaUpdateId);
|
||||
|
||||
getHostileRefManager().setOnlineOfflineState(true);
|
||||
|
||||
phaseMgr->AddUpdateFlag(PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED);
|
||||
phaseMgr->Update();
|
||||
}
|
||||
|
||||
m_camera.UpdateVisibilityForOwner();
|
||||
|
|
@ -2675,6 +2672,11 @@ void Player::GiveLevel(uint32 level)
|
|||
MailDraft(mailReward->mailTemplateId).SendMailTo(this, MailSender(MAIL_CREATURE, mailReward->senderEntry));
|
||||
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
|
||||
|
||||
PhaseUpdateData phaseUdateData;
|
||||
phaseUdateData.AddConditionType(CONDITION_LEVEL);
|
||||
|
||||
phaseMgr->NotifyConditionChanged(phaseUdateData);
|
||||
}
|
||||
|
||||
void Player::UpdateFreeTalentPoints(bool resetIfNeed)
|
||||
|
|
@ -4137,25 +4139,9 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
|
|||
}
|
||||
}
|
||||
|
||||
SetPhaseAndMap(target);
|
||||
Unit::BuildCreateUpdateBlockForPlayer(data, target);
|
||||
}
|
||||
|
||||
void Player::SetPhaseAndMap(Player* target) const
|
||||
{
|
||||
if (QueryResult *result = CharacterDatabase.PQuery("SELECT map, phase FROM character_phase_data WHERE guid = '%u'", target->GetGUIDLow()))
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
uint16 mapId = fields[0].GetUInt16();
|
||||
uint32 phase = fields[1].GetUInt32();
|
||||
|
||||
target->GetSession()->SendSetPhaseShift(phase, mapId);
|
||||
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::DestroyForPlayer(Player* target, bool anim) const
|
||||
{
|
||||
Unit::DestroyForPlayer(target, anim);
|
||||
|
|
@ -6860,7 +6846,11 @@ void Player::UpdateArea(uint32 newArea)
|
|||
SetFFAPvP(false);
|
||||
}
|
||||
|
||||
phaseMgr->AddUpdateFlag(PHASE_UPDATE_FLAG_AREA_UPDATE);
|
||||
|
||||
UpdateAreaDependentAuras();
|
||||
|
||||
phaseMgr->RemoveUpdateFlag(PHASE_UPDATE_FLAG_AREA_UPDATE);
|
||||
}
|
||||
|
||||
bool Player::CanUseCapturePoint()
|
||||
|
|
@ -6880,6 +6870,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
|||
if (!zone)
|
||||
return;
|
||||
|
||||
phaseMgr->AddUpdateFlag(PHASE_UPDATE_FLAG_ZONE_UPDATE);
|
||||
|
||||
if (m_zoneUpdateId != newZone)
|
||||
{
|
||||
// handle outdoor pvp zones
|
||||
|
|
@ -6970,6 +6962,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
|||
|
||||
UpdateZoneDependentAuras();
|
||||
UpdateZoneDependentPets();
|
||||
|
||||
phaseMgr->RemoveUpdateFlag(PHASE_UPDATE_FLAG_ZONE_UPDATE);
|
||||
}
|
||||
|
||||
// If players are too far way of duel flag... then player loose the duel
|
||||
|
|
@ -14244,6 +14238,11 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver,
|
|||
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0);
|
||||
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
|
||||
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
|
||||
|
||||
PhaseUpdateData phaseUdateData;
|
||||
phaseUdateData.AddQuestUpdate(quest_id);
|
||||
|
||||
phaseMgr->NotifyConditionChanged(phaseUdateData);
|
||||
}
|
||||
|
||||
void Player::FailQuest(uint32 questId)
|
||||
|
|
@ -14783,6 +14782,11 @@ void Player::SetQuestStatus(uint32 quest_id, QuestStatus status)
|
|||
q_status.uState = QUEST_CHANGED;
|
||||
}
|
||||
|
||||
PhaseUpdateData phaseUdateData;
|
||||
phaseUdateData.AddQuestUpdate(quest_id);
|
||||
|
||||
phaseMgr->NotifyConditionChanged(phaseUdateData);
|
||||
|
||||
UpdateForQuestWorldObjects();
|
||||
}
|
||||
|
||||
|
|
@ -15412,15 +15416,6 @@ void Player::SendQuestReward(Quest const* pQuest, uint32 XP, Object* /*questGive
|
|||
data.WriteBit(1); // unk
|
||||
|
||||
GetSession()->SendPacket(&data);
|
||||
|
||||
if (QuestPhaseMapsVector const* QuestPhaseVector = sObjectMgr.GetQuestPhaseMapVector(questid))
|
||||
{
|
||||
for (QuestPhaseMapsVector::const_iterator itr = QuestPhaseVector->begin(); itr != QuestPhaseVector->end(); ++itr)
|
||||
{
|
||||
GetSession()->SendSetPhaseShift(itr->PhaseMask, itr->MapId);
|
||||
CharacterDatabase.PExecute("REPLACE INTO character_phase_data` (`guid`, `map`, `phase`) VALUES (%u, %u, %u)", GetSession()->GetPlayer()->GetGUIDLow(), itr->MapId, itr->PhaseMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::SendQuestFailed(uint32 quest_id, InventoryResult reason)
|
||||
|
|
@ -20477,21 +20472,6 @@ template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Corpse*
|
|||
template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, GameObject* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
|
||||
template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, DynamicObject* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
|
||||
|
||||
void Player::SetPhaseMask(uint32 newPhaseMask, bool update)
|
||||
{
|
||||
// GM-mode have mask PHASEMASK_ANYWHERE always
|
||||
if (isGameMaster())
|
||||
newPhaseMask = PHASEMASK_ANYWHERE;
|
||||
|
||||
// phase auras normally not expected at BG but anyway better check
|
||||
if (BattleGround* bg = GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag(this);
|
||||
|
||||
Unit::SetPhaseMask(newPhaseMask, update);
|
||||
if (IsInWorld())
|
||||
GetSession()->SendSetPhaseShift(GetPhaseMask());
|
||||
}
|
||||
|
||||
void Player::InitPrimaryProfessions()
|
||||
{
|
||||
uint32 maxProfs = GetSession()->GetSecurity() < AccountTypes(sWorld.getConfig(CONFIG_UINT32_TRADE_SKILL_GMIGNORE_MAX_PRIMARY_COUNT))
|
||||
|
|
@ -22437,28 +22417,6 @@ void Player::_LoadSkills(QueryResult* result)
|
|||
}
|
||||
}
|
||||
|
||||
uint32 Player::GetPhaseMaskForSpawn() const
|
||||
{
|
||||
uint32 phase = PHASEMASK_NORMAL;
|
||||
if (!isGameMaster())
|
||||
phase = GetPhaseMask();
|
||||
else
|
||||
{
|
||||
AuraList const& phases = GetAurasByType(SPELL_AURA_PHASE);
|
||||
AuraList const& phases2 = GetAurasByType(SPELL_AURA_PHASE_2);
|
||||
if (!phases.empty())
|
||||
phase = phases.front()->GetMiscValue();
|
||||
else if (!phases2.empty())
|
||||
phase = phases2.front()->GetMiscValue();
|
||||
}
|
||||
|
||||
// some aura phases include 1 normal map in addition to phase itself
|
||||
if (uint32 n_phase = phase & ~PHASEMASK_NORMAL)
|
||||
return n_phase;
|
||||
|
||||
return PHASEMASK_NORMAL;
|
||||
}
|
||||
|
||||
InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) const
|
||||
{
|
||||
ItemPrototype const* pProto = pItem->GetProto();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue