示例#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
        }
示例#2
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);
        }
示例#3
0
        /// <summary>
        /// Creates a game object spawn entity from given Campaign portal object.
        /// </summary>
        /// <param name="battleFrontObject">Portal object providing raw data</param>
        /// <returns>newly created spawn entity</returns>
        private GameObject_spawn CreateSpawn(BattleFrontObject battleFrontObject)
        {
            GameObject_proto proto = GameObjectService.GetGameObjectProto(PORTAL_PROTO_ENTRY);

            proto = (GameObject_proto)proto.Clone();

            GameObject_spawn spawn = new GameObject_spawn();

            spawn.BuildFromProto(proto);

            // boule blanche : 3457
            // grosse boule blanche : 1675
            proto.Scale = 25;
            // spawn.DisplayID = 1675;
            spawn.DisplayID = 1675;
            spawn.ZoneId    = battleFrontObject.ZoneId;

            Point3D worldPos = GetWorldPosition(battleFrontObject);

            spawn.WorldX = worldPos.X;
            spawn.WorldY = worldPos.Y;
            spawn.WorldZ = worldPos.Z;
            spawn.WorldO = battleFrontObject.O;

            return(spawn);
        }
        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);
                }
            }
        }
示例#5
0
        /// <summary>
        /// Creates a game object spawn entity from given Campaign portal object.
        /// </summary>
        /// <param name="battleFrontObject">Portal object providing raw data</param>
        /// <returns>newly created spawn entity</returns>
        private GameObject_spawn CreateSpawn(int zoneId, int x, int y, int z, int o)
        {
            GameObject_proto proto = GameObjectService.GetGameObjectProto(PORTAL_PROTO_ENTRY);

            proto = (GameObject_proto)proto.Clone();

            GameObject_spawn spawn = new GameObject_spawn();

            spawn.BuildFromProto(proto);

            // boule blanche : 3457
            // grosse boule blanche : 1675
            proto.Scale = 25;
            // spawn.DisplayID = 1675;
            spawn.DisplayID = 1675;
            spawn.ZoneId    = (ushort)zoneId;

            spawn.WorldX = x;
            spawn.WorldY = y;
            spawn.WorldZ = z;
            spawn.WorldO = o;

            spawn.IsValid   = true;
            spawn.IsDeleted = false;
            spawn.Guid      = 132456;

            return(spawn);
        }
        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);
            }
        }
        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);
        }
示例#8
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 ExplodeFlags()
        {
            GroundTarget gt1 = new GroundTarget(Flags[0].WorldPosition, GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt1, 230);

            GroundTarget gt2 = new GroundTarget(Flags[1].WorldPosition, GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt2, 230);

            GroundTarget gt3 = new GroundTarget(new Point3D(364572, 365590, 12036), GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt3, 230);


            EvtInterface.AddEvent(() =>
            {
                Explosion(gt1);
                Explosion(gt2);
                Explosion(gt3);
            }, 1000, 1);

            //remove ground targets after explosions
            EvtInterface.AddEvent(() =>
            {
                gt1.RemoveFromWorld();
                gt2.RemoveFromWorld();
                gt3.RemoveFromWorld();
            }, 10000, 1);

            EvtInterface.AddEvent(Unlock, 5000, 1);
        }
        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);
        }
示例#11
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);
        }
示例#12
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);
        }
示例#13
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));
            }
        }
示例#14
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);
        }
示例#15
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);
        }
示例#16
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
        }
示例#17
0
        public CapturePoint(Scenario_Object scenarioObject, Func <Player, bool> captureCheck, Action <CapturePoint> onCapture)
        {
            ObjectiveID   = scenarioObject.Identifier;
            ObjectiveName = scenarioObject.ObjectiveName;
            _x            = scenarioObject.WorldPosX;
            _y            = scenarioObject.WorldPosY;
            _z            = scenarioObject.PosZ;
            _o            = scenarioObject.Heading;
            _proto        = GameObjectService.GetGameObjectProto(scenarioObject.ProtoEntry);
            _captureCheck = captureCheck;
            _onCapture    = onCapture;

            _captureText         = scenarioObject.CaptureObjectiveText.Replace("%n", ObjectiveName);
            _captureDesc         = scenarioObject.CaptureObjectiveDescription.Replace("%n", ObjectiveName);
            _holdText            = scenarioObject.HoldObjectiveText.Replace("%n", ObjectiveName);
            _holdDesc            = scenarioObject.HoldObjectiveDescription.Replace("%n", ObjectiveName);
            _captureAnnouncement = scenarioObject.CaptureAnnouncement;

            CaptureDuration = 3;
        }
        // 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;
            }
        }
