コード例 #1
0
 /// Add classes to a skill feat instead of working with the NWNX_SkillRanks_SkillFeat::sClasses string.
 ///
 /// Manipulating the sClasses string in the NWNX_SkillRanks_SkillFeat struct can be difficult. This
 /// function allows the builder to enter one class at a time.
 /// <param name="skillFeat">The NWNX_SkillRanks_SkillFeat for which the sClasses field will be modifier.</param>
 /// <param name="iClass">The class to add to the Skill Feat.</param>
 /// <returns>The updated NWNX_SkillRanks_SkillFeat.</returns>
 public static SkillFeat AddSkillFeatClass(SkillFeat skillFeat, int iClass)
 {
     if (GetStringLength(skillFeat.sClasses) < 255)
     {
         int    i;
         string sPad = "";
         for (i = 0; i < 255 - GetStringLength(skillFeat.sClasses); i++)
         {
             sPad = sPad + "0";
         }
         skillFeat.sClasses = sPad + skillFeat.sClasses;
     }
     skillFeat.sClasses = GetStringLeft(skillFeat.sClasses, 254 - iClass) + "1" + GetStringRight(skillFeat.sClasses, iClass);
     return(skillFeat);
 }
コード例 #2
0
        /// Modifies or creates a skill feat.
        /// <param name="skillFeat">The defined NWNX_SkillRanks_SkillFeat.</param>
        /// <param name="createIfNonExistent">TRUE to create if the feat does not exist.</param>
        public static void SetSkillFeat(SkillFeat skillFeat, int createIfNonExistent = FALSE)
        {
            const string sFunc = "SetSkillFeat";

            VM.NWNX.SetFunction(NWNX_SkillRanks, sFunc);
            VM.NWNX.StackPush(createIfNonExistent);
            VM.NWNX.StackPush(skillFeat.iKeyAbilityMask);
            VM.NWNX.StackPush(skillFeat.bBypassArmorCheckPenalty);
            VM.NWNX.StackPush(skillFeat.iDayOrNight);
            VM.NWNX.StackPush(skillFeat.iAreaFlagsForbidden);
            VM.NWNX.StackPush(skillFeat.iAreaFlagsRequired);
            VM.NWNX.StackPush(skillFeat.fClassLevelMod);
            VM.NWNX.StackPush(GetStringRight(skillFeat.sClasses, GetStringLength(skillFeat.sClasses) - FindSubString(skillFeat.sClasses, "1")));
            VM.NWNX.StackPush(skillFeat.iFocusFeat);
            VM.NWNX.StackPush(skillFeat.iModifier);
            VM.NWNX.StackPush(skillFeat.iFeat);
            VM.NWNX.StackPush(skillFeat.iSkill);
            VM.NWNX.Call();
        }
コード例 #3
0
        /// Returns a skill feat by index.
        /// @remark Generally used in a loop with NWNX_SkillRanks_GetSkillFeatCountForSkill().
        /// <param name="iSkill">The skill.</param>
        /// <param name="iIndex">The index in the list of feats for the skill.</param>
        /// <returns>A constructed NWNX_SkillRanks_SkillFeat.</returns>
        public static SkillFeat GetSkillFeatForSkillByIndex(int iSkill, int iIndex)
        {
            const string sFunc = "GetSkillFeatForSkillByIndex";

            VM.NWNX.SetFunction(NWNX_SkillRanks, sFunc);
            VM.NWNX.StackPush(iIndex);
            VM.NWNX.StackPush(iSkill);
            VM.NWNX.Call();
            SkillFeat skillFeat = default;

            skillFeat.iSkill                   = iSkill;
            skillFeat.iFeat                    = VM.NWNX.StackPopInt();
            skillFeat.iModifier                = VM.NWNX.StackPopInt();
            skillFeat.iFocusFeat               = VM.NWNX.StackPopInt();
            skillFeat.sClasses                 = VM.NWNX.StackPopString();
            skillFeat.fClassLevelMod           = VM.NWNX.StackPopFloat();
            skillFeat.iAreaFlagsRequired       = VM.NWNX.StackPopInt();
            skillFeat.iAreaFlagsForbidden      = VM.NWNX.StackPopInt();
            skillFeat.iDayOrNight              = VM.NWNX.StackPopInt();
            skillFeat.bBypassArmorCheckPenalty = VM.NWNX.StackPopInt();
            skillFeat.iKeyAbilityMask          = VM.NWNX.StackPopInt();
            return(skillFeat);
        }