private static void UpdateStackLimit(ItemBaseConfData data)
        {
            if (data == null || data.StackLimitedNumber <= 0)
            {
                return;
            }

            var oldLimit    = data.StackLimitedNumber;
            var isStackable = oldLimit > 1;

            data.StackLimitedNumber = isStackable ? Main.Settings.StackSizeForStackable : Main.Settings.StackSizeForUnstackable;
        }
            public static void Postfix(ItemBaseConfData __result)
            {
                if (!Enabled)
                {
                    return;
                }

                try
                {
                    UpdateStackLimit(__result);
                }
                catch (Exception exception)
                {
                    Main.Logger.Exception(exception);
                }
            }
示例#3
0
            static void Postfix(ItemDataMgr __instance, ref List <ItemBaseConfData> ___itemBaseList, ref List <EquipmentItemConfData> ___equipmentDataList)
            {
                if (!enabled)
                {
                    return;
                }

                foreach (KeyValuePair <int, string> kvp in videoNames)
                {
                    ItemBaseConfData itemConf = new ItemBaseConfData()
                    {
                        ID     = kvp.Key,
                        NameID = kvp.Key,
                    };

                    ___itemBaseList.Add(itemConf);
                }
            }
示例#4
0
        public static bool FavorUtility_GetGiftGainInfo_Patch_Prefix(NpcData npcData, FavorManagerConfInfo favorConf, ItemBaseConfData itemBaseConf, ref int gainValue, ref FeeLevelEnum feeLevel, ref string replyText, ref GiftType gType)
        {
            if (!Main.enabled)
            {
                return(true);
            }

            if (itemBaseConf.NameID == 271422) //heart knot
            {
                gainValue = 0;
                replyText = string.Empty;
                gType     = GiftType.Normal;
                feeLevel  = FeeLevelEnum.Refuse;
                int failIndex = -1;
                int id        = npcData.id;

                Dbgl("Giving heart knot to :" + npcData.Name + " " + npcData.id + " " + npcData.factionId);

                if (Module <Player> .Self.CanExpress(id, out failIndex) && FavorRelationshipUtil.CheckExpress(id, ref failIndex))
                {
                    gainValue = FavorUtility.GetGiftGainValue(favorConf.FavorValues_Confession, itemBaseConf);
                    feeLevel  = FeeLevelEnum.Confession;
                    gType     = GiftType.Relation;
                }
                else
                {
                    gainValue = 0;
                    feeLevel  = FeeLevelEnum.Refuse;
                    gType     = GiftType.Relation;
                }

                replyText = FavorUtility.GetGiveGiftDialog(npcData, favorConf, itemBaseConf, feeLevel, failIndex);
                return(false);
            }
            else if (itemBaseConf.NameID == 270956) // wedding ring
            {
                gainValue = 0;
                replyText = string.Empty;
                gType     = GiftType.Normal;
                feeLevel  = FeeLevelEnum.Refuse;
                int failIndex = -1;
                int id        = npcData.id;

                if (Module <MGMgr> .Self.CanMarriage(id, out failIndex) && FavorRelationshipUtil.CheckPropose(id, ref failIndex))
                {
                    gainValue = FavorUtility.GetGiftGainValue(favorConf.FavorValues_Propose, itemBaseConf);
                    feeLevel  = FeeLevelEnum.Propose;
                    gType     = GiftType.Relation;
                }
                else
                {
                    gainValue = 0;
                    feeLevel  = FeeLevelEnum.Refuse;
                    gType     = GiftType.Relation;
                }

                replyText = FavorUtility.GetGiveGiftDialog(npcData, favorConf, itemBaseConf, feeLevel, failIndex);
                return(false);
            }

            return(true);
        }
