public void HandleCommand(string key, string obj, string target, Player player, Room room) { // oddballs is shit name // but might be times where we need a command to trigger // a skill that does not match the name // here second matches on second attack // but I want second to allow selecting a second weapon var oddBalls = new List <Tuple <string, string> >() { new Tuple <string, string>("second", "dual wield"), new Tuple <string, string>("warcry", "war cry"), }; var oddBallMatch = oddBalls.FirstOrDefault(x => x.Item1.StartsWith(key)); if (oddBallMatch != null) { key = oddBallMatch.Item2; } //check player skill var foundSkill = _cache.GetAllSkills() .FirstOrDefault(x => x.Name.StartsWith(key, StringComparison.CurrentCultureIgnoreCase) && x.Type != SkillType.Passive); if (foundSkill != null) { _Skill.PerfromSkill(foundSkill, key, player, obj, room); return; } //check socials var social = _cache.GetSocials().Keys.FirstOrDefault(x => x.StartsWith(key)); if (social != null) { var emoteTarget = key == obj ? "" : obj; _socials.EmoteSocial(player, room, _cache.GetSocials()[social], emoteTarget); return; } _writeToClient.WriteLine("That is not a command.", player.ConnectionId); }
public void HandleCommand(string key, string obj, string target, Player player, Room room) { var foundCommand = false; //check player skills if (false) { } //check socials var social = _cache.GetSocials().Keys.FirstOrDefault(x => x.StartsWith(key)); if (social != null) { foundCommand = true; var emoteTarget = key == obj ? "" : obj; _socials.EmoteSocial(player, room, _cache.GetSocials()[social], emoteTarget); return; } _writeToClient.WriteLine("That is not a command.", player.ConnectionId); }