diff options
| author | Shauren <shauren.trinity@gmail.com> | 2016-06-13 21:00:25 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2016-06-13 21:00:25 +0200 |
| commit | d2733eb6f1f9a550ec6511b5fa696b67b11044b3 (patch) | |
| tree | 92e101dba7e48661de4a02c93bfba5700a6f1bdf /src/server/scripts | |
| parent | 3903482eb810625fce64c616a4edca3f06975e94 (diff) | |
| parent | 2fe6fc63d79655a96ee2135a6b380ce353729088 (diff) | |
Merge branch '6.x' of https://github.com/TrinityCore/TrinityCore into legion
Diffstat (limited to 'src/server/scripts')
12 files changed, 51 insertions, 42 deletions
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 22e9bfe704a..982a15e314d 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -146,9 +146,7 @@ public: Map* map = player->GetMap(); GameObject* object = new GameObject; - ObjectGuid::LowType guidLow = map->GenerateLowGuid<HighGuid::GameObject>(); - - if (!object->Create(guidLow, objectInfo->entry, map, 0, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) + if (!object->Create(objectInfo->entry, map, 0, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { delete object; return false; @@ -164,7 +162,7 @@ public: // fill the gameobject data and save to the db object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMask()); - guidLow = object->GetSpawnId(); + ObjectGuid::LowType spawnId = object->GetSpawnId(); // delete the old object and do a clean load from DB with a fresh new GameObject instance. // this is required to avoid weird behavior and memory leaks @@ -172,16 +170,16 @@ public: object = new GameObject(); // this will generate a new guid if the object is in an instance - if (!object->LoadGameObjectFromDB(guidLow, map)) + if (!object->LoadGameObjectFromDB(spawnId, map)) { delete object; return false; } /// @todo is it really necessary to add both the real and DB table guid here ? - sObjectMgr->AddGameobjectToGrid(guidLow, ASSERT_NOTNULL(sObjectMgr->GetGOData(guidLow))); + sObjectMgr->AddGameobjectToGrid(spawnId, ASSERT_NOTNULL(sObjectMgr->GetGOData(spawnId))); - handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, objectId, objectInfo->name.c_str(), guidLow, x, y, z); + handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, objectId, objectInfo->name.c_str(), spawnId, x, y, z); return true; } @@ -669,7 +667,7 @@ public: int32 objectState = atoi(state); if (objectType < 4) - object->SetByteValue(GAMEOBJECT_BYTES_1, objectType, objectState); + object->SetByteValue(GAMEOBJECT_BYTES_1, uint8(objectType), uint8(objectState)); else if (objectType == 4) object->SendCustomAnim(objectState); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 5fd9ff8028a..96acb89f1cb 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1106,7 +1106,13 @@ public: if (!*args) return false; - uint32 phase = (uint32) atoi((char*)args); + uint32 phaseID = uint32(atoi((char*)args)); + if (!sPhaseStore.LookupEntry(phaseID)) + { + handler->SendSysMessage(LANG_PHASE_NOTFOUND); + handler->SetSentErrorMessage(true); + return false; + } Creature* creature = handler->getSelectedCreature(); if (!creature || creature->IsPet()) @@ -1117,8 +1123,8 @@ public: } creature->ClearPhases(); - creature->SetInPhase(phase, true, true); - creature->SetDBPhase(phase); + creature->SetInPhase(phaseID, true, true); + creature->SetDBPhase(phaseID); creature->SaveToDB(); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index 8c68fe4cc18..9d7c41ffd7b 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -1353,8 +1353,10 @@ class go_twilight_portal : public GameObjectScript } } - bool GossipHello(Player* player) override + bool GossipHello(Player* player, bool isUse) override { + if (!isUse) + return true; if (_spellId != 0) player->CastSpell(player, _spellId, true); return true; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 106c567b24e..d755fa15d23 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -1113,7 +1113,7 @@ class npc_jaina_or_sylvanas_escape_hor : public CreatureScript me->RemoveAurasDueToSpell(SPELL_HARVEST_SOUL); if (_instance->GetData(DATA_TEAM_IN_INSTANCE) == ALLIANCE) Talk(SAY_JAINA_ESCAPE_9); - if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetGuidData(DATA_GUNSHIP))) + if (Transport* gunship = ObjectAccessor::GetTransportOnMap(*me, _instance->GetGuidData(DATA_GUNSHIP))) gunship->EnableMovement(true); _instance->SetBossState(DATA_THE_LICH_KING_ESCAPE, DONE); break; @@ -1185,7 +1185,7 @@ class npc_the_lich_king_escape_hor : public CreatureScript if (Creature* target = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_ESCAPE_LEADER))) DoCast(target, SPELL_HARVEST_SOUL); - if (Transport* gunship = ObjectAccessor::GetTransport(*me, _instance->GetGuidData(DATA_GUNSHIP))) + if (Transport* gunship = ObjectAccessor::GetTransportOnMap(*me, _instance->GetGuidData(DATA_GUNSHIP))) gunship->EnableMovement(true); break; default: diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 037b6a2988e..1a165780224 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -400,7 +400,7 @@ class instance_icecrown_citadel : public InstanceMapScript return entry; } - uint32 GetGameObjectEntry(ObjectGuid::LowType /*guidLow*/, uint32 entry) override + uint32 GetGameObjectEntry(ObjectGuid::LowType /*spawnId*/, uint32 entry) override { switch (entry) { diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index ef6ccf5bf4b..69dbc7bf9e6 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -200,7 +200,7 @@ public: if (zombie) { zombieToBeEatenGUID = zombie->GetGUID(); // save for later use - + // the soon-to-be-eaten zombie should stop moving and stop attacking zombie->AI()->SetData(DATA_ZOMBIE_STATE, STATE_ZOMBIE_TOBE_EATEN); @@ -225,7 +225,7 @@ public: case EVENT_KILL_ZOMBIE_SINGLE: { Creature* zombieToBeEaten = ObjectAccessor::GetCreature(*me, zombieToBeEatenGUID); - if (zombieToBeEaten && zombieToBeEaten->IsAlive() && zombieToBeEaten->IsWithinDistInMap(me, 10.0)) + if (zombieToBeEaten && zombieToBeEaten->IsAlive() && zombieToBeEaten->IsWithinDistInMap(me, 10.0)) DoCast(zombieToBeEaten, SPELL_ZOMBIE_CHOW_SEARCH_SINGLE); // do the killing + healing in done inside by spell script see below. zombieToBeEatenGUID = ObjectGuid::Empty; @@ -249,11 +249,11 @@ public: if (zombie && zombie->IsAlive() && zombie->GetExactDist2d(me) > 18.0) zombie = nullptr; } - + if (zombie) // cast the aoe spell only if at least one zombie is found nearby { Talk(EMOTE_DEVOURS_ALL); - DoCastAOE(SPELL_ZOMBIE_CHOW_SEARCH_MULTI); + DoCastAOE(SPELL_ZOMBIE_CHOW_SEARCH_MULTI); } break; } @@ -269,7 +269,7 @@ public: me->GetMotionMaster()->MoveIdle(); events.ScheduleEvent(EVENT_KILL_ZOMBIE_SINGLE, Seconds(1)); } - + } void DoAction(int32 action) override @@ -405,17 +405,19 @@ public: if (state == STATE_ZOMBIE_DECIMATED) { timer += diff; - Creature* gluth = ObjectAccessor::GetCreature(*me, GluthGUID); // Putting this in the UpdateAI loop fixes an issue where death gripping a decimated zombie would make the zombie stand still until the rest of the fight. // Also fix the issue where if one or more zombie is rooted when decimates hits (and MovePoint() is called), the zombie teleport to the boss. pretty weird behavior. - if (gluth && timer>1600 && me->GetExactDist2d(gluth) > 10.0 && me->CanFreeMove()) // it takes about 1600 ms for the animation to cycle. This way, the animation looks relatively smooth. + if (Creature* gluth = ObjectAccessor::GetCreature(*me, GluthGUID)) { - me->GetMotionMaster()->MovePoint(0, gluth->GetPosition()); // isn't dynamic. So, to take into account Gluth's movement, it must be called periodicly. - timer = 0; - } + if (timer > 1600 && me->GetExactDist2d(gluth) > 10.0 && me->CanFreeMove()) // it takes about 1600 ms for the animation to cycle. This way, the animation looks relatively smooth. + { + me->GetMotionMaster()->MovePoint(0, gluth->GetPosition()); // isn't dynamic. So, to take into account Gluth's movement, it must be called periodicly. + timer = 0; + } - if (me->GetExactDist2d(gluth) <= 10.0) - me->StopMoving(); + if (me->GetExactDist2d(gluth) <= 10.0) + me->StopMoving(); + } } else if (state == STATE_ZOMBIE_NORMAL) DoMeleeAttackIfReady(); @@ -430,10 +432,10 @@ public: { me->SetReactState(ReactStates::REACT_PASSIVE); me->AttackStop(); - me->SetTarget(ObjectGuid::Empty); + me->SetTarget(ObjectGuid::Empty); // at this point, the zombie should be non attacking and non moving. - me->SetWalk(true); // it doesnt seem to work with MoveFollow() (but it does work with MovePoint()). + me->SetWalk(true); // it doesnt seem to work with MoveFollow() (but it does work with MovePoint()). timer = 1000; } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index e5944841ad5..f6c829590b9 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -86,8 +86,7 @@ public: void SpawnGameObject(uint32 entry, Position const& pos) { GameObject* go = new GameObject(); - if (!go->Create(instance->GenerateLowGuid<HighGuid::GameObject>(), entry, instance, - PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), + if (!go->Create(entry, instance, PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), 0, 0, 0, 0, 120, GO_STATE_READY)) { delete go; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 0d8f9a6bce1..33afada15fd 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -977,8 +977,11 @@ class go_celestial_planetarium_access : public GameObjectScript { } - bool GossipHello(Player* player) override + bool GossipHello(Player* player, bool isUse) override { + if (!isUse) + return true; + if (go->HasFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE)) return true; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 59ff06ea66b..c7f49a67328 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -163,7 +163,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) GameObject* go = new GameObject; Map* map = player->GetMap(); - if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY)) + if (!go->Create(SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY)) { delete go; return true; @@ -194,7 +194,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) GameObject* go = new GameObject; Map* map = player->GetMap(); - if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY)) + if (!go->Create(SI_SILITHYST_MOUND, map, player->GetPhaseMask(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation(), 0, 0, 0, 0, 100, GO_STATE_READY)) { delete go; return true; diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp index 9ec779703d3..659a24773b7 100644 --- a/src/server/scripts/Pet/pet_mage.cpp +++ b/src/server/scripts/Pet/pet_mage.cpp @@ -198,8 +198,8 @@ class npc_pet_mage_mirror_image : public CreatureScript if (!target || me->GetVictim() != target) { Unit* ownerTarget = nullptr; - if (Player* owner = me->GetCharmerOrOwner()->ToPlayer()) - ownerTarget = owner->GetSelectedUnit(); + if (Player* ownerPlayer = me->GetCharmerOrOwner()->ToPlayer()) + ownerTarget = ownerPlayer->GetSelectedUnit(); // recognize which victim will be choosen if (ownerTarget && ownerTarget->GetTypeId() == TYPEID_PLAYER) diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 0829441e17a..ad43ed92d3e 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -442,7 +442,7 @@ class spell_sha_fulmination : public SpellScriptLoader uint32 stacks = aura->GetCharges(); if (stacks > 1) { - SpellInfo const* triggerSpell = sSpellMgr->GetSpellInfo(aura->GetSpellEffectInfo(EFFECT_0)->TriggerSpell); + SpellInfo const* triggerSpell = sSpellMgr->AssertSpellInfo(aura->GetSpellEffectInfo(EFFECT_0)->TriggerSpell); SpellEffectInfo const* triggerEffect = triggerSpell->GetEffect(EFFECT_0); uint32 damage; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 0e9a972a3fb..c9481f2e6b8 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -834,12 +834,11 @@ class go_soulwell : public GameObjectScript { } - /// Due to the fact that this GameObject triggers CMSG_GAMEOBJECT_USE - /// _and_ CMSG_GAMEOBJECT_REPORT_USE, this GossipHello hook is called - /// twice. The script's handling is fine as it won't remove two charges - /// on the well. We have to find how to segregate REPORT_USE and USE. - bool GossipHello(Player* player) override + bool GossipHello(Player* player, bool isUse) override { + if (!isUse) + return true; + Unit* owner = go->GetOwner(); if (!owner || owner->GetTypeId() != TYPEID_PLAYER || !player->IsInSameRaidWith(owner->ToPlayer())) return true; |
