Beispiel #1
0
        public void StartUseItem(IEventArgs args, FreeData fd, ItemPosition ip, int sing, int sound)
        {
            PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
            fd.Player.playerMove.InterruptAutoRun();

            SkillTimeTrigger trigger = (SkillTimeTrigger)itemSkill.trigger;

            trigger.SetTime(sing * 1000);
            trigger.Reset();

            UsingItemAction interAction = (UsingItemAction)trigger.interAction;

            interAction.fd = fd;
            interAction.ip = ip;

            UsingItemAction action = (UsingItemAction)itemSkill.GetEffect();

            action.fd = fd;
            action.ip = ip;

            StartCounter(args, sing, fd, true);

            startUse = true;

            FreeSoundUtil.Stop("use", args, fd);

            if (sound > 0)
            {
                FreeSoundUtil.PlayOnce("use", sound, args, fd);
            }
        }
Beispiel #2
0
        public void StartUseItem(IEventArgs args, FreeData fd, ItemPosition ip, int sing, int sound)
        {
            PlayerStateUtil.RemoveGameState(EPlayerGameState.InterruptItem, fd.Player.gamePlay);
            fd.Player.autoMoveInterface.PlayerAutoMove.StopAutoMove();

            SkillTimeTrigger trigger = (SkillTimeTrigger)itemSkill.trigger;

            trigger.SetTime(sing * 1000);
            trigger.Reset();

            itemSkill.inter       = null;
            itemSkill.interAction = null;
            if (ip.key.GetClickSkill() != null)
            {
                PlayerActionSkill skill = ip.key.GetClickSkill() as PlayerActionSkill;
                if (skill != null && skill.inter != null)
                {
                    itemSkill.inter       = skill.inter;
                    itemSkill.interAction = skill.interAction;
                }
            }

            UsingItemAction interAction = (UsingItemAction)trigger.interAction;

            interAction.fd = fd;
            interAction.ip = ip;

            UsingItemAction action = (UsingItemAction)itemSkill.GetEffect();

            action.fd = fd;
            action.ip = ip;

            StartCounter(args, sing, fd, true);
            startUse = true;
            SetCurrentItem(ip, (ISkillArgs)args);
            SimpleProto data = FreePool.Allocate();

            data.Key = FreeMessageConstant.PlaySound;
            data.Ks.Add(0);
            data.Ins.Add(FreeUtil.ReplaceInt("{item.itemId}", args));
            fd.Player.network.NetworkChannel.SendReliable((int)EServer2ClientMessage.FreeData, data);
            PlayerStateUtil.AddPlayerState(EPlayerGameState.UseItem, fd.Player.gamePlay);
        }