Пример #1
0
        public void SpawnGO(object list)
        {
            var Params = (List <object>)list;

            int  Entry          = (int)Params[0];
            int  X              = (int)Params[1];
            int  Y              = (int)Params[2];
            int  Z              = (int)Params[3];
            int  O              = (int)Params[4];
            uint AllowVfxUpdate = (uint)Params[5];

            GameObject_proto Proto = GameObjectService.GetGameObjectProto((uint)Entry);

            GameObject_spawn Spawn = new GameObject_spawn();

            Spawn.Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID();
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO         = O;
            Spawn.WorldX         = X;
            Spawn.WorldY         = Y;
            Spawn.WorldZ         = Z;
            Spawn.ZoneId         = (ushort)Obj.ZoneId;
            Spawn.AllowVfxUpdate = AllowVfxUpdate;
            GameObject go = Obj.Region.CreateGameObject(Spawn);

            go.Respawn = 0;
            go.EvtInterface.AddEventNotify(EventName.OnDie, RemoveGOs); // We are removing spawns from server when adds die

            goList.Add(go);                                             // Adding adds to the list for easy removal
        }
        public static void Spawn(Player plr, uint entry)
        {
            GameObject_proto proto = GameObjectService.GetGameObjectProto(entry);

            if (proto == null)
            {
                plr.SendClientMessage($"Invalid go entry({entry})", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                return;
            }

            plr.UpdateWorldPosition();

            GameObject_spawn spawn = new GameObject_spawn();

            spawn.Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID();
            spawn.BuildFromProto(proto);
            spawn.WorldO = plr._Value.WorldO;
            spawn.WorldY = plr._Value.WorldY;
            spawn.WorldZ = plr._Value.WorldZ;
            spawn.WorldX = plr._Value.WorldX;
            spawn.ZoneId = plr.Zone.ZoneId;

            WorldMgr.Database.AddObject(spawn);

            plr.Region.CreateGameObject(spawn);
        }
Пример #3
0
        private void AddGlow(Realms assaultingRealm)
        {
            GameObject_proto glowProto = GameObjectService.GetGameObjectProto(99858); //99858

            if (glowProto != null)
            {
                GameObject_spawn spawn = new GameObject_spawn
                {
                    Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                    WorldO = Heading,
                    WorldX = WorldPosition.X,
                    WorldY = WorldPosition.Y,
                    WorldZ = WorldPosition.Z,
                    ZoneId = ZoneId,
                };
                spawn.BuildFromProto(glowProto);

                var siegeRangeFlag = new GameObject(spawn);
                if (assaultingRealm == Realms.REALMS_REALM_DESTRUCTION)
                {
                    siegeRangeFlag.VfxState = 2; //1 blue, 2 red, 3 white, 4 - white;
                }
                else
                {
                    siegeRangeFlag.VfxState = 1; //1 blue, 2 red, 3 white, 4 - white;
                }
                Region.AddObject(siegeRangeFlag, ZoneId);
            }
        }
Пример #4
0
        private void CreateGlow(ClickFlag flag)
        {
            if (_glowObject != null)
            {
                _glowObject.RemoveFromWorld();
            }
            // Spawn objective glow (Big Poofy Glowy Nuet)
            GameObject_proto glowProto = GameObjectService.GetGameObjectProto(99858);

            if (glowProto != null)
            {
                GameObject_spawn spawn = new GameObject_spawn
                {
                    Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                    WorldO = flag.Heading,
                    WorldX = flag.WorldPosition.X,
                    WorldY = flag.WorldPosition.Y,
                    WorldZ = (ushort)flag.WorldPosition.Z,
                    ZoneId = Region.RegionId,
                };
                spawn.BuildFromProto(glowProto);

                _glowObject          = new GameObject(spawn);
                _glowObject.VfxState = (byte)flag.Owner;
                Region.AddObject(_glowObject, spawn.ZoneId);
            }
        }
        private void CreateSalvage(int x, int y, int z, int o)
        {
            if (_salvage != null)
            {
                _salvage.RemoveFromWorld();
            }

            GameObject_proto glowProto = GameObjectService.GetGameObjectProto(100598);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = 0,
                WorldX = x,
                WorldY = y,
                WorldZ = (ushort)z,
                ZoneId = Region.RegionId,
            };

            spawn.BuildFromProto(glowProto);

            _salvage = new Part(spawn, FLAG_EFFECTS.Mball1, 2000, 2000)
            {
                PickedUp   = new Part.PartDelegate(SalvagePickedUp),
                DroppedOff = new Part.PartDelegate(SalvageDroppedOff),
                Lost       = new Part.PartDelegate(SalvageLost)
            };
            Region.AddObject(_salvage, spawn.ZoneId);
        }
        public void CreateGlow()
        {
            if (Region != null)
            {
                if (_glowObject != null)
                {
                    _glowObject.RemoveFromWorld();
                }
                // Spawn objective glow (Big Poofy Glowy Nuet)
                GameObject_proto glowProto = GameObjectService.GetGameObjectProto(99858);

                if (glowProto != null)
                {
                    GameObject_spawn spawn = new GameObject_spawn
                    {
                        Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                        WorldO = Heading,
                        WorldX = _x,
                        WorldY = _y,
                        WorldZ = _z,
                        ZoneId = Region.RegionId,
                    };
                    spawn.BuildFromProto(glowProto);

                    _glowObject          = new GameObject(spawn);
                    _glowObject.VfxState = (byte)GlowOwner;

                    Region.AddObject(_glowObject, spawn.ZoneId);
                }
            }
        }
