Пример #1
0
        public static int NewArmor(CLRScriptBase script, int maxValue)
        {
            #region Calculate Armor Type
            List <int> possibleBaseItems = new List <int>();
            foreach (int armorType in ArmorResRefs.Keys)
            {
                if (Pricing.ArmorRulesTypeValues[armorType] <= maxValue)
                {
                    possibleBaseItems.Add(armorType);
                }
            }
            if (possibleBaseItems.Count == 0)
            {
                // Can't afford any armor. What are we doing here?
                return(0);
            }
            int selectedArmorType = possibleBaseItems[Generation.rand.Next(possibleBaseItems.Count)];
            int armorValue        = Pricing.ArmorRulesTypeValues[selectedArmorType];
            maxValue -= armorValue;
            uint armor = script.CreateItemOnObject(ArmorResRefs[selectedArmorType], script.OBJECT_SELF, 1, "", FALSE);
            #endregion

            #region Armor Appearance
            Generation.Theme armorTheme = Generation.GetEnchantmentTheme();
            if (script.GetBaseItemType(armor) == BASE_ITEM_ARMOR)
            {
                script.StoreCampaignObject(ACR_Items.ItemChangeDBName, ACR_Items.ModelChangeVarName, armor, script.OBJECT_SELF);
                ArmorSet set = null;
                switch (selectedArmorType)
                {
                case ARMOR_RULES_TYPE_BANDED:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Banded][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Banded].Count)];
                    break;

                case ARMOR_RULES_TYPE_BREASTPLATE:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Breastplate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Breastplate].Count)];
                    break;

                case ARMOR_RULES_TYPE_CHAIN_SHIRT:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.ChainShirt][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.ChainShirt].Count)];
                    break;

                case ARMOR_RULES_TYPE_CHAINMAIL:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Chainmail][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Chainmail].Count)];
                    break;

                case ARMOR_RULES_TYPE_CLOTH:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Cloth][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Cloth].Count)];
                    break;

                case ARMOR_RULES_TYPE_FULL_PLATE:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.FullPlate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.FullPlate].Count)];
                    break;

                case ARMOR_RULES_TYPE_HALF_PLATE:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.HalfPlate][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.HalfPlate].Count)];
                    break;

                case ARMOR_RULES_TYPE_HIDE:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Hide][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Hide].Count)];
                    break;

                case ARMOR_RULES_TYPE_LEATHER:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Leather][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Leather].Count)];
                    break;

                case ARMOR_RULES_TYPE_PADDED:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Padded][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Padded].Count)];
                    break;

                case ARMOR_RULES_TYPE_SCALE:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Scale][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.Scale].Count)];
                    break;

                case ARMOR_RULES_TYPE_STUDDED_LEATHER:
                    set = ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.StuddedLeather][Generation.rand.Next(ACR_Items.ArmorSetLibrary[ACR_Items.ArmorSetTypes.StuddedLeather].Count)];
                    break;
                }
                if (set != null)
                {
                    ItemModels.TakeArmorStyle(ALFA.Shared.Modules.InfoStore.ModifiedGff[ACR_Items.ModelChangeVarName], set);
                }
                ColorPair color = GeneratedColors.ColorPairs[armorTheme][Generation.rand.Next(GeneratedColors.ColorPairs[armorTheme].Count)];
                ItemColors.SetColorThemes(ALFA.Shared.Modules.InfoStore.ModifiedGff[ACR_Items.ModelChangeVarName], color.Primary, color.Accent);
                script.DestroyObject(armor, 0.0f, TRUE);
                armor = script.RetrieveCampaignObject(ACR_Items.ItemChangeDBName, ACR_Items.ModelChangeVarName, script.GetLocation(script.OBJECT_SELF), script.OBJECT_SELF, script.OBJECT_SELF);
            }
            #endregion

            #region See if We Want This to be Masterwork
            if (maxValue >= 150)
            {
                switch (selectedArmorType)
                {
                case ARMOR_RULES_TYPE_BANDED:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_BANDED_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_BREASTPLATE:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_BREASTPLATE_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_CHAIN_SHIRT:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_CHAIN_SHIRT_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_CHAINMAIL:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_CHAINMAIL_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_FULL_PLATE:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_FULL_PLATE_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_HALF_PLATE:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_HALF_PLATE_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_HIDE:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_HIDE_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_LEATHER:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_LEATHER_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_PADDED:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_PADDED_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_SCALE:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SCALE_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_SHIELD_HEAVY:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_HEAVY_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_SHIELD_LIGHT:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_LIGHT_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_SHIELD_TOWER:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SHIELD_TOWER_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_SPLINT:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_SPLINT_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;

                case ARMOR_RULES_TYPE_STUDDED_LEATHER:
                    script.SetArmorRulesType(armor, ARMOR_RULES_TYPE_STUDDED_LEATHER_MASTERWORK);
                    armorValue += 150;
                    maxValue   -= 150;
                    break;
                }
            }
            else
            {
                // We can't even afford masterwork. Carry on.
                return(armorValue);
            }
            #endregion

            #region Calculate Effective Plus
            double effectivePlusRemaining = Math.Sqrt((double)(maxValue / 1000)); // we cast after the division because we're going to turn this into an int later.
            double currentEffectivePlus   = 0.0;
            #endregion

            #region Set Base Properties
            int enhancementBonus = 0;
            if (effectivePlusRemaining >= 1.0)
            {
                enhancementBonus        = 1;
                effectivePlusRemaining -= 1;
                currentEffectivePlus    = 1;
                bool quirkAdded = false;
                while (effectivePlusRemaining >= 1)
                {
                    if (Generation.rand.Next(100) > 95)
                    {
                        // The remainder of the enchantment will
                        // be personality heavy.
                        break;
                    }
                    if (!quirkAdded && Generation.rand.Next(100) < 75)
                    {
                        enhancementBonus       += 1;
                        effectivePlusRemaining -= 1;
                        currentEffectivePlus   += 1;
                    }
                    else
                    {
                        List <EnhancementTypes> quirks = BuildBaseEnchantmentPossibilities(script.GetBaseItemType(armor), effectivePlusRemaining);
                        if (quirks.Count > 0)
                        {
                            EnhancementTypes quirk = quirks[Generation.rand.Next(quirks.Count)];
                            if (selectedArmorType == ARMOR_RULES_TYPE_CLOTH &&
                                quirk == EnhancementTypes.Twilight)
                            {
                                quirk = EnhancementTypes.SpellFocus;
                            }
                            switch (quirk)
                            {
                            case EnhancementTypes.CombatCasting:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_COMBAT_CASTING), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Battlemage's {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 1;
                                currentEffectivePlus   += 1;
                                break;

                            case EnhancementTypes.DeflectArrows:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_DEFLECT_ARROWS), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Arrowcatching {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 2;
                                currentEffectivePlus   += 2;
                                break;

                            case EnhancementTypes.Dodge:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_DODGE), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Nimble {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 1;
                                currentEffectivePlus   += 1;
                                break;

                            case EnhancementTypes.ExtraTurning:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_EXTRA_TURNING), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Turning {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 1;
                                currentEffectivePlus   += 1;
                                break;

                            case EnhancementTypes.SpellFocus:
                                int primarySchool = Generation.SpellSchoolFocus[Generation.rand.Next(Generation.SpellSchoolFocus.Count)];
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(primarySchool), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Mage's {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 1;
                                currentEffectivePlus   += 1;
                                if (effectivePlusRemaining >= 0.5)
                                {
                                    script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(Generation.SpellFocusLeft[primarySchool]), armor, 0.0f);
                                    effectivePlusRemaining -= 0.5;
                                    currentEffectivePlus   += 0.5;
                                }
                                if (effectivePlusRemaining >= 0.5)
                                {
                                    script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(Generation.SpellFocusRight[primarySchool]), armor, 0.0f);
                                    effectivePlusRemaining -= 0.5;
                                    currentEffectivePlus   += 0.5;
                                }
                                break;

                            case EnhancementTypes.SpellPenetration:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusFeat(IP_CONST_FEAT_SPELLPENETRATION), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Mage's {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 1.5;
                                currentEffectivePlus   += 1.5;
                                break;

                            case EnhancementTypes.SR12:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_12), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 2;
                                currentEffectivePlus   += 2;
                                break;

                            case EnhancementTypes.SR14:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_14), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 3;
                                currentEffectivePlus   += 3;
                                break;

                            case EnhancementTypes.SR16:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_16), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 4;
                                currentEffectivePlus   += 4;
                                break;

                            case EnhancementTypes.SR18:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyBonusSpellResistance(IP_CONST_SPELLRESISTANCEBONUS_18), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Spellsoaking {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 5;
                                currentEffectivePlus   += 5;
                                break;

                            case EnhancementTypes.Twilight:
                                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyArcaneSpellFailure(IP_CONST_ARCANE_SPELL_FAILURE_MINUS_10_PERCENT), armor, 0.0f);
                                script.SetFirstName(armor, String.Format("Twilight {0}", script.GetName(armor)));
                                effectivePlusRemaining -= 1;
                                currentEffectivePlus   += 1;
                                break;
                            }
                        }
                        quirkAdded = true;
                    }
                }
                script.AddItemProperty(DURATION_TYPE_PERMANENT, script.ItemPropertyACBonus(enhancementBonus), armor, 0.0f);
                script.SetFirstName(armor, String.Format("{0} +{1}", script.GetName(armor), enhancementBonus));
            }
            #endregion

            #region Armor Personality
            SetPersonalityProperties(script, armor, armorTheme, enhancementBonus, ref effectivePlusRemaining, ref currentEffectivePlus);
            armorValue += (int)(currentEffectivePlus * currentEffectivePlus * 1000);
            Pricing.CalculatePrice(script, armor);
            return(armorValue);

            #endregion
        }
        public static void TakeArmorStyle(GFFFile armor, ArmorSet set)
        {
            armor.TopLevelStruct["ArmorVisualType"].ValueByte = (byte)set.ArmorVisualType;
            armor.TopLevelStruct["Variation"].ValueByte = (byte)set.ArmorVariation;

            bool beltSeen = false;
            bool bootsSeen = false;
            bool cloakSeen = false;
            bool glovesSeen = false;
            bool helmSeen = false;

            List<GFFField> removals = new List<GFFField>();
            foreach (GFFField armorPiece in armor.TopLevelStruct.Fields.Values)
            {
                if (armorPiece.StringLabel == "Belt")
                {
                    beltSeen = true;
                    if (set.BeltVariation < 0 || set.BeltVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
                else if (armorPiece.StringLabel == "Boots")
                {
                    bootsSeen = true;
                    if (set.BootsVariation < 0 || set.BootsVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
                else if (armorPiece.StringLabel == "Cloak")
                {
                    cloakSeen = true;
                    if (set.BootsVariation < 0 || set.BootsVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
                else if (armorPiece.StringLabel == "Gloves")
                {
                    glovesSeen = true;
                    if (set.GlovesVariation < 0 || set.GlovesVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
                else if (armorPiece.StringLabel == "Helm")
                {
                    helmSeen = true;
                    if (set.GlovesVariation < 0 || set.GlovesVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
            }
            foreach (GFFField toRemove in removals)
            {
                armor.TopLevelStruct.Fields.Remove(toRemove);
            }

            if (!beltSeen && set.BeltVariation >= 0 && set.BeltVisualType >= 0)
            {
                AddArmorPiece(armor, "Belt", ACR_Items.BeltVariations);
            }
            if (!bootsSeen && set.BootsVariation >= 0 && set.BootsVisualType >= 0)
            {
                AddArmorPiece(armor, "Boots", ACR_Items.BootVariations);
            }
            if (!cloakSeen && set.CloakVariation >= 0 && set.CloakVisualType >= 0)
            {
                AddArmorPiece(armor, "Cloak", ACR_Items.CloakVariations);
            }
            if (!glovesSeen && set.GlovesVariation >= 0 && set.GlovesVisualType >= 0)
            {
                AddArmorPiece(armor, "Gloves", ACR_Items.GloveVariations);
            }
            if (!helmSeen && set.HelmetVariation >= 0 && set.HelmetVisualType >= 0)
            {
                AddArmorPiece(armor, "Helm", ACR_Items.HelmetVariations);
            }

            foreach (GFFField armorPiece in armor.TopLevelStruct.Fields.Values)
            {
                if (armorPiece.StringLabel == "Belt")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte = (byte)set.BeltVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.BeltVisualType;
                }
                else if (armorPiece.StringLabel == "Boots")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte = (byte)set.BootsVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.BootsVisualType;
                }
                else if (armorPiece.StringLabel == "Cloak")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte = (byte)set.CloakVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.CloakVisualType;
                }
                else if (armorPiece.StringLabel == "Gloves")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte = (byte)set.GlovesVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.GlovesVisualType;
                }
                else if (armorPiece.StringLabel == "Helm")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte = (byte)set.HelmetVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.HelmetVisualType;
                }
            }

            armor.TopLevelStruct["ACLtAnkle"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftAnkle; 
            armor.TopLevelStruct["ACLtArm"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftArm; 
            armor.TopLevelStruct["ACLtBracer"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftBracer; 
            armor.TopLevelStruct["ACLtElbow"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftElbow; 
            armor.TopLevelStruct["ACLtFoot"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftFoot; 
            armor.TopLevelStruct["ACLtHip"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftHip; 
            armor.TopLevelStruct["ACLtKnee"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftKnee; 
            armor.TopLevelStruct["ACLtLeg"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftLeg; 
            armor.TopLevelStruct["ACLtShin"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftShin;
            armor.TopLevelStruct["ACLtShoulder"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftShoulder; 
            armor.TopLevelStruct["ACRtAnkle"].ValueStruct["Accessory"].ValueByte = (byte)set.RightAnkle; 
            armor.TopLevelStruct["ACRtArm"].ValueStruct["Accessory"].ValueByte = (byte)set.RightArm; 
            armor.TopLevelStruct["ACRtBracer"].ValueStruct["Accessory"].ValueByte = (byte)set.RightBracer; 
            armor.TopLevelStruct["ACRtElbow"].ValueStruct["Accessory"].ValueByte = (byte)set.RightElbow; 
            armor.TopLevelStruct["ACRtFoot"].ValueStruct["Accessory"].ValueByte = (byte)set.RightFoot; 
            armor.TopLevelStruct["ACRtHip"].ValueStruct["Accessory"].ValueByte = (byte)set.RightHip; 
            armor.TopLevelStruct["ACRtKnee"].ValueStruct["Accessory"].ValueByte = (byte)set.RightKnee; 
            armor.TopLevelStruct["ACRtLeg"].ValueStruct["Accessory"].ValueByte = (byte)set.RightLeg; 
            armor.TopLevelStruct["ACRtShin"].ValueStruct["Accessory"].ValueByte = (byte)set.RightShin; 
            armor.TopLevelStruct["ACRtShoulder"].ValueStruct["Accessory"].ValueByte = (byte)set.RightShoulder; 
            armor.TopLevelStruct["ACFtHip"].ValueStruct["Accessory"].ValueByte = (byte)set.FrontHip; 
            armor.TopLevelStruct["ACBkHip"].ValueStruct["Accessory"].ValueByte = (byte)set.BackHip; 
        }
Пример #3
0
        public static void TakeArmorStyle(GFFFile armor, ArmorSet set)
        {
            armor.TopLevelStruct["ArmorVisualType"].ValueByte = (byte)set.ArmorVisualType;
            armor.TopLevelStruct["Variation"].ValueByte       = (byte)set.ArmorVariation;

            bool beltSeen   = false;
            bool bootsSeen  = false;
            bool cloakSeen  = false;
            bool glovesSeen = false;
            bool helmSeen   = false;

            List <GFFField> removals = new List <GFFField>();

            foreach (GFFField armorPiece in armor.TopLevelStruct.Fields.Values)
            {
                if (armorPiece.StringLabel == "Belt")
                {
                    beltSeen = true;
                    if (set.BeltVariation < 0 || set.BeltVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
                else if (armorPiece.StringLabel == "Boots")
                {
                    bootsSeen = true;
                    if (set.BootsVariation < 0 || set.BootsVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
                else if (armorPiece.StringLabel == "Cloak")
                {
                    cloakSeen = true;
                    if (set.BootsVariation < 0 || set.BootsVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
                else if (armorPiece.StringLabel == "Gloves")
                {
                    glovesSeen = true;
                    if (set.GlovesVariation < 0 || set.GlovesVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
                else if (armorPiece.StringLabel == "Helm")
                {
                    helmSeen = true;
                    if (set.GlovesVariation < 0 || set.GlovesVisualType < 0)
                    {
                        removals.Add(armorPiece);
                    }
                }
            }
            foreach (GFFField toRemove in removals)
            {
                armor.TopLevelStruct.Fields.Remove(toRemove);
            }

            if (!beltSeen && set.BeltVariation >= 0 && set.BeltVisualType >= 0)
            {
                AddArmorPiece(armor, "Belt", ACR_Items.BeltVariations);
            }
            if (!bootsSeen && set.BootsVariation >= 0 && set.BootsVisualType >= 0)
            {
                AddArmorPiece(armor, "Boots", ACR_Items.BootVariations);
            }
            if (!cloakSeen && set.CloakVariation >= 0 && set.CloakVisualType >= 0)
            {
                AddArmorPiece(armor, "Cloak", ACR_Items.CloakVariations);
            }
            if (!glovesSeen && set.GlovesVariation >= 0 && set.GlovesVisualType >= 0)
            {
                AddArmorPiece(armor, "Gloves", ACR_Items.GloveVariations);
            }
            if (!helmSeen && set.HelmetVariation >= 0 && set.HelmetVisualType >= 0)
            {
                AddArmorPiece(armor, "Helm", ACR_Items.HelmetVariations);
            }

            foreach (GFFField armorPiece in armor.TopLevelStruct.Fields.Values)
            {
                if (armorPiece.StringLabel == "Belt")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte       = (byte)set.BeltVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.BeltVisualType;
                }
                else if (armorPiece.StringLabel == "Boots")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte       = (byte)set.BootsVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.BootsVisualType;
                }
                else if (armorPiece.StringLabel == "Cloak")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte       = (byte)set.CloakVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.CloakVisualType;
                }
                else if (armorPiece.StringLabel == "Gloves")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte       = (byte)set.GlovesVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.GlovesVisualType;
                }
                else if (armorPiece.StringLabel == "Helm")
                {
                    armorPiece.ValueStruct["Variation"].ValueByte       = (byte)set.HelmetVariation;
                    armorPiece.ValueStruct["ArmorVisualType"].ValueByte = (byte)set.HelmetVisualType;
                }
            }

            armor.TopLevelStruct["ACLtAnkle"].ValueStruct["Accessory"].ValueByte    = (byte)set.LeftAnkle;
            armor.TopLevelStruct["ACLtArm"].ValueStruct["Accessory"].ValueByte      = (byte)set.LeftArm;
            armor.TopLevelStruct["ACLtBracer"].ValueStruct["Accessory"].ValueByte   = (byte)set.LeftBracer;
            armor.TopLevelStruct["ACLtElbow"].ValueStruct["Accessory"].ValueByte    = (byte)set.LeftElbow;
            armor.TopLevelStruct["ACLtFoot"].ValueStruct["Accessory"].ValueByte     = (byte)set.LeftFoot;
            armor.TopLevelStruct["ACLtHip"].ValueStruct["Accessory"].ValueByte      = (byte)set.LeftHip;
            armor.TopLevelStruct["ACLtKnee"].ValueStruct["Accessory"].ValueByte     = (byte)set.LeftKnee;
            armor.TopLevelStruct["ACLtLeg"].ValueStruct["Accessory"].ValueByte      = (byte)set.LeftLeg;
            armor.TopLevelStruct["ACLtShin"].ValueStruct["Accessory"].ValueByte     = (byte)set.LeftShin;
            armor.TopLevelStruct["ACLtShoulder"].ValueStruct["Accessory"].ValueByte = (byte)set.LeftShoulder;
            armor.TopLevelStruct["ACRtAnkle"].ValueStruct["Accessory"].ValueByte    = (byte)set.RightAnkle;
            armor.TopLevelStruct["ACRtArm"].ValueStruct["Accessory"].ValueByte      = (byte)set.RightArm;
            armor.TopLevelStruct["ACRtBracer"].ValueStruct["Accessory"].ValueByte   = (byte)set.RightBracer;
            armor.TopLevelStruct["ACRtElbow"].ValueStruct["Accessory"].ValueByte    = (byte)set.RightElbow;
            armor.TopLevelStruct["ACRtFoot"].ValueStruct["Accessory"].ValueByte     = (byte)set.RightFoot;
            armor.TopLevelStruct["ACRtHip"].ValueStruct["Accessory"].ValueByte      = (byte)set.RightHip;
            armor.TopLevelStruct["ACRtKnee"].ValueStruct["Accessory"].ValueByte     = (byte)set.RightKnee;
            armor.TopLevelStruct["ACRtLeg"].ValueStruct["Accessory"].ValueByte      = (byte)set.RightLeg;
            armor.TopLevelStruct["ACRtShin"].ValueStruct["Accessory"].ValueByte     = (byte)set.RightShin;
            armor.TopLevelStruct["ACRtShoulder"].ValueStruct["Accessory"].ValueByte = (byte)set.RightShoulder;
            armor.TopLevelStruct["ACFtHip"].ValueStruct["Accessory"].ValueByte      = (byte)set.FrontHip;
            armor.TopLevelStruct["ACBkHip"].ValueStruct["Accessory"].ValueByte      = (byte)set.BackHip;
        }