Ejemplo n.º 1
0
        /// <summary>
        /// Delete the target <(0=World,1=Database)>
        /// </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 NpcRemove(Player plr, ref List <string> values)
        {
            Object obj = GetObjectTarget(plr);

            if (!obj.IsCreature())
            {
                return(false);
            }

            int database = GetInt(ref values);

            obj.Dispose();

            if (database > 0)
            {
                Creature_spawn spawn = obj.GetCreature().Spawn;
                WorldMgr.Database.DeleteObject(spawn);

                GMCommandLog log = new GMCommandLog();
                log.PlayerName = plr.Name;
                log.AccountId  = (uint)plr.Client._Account.AccountId;
                log.Command    = "REMOVE CREATURE " + spawn.Entry + " " + spawn.Guid + " AT " + spawn.ZoneId + " " + spawn.WorldX + " " + spawn.WorldY;
                log.Date       = DateTime.Now;
                CharMgr.Database.AddObject(log);
            }

            plr.SendClientMessage("NPC REMOVE: Removed " + obj.GetCreature().Spawn.Guid);

            return(true);
        }
Ejemplo n.º 2
0
        public bool RemoveAdds(Object npc = null, object instigator = null)
        {
            Creature c = npc as Creature;

            c.EvtInterface.AddEvent(c.Destroy, 10000, 1);
            return(false);
        }
Ejemplo n.º 3
0
        List <Object> stuffInRange = new List <Object>(); // This is list of stuff that entered range

        public override void OnObjectLoad(Object Obj)
        {
            this.Obj = Obj;
            Obj.EvtInterface.AddEventNotify(EventName.OnEnterCombat, SlayLowbies);
            Obj.EvtInterface.AddEventNotify(EventName.OnReceiveDamage, SlayLowbies);
            Obj.EvtInterface.AddEventNotify(EventName.OnDealDamage, SlayLowbies);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Sets armor piece color <slotIndex (0=all), pri_tint, sec_tint (from tintpalette_equipment.csv)>
        /// </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 NpcTint(Player plr, ref List <string> values)
        {
            Object target = plr.CbtInterface.GetCurrentTarget();

            if (target == null || !target.IsCreature())
            {
                return(false);
            }

            int slotIndex = GetInt(ref values);
            int pri       = GetInt(ref values);
            int sec       = GetInt(ref values);
            var creature  = target.GetCreature();

            foreach (var item in creature.ItmInterface.Items.Where(e => e != null && e.SlotId != 0))
            {
                if (slotIndex != 0 && item.SlotId != slotIndex)
                {
                    continue;
                }

                item._PrimaryColor               = (ushort)pri;
                item._SecondaryColor             = (ushort)sec;
                item.CreatureItem.PrimaryColor   = (ushort)pri;
                item.CreatureItem.SecondaryColor = (ushort)sec;
                WorldMgr.Database.SaveObject(item.CreatureItem);
            }
            WorldMgr.Database.ForceSave();
            creature.ItmInterface.SendEquipped(null);

            return(true);
        }
Ejemplo n.º 5
0
        public override void OnDie(Object Obj)
        {
            // Spawn the bad npc
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)135);

            if (Proto == null)
            {
                return;
            }

            Obj.UpdateWorldPosition();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO  = Obj.Heading;
            Spawn.WorldY  = Obj.WorldPosition.Y;
            Spawn.WorldZ  = Obj.WorldPosition.Z;
            Spawn.WorldX  = Obj.WorldPosition.X;
            Spawn.ZoneId  = Obj.Zone.ZoneId;
            Spawn.Faction = 72;
            Spawn.Emote   = 53;

            Creature c = Obj.Region.CreateCreature(Spawn);

            //  The villager will be disposed in 20 secs
            c.EvtInterface.AddEvent(c.Destroy, 20000, 1);
        }