Пример #7
0
        public void Spawn(bool attackable)
        {
            GameObject?.Destroy();

            GameObject_proto proto = GameObjectService.GetGameObjectProto(Info.GameObjectId);

            if (proto == null)
            {
                Log.Error("KeepDoor", "No Door Proto");
                return;
            }

            _logger.Debug($"Spawning Keep Door = {Info.DoorId} Number = {Info.Number} for Keep = {Keep.Info.Name}");

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = Info.O,
                WorldY = Info.Y,
                WorldZ = Info.Z,
                WorldX = Info.X,
                ZoneId = Info.ZoneId,
                DoorId = Info.DoorId,
            };

            spawn.BuildFromProto(proto);

            GameObject = new KeepGameObject(spawn, this, Keep);
            Region.AddObject(GameObject, spawn.ZoneId);

            GameObject.SetAttackable(attackable);

            Occlusion.SetFixtureVisible(Info.DoorId, true);
        }
Пример #8
0
        public void Spawn()
        {
            GameObject?.Destroy();

            GameObject_proto proto = GameObjectService.GetGameObjectProto(Info.GameObjectId);

            if (proto == null)
            {
                Log.Error("KeepDoor", "No Door Proto");
                return;
            }

            // Log.Info("KeepDoor", "Spawning Keep Door = " + Info.DoorId + " Number = " + Info.Number);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = Info.O,
                WorldY = Info.Y,
                WorldZ = Info.Z,
                WorldX = Info.X,
                ZoneId = Info.ZoneId,
                DoorId = Info.DoorId,
            };

            spawn.BuildFromProto(proto);

            GameObject = new KeepGameObject(spawn, this, Keep);
            Region.AddObject(GameObject, spawn.ZoneId);

            GameObject.SetAttackable(Keep.KeepStatus != KeepStatus.KEEPSTATUS_LOCKED);

            WarZoneLib.RegionData.HideDoor(false, Info.ZoneId, Info.DoorId);
        }
