public override void Execute(GameTrigger trigger) { var character = trigger.Character; var players = character.Map.GetAllCharacters().ToArray(); var itemToken = ItemManager.Instance.TryGetTemplate(20837); var amount = trigger.Get <int>("amount"); var item = character.Inventory.TryGetItem(itemToken); if (item.Stack < amount) { trigger.ReplyError("You doesn't have enough items !!"); return; } character.Inventory.RemoveItem(item, amount); var amountPerPlayer = (int)Math.Ceiling((double)amount / players.Count()); foreach (var player in players) { player.Inventory.AddItem(itemToken, amountPerPlayer); } trigger.Reply("Successfully add {0} items to {1} players !", amount, players.Count()); }
public override void Execute(GameTrigger trigger) { trigger.Reply("Admin chat mode is : {0}", new object[] { trigger.Bold((trigger.Character.AdminMessagesEnabled = !trigger.Character.AdminMessagesEnabled) ? "Enabled" : "Disabled") }); }
public override void Execute(GameTrigger trigger) { var map = trigger.Get <Map>("map"); var pools = map.SpawningPools.OfType <DungeonSpawningPool>().ToArray(); if (pools.Length == 0) { trigger.ReplyError("Target map {0} has no dungeon spawn", map.Id); return; } foreach (var spawn in pools.SelectMany(pool => pool.Spawns)) { spawn.TeleportEvent = true; spawn.TeleportCell = trigger.Character.Cell.Id; spawn.TeleportMap = trigger.Character.Map; spawn.TeleportDirection = trigger.Character.Direction; WorldServer.Instance.IOTaskPool.AddMessage(() => WorldServer.Instance.DBAccessor.Database.Update(spawn)); } trigger.Reply("Teleport event defined."); }
public override void Execute(GameTrigger trigger) { if (!trigger.Character.IsInFight()) { trigger.ReplyError("You must be in a fight"); return; } if (!trigger.Character.Fight.AIDebugMode) { trigger.ReplyError("AI debug mode must be enabled"); return; } if (!(trigger.Character.Fight.FighterPlaying is AIFighter)) { trigger.ReplyError("Current fighter is not an AI fighter"); return; } var aiFighter = trigger.Character.Fight.FighterPlaying as AIFighter; trigger.Character.ClearHighlight(); var enemy = aiFighter.Brain.Environment.GetNearestEnemy(); if (trigger.IsArgumentDefined("los")) { trigger.Reply(trigger.Color("Cast with LoS", trigger.Character.HighlightCells(aiFighter.Brain.Environment.GetCellsWithLoS(enemy.Cell)))); } foreach (var spell in aiFighter.Spells.Values) { var cell = aiFighter.Brain.Environment.GetCellToCastSpell(new TargetCell(enemy.Cell), spell, spell.CurrentSpellLevel.CastTestLos); if (cell != null) { trigger.Reply(trigger.Color("Cast " + spell, trigger.Character.HighlightCell(cell))); } } var fleeCell = aiFighter.Brain.Environment.GetCellToFlee(); trigger.Reply(trigger.Color("Flee cell", trigger.Character.HighlightCell(fleeCell))); }
public override void Execute(GameTrigger trigger) { if (!trigger.Character.IsInFight()) { trigger.ReplyError("You must be in a fight"); return; } trigger.Character.Fight.AIDebugMode = !trigger.Character.Fight.AIDebugMode; trigger.Reply("AI debug mode " + (trigger.Character.Fight.AIDebugMode ? "enabled" : "disabled")); }
public override void Execute(GameTrigger trigger) { if (!trigger.Character.IsInFight()) { trigger.ReplyError("You must be in a fight"); return; } if (!trigger.Character.Fight.AIDebugMode) { trigger.ReplyError("AI debug mode must be enabled"); return; } if (!(trigger.Character.Fight.FighterPlaying is AIFighter)) { trigger.ReplyError("Current fighter is not an AI fighter"); return; } var aiFighter = trigger.Character.Fight.FighterPlaying as AIFighter; foreach (var cast in aiFighter.Brain.SpellSelector.Possibilities) { trigger.Reply("(#1) Spell {0} ({1}) :: {2}", cast.Spell.Template.Name, cast.Spell.Id, SpellIdentifier.GetSpellCategories(cast.Spell)); var dumper = new ObjectDumper(8) { MemberPredicate = (member) => !member.Name.Contains("Target") }; trigger.Reply("\t{0} Targets", cast.Impacts.Count); foreach (var impact in cast.Impacts) { trigger.Reply(dumper.DumpElement(impact)); } } }
public override void Execute(GameTrigger trigger) { var target = trigger.Character.Map.GetActors <Merchant>(x => x.Name == trigger.Get <string>("target")).FirstOrDefault(); if (target == null) { trigger.ReplyError("Target not found !"); return; } MerchantManager.Instance.RemoveMerchantSpawn(target.Record); MerchantManager.Instance.UnActiveMerchant(target); trigger.Reply("Target Merchant kicked"); }
public override void Execute(GameTrigger trigger) { Character character = trigger.Character; if (character.GuildMember == null) { string name = trigger.Get <string>("guildname"); Guild guild = Singleton <GuildManager> .Instance.TryGetGuild(name); GuildMember guildMember; guild.TryAddMember(character, out guildMember); character.GuildMember = guildMember; trigger.Reply(string.Format("You have join Guild: {0}", guild.Name)); } else { trigger.ReplyError("You must leave your Guild before join another"); } }
public override void Execute(GameTrigger trigger) { if (!trigger.Character.IsInFight()) { trigger.ReplyError("You must be in a fight"); return; } if (!trigger.Character.Fight.AIDebugMode) { trigger.ReplyError("AI debug mode must be enabled"); return; } if (!(trigger.Character.Fight.FighterPlaying is AIFighter)) { trigger.ReplyError("Current fighter is not an AI fighter"); return; } trigger.Character.Fight.FighterPlaying.PassTurn(); trigger.Reply("Turn passed"); }