Ejemplo n.º 6
0
        public void RemoveBuffs(Object Obj)
        {
            Creature c = Obj as Creature;

            //c.IsImmovable = false;
            c.IsInvulnerable = false;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// This method allow setting level for selected NPC.
        /// Works for normal NPC and PQ NPCs :)
        /// <param name="plr">Player that initiated the command</param>
        /// <param name="values">List of command arguments (after command name)</param>
        /// </summary>
        public static bool NpcLevel(Player plr, ref List <string> values)
        {
            Object target = plr.CbtInterface.GetCurrentTarget();

            if (target == null)
            {
                return(false);
            }
            int nPCLevel = GetInt(ref values);

            Creature creature = target.GetCreature();

            creature.Spawn.Level = (byte)nPCLevel;

            if (creature.PQSpawnId == null)
            {
                WorldMgr.Database.SaveObject(creature.Spawn);
            }
            else
            {
                PQuest_Spawn pQSpawn = WorldMgr.Database.SelectObject <PQuest_Spawn>("pquest_spawns_ID='" + creature.PQSpawnId + "'");
                pQSpawn.Level = (byte)nPCLevel;
                WorldMgr.Database.SaveObject(pQSpawn);
            }

            creature.RezUnit();
            return(true);
        }
Ejemplo n.º 8
0
        // This allow to enable or disable event, .event enable 1
        // to enable or .event enable 0 to disable
        public static bool EventEnable(Player plr, ref List <string> values)
        {
            int    enabled = GetInt(ref values);
            Object obj     = GetObjectTarget(plr);

            return(false);
        }
Ejemplo n.º 9
0
        // When something gets in range (I think it is 350 or 400) we want
        // to add it to correct lists and set some events
        public override void OnEnterRange(Object Obj, Object DistObj)
        {
            if (DistObj.IsPlayer())
            {
                //Obj.Say("YOU HAVE COME IN RANGE " + DistObj.Name);
                stuffInRange.Add(DistObj);

                // Just some small talk every 10s
                //Obj.EvtInterface.AddEvent(SayStuff, 10000, 0);

                // Checks HP of boss when receiving damage
                Obj.EvtInterface.AddEventNotify(EventName.OnReceiveDamage, CheckHP);

                // Bragging about killing player when players die
                DistObj.EvtInterface.AddEventNotify(EventName.OnDie, OnKilledPlayer);

                // Spawns magic wall to make everybody fight in his labolatory

                // Despawns adds and maigc walls on boss death
                Obj.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAllAdds);
                Obj.EvtInterface.AddEventNotify(EventName.OnDie, RemoveWall);
            }

            // We are adding the magic walls we are spawning below to the list to quickly dispose them when needed
            else if (DistObj.IsGameObject())
            {
                GameObject GO = DistObj as GameObject;
                if (GO.Entry == 2000441)
                {
                    // Despawns wall when boss dies
                    magicWalls.Add(GO);
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Changes the current faction of selected Unit (byte Faction)
        /// </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 ModifyFaction(Player plr, ref List <string> values)
        {
            byte faction = (byte)GetInt(ref values);
            byte save    = (byte)(values.Count > 0 ? GetInt(ref values) : 0);

            Object obj = GetObjectTarget(plr);

            RegionMgr region = obj.Region;
            ushort    zoneId = obj.Zone.ZoneId;

            obj.RemoveFromWorld();
            obj.GetUnit().SetFaction(faction);
            region.AddObject(obj.GetUnit(), zoneId, true);

            if (save > 0)
            {
                if (obj.IsCreature())
                {
                    Creature crea = obj.GetCreature();
                    crea.Spawn.Faction = faction;
                    WorldMgr.Database.SaveObject(crea.Spawn);
                }
            }

            return(true);
        }
Ejemplo n.º 11
0
 // When something gets in range (I think it is 350 or 400) we want
 // to add it to correct lists and set some events
 public override void OnEnterRange(Object Obj, Object DistObj)
 {
     if (DistObj.IsPlayer())
     {
         stuffInRange.Add(DistObj);
     }
 }
Ejemplo n.º 12
0
        public override void SetOwner(Object owner)
        {
            _Owner  = owner;
            _weapon = (Creature)owner;

            switch (_weapon.Spawn.Proto.CreatureSubType)
            {
            case (byte)CreatureSubTypes.SIEGE_GTAOE:
                Type = SiegeType.GTAOE;
                break;

            case (byte)CreatureSubTypes.SIEGE_SINGLE_TARGET:
                Type = SiegeType.SNIPER;
                break;

            case (byte)CreatureSubTypes.SIEGE_OIL:
                Type = SiegeType.OIL;
                break;

            case (byte)CreatureSubTypes.SIEGE_RAM:
                Type        = SiegeType.RAM;
                _maxPlayers = 4;
                break;

            default:
                Type = SiegeType.DIRECT;
                break;
            }
        }
Ejemplo n.º 13
0
        public void AddObject(Object obj)
        {
            if (obj.Zone == this)
            {
                Log.Error("ZoneMgr", "Object Already in zone : " + ZoneId);
                return;
            }

            obj.SetZone(this);

            if (obj is PublicQuest)
            {
                PQuests.Add((PublicQuest)obj);
            }

            if (obj is HotSpot)
            {
                HotSpots.Add((HotSpot)obj);
            }

            if (obj is Player)
            {
                lock (Players)
                    Players.Add((Player)obj);
            }

            obj.LastRangeCheck = new Point2D();
        }
Ejemplo n.º 14
0
        public bool RemoveObject(Object obj)
        {
            // nothing to remove here
            if (obj == null)
            {
                return(true);
            }

            //if (Obj.IsPlayer())
            //    Log.Success("RemoveObject", Obj.Name);

            obj.EvtInterface.Notify(EventName.OnRemoveFromWorld, obj, null);

            var rem = new ObjectRemove
            {
                Obj  = obj,
                Oid  = obj.Oid,
                Zone = obj.Zone,
                Cell = obj._Cell
            };

            lock (_objectsToRemove)
            {
                _objectsToRemove.Add(rem);
            }

            return(false);
        }
Ejemplo n.º 15
0
        public bool AddObject(Object obj, ushort zoneId, bool mustUpdateRange = false)
        {
            var info = GetZone_Info(zoneId);

            if (info == null)
            {
                Log.Error("RegionMgr",
                          "AddObject: Unable to add object " + obj.Name + " to invalid Zone with ID : " + zoneId);
                return(false);
            }

            var add = new ObjectAdd
            {
                Obj             = obj,
                ZoneId          = zoneId,
                MustUpdateRange = mustUpdateRange
            };

            //obj.MovementZone = GetZoneMgr(zoneId);

            lock (_objectsToAdd)
            {
                _objectsToAdd.Add(add);
            }

            return(true);
        }
Ejemplo n.º 16
0
        public static bool NpcPermaAnimScript(Player plr, ref List <string> values)
        {
            Object target = plr.CbtInterface.GetCurrentTarget();

            if (target == null)
            {
                return(false);
            }
            int animID = GetInt(ref values);

            var Out = new PacketOut((byte)Opcodes.F_ANIMATION);

            Out.WriteUInt16(target.Oid);
            Out.WriteByte(0);
            Out.WriteByte(0);
            Out.WriteUInt16((ushort)animID);

            plr.DispatchPacket(Out, true);

            Creature creature = target.GetCreature();

            creature.Spawn.Emote = (byte)animID;

            if (creature.PQSpawnId == null)
            {
                WorldMgr.Database.SaveObject(creature.Spawn);
            }
            else
            {
                PQuest_Spawn pQSpawn = WorldMgr.Database.SelectObject <PQuest_Spawn>("pquest_spawns_ID='" + creature.PQSpawnId + "'");
                pQSpawn.Emote = (byte)animID;
                WorldMgr.Database.SaveObject(pQSpawn);
            }
            return(true);
        }
Ejemplo n.º 17
0
 public bool OnPlayerLeave(Object Sender, object Args)
 {
     if (IsInGuild())
     {
         Guild.RemoveOnlineMember(_Owner.GetPlayer());
     }
     return(false);
 }
Ejemplo n.º 18
0
 public override void OnObjectLoad(Object Obj)
 {
     this.Obj = Obj;
     X        = Obj.WorldPosition.X;
     Y        = Obj.WorldPosition.Y;
     Z        = Obj.WorldPosition.Z;
     O        = Obj.Heading;
 }
Ejemplo n.º 19
0
        public bool OnEnterCombat(Object npc = null, object instigator = null)
        {
            Creature c = Obj as Creature;

            c.IsInvulnerable = false;
            Stage            = -1;
            return(false);
        }
Ejemplo n.º 20
0
        public void GenerateOid(Object obj)
        {
            var oid = GetOid();

            Objects[oid] = obj;

            obj.SetOid(oid);
            obj.Loaded = false;
        }
Ejemplo n.º 21
0
        public bool OnPlayerMoved(Object sender, object args)
        {
            if (_abilityProcessor != null && _abilityProcessor.HasInfo())
            {
                _abilityProcessor.CheckMoveInterrupt();
            }

            return(false);
        }
Ejemplo n.º 22
0
        public override void OnObjectLoad(Object Obj)
        {
            this.Obj   = Obj;
            spawnPoint = Obj as Point3D;

            // Terror
            //Obj.EvtInterface.AddEventNotify(EventName.OnDealDamage, ApplyTerror);
            //Obj.EvtInterface.AddEventNotify(EventName.OnLeaveCombat, RemoveTerror);
            //Obj.EvtInterface.AddEventNotify(EventName.OnDie, RemoveTerror);
        }
Ejemplo n.º 23
0
        // This remove all adds from game
        public bool RemoveAllAdds(Object npc = null, object instigator = null)
        {
            foreach (Creature add in addList)
            {
                add.Health = 0;
                add.EvtInterface.AddEvent(add.Destroy, 20000, 1);
            }

            return(false);
        }
Ejemplo n.º 24
0
        public bool OnTargetDie(Object obj, object args)
        {
            if (State == AiState.FIGHTING)
            {
                LockMovement(4000);
            }

            CurrentBrain.NotifyTargetKilled((Unit)obj);
            return(false);
        }
Ejemplo n.º 25
0
        // Removal of magic wall
        public bool RemoveWall(Object GO = null, object instigator = null)
        {
            //2000441;

            foreach (GameObject wall in magicWalls)
            {
                wall.Destroy();
            }

            return(false);
        }
Ejemplo n.º 26
0
        public void AddObject(Object obj)
        {
            if (obj is Player)
            {
                Players.Add((Player)obj);
                Region.LoadCells(X, Y, 1); // Load nearby cells when a player enters
            }

            Objects.Add(obj);
            obj._Cell = this;
        }
Ejemplo n.º 27
0
        protected int Stage = -1;                                                     // This is variable that controls combat Stage

        public override void OnObjectLoad(Object Obj)
        {
            this.Obj    = Obj;
            spawnPoint  = Obj as Point3D;
            spawnWorldX = (int)Obj.WorldPosition.X;
            spawnWorldY = (int)Obj.WorldPosition.Y;
            spawnWorldZ = (int)Obj.WorldPosition.Z;
            spawnWorldO = (int)Obj.Heading;

            Obj.EvtInterface.AddEventNotify(EventName.OnEnterCombat, OnEnterCombat);
            Obj.EvtInterface.AddEventNotify(EventName.OnLeaveCombat, OnLeaveCombat);
        }
Ejemplo n.º 28
0
        public void LoopVfx(object parameters)
        {
            var Params = (List <object>)parameters;

            Object o        = Params[0] as Object;
            ushort effectId = (ushort)((int)Params[1]);

            if (o != null)
            {
                o.PlayEffect(effectId);
            }
        }
Ejemplo n.º 29
0
        public bool RemoveTerror(Object npc = null, object instigator = null)
        {
            foreach (Player player in Obj.PlayersInRange)
            {
                if (player.BuffInterface.GetBuff(5968, player) != null)
                {
                    player.BuffInterface.RemoveBuffByEntry(5968);
                }
            }

            return(true);
        }
Ejemplo n.º 30
0
        public bool ApplyTerror(Object npc = null, object instigator = null)
        {
            Unit u = Obj as Unit;

            foreach (Player player in Obj.PlayersInRange)
            {
                BuffInfo b = AbilityMgr.GetBuffInfo(5968, u, player); // This is Terror buff
                player.BuffInterface.QueueBuff(new BuffQueueInfo(u, 40, b));
            }

            return(true);
        }