Merge
--HG-- branch : trunk
This commit is contained in:
@@ -528,9 +528,10 @@ void AuctionHouseObject::Update()
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
vector<uint32>::iterator iter = expiredAuctions.begin();
|
||||
while (!expiredAuctions.empty())
|
||||
{
|
||||
vector<uint32>::iterator iter = expiredAuctions.begin();
|
||||
|
||||
// from auctionhousehandler.cpp, creates auction pointer & player pointer
|
||||
AuctionEntry* auction = GetAuction(*iter);
|
||||
|
||||
|
||||
+32
-32
@@ -703,7 +703,7 @@ void Map::Update(const uint32 &t_diff)
|
||||
plr->Update(t_diff);
|
||||
|
||||
m_notifyTimer.Update(t_diff);
|
||||
if(m_notifyTimer.Passed())
|
||||
if (m_notifyTimer.Passed())
|
||||
{
|
||||
m_notifyTimer.Reset();
|
||||
RelocationNotify();
|
||||
@@ -799,7 +799,7 @@ void Map::Update(const uint32 &t_diff)
|
||||
// marked cells are those that have been visited
|
||||
// don't visit the same cell twice
|
||||
uint32 cell_id = (y * TOTAL_NUMBER_OF_CELLS_PER_MAP) + x;
|
||||
if(!isCellMarked(cell_id))
|
||||
if (!isCellMarked(cell_id))
|
||||
{
|
||||
markCell(cell_id);
|
||||
CellPair pair(x,y);
|
||||
@@ -837,7 +837,7 @@ void Map::Remove(Player *player, bool remove)
|
||||
else
|
||||
{
|
||||
Cell cell(p);
|
||||
if( !getNGrid(cell.data.Part.grid_x, cell.data.Part.grid_y) )
|
||||
if (!getNGrid(cell.data.Part.grid_x, cell.data.Part.grid_y))
|
||||
sLog.outError("Map::Remove() i_grids was NULL x:%d, y:%d",cell.data.Part.grid_x,cell.data.Part.grid_y);
|
||||
else
|
||||
{
|
||||
@@ -850,7 +850,7 @@ void Map::Remove(Player *player, bool remove)
|
||||
}
|
||||
}
|
||||
|
||||
if( remove )
|
||||
if (remove)
|
||||
DeleteFromWorld(player);
|
||||
}
|
||||
|
||||
@@ -859,7 +859,7 @@ bool Map::RemoveBones(uint64 guid, float x, float y)
|
||||
if (IsRemovalGrid(x, y))
|
||||
{
|
||||
Corpse * corpse = ObjectAccessor::Instance().GetObjectInWorld(GetId(), x, y, guid, (Corpse*)NULL);
|
||||
if(corpse && corpse->GetTypeId() == TYPEID_CORPSE && corpse->GetType() == CORPSE_BONES)
|
||||
if (corpse && corpse->GetTypeId() == TYPEID_CORPSE && corpse->GetType() == CORPSE_BONES)
|
||||
corpse->DeleteBonesFromWorld();
|
||||
else
|
||||
return false;
|
||||
@@ -872,20 +872,20 @@ void
|
||||
Map::Remove(T *obj, bool remove)
|
||||
{
|
||||
obj->RemoveFromWorld();
|
||||
if(obj->isActiveObject())
|
||||
if (obj->isActiveObject())
|
||||
RemoveFromActive(obj);
|
||||
|
||||
CellPair p = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
|
||||
if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP )
|
||||
if (p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP)
|
||||
sLog.outError("Map::Remove: Object " I64FMT " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
|
||||
else
|
||||
{
|
||||
Cell cell(p);
|
||||
if(loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||
if (loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)))
|
||||
{
|
||||
DEBUG_LOG("Remove object " I64FMT " from grid[%u,%u]", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y);
|
||||
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
|
||||
assert( grid != NULL );
|
||||
assert(grid != NULL);
|
||||
|
||||
RemoveFromGrid(obj,grid,cell);
|
||||
UpdateObjectVisibility(obj,cell,p);
|
||||
@@ -894,7 +894,7 @@ Map::Remove(T *obj, bool remove)
|
||||
|
||||
obj->ResetMap();
|
||||
|
||||
if( remove )
|
||||
if (remove)
|
||||
{
|
||||
// if option set then object already saved at this moment
|
||||
if(!sWorld.getConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
|
||||
@@ -918,17 +918,17 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati
|
||||
|
||||
player->Relocate(x, y, z, orientation);
|
||||
|
||||
if( old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell) )
|
||||
if (old_cell.DiffGrid(new_cell) || old_cell.DiffCell(new_cell))
|
||||
{
|
||||
DEBUG_LOG("Player %s relocation grid[%u,%u]cell[%u,%u]->grid[%u,%u]cell[%u,%u]", player->GetName(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
|
||||
|
||||
// update player position for group at taxi flight
|
||||
if(player->GetGroup() && player->isInFlight())
|
||||
if (player->GetGroup() && player->isInFlight())
|
||||
player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_POSITION);
|
||||
|
||||
NGridType* oldGrid = getNGrid(old_cell.GridX(), old_cell.GridY());
|
||||
RemoveFromGrid(player, oldGrid,old_cell);
|
||||
if( !old_cell.DiffGrid(new_cell) )
|
||||
if (!old_cell.DiffGrid(new_cell))
|
||||
AddToGrid(player, oldGrid,new_cell);
|
||||
else
|
||||
EnsureGridLoadedAtEnter(new_cell, player);
|
||||
@@ -937,7 +937,7 @@ Map::PlayerRelocation(Player *player, float x, float y, float z, float orientati
|
||||
AddUnitToNotify(player);
|
||||
|
||||
NGridType* newGrid = getNGrid(new_cell.GridX(), new_cell.GridY());
|
||||
if( !same_cell && newGrid->GetGridState()!= GRID_STATE_ACTIVE )
|
||||
if (!same_cell && newGrid->GetGridState()!= GRID_STATE_ACTIVE)
|
||||
{
|
||||
ResetGridExpiry(*newGrid, 0.1f);
|
||||
newGrid->SetGridState(GRID_STATE_ACTIVE);
|
||||
@@ -955,13 +955,13 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang
|
||||
Cell new_cell(new_val);
|
||||
|
||||
// delay creature move for grid/cell to grid/cell moves
|
||||
if( old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell) )
|
||||
if (old_cell.DiffCell(new_cell) || old_cell.DiffGrid(new_cell))
|
||||
{
|
||||
#ifdef TRINITY_DEBUG
|
||||
if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
|
||||
if ((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES) == 0)
|
||||
sLog.outDebug("Creature (GUID: %u Entry: %u) added to moving list from grid[%u,%u]cell[%u,%u] to grid[%u,%u]cell[%u,%u].", creature->GetGUIDLow(), creature->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
|
||||
#endif
|
||||
AddCreatureToMoveList(creature,x,y,z,ang);
|
||||
AddCreatureToMoveList(creature, x, y, z, ang);
|
||||
// in diffcell/diffgrid case notifiers called at finishing move creature in Map::MoveAllCreaturesInMoveList
|
||||
}
|
||||
else
|
||||
@@ -970,12 +970,12 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang
|
||||
AddUnitToNotify(creature);
|
||||
}
|
||||
|
||||
if(creature->IsVehicle())
|
||||
if (creature->IsVehicle())
|
||||
{
|
||||
for (SeatMap::iterator itr = creature->GetVehicleKit()->m_Seats.begin(); itr != creature->GetVehicleKit()->m_Seats.end(); ++itr)
|
||||
if(Unit *passenger = itr->second.passenger)
|
||||
if (Unit *passenger = itr->second.passenger)
|
||||
{
|
||||
if(passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
PlayerRelocation((Player*)passenger,
|
||||
x + passenger->m_movementInfo.t_x,
|
||||
y + passenger->m_movementInfo.t_y,
|
||||
@@ -995,15 +995,15 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang
|
||||
|
||||
void Map::AddCreatureToMoveList(Creature *c, float x, float y, float z, float ang)
|
||||
{
|
||||
if(!c)
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
i_creaturesToMove[c] = CreatureMover(x,y,z,ang);
|
||||
i_creaturesToMove[c] = CreatureMover(x, y, z, ang);
|
||||
}
|
||||
|
||||
void Map::MoveAllCreaturesInMoveList()
|
||||
{
|
||||
while(!i_creaturesToMove.empty())
|
||||
while (!i_creaturesToMove.empty())
|
||||
{
|
||||
// get data and remove element;
|
||||
CreatureMoveList::iterator iter = i_creaturesToMove.begin();
|
||||
@@ -1016,7 +1016,7 @@ void Map::MoveAllCreaturesInMoveList()
|
||||
Cell new_cell(new_val);
|
||||
|
||||
// do move or do move to respawn or remove creature if previous all fail
|
||||
if(CreatureCellRelocation(c,new_cell))
|
||||
if (CreatureCellRelocation(c,new_cell))
|
||||
{
|
||||
// update pos
|
||||
c->Relocate(cm.x, cm.y, cm.z, cm.ang);
|
||||
@@ -1027,12 +1027,12 @@ void Map::MoveAllCreaturesInMoveList()
|
||||
{
|
||||
// if creature can't be move in new cell/grid (not loaded) move it to repawn cell/grid
|
||||
// creature coordinates will be updated and notifiers send
|
||||
if(!CreatureRespawnRelocation(c))
|
||||
if (!CreatureRespawnRelocation(c))
|
||||
{
|
||||
// ... or unload (if respawn grid also not loaded)
|
||||
#ifdef TRINITY_DEBUG
|
||||
if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
|
||||
sLog.outDebug("Creature (GUID: %u Entry: %u ) can't be move to unloaded respawn grid.",c->GetGUIDLow(),c->GetEntry());
|
||||
if ((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES) == 0)
|
||||
sLog.outDebug("Creature (GUID: %u Entry: %u) can't be move to unloaded respawn grid.",c->GetGUIDLow(),c->GetEntry());
|
||||
#endif
|
||||
AddObjectToRemoveList(c);
|
||||
}
|
||||
@@ -1043,10 +1043,10 @@ void Map::MoveAllCreaturesInMoveList()
|
||||
bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
|
||||
{
|
||||
Cell const& old_cell = c->GetCurrentCell();
|
||||
if(!old_cell.DiffGrid(new_cell) ) // in same grid
|
||||
if (!old_cell.DiffGrid(new_cell)) // in same grid
|
||||
{
|
||||
// if in same cell then none do
|
||||
if(old_cell.DiffCell(new_cell))
|
||||
if (old_cell.DiffCell(new_cell))
|
||||
{
|
||||
#ifdef TRINITY_DEBUG
|
||||
if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
|
||||
@@ -1068,7 +1068,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
|
||||
}
|
||||
|
||||
// in diff. grids but active creature
|
||||
if(c->isActiveObject())
|
||||
if (c->isActiveObject())
|
||||
{
|
||||
EnsureGridLoadedAtEnter(new_cell);
|
||||
|
||||
@@ -1084,7 +1084,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
|
||||
}
|
||||
|
||||
// in diff. loaded grid normal creature
|
||||
if(loaded(GridPair(new_cell.GridX(), new_cell.GridY())))
|
||||
if (loaded(GridPair(new_cell.GridX(), new_cell.GridY())))
|
||||
{
|
||||
#ifdef TRINITY_DEBUG
|
||||
if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
|
||||
@@ -1100,7 +1100,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell)
|
||||
|
||||
// fail to move: normal creature attempt move to unloaded grid
|
||||
#ifdef TRINITY_DEBUG
|
||||
if((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES)==0)
|
||||
if ((sLog.getLogFilter() & LOG_FILTER_CREATURE_MOVES) == 0)
|
||||
sLog.outDebug("Creature (GUID: %u Entry: %u) attempt move from grid[%u,%u]cell[%u,%u] to unloaded grid[%u,%u]cell[%u,%u].", c->GetGUIDLow(), c->GetEntry(), old_cell.GridX(), old_cell.GridY(), old_cell.CellX(), old_cell.CellY(), new_cell.GridX(), new_cell.GridY(), new_cell.CellX(), new_cell.CellY());
|
||||
#endif
|
||||
return false;
|
||||
|
||||
+4
-4
@@ -293,15 +293,15 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
||||
//function for setting up visibility distance for maps on per-type/per-Id basis
|
||||
virtual void InitVisibilityDistance();
|
||||
|
||||
void PlayerRelocation(Player *, float x, float y, float z, float angl);
|
||||
void CreatureRelocation(Creature *creature, float x, float y, float, float);
|
||||
void PlayerRelocation(Player *, float x, float y, float z, float orientation);
|
||||
void CreatureRelocation(Creature *creature, float x, float y, float z, float ang);
|
||||
|
||||
template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &cell, TypeContainerVisitor<T, CONTAINER> &visitor);
|
||||
|
||||
bool IsRemovalGrid(float x, float y) const
|
||||
{
|
||||
GridPair p = Trinity::ComputeGridPair(x, y);
|
||||
return( !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL );
|
||||
return !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL;
|
||||
}
|
||||
|
||||
bool GetUnloadLock(const GridPair &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); }
|
||||
@@ -312,7 +312,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
||||
|
||||
void ResetGridExpiry(NGridType &grid, float factor = 1) const
|
||||
{
|
||||
grid.ResetTimeTracker((time_t)((float)i_gridExpiry*factor));
|
||||
grid.ResetTimeTracker(time_t(float(i_gridExpiry)*factor));
|
||||
}
|
||||
|
||||
time_t GetGridExpiry(void) const { return i_gridExpiry; }
|
||||
|
||||
+1
-1
@@ -1468,7 +1468,7 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SOUND, 4);
|
||||
data << Sound;
|
||||
if (OnlySelf && GetTypeId() == TYPEID_PLAYER )
|
||||
if (OnlySelf && GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->GetSession()->SendPacket( &data );
|
||||
else
|
||||
SendMessageToSet( &data, true ); // ToSelf ignored in this case
|
||||
|
||||
+3
-3
@@ -1252,7 +1252,7 @@ void Player::Update( uint32 p_time )
|
||||
else
|
||||
{
|
||||
// prevent base and off attack in same time, delay attack at 0.2 sec
|
||||
if(getAttackTimer(BASE_ATTACK) < ATTACK_DISPLAY_DELAY)
|
||||
if (getAttackTimer(BASE_ATTACK) < ATTACK_DISPLAY_DELAY)
|
||||
setAttackTimer(BASE_ATTACK,ATTACK_DISPLAY_DELAY);
|
||||
|
||||
// do attack
|
||||
@@ -1372,9 +1372,9 @@ void Player::Update( uint32 p_time )
|
||||
}
|
||||
|
||||
// not auto-free ghost from body in instances
|
||||
#pragma omp critical(UpdateThreadSafety)
|
||||
if(m_deathTimer > 0 && !GetBaseMap()->Instanceable())
|
||||
{
|
||||
#pragma omp critical(UpdateThreadSafety)
|
||||
if(p_time >= m_deathTimer)
|
||||
{
|
||||
m_deathTimer = 0;
|
||||
@@ -1392,7 +1392,7 @@ void Player::Update( uint32 p_time )
|
||||
SendUpdateToOutOfRangeGroupMembers();
|
||||
|
||||
Pet* pet = GetPet();
|
||||
if(pet && !IsWithinDistInMap(pet, OWNER_MAX_DISTANCE) && !pet->isPossessed())
|
||||
if (pet && !IsWithinDistInMap(pet, OWNER_MAX_DISTANCE) && !pet->isPossessed())
|
||||
//if(pet && !IsWithinDistInMap(pet, OWNER_MAX_DISTANCE) && (GetCharmGUID() && (pet->GetGUID() != GetCharmGUID())))
|
||||
RemovePet(pet, PET_SAVE_NOT_IN_SLOT, true);
|
||||
|
||||
|
||||
+29
-31
@@ -850,10 +850,10 @@ void Spell::CleanupTargetList()
|
||||
|
||||
void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
|
||||
{
|
||||
if( m_spellInfo->Effect[effIndex] == 0 )
|
||||
if (m_spellInfo->Effect[effIndex] == 0)
|
||||
return;
|
||||
|
||||
if(!CheckTarget(pVictim, effIndex))
|
||||
if (!CheckTarget(pVictim, effIndex))
|
||||
return;
|
||||
|
||||
// Check for effect immune skip if immuned
|
||||
@@ -898,7 +898,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
|
||||
}
|
||||
|
||||
// Calculate hit result
|
||||
if(m_originalCaster)
|
||||
if (m_originalCaster)
|
||||
{
|
||||
target.missCondition = m_originalCaster->SpellHitResult(pVictim, m_spellInfo, m_canReflect);
|
||||
if(m_skipCheck && target.missCondition != SPELL_MISS_IMMUNE)
|
||||
@@ -945,8 +945,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
|
||||
|
||||
void Spell::AddUnitTarget(uint64 unitGUID, uint32 effIndex)
|
||||
{
|
||||
Unit* unit = m_caster->GetGUID() == unitGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, unitGUID);
|
||||
if (unit)
|
||||
if (Unit* unit = m_caster->GetGUID() == unitGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, unitGUID))
|
||||
AddUnitTarget(unit, effIndex);
|
||||
}
|
||||
|
||||
@@ -2128,25 +2127,25 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
|
||||
case TARGET_TYPE_CHANNEL:
|
||||
{
|
||||
if(!m_originalCaster || !m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
if (!m_originalCaster || !m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
{
|
||||
sLog.outError( "SPELL: no current channeled spell for spell ID %u", m_spellInfo->Id );
|
||||
break;
|
||||
}
|
||||
|
||||
switch(cur)
|
||||
switch (cur)
|
||||
{
|
||||
case TARGET_UNIT_CHANNEL:
|
||||
// in some cases unittarget is invalid and crash. do not know why it happens.
|
||||
if(Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID()))
|
||||
if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID()))
|
||||
AddUnitTarget(target, i);
|
||||
else
|
||||
sLog.outError( "SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id );
|
||||
break;
|
||||
case TARGET_DEST_CHANNEL:
|
||||
if(m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.HasDst())
|
||||
if (m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.HasDst())
|
||||
m_targets = m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets;
|
||||
else if(Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID()))
|
||||
else if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.getUnitTargetGUID()))
|
||||
m_targets.setDst(target);
|
||||
else
|
||||
sLog.outError( "SPELL: cannot find channel spell destination for spell ID %u", m_spellInfo->Id );
|
||||
@@ -2157,7 +2156,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
|
||||
default:
|
||||
{
|
||||
switch(cur)
|
||||
switch (cur)
|
||||
{
|
||||
case TARGET_GAMEOBJECT:
|
||||
case TARGET_OBJECT_USE:
|
||||
@@ -2165,9 +2164,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
AddGOTarget(m_targets.getGOTarget(), i);
|
||||
break;
|
||||
case TARGET_GAMEOBJECT_ITEM:
|
||||
if(m_targets.getGOTargetGUID())
|
||||
if (m_targets.getGOTargetGUID())
|
||||
AddGOTarget(m_targets.getGOTarget(), i);
|
||||
else if(m_targets.getItemTarget())
|
||||
else if (m_targets.getItemTarget())
|
||||
AddItemTarget(m_targets.getItemTarget(), i);
|
||||
break;
|
||||
default:
|
||||
@@ -2178,10 +2177,10 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
}
|
||||
}
|
||||
|
||||
if(pushType == PUSH_CHAIN) // Chain
|
||||
if (pushType == PUSH_CHAIN) // Chain
|
||||
{
|
||||
Unit *target = m_targets.getUnitTarget();
|
||||
if(!target)
|
||||
if (!target)
|
||||
{
|
||||
sLog.outError("SPELL: no chain unit target for spell ID %u", m_spellInfo->Id);
|
||||
return;
|
||||
@@ -2189,10 +2188,10 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
|
||||
//Chain: 2, 6, 22, 25, 45, 77
|
||||
uint32 maxTargets = m_spellInfo->EffectChainTarget[i];
|
||||
if(modOwner)
|
||||
if (modOwner)
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, maxTargets, this);
|
||||
|
||||
if(maxTargets > 1)
|
||||
if (maxTargets > 1)
|
||||
{
|
||||
//otherwise, this multiplier is used for something else
|
||||
m_damageMultipliers[i] = 1.0f;
|
||||
@@ -2201,13 +2200,13 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
float range;
|
||||
std::list<Unit*> unitList;
|
||||
|
||||
switch(cur)
|
||||
switch (cur)
|
||||
{
|
||||
case TARGET_UNIT_NEARBY_ENEMY:
|
||||
case TARGET_UNIT_TARGET_ENEMY:
|
||||
case TARGET_UNIT_NEARBY_ENTRY: // fix me
|
||||
range = GetSpellMaxRange(m_spellInfo, false);
|
||||
if(modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
|
||||
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
|
||||
SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_ENEMY);
|
||||
break;
|
||||
case TARGET_UNIT_CHAINHEAL:
|
||||
@@ -2215,7 +2214,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
case TARGET_UNIT_NEARBY_ALLY_UNK:
|
||||
case TARGET_UNIT_NEARBY_RAID:
|
||||
range = GetSpellMaxRange(m_spellInfo, true);
|
||||
if(modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
|
||||
if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this);
|
||||
SearchChainTarget(unitList, range, maxTargets, SPELL_TARGETS_CHAINHEAL);
|
||||
break;
|
||||
}
|
||||
@@ -2226,7 +2225,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
else
|
||||
AddUnitTarget(target, i);
|
||||
}
|
||||
else if(pushType)
|
||||
else if (pushType)
|
||||
{
|
||||
// Dummy, just for client
|
||||
if(EffectTargetType[m_spellInfo->Effect[i]] != SPELL_REQUIRE_UNIT)
|
||||
@@ -2270,7 +2269,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
if(targetType == SPELL_TARGETS_ENTRY)
|
||||
{
|
||||
SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(m_spellInfo->Id);
|
||||
if(bounds.first==bounds.second)
|
||||
if(bounds.first == bounds.second)
|
||||
{
|
||||
// Custom entries
|
||||
// TODO: move these to sql
|
||||
@@ -2279,8 +2278,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
case 46584: // Raise Dead
|
||||
{
|
||||
m_targets.m_targetMask &= ~TARGET_FLAG_DEST_LOCATION;
|
||||
WorldObject* result = FindCorpseUsing<MaNGOS::RaiseDeadObjectCheck> ();
|
||||
if(result)
|
||||
if (WorldObject* result = FindCorpseUsing<MaNGOS::RaiseDeadObjectCheck> ())
|
||||
{
|
||||
switch(result->GetTypeId())
|
||||
{
|
||||
@@ -2309,9 +2307,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
|
||||
WorldObject* result = FindCorpseUsing <Trinity::ExplodeCorpseObjectCheck> ();
|
||||
|
||||
if(result)
|
||||
if (result)
|
||||
{
|
||||
switch(result->GetTypeId())
|
||||
switch (result->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
case TYPEID_PLAYER:
|
||||
@@ -2357,11 +2355,11 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(targetType)
|
||||
else if (targetType)
|
||||
SearchAreaTarget(unitList, radius, pushType, targetType);
|
||||
else
|
||||
{
|
||||
switch(cur)
|
||||
switch (cur)
|
||||
{
|
||||
case TARGET_UNIT_AREA_PARTY_SRC:
|
||||
case TARGET_UNIT_AREA_PARTY_DST:
|
||||
@@ -4292,11 +4290,11 @@ void Spell::HandleThreatSpells(uint32 spellId)
|
||||
void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i)
|
||||
{
|
||||
|
||||
if(!Script->OnSpellCast(pUnitTarget,pItemTarget,pGOTarget,i,m_spellInfo))
|
||||
if (!Script->OnSpellCast(pUnitTarget,pItemTarget,pGOTarget,i,m_spellInfo))
|
||||
return;
|
||||
|
||||
//effect has been handled, skip it
|
||||
if(m_effectMask & (1<<i))
|
||||
if (m_effectMask & (1<<i))
|
||||
return;
|
||||
|
||||
unitTarget = pUnitTarget;
|
||||
@@ -4310,7 +4308,7 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar
|
||||
//we do not need DamageMultiplier here.
|
||||
damage = CalculateDamage(i, NULL);
|
||||
|
||||
if(eff<TOTAL_SPELL_EFFECTS)
|
||||
if(eff < TOTAL_SPELL_EFFECTS)
|
||||
{
|
||||
//sLog.outDebug( "WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff);
|
||||
(this->*SpellEffects[eff])(i);
|
||||
|
||||
+19
-17
@@ -1715,6 +1715,8 @@ void Spell::EffectDummy(uint32 i)
|
||||
if (m_spellInfo->SpellFamilyFlags[1] & 0x20000 && i == 1)
|
||||
{
|
||||
int32 dmg = m_damage * damage / 100;
|
||||
if (!unitTarget)
|
||||
unitTarget = m_caster;
|
||||
m_caster->CastCustomSpell(unitTarget, 54171, &dmg, 0, 0, true);
|
||||
return;
|
||||
}
|
||||
@@ -1722,7 +1724,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
{
|
||||
case 156: // Holy Shock
|
||||
{
|
||||
if(!unitTarget)
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
int hurt = 0;
|
||||
@@ -1742,7 +1744,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_caster->IsFriendlyTo(unitTarget))
|
||||
if (m_caster->IsFriendlyTo(unitTarget))
|
||||
m_caster->CastSpell(unitTarget, heal, true, 0);
|
||||
else
|
||||
m_caster->CastSpell(unitTarget, hurt, true, 0);
|
||||
@@ -1759,11 +1761,11 @@ void Spell::EffectDummy(uint32 i)
|
||||
}
|
||||
case 20425: // Judgement of command
|
||||
{
|
||||
if(!unitTarget)
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
SpellEntry const* spell_proto = sSpellStore.LookupEntry(damage);
|
||||
if(!spell_proto)
|
||||
if (!spell_proto)
|
||||
return;
|
||||
|
||||
m_caster->CastSpell(unitTarget, spell_proto, true, NULL);
|
||||
@@ -1776,7 +1778,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
// non-standard cast requirement check
|
||||
if (!unitTarget || unitTarget->getAttackers().empty())
|
||||
{
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true);
|
||||
SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT);
|
||||
return;
|
||||
@@ -1784,7 +1786,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
|
||||
// Righteous Defense (step 2) (in old version 31980 dummy effect)
|
||||
// Clear targets for eff 1
|
||||
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
|
||||
ihit->effectMask &= ~(1<<1);
|
||||
|
||||
// not empty (checked)
|
||||
@@ -1795,7 +1797,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
uint32 count = 0;
|
||||
for (Unit::AttackerSet::const_iterator aItr = attackers.begin(); aItr != attackers.end() && count < 3; ++aItr)
|
||||
{
|
||||
if(!roll_chance_f(chance))
|
||||
if (!roll_chance_f(chance))
|
||||
continue;
|
||||
++count;
|
||||
AddUnitTarget((*aItr), 1);
|
||||
@@ -1806,7 +1808,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
}
|
||||
case 37877: // Blessing of Faith
|
||||
{
|
||||
if(!unitTarget)
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
uint32 spell_id = 0;
|
||||
@@ -1831,7 +1833,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
// TODO: use expect spell for enchant (if exist talent)
|
||||
// In 3.0.3 no mods present for rockbiter
|
||||
uint32 spell_id = 0;
|
||||
switch(m_spellInfo->Id)
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 8017: spell_id = 36494; break; // Rank 1
|
||||
case 8018: spell_id = 36750; break; // Rank 2
|
||||
@@ -1844,20 +1846,20 @@ void Spell::EffectDummy(uint32 i)
|
||||
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spell_id );
|
||||
|
||||
if(!spellInfo)
|
||||
if (!spellInfo)
|
||||
{
|
||||
sLog.outError("WORLD: unknown spell id %i", spell_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
for (uint8 j = BASE_ATTACK; j <= OFF_ATTACK; ++j)
|
||||
{
|
||||
if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j)))
|
||||
if (Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j)))
|
||||
{
|
||||
if(item->IsFitToSpellRequirements(m_spellInfo))
|
||||
if (item->IsFitToSpellRequirements(m_spellInfo))
|
||||
{
|
||||
Spell *spell = new Spell(m_caster, spellInfo, true);
|
||||
|
||||
@@ -1867,7 +1869,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
spell->m_currentBasePoints[1] = damage-1;
|
||||
|
||||
SpellCastTargets targets;
|
||||
targets.setItemTarget( item );
|
||||
targets.setItemTarget(item);
|
||||
spell->prepare(&targets);
|
||||
}
|
||||
}
|
||||
@@ -1875,7 +1877,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
}
|
||||
// Cleansing Totem Pulse
|
||||
if(m_spellInfo->SpellFamilyFlags[0] & 0x04000000 && m_spellInfo->SpellIconID==1673)
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & 0x04000000 && m_spellInfo->SpellIconID==1673)
|
||||
{
|
||||
int32 bp1 = 1;
|
||||
// Cleansing Totem Effect
|
||||
@@ -1889,9 +1891,9 @@ void Spell::EffectDummy(uint32 i)
|
||||
return;
|
||||
}
|
||||
// Mana Spring Totem
|
||||
if(m_spellInfo->SpellFamilyFlags[0] & 0x4000)
|
||||
if (m_spellInfo->SpellFamilyFlags[0] & 0x4000)
|
||||
{
|
||||
if(unitTarget->getPowerType()!=POWER_MANA)
|
||||
if (unitTarget->getPowerType()!=POWER_MANA)
|
||||
return;
|
||||
m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID);
|
||||
return;
|
||||
|
||||
+10
-10
@@ -255,16 +255,16 @@ void Unit::Update( uint32 p_time )
|
||||
//not implemented before 3.0.2
|
||||
//if(!hasUnitState(UNIT_STAT_CASTING))
|
||||
{
|
||||
if(uint32 base_att = getAttackTimer(BASE_ATTACK))
|
||||
if (uint32 base_att = getAttackTimer(BASE_ATTACK))
|
||||
setAttackTimer(BASE_ATTACK, (p_time >= base_att ? 0 : base_att - p_time));
|
||||
if(uint32 ranged_att = getAttackTimer(RANGED_ATTACK))
|
||||
if (uint32 ranged_att = getAttackTimer(RANGED_ATTACK))
|
||||
setAttackTimer(RANGED_ATTACK, (p_time >= ranged_att ? 0 : ranged_att - p_time));
|
||||
if(uint32 off_att = getAttackTimer(OFF_ATTACK))
|
||||
if (uint32 off_att = getAttackTimer(OFF_ATTACK))
|
||||
setAttackTimer(OFF_ATTACK, (p_time >= off_att ? 0 : off_att - p_time));
|
||||
}
|
||||
|
||||
// update abilities available only for fraction of time
|
||||
UpdateReactives( p_time );
|
||||
UpdateReactives(p_time);
|
||||
|
||||
ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, GetHealth() < GetMaxHealth()*0.20f);
|
||||
ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, GetHealth() < GetMaxHealth()*0.35f);
|
||||
@@ -14880,16 +14880,16 @@ void Unit::ExitVehicle()
|
||||
|
||||
void Unit::BuildMovementPacket(ByteBuffer *data) const
|
||||
{
|
||||
switch(GetTypeId())
|
||||
switch (GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
if(canFly())
|
||||
if (canFly())
|
||||
const_cast<Unit*>(this)->AddUnitMovementFlag(MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_LEVITATING);
|
||||
break;
|
||||
case TYPEID_PLAYER:
|
||||
// remove unknown, unused etc flags for now
|
||||
const_cast<Unit*>(this)->RemoveUnitMovementFlag(MOVEMENTFLAG_SPLINE2);
|
||||
if(isInFlight())
|
||||
if (isInFlight())
|
||||
{
|
||||
WPAssert(const_cast<Unit*>(this)->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
||||
const_cast<Unit*>(this)->AddUnitMovementFlag(MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_SPLINE2);
|
||||
@@ -14906,11 +14906,11 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
|
||||
*data << GetOrientation();
|
||||
|
||||
// 0x00000200
|
||||
if(GetUnitMovementFlags() & MOVEMENTFLAG_ONTRANSPORT)
|
||||
if (GetUnitMovementFlags() & MOVEMENTFLAG_ONTRANSPORT)
|
||||
{
|
||||
if(m_vehicle)
|
||||
if (m_vehicle)
|
||||
data->append(m_vehicle->GetBase()->GetPackGUID());
|
||||
else if(GetTransport())
|
||||
else if (GetTransport())
|
||||
data->append(GetTransport()->GetPackGUID());
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user