Ejemplo n.º 1
0
        public static ParamData.AtkParam GetPlayerBasicAtkParam(ParamData.EquipParamWeapon wpn, int behaviorJudgeID, bool isLeftHand)
        {
            if (wpn == null)
            {
                return(null);
            }

            // Format: 10VVVVJJJ
            // V = BehaviorVariationID
            // J = BehaviorJudgeID
            long behaviorParamID = 10_0000_000 + (wpn.BehaviorVariationID * 1_000) + behaviorJudgeID;

            // If behavior 10VVVVJJJ doesn't exist, check for fallback behavior 10VV00JJJ.
            if (!BehaviorParam_PC.ContainsKey(behaviorParamID))
            {
                long baseBehaviorVariationID = (wpn.BehaviorVariationID / 100) * 100;

                if (baseBehaviorVariationID == wpn.BehaviorVariationID)
                {
                    // Fallback is just the same thing, which we already know doesn't exist.
                    return(null);
                }

                long baseBehaviorParamID = 10_0000_000 + (baseBehaviorVariationID * 1_000) + behaviorJudgeID;

                if (BehaviorParam_PC.ContainsKey(baseBehaviorParamID))
                {
                    behaviorParamID = baseBehaviorParamID;
                }
                else
                {
                    return(null);
                }
            }

            ParamData.BehaviorParam behaviorParamEntry = BehaviorParam_PC[behaviorParamID];

            // Make sure behavior is an attack behavior.
            if (behaviorParamEntry.RefType != 0)
            {
                return(null);
            }

            // Make sure referenced attack exists.
            if (!AtkParam_Pc.ContainsKey(behaviorParamEntry.RefID))
            {
                return(null);
            }

            return(AtkParam_Pc[behaviorParamEntry.RefID]);
        }
Ejemplo n.º 2
0
        public static ParamData.AtkParam GetPlayerBasicAtkParam(ParamData.EquipParamWeapon wpn, int behaviorSubID, bool isLeftHand)
        {
            if (wpn == null)
            {
                return(null);
            }

            long behaviorParamID = 10_0000_000 + (wpn.BehaviorVariationID * 1_000) + behaviorSubID;

            if (!BehaviorParam_PC.ContainsKey(behaviorParamID))
            {
                if (wpn != null)
                {
                    long baseBehaviorParamID = 10_0000_000 + ((wpn.WepMotionCategory * 100) * 1_000) + behaviorSubID;

                    if (BehaviorParam_PC.ContainsKey(baseBehaviorParamID))
                    {
                        behaviorParamID = baseBehaviorParamID;
                    }
                    else
                    {
                        return(null);
                    }
                }
                else

                {
                    return(null);
                }
            }

            ParamData.BehaviorParam behaviorParamEntry = BehaviorParam_PC[behaviorParamID];
            if (behaviorParamEntry.RefType != 0)
            {
                return(null);
            }

            if (!AtkParam_Pc.ContainsKey(behaviorParamEntry.RefID))
            {
                return(null);
            }

            return(AtkParam_Pc[behaviorParamEntry.RefID]);
        }
