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) { MonsterTemplate monsterTemplate = trigger.Get <MonsterTemplate>("monster"); Character target = base.GetTarget(trigger); foreach (MonsterSpell current in monsterTemplate.Grades.FirstOrDefault <MonsterGrade>().SpellsTemplates) { CharacterSpell characterSpell = target.Spells.LearnSpell(current.SpellId); if (characterSpell != null) { trigger.Reply("'{0}' learned the spell '{1}'", new object[] { trigger.Bold(target), trigger.Bold(characterSpell.Template.Name) }); } else { trigger.ReplyError("Spell {0} not learned. Unknow reason", new object[] { trigger.Bold(current.SpellId) }); } } }
public override void Execute(TriggerBase trigger) { foreach (var target in GetTargets(trigger)) { byte delta; var amount = trigger.Get <short>("amount"); if (amount > 0 && amount <= byte.MaxValue) { delta = (byte)(amount); target.LevelUp(delta); trigger.Reply("Added " + trigger.Bold("{0}") + " levels to '{1}'.", delta, target.Name); } else if (amount < 0 && -amount <= byte.MaxValue) { delta = (byte)(-amount); target.LevelDown(delta); trigger.Reply("Removed " + trigger.Bold("{0}") + " levels from '{1}'.", delta, target.Name); } else { trigger.ReplyError("Invalid level given."); } } }
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) { var target = GetTarget(trigger); foreach (var spell in target.Spells) { trigger.Reply("{0} ({1}) - Level {2}", trigger.Bold(spell.Template.Name), trigger.Bold(spell.Id), trigger.Bold(spell.CurrentLevel)); } }
public override void Execute(TriggerBase trigger) { if (trigger.Args.HasNext) { base.Execute(trigger); } else { trigger.Reply("Uptime : " + trigger.Bold("{0}") + " Players : " + trigger.Bold("{1}"), ServerBase.InstanceAsBase.UpTime.ToString(@"dd\.hh\:mm\:ss"), ServerBase.InstanceAsBase.ClientManager.Count); } }
public override void Execute(TriggerBase trigger) { Character target = base.GetTarget(trigger); foreach (CharacterSpell current in target.Spells) { trigger.Reply("{0} ({1}) - Level {2}", new object[] { trigger.Bold(current.Template.Name), trigger.Bold(current.Id), trigger.Bold(current.CurrentLevel) }); } }
public static void DisplaySubCommandDescription(TriggerBase trigger, CommandBase command, SubCommand subcommand) { trigger.Reply(trigger.Bold("{0}") + " {1} - {2}", command.Aliases.First(), string.Join("/", subcommand.Aliases), subcommand.Description); }
public static void DisplayFullCommandDescription(TriggerBase trigger, CommandBase command) { trigger.Reply(trigger.Bold("{0}") + "{1} - {2}", string.Join("/", command.Aliases), command is SubCommandContainer && (command as SubCommandContainer).Count > 0 ? string.Format(" ({0} subcmds)", (command as SubCommandContainer).Count(trigger.CanAccessCommand)) : "", command.Description); if (!(command is SubCommandContainer)) { trigger.Reply(" -> " + command.Aliases.First() + " " + command.GetSafeUsage()); } if (command.Parameters != null) { foreach (var commandParameter in command.Parameters) { DisplayCommandParameter(trigger, commandParameter); } } if (!(command is SubCommandContainer)) { return; } foreach (var subCommand in command as SubCommandContainer) { if (trigger.CanAccessCommand(subCommand)) { DisplayFullSubCommandDescription(trigger, command, subCommand); } } }
public static void DisplayFullCommandDescription(TriggerBase trigger, CommandBase command) { trigger.Reply(trigger.Bold("{0}") + "{1} - {2}", new object[] { string.Join("/", command.Aliases), (!(command is SubCommandContainer) || (command as SubCommandContainer).Count <= 0) ? "" : string.Format(" ({0} subcmds)", (command as SubCommandContainer).Count((SubCommand entry) => entry.RequiredRole <= trigger.UserRole)), command.Description }); if (!(command is SubCommandContainer)) { trigger.Reply(" -> " + command.Aliases.First <string>() + " " + command.GetSafeUsage()); } if (command.Parameters != null) { foreach (IParameterDefinition current in command.Parameters) { HelpCommand.DisplayCommandParameter(trigger, current); } } if (command is SubCommandContainer) { foreach (SubCommand current2 in command as SubCommandContainer) { HelpCommand.DisplayFullSubCommandDescription(trigger, command, current2); } } }
public override void Execute(TriggerBase trigger) { var spell = trigger.Get <SpellTemplate>("spell"); var target = GetTarget(trigger); var result = target.Spells.LearnSpell(spell); if (result != null) { trigger.Reply("'{0}' learned the spell '{1}'", trigger.Bold(target), trigger.Bold(spell.Name)); } else { trigger.ReplyError("Spell {0} not learned. Unknow reason", trigger.Bold(spell.Name)); } }
public static void DisplayCommandParameter(TriggerBase trigger, IParameterDefinition parameter) { trigger.Reply("\t(" + trigger.Bold("{0}") + " : {1})", new object[] { parameter.GetUsage(), parameter.Description ?? "" }); }
public static void DisplayCommandDescription(TriggerBase trigger, CommandBase command) { trigger.Reply(trigger.Bold("{0}") + "{1} - {2}", string.Join("/", command.Aliases), command is SubCommandContainer ? string.Format(" ({0} subcmds)", (command as SubCommandContainer).Count(entry => entry.RequiredRole <= trigger.UserRole)) : "", command.Description); }
public override void Execute(TriggerBase trigger) { var monster = trigger.Get <MonsterTemplate>("monster"); var target = GetTarget(trigger); foreach (var spell in monster.Grades.FirstOrDefault().SpellsTemplates) { var result = target.Spells.LearnSpell(spell.SpellId); if (result != null) { trigger.Reply("'{0}' learned the spell '{1}'", trigger.Bold(target), trigger.Bold(result.Template.Name)); } else { trigger.ReplyError("Spell {0} not learned. Unknow reason", trigger.Bold(spell.SpellId)); } } }
public override void Execute(TriggerBase trigger) { if (trigger.Args.HasNext) { base.Execute(trigger); } else { trigger.Reply("Temps sur Avalone : " + trigger.Bold("{0}") + "<br/> Joueurs en ligne sur Avalone: " + trigger.Bold("{1}"), ServerBase.InstanceAsBase.UpTime.ToString(@"dd\.hh\:mm\:ss"), ServerBase.InstanceAsBase.ClientManager.Count); } }
private void OnReply(TriggerBase trigger, AccountAnswerMessage reply) { trigger.Reply("Account : {0} ({1})", new object[] { trigger.Bold(reply.Account.Login), trigger.Bold(reply.Account.Id) }); trigger.Reply("Banned : {0}", new object[] { trigger.Bold(reply.Account.IsBanned) }); trigger.Reply("Jailed : {0}", new object[] { trigger.Bold(reply.Account.IsJailed) }); if (reply.Account.IsBanned) { trigger.Reply("Reason : {0}", new object[] { trigger.Bold(reply.Account.BanReason) }); trigger.Reply("Until : {0}", new object[] { trigger.Bold(reply.Account.BanEndDate) }); } }
public override void Execute(TriggerBase trigger) { SpellTemplate spellTemplate = trigger.Get <SpellTemplate>("spell"); Character target = base.GetTarget(trigger); CharacterSpell characterSpell = target.Spells.LearnSpell(spellTemplate); if (characterSpell != null) { trigger.Reply("'{0}' learned the spell '{1}'", new object[] { trigger.Bold(target), trigger.Bold(spellTemplate.Name) }); } else { trigger.ReplyError("Spell {0} not learned. Unknow reason", new object[] { trigger.Bold(spellTemplate.Name) }); } }
public override void Execute(TriggerBase trigger) { Character target = base.GetTarget(trigger); SpellTemplate spellTemplate = trigger.Get <SpellTemplate>("spell"); int num = trigger.Get <int>("level"); CharacterSpell spell = target.Spells.GetSpell(spellTemplate.Id); if (spell == null) { trigger.ReplyError("Spell {0} not found", new object[] { trigger.Bold(spell) }); } else { if (!spell.ByLevel.ContainsKey(num)) { trigger.ReplyError("Level {0} not found. Give a level between {1} and {2}", new object[] { trigger.Bold(num), trigger.Bold(spell.ByLevel.Keys.Min()), trigger.Bold(spell.ByLevel.Keys.Max()) }); } else { spell.CurrentLevel = (byte)num; trigger.ReplyBold("{0}'s spell {1} is now level {2}", new object[] { target, spell.Template.Name, num }); InventoryHandler.SendSpellUpgradeSuccessMessage(target.Client, spell); } } }
public override void Execute(TriggerBase trigger) { SpellTemplate spellTemplate = trigger.Get <SpellTemplate>("spell"); Character target = base.GetTarget(trigger); if (trigger.Get <bool>("keep") ? target.Spells.ForgetSpell(spellTemplate) : target.Spells.UnLearnSpell(spellTemplate)) { trigger.Reply("'{0}' forgot the spell '{1}'{2}", new object[] { trigger.Bold(target), trigger.Bold(spellTemplate.Name), trigger.Get <bool>("keep") ? " (but kept it)" : string.Empty }); } else { trigger.ReplyError("Spell {0} not unlearned. {1} may not have this spell", new object[] { trigger.Bold(spellTemplate.Name), trigger.Bold(target) }); } }
public static void DisplayFullSubCommandDescription(TriggerBase trigger, CommandBase command, SubCommand subcommand) { trigger.Reply(trigger.Bold("{0} {1}") + " - {2}", command.Aliases.First(), string.Join("/", subcommand.Aliases), subcommand.Description); trigger.Reply(" -> " + command.Aliases.First() + " " + subcommand.Aliases.First() + " " + subcommand.GetSafeUsage()); foreach (var commandParameter in subcommand.Parameters) { DisplayCommandParameter(trigger, commandParameter); } }
public override void Execute(TriggerBase trigger) { Character[] targets = base.GetTargets(trigger); for (int i = 0; i < targets.Length; i++) { Character character = targets[i]; short num = trigger.Get <short>("amount"); if (num > 0 && num <= 255) { byte b = (byte)num; character.LevelUp(b); trigger.Reply("Added " + trigger.Bold("{0}") + " levels to '{1}'.", new object[] { b, character.Name }); } else { if (num < 0 && -num <= 255) { byte b = (byte)(-(byte)num); character.LevelDown(b); trigger.Reply("Removed " + trigger.Bold("{0}") + " levels from '{1}'.", new object[] { b, character.Name }); } else { trigger.ReplyError("Invalid level given. Must be greater then -255 and lesser than 255"); } } } }
private static void OnReply(TriggerBase trigger, AccountAnswerMessage reply) { trigger.Reply("Account : {0} ({1})", trigger.Bold(reply.Account.Login), trigger.Bold(reply.Account.Id)); trigger.Reply("Banned : {0}", trigger.Bold(reply.Account.IsBanned)); trigger.Reply("Jailed : {0}", trigger.Bold(reply.Account.IsJailed)); trigger.Reply("Reason : {0}", trigger.Bold(reply.Account.BanReason)); trigger.Reply("Until : {0}", trigger.Bold(reply.Account.BanEndDate)); }
public override void Execute(TriggerBase trigger) { var spell = trigger.Get <SpellTemplate>("spell"); var target = GetTarget(trigger); var result = trigger.Get <bool>("keep") ? target.Spells.ForgetSpell(spell) : target.Spells.UnLearnSpell(spell); if (result) { trigger.Reply("'{0}' forgot the spell '{1}'{2}", trigger.Bold(target), trigger.Bold(spell.Name), trigger.Get <bool>("keep") ? " (but kept it)" : string.Empty); } else { trigger.ReplyError("Spell {0} not unlearned. {1} may not have this spell", trigger.Bold(spell.Name), trigger.Bold(target)); } }
public static void DisplayFullSubCommandDescription(TriggerBase trigger, CommandBase command, SubCommand subcommand) { trigger.Reply(trigger.Bold("{0} {1}") + " - {2}", new object[] { command.Aliases.First <string>(), string.Join("/", subcommand.Aliases), subcommand.Description }); trigger.Reply(string.Concat(new string[] { " -> ", command.Aliases.First <string>(), " ", subcommand.Aliases.First <string>(), " ", subcommand.GetSafeUsage() })); foreach (IParameterDefinition current in subcommand.Parameters) { HelpCommand.DisplayCommandParameter(trigger, current); } }
public override void ExecuteRemove(TriggerBase trigger) { var targets = GetTargets(trigger); IEnumerable <Emote> emotes; if (trigger.IsArgumentDefined("all")) { emotes = ChatManager.Instance.Emotes.Values; } else if (trigger.IsArgumentDefined("id")) { var emote = ChatManager.Instance.GetEmote(trigger.Get <int>("id")); if (emote == null) { trigger.ReplyError($"Emote {trigger.Bold(trigger.Get<int>("id"))} not found"); return; } emotes = new[] { emote }; } else { trigger.ReplyError("Specify an emote or -all"); return; } foreach (var target in targets) { foreach (var emote in emotes) { target.RemoveEmote(emote.EmoteId); } } }