/// <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); }
public bool RemoveAdds(Object npc = null, object instigator = null) { Creature c = npc as Creature; c.EvtInterface.AddEvent(c.Destroy, 10000, 1); return(false); }
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); }
/// <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); }
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); }
public void RemoveBuffs(Object Obj) { Creature c = Obj as Creature; //c.IsImmovable = false; c.IsInvulnerable = false; }
/// <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); }
// 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); }
// 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); } } }
/// <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); }
// 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); } }
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; } }
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(); }
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); }
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); }
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); }
public bool OnPlayerLeave(Object Sender, object Args) { if (IsInGuild()) { Guild.RemoveOnlineMember(_Owner.GetPlayer()); } return(false); }
public override void OnObjectLoad(Object Obj) { this.Obj = Obj; X = Obj.WorldPosition.X; Y = Obj.WorldPosition.Y; Z = Obj.WorldPosition.Z; O = Obj.Heading; }
public bool OnEnterCombat(Object npc = null, object instigator = null) { Creature c = Obj as Creature; c.IsInvulnerable = false; Stage = -1; return(false); }
public void GenerateOid(Object obj) { var oid = GetOid(); Objects[oid] = obj; obj.SetOid(oid); obj.Loaded = false; }
public bool OnPlayerMoved(Object sender, object args) { if (_abilityProcessor != null && _abilityProcessor.HasInfo()) { _abilityProcessor.CheckMoveInterrupt(); } return(false); }
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); }
// 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); }
public bool OnTargetDie(Object obj, object args) { if (State == AiState.FIGHTING) { LockMovement(4000); } CurrentBrain.NotifyTargetKilled((Unit)obj); return(false); }
// Removal of magic wall public bool RemoveWall(Object GO = null, object instigator = null) { //2000441; foreach (GameObject wall in magicWalls) { wall.Destroy(); } return(false); }
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; }
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); }
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); } }
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); }
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); }