--HG--
branch : trunk
This commit is contained in:
Machiavelli
2009-06-10 08:45:45 +02:00
77 changed files with 1565 additions and 687 deletions
+12
View File
@@ -205,6 +205,14 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
return false;
}
return true;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
if(team.team != ALLIANCE && team.team != HORDE)
{
sLog.outErrorDb( "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) have unknown team in value1 (%u), ignore.",
criteria->ID, criteria->requiredType,dataType,gender.gender);
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;
@@ -265,6 +273,10 @@ bool AchievementCriteriaData::Meets(Player const* source, Unit const* target, ui
return source->GetMap()->GetSpawnMode()==difficalty.difficalty;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
if (!target || target->GetTypeId() != TYPEID_PLAYER)
return false;
return ((Player*)target)->GetTeam() == team.team;
}
return false;
}
+8 -2
View File
@@ -53,12 +53,13 @@ enum AchievementCriteriaDataType
ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE = 8, // minvalue value provided with achievement update must be not less that limit
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL = 9, // minlevel minlevel of target
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER = 10,// gender 0=male; 1=female
ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED = 11,// used to prevent achievement createria complete if not all requirement implemented and listed in table
ACHIEVEMENT_CRITERIA_DATA_TYPE_DISABLED = 11,// used to prevent achievement creteria complete if not all requirement implemented and listed in table
ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY = 12,// difficulty normal/heroic difficulty for current event map
ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT = 13,// count "with less than %u people in the zone"
ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM = 14,// team HORDE(67), ALLIANCE(469)
};
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 14 // maximum value in AchievementCriteriaDataType enum
#define MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE 15 // maximum value in AchievementCriteriaDataType enum
class Player;
class Unit;
@@ -128,6 +129,11 @@ struct AchievementCriteriaData
{
uint32 maxcount;
} map_players;
// ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM = 14
struct
{
uint32 team;
} team;
// ...
struct
{
+7 -5
View File
@@ -1646,15 +1646,17 @@ bool Creature::IsWithinSightDist(Unit const* u) const
return IsWithinDistInMap(u, sWorld.getConfig(CONFIG_SIGHT_MONSTER));
}
bool Creature::canStartAttack(Unit const* who) const
bool Creature::canStartAttack(Unit const* who, bool force) const
{
if(isCivilian() || IsNeutralToAll()
if(isCivilian()
|| !who->isInAccessiblePlaceFor(this)
|| !canFly() && GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE
|| !IsWithinDistInMap(who, GetAttackDistance(who)))
|| !canFly() && GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
return false;
if(!canAttack(who, false))
if(!force && (IsNeutralToAll() || !IsWithinDistInMap(who, GetAttackDistance(who))))
return false;
if(!canAttack(who, force))
return false;
return IsWithinLOSInMap(who);
+1 -1
View File
@@ -643,7 +643,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList = false, bool is3dDistance = true) const;
bool IsWithinSightDist(Unit const* u) const;
bool canStartAttack(Unit const* u) const;
bool canStartAttack(Unit const* u, bool force) const;
float GetAttackDistance(Unit const* pl) const;
Unit* SelectNearestTarget(float dist = 0) const;
+2 -2
View File
@@ -100,11 +100,11 @@ void CreatureAI::MoveInLineOfSight(Unit *who)
if(me->getVictim())
return;
if(me->canStartAttack(who))
if(me->canStartAttack(who, false))
AttackStart(who);
else if(who->getVictim() && me->IsFriendlyTo(who)
&& me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
&& me->canAttack(who->getVictim()))
&& me->canStartAttack(who->getVictim(), true))
AttackStart(who->getVictim());
}
+1
View File
@@ -37,6 +37,7 @@ namespace AIRegistry
void Initialize()
{
(new CreatureAIFactory<NullCreatureAI>("NullCreatureAI"))->RegisterSelf();
(new CreatureAIFactory<TriggerAI>("TriggerAI"))->RegisterSelf();
(new CreatureAIFactory<AggressorAI>("AggressorAI"))->RegisterSelf();
(new CreatureAIFactory<ReactorAI>("ReactorAI"))->RegisterSelf();
(new CreatureAIFactory<PassiveAI>("PassiveAI"))->RegisterSelf();
+8 -3
View File
@@ -60,12 +60,17 @@ namespace FactorySelector
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
else if(creature->isGuard())
ai_factory = ai_registry.GetRegistryItem("GuardAI");
else if(creature->HasSummonMask(SUMMON_MASK_GUARDIAN))
else if(creature->isGuardian())
ai_factory = ai_registry.GetRegistryItem("PetAI");
else if(creature->isTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI");
else if(creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER)
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
else if(creature->isTrigger())
{
if(creature->m_spells[0])
ai_factory = ai_registry.GetRegistryItem("TriggerAI");
else
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
}
else if(creature->GetCreatureType() == CREATURE_TYPE_CRITTER)
ai_factory = ai_registry.GetRegistryItem("CritterAI");
}
+5 -4
View File
@@ -957,11 +957,12 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
}
}
//if (m_creature->isCivilian() && m_creature->IsNeutralToAll())
// return;
if(me->canStartAttack(who))
if(me->canStartAttack(who, false))
AttackStart(who);
else if(who->getVictim() && me->IsFriendlyTo(who)
&& me->IsWithinDistInMap(who, sWorld.getConfig(CONFIG_CREATURE_FAMILY_ASSISTANCE_RADIUS))
&& me->canStartAttack(who->getVictim(), true))
AttackStart(who->getVictim());
}
void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
+4 -4
View File
@@ -45,7 +45,7 @@ FleeingMovementGenerator<T>::_setTargetLocation(T &owner)
if(!_getPoint(owner, x, y, z))
return;
owner.addUnitState(UNIT_STAT_FLEEING);
owner.addUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
Traveller<T> traveller(owner);
i_destinationHolder.SetDestination(traveller, x, y, z);
}
@@ -304,7 +304,7 @@ FleeingMovementGenerator<T>::Initialize(T &owner)
_Init(owner);
owner.CastStop();
owner.addUnitState(UNIT_STAT_FLEEING);
owner.addUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
owner.SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner.SetUInt64Value(UNIT_FIELD_TARGET, 0);
owner.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
@@ -353,7 +353,7 @@ void
FleeingMovementGenerator<T>::Finalize(T &owner)
{
owner.RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING);
owner.clearUnitState(UNIT_STAT_FLEEING);
owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
if(owner.GetTypeId() == TYPEID_UNIT && owner.getVictim())
owner.SetUInt64Value(UNIT_FIELD_TARGET, owner.getVictim()->GetGUID());
}
@@ -413,7 +413,7 @@ template bool FleeingMovementGenerator<Creature>::Update(Creature &, const uint3
void TimedFleeingMovementGenerator::Finalize(Unit &owner)
{
owner.clearUnitState(UNIT_STAT_FLEEING);
owner.clearUnitState(UNIT_STAT_FLEEING | UNIT_STAT_ROAMING);
if (Unit* victim = owner.getVictim())
{
if (owner.isAlive())
+1 -1
View File
@@ -997,7 +997,7 @@ namespace Trinity
}
else
{
if(!m_creature->canStartAttack(u))
if(!m_creature->canStartAttack(u, false))
return false;
}
-6
View File
@@ -53,12 +53,6 @@ bool InstanceData::IsEncounterInProgress() const
return false;
}
//This will be removed in the future, just compitiable with Mangos
void InstanceData::OnCreatureCreate(Creature *creature, bool add)
{
OnCreatureCreate(creature, creature->GetEntry());
}
void InstanceData::LoadMinionData(const MinionData *data)
{
while(data->entry)
-6
View File
@@ -138,12 +138,6 @@ class TRINITY_DLL_SPEC InstanceData : public ZoneScript
//Called when a player successfully enters the instance.
virtual void OnPlayerEnter(Player *) {}
//Called when a gameobject is created
void OnGameObjectCreate(GameObject *go, bool add) { OnObjectCreate(go); }
//called on creature creation
void OnCreatureCreate(Creature *, bool add);
//Handle open / close objects
//use HandleGameObject(NULL,boolen,GO); in OnObjectCreate in instance scripts
//use HandleGameObject(GUID,boolen,NULL); in any other script
+6
View File
@@ -1002,6 +1002,12 @@ bool Item::IsBindedNotWith( Player const* player ) const
bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const
{
if(pUnitTarget->GetTypeId() != TYPEID_UNIT)
return false;
if(pUnitTarget->GetEntry() != m_uiTargetEntry)
return false;
switch(m_uiType)
{
case ITEM_TARGET_TYPE_CREATURE:
+55 -38
View File
@@ -370,16 +370,16 @@ void Map::AddNotifier(T*)
template<>
void Map::AddNotifier(Player* obj)
{
obj->m_Notified = false;
obj->m_IsInNotifyList = false;
//obj->m_Notified = false;
//obj->m_IsInNotifyList = false;
AddUnitToNotify(obj);
}
template<>
void Map::AddNotifier(Creature* obj)
{
obj->m_Notified = false;
obj->m_IsInNotifyList = false;
//obj->m_Notified = false;
//obj->m_IsInNotifyList = false;
AddUnitToNotify(obj);
}
@@ -561,25 +561,21 @@ bool Map::loaded(const GridPair &p) const
void Map::RelocationNotify()
{
//Move backlog to notify list
for(std::vector<uint64>::iterator iter = i_unitsToNotifyBacklog.begin(); iter != i_unitsToNotifyBacklog.end(); ++iter)
{
if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL))
{
i_unitsToNotify.push_back(unit);
}
}
i_unitsToNotifyBacklog.clear();
i_lock = true;
//Notify
for(std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
{
Unit *unit = *iter;
if(unit->m_Notified || !unit->IsInWorld() || unit->GetMapId() != GetId())
if(!unit)
continue;
unit->m_NotifyListPos = -1;
if(unit->m_Notified)
continue;
unit->m_Notified = true;
unit->m_IsInNotifyList = false;
float dist = abs(unit->GetPositionX() - unit->oldX) + abs(unit->GetPositionY() - unit->oldY);
if(dist > 10.0f)
@@ -592,10 +588,10 @@ void Map::RelocationNotify()
if(unit->GetTypeId() == TYPEID_PLAYER)
{
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
if(((Player*)unit)->m_seer != unit)
//if(((Player*)unit)->m_seer != unit)
VisitAll(((Player*)unit)->m_seer->GetPositionX(), ((Player*)unit)->m_seer->GetPositionY(), World::GetMaxVisibleDistance() + dist, notifier);
else
VisitAll(((Player*)unit)->GetPositionX(), ((Player*)unit)->GetPositionY(), World::GetMaxVisibleDistance() + dist, notifier);
//else
//VisitAll(((Player*)unit)->GetPositionX(), ((Player*)unit)->GetPositionY(), World::GetMaxVisibleDistance() + dist, notifier);
notifier.Notify();
}
else
@@ -605,31 +601,55 @@ void Map::RelocationNotify()
}
}
for(std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
{
(*iter)->m_Notified = false;
}
if(*iter)
(*iter)->m_Notified = false;
i_unitsToNotify.clear();
i_lock = false;
if(!i_unitsToNotifyBacklog.empty())
{
i_unitsToNotify.insert(i_unitsToNotify.end(), i_unitsToNotifyBacklog.begin(), i_unitsToNotifyBacklog.end());
i_unitsToNotifyBacklog.clear();
}
}
void Map::AddUnitToNotify(Unit* u)
{
if(u->m_IsInNotifyList)
return;
if(u->m_NotifyListPos < 0)
{
u->oldX = u->GetPositionX();
u->oldY = u->GetPositionY();
u->m_IsInNotifyList = true;
u->oldX = u->GetPositionX();
u->oldY = u->GetPositionY();
if(i_lock)
{
u->m_NotifyListPos = i_unitsToNotifyBacklog.size();
i_unitsToNotifyBacklog.push_back(u);
}
else
{
u->m_NotifyListPos = i_unitsToNotify.size();
i_unitsToNotify.push_back(u);
}
}
}
void Map::RemoveUnitFromNotify(int32 slot)
{
if(i_lock)
i_unitsToNotifyBacklog.push_back(u->GetGUID());
{
assert(slot < i_unitsToNotifyBacklog.size());
i_unitsToNotifyBacklog[slot] = NULL;
}
else
i_unitsToNotify.push_back(u);
{
assert(slot < i_unitsToNotify.size());
i_unitsToNotify[slot] = NULL;
}
}
void Map::Update(const uint32 &t_diff)
{
i_lock = false;
resetMarkedCells();
Trinity::ObjectUpdater updater(t_diff);
@@ -734,10 +754,7 @@ void Map::Update(const uint32 &t_diff)
}
}
i_lock = true;
MoveAllCreaturesInMoveList();
RelocationNotify();
RemoveAllObjectsInRemoveList();
// Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load !
@@ -2109,11 +2126,11 @@ inline void Map::setNGrid(NGridType *grid, uint32 x, uint32 y)
i_grids[x][y] = grid;
}
void Map::DoDelayedMovesAndRemoves()
{
MoveAllCreaturesInMoveList();
RemoveAllObjectsInRemoveList();
}
//void Map::DoDelayedMovesAndRemoves()
//{
//MoveAllCreaturesInMoveList();
//RemoveAllObjectsInRemoveList();
//}
void Map::AddObjectToRemoveList(WorldObject *obj)
{
+4 -3
View File
@@ -340,6 +340,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
virtual void MoveAllCreaturesInMoveList();
virtual void RemoveAllObjectsInRemoveList();
virtual void RelocationNotify();
bool CreatureRespawnRelocation(Creature *c); // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader
@@ -373,7 +374,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
void AddObjectToRemoveList(WorldObject *obj);
void AddObjectToSwitchList(WorldObject *obj, bool on);
void DoDelayedMovesAndRemoves();
//void DoDelayedMovesAndRemoves();
virtual bool RemoveBones(uint64 guid, float x, float y);
@@ -388,7 +389,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
bool ActiveObjectsNearGrid(uint32 x, uint32 y) const;
void AddUnitToNotify(Unit* unit);
void RelocationNotify();
void RemoveUnitFromNotify(int32 slot);
void SendToPlayers(WorldPacket const* data) const;
@@ -496,7 +497,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
time_t i_gridExpiry;
bool i_lock;
std::vector<uint64> i_unitsToNotifyBacklog;
std::vector<Unit*> i_unitsToNotifyBacklog;
std::vector<Unit*> i_unitsToNotify;
std::set<WorldObject *> i_objectsToRemove;
std::map<WorldObject*, bool> i_objectsToSwitch;
+6
View File
@@ -77,6 +77,12 @@ void MapInstanced::RemoveAllObjectsInRemoveList()
Map::RemoveAllObjectsInRemoveList();
}
void MapInstanced::RelocationNotify()
{
for (InstancedMaps::iterator i = m_InstancedMaps.begin(); i != m_InstancedMaps.end(); ++i)
i->second->RelocationNotify();
}
bool MapInstanced::RemoveBones(uint64 guid, float x, float y)
{
bool remove_result = false;
+1
View File
@@ -37,6 +37,7 @@ class TRINITY_DLL_DECL MapInstanced : public Map
void Update(const uint32&);
void MoveAllCreaturesInMoveList();
void RemoveAllObjectsInRemoveList();
void RelocationNotify();
bool RemoveBones(uint64 guid, float x, float y);
void UnloadAll();
bool CanEnter(Player* player);
+1 -1
View File
@@ -270,7 +270,7 @@ MapManager::Update(uint32 diff)
void MapManager::DoDelayedMovesAndRemoves()
{
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
iter->second->DoDelayedMovesAndRemoves();
iter->second->RelocationNotify();
}
bool MapManager::ExistMapAndVMap(uint32 mapid, float x,float y)
+11
View File
@@ -20,6 +20,7 @@
#include "NullCreatureAI.h"
#include "Creature.h"
#include "TemporarySummon.h"
void PassiveAI::UpdateAI(const uint32)
{
@@ -68,3 +69,13 @@ void CritterAI::EnterEvadeMode()
me->SetControlled(false, UNIT_STAT_FLEEING);
CreatureAI::EnterEvadeMode();
}
void TriggerAI::UpdateAI(const uint32 diff)
{
if(!casted)
{
casted = true;
if(me->m_spells[0] && me->isSummon())
me->CastSpell(me, me->m_spells[0], false, 0, 0, ((TempSummon*)me)->GetSummonerGUID());
}
}
+9
View File
@@ -75,5 +75,14 @@ class TRINITY_DLL_DECL CritterAI : public PassiveAI
void EnterEvadeMode();
};
class TRINITY_DLL_DECL TriggerAI : public NullCreatureAI
{
public:
explicit TriggerAI(Creature *c) : NullCreatureAI(c), casted(false) {}
void UpdateAI(const uint32);
private:
bool casted;
};
#endif
+2 -2
View File
@@ -204,12 +204,12 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
case SUMMON_PET:
petlevel=owner->getLevel();
SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x800); //class=mage
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
// this enables popup window (pet dismiss, cancel)
break;
case HUNTER_PET:
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100);
SetUInt32Value(UNIT_FIELD_BYTES_0, 0x02020100); //class=warrior,gender=none,power=focus
SetSheath(SHEATH_STATE_MELEE);
SetByteValue(UNIT_FIELD_BYTES_2, 2, fields[9].GetBool() ? UNIT_RENAME_NOT_ALLOWED : UNIT_RENAME_ALLOWED);
+1 -1
View File
@@ -6489,7 +6489,7 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
return;
// not apply mods for broken item
if(item->IsBroken() && apply)
if(item->IsBroken())
return;
ItemPrototype const *proto = item->GetProto();
+12 -9
View File
@@ -176,12 +176,22 @@ void TempSummon::InitStats(uint32 duration)
if(m_type == TEMPSUMMON_MANUAL_DESPAWN)
m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Unit *owner = GetSummoner();
if(owner && isTrigger() && m_spells[0])
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
if(owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
}
if(!m_Properties)
return;
if(uint32 slot = m_Properties->Slot)
if(owner)
{
if(Unit *owner = GetSummoner())
if(uint32 slot = m_Properties->Slot)
{
if(owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())
{
@@ -204,13 +214,6 @@ void TempSummon::InitSummon()
{
if(owner->GetTypeId()==TYPEID_UNIT && ((Creature*)owner)->IsAIEnabled)
((Creature*)owner)->AI()->JustSummoned(this);
if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER && m_spells[0])
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
CastSpell(this, m_spells[0], false, 0, 0, m_summonerGUID);
}
}
}
+15 -10
View File
@@ -80,7 +80,7 @@ static bool procPrepared = InitTriggerAuraData();
Unit::Unit()
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this)
, m_IsInNotifyList(false), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false)
, m_NotifyListPos(-1), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false)
, i_AI(NULL), i_disabledAI(NULL), m_removedAurasCount(0), m_Vehicle(NULL), m_transport(NULL)
, m_ControlledByPlayer(false), m_procDeep(0)
{
@@ -10450,8 +10450,7 @@ void Unit::SetVisibility(UnitVisibility x)
{
m_Visibility = x;
if(IsInWorld())
SetToNotify();
SetToNotify();
if(x == VISIBILITY_GROUP_STEALTH)
DestroyForNearbyPlayers();
@@ -11685,7 +11684,8 @@ void Unit::AddToWorld()
{
WorldObject::AddToWorld();
m_Notified = false;
m_IsInNotifyList = false;
//assert(m_NotifyListPos < 0); instance : crash
m_NotifyListPos = -1;
SetToNotify();
}
}
@@ -11704,6 +11704,12 @@ void Unit::RemoveFromWorld()
RemoveNotOwnSingleTargetAuras();
ExitVehicle();
if(m_NotifyListPos >= 0)
{
GetMap()->RemoveUnitFromNotify(m_NotifyListPos);
m_NotifyListPos = -1;
}
if(GetCharmerGUID())
{
sLog.outCrash("Unit %u has charmer guid when removed from world", GetEntry());
@@ -13229,11 +13235,9 @@ bool Unit::HandleAuraRaidProcFromCharge( AuraEffect* triggeredByAura )
void Unit::SetToNotify()
{
if(m_IsInNotifyList)
return;
if(Map *map = GetMap())
map->AddUnitToNotify(this);
// it is called somewhere when obj is not in world (crash when log in instance)
if(m_NotifyListPos < 0)
GetMap()->AddUnitToNotify(this);
}
void Unit::Kill(Unit *pVictim, bool durabilityLoss)
@@ -13668,7 +13672,7 @@ void Unit::SetCharmedBy(Unit* charmer, CharmType type)
if(cinfo && cinfo->type == CREATURE_TYPE_DEMON)
{
//to prevent client crash
//SetFlag(UNIT_FIELD_BYTES_0, 2048);
SetByteValue(UNIT_FIELD_BYTES_0, 1, (uint8)CLASS_MAGE);
//just to enable stat window
if(GetCharmInfo())
@@ -13763,6 +13767,7 @@ void Unit::RemoveCharmedBy(Unit *charmer)
CreatureInfo const *cinfo = ((Creature*)this)->GetCreatureInfo();
if(cinfo && cinfo->type == CREATURE_TYPE_DEMON)
{
SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class));
if(GetCharmInfo())
GetCharmInfo()->SetPetNumber(0, true);
else
+2 -1
View File
@@ -1722,7 +1722,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
// relocation notification
void SetToNotify();
bool m_Notified, m_IsInNotifyList;
bool m_Notified;
int32 m_NotifyListPos;
float oldX, oldY;
void SetReducedThreatPercent(uint32 pct, uint64 guid)
+22 -28
View File
@@ -1500,7 +1500,7 @@ void World::SetInitialWorldSettings()
LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " UI64FMTD ", '%s', 0)",
realmID, uint64(m_startTime), isoDate);
m_timers[WUPDATE_OBJECTS].SetInterval(0);
m_timers[WUPDATE_OBJECTS].SetInterval(IN_MILISECONDS/2);
m_timers[WUPDATE_SESSIONS].SetInterval(0);
m_timers[WUPDATE_WEATHERS].SetInterval(1*IN_MILISECONDS);
m_timers[WUPDATE_AUCTIONS].SetInterval(MINUTE*IN_MILISECONDS);
@@ -1698,14 +1698,9 @@ void World::Update(uint32 diff)
auctionmgr.Update();
}
RecordTimeDiff(NULL);
/// <li> Handle session updates when the timer has passed
if (m_timers[WUPDATE_SESSIONS].Passed())
{
m_timers[WUPDATE_SESSIONS].Reset();
UpdateSessions(diff);
}
RecordTimeDiff(NULL);
UpdateSessions(diff);
RecordTimeDiff("UpdateSessions");
/// <li> Handle weather updates when the timer has passed
@@ -1754,26 +1749,29 @@ void World::Update(uint32 diff)
}
/// <li> Handle all other objects
if (m_timers[WUPDATE_OBJECTS].Passed())
///- Update objects when the timer has passed (maps, transport, creatures,...)
MapManager::Instance().Update(diff); // As interval = 0
if(m_timers[WUPDATE_OBJECTS].Passed())
{
m_timers[WUPDATE_OBJECTS].Reset();
///- Update objects when the timer has passed (maps, transport, creatures,...)
MapManager::Instance().Update(diff); // As interval = 0
RecordTimeDiff(NULL);
///- Process necessary scripts
if (!m_scriptSchedule.empty())
ScriptsProcess();
RecordTimeDiff("UpdateScriptsProcess");
sBattleGroundMgr.Update(diff);
RecordTimeDiff("UpdateBattleGroundMgr");
sOutdoorPvPMgr.Update(diff);
RecordTimeDiff("UpdateOutdoorPvPMgr");
MapManager::Instance().DoDelayedMovesAndRemoves();
}
RecordTimeDiff(NULL);
///- Process necessary scripts
if (!m_scriptSchedule.empty())
{
RecordTimeDiff(NULL);
ScriptsProcess();
RecordTimeDiff("UpdateScriptsProcess");
}
sBattleGroundMgr.Update(diff);
RecordTimeDiff("UpdateBattleGroundMgr");
sOutdoorPvPMgr.Update(diff);
RecordTimeDiff("UpdateOutdoorPvPMgr");
// execute callbacks from sql queries that were queued recently
UpdateResultQueue();
RecordTimeDiff("UpdateResultQueue");
@@ -1795,10 +1793,6 @@ void World::Update(uint32 diff)
m_timers[WUPDATE_EVENTS].Reset();
}
/// </ul>
///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove"
//MapManager::Instance().DoDelayedMovesAndRemoves();
// update the instance reset times
sInstanceSaveManager.Update();