aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2011-02-18 19:48:47 +0100
committerShauren <shauren.trinity@gmail.com>2011-02-18 19:48:47 +0100
commit0f34df6e1a5c2272a3a1841978bcb8dfea073449 (patch)
treeb58c2384c53871b08f88ba2db77f54289fabc0cf /src/server/game/Entities
parent6a64c79d2aa169f6d6d385948af3f6737f274133 (diff)
Scripts/Icecrown Citadel: Added support for weekly quest "Deprogramming"
Diffstat (limited to 'src/server/game/Entities')
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.cpp92
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp4
2 files changed, 45 insertions, 51 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 9c8e52fa81b..9a21f57f120 100755
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -317,14 +317,10 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data
SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
// Load creature equipment
- if (!data || data->equipmentId == 0)
- { // use default from the template
+ if (!data || data->equipmentId == 0) // use default from the template
LoadEquipment(cinfo->equipmentId);
- }
- else if (data && data->equipmentId != -1)
- { // override, -1 means no equipment
+ else if (data && data->equipmentId != -1) // override, -1 means no equipment
LoadEquipment(data->equipmentId);
- }
SetName(normalInfo->Name); // at normal entry always
@@ -764,61 +760,59 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
}
//oX = x; oY = y; dX = x; dY = y; m_moveTime = 0; m_startMove = 0;
- const bool bResult = CreateFromProto(guidlow, Entry, vehId, team, data);
+ if (!CreateFromProto(guidlow, Entry, vehId, team, data))
+ return false;
- if (bResult)
+ switch (GetCreatureInfo()->rank)
{
- switch (GetCreatureInfo()->rank)
- {
- case CREATURE_ELITE_RARE:
- m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_RARE);
- break;
- case CREATURE_ELITE_ELITE:
- m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE);
- break;
- case CREATURE_ELITE_RAREELITE:
- m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_RAREELITE);
- break;
- case CREATURE_ELITE_WORLDBOSS:
- m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_WORLDBOSS);
- break;
- default:
- m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_NORMAL);
- break;
- }
- LoadCreaturesAddon();
- CreatureModelInfo const *minfo = sObjectMgr->GetCreatureModelRandomGender(GetNativeDisplayId());
- if (minfo && !isTotem()) // Cancel load if no model defined or if totem
- {
- uint32 display_id = minfo->modelid; // it can be different (for another gender)
+ case CREATURE_ELITE_RARE:
+ m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_RARE);
+ break;
+ case CREATURE_ELITE_ELITE:
+ m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_ELITE);
+ break;
+ case CREATURE_ELITE_RAREELITE:
+ m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_RAREELITE);
+ break;
+ case CREATURE_ELITE_WORLDBOSS:
+ m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_WORLDBOSS);
+ break;
+ default:
+ m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_NORMAL);
+ break;
+ }
- SetDisplayId(display_id);
- SetNativeDisplayId(display_id);
- SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
- }
+ LoadCreaturesAddon();
+ CreatureModelInfo const *minfo = sObjectMgr->GetCreatureModelRandomGender(GetNativeDisplayId());
+ if (minfo && !isTotem()) // Cancel load if no model defined or if totem
+ {
+ uint32 display_id = minfo->modelid; // it can be different (for another gender)
- if (GetCreatureInfo()->InhabitType & INHABIT_AIR)
- {
- if (GetDefaultMovementType() == IDLE_MOTION_TYPE)
- AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
- else
- SetFlying(true);
- }
+ SetDisplayId(display_id);
+ SetNativeDisplayId(display_id);
+ SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
+ }
- if (GetCreatureInfo()->InhabitType & INHABIT_WATER)
- {
- AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
- }
- LastUsedScriptID = GetCreatureInfo()->ScriptID;
+ if (GetCreatureInfo()->InhabitType & INHABIT_AIR)
+ {
+ if (GetDefaultMovementType() == IDLE_MOTION_TYPE)
+ AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
+ else
+ SetFlying(true);
}
+ if (GetCreatureInfo()->InhabitType & INHABIT_WATER)
+ AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
+
+ LastUsedScriptID = GetCreatureInfo()->ScriptID;
+
// TODO: Replace with spell, handle from DB
if (isSpiritHealer())
{
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST);
}
- else if(isSpiritGuide())
+ else if (isSpiritGuide())
{
m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST | GHOST_VISIBILITY_ALIVE);
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST | GHOST_VISIBILITY_ALIVE);
@@ -827,7 +821,7 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
if (Entry == VISUAL_WAYPOINT)
SetVisible(false);
- return bResult;
+ return true;
}
bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 752572151ef..3227e69771a 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -1846,7 +1846,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
{
if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
{
- sLog->outError("TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
+ sLog->outError("TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
mapid, x, y, z, orientation, GetGUIDLow(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
@@ -8045,7 +8045,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
+ sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]);
continue;
}