Esempio n. 1
0
 public PostReleaseSkillEventArgs(StarverPlayer player, StarverSkill skill, int mpCost, int cd)
 {
     Player = player;
     Skill  = skill;
     MPCost = mpCost;
     CD     = cd;
 }
Esempio n. 2
0
        private void AuraCommand(CommandArgs args)
        {
            var option = string.Empty;

            if (args.Parameters.Count > 0)
            {
                option = args.Parameters[0].ToLower();
            }
            #region FindSkill
            StarverSkill FindSkill(string nameOrID)
            {
                StarverSkill skill = null;

                if (int.TryParse(nameOrID, out int skillID))
                {
                    if (!skillID.InRange(0, StarverSkill.Count - 1))
                    {
                        args.Player.SendErrorMessage($"无效的技能ID: {skillID}");
                        return(null);
                    }
                    skill = Skills[skillID];
                }
                else
                {
                    skill = Skills.FirstOrDefault(skill => skill.Name.StartsWith(nameOrID, StringComparison.OrdinalIgnoreCase));
                    if (skill == null)
                    {
                        args.Player.SendErrorMessage($"找不到技能: {nameOrID}");
                        args.Player.SendErrorMessage("使用/au list [页码] 以查看技能列表");
                        return(null);
                    }
                }
                return(skill);
            }

            #endregion
            switch (option)
            {
            case "bind":
            {
                #region CheckParamsCount
                if (args.Parameters.Count < 3)
                {
                    goto default;
                }
                #endregion
                #region CheckSlotValid
                if (!int.TryParse(args.Parameters[1], out int slot) || !slot.InRange(1, MaxSkillSlot))
                {
                    args.Player.SendErrorMessage($"无效的slot: {args.Parameters[1]}");
                    args.Player.SendErrorMessage("应为1/2/3/4/5");
                    break;
                }
                slot--;
                #endregion
                #region FindSkill
                var skill = FindSkill(args.Parameters[2]);
                if (skill == null)
                {
                    break;
                }
                #endregion
                #region CheckSkill
                var player = Players[args.Player.Index];
                if (!skill.CanSet(player))
                {
                    break;
                }
                #endregion
                #region CheckBinding
                switch (player.HeldItem.useStyle)
                {
                // 长矛
                case ItemUseStyleID.Shoot when player.HeldItem.noUseGraphic:
                    player.BindSkill(slot, skill, true, player.HeldItem.shoot);
                    break;

                // 射出类
                case ItemUseStyleID.Shoot:
                    player.BindSkill(slot, skill, false, player.HeldItem.type);
                    break;

                // 短剑
                case ItemUseStyleID.Rapier:
                    player.BindSkill(slot, skill, false, player.HeldItem.type);
                    break;

                default:
                    if (skill.SpecialBindTo(player))
                    {
                        break;
                    }
                    args.Player.SendErrorMessage("该武器无法绑定技能");
                    return;
                }
                args.Player.SendMessage(skill.Name, Color.Aqua);
                args.Player.SendMessage(skill.Introduction, Color.Aqua);
                #endregion
            }
            break;

            case "list":
                #region ListSkill
                if (args.Parameters.Count < 2 || !int.TryParse(args.Parameters[1], out int page))
                {
                    args.Player.SendInfoMessage("用法:  /au list [页码]");
                    break;
                }
                page = Math.Min(1, page);
                page = Math.Max(page, Skills.SkillLists.Length);
                page--;
                args.Player.SendInfoMessage(Skills.SkillLists[page]);
                break;
                #endregion
                #region Sounds
                //case "sounds":
                //	Task.Run(() =>
                //	{
                //		try
                //		{
                //			for (int i = 0; i < SoundID.TrackableLegacySoundCount; i++)
                //			{
                //				var sound = new NetMessage.NetSoundInfo(args.TPlayer.Center, (ushort)i);
                //				NetMessage.PlayNetSound(sound);
                //				args.Player.SendInfoMessage($"soundid: {i}");
                //				Thread.Sleep(5000);
                //			}
                //		}
                //		catch (Exception)
                //		{

                //		}
                //	});
                //	break;
                #endregion
            case "help":
                #region Help
                if (args.Parameters.Count < 2)
                {
                    goto default;
                }
                if (!int.TryParse(args.Parameters[1], out int skillID))
                {
                    goto default;
                }
                skillID = Math.Min(0, skillID);
                skillID = Math.Max(skillID, Skills.Count - 1);
                args.Player.SendMessage(Skills[skillID].Name, Color.Aqua);
                args.Player.SendMessage(Skills[skillID].Introduction, Color.Aqua);
                break;

                #endregion
            default:
                args.Player.SendInfoMessage("bind <slot> <skill> 将制定技能绑定到手中的武器上");
                args.Player.SendInfoMessage("list  查看技能列表");
                args.Player.SendInfoMessage("help [技能id]  查看技能介绍");
                args.Player.SendInfoMessage("help  帮助");
                break;
            }
        }