diff options
author | joschiwald <joschiwald.trinity@gmail.com> | 2014-10-26 01:46:28 +0200 |
---|---|---|
committer | joschiwald <joschiwald.trinity@gmail.com> | 2014-10-26 01:56:06 +0200 |
commit | 747350a0bcffaa4ef2b5d3317bb75fac78c64472 (patch) | |
tree | bc70e5a82c432dbb208ea74dfb1574bc467b8f3b /src | |
parent | 10fb948c409e2e4a68b77b7cfc41c068fcbd0bf4 (diff) |
Scripts: replaced various Location struct defines with proper Position or G3D::Vector3
Diffstat (limited to 'src')
13 files changed, 118 insertions, 160 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 7e7eb3e7e67..669ec512afd 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1632,6 +1632,13 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation()); } +Position Position::GetPositionWithOffset(Position const& offset) const +{ + Position ret(*this); + ret.RelocateOffset(offset); + return ret; +} + float Position::GetAngle(const Position* obj) const { if (!obj) @@ -2797,7 +2804,7 @@ void WorldObject::DestroyForNearbyPlayers() if (!player->HaveAtClient(this)) continue; - if (isType(TYPEMASK_UNIT) && ((Unit*)this)->GetCharmerGUID() == player->GetGUID()) /// @todo this is for puppet + if (isType(TYPEMASK_UNIT) && ToUnit()->GetCharmerGUID() == player->GetGUID()) /// @todo this is for puppet continue; DestroyForPlayer(player); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 7eee9f0c4c4..f7e8a7a6447 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -339,6 +339,7 @@ struct Position { return std::sqrt(GetExactDistSq(pos)); } void GetPositionOffsetTo(Position const & endPos, Position & retOffset) const; + Position GetPositionWithOffset(Position const& offset) const; float GetAngle(Position const* pos) const; float GetAngle(float x, float y) const; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index d67c28a3552..d2c0ae88590 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -217,11 +217,6 @@ enum mograine SPELL_THUNDER = 53630 }; -struct Location -{ - float x, y, z, o; -}; - void UpdateWorldState(Map* map, uint32 id, uint32 state) { Map::PlayerList const& players = map->GetPlayers(); @@ -236,10 +231,10 @@ void UpdateWorldState(Map* map, uint32 id, uint32 state) } } -static Location LightofDawnLoc[]= +Position const LightofDawnLoc[] = { {2281.335f, -5300.409f, 85.170f, 0}, // 0 Tirion Fordring loc - {2283.896f, -5287.914f, 83.066f, 1.55f}, // 1 Tirion Fordring loc2 + {2283.896f, -5287.914f, 83.066f, 1.55f}, // 1 Tirion Fordring loc2 {2281.461f, -5263.014f, 81.164f, 0}, // 2 Tirion charges {2262.277f, -5293.477f, 82.167f, 0}, // 3 Tirion run {2270.286f, -5287.73f, 82.262f, 0}, // 4 Tirion relocate @@ -540,30 +535,30 @@ public: if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN)) temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); temp->SetWalk(true); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19].x, LightofDawnLoc[19].y, LightofDawnLoc[19].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[19]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) { if (temp->HasAura(SPELL_THE_LIGHT_OF_DAWN)) temp->RemoveAurasDueToSpell(SPELL_THE_LIGHT_OF_DAWN); temp->SetWalk(true); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21].x, LightofDawnLoc[21].y, LightofDawnLoc[21].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[21]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) { temp->SetWalk(true); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10].x, LightofDawnLoc[10].y, LightofDawnLoc[10].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[10]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) { temp->SetWalk(true); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13].x, LightofDawnLoc[13].y, LightofDawnLoc[13].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[13]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) { temp->SetWalk(true); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16].x, LightofDawnLoc[16].y, LightofDawnLoc[16].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[16]); } JumpToNextStep(10000); } @@ -729,30 +724,30 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKoltiraGUID)) { temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f })); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiOrbazGUID)) { temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f })); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiThassarianGUID)) { temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f })); } for (uint8 i = 0; i < ENCOUNTER_ABOMINATION_NUMBER; ++i) if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i])) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f })); for (uint8 i = 0; i < ENCOUNTER_BEHEMOTH_NUMBER; ++i) if (Creature* temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i])) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f })); for (uint8 i = 0; i < ENCOUNTER_GHOUL_NUMBER; ++i) if (Creature* temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i])) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f })); for (uint8 i = 0; i < ENCOUNTER_WARRIOR_NUMBER; ++i) if (Creature* temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i])) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f })); JumpToNextStep(5000); break; @@ -782,7 +777,7 @@ public: break; case 15: // summon gate - if (Creature* temp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22].x, LightofDawnLoc[22].y, LightofDawnLoc[22].z, LightofDawnLoc[22].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + if (Creature* temp = me->SummonCreature(NPC_HIGHLORD_ALEXANDROS_MOGRAINE, LightofDawnLoc[22], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) { temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); temp->CastSpell(temp, SPELL_ALEXANDROS_MOGRAINE_SPAWN, true); @@ -796,7 +791,7 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiAlexandrosGUID)) { temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23].x, LightofDawnLoc[23].y, LightofDawnLoc[23].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[23]); temp->AI()->Talk(SAY_LIGHT_OF_DAWN32); } SetHoldState(false); // makes darion turns back @@ -810,7 +805,7 @@ public: break; case 18: // Darion's spirit out - if (Creature* temp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24].x, LightofDawnLoc[24].y, LightofDawnLoc[24].z, LightofDawnLoc[24].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + if (Creature* temp = me->SummonCreature(NPC_DARION_MOGRAINE, LightofDawnLoc[24], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) { temp->AI()->Talk(SAY_LIGHT_OF_DAWN35); temp->SetWalk(false); @@ -823,7 +818,7 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDarionGUID)) { temp->AI()->Talk(EMOTE_LIGHT_OF_DAWN07); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25].x, LightofDawnLoc[25].y, LightofDawnLoc[25].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[25]); } JumpToNextStep(4000); break; @@ -857,7 +852,7 @@ public: temp->AI()->Talk(SAY_LIGHT_OF_DAWN39); if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) // Tirion moves forward here - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1].x, LightofDawnLoc[1].y, LightofDawnLoc[1].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[1]); JumpToNextStep(15000); break; @@ -887,7 +882,7 @@ public: break; case 29: // lich king spawns - if (Creature* temp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26].x, LightofDawnLoc[26].y, LightofDawnLoc[26].z, LightofDawnLoc[26].o, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) + if (Creature* temp = me->SummonCreature(NPC_THE_LICH_KING, LightofDawnLoc[26], TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000)) { temp->AI()->Talk(SAY_LIGHT_OF_DAWN43); uiLichKingGUID = temp->GetGUID(); @@ -920,7 +915,7 @@ public: case 32: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27].x, LightofDawnLoc[27].y, LightofDawnLoc[27].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[27]); JumpToNextStep(6000); break; @@ -999,7 +994,7 @@ public: if (fLichPositionX && fLichPositionY) { - Unit* temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x + rand32() % 10, LightofDawnLoc[0].y + rand32() % 10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + Unit* temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 10), float(rand32() % 10), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); @@ -1007,7 +1002,7 @@ public: temp->GetMotionMaster()->MovePoint(0, fLichPositionX, fLichPositionY, fLichPositionZ); uiDefenderGUID[0] = temp->GetGUID(); - temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x + rand32() % 10, LightofDawnLoc[0].y + rand32() % 10, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); + temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 10), float(rand32() % 10), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 10000); temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_ATTACK_UNARMED); temp->SetWalk(false); temp->SetSpeed(MOVE_RUN, 2.0f); @@ -1051,33 +1046,33 @@ public: temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[14].x, LightofDawnLoc[14].y, LightofDawnLoc[14].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[14]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[11].x, LightofDawnLoc[11].y, LightofDawnLoc[11].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[11]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[17].x, LightofDawnLoc[17].y, LightofDawnLoc[17].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[17]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[0])) { temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 10, LightofDawnLoc[0].y + rand32() % 10, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 10), float(rand32() % 10), 0.0f, 0.0f })); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[0])) { temp->SetSpeed(MOVE_RUN, 6.0f); temp->SetStandState(UNIT_STAND_STATE_DEAD); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].x + rand32() % 10, LightofDawnLoc[0].y + rand32() % 10, LightofDawnLoc[0].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 10), float(rand32() % 10), 0.0f, 0.0f })); } JumpToNextStep(3000); break; @@ -1160,9 +1155,9 @@ public: temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); temp->SetSpeed(MOVE_RUN, 3.0f); // workarounds, make Tirion still running temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2].x, LightofDawnLoc[2].y, LightofDawnLoc[2].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[2]); if (Creature* lktemp = ObjectAccessor::GetCreature(*me, uiLichKingGUID)) - lktemp->Relocate(LightofDawnLoc[28].x, LightofDawnLoc[28].y, LightofDawnLoc[28].z); // workarounds, he should kick back by Tirion, but here we relocate him + lktemp->Relocate(LightofDawnLoc[28]); // workarounds, he should kick back by Tirion, but here we relocate him } JumpToNextStep(1500); break; @@ -1178,7 +1173,7 @@ public: { temp->SetSpeed(MOVE_RUN, 1.0f); me->SetWalk(true); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[29].x, LightofDawnLoc[29].y, LightofDawnLoc[29].z); // 26 + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[29]); // 26 } JumpToNextStep(4000); break; @@ -1214,7 +1209,7 @@ public: { temp->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); temp->SetSpeed(MOVE_RUN, 1.0f); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[6].x, LightofDawnLoc[6].y, LightofDawnLoc[6].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[6]); } JumpToNextStep(2500); break; @@ -1238,7 +1233,7 @@ public: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { temp->SetWalk(true); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7].x, LightofDawnLoc[7].y, LightofDawnLoc[7].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[7]); } JumpToNextStep(5500); break; @@ -1246,7 +1241,7 @@ public: case 63: if (Creature* temp = ObjectAccessor::GetCreature(*me, uiTirionGUID)) { - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8].x, LightofDawnLoc[8].y, LightofDawnLoc[8].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[8]); temp->AI()->Talk(SAY_LIGHT_OF_DAWN61); } JumpToNextStep(15000); @@ -1401,7 +1396,7 @@ public: if (uiFight_duration <= diff + 5000) { if (!uiTirionGUID) - if (Creature* temp = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightofDawnLoc[0].x, LightofDawnLoc[0].y, LightofDawnLoc[0].z, 1.528f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000)) + if (Creature* temp = me->SummonCreature(NPC_HIGHLORD_TIRION_FORDRING, LightofDawnLoc[0].GetPositionWithOffset({ 0.0f, 0.0f, 0.0f, 1.528f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000)) { temp->setFaction(me->getFaction()); temp->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 0, uint32(EQUIP_UNEQUIP)); @@ -1443,7 +1438,7 @@ public: temp->AttackStop(); temp->setFaction(me->getFaction()); temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9].x, LightofDawnLoc[9].y, LightofDawnLoc[9].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[9]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID)) @@ -1454,7 +1449,7 @@ public: temp->AttackStop(); temp->setFaction(me->getFaction()); temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12].x, LightofDawnLoc[12].y, LightofDawnLoc[12].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[12]); } if (Creature* temp = ObjectAccessor::GetCreature(*me, uiEligorGUID)) @@ -1465,7 +1460,7 @@ public: temp->AttackStop(); temp->setFaction(me->getFaction()); temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[15].x, LightofDawnLoc[15].y, LightofDawnLoc[15].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[15]); } DespawnNPC(uiRayneGUID); @@ -1477,7 +1472,7 @@ public: temp->AttackStop(); temp->setFaction(me->getFaction()); temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[18].x, LightofDawnLoc[18].y, LightofDawnLoc[18].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[18]); temp->CastSpell(temp, SPELL_THE_LIGHT_OF_DAWN, false); } @@ -1492,7 +1487,7 @@ public: temp->AttackStop(); temp->setFaction(me->getFaction()); temp->SetWalk(false); - temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[20].x, LightofDawnLoc[20].y, LightofDawnLoc[20].z); + temp->GetMotionMaster()->MovePoint(0, LightofDawnLoc[20]); temp->CastSpell(temp, SPELL_THE_LIGHT_OF_DAWN, false); } @@ -1539,7 +1534,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiGhoulGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_ACHERUS_GHOUL, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2084); uiGhoulGUID[i] = temp->GetGUID(); } @@ -1549,7 +1544,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiAbominationGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_WARRIOR_OF_THE_FROZEN_WASTES, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2084); uiAbominationGUID[i] = temp->GetGUID(); } @@ -1559,7 +1554,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiWarriorGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_RAMPAGING_ABOMINATION, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2084); uiWarriorGUID[i] = temp->GetGUID(); } @@ -1569,7 +1564,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiBehemothGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_FLESH_BEHEMOTH, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2084); uiBehemothGUID[i] = temp->GetGUID(); } @@ -1581,7 +1576,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiDefenderGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_DEFENDER_OF_THE_LIGHT, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiDefenderGUID[i] = temp->GetGUID(); @@ -1592,7 +1587,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiEarthshatterGUID[i]); if (!temp) { - temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_RIMBLAT_EARTHSHATTER, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiEarthshatterGUID[i] = temp->GetGUID(); @@ -1601,7 +1596,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiKorfaxGUID); if (!temp) { - temp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + temp = me->SummonCreature(NPC_KORFAX_CHAMPION_OF_THE_LIGHT, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiKorfaxGUID = temp->GetGUID(); @@ -1609,7 +1604,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiMaxwellGUID); if (!temp) { - temp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + temp = me->SummonCreature(NPC_LORD_MAXWELL_TYROSUS, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiMaxwellGUID = temp->GetGUID(); @@ -1617,7 +1612,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiEligorGUID); if (!temp) { - temp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); + temp = me->SummonCreature(NPC_COMMANDER_ELIGOR_DAWNBRINGER, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 600000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiEligorGUID = temp->GetGUID(); @@ -1625,7 +1620,7 @@ public: temp = ObjectAccessor::GetCreature(*me, uiRayneGUID); if (!temp) { - temp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].x + rand32() % 30, LightofDawnLoc[0].y + rand32() % 30, LightofDawnLoc[0].z, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); + temp = me->SummonCreature(NPC_RAYNE, LightofDawnLoc[0].GetPositionWithOffset({ float(rand32() % 30), float(rand32() % 30), 0.0f, 0.0f }), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 300000); temp->setFaction(2089); me->AddThreat(temp, 0.0f); uiRayneGUID = temp->GetGUID(); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 6ea3232084f..f42e28026a7 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -95,12 +95,7 @@ enum Spells SPELL_DEATH = 42566 //not correct spell }; -struct Locations -{ - float x, y, z; -}; - -static Locations FlightPoint[]= +G3D::Vector3 const FlightPoint[]= { {1754.00f, 1346.00f, 17.50f}, {1765.00f, 1347.00f, 19.00f}, @@ -125,7 +120,7 @@ static Locations FlightPoint[]= {1758.00f, 1367.00f, 19.51f} }; -static Locations Spawn[]= +G3D::Vector3 const Spawn[]= { {1776.27f, 1348.74f, 19.20f}, //spawn point for pumpkin shrine mob {1765.28f, 1347.46f, 17.55f} //spawn point for smoke diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp index 8d23cf0a3e4..19b91b75dd4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp @@ -71,35 +71,27 @@ enum LieutenantDrake SPELL_FRIGHTENING_SHOUT = 33789 }; -struct Location +G3D::Vector3 const DrakeWP[]= { - uint32 wpId; - float x; - float y; - float z; -}; - -static Location DrakeWP[]= -{ - {0, 2125.84f, 88.2535f, 54.8830f}, - {1, 2111.01f, 93.8022f, 52.6356f}, - {2, 2106.70f, 114.753f, 53.1965f}, - {3, 2107.76f, 138.746f, 52.5109f}, - {4, 2114.83f, 160.142f, 52.4738f}, - {5, 2125.24f, 178.909f, 52.7283f}, - {6, 2151.02f, 208.901f, 53.1551f}, - {7, 2177.00f, 233.069f, 52.4409f}, - {8, 2190.71f, 227.831f, 53.2742f}, - {9, 2178.14f, 214.219f, 53.0779f}, - {10, 2154.99f, 202.795f, 52.6446f}, - {11, 2132.00f, 191.834f, 52.5709f}, - {12, 2117.59f, 166.708f, 52.7686f}, - {13, 2093.61f, 139.441f, 52.7616f}, - {14, 2086.29f, 104.950f, 52.9246f}, - {15, 2094.23f, 81.2788f, 52.6946f}, - {16, 2108.70f, 85.3075f, 53.3294f}, - {17, 2125.50f, 88.9481f, 54.7953f}, - {18, 2128.20f, 70.9763f, 64.4221f} + { 2125.84f, 88.2535f, 54.8830f }, + { 2111.01f, 93.8022f, 52.6356f }, + { 2106.70f, 114.753f, 53.1965f }, + { 2107.76f, 138.746f, 52.5109f }, + { 2114.83f, 160.142f, 52.4738f }, + { 2125.24f, 178.909f, 52.7283f }, + { 2151.02f, 208.901f, 53.1551f }, + { 2177.00f, 233.069f, 52.4409f }, + { 2190.71f, 227.831f, 53.2742f }, + { 2178.14f, 214.219f, 53.0779f }, + { 2154.99f, 202.795f, 52.6446f }, + { 2132.00f, 191.834f, 52.5709f }, + { 2117.59f, 166.708f, 52.7686f }, + { 2093.61f, 139.441f, 52.7616f }, + { 2086.29f, 104.950f, 52.9246f }, + { 2094.23f, 81.2788f, 52.6946f }, + { 2108.70f, 85.3075f, 53.3294f }, + { 2125.50f, 88.9481f, 54.7953f }, + { 2128.20f, 70.9763f, 64.4221f } }; class boss_lieutenant_drake : public CreatureScript @@ -163,7 +155,7 @@ public: /// @todo make this work if (CanPatrol && wpId == 0) { - me->GetMotionMaster()->MovePoint(DrakeWP[0].wpId, DrakeWP[0].x, DrakeWP[0].y, DrakeWP[0].z); + me->GetMotionMaster()->MovePoint(wpId, DrakeWP[wpId].x, DrakeWP[wpId].y, DrakeWP[wpId].z); ++wpId; } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 8a0921b604b..3f882e0b99e 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -31,6 +31,9 @@ enum GossipNPCs GOSSIP_MENU_ETERNOS = 9574, GOSSIP_MENU_BELGARISTRASZ = 9575, + SPELL_CREATE_EMERALD_ESSENCE = 49382, // no effects in spell_dbc + SPELL_CREATE_AMBER_ESSENCE = 49447, // no effects in spell_dbc + SPELL_CREATE_RUBY_ESSENCE = 49450, // no effects in spell_dbc ITEM_EMERALD_ESSENCE = 37815, ITEM_AMBER_ESSENCE = 37859, ITEM_RUBY_ESSENCE = 37860 @@ -48,7 +51,7 @@ enum Drakes SPELL_RUBY_EVASIVE_AURA = 50248, // Instant - Allows the Ruby Drake to generate Evasive Charges when hit by hostile attacks and spells. SPELL_RUBY_EVASIVE_CHARGES = 50241, SPELL_RUBY_EVASIVE_MANEUVERS = 50240, // Instant - 5 sec. cooldown - Allows your drake to dodge all incoming attacks and spells. Requires Evasive Charges to use. Each attack or spell dodged while this ability is active burns one Evasive Charge. Lasts 30 sec. or until all charges are exhausted. - // you do not have acces to until you kill Mage-Lord Urom + // you do not have access to until you kill the Mage-Lord Urom SPELL_RUBY_MARTYR = 50253, // Instant - 10 sec. cooldown - Redirect all harmful spells cast at friendly drakes to yourself for 10 sec. /* @@ -112,7 +115,7 @@ class npc_verdisa_beglaristrasz_eternos : public CreatureScript void StoreEssence(Player* player, uint32 itemId) { - /// @todo: should be handled by spell, but not found in dbc (49450 and other?) + /// @todo: implement with spells uint32 count = 1; ItemPosCountVec dest; uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count); diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index bacb63b73bc..c6e4f40ef58 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -58,7 +58,7 @@ enum Misc MAX_TEMPEST_MINIONS = 4 }; -struct Position TempestMinions[MAX_TEMPEST_MINIONS] = +Position const TempestMinions[MAX_TEMPEST_MINIONS] = { {-203.980103f, -281.287720f, 91.650223f, 1.598807f}, {-233.489410f, -281.139282f, 91.652412f, 1.598807f}, diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 8e7df5f1c3f..6b11d8715b8 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -298,12 +298,7 @@ static const Yells Conversation[22] = {0, "", EMPTY, 1000, 0, false} // 21 }; -struct Locations -{ - float x, y, z; -}; - -static const Locations HoverPosition[4]= +G3D::Vector3 const HoverPosition[4]= { {657.0f, 340.0f, 355.0f}, {657.0f, 275.0f, 355.0f}, @@ -311,7 +306,7 @@ static const Locations HoverPosition[4]= {705.0f, 340.0f, 355.0f} }; -static const Locations GlaivePosition[4]= +G3D::Vector3 const GlaivePosition[4]= { {695.105f, 305.303f, 354.256f}, {659.338f, 305.303f, 354.256f}, // the distance between two glaives is 36 @@ -319,13 +314,13 @@ static const Locations GlaivePosition[4]= {664.338f, 305.303f, 354.256f} }; -static const Locations EyeBlast[2]= +G3D::Vector3 const EyeBlast[2]= { {677.0f, 350.0f, 354.0f}, // start point, pass through glaive point {677.0f, 260.0f, 354.0f} }; -static const Locations AkamaWP[13]= +G3D::Vector3 const AkamaWP[13]= { {770.01f, 304.50f, 312.29f}, // Bottom of the first stairs, at the doors {780.66f, 304.50f, 319.74f}, // Top of the first stairs @@ -342,7 +337,7 @@ static const Locations AkamaWP[13]= {782.01f, 304.55f, 319.76f} // Final location - back at the initial gates. This is where he will fight the minions! (12) }; // 755.762f, 304.0747f, 312.1769f -- This is where Akama should be spawned -static const Locations SpiritSpawns[2]= +G3D::Vector3 const SpiritSpawns[2]= { {755.5426f, 309.9156f, 312.2129f}, {755.5426f, 298.7923f, 312.0834f} @@ -734,14 +729,14 @@ public: disty = EyeBlast[i].y - HoverPosition[HoverPoint].y; dist[i] = distx * distx + disty * disty; } - Locations initial = EyeBlast[dist[0] < dist[1] ? 0 : 1]; + G3D::Vector3 initial = EyeBlast[dist[0] < dist[1] ? 0 : 1]; for (uint8 i = 0; i < 2; ++i) { distx = GlaivePosition[i].x - HoverPosition[HoverPoint].x; disty = GlaivePosition[i].y - HoverPosition[HoverPoint].y; dist[i] = distx * distx + disty * disty; } - Locations final = GlaivePosition[dist[0] < dist[1] ? 0 : 1]; + G3D::Vector3 final = GlaivePosition[dist[0] < dist[1] ? 0 : 1]; final.x = 2 * final.x - initial.x; final.y = 2 * final.y - initial.y; diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index ed145045131..24d6eb6c831 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -82,12 +82,7 @@ uint32 PrismaticAuras[]= 40897, // Holy }; -struct Locations -{ - float x, y, z; -}; - -static Locations TeleportPoint[]= +G3D::Vector3 const TeleportPoint[]= { {959.996f, 212.576f, 193.843f}, {932.537f, 231.813f, 193.838f}, diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index 6c15784c35e..d49a23c85dd 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -84,12 +84,7 @@ enum ReliquaryOfSouls NUMBER_ENSLAVED_SOUL = 8 }; -struct Position2d -{ - float x, y; -}; - -static Position2d Coords[]= +G3D::Vector2 const Coords[]= { {450.4f, 212.3f}, {542.1f, 212.3f}, diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index ecc4457e454..6ff865cfcd0 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -141,14 +141,9 @@ enum Events EVENT_SPIRIT_HEAL = 24 }; -struct Location -{ - float x, y, z; -}; - -static Location ShadeWP = { 512.4877f, 400.7993f, 112.7837f }; +G3D::Vector3 const ShadeWP = { 512.4877f, 400.7993f, 112.7837f }; -static Location AkamaWP[] = +G3D::Vector3 const AkamaWP[] = { { 517.4877f, 400.7993f, 112.7837f }, { 468.4435f, 401.1062f, 118.5379f } diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index b37adae3fe9..2dd5c81a2ee 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -1213,13 +1213,8 @@ static TorlothCinematic TorlothAnim[]= {0, 0} }; -struct Location -{ - float x, y, z, o; -}; - //Cordinates for Spawns -static Location SpawnLocation[]= +static Position SpawnLocation[]= { //Cords used for: {-4615.8556f, 1342.2532f, 139.9f, 1.612f}, //Illidari Soldier @@ -1727,12 +1722,7 @@ void npc_lord_illidan_stormrage::npc_lord_illidan_stormrageAI::SummonNextWave() for (uint8 i = 0; i < count; ++i) { - Creature* Spawn = NULL; - float X = SpawnLocation[locIndex + i].x; - float Y = SpawnLocation[locIndex + i].y; - float Z = SpawnLocation[locIndex + i].z; - float O = SpawnLocation[locIndex + i].o; - Spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + Creature* Spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, SpawnLocation[locIndex + i], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); ++LiveCount; if (Spawn) diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index f7c09fa21b9..6df02b7b20d 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -524,12 +524,7 @@ enum Doctor HORDE_COORDS = 6 }; -struct Location -{ - float x, y, z, o; -}; - -static Location AllianceCoords[]= +Position const AllianceCoords[]= { {-3757.38f, -4533.05f, 14.16f, 3.62f}, // Top-far-right bunk as seen from entrance {-3754.36f, -4539.13f, 14.16f, 5.13f}, // Top-far-left bunk @@ -545,7 +540,7 @@ static Location AllianceCoords[]= #define A_RUNTOY -4531.52f #define A_RUNTOZ 11.91f -static Location HordeCoords[]= +Position const HordeCoords[]= { {-1013.75f, -3492.59f, 62.62f, 4.34f}, // Left, Behind {-1017.72f, -3490.92f, 62.62f, 4.34f}, // Right, Behind @@ -614,7 +609,7 @@ public: bool Event; GuidList Patients; - std::vector<Location*> Coordinates; + std::vector<Position const*> Coordinates; void Reset() override { @@ -647,7 +642,7 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void PatientDied(Location* point) + void PatientDied(Position const* point) { Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID); if (player && ((player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))) @@ -672,7 +667,7 @@ public: Reset(); } - void PatientSaved(Creature* /*soldier*/, Player* player, Location* point) + void PatientSaved(Creature* /*soldier*/, Player* player, Position const* point) { if (player && PlayerGUID == player->GetGUID()) { @@ -747,7 +742,7 @@ public: } ObjectGuid DoctorGUID; - Location* Coord; + Position const* Coord; void Reset() override { @@ -864,7 +859,6 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff) if (Coordinates.empty()) return; - std::vector<Location*>::iterator itr = Coordinates.begin() + rand32() % Coordinates.size(); uint32 patientEntry = 0; switch (me->GetEntry()) @@ -880,20 +874,21 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff) return; } - if (Location* point = *itr) + std::vector<Position const*>::iterator point = Coordinates.begin(); + std::advance(point, urand(0, Coordinates.size() - 1)); + + if (Creature* Patient = me->SummonCreature(patientEntry, **point, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) { - if (Creature* Patient = me->SummonCreature(patientEntry, point->x, point->y, point->z, point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) - { - //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND) - Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND) + Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - Patients.push_back(Patient->GetGUID()); - ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID(); - ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = point; + Patients.push_back(Patient->GetGUID()); + ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID(); + ENSURE_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = *point; - Coordinates.erase(itr); - } + Coordinates.erase(point); } + SummonPatientTimer = 10000; ++SummonPatientCount; } |