Пример #9
0
        public static void Point(Player plr)
        {
            if (plr.Zone == null)
            {
                SendCsr(plr, "CAMPAIGN POINT: Must be in a zone to use this command.");
                return;
            }

            IBattlefrontFlag closestFlag = plr.Region.Bttlfront.GetClosestFlag(plr.WorldPosition);

            if (closestFlag == null)
            {
                SendCsr(plr, "CAMPAIGN POINT: Must be in an open-world RvR zone.");
                return;
            }
            else if (!(closestFlag is BattlefrontFlag))
            {
                SendCsr(plr, "CAMPAIGN POINT: This command is supported in legacy RvR.");
                return;
            }

            plr.SendClientMessage("Flag: " + closestFlag.ObjectiveName);
            GameObject_proto proto = GameObjectService.GetGameObjectProto(429);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldX = plr.WorldPosition.X,
                WorldY = plr.WorldPosition.Y,
                WorldZ = plr.WorldPosition.Z,
                WorldO = plr.Heading,
                ZoneId = plr.Zone.ZoneId
            };

            spawn.BuildFromProto(proto);
            plr.Region.CreateGameObject(spawn);

            BattlefrontResourceSpawn res = new BattlefrontResourceSpawn
            {
                Entry = ((BattlefrontFlag)closestFlag).ID,
                X     = plr.X,
                Y     = plr.Y,
                Z     = plr.Z,
                O     = plr.Heading
            };

            WorldMgr.Database.AddObject(res);
        }
Пример #10
0
        public void EnergyFlux()
        {
            Brain.SpeakYourMind(" using EnergyFlux");

            // Remove any old electron fluxes (max of 4)
            var fluxes = Owner.GetInRange <GameObject>(150);

            if (fluxes.Count > 4)
            {
                foreach (var flux in fluxes)
                {
                    if (flux.Entry == 3100414)
                    {
                        flux.EvtInterface.AddEvent(flux.Destroy, 2 * 1000, 1);
                        break;
                    }
                }
            }

            GameObject_proto proto = GameObjectService.GetGameObjectProto(3100414);

            var newTarget = Brain.SetRandomTarget();

            if (newTarget != null)
            {
                GameObject_spawn spawn = new GameObject_spawn
                {
                    Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                    WorldO = 2093,
                    WorldX = newTarget.WorldPosition.X + StaticRandom.Instance.Next(50),
                    WorldY = newTarget.WorldPosition.Y + StaticRandom.Instance.Next(50),
                    WorldZ = newTarget.WorldPosition.Z,
                    ZoneId = (ushort)Owner.ZoneId
                };

                spawn.BuildFromProto(proto);
                proto.IsAttackable = 1;

                var go = Owner.Region.CreateGameObject(spawn);
                // When the gameobject dies, remove it.
                go.EvtInterface.AddEventNotify(EventName.OnDie, RemoveGOs);
                // When the boss dies, remove all child "fluxes"
                Owner.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAllFluxes);
                // Buff the flux with the lightning rod buff.
                go.BuffInterface.QueueBuff(new BuffQueueInfo(go, 48, AbilityMgr.GetBuffInfo((ushort)1543),
                                                             BuffAssigned));
            }
        }
Пример #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="plr">Player that initiated the command</param>
        /// <param name="values">List of command arguments (after command name)</param>
        /// <returns>True if command was correctly handled, false if operation was canceled</returns>
        public static bool RespawnAdd(Player plr, ref List <string> values)
        {
            byte         realm   = (byte)GetInt(ref values);
            Zone_Respawn respawn = new Zone_Respawn
            {
                PinX   = (ushort)plr.X,
                PinY   = (ushort)plr.Y,
                PinZ   = (ushort)plr.Z,
                WorldO = plr.Heading,
                ZoneID = plr.Zone.ZoneId,
                Realm  = realm
            };

            WorldMgr.Database.AddObject(respawn);
            ZoneService.LoadZone_Respawn();

            GameObject_proto proto = GameObjectService.GetGameObjectProto(563);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldX = plr.WorldPosition.X,
                WorldY = plr.WorldPosition.Y,
                WorldZ = plr.WorldPosition.Z,
                WorldO = plr.Heading,
                ZoneId = plr.Zone.ZoneId
            };

            spawn.BuildFromProto(proto);
            plr.Region.CreateGameObject(spawn);

            GMCommandLog log = new GMCommandLog
            {
                PlayerName = plr.Name,
                AccountId  = (uint)plr.Client._Account.AccountId,
                Command    = "ADD RESPAWN TO " + plr.Zone.ZoneId + " " + (ushort)plr.X + " " + (ushort)plr.Y,
                Date       = DateTime.Now
            };

            CharMgr.Database.AddObject(log);

            return(true);
        }
