// 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); } } }
public static void Remove(Player plr, bool database) { Object obj = GetObjectTarget(plr); if (!obj.IsGameObject()) { plr.SendClientMessage($"GAMEOBJECT REMOVE: Target is not a gameobject", ChatLogFilters.CHATLOGFILTERS_CSR_TELL_RECEIVE); return; } obj.RemoveFromWorld(); if (database) { WorldMgr.Database.DeleteObject(obj.GetGameObject().Spawn); } }
/// <summary> /// Converts selected Object to a PQ spawn <objective id> /// </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 PqConvert(Player plr, ref List <string> values) { int objective = GetInt(ref values); int type = GetInt(ref values); //creatures only atm Object obj = GetObjectTarget(plr); switch (type) { case 1: if (!obj.IsCreature()) { return(false); } obj.Dispose(); Creature_spawn spawn = obj.GetCreature().Spawn; WorldMgr.Database.DeleteObject(spawn); PQuest_Spawn newSpawn = new PQuest_Spawn(); //Added pquest_spawns_ID here as it is required to correctly save it to DB after this field was //added in PQuest_spawn.cs newSpawn.pquest_spawns_ID = Guid.NewGuid().ToString(); newSpawn.Entry = spawn.Entry; newSpawn.Objective = (uint)objective; newSpawn.Type = 1; // npc newSpawn.WorldO = spawn.WorldO; newSpawn.WorldY = spawn.WorldY; newSpawn.WorldZ = spawn.WorldZ; newSpawn.WorldX = spawn.WorldX; newSpawn.ZoneId = spawn.ZoneId; newSpawn.Emote = spawn.Emote; newSpawn.Level = spawn.Level; WorldMgr.Database.AddObject(newSpawn); break; case 2: if (!obj.IsGameObject()) { return(false); } obj.Dispose(); GameObject_spawn gospawn = obj.GetGameObject().Spawn; WorldMgr.Database.DeleteObject(gospawn); PQuest_Spawn newSpawngo = new PQuest_Spawn(); newSpawngo.pquest_spawns_ID = Guid.NewGuid().ToString(); newSpawngo.Entry = gospawn.Entry; newSpawngo.Objective = (uint)objective; newSpawngo.Type = 2; // go newSpawngo.WorldO = gospawn.WorldO; newSpawngo.WorldY = gospawn.WorldY; newSpawngo.WorldZ = gospawn.WorldZ; newSpawngo.WorldX = gospawn.WorldX; newSpawngo.ZoneId = gospawn.ZoneId; newSpawngo.Unks = gospawn.Unks; WorldMgr.Database.AddObject(newSpawngo); break; case 3: if (!obj.IsGameObject()) { return(false); } GameObject_spawn gointspawn = obj.GetGameObject().Spawn; PQuest_Spawn newSpawnintgo = new PQuest_Spawn(); newSpawnintgo.pquest_spawns_ID = Guid.NewGuid().ToString(); newSpawnintgo.Entry = ((GameObject)obj).Spawn.Guid; newSpawnintgo.Objective = (uint)objective; newSpawnintgo.Type = 3; // change interaction of a spawned go WorldMgr.Database.AddObject(newSpawnintgo); break; } return(true); }