示例#5
0
            static void Postfix(ItemDataMgr __instance, ref List <ItemBaseConfData> ___itemBaseList, ref List <EquipmentItemConfData> ___equipmentDataList)
            {
                if (!enabled)
                {
                    return;
                }
                int itemIds   = 42000000;
                int nameIds   = 42000000;
                int sourceIds = 4200;

                if (settings.includeSpecialWeapons)
                {
                    int storeId = storeIds[settings.specialWeaponStore];
                    Dbgl($"special weapons store {storeId}");
                    weapons = new List <Weapon> {
                        new Weapon(1001999, productIds++, 1, -1, "-1", storeId, settings.unknownWeaponChance),     // nameless
                        new Weapon(1001011, productIds++, 1, -1, "-1", storeId, settings.waterSwordChance),        // Waterfall
                        //new Weapon(1001010,productIds++,1,-1,"-1", storeId, 0.5f), //Rogue Knight
                        new Weapon(1001012, productIds++, 1, -1, "-1", storeId, settings.purpleHazeChance),        // Purple Haze
                        new Weapon(1001402, productIds++, 1, -1, "-1", storeId, settings.InflateableHammerChance), // Inflateable Hammer
                        new Weapon(1001000, productIds++, 1, -1, "-1", storeId, settings.DevDaggerChance),         // Dev's Dagger
                    };
                }

                for (int i = 0; i < ___itemBaseList.Count; i++)
                {
                    if (___itemBaseList[i].ID == 1001999)
                    {
                        ___itemBaseList[i].BuyPrice = 1000000;
                    }
                }


                foreach (WeaponItem item in weaponItems)
                {
                    nameDesc.Add(nameIds, item.name);
                    nameDesc.Add(nameIds + 1, item.description);
                    nameDesc.Add(nameIds + 2, item.effect);
                    nameDesc.Add(nameIds + 3, storeNames[item.storeId]);
                    sourceStrings.Add(sourceIds, nameIds + 3);

                    ItemBaseConfData itemConf = new ItemBaseConfData()
                    {
                        ID               = itemIds,
                        NameID           = nameIds,
                        Explain_one      = nameIds + 1,
                        BuyPrice         = item.buyPrice,
                        SellPrice        = item.sellPrice,
                        ExhibitModelPath = item.dropModelPath,
                        giftModelPath    = item.dropModelPath,
                        displayScale     = item.displayScale,
                        ItemType         = new ItemType[] { ItemType.Equipment },

                        sourceIndex = new int[] { sourceIds },
                        orderIndex  = item.orderIndex,

                        ItemFunctionID     = itemIds,
                        StackLimitedNumber = 1,
                        isGift             = 0,
                        rareLv             = 0,
                        reputationModify   = 0,

                        intendType      = item.intendType,
                        skillIds        = item.skillIds,
                        alwaysOnHand    = item.alwaysOnHand,
                        holdInBothHands = item.holdInBothHands,
                        energy          = -1,
                        hotValue        = 0,
                        recycleTag      = "1",
                        Effect_Desc_ID  = nameIds + 2,
                        HaveIcon        = true,
                        CanPickup       = true,
                        CanDiscard      = true,
                        CanSell         = true,
                    };

                    typeof(ItemBaseConfData).GetField("iconPath", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(itemConf, item.iconPath);
                    typeof(ItemBaseConfData).GetField("ModelPath", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(itemConf, item.modelPath);
                    typeof(ItemBaseConfData).GetField("DropModelPathMale", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(itemConf, item.dropModelPath);

                    ___itemBaseList.Add(itemConf);

                    EquipmentItemConfData equipConf = new EquipmentItemConfData()
                    {
                        id                  = itemIds,
                        equipType           = 0,
                        durabilityMax       = 100,
                        durabilityCost      = 0,
                        repairRate          = 1,
                        attack              = item.attack,
                        defense             = item.defense,
                        critical            = item.critical,
                        antiCritical        = item.antiCritical,
                        hpMax               = item.hpMax,
                        cpMax               = item.cpMax,
                        attackType          = AttackType.Melee,
                        digGridCount        = item.digGridCount,
                        digIntensity        = item.digIntensity,
                        Rate                = item.rate,
                        dateForce           = 0,
                        meleeCriticalAmount = item.meleeCriticalAmount,
                        rangeCriticalAmount = 0,
                    };

                    ___equipmentDataList.Add(equipConf);

                    weapons.Add(new Weapon(itemIds, productIds++, 1, -1, "-1", item.storeId, item.chance));

                    itemIds++;
                    nameIds += 4;
                    sourceIds++;
                }
            }
示例#6
0
            static void Postfix(ItemDataMgr __instance, ref List <ItemBaseConfData> ___itemBaseList, ref List <EquipmentItemConfData> ___equipmentDataList)
            {
                if (!enabled)
                {
                    return;
                }
                int itemIds   = 42000000;
                int nameIds   = 42000000;
                int sourceIds = 4200;

                foreach (NewItem item in newItems)
                {
                    nameDesc.Add(nameIds, item.name);
                    nameDesc.Add(nameIds + 1, item.description);
                    nameDesc.Add(nameIds + 2, item.effect);
                    nameDesc.Add(nameIds + 3, storeNames[item.storeId]);
                    sourceStrings.Add(sourceIds, nameIds + 3);

                    ItemBaseConfData itemConf = new ItemBaseConfData()
                    {
                        ID               = itemIds,
                        NameID           = nameIds,
                        Explain_one      = nameIds + 1,
                        BuyPrice         = item.buyPrice,
                        SellPrice        = item.sellPrice,
                        ExhibitModelPath = item.dropModelPath,
                        giftModelPath    = item.dropModelPath,
                        displayScale     = item.displayScale,
                        ItemType         = new ItemType[] { ItemType.Equipment },

                        sourceIndex = new int[] { sourceIds },
                        orderIndex  = item.orderIndex,

                        ItemFunctionID     = itemIds,
                        StackLimitedNumber = 1,
                        isGift             = 0,
                        rareLv             = 0,
                        reputationModify   = 0,

                        intendType      = item.intendType,
                        skillIds        = item.skillIds,
                        alwaysOnHand    = item.alwaysOnHand,
                        holdInBothHands = item.holdInBothHands,
                        energy          = -1,
                        hotValue        = 0,
                        recycleTag      = "1",
                        Effect_Desc_ID  = nameIds + 2,
                        HaveIcon        = true,
                        CanPickup       = true,
                        CanDiscard      = true,
                        CanSell         = true,
                    };

                    typeof(ItemBaseConfData).GetField("iconPath", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(itemConf, item.iconPath);
                    typeof(ItemBaseConfData).GetField("ModelPath", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(itemConf, item.modelPath);
                    typeof(ItemBaseConfData).GetField("DropModelPathMale", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(itemConf, item.dropModelPath);

                    ___itemBaseList.Add(itemConf);

                    EquipmentItemConfData equipConf = new EquipmentItemConfData()
                    {
                        id                  = itemIds,
                        equipType           = 0,
                        durabilityMax       = 100,
                        durabilityCost      = 0,
                        repairRate          = 1,
                        attack              = item.attack,
                        defense             = item.defense,
                        critical            = item.critical,
                        antiCritical        = item.antiCritical,
                        hpMax               = item.hpMax,
                        cpMax               = item.cpMax,
                        attackType          = AttackType.Melee,
                        digGridCount        = item.digGridCount,
                        digIntensity        = item.digIntensity,
                        Rate                = item.rate,
                        dateForce           = 0,
                        meleeCriticalAmount = item.meleeCriticalAmount,
                        rangeCriticalAmount = 0,
                    };

                    ___equipmentDataList.Add(equipConf);

                    storeItems.Add(new StoreItem(itemIds, productIds++, 1, -1, "-1", "-1", item.storeId, item.chance));

                    itemIds++;
                    nameIds += 4;
                    sourceIds++;
                }
            }