Пример #12
0
        public static LootChest Create(RegionMgr region, Point3D location, ushort zoneId, bool convertPin = true)
        {
            if (region == null)
            {
                Log.Error("LootChest", "Attempt to create for NULL region");
                return(null);
            }

            GameObject_proto proto = GameObjectService.GetGameObjectProto(188);
            GameObject_spawn spawn = new GameObject_spawn();

            if (convertPin)  // Non-fort zone location points are PIN position system, forts are worldposition.
            {
                var targetPosition = ZoneService.GetWorldPosition(ZoneService.GetZone_Info(zoneId), (ushort)location.X,
                                                                  (ushort)location.Y, (ushort)location.Z);

                spawn.Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID();
                spawn.WorldO = 0;
                spawn.WorldY = targetPosition.Y + StaticRandom.Instance.Next(50, 100);
                spawn.WorldZ = targetPosition.Z;
                spawn.WorldX = targetPosition.X + StaticRandom.Instance.Next(50, 100);
                spawn.ZoneId = zoneId;
            }
            else
            {
                spawn.Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID();
                spawn.WorldO = 0;
                spawn.WorldY = location.Y + StaticRandom.Instance.Next(50, 100);
                spawn.WorldZ = location.Z;
                spawn.WorldX = location.X + StaticRandom.Instance.Next(50, 100);
                spawn.ZoneId = zoneId;
            }


            spawn.BuildFromProto(proto);
            var chest = region.CreateLootChest(spawn);

            chest.LootBags = new Dictionary <uint, KeyValuePair <Item_Info, List <Talisman> > >();


            return(chest);
        }
Пример #13
0
        public void CreateExitPortal(int X, int Y, int Z, int O)
        {
            GameObject_proto Proto = GameObjectService.GetGameObjectProto(98878); // This is portal

            GameObject_spawn Spawn = new GameObject_spawn();

            Spawn.Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID();
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO = O;
            Spawn.WorldX = X;
            Spawn.WorldY = Y;
            Spawn.WorldZ = Z;
            Spawn.ZoneId = (ushort)Obj.ZoneId;
            GameObject go = Obj.Region.CreateGameObject(Spawn);

            go.Respawn = 0;
            go.EvtInterface.AddEvent(go.Destroy, 30 * 10 * 1000, 1);

            //goList.Add(go); // Adding adds to the list for easy removal
        }
Пример #14
0
        // Make RoR Great Again - adding wall
        public void AddWall()
        {
            GameObject_proto proto = GameObjectService.GetGameObjectProto(2000441);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldX = 137348,
                WorldY = 524446,
                WorldZ = 11128,
                WorldO = 2008,
                ZoneId = 169
            };

            spawn.BuildFromProto(proto);
            GameObject GO = Obj.Region.CreateGameObject(spawn);

            GO.Say("**Wall of magical force is now blocking the exit**", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY);
            magicWalls.Add(GO);
        }
        private void CreateBomb(int x, int y, int z, int o)
        {
            _carrier = null;
            if (_bomb != null)
            {
                _bomb.RemoveFromWorld();
                _bomb = null;
            }
            if (_carrier != null)
            {
                _carrier.OSInterface.RemoveEffect((byte)0xB);
                _carrier = null;
            }

            GameObject_proto glowProto = GameObjectService.GetGameObjectProto(100112);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = 0,
                WorldX = x,
                WorldY = y,
                WorldZ = (ushort)z,
                ZoneId = Region.RegionId,
            };

            spawn.BuildFromProto(glowProto);

            _bomb = new Part(spawn, FLAG_EFFECTS.Bomb, 2000, 2000)
            {
                PickedUp   = new Part.PartDelegate(BombPickedUp),
                DroppedOff = new Part.PartDelegate(BombDroppedOff),
                Lost       = new Part.PartDelegate(BombLost)
            };
            Region.AddObject(_bomb, spawn.ZoneId);
            if (_centerGlow != null)
            {
                _centerGlow.VfxState = 0;
            }
        }
Пример #16
0
        public override void OnLoad()
        {
            X = Zone.CalculPin((uint)HomePosition.X, true);
            Y = Zone.CalculPin((uint)HomePosition.Y, false);
            Z = HomePosition.Z;

            base.OnLoad();

            WorldPosition.SetCoordsFrom(HomePosition);

            HomePosition = new Point3D(WorldPosition);

            SetOffset((ushort)(HomePosition.X >> 12), (ushort)(HomePosition.Y >> 12));

            // Spawn objective glow (Big Poofy Glowy Nuet)
            GameObject_proto glowProto = GameObjectService.GetGameObjectProto(99858);

            if (glowProto == null)
            {
                return;
            }

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = Heading,
                WorldY = WorldPosition.Y + 2,
                WorldZ = WorldPosition.Z,
                WorldX = WorldPosition.X + 6,
                ZoneId = Zone.ZoneId,
            };

            spawn.BuildFromProto(glowProto);

            _glowObject = new GameObject(spawn);

            SetGlowColorFor(RealmCapturableFor);

            Region.AddObject(_glowObject, spawn.ZoneId);
        }
        private GameObject AddObject(int x, int y, int z, int o, uint entry)
        {
            GameObject_proto glowProto = GameObjectService.GetGameObjectProto(entry);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = o,
                WorldX = x,
                WorldY = y,
                WorldZ = (ushort)z,
                ZoneId = Region.RegionId,
            };

            spawn.BuildFromProto(glowProto);

            var obj = new GameObject(spawn);

            Region.AddObject(obj, spawn.ZoneId);

            return(obj);
        }
Пример #18
0
        public override void OnLoad()
        {
            Z = _z;
            X = Zone.CalculPin((uint)_x, true);
            Y = Zone.CalculPin((uint)_y, false);
            base.OnLoad();

            Heading         = (ushort)_o;
            WorldPosition.X = _x;
            WorldPosition.Y = _y;
            WorldPosition.Z = _z;

            SetOffset((ushort)(_x >> 12), (ushort)(_y >> 12));

            IsActive = true;

            // Spawn objective glow (Big Poofy Glowy Nuet)
            GameObject_proto glowProto = GameObjectService.GetGameObjectProto(99858);

            if (glowProto == null)
            {
                return;
            }

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = Heading,
                WorldY = WorldPosition.Y,
                WorldZ = WorldPosition.Z - 256,
                WorldX = WorldPosition.X,
                ZoneId = Zone.ZoneId,
            };

            spawn.BuildFromProto(glowProto);

            _glowObject = new GameObject(spawn);
            Region.AddObject(_glowObject, spawn.ZoneId);
        }
Пример #19
0
        /// <summary>
        /// Aslong as the Banner of Bloodlust i s up,Borzhar will charge a t a new target
        /// and should s tay locked on the target for a medium duration before charging
        /// at a new target. Players can destroy the banner which will prevent him f rom
        /// using this charge anymore.
        /// </summary>
        public void DeployBannerOfBloodlust()
        {
            Brain.SpeakYourMind(" using DeployBannerOfBloodlust");

            GameObject_proto proto = GameObjectService.GetGameObjectProto(3100412);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldX = Owner.WorldPosition.X + StaticRandom.Instance.Next(50),
                WorldY = Owner.WorldPosition.Y + StaticRandom.Instance.Next(50),
                WorldZ = Owner.WorldPosition.Z,
                WorldO = Owner.Heading,
                ZoneId = Owner.Zone.ZoneId
            };

            spawn.BuildFromProto(proto);
            proto.IsAttackable = 1;

            var go = Owner.Region.CreateGameObject(spawn);

            go.EvtInterface.AddEventNotify(EventName.OnDie, RemoveGOs);
        }