示例#20
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);
        }
        public MurderballScenario(Scenario_Info info, int tier)
            : base(info, tier)
        {
            foreach (Scenario_Object obj in info.ScenObjects)
            {
                HoldObject ball;

                if (obj.ProtoEntry != 0)
                {
                    GameObject_proto proto = GameObjectService.GetGameObjectProto(obj.ProtoEntry);

                    ball = new HoldObject(obj.Identifier, obj.ObjectiveName, new Point3D(obj.WorldPosX, obj.WorldPosY, obj.PosZ), 14031, 30000, BallPickedUp, BallDropped, ObjectReset, BallBuffAssigned, proto.DisplayID, proto.DisplayID);
                }
                else
                {
                    ball = new HoldObject(obj.Identifier, obj.ObjectiveName, new Point3D(obj.WorldPosX, obj.WorldPosY, obj.PosZ), 14031, 30000, BallPickedUp, BallDropped, ObjectReset, BallBuffAssigned, 235, 233);
                }

                _murderballTicks.Add(ball, 0);
                Region.AddObject(ball, info.MapId);
            }
        }
        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);
        }
示例#23
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);
        }
示例#24
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);
        }
        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);
        }
示例#26
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);
        }
示例#27
0
        protected override void SetDeath(Unit killer)
        {
            Health = 0;

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_DEATH, 12);

            Out.WriteUInt16(Oid);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteUInt16(killer.IsPet() ? killer.GetPet().Owner.Oid : killer.Oid);
            Out.Fill(0, 6);
            DispatchPacket(Out, true);

            AbtInterface.Cancel(true);
            ScrInterface.OnDie(this);
            BuffInterface.RemoveBuffsOnDeath();

            EvtInterface.Notify(EventName.OnDie, this, killer);

            Pet    pet      = killer as Pet;
            Player credited = (pet != null) ? pet.Owner : (killer as Player);

            if (credited != null)
            {
                HandleDeathRewards(credited);
            }

            ClearTrackedDamage();

            _buildState = EConstructionState.Destroying;

            foreach (Player plr in _interactors)
            {
                plr.Palisade = null;
            }

            _interactors.Clear();

            foreach (NewBuff buff in _interactionBuffs)
            {
                buff.BuffHasExpired = true;
            }

            _interactionBuffs.Clear();

            GroundTarget gt = new GroundTarget(_constructor, new Point3D(WorldPosition), GameObjectService.GetGameObjectProto(23));

            Region.AddObject(gt, Zone.ZoneId);

            gt.BuffInterface.QueueBuff(new BuffQueueInfo(_constructor, 40, AbilityMgr.GetBuffInfo(23762)));

            gt.SetExpiry(TCPManager.GetTimeStampMS() + 5000);
        }
示例#28
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);
                }
            }
        }
示例#29
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);
            }
        }
示例#30
0
        public bool StartAbilityAtPos(AbilityInfo abInfo, byte castSequence, Point3D worldPos, ushort zoneID)
        {
            _pendingInfo = abInfo;
            _pendingInfo.TargetPosition = worldPos;
            _pendingItemCooldownGroup   = 0;
            _pendingCastSequence        = castSequence;

            byte result = ModifyInitials();

            if (result == 1 || !AllowStartCastAtPos() || !_caster.PointWithinRadiusFeet(_pendingInfo.TargetPosition, (int)(_caster.BaseRadius + _pendingInfo.Range)))
            {
                CancelPendingCast();
                return(false);
            }

            if (result == 2)
            {
                _abInterface.SetGlobalCooldown();
                CancelPendingCast();
                return(false);
            }

            if (result == 3)
            {
                _abInterface.SetCooldown(_pendingInfo.ConstantInfo.CooldownEntry != 0 ? _pendingInfo.ConstantInfo.CooldownEntry : _pendingInfo.Entry, _pendingInfo.Cooldown * 1000);
                CancelPendingCast();
                return(false);
            }

            // Cast success. Cancel existing ability if any

            if (AbInfo != null)
            {
                CancelCast(0);
            }

            AbInfo             = _pendingInfo;
            _pendingInfo       = null;
            _itemCooldownGroup = 0;
            _castSequence      = castSequence;

            _castStartTime = TCPManager.GetTimeStampMS();

            if (AbInfo.Level == 0)
            {
                AbInfo.Level = _abInterface.GetMasteryLevelFor(AbInfo.ConstantInfo.MasteryTree);
            }

            if (AbInfo.ConstantInfo.Origin != AbilityOrigin.AO_ITEM)
            {
                _caster.BuffInterface.NotifyAbilityStarted(AbInfo);
            }

            SendStart();

            if (!AbInfo.ConstantInfo.IgnoreGlobalCooldown)
            {
                _abInterface.SetGlobalCooldown();
            }

            if (AbInfo.ConstantInfo.ChannelID != 0)
            {
                // Channeled Morale 4s grant immunity and cannot be interrupted
                if (AbInfo.SpecialCost == -4)
                {
                    _caster.AddCrowdControlImmunity((int)CrowdControlTypes.Unstoppable);
                    _caster.IsImmovable = true;
                }

                GroundTarget gt = new GroundTarget(_caster, AbInfo.TargetPosition, GameObjectService.GetGameObjectProto(23));
                _caster.Region.AddObject(gt, _caster.Zone.ZoneId);

                gt.SetExpiry(TCPManager.GetTimeStampMS() + 20000);

                AbInfo.Target = gt;

                _channelHandler.Initialize(AbInfo, castSequence);
            }
            else
            {
                CastAtPosition();
            }

            return(false);
        }