aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/OutdoorPvP
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2018-01-27 21:47:37 +0100
committerjoschiwald <joschiwald.trinity@gmail.com>2018-01-27 23:02:46 +0100
commit6226189a1687e1a2b4fb5a490031c22b5f334dc6 (patch)
treed48fbc4a586203c0c4ae3721697d3428773e9e00 /src/server/scripts/OutdoorPvP
parentf963b8a225a70e7007536d5d4787483a2cade978 (diff)
Core/Entities: Created factory methods to create new areatriggers, creatures and gameobjects
Diffstat (limited to 'src/server/scripts/OutdoorPvP')
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp67
1 files changed, 11 insertions, 56 deletions
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index ef24b8a5af1..d259e8585c6 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -149,70 +149,25 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
if (spellId == SI_SILITHYST_FLAG)
{
// if it was dropped away from the player's turn-in point, then create a silithyst mound, if it was dropped near the areatrigger, then it was dispelled by the outdoorpvp, so do nothing
- switch (player->GetTeam())
+ if (AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(player->GetTeam() == ALLIANCE ? SI_AREATRIGGER_A : SI_AREATRIGGER_H))
{
- case ALLIANCE:
+ // 5.0f is safe-distance
+ if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius)
{
- AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_A);
- if (atEntry)
+ // he dropped it further, summon mound
+ Map* map = player->GetMap();
+ if (GameObject* go = GameObject::CreateGameObject(SI_SILITHYST_MOUND, map, *player, QuaternionData(), 255, GO_STATE_READY))
{
- // 5.0f is safe-distance
- if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius)
- {
- // he dropped it further, summon mound
- GameObject* go = new GameObject();
- Map* map = player->GetMap();
-
- if (!go->Create(SI_SILITHYST_MOUND, map, *player, QuaternionData(), 255, GO_STATE_READY))
- {
- delete go;
- return true;
- }
-
- go->CopyPhaseFrom(player);
-
- go->SetRespawnTime(0);
+ go->CopyPhaseFrom(player);
+ go->SetRespawnTime(0);
- if (!map->AddToMap(go))
- {
- delete go;
- return true;
- }
- }
- }
- }
- break;
- case HORDE:
- {
- AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(SI_AREATRIGGER_H);
- if (atEntry)
- {
- // 5.0f is safe-distance
- if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius)
+ if (!map->AddToMap(go))
{
- // he dropped it further, summon mound
- GameObject* go = new GameObject();
- Map* map = player->GetMap();
-
- if (!go->Create(SI_SILITHYST_MOUND, map, *player, QuaternionData(), 255, GO_STATE_READY))
- {
- delete go;
- return true;
- }
-
- go->CopyPhaseFrom(player);
-
- go->SetRespawnTime(0);
-
- if (!map->AddToMap(go))
- {
- delete go;
- return true;
- }
+ delete go;
+ return true;
}
}
}
- break;
}
return true;
}