예제 #1
0
        public static Interaction GetInteraction(decimal amount, decimal fee)
        {
            string parm1             = amount.ToString("0.00000000").Split('.')[1];
            int    costTypeInt       = int.Parse(parm1.Substring(0, 2));
            int    interactionTypInt = int.Parse(parm1.Substring(2, 2));

            if (Enum.IsDefined(typeof(CostType), costTypeInt) &&
                Enum.IsDefined(typeof(InteractionType), interactionTypInt))
            {
                CostType        costType        = (CostType)costTypeInt;
                InteractionType interactionType = (InteractionType)interactionTypInt;
                int             addParam1       = int.Parse(parm1.Substring(4, 4));
                int             addParam2       = int.Parse(fee.ToString("0.00000000").Split('.')[1].Substring(4, 4));

                switch (interactionType)
                {
                case InteractionType.ADVENTURE:
                    if (AdventureAction.TryGetAdventure(addParam1, addParam2, out AdventureAction adventure))
                    {
                        return(adventure);
                    }
                    break;

                case InteractionType.LEVELING:
                    if (LevelingAction.TryGetAdventure(addParam1, addParam2, out LevelingAction leveling))
                    {
                        return(leveling);
                    }
                    break;
                }
            }

            return(new Unknown());
        }
예제 #2
0
        public static bool TryGetAdventure(int paramAdd1, int paramAdd2, out LevelingAction leveling)
        {
            if (Enum.IsDefined(typeof(LevelingType), int.Parse(paramAdd1.ToString("0000").Substring(0, 2))) &&
                Enum.IsDefined(typeof(ClassType), int.Parse(paramAdd1.ToString("0000").Substring(2, 2))))
            {
                leveling = new LevelingAction(paramAdd1, paramAdd2);
                return(true);
            }

            leveling = null;
            return(false);
        }
예제 #3
0
        public static Interaction GetInteraction(decimal amount, decimal fee)
        {
            var param1 = ((int)(amount * 100000000 % 100000000)).ToString("00000000");
            //var param1 = amount.ToString("0.00000000").Split('.')[1];
            var costTypeInt = int.Parse(param1.Substring(0, 2));
            //var costTypeInt = (int) (amount * 100 % 100);
            var interactionTypInt = int.Parse(param1.Substring(2, 2));

            //var interactionTypInt = (int) (amount * 10000 % 10000) % (costTypeInt * 100);

            if (Enum.IsDefined(typeof(CostType), costTypeInt) &&
                Enum.IsDefined(typeof(InteractionType), interactionTypInt))
            {
                var interactionType = (InteractionType)interactionTypInt;
                var addParam1       = int.Parse(param1.Substring(4, 4));

                var feeString = ((int)(fee * 100000000 % 100000000)).ToString("00000000");
                var addParam2 = int.Parse(feeString.Substring(4, 4));
                //var addParam2 = int.Parse(fee.ToString("0.00000000").Split('.')[1].Substring(4, 4));

                switch (interactionType)
                {
                case InteractionType.Adventure:
                    if (AdventureAction.TryGetInteraction(addParam1, addParam2, out AdventureAction adventure))
                    {
                        return(adventure);
                    }

                    break;

                case InteractionType.Leveling:
                    if (LevelingAction.TryGetInteraction(addParam1, addParam2, out LevelingAction leveling))
                    {
                        return(leveling);
                    }

                    break;

                case InteractionType.Special:
                    if (SpecialAction.TryGetInteraction(addParam1, addParam2, out SpecialAction special))
                    {
                        return(special);
                    }

                    break;
                }
            }

            return(new Unknown());
        }