Пример #20
0
        public static void Create(RegionMgr region, PQuest_Info info, ref Dictionary <uint, ContributionInfo> players, float bagCountMod)
        {
            if (region == null)
            {
                Log.Error("GoldChest", "Attempt to create for NULL region");
                return;
            }

            if (info == null)
            {
                Log.Error("GoldChest", "NULL PQuest in Region " + region);
                return;
            }

            if (bagCountMod == 0.0f)
            {
                return;
            }

            GameObject_proto proto = GameObjectService.GetGameObjectProto(188);

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldO = 0,
                WorldY = info.GoldChestWorldY,
                WorldZ = info.GoldChestWorldZ,
                WorldX = info.GoldChestWorldX,
                ZoneId = info.ZoneId
            };

            spawn.BuildFromProto(proto);

            GoldChest chest = new GoldChest(spawn, info, ref players, bagCountMod, region);

            region.AddObject(chest, info.ZoneId);
        }
        public static void Local(Player plr, uint entry, int zoneX, int zoneY, int z, int heading)
        {
            if (plr.Zone == null)
            {
                plr.SendClientMessage("GAMEOBJECT LOCAL: Must be in a zone to use this command.", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                return;
            }

            int worldX = (plr.Zone.Info.OffX << 12) + (zoneX - 8192);
            int worldY = (plr.Zone.Info.OffY << 12) + (zoneY - 8192);

            GameObject_proto proto = GameObjectService.GetGameObjectProto(entry);

            if (proto == null)
            {
                plr.SendClientMessage($"GAMEOBJECT LOCAL: Unable to find a game object prototype of the specified entry {entry}", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE);
                return;
            }

            GameObject_spawn spawn = new GameObject_spawn
            {
                Guid   = (uint)GameObjectService.GenerateGameObjectSpawnGUID(),
                WorldX = worldX,
                WorldY = worldY,
                WorldZ = z,
                WorldO = heading,
                ZoneId = plr.Zone.ZoneId
            };

            spawn.BuildFromProto(proto);

            WorldMgr.Database.AddObject(spawn);

            plr.Region.CreateGameObject(spawn);

            plr.Teleport(plr.Zone.ZoneId, (uint)worldX, (uint)worldY, (ushort)z, 0);
        }
Пример #22
0
        public void Reset()
        {
            if (Objective == null)
            {
                Log.Error("PQuestObjective.Reset", string.Concat(Quest.Name, " has no objective!"));
                return;
            }

            if (Objective.Spawns == null)
            {
                Log.Error("PQuestObjective.Reset", string.Concat(Quest.Name, " - ", Objective.StageName, " has no spawn set"));
                return;
            }

            foreach (PQuest_Spawn spawn in Objective.Spawns)
            {
                if (spawn.Type == 1)
                {
                    Creature_proto proto = CreatureService.GetCreatureProto(spawn.Entry);
                    if (proto == null)
                    {
                        Log.Error("PQCreature", "No Proto");
                        continue;
                    }

                    if (Quest == null)
                    {
                        Log.Error("PQuestObjective", "Missing quest for: " + Objective.Objective);
                        continue;
                    }

                    Creature_spawn S = new Creature_spawn
                    {
                        Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID(),
                        WorldO = spawn.WorldO,
                        WorldY = spawn.WorldY,
                        WorldZ = spawn.WorldZ,
                        WorldX = spawn.WorldX,
                        ZoneId = spawn.ZoneId
                    };
                    S.BuildFromProto(proto);
                    //This sets the emotes for NPCs in PQ
                    S.Emote = spawn.Emote;
                    //This sets NPC level from puest_spawns table, we are not using creature_protos here
                    S.Level = spawn.Level;

                    PQuestCreature newCreature = new PQuestCreature(S, this, Quest);
                    newCreature.PQSpawnId = spawn.pquest_spawns_ID.Replace(" ", "");

                    if (newCreature != null)
                    {
                        lock (ActiveCreatures)
                        {
                            ActiveCreatures.Add(newCreature);
                        }

                        Quest.Region.AddObject(newCreature, spawn.ZoneId);
                    }
                }
                if (spawn.Type == 2)
                {
                    GameObject_proto Proto = GameObjectService.GetGameObjectProto(spawn.Entry);
                    if (Proto == null)
                    {
                        Log.Error("PQGO", "No Proto");
                        return;
                    }

                    GameObject_spawn S = new GameObject_spawn();
                    S.Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID();
                    S.BuildFromProto(Proto);
                    S.WorldO         = spawn.WorldO;
                    S.WorldY         = spawn.WorldY;
                    S.WorldZ         = spawn.WorldZ;
                    S.WorldX         = spawn.WorldX;
                    S.ZoneId         = spawn.ZoneId;
                    S.SoundId        = spawn.SoundId;
                    S.VfxState       = spawn.VfxState;
                    S.AllowVfxUpdate = spawn.AllowVfxUpdate;
                    S.Unks           = spawn.Unks;
                    S.Unk3           = spawn.Unk3;


                    PQuestGameObject NewGo = new PQuestGameObject(S, this);
                    if (NewGo != null)
                    {
                        lock (ActiveGameObjects)
                        {
                            ActiveGameObjects.Add(NewGo);
                        }
                        Quest.Region.AddObject(NewGo, spawn.ZoneId);
                    }

                    // PQ Sound player - this will play sounds on PQ Stage, need to be setup in DB
                    if (spawn.Entry == 2000489 && Objective.SoundId != 0)
                    {
                        string text = "";

                        var prms = new List <object>()
                        {
                            NewGo, (ushort)Objective.SoundId, text
                        };

                        for (int i = 0; i < Objective.SoundIteration; i++)
                        {
                            NewGo.EvtInterface.AddEvent(PlayPQSound, i * (int)Objective.SoundDelay * 1000 + 500, 1, prms);
                        }
                    }
                }
                if (spawn.Type == 3)
                {
                    return;

#warning this sucks cant get gos by spawn id

                    ActiveInteractableGameObjects.Add(spawn.Entry);
                }
            }
        }
Пример #23
0
        public void End()
        {
            if (_ended)
            {
                return;
            }

            if (IsDungeon())
            {
                _stageTimeEnd = TCPManager.GetTimeStamp() + TIME_DUNGEON_RESET;
                EvtInterface.AddEvent(Reset, TIME_DUNGEON_RESET * 1000, 1);
            }
            else
            {
                _stageTimeEnd = TCPManager.GetTimeStamp() + TIME_PQ_RESET;
                EvtInterface.AddEvent(Reset, TIME_PQ_RESET * 1000, 1);
            }

            _started = false;
            _ended   = true;

            foreach (uint plr in ActivePlayers)
            {
                Player targPlayer = Player.GetPlayer(plr);
                if (targPlayer != null)
                {
                    targPlayer.SendLocalizeString(Info.Name + " Complete", ChatLogFilters.CHATLOGFILTERS_SAY, GameData.Localized_text.CHAT_TAG_MONSTER_EMOTE);
                    //SendReinitTime(Plr, TIME_PQ_RESET);
                    targPlayer.AddInfluence((ushort)Info.ChapterId, 500);
                }
            }
            //sanity check - remove players in the PQ who won without doing anything
            foreach (KeyValuePair <uint, ContributionInfo> kV in Players)
            {
                if (kV.Value.ActiveTimeEnd == 0) // no contribution yet
                {
                    _toRemove.Add(kV);
                }
            }

            if (_toRemove.Count > 0)
            {
                foreach (var kVr in _toRemove)
                {
                    Players.Remove(kVr.Key);
                }
                _toRemove.Clear();
            }

            GoldChest.Create(Region, Info, ref Players, 1);

            // We are playing some sounds when we finish the whole PQ
            if (Info.SoundPQEnd != 0)
            {
                GameObject_proto Proto = GameObjectService.GetGameObjectProto(2000489);

                GameObject_spawn S = new GameObject_spawn();
                S.Guid = (uint)GameObjectService.GenerateGameObjectSpawnGUID();
                S.BuildFromProto(Proto);
                S.WorldX = Info.GoldChestWorldX;
                S.WorldY = Info.GoldChestWorldY;
                S.WorldZ = Info.GoldChestWorldZ;
                S.WorldO = 0;
                S.ZoneId = Info.ZoneId;

                GameObject GOSoundPlayer = Region.CreateGameObject(S);

                // PQ Sound player - this will play sounds on PQ Stage, need to be setup in DB
                var prms = new List <object>()
                {
                    GOSoundPlayer, (ushort)Info.SoundPQEnd
                };

                GOSoundPlayer.EvtInterface.AddEvent(PlayFinalPQSound, 1 * 1000, 1, prms);

                //GOSoundPlayer.EvtInterface.AddEvent(Destroy, 5 * 1000, 1);
            }
        }