Ejemplo n.º 3
0
        public void BuildAllHitboxPrimitives(ParamData.EquipParamWeapon wpn, bool leftHand)
        {
            bool isValidWeaponBehavior(long rowID)
            {
                return(((rowID >= 10_0000_000 + (wpn.BehaviorVariationID * 1_000)) &&
                        (rowID <= 10_0000_000 + (wpn.BehaviorVariationID * 1_000) + 999)) ||
                       ((rowID >= 10_0000_000 + ((wpn.WepMotionCategory * 100) * 1_000)) &&
                        (rowID <= 10_0000_000 + ((wpn.WepMotionCategory * 100) * 1_000) + 999)));
            }

            var atkParams = new List <ParamData.AtkParam>();

            foreach (var behKvp in ParamManager.BehaviorParam_PC.Where(kvp => isValidWeaponBehavior(kvp.Key)))
            {
                var beh = ParamManager.BehaviorParam_PC[behKvp.Key];
                if (beh.RefType == 0)
                {
                    // Check for non-existing attack reference memes.
                    if (ParamManager.AtkParam_Pc.ContainsKey(beh.RefID))
                    {
                        var atp = ParamManager.AtkParam_Pc[beh.RefID];
                        if (!atkParams.Contains(atp))
                        {
                            atkParams.Add(atp);
                        }
                    }
                }
            }

            BuildAllHitboxPrimitives(atkParams, leftHand);



            //foreach (var evBox in Main.TAE_EDITOR.Graph.EventBoxes)
            //{
            //    (long ID, ParamData.AtkParam Param) atkParam = (0, null);

            //    bool leftHand = IsViewingLeftHandHit;

            //    if (evBox.MyEvent.TypeName == "InvokeAttackBehavior" || evBox.MyEvent.TypeName == "InvokeThrowDamageBehavior")
            //    {
            //        if (!MODEL.IS_PLAYER)
            //            atkParam = ParamManager.GetNpcBasicAtkParam((int)evBox.MyEvent.Parameters["BehaviorSubID"]);
            //        else
            //            atkParam = ParamManager.GetPlayerBasicAtkParam(IsViewingLeftHandHit ? MODEL.ChrAsm.LeftWeapon : MODEL.ChrAsm.RightWeapon,
            //                (int)evBox.MyEvent.Parameters["BehaviorSubID"], isLeftHand: IsViewingLeftHandHit);
            //    }
            //    else if (evBox.MyEvent.TypeName == "InvokeCommonBehavior")
            //    {
            //        atkParam = ParamManager.GetPlayerCommonAttack((int)evBox.MyEvent.Parameters["BehaviorParamID"]);
            //    }
            //    else if (evBox.MyEvent.TypeName == "InvokePCBehavior")
            //    {
            //        if (MODEL.IS_PLAYER)
            //        {
            //            int condition = (int)evBox.MyEvent.Parameters["Condition"];
            //            if (condition == 4)
            //            {
            //                atkParam = ParamManager.GetPlayerCommonAttack((int)evBox.MyEvent.Parameters["BehaviorSubID"]);
            //            }
            //            else if (condition == 8)
            //            {
            //                atkParam = ParamManager.GetPlayerBasicAtkParam(
            //                    IsViewingLeftHandHit ? MODEL.ChrAsm.LeftWeapon : MODEL.ChrAsm.RightWeapon,
            //                    (int)evBox.MyEvent.Parameters["BehaviorSubID"], isLeftHand: IsViewingLeftHandHit);
            //            }
            //            else if (condition == 2 || condition == 8)
            //            {
            //                atkParam = ParamManager.GetPlayerBasicAtkParam(
            //                    IsViewingLeftHandHit ? MODEL.ChrAsm.LeftWeapon : MODEL.ChrAsm.RightWeapon,
            //                    (int)evBox.MyEvent.Parameters["BehaviorSubID"], isLeftHand: true);
            //                leftHand = true;
            //            }
            //            else
            //            {
            //                Console.WriteLine($"Unknown InvokePCBehavior condition: {condition}");
            //            }
            //        }
            //    }


            //    if (atkParam.Param == null)
            //        continue;

            //    HitboxPrimitiveInfos.Add(atkParam.Param, new HitboxPrimInfo() { IsLeftHandAtk = leftHand });

            //    for (int i = 0; i < atkParam.Param.Hits.Length; i++)
            //    {
            //        CreateHitboxPrimitive(atkParam.Param, atkParam.Param.Hits[i],
            //            atkParam.Param.GetCapsuleColor(atkParam.Param.Hits[i]), $"ATK {atkParam.ID}{(atkParam.Param.ThrowTypeID > 0 ? $"\nTHROW {atkParam.Param.ThrowTypeID}" : "")}",
            //            showText: i == 0);
            //    }
            //}
        }