diff options
-rw-r--r-- | sql/base/world_database.sql | 2 | ||||
-rw-r--r-- | sql/updates/world/2011_06_27_06_world_command.sql | 1 | ||||
-rw-r--r-- | sql/updates/world/2011_06_27_06_world_creature.sql | 4 | ||||
-rwxr-xr-x | src/server/game/Entities/Creature/Creature.cpp | 44 | ||||
-rwxr-xr-x | src/server/game/Entities/Creature/Creature.h | 4 | ||||
-rwxr-xr-x | src/server/game/Globals/ObjectMgr.cpp | 22 | ||||
-rwxr-xr-x | src/server/game/Grids/Notifiers/GridNotifiers.h | 4 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 1 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 32 | ||||
-rw-r--r-- | src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp | 118 | ||||
-rw-r--r-- | src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp | 17 | ||||
-rw-r--r-- | src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h | 1 | ||||
-rwxr-xr-x | src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp | 17 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 2 |
14 files changed, 89 insertions, 180 deletions
diff --git a/sql/base/world_database.sql b/sql/base/world_database.sql index 036937cf1e9..03d6572bff3 100644 --- a/sql/base/world_database.sql +++ b/sql/base/world_database.sql @@ -562,7 +562,6 @@ INSERT INTO `command` VALUES ('npc move',2,'Syntax: .npc move [#creature_guid]\r\n\r\nMove the targeted creature spawn point to your coordinates.'), ('npc playemote',3,'Syntax: .npc playemote #emoteid\r\n\r\nMake the selected creature emote with an emote of id #emoteid.'), ('npc say',1,'Syntax: .npc say $message\nMake selected creature say specified message.'), -('npc set deathstate',2,'Syntax: .npc set deathstate on/off\r\n\r\nSet default death state (dead/alive) for npc at spawn.'), ('npc set link',2,'Syntax: .npc set link $creatureGUID\r\n\r\nLinks respawn of selected creature to the condition that $creatureGUID defined is alive.'), ('npc set model',2,'Syntax: .npc set model #displayid\r\n\r\nChange the model id of the selected creature to #displayid.'), ('npc set movetype',2,'Syntax: .npc set movetype [#creature_guid] stay/random/way [NODEL]\r\n\r\nSet for creature pointed by #creature_guid (or selected if #creature_guid not provided) movement type and move it to respawn position (if creature alive). Any existing waypoints for creature will be removed from the database if you do not use NODEL. If the creature is dead then movement type will applied at creature respawn.\r\nMake sure you use NODEL, if you want to keep the waypoints.'), @@ -822,7 +821,6 @@ CREATE TABLE `creature` ( `currentwaypoint` mediumint(8) unsigned NOT NULL DEFAULT '0', `curhealth` int(10) unsigned NOT NULL DEFAULT '1', `curmana` int(10) unsigned NOT NULL DEFAULT '0', - `DeathState` tinyint(3) unsigned NOT NULL DEFAULT '0', `MovementType` tinyint(3) unsigned NOT NULL DEFAULT '0', `npcflag` int(10) unsigned NOT NULL DEFAULT '0', `unit_flags` int(10) unsigned NOT NULL DEFAULT '0', diff --git a/sql/updates/world/2011_06_27_06_world_command.sql b/sql/updates/world/2011_06_27_06_world_command.sql new file mode 100644 index 00000000000..7b3f1e5765f --- /dev/null +++ b/sql/updates/world/2011_06_27_06_world_command.sql @@ -0,0 +1 @@ +DELETE FROM `command` WHERE `name`= 'npc set deathstate'; diff --git a/sql/updates/world/2011_06_27_06_world_creature.sql b/sql/updates/world/2011_06_27_06_world_creature.sql new file mode 100644 index 00000000000..e4e6d3c98ce --- /dev/null +++ b/sql/updates/world/2011_06_27_06_world_creature.sql @@ -0,0 +1,4 @@ +-- Drop DeathState column +ALTER TABLE `creature` DROP COLUMN `DeathState`; +-- Remove spawns for Kologarn (not boss) and Focused Eyebeam (summoned). +DELETE FROM `creature` WHERE `id` IN (34297,33632,33802); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index e139c96a108..bcca2dcd6e4 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -142,9 +142,8 @@ lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGrou m_PlayerDamageReq(0), m_lootMoney(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), -m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), -m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), m_creatureInfo(NULL), m_creatureData(NULL), -m_formation(NULL) +m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), +m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL) { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; @@ -229,7 +228,7 @@ void Creature::SearchFormation() void Creature::RemoveCorpse(bool setSpawnTime) { - if ((getDeathState() != CORPSE && !m_isDeadByDefault) || (getDeathState() != ALIVE && m_isDeadByDefault)) + if (getDeathState() != CORPSE) return; m_corpseRemoveTime = time(NULL); @@ -471,9 +470,6 @@ void Creature::Update(uint32 diff) } case CORPSE: { - if (m_isDeadByDefault) - break; - if (m_groupLootTimer && lootingGroupLowGUID) { // for delayed spells @@ -504,15 +500,6 @@ void Creature::Update(uint32 diff) } case ALIVE: { - if (m_isDeadByDefault) - { - if (m_corpseRemoveTime <= time(NULL)) - { - RemoveCorpse(false); - sLog->outStaticDebug("Removing alive corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY)); - } - } - Unit::Update(diff); // creature can be dead after Unit::Update call @@ -1082,7 +1069,6 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) data.currentwaypoint = 0; data.curhealth = GetHealth(); data.curmana = GetPower(POWER_MANA); - data.is_dead = m_isDeadByDefault; // prevent add data integrity problems data.movementType = !m_respawnradius && GetDefaultMovementType() == RANDOM_MOTION_TYPE ? IDLE_MOTION_TYPE : GetDefaultMovementType(); @@ -1114,7 +1100,6 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) << (uint32) (0) << ", " //currentwaypoint << GetHealth() << ", " //curhealth << GetPower(POWER_MANA) << ", " //curmana - << (m_isDeadByDefault ? 1 : 0) << ", " //is_dead << GetDefaultMovementType() << ", " //default movement generator type << npcflag << ", " << unit_flags << ", " @@ -1292,8 +1277,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map) m_respawnradius = data->spawndist; m_respawnDelay = data->spawntimesecs; - m_isDeadByDefault = data->is_dead; - m_deathState = m_isDeadByDefault ? DEAD : ALIVE; + m_deathState = ALIVE; m_respawnTime = sObjectMgr->GetCreatureRespawnTime(m_DBTableGuid, GetInstanceId()); if (m_respawnTime) // respawn on Update @@ -1404,7 +1388,7 @@ bool Creature::isVisibleForInState(WorldObject const* seer) const if (!Unit::isVisibleForInState(seer)) return false; - if (isAlive() || (m_isDeadByDefault && m_deathState == CORPSE) || m_corpseRemoveTime > time(NULL)) + if (isAlive() || m_corpseRemoveTime > time(NULL)) return true; return false; @@ -1495,7 +1479,9 @@ float Creature::GetAttackDistance(Unit const* pl) const void Creature::setDeathState(DeathState s) { - if ((s == JUST_DIED && !m_isDeadByDefault)||(s == JUST_ALIVED && m_isDeadByDefault)) + Unit::setDeathState(s); + + if (s == JUST_DIED) { m_corpseRemoveTime = time(NULL) + m_corpseDelay; m_respawnTime = time(NULL) + m_respawnDelay + m_corpseDelay; @@ -1503,11 +1489,7 @@ void Creature::setDeathState(DeathState s) // always save boss respawn time at death to prevent crash cheating if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY) || isWorldBoss()) SaveRespawnTime(); - } - Unit::setDeathState(s); - if (s == JUST_DIED) - { SetUInt64Value(UNIT_FIELD_TARGET, 0); // remove target selection in any cases (can be set at aura remove in Unit::setDeathState) SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); @@ -1608,15 +1590,7 @@ void Creature::Respawn(bool force) CreatureTemplate const *cinfo = GetCreatureInfo(); SelectLevel(cinfo); - if (m_isDeadByDefault) - { - setDeathState(JUST_DIED); - i_motionMaster.Clear(); - ClearUnitState(uint32(UNIT_STAT_ALL_STATE)); - LoadCreaturesAddon(true); - } - else - setDeathState(JUST_ALIVED); + setDeathState(JUST_ALIVED); uint32 displayID = GetNativeDisplayId(); CreatureModelInfo const *minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 45429a9206e..a50c499e9e8 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -254,7 +254,6 @@ struct CreatureData uint32 currentwaypoint; uint32 curhealth; uint32 curmana; - bool is_dead; uint8 movementType; uint8 spawnMask; uint32 npcflag; @@ -603,7 +602,6 @@ class Creature : public Unit, public GridObject<Creature> void SetCurrentCell(Cell const& cell) { m_currentCell = cell; } void RemoveCorpse(bool setSpawnTime = true); - bool isDeadByDefault() const { return m_isDeadByDefault; }; void ForcedDespawn(uint32 timeMSToDespawn = 0); void DespawnOrUnsummon(uint32 msTimeToDespawn = 0); @@ -656,7 +654,6 @@ class Creature : public Unit, public GridObject<Creature> void SetFormation(CreatureGroup *formation) {m_formation = formation;} Unit *SelectVictim(); - void SetDeadByDefault (bool death_state) {m_isDeadByDefault = death_state;} void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; } bool IsReputationGainDisabled() { return DisableReputationGain; } @@ -713,7 +710,6 @@ class Creature : public Unit, public GridObject<Creature> bool m_AlreadySearchedAssistance; bool m_regenHealth; bool m_AI_locked; - bool m_isDeadByDefault; SpellSchoolMask m_meleeDamageSchoolMask; uint32 m_originalEntry; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 80fdc3060f4..2c69d83f311 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -1434,8 +1434,8 @@ void ObjectMgr::LoadCreatures() // 0 1 2 3 4 5 6 7 8 9 10 QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, " - // 11 12 13 14 15 16 17 18 19 20 21 22 - "currentwaypoint, curhealth, curmana, DeathState, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags " + // 11 12 13 14 15 16 17 18 19 20 21 + "currentwaypoint, curhealth, curmana, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags " "FROM creature " "LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid " "LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid"); @@ -1494,15 +1494,14 @@ void ObjectMgr::LoadCreatures() data.currentwaypoint= fields[11].GetUInt32(); data.curhealth = fields[12].GetUInt32(); data.curmana = fields[13].GetUInt32(); - data.is_dead = fields[14].GetBool(); - data.movementType = fields[15].GetUInt8(); - data.spawnMask = fields[16].GetUInt8(); - data.phaseMask = fields[17].GetUInt16(); - int16 gameEvent = fields[18].GetInt16(); - uint32 PoolId = fields[19].GetUInt32(); - data.npcflag = fields[20].GetUInt32(); - data.unit_flags = fields[21].GetUInt32(); - data.dynamicflags = fields[22].GetUInt32(); + data.movementType = fields[14].GetUInt8(); + data.spawnMask = fields[15].GetUInt8(); + data.phaseMask = fields[16].GetUInt16(); + int16 gameEvent = fields[17].GetInt16(); + uint32 PoolId = fields[18].GetUInt32(); + data.npcflag = fields[19].GetUInt32(); + data.unit_flags = fields[20].GetUInt32(); + data.dynamicflags = fields[21].GetUInt32(); MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) @@ -1724,7 +1723,6 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float data.currentwaypoint = 0; data.curhealth = stats->GenerateHealth(cInfo); data.curmana = stats->GenerateMana(cInfo); - data.is_dead = false; data.movementType = cInfo->MovementType; data.spawnMask = 1; data.phaseMask = PHASEMASK_NORMAL; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 042950a6ddd..426ce41077d 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -498,7 +498,7 @@ namespace Trinity bool operator()(Creature* u) { if (i_funit->GetTypeId() != TYPEID_PLAYER || !((Player*)i_funit)->isHonorOrXPTarget(u) || - u->getDeathState() != CORPSE || u->isDeadByDefault() || u->isInFlight() || + u->getDeathState() != CORPSE || u->isInFlight() || (u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0 || (u->GetDisplayId() != u->GetNativeDisplayId())) return false; @@ -525,7 +525,7 @@ namespace Trinity } bool operator()(Creature* u) { - if (u->getDeathState() != CORPSE || u->isInFlight() || u->isDeadByDefault() || + if (u->getDeathState() != CORPSE || u->isInFlight() || (u->GetDisplayId() != u->GetNativeDisplayId()) || (u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL) != 0) return false; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 17f8b246c83..797a8ecfcbe 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2516,7 +2516,6 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur) || (m_targets.GetUnitTarget()->getDeathState() == CORPSE && m_targets.GetUnitTarget()->GetDisplayId() == m_targets.GetUnitTarget()->GetNativeDisplayId() && m_targets.GetUnitTarget()->GetTypeId() == TYPEID_UNIT - && !m_targets.GetUnitTarget()->ToCreature()->isDeadByDefault() && !(m_targets.GetUnitTarget()->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL) && m_targets.GetUnitTarget()->GetDisplayId() == m_targets.GetUnitTarget()->GetNativeDisplayId())))) { diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 7686ff66ae8..dd526162e66 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -63,7 +63,6 @@ public: static ChatCommand npcSetCommandTable[] = { { "allowmove", SEC_ADMINISTRATOR, false, &HandleNpcSetAllowMovementCommand, "", NULL }, - { "deathstate", SEC_GAMEMASTER, false, &HandleNpcSetDeathStateCommand, "", NULL }, { "entry", SEC_ADMINISTRATOR, false, &HandleNpcSetEntryCommand, "", NULL }, { "factionid", SEC_GAMEMASTER, false, &HandleNpcSetFactionIdCommand, "", NULL }, { "flag", SEC_GAMEMASTER, false, &HandleNpcSetFlagCommand, "", NULL }, @@ -1157,37 +1156,6 @@ public: return true; } - //npc deathstate handling - static bool HandleNpcSetDeathStateCommand(ChatHandler* handler, const char* args) - { - if (!*args) - return false; - - Creature* pCreature = handler->getSelectedCreature(); - if (!pCreature || pCreature->isPet()) - { - handler->SendSysMessage(LANG_SELECT_CREATURE); - handler->SetSentErrorMessage(true); - return false; - } - - if (strncmp(args, "on", 3) == 0) - pCreature->SetDeadByDefault(true); - else if (strncmp(args, "off", 4) == 0) - pCreature->SetDeadByDefault(false); - else - { - handler->SendSysMessage(LANG_USE_BOL); - handler->SetSentErrorMessage(true); - return false; - } - - pCreature->SaveToDB(); - pCreature->Respawn(); - - return true; - } - static bool HandleNpcAddFormationCommand(ChatHandler* handler, const char* args) { if (!*args) diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp index 7edec45ca5e..51fb290502d 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_kologarn.cpp @@ -85,7 +85,7 @@ enum Yells SAY_BERSERK = -1603238, }; -enum +enum Achievemments { ACHIEV_DISARMED_START_EVENT = 21687, }; @@ -95,14 +95,9 @@ class boss_kologarn : public CreatureScript public: boss_kologarn() : CreatureScript("boss_kologarn") { } - CreatureAI* GetAI(Creature* pCreature) const - { - return GetUlduarAI<boss_kologarnAI>(pCreature); - } - struct boss_kologarnAI : public BossAI { - boss_kologarnAI(Creature *pCreature) : BossAI(pCreature, BOSS_KOLOGARN), vehicle(pCreature->GetVehicleKit()), + boss_kologarnAI(Creature* creature) : BossAI(creature, BOSS_KOLOGARN), vehicle(creature->GetVehicleKit()), left(false), right(false) { ASSERT(vehicle); @@ -115,7 +110,7 @@ class boss_kologarn : public CreatureScript Reset(); } - Vehicle *vehicle; + Vehicle* vehicle; bool left, right; uint64 eyebeamTarget; @@ -140,7 +135,7 @@ class boss_kologarn : public CreatureScript void Reset() { _Reset(); - + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); eyebeamTarget = 0; } @@ -149,7 +144,8 @@ class boss_kologarn : public CreatureScript DoScriptText(SAY_DEATH, me); DoCast(SPELL_KOLOGARN_PACIFY); me->GetMotionMaster()->MoveTargetedHome(); - + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetCorpseDelay(604800); // Prevent corpse from despawning. _JustDied(); } @@ -204,8 +200,7 @@ class boss_kologarn : public CreatureScript if (!right && !left) events.ScheduleEvent(EVENT_STONE_SHOUT, 5000); - if (instance) - instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT); + instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_DISARMED_START_EVENT); } else { @@ -234,7 +229,6 @@ class boss_kologarn : public CreatureScript summon->CastSpell(summon, SPELL_FOCUSED_EYEBEAM_PERIODIC, true); summon->CastSpell(summon, SPELL_FOCUSED_EYEBEAM_VISUAL, true); summon->SetReactState(REACT_PASSIVE); - summon->SetFlag(UNIT_FIELD_ATTACK_POWER, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_PACIFIED); // One of the above spells is a channeled spell, we need to clear this unit state for MoveChase to work summon->ClearUnitState(UNIT_STAT_CASTING); @@ -249,7 +243,7 @@ class boss_kologarn : public CreatureScript } } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; @@ -289,14 +283,14 @@ class boss_kologarn : public CreatureScript break; case EVENT_RESPAWN_LEFT_ARM: { - if (Creature* arm = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_LEFT_ARM) : 0)) + if (Creature* arm = Unit::GetCreature(*me, instance->GetData64(DATA_LEFT_ARM))) RespawnArm(arm->ToCreature()); events.CancelEvent(EVENT_RESPAWN_LEFT_ARM); break; } case EVENT_RESPAWN_RIGHT_ARM: { - if (Creature* arm = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_RIGHT_ARM) : 0)) + if (Creature* arm = Unit::GetCreature(*me, instance->GetData64(DATA_RIGHT_ARM))) RespawnArm(arm->ToCreature()); events.CancelEvent(EVENT_RESPAWN_RIGHT_ARM); break; @@ -312,8 +306,7 @@ class boss_kologarn : public CreatureScript } break; case EVENT_FOCUSED_EYEBEAM: - Unit* eyebeamTargetUnit = SelectTarget(SELECT_TARGET_FARTHEST, 0, 0, true); - if (eyebeamTargetUnit) + if (Unit* eyebeamTargetUnit = SelectTarget(SELECT_TARGET_FARTHEST, 0, 0, true)) { eyebeamTarget = eyebeamTargetUnit->GetGUID(); DoCast(SPELL_SUMMON_FOCUSED_EYEBEAM); @@ -335,6 +328,11 @@ class boss_kologarn : public CreatureScript arm->CastSpell(arm, SPELL_ARM_ENTER_VISUAL, true); } }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetUlduarAI<boss_kologarnAI>(creature); + } }; class spell_ulduar_rubble_summon : public SpellScriptLoader @@ -374,14 +372,14 @@ class spell_ulduar_rubble_summon : public SpellScriptLoader class StoneGripTargetSelector : public std::unary_function<Unit *, bool> { public: - StoneGripTargetSelector(Creature* me, const Unit* victim) : _me(me), _victim(victim) {} + StoneGripTargetSelector(Creature* me, Unit const* victim) : _me(me), _victim(victim) {} - bool operator() (Unit* pTarget) + bool operator() (Unit* target) { - if (pTarget == _victim && _me->getThreatManager().getThreatList().size() > 1) + if (target == _victim && _me->getThreatManager().getThreatList().size() > 1) return true; - if (pTarget->GetTypeId() != TYPEID_PLAYER) + if (target->GetTypeId() != TYPEID_PLAYER) return true; return false; @@ -472,11 +470,8 @@ class spell_ulduar_cancel_stone_grip : public SpellScriptLoader void HandleScript(SpellEffIndex /*effIndex*/) { - Unit* target = this->GetHitPlayer(); - if (!target) - return; - - if (!target->GetVehicle()) + Unit* target = GetHitUnit(); + if (!target || !target->GetVehicle()) return; switch (target->GetMap()->GetDifficulty()) @@ -506,38 +501,38 @@ class spell_ulduar_cancel_stone_grip : public SpellScriptLoader class spell_ulduar_squeezed_lifeless : public SpellScriptLoader { -public: - spell_ulduar_squeezed_lifeless() : SpellScriptLoader("spell_ulduar_squeezed_lifeless") { } - - class spell_ulduar_squeezed_lifeless_SpellScript : public SpellScript - { - PrepareSpellScript(spell_ulduar_squeezed_lifeless_SpellScript); + public: + spell_ulduar_squeezed_lifeless() : SpellScriptLoader("spell_ulduar_squeezed_lifeless") { } - void HandleInstaKill(SpellEffIndex /*effIndex*/) + class spell_ulduar_squeezed_lifeless_SpellScript : public SpellScript { - if (!GetHitPlayer()->GetVehicle()) - return; - - Position pos; - pos.m_positionX = 1756.25f + irand(-3, 3); - pos.m_positionY = -8.3f + irand(-3, 3); - pos.m_positionZ = 448.8f; - pos.m_orientation = M_PI; - GetHitPlayer()->DestroyForNearbyPlayers(); - GetHitPlayer()->ExitVehicle(&pos); - GetHitPlayer()->UpdateObjectVisibility(false); - } + PrepareSpellScript(spell_ulduar_squeezed_lifeless_SpellScript); - void Register() + void HandleInstaKill(SpellEffIndex /*effIndex*/) + { + if (!GetHitPlayer() || !GetHitPlayer()->GetVehicle()) + return; + + Position pos; + pos.m_positionX = 1756.25f + irand(-3, 3); + pos.m_positionY = -8.3f + irand(-3, 3); + pos.m_positionZ = 448.8f; + pos.m_orientation = M_PI; + GetHitPlayer()->DestroyForNearbyPlayers(); + GetHitPlayer()->ExitVehicle(&pos); + GetHitPlayer()->UpdateObjectVisibility(false); + } + + void Register() + { + OnEffect += SpellEffectFn(spell_ulduar_squeezed_lifeless_SpellScript::HandleInstaKill, EFFECT_1, SPELL_EFFECT_INSTAKILL); + } + }; + + SpellScript* GetSpellScript() const { - OnEffect += SpellEffectFn(spell_ulduar_squeezed_lifeless_SpellScript::HandleInstaKill, EFFECT_1, SPELL_EFFECT_INSTAKILL); + return new spell_ulduar_squeezed_lifeless_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_ulduar_squeezed_lifeless_SpellScript(); - } }; class spell_ulduar_stone_grip_absorb : public SpellScriptLoader @@ -588,8 +583,8 @@ class spell_ulduar_stone_grip : public SpellScriptLoader void OnRemoveStun(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (Player* pOwner = GetOwner()->ToPlayer()) - pOwner->RemoveAurasDueToSpell(aurEff->GetAmount()); + if (Player* owner = GetOwner()->ToPlayer()) + owner->RemoveAurasDueToSpell(aurEff->GetAmount()); } void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode) @@ -600,13 +595,13 @@ class spell_ulduar_stone_grip : public SpellScriptLoader if (GetOwner()->GetTypeId() != TYPEID_UNIT) return; - Player* pCaster = GetCaster() ? GetCaster()->ToPlayer() : NULL; - if (!pCaster || !pCaster->IsOnVehicle(GetOwner()->ToUnit())) + Player* caster = GetCaster() ? GetCaster()->ToPlayer() : NULL; + if (!caster || !caster->IsOnVehicle(GetOwner()->ToUnit())) return; - pCaster->RemoveAurasDueToSpell(GetId()); - pCaster->ExitVehicle(); - pCaster->GetMotionMaster()->MoveJump(1756.25f + irand(-3, 3), -8.3f + irand(-3, 3), 448.8f, 5.0f, 5.0f); + caster->RemoveAurasDueToSpell(GetId()); + caster->ExitVehicle(); + caster->GetMotionMaster()->MoveJump(1756.25f + irand(-3, 3), -8.3f + irand(-3, 3), 448.8f, 5.0f, 5.0f); PreventDefaultAction(); } @@ -652,7 +647,6 @@ class spell_kologarn_stone_shout : public SpellScriptLoader void AddSC_boss_kologarn() { new boss_kologarn(); - new spell_ulduar_rubble_summon(); new spell_ulduar_squeezed_lifeless(); new spell_ulduar_cancel_stone_grip(); diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp index f649ccef222..8c2d2d815f6 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/instance_ulduar.cpp @@ -212,23 +212,6 @@ class instance_ulduar : public InstanceMapScript case NPC_KOLOGARN: KologarnGUID = creature->GetGUID(); break; - case NPC_KOLOGARN_BRIDGE: - // The below hacks are courtesy of the grid/visibilitysystem - if (GetBossState(BOSS_KOLOGARN) == DONE) - { - creature->SetDeadByDefault(true); - creature->setDeathState(CORPSE); - creature->DestroyForNearbyPlayers(); - creature->UpdateObjectVisibility(true); - } - else - { - creature->SetDeadByDefault(false); - creature->setDeathState(CORPSE); - creature->RemoveCorpse(true); - } - break; - case NPC_AURIAYA: AuriayaGUID = creature->GetGUID(); break; diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h index 53aa9635839..3ddb2eaf036 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/ulduar/ulduar.h @@ -80,7 +80,6 @@ enum UlduarNPCs NPC_MOLGEIM = 32927, NPC_BRUNDIR = 32857, NPC_KOLOGARN = 32930, - NPC_KOLOGARN_BRIDGE = 34297, NPC_FOCUSED_EYEBEAM = 33632, NPC_FOCUSED_EYEBEAM_RIGHT = 33802, NPC_LEFT_ARM = 32933, diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index bff1e8e011d..eb9f2b1928a 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -63,19 +63,14 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() case NA_NPC_GUARD_13: case NA_NPC_GUARD_14: case NA_NPC_GUARD_15: + { + if (Creature* cr = HashMapHolder<Creature>::Find(itr->second)) { - if (Creature* cr = HashMapHolder<Creature>::Find(itr->second)) - { - if (cr->isAlive()) - ++cnt; - } - else if (CreatureData const* cd = sObjectMgr->GetCreatureData(GUID_LOPART(itr->second))) - { - if (!cd->is_dead) - ++cnt; - } + if (cr->isAlive()) + ++cnt; } - break; + } + break; default: break; } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 75102b9f856..f8c7f6ca03e 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1235,7 +1235,7 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader switch (GetId()) { case 66668: - factor = 0.01; + factor = 0.01f; baseItemLevel = 205; break; default: |