public override void ExecuteRemove(TriggerBase trigger) { var target = GetTarget(trigger); if (trigger.Get <bool>("all")) { target.RemoveAllOrnament(); target.ResetOrnament(); trigger.ReplyBold("{0} forgot all ornaments", target); } else { if (!trigger.IsArgumentDefined("id")) { trigger.ReplyError("Define at least one argument (id or -all)"); } else { var id = trigger.Get <short>("id"); if (!TinselManager.Instance.Ornaments.ContainsKey(id)) { trigger.ReplyError("Ornament {0} doesn't exists"); } else { target.RemoveOrnament(id); if (target.SelectedOrnament == id) { target.ResetOrnament(); } trigger.ReplyBold("{0} forgot ornament {1}", target, id); } } } }
public override void Execute(TriggerBase trigger) { if (trigger.Get <bool>("cancel")) { ServerBase.InstanceAsBase.CancelScheduledShutdown(); trigger.Reply("Shutting down procedure is canceled."); return; } if (trigger.Get <bool>("info")) { trigger.Reply($"Shutdown Date: {ServerBase.InstanceAsBase.ScheduledShutdownDate}"); return; } trigger.Reply($"No exit shutdown: {ServerBase.InstanceAsBase.IsNoExitShutdown = trigger.Get<bool>("noexit")}"); m_shutdownCountdown = trigger.Get <int>("time"); if (m_shutdownCountdown > 0) { ServerBase.InstanceAsBase.ScheduleShutdown(TimeSpan.FromSeconds(m_shutdownCountdown)); trigger.Reply("Server shutting down in {0} seconds", m_shutdownCountdown); } else { ServerBase.InstanceAsBase.Shutdown(); } }
public override void Execute(TriggerBase trigger) { var npcId = trigger.Get <sbyte>("npcid"); Npc npc; if (trigger.IsArgumentDefined("map")) { npc = trigger.Get <Map>("map").GetActor <Npc>(npcId); } else if (trigger is GameTrigger) { npc = (trigger as GameTrigger).Character.Map.GetActor <Npc>(npcId); } else { trigger.ReplyError("Npc Map must be defined !"); return; } if (npc.Spawn == null) { trigger.ReplyError("This npc is not saved in database"); } npc.Map.UnSpawnNpc(npc); WorldServer.Instance.IOTaskPool.AddMessage( () => { NpcManager.Instance.RemoveNpcSpawn(npc.Spawn); trigger.Reply("Npc {0} unspawned", npcId); }); }
public override void Execute(TriggerBase trigger) { NpcTemplate npcTemplate = trigger.Get <NpcTemplate>("npc"); ObjectPosition objectPosition = null; if (trigger.IsArgumentDefined("map") && trigger.IsArgumentDefined("cell") && trigger.IsArgumentDefined("direction")) { Map map = trigger.Get <Map>("map"); short cellId = trigger.Get <short>("cell"); DirectionsEnum direction = trigger.Get <DirectionsEnum>("direction"); objectPosition = new ObjectPosition(map, cellId, direction); } else { if (trigger is GameTrigger) { objectPosition = (trigger as GameTrigger).Character.Position; } } if (objectPosition == null) { trigger.ReplyError("Position of npc is not defined"); } else { Npc npc = objectPosition.Map.SpawnNpc(npcTemplate, objectPosition, npcTemplate.Look); trigger.Reply("Npc {0} spawned", new object[] { npc.Id }); } }
public override void ExecuteRemove(TriggerBase trigger) { var template = trigger.Get <NpcTemplate>("npc"); var itemTemplate = trigger.Get <ItemTemplate>("item"); var shop = template.Actions.OfType <NpcBuySellAction>().FirstOrDefault(); if (shop == null) { trigger.ReplyError("Npc {0} has no shop", template); return; } WorldServer.Instance.IOTaskPool.AddMessage( () => { var items = shop.Items.Where(entry => entry.ItemId == itemTemplate.Id).ToArray(); foreach (var item in items) { WorldServer.Instance.DBAccessor.Database.Delete(item); shop.Items.Remove(item); trigger.Reply("Item '{0}' removed from '{1}'s' shop", itemTemplate.Name, template.Name); } }); }
public override void ExecuteAdd(TriggerBase trigger) { var target = GetTarget(trigger); if (trigger.Get <bool>("all")) { foreach (var title in TinselManager.Instance.Titles) { target.AddTitle(title.Key); } trigger.ReplyBold("{0} learned all titles", target); } else { if (!trigger.IsArgumentDefined("id")) { trigger.ReplyError("Define at least one argument (id or -all)"); } else { var id = trigger.Get <short>("id"); if (!TinselManager.Instance.Titles.ContainsKey(id)) { trigger.ReplyError("Title {0} doesn't exists"); } else { target.AddTitle(id); trigger.ReplyBold("{0} learned title {1}", target, TinselManager.Instance.Titles[id].Name); } } } }
public override void Execute(TriggerBase trigger) { if (trigger.IsArgumentDefined("type")) { var type = trigger.Get <string>("type"); var entries = BenchmarkManager.Instance.Entries.Where(x => x.AdditionalProperties.ContainsKey("type") && x.AdditionalProperties["type"].Equals(type)); trigger.Reply(BenchmarkManager.Instance.GenerateReport(entries).HtmlEntities()); } else if (trigger.IsArgumentDefined("msg")) { var msg = trigger.Get <string>("msg"); var entries = BenchmarkManager.Instance.Entries.Where(x => x.MessageType.Equals(msg, StringComparison.InvariantCultureIgnoreCase)); foreach (var entry in entries) { trigger.Reply(entry.ToString()); } } else { trigger.Reply(BenchmarkManager.Instance.GenerateReport().HtmlEntities()); } }
public override void Execute(TriggerBase trigger) { var template = trigger.Get <NpcTemplate>("npc"); ObjectPosition position = null; if (trigger.IsArgumentDefined("map") && trigger.IsArgumentDefined("cell") && trigger.IsArgumentDefined("direction")) { var map = trigger.Get <Map>("map"); var cell = trigger.Get <short>("cell"); var direction = trigger.Get <DirectionsEnum>("direction"); position = new ObjectPosition(map, cell, direction); } else if (trigger is GameTrigger) { position = (trigger as GameTrigger).Character.Position; } if (position == null) { trigger.ReplyError("Position of npc is not defined"); return; } var npc = position.Map.SpawnNpc(template, position, template.Look); trigger.Reply("Npc {0} spawned", npc.Id); }
public override void Execute(TriggerBase trigger) { var hardwareId = trigger.Get <string>("hardwareId"); var reason = trigger.Get <string>("reason"); if (!IPCAccessor.Instance.IsConnected) { trigger.ReplyError("IPC service not operational !"); return; } var message = new BanHardwareIdMessage { HardwareId = hardwareId, BanReason = reason }; var source = trigger.GetSource() as WorldClient; if (source != null) { message.BannerAccountId = source.Account.Id; } IPCAccessor.Instance.SendRequest(message, ok => { World.Instance.ForEachCharacter(x => x.Account.LastHardwareId == hardwareId, character => character.Client.Disconnect()); trigger.Reply("HardwareId {0} banned", hardwareId); }, error => trigger.ReplyError("HardwareId {0} not banned : {1}", hardwareId, error.Message)); }
public override void Execute(TriggerBase trigger) { if (server == null) { server = new ClientManager(); server.Initialize(CreateClient); server.Start("127.0.0.1", 555); } try { int count = trigger.Get <int>("clients"); var clients = new List <FakeClientTest>(); for (int i = 0; i < count; i++) { var client = new FakeClientTest(); client.Connect(); clients.Add(client); } int count2 = trigger.Get <int>("sends"); for (int i = 0; i < count2; i++) { foreach (var client in clients) { client.SendRandomData(); } } } finally { //server.Close(); } }
public override void Execute(TriggerBase trigger) { var npc = trigger.Get <NpcTemplate>("npc"); var shop = npc.Actions.OfType <NpcBuySellAction>().FirstOrDefault(); if (shop == null) { trigger.ReplyError("Npc {0} has no shop", npc); return; } WorldServer.Instance.IOTaskPool.AddMessage( () => { if (trigger.IsArgumentDefined("notoken")) { shop.Token = null; trigger.Reply("Token removed"); } else if (trigger.IsArgumentDefined("token")) { var token = trigger.Get <ItemTemplate>("token"); shop.Token = token; trigger.Reply("Npc {0} now sells items for tokens {1}", npc, token); } else { trigger.ReplyError("Define token or -notoken"); } NpcManager.Instance.RemoveNpcAction(shop); }); }
public override void ExecuteAdd(TriggerBase trigger) { var monster = trigger.Get <MonsterTemplate>("monster"); var spell = trigger.Get <SpellTemplate>("spell"); var level = trigger.IsArgumentDefined("level") ? (int?)trigger.Get <int>("level") : null; WorldServer.Instance.IOTaskPool.AddMessage( () => { foreach (var grade in monster.Grades) { var spellLevel = Math.Min(level ?? (int)grade.GradeId, spell.SpellLevelsIds.Length + 1); var monsterSpell = new MonsterSpell() { SpellId = spell.Id, Level = (sbyte)spellLevel, MonsterGrade = grade, }; MonsterManager.Instance.AddMonsterSpell(monsterSpell); grade.SpellsTemplates.Add(monsterSpell); grade.ReloadSpells(); } trigger.Reply("Spell '{0}' added to '{1}'", spell.Name, monster.Name); }); }
public override void Execute(TriggerBase trigger) { var itemTemplate = trigger.Get <ItemTemplate>("template"); { foreach (var target in GetTargets(trigger)) { var item = target.Inventory.TryGetItem(itemTemplate); if (item != null) { if (trigger.IsArgumentDefined("amount")) { target.Inventory.RemoveItem(item, trigger.Get <int>("amount")); trigger.ReplyBold("'{0}'x{1} removed from {1}'s inventory", itemTemplate.Name, trigger.Get <uint>("amount"), target); } else { target.Inventory.RemoveItem(item); trigger.ReplyBold("Item {0} removed from {1}'s inventory", itemTemplate.Name, target); } } else { trigger.ReplyError("{0} hasn't item {1}"); } } } }
public override void ExecuteRemove(TriggerBase trigger) { var character = trigger is GameTrigger ? (trigger as GameTrigger).Character : null; if (character == null) { return; } var map = trigger.Get <Map>("map"); if (map == null) { trigger.ReplyError("Map '{0}' doesn't exist", trigger.Get <int>("mapid")); } else { var cellIdSrc = trigger.IsArgumentDefined("cellidsrc") ? character.Map.Cells[trigger.Get <short>("cellidsrc")] : character.Cell; WorldServer.Instance.IOTaskPool.ExecuteInContext(() => { CellTriggerManager.Instance.DeleteCellTrigger(character.Map.Id, cellIdSrc.Id); trigger.ReplyBold("Delete CellTrigger from map {0}({1})", character.Map.Id, cellIdSrc.Id); }); } }
public override void Execute(TriggerBase trigger) { var template = trigger.Get <SpellTemplate>("spell"); var level = trigger.Get <int>("level"); ExploreSpell(template, level, false, trigger); }
public override void Execute(TriggerBase trigger) { var target = GetTarget(trigger); var template = trigger.Get <SpellTemplate>("spell"); var level = trigger.Get <int>("level"); var spell = target.Spells.GetSpell(template.Id); if (spell == null) { trigger.ReplyError("Spell {0} not found", trigger.Bold(spell)); return; } if (!spell.ByLevel.ContainsKey(level)) { trigger.ReplyError("Level {0} not found. Give a level between {1} and {2}", trigger.Bold(level), trigger.Bold(spell.ByLevel.Keys.Min()), trigger.Bold(spell.ByLevel.Keys.Max())); return; } spell.CurrentLevel = (byte)level; trigger.ReplyBold("{0}'s spell {1} is now level {2}", target, spell.Template.Name, level); ContextRoleplayHandler.SendSpellModifySuccessMessage(target.Client, spell); }
public override void Execute(TriggerBase trigger) { var jobStr = trigger.Get <string>("job"); JobTemplate jobTemplate; int jobId; if (!int.TryParse(jobStr, out jobId)) { jobTemplate = JobManager.Instance.GetJobTemplates().FirstOrDefault(x => x.Name.ToLower().Contains(jobStr.ToLower())); if (jobTemplate == null) { trigger.ReplyError($"Job {trigger.Bold(jobStr)} not found"); return; } jobId = jobTemplate.Id; } else { jobTemplate = JobManager.Instance.GetJobTemplate(jobId); if (jobTemplate == null) { trigger.ReplyError($"Job {trigger.Bold(jobId)} not found"); return; } } var level = trigger.Get <int>("level"); foreach (var target in GetTargets(trigger)) { var job = target.Jobs[jobId]; if (job == null) { trigger.ReplyError($"{trigger.Bold(target.Name)} doesn't have job {trigger.Bold(jobTemplate.Name)}"); continue; } if (level + job.Level > ExperienceManager.Instance.HighestJobLevel) { job.Experience = ExperienceManager.Instance.GetJobLevelExperience(ExperienceManager.Instance.HighestJobLevel); } else if (level + job.Level < 1) { job.Experience = 0; } else { job.Experience = ExperienceManager.Instance.GetJobLevelExperience((byte)(level + job.Level)); } trigger.Reply($"{trigger.Bold(target.Name)} job {trigger.Bold(jobTemplate.Name)} is now level {job.Level}"); } }
public override void Execute(TriggerBase trigger) { IEnumerable <MonsterSpawn> spawns; var monster = trigger.Get <MonsterTemplate>("monster"); if (trigger.IsArgumentDefined("subarea")) { var subArea = trigger.Get <SubArea>("subarea"); spawns = subArea.Maps.SelectMany(x => x.MonsterSpawns).Distinct().Where(x => x.MonsterId == monster.Id); } else { spawns = MonsterManager.Instance.GetMonsterSpawns().Where(x => x.MonsterId == monster.Id); } foreach (var spawn in spawns) { if (spawn.Map != null) { spawn.Map.AddMonsterSpawn(spawn); } if (spawn.SubArea == null) { continue; } foreach (var map in spawn.SubArea.Maps) { map.AddMonsterSpawn(spawn); } } WorldServer.Instance.IOTaskPool.AddMessage( () => { WorldServer.Instance.DBAccessor.Database.BeginTransaction(); var count = 0; foreach (var spawn in spawns) { if (spawn.IsDisabled) { count++; } spawn.IsDisabled = false; WorldServer.Instance.DBAccessor.Database.Update(spawn); } WorldServer.Instance.DBAccessor.Database.CompleteTransaction(); trigger.ReplyBold("Re-Enabled {0} spawns", count); }); }
public override void Execute(TriggerBase trigger) { var transition = trigger.Get <MapNeighbour>("t"); var map = trigger.Get <Map>("map"); var cell = trigger.IsArgumentDefined("cell") ? map.GetCell(trigger.Get <short>("cell")) : null; Map from; if (trigger.IsArgumentDefined("from")) { from = trigger.Get <Map>("from"); } else { if (!(trigger is GameTrigger)) { trigger.ReplyError("From not defined"); return; } from = (trigger as GameTrigger).Character.Map; } switch (transition) { case MapNeighbour.Top: from.TopNeighbour = map; from.Record.TopNeighbourCellId = cell?.Id; break; case MapNeighbour.Bottom: from.BottomNeighbour = map; from.Record.BottomNeighbourCellId = cell?.Id; break; case MapNeighbour.Right: from.RightNeighbour = map; from.Record.RightNeighbourCellId = cell?.Id; break; case MapNeighbour.Left: from.LeftNeighbour = map; from.Record.LeftNeighbourCellId = cell?.Id; break; default: trigger.ReplyError("{0} not a valid transition", transition); return; } WorldServer.Instance.IOTaskPool.ExecuteInContext(() => { WorldServer.Instance.DBAccessor.Database.Update(from.Record); trigger.ReplyBold("{0} -> {1} = {2}", from.Id, transition, map.Id); }); }
public override void Execute(TriggerBase trigger) { int i = 0; int count = trigger.Get <int>("times"); PingIO(trigger, 0, trigger.Get <int>("times"), new List <DateTime>() { DateTime.Now }); }
public override void Execute(TriggerBase trigger) { if (!IPCAccessor.Instance.IsConnected) { trigger.ReplyError("IPC service not operational !"); return; } var player = World.Instance.GetCharacter(trigger.Get <string>("player")); if (player == null) { WorldServer.Instance.IOTaskPool.ExecuteInContext(() => { var character = CharacterManager.Instance.GetCharacterByName(trigger.Get <string>("player")); if (character == null) { trigger.ReplyError("Player {0} not found", trigger.Get <string>("player")); return; } var message = new AccountRequestMessage { CharacterId = character.Id }; IPCAccessor.Instance.SendRequest <AccountAnswerMessage>(message, reply => IPCAccessor.Instance.SendRequest(new UnBanAccountMessage(reply.Account.Login), ok => trigger.Reply("Account {0} unbanned", reply.Account.Login), error => trigger.ReplyError("Account {0} not unbanned : {1}", reply.Account.Login, error.Message)), error => trigger.ReplyError("Player {0} not unbanned : {1}", character.Name, error.Message)); }); } else { IPCAccessor.Instance.SendRequest(new UnBanAccountMessage(player.Account.Login), ok => trigger.Reply("Account {0} unbanned", player.Account.Login), error => trigger.ReplyError("Account {0} not unbanned : {1}", player.Account.Login, error.Message)); if (!player.Account.IsJailed) { return; } player.Account.IsJailed = false; player.Account.BanEndDate = null; player.Teleport(player.Breed.GetStartPosition()); player.SendServerMessage("Vous avez été libéré de prison.", Color.Red); } }
public override void Execute(TriggerBase trigger) { Map map = null; SubArea subarea = null; var bonus = trigger.Get <int>("bonus"); if (bonus < 0 || bonus > SkillHarvest.StarsBonusLimit) { trigger.ReplyError("Bonus between 0 and 200%"); return; } if (!trigger.IsArgumentDefined("map") && !trigger.IsArgumentDefined("subarea") && !trigger.IsArgumentDefined("all")) { if (!(trigger is GameTrigger)) { trigger.ReplyError("You have to define a map or a subarea if your are not ingame"); return; } map = (trigger as GameTrigger).Character.Map; } else if (trigger.IsArgumentDefined("map")) { map = trigger.Get <Map>("map"); } else if (trigger.IsArgumentDefined("subarea")) { subarea = trigger.Get <SubArea>("subarea"); } if (map != null) { foreach (var skill in map.GetInteractiveObjects().SelectMany(x => x.GetSkills()).OfType <ISkillWithAgeBonus>()) { skill.AgeBonus = (short)bonus; } } else if (subarea != null) { foreach (var skill in subarea.Maps.SelectMany(x => x.GetInteractiveObjects().SelectMany(y => y.GetSkills()).OfType <ISkillWithAgeBonus>())) { skill.AgeBonus = (short)bonus; } } else { foreach (var skill in World.Instance.GetMaps().SelectMany(x => x.GetInteractiveObjects().SelectMany(y => y.GetSkills()).OfType <ISkillWithAgeBonus>())) { skill.AgeBonus = (short)bonus; } } trigger.Reply("Interactives stars set to " + bonus); }
public override void Execute(TriggerBase trigger) { var template = trigger.Get <MonsterTemplate>("monster"); ObjectPosition position = null; MonsterGroup group; if (template.Grades.Count <= trigger.Get <sbyte>("grade")) { trigger.ReplyError("Unexistant grade '{0}' for this monster", trigger.Get <sbyte>("grade")); return; } MonsterGrade grade = template.Grades[trigger.Get <sbyte>("grade")]; if (grade.Template.EntityLook == null) { trigger.ReplyError("Cannot display this monster"); return; } if (trigger.IsArgumentDefined("map") && trigger.IsArgumentDefined("cell") && trigger.IsArgumentDefined("direction")) { var map = trigger.Get <Map>("map"); var cell = trigger.Get <short>("cell"); var direction = trigger.Get <DirectionsEnum>("direction"); position = new ObjectPosition(map, cell, direction); } else if (trigger is GameTrigger) { position = (trigger as GameTrigger).Character.Position; } if (position == null) { trigger.ReplyError("Position of monster is not defined"); return; } if (trigger.IsArgumentDefined("id")) { group = position.Map.GetActor <MonsterGroup>(trigger.Get <sbyte>("id")); if (group == null) { trigger.ReplyError("Group with id '{0}' not found", trigger.Get <sbyte>("id")); return; } group.AddMonster(new Monster(grade, group)); } else { group = position.Map.SpawnMonsterGroup(grade, position); } trigger.Reply("Monster '{0}' added to the group '{1}'", template.Id, group.Id); }
public override void Execute(TriggerBase trigger) { var ip = trigger.Get <string>("ip"); var reason = trigger.Get <string>("reason"); if (!IPCAccessor.Instance.IsConnected) { trigger.ReplyError("IPC service not operational !"); return; } try { IPAddressRange.Parse(ip); } catch { trigger.ReplyError("IP format '{0}' incorrect", ip); return; } var message = new BanIPMessage { IPRange = ip, BanReason = reason, }; var source = trigger.GetSource() as WorldClient; if (source != null) { message.BannerAccountId = source.Account.Id; } if (trigger.IsArgumentDefined("time")) { message.BanEndDate = DateTime.Now + TimeSpan.FromMinutes(trigger.Get <int>("time")); } else if (trigger.IsArgumentDefined("life")) { message.BanEndDate = null; } else { trigger.ReplyError("No ban duration given"); return; } IPCAccessor.Instance.SendRequest(message, ok => trigger.Reply("IP {0} banned", ip), error => trigger.ReplyError("IP {0} not banned : {1}", ip, error.Message)); }
public override void Execute(TriggerBase trigger) { Map map = null; SubArea subarea = null; if (!trigger.IsArgumentDefined("map") && !trigger.IsArgumentDefined("subarea")) { if (!(trigger is GameTrigger)) { trigger.ReplyError("You have to define a map or a subarea if your are not ingame"); return; } map = (trigger as GameTrigger).Character.Map; } else if (trigger.IsArgumentDefined("map")) { map = trigger.Get <Map>("map"); } else if (trigger.IsArgumentDefined("subarea")) { subarea = trigger.Get <SubArea>("subarea"); } if (map != null) { var pool = map.SpawningPools.OfType <ClassicalSpawningPool>().FirstOrDefault(); if (pool == null) { trigger.ReplyError("No spawning pool on the map"); return; } if (pool.SpawnNextGroup()) { trigger.Reply("Next group spawned"); } else { trigger.ReplyError("Spawns limit reached"); } } else if (subarea != null) { var i = subarea.Maps.Select(subMap => subMap.SpawningPools.OfType <ClassicalSpawningPool>().FirstOrDefault()).Where(pool => pool != null).Count(pool => pool.SpawnNextGroup()); trigger.Reply("{0} groups spawned", i); } }
public override void Execute(TriggerBase trigger) { var serverId = trigger.Get <int>("serverid"); var stateId = trigger.Get <int>("status"); var world = WorldServerManager.Instance.GetServerById(serverId); if (world == null) { return; } WorldServerManager.Instance.ChangeWorldState(world, (ServerStatusEnum)stateId, false); }
public override void Execute(TriggerBase trigger) { var reason = trigger.Get <string>("reason"); if (!IPCAccessor.Instance.IsConnected) { trigger.ReplyError("IPC service not operational !"); return; } foreach (var target in GetTargets(trigger)) { var message = new BanAccountMessage { AccountId = target.Account.Id, BanReason = reason, }; var source = trigger.GetSource() as WorldClient; if (source != null) { message.BannerAccountId = source.Account.Id; } if (!trigger.IsArgumentDefined("time")) { trigger.ReplyError("No ban duration given"); return; } var time = trigger.Get <int>("time"); message.BanEndDate = DateTime.Now + TimeSpan.FromMinutes(time); message.Jailed = true; IPCAccessor.Instance.SendRequest(message, ok => { target.Area.ExecuteInContext(() => target.TeleportToJail()); target.Account.IsJailed = true; target.Mute(TimeSpan.FromMinutes(time), source.Character); target.OpenPopup(string.Format("Vous avez été emprisonné et muté pendant {0} minutes par {1}", time, source.Character.Name)); trigger.Reply("Account {0} jailed for {1} minutes. Reason : {2}", target.Account.Login, trigger.Get <int>("time"), reason); }, error => trigger.ReplyError("Account {0} not jailed : {1}", target.Account.Login, error.Message)); } }
public override void Execute(TriggerBase trigger) { Character[] targets = base.GetTargets(trigger); for (int i = 0; i < targets.Length; i++) { Character character = targets[i]; int num = (trigger.Get <int>("time") > 720) ? 720 : trigger.Get <int>("time"); character.Mute(System.TimeSpan.FromMinutes((double)num), trigger.User as Character); trigger.Reply("{0} muted", new object[] { character.Name }); character.OpenPopup(string.Format("Vous avez été muté pendant {0} minutes", num)); } }
public Character[] GetTargets(TriggerBase trigger) { Character[] targets = null; if (trigger.IsArgumentDefined("target")) { targets = trigger.Get <Character[]>("target"); } else if (trigger is GameTrigger) { targets = new [] { (trigger as GameTrigger).Character } } ; if (targets == null) { throw new Exception("Target is not defined"); } if (targets.Length == 0) { throw new Exception("No target found"); } return(targets); }
public override void Execute(TriggerBase trigger) { int index; if (!trigger.IsArgumentDefined("index")) { index = trigger.User.CommandsErrors.Count - 1; // last index } else { index = trigger.Get <int>("index"); } if (trigger.User.CommandsErrors.Count <= index) { trigger.ReplyError("No error at index {0}", index); return; } var pair = trigger.User.CommandsErrors[index]; trigger.Reply("Command : " + pair.Key); trigger.Reply("Exception : "); foreach (var line in pair.Value.ToString().Split(new [] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)) { trigger.Reply(line); } }