Beispiel #1
0
        private static void ApplyStatChangeVars(Heroine heroine, PregnancyData preg, Dictionary <string, ValData> vars)
        {
            if (vars.TryGetVarValue("PillUsed", out bool used) && used)
            {
                PregnancyGameController.ForceStopPregnancyDelayed(heroine);

                var freePill = _personalityHasPills.TryGetValue(heroine.personality, out var val) && val;
                if (!freePill)
                {
                    StoreApi.SetItemAmountBought(AfterpillStoreId, Mathf.Clamp(StoreApi.GetItemAmountBought(AfterpillStoreId) - 1, 0, 99));
                }
            }

            if (vars.TryGetVarValue <int>("FavorChange", out var favor))
            {
                heroine.favor = Mathf.Clamp(heroine.favor + favor, 0, 150);
            }

            if (vars.TryGetVarValue <int>("LewdChange", out var lewd))
            {
                heroine.lewdness = Mathf.Clamp(heroine.lewdness + lewd, 0, 100);
            }

            if (vars.TryGetVarValue <int>("MoneyChange", out var money))
            {
                Manager.Game.saveData.player.koikatsuPoint += money;
            }
        }
Beispiel #2
0
        public bool Install(Harmony instance, ConfigFile config)
        {
            if (StudioAPI.InsideStudio || Interlocked.Increment(ref _installed) != 1)
            {
                return(false);
            }

            StoreApi.RegisterShopItem(
                itemId: AfterpillStoreId,
                itemName: "Afterpill",
                explaination: "Prevents pregnancy when used within a few days of insemination. Always smart to keep a couple of these for emergencies.",
                shopType: StoreApi.ShopType.NightOnly,
                itemBackground: StoreApi.ShopBackground.Pink,
                itemCategory: 8,
                stock: 5,
                resetsDaily: false,
                cost: 50,
                sort: 461);

            instance.PatchMoveNext(
                original: AccessTools.Method(typeof(TalkScene), nameof(TalkScene.Introduction)),
                transpiler: new HarmonyMethod(typeof(CustomEventsFeature), nameof(IntroductionTpl)));

            // todo make heroine want to talk to player when theres a custom event waiting

            return(true);
        }
Beispiel #3
0
        public bool ApplyFeature(ref CompositeDisposable disp, MoreShopItemsPlugin inst)
        {
            const string itemName = "Ero Detection App";

            disp.Add(StoreApi.RegisterShopItem(
                         itemId: MoreShopItemsPlugin.DetectorItemId,
                         itemName: itemName,
                         explaination: "A phone app that notifies you about erotic activities happening around the island. It's fully automatic and gives estimated locations.",
                         shopType: StoreApi.ShopType.NightOnly,
                         itemBackground: StoreApi.ShopBackground.Yellow,
                         itemCategory: 3,
                         stock: 1,
                         resetsDaily: false,
                         cost: 200,
                         sort: 500));

            disp.Add(Harmony.CreateAndPatchAll(typeof(EroDetectorFeat)));

            _notifyMast = inst.Config.Bind(itemName, "Notification on masturbation", true, "If the item is purchased, show a notification whenever any NPC starts a masturbation action.");
            _notifyLesb = inst.Config.Bind(itemName, "Notification on lesbian", true, "If the item is purchased, show a notification whenever any NPC starts a lesbian action.");

            TranslationHelper.TranslateAsync(_infoTextPrefix, s => _infoTextPrefix = s);

            return(true);
        }
Beispiel #4
0
        private static void WaitPointDataChangedHook(Base __instance, Base.WaitPointData value)
        {
            // wpData is null when the character is still walking to the current action location
            if (value == null)
            {
                return;
            }

            if (__instance is NPC npc)
            {
                if (npc.isOnanism && _notifyMast.Value || npc.isLesbian && _notifyLesb.Value)
                {
                    try
                    {
                        if (StoreApi.GetItemAmountBought(MoreShopItemsPlugin.DetectorItemId) > 0)
                        {
                            var mapNo = __instance.mapNo;
                            //if (ActionScene.initialized && ActionScene.instance.Player.mapNo != mapNo)
                            if (ActionScene.instance.Map.infoDic.TryGetValue(mapNo, out var param))
                            {
                                InformationUI.SetAsync(string.Format(_infoTextPrefix, param.DisplayName), InformationUI.Mode.Normal).Forget();
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        UnityEngine.Debug.LogException(e);
                    }
                }
            }
        }
        public IActionResult SalesReport(int daysAgo)
        {
            var APIStores = new StoreApi(new Configuration {
                BasePath = "https://localhost:44368/"
            });
            var stores    = APIStores.ApiStoreGet();
            var APIOrders = new OrderApi(new Configuration {
                BasePath = "https://localhost:44368/"
            });
            var orders = APIOrders.ApiOrderGet();

            List <SalesReport> summary = orders.Where(sales => (DateTime.Now - (DateTime)sales.TimeStamp).TotalDays <= daysAgo)
                                         .GroupBy(sales1 => sales1.Store).Select(sales2 => new SalesReport
            {
                Item     = sales2.First().Store.Name,
                Quantity = sales2.Count(),
                Revenue  = sales2.Sum(sales => (double)sales.PriceTotal),
                Pizzas   = sales2.SelectMany(group => group.Pizza).GroupBy(pizza => pizza.Pizza).Select(pizzaGroup => new SalesReport
                {
                    Item     = pizzaGroup.First().Name,
                    Quantity = pizzaGroup.Count(),
                    Revenue  = pizzaGroup.Sum(sales => (double)sales.Price),
                }).OrderBy(report => report.Item)
            }).ToList();

            return(View(summary));
        }
Beispiel #6
0
 public ActionResult Store([FromBody] StoreApi storeApi)
 {
     if (storeApi == null)
     {
         return(Json(new ResultsJson(new Message(CodeMessage.PostNull, "PostNull"), null)));
     }
     return(Json(Global.BUSS.BussResults(this, storeApi)));
 }
Beispiel #7
0
        public static void Apply(Harmony hi)
        {
            hi.PatchAll(typeof(AccessPointHooks));

            StoreApi.RegisterShopItem(StoreItemId, "Cursed drawing board",
                                      "Gives access to a supposedly cursed drawing board inside the Training Center. The board is said to give its user the ability to bestow lewd crests upon people they know. Each upgrade lets you affect characters that you know less well.",
                                      StoreApi.ShopType.Normal, StoreApi.ShopBackground.Yellow, 3, 3, false, 100,
                                      numText: "{0} available upgrades");
        }
Beispiel #8
0
        private static void RunIntroEvent(Heroine heroine, PregnancyData preg, bool isPillEvent)
        {
            var loadedEvt = GetEvent(heroine, preg, isPillEvent);

            if (loadedEvt == null)
            {
                PregnancyPlugin.Logger.LogError("Unexpected null GetEvent result");
                return;
            }

            // Init needed first since the custom event starts empty
            var evt = EventApi.CreateNewEvent(setPlayerParam: true);

            heroine.SetADVParam(evt);
            var freePill = _personalityHasPills.TryGetValue(heroine.personality, out var val) && val;

            evt.Add(Program.Transfer.VAR("bool", "PillForFree", freePill.ToString(CultureInfo.InvariantCulture)));
            evt.Add(Program.Transfer.VAR("bool", "PlayerHasPill", (StoreApi.GetItemAmountBought(AfterpillStoreId) >= 1).ToString(CultureInfo.InvariantCulture)));
            // Give favor by default, gets overriden if the event specifies any other value
            evt.Add(Program.Transfer.VAR("int", "FavorChange", "30"));

            evt.AddRange(loadedEvt);

            var scene = TalkScene.instance;

            scene.StartADV(evt, scene.cancellation.Token)
            .ContinueWith(() => Program.ADVProcessingCheck(scene.cancellation.Token))
            .ContinueWith(() =>
            {
                PregnancyGameController.ApplyToAllDatas((chara, data) =>
                {
                    if (chara == heroine)
                    {
                        if (isPillEvent)
                        {
                            data.CanAskForAfterpill = false;
                        }
                        else
                        {
                            data.CanTellAboutPregnancy = false;
                        }
                        return(true);
                    }
                    return(false);
                });

                var vars = ActionScene.instance.AdvScene.Scenario.Vars;
                ApplyStatChangeVars(heroine, preg, vars);

                // Fix mouth getting permanently locked by the events
                heroine.chaCtrl.ChangeMouthFixed(false);
            })
            .Forget();
        }
Beispiel #9
0
        public void TestGetInventory()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration(timeout: 10000);

            StoreApi storeApi = new StoreApi(c1);
            Dictionary <String, int?> response = storeApi.GetInventory();

            foreach (KeyValuePair <string, int?> entry in response)
            {
                Assert.IsInstanceOf(typeof(int?), entry.Value);
            }
        }
        public void GetInventoryTest()
        {
            // TODO: add unit test for the method 'GetInventory'
            //var response = instance.GetInventory();
            //Assert.IsInstanceOf<Dictionary<string, int?>> (response, "response is Dictionary<string, int?>");

            // set timeout to 10 seconds
            Configuration c1 = new Configuration(timeout: 10000);

            StoreApi storeApi = new StoreApi(c1);
            Dictionary <String, int?> response = storeApi.GetInventory();

            foreach (KeyValuePair <string, int?> entry in response)
            {
                Assert.IsInstanceOf(typeof(int?), entry.Value);
            }
        }
Beispiel #11
0
        public void TestGetInventoryInObject()
        {
            // set timeout to 10 seconds
            Configuration c1 = new Configuration(timeout: 10000);

            StoreApi storeApi = new StoreApi(c1);

            Newtonsoft.Json.Linq.JObject response = (Newtonsoft.Json.Linq.JObject)storeApi.GetInventoryInObject();

            // should be a Newtonsoft.Json.Linq.JObject since type is object
            Assert.IsInstanceOf(typeof(Newtonsoft.Json.Linq.JObject), response);

            foreach (KeyValuePair <string, string> entry in response.ToObject <Dictionary <string, string> >())
            {
                Assert.IsInstanceOf(typeof(int?), Int32.Parse(entry.Value));
            }
        }
Beispiel #12
0
        public bool Install(Harmony instance, ConfigFile config)
        {
            if (StudioAPI.InsideStudio || Interlocked.Increment(ref _installed) != 1)
            {
                return(false);
            }

            var insertCat = StoreApi.RegisterShopItemCategory(ResourceUtils.GetEmbeddedResource("icon_insertable.png").LoadTexture());

            StoreApi.RegisterShopItem(SuppositoryStoreId, "Family Making Tampons",
                                      "Cum delivery devices disguised as a pack of tampons. Thanks to multiple patented technologies the conception rate is close to 100%. Perfect as a gift. (Doesn't work on infertile characters)",
                                      StoreApi.ShopType.NightOnly, StoreApi.ShopBackground.Pink, insertCat, 3, true, 100, 461, onBought: item => TopicApi.AddTopicToInventory(SuppositoryTopicId));

            TopicApi.RegisterTopic(SuppositoryTopicId, "Family Making Tampons", TopicApi.TopicCategory.Love, TopicApi.TopicRarity.Rarity5, GetAdvScript, GetAdvResult);

            return(true);
        }
Beispiel #13
0
        public JsonResult ImportStores()
        {
            StoreApi sa   = new StoreApi();
            JsonSMsg rMsg = new JsonSMsg();

            try
            {
                var result = sa.BindStore(7);//值需要获取
                rMsg.Status  = 0;
                rMsg.Message = "success";
                rMsg.Data    = result;
            }
            catch
            {
                rMsg.Status  = -1;
                rMsg.Message = "fail";
            }
            return(Json(rMsg));
        }
        public IActionResult SelectStore()
        {
            var sessionOrder = Utils.GetCurrentOrder(HttpContext.Session);
            var API          = new OrderApi(new Configuration {
                BasePath = "https://localhost:44368/"
            });
            var orders = API.ApiOrderGet();
            var API2   = new StoreApi(new Configuration {
                BasePath = "https://localhost:44368/"
            });
            var stores = API2.ApiStoreGet();

            List <Order> previousOrders = orders.Where(
                order => order.Customer.Name.Equals(sessionOrder.Customer.Name)).OrderByDescending(order => order.TimeStamp).ToList();
            List <AStore> storesToDisplay = new List <AStore>();

#if !DEBUG
            if (previousOrders.Any() && timeSinceOrder(previousOrders.First()).TotalHours < 2)
            {
                return(BadRequest("At least 2 hours must pass since your last order before you can place another."));
            }
            foreach (var store in stores)
            {
                var lastOrderFromStore = previousOrders.FirstOrDefault(order => order.Store.Name.Equals(store.Name));

                if (lastOrderFromStore is null || timeSinceOrder(lastOrderFromStore).TotalHours >= 24)
                {
                    storesToDisplay.Add(store);
                }
            }
#else
            storesToDisplay = stores;
#endif

            if (storesToDisplay.Count == 0)
            {
                return(BadRequest("There is a 24 hour waiting period for making repeat orders at each store. All stores are currently under this waiting period."));
            }

            ViewBag.Stores = new SelectList(storesToDisplay.ToList(), "Id", "Name");
            return(View(new AStore()));
        }
        public JsonResult GetStoreInfo(int storeId)
        {
            var storeApi = new StoreApi();
            var store    = storeApi.Get().Where(q => q.ID == storeId).FirstOrDefault();

            if (store != null)
            {
                return(Json(new
                {
                    status = new
                    {
                        success = true,
                        status = ConstantManager.STATUS_SUCCESS,
                        message = ConstantManager.MES_SUCCESS
                    },
                    data = new
                    {
                        data = new
                        {
                            store = store
                        }
                    }
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new
                {
                    status = new
                    {
                        success = false,
                        status = ConstantManager.STATUS_SUCCESS,
                        message = ConstantManager.MES_FAIL
                    },
                    data = new
                    {
                    }
                }));
            }
        }
        public JsonResult GetStoreList()
        {
            var storeApi = new StoreApi();
            var stores   = storeApi.Get().ToList();

            if (stores != null)
            {
                return(Json(new
                {
                    status = new
                    {
                        success = true,
                        status = ConstantManager.STATUS_SUCCESS,
                        message = ConstantManager.MES_SUCCESS
                    },
                    data = new
                    {
                        data = new
                        {
                            store_list = stores
                        }
                    }
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new
                {
                    status = new
                    {
                        success = false,
                        status = ConstantManager.STATUS_SUCCESS,
                        message = ConstantManager.MES_FAIL
                    },
                    data = new
                    {
                    }
                }));
            }
        }
        public IActionResult GetSelectedStore(AStore selectedStore)
        {
            var API = new StoreApi(new Configuration {
                BasePath = "https://localhost:44368/"
            });
            var stores     = API.ApiStoreGet();
            var foundStore = stores.FirstOrDefault(store => store.Id == selectedStore.Id); //grab identicle store from db

            if (foundStore is null)
            {
                return(BadRequest("You selected a null store."));
            }

            var sessionOrder = Utils.GetCurrentOrder(HttpContext.Session);      //grabbing sessionn info and placing store info into it

            sessionOrder.Store.Id    = (int)foundStore.Id;
            sessionOrder.Store.Name  = foundStore.Name;
            sessionOrder.Store.Store = foundStore.Store;

            Utils.SaveOrder(HttpContext.Session, sessionOrder);                 //save session
            return(RedirectToAction("PizzaMenu", "FEOrder"));
        }
Beispiel #18
0
        public bool Install(Harmony instance, ConfigFile config)
        {
            if (StudioAPI.InsideStudio || Interlocked.Increment(ref _installed) != 1)
            {
                return(false);
            }

            var rubberCat = StoreApi.RegisterShopItemCategory(ResourceUtils.GetEmbeddedResource("item_rubber.png").LoadTexture());

            StoreApi.RegisterShopItem(itemId: RubberStoreId,
                                      itemName: "Family Making Condoms",
                                      explaination: "Makes pregnancy up to 95% likely after cumming inside with a condom on. Active in all H scenes until the end of the next day, use with caution! (Doesn't work on infertile characters)",
                                      shopType: StoreApi.ShopType.NightOnly,
                                      itemBackground: StoreApi.ShopBackground.Pink,
                                      itemCategory: rubberCat,
                                      stock: 1,
                                      resetsDaily: true,
                                      cost: 100,
                                      sort: 460);

            instance.PatchAll(typeof(FamilyCondomsFeature));

            return(true);
        }
Beispiel #19
0
        public bool ApplyFeature(ref CompositeDisposable disp, MoreShopItemsPlugin inst)
        {
            var ico = ResourceUtils.GetEmbeddedResource("item_talisman.png", typeof(MoreShopItemsPlugin).Assembly).LoadTexture();
            var talismanCategoryId = StoreApi.RegisterShopItemCategory(ico);

            disp.Add(ico);

            const int maxTalismansOwned = 2;

            disp.Add(StoreApi.RegisterShopItem(
                         itemId: MoreShopItemsPlugin.TalismanItemId,
                         itemName: "Twin-making Talisman",
                         explaination: "An old talisman that was allegedly used for conversing with spirits in the past. It can summon a fake twin of any living person that is experienced in sex. (One time use during H scenes)",
                         shopType: StoreApi.ShopType.NightOnly,
                         itemBackground: StoreApi.ShopBackground.Pink,
                         itemCategory: talismanCategoryId,
                         stock: maxTalismansOwned,
                         resetsDaily: false,
                         cost: 100,
                         numText: "{0} remaining out of " + maxTalismansOwned));

            disp.Add(CustomTrespassingHsceneButtons.AddHsceneTrespassingButtonWithConfirmation(
                         buttonText: "Let's use a Twin-making Talisman",
                         spawnConditionCheck: hSprite =>
            {
                var flags = hSprite.flags;
                return((flags.mode == HFlag.EMode.aibu || flags.mode == HFlag.EMode.sonyu || flags.mode == HFlag.EMode.houshi) &&
                       !flags.isFreeH
                       // 3P is only available for experienced or horny
                       && flags.lstHeroine[0].HExperience >= Heroine.HExperienceKind.慣れ &&
                       StoreApi.GetItemAmountBought(MoreShopItemsPlugin.TalismanItemId) > 0
                       // Only enable if not coming from a peeping H scene, because trying to start 3P in that state just ends the H scene
                       && GameObject.FindObjectOfType <HScene>().dataH.peepCategory.Count == 0);
            },
                         confirmBoxTitle: "Hシーン確認",
                         confirmBoxSentence: "Do you want to use one of your Twin-making Talismans?\n\nIt's supposed to create a twin of the girl, but what will actually happen?",
                         onConfirmed: hSprite =>
            {
                MoreShopItemsPlugin.Logger.LogDebug("Twin-making Talisman used");

                // Custom code, copy current heroine and add a copy to the "other heroine waiting" field
                var hsp = GameObject.FindObjectOfType <HSceneProc>();
                if (hsp == null)
                {
                    throw new ArgumentNullException(nameof(hsp));
                }

                var currHeroine = hsp.dataH.lstFemale[0];
                if (currHeroine == null)
                {
                    throw new ArgumentNullException(nameof(currHeroine));
                }

                MoreShopItemsPlugin.Logger.LogDebug($"Creating a copy of the main heroine: {currHeroine.Name} chaCtrl={currHeroine.chaCtrl}");
                Heroine.SetBytes(currHeroine.version, Heroine.GetBytes(currHeroine), out var copyHeroine);
                copyHeroine.chaCtrl   = currHeroine.chaCtrl;
                hsp.dataH.newHeroione = copyHeroine;

                // Stock game code to initialize the 3P transition
                MoreShopItemsPlugin.Logger.LogDebug("Starting 3P transition copied character");
                var flags         = hSprite.flags;
                flags.click       = HFlag.ClickKind.end;
                flags.isHSceneEnd = true;
                flags.numEnd      = 2;
                //flags.lstHeroine[0].lewdness = 100;
                var asi = ActionScene.instance;
                if (asi == null)
                {
                    throw new ArgumentNullException(nameof(asi));
                }
                if (asi)
                {
                    asi.isPenetration = true;
                }
                if (flags.shortcut != null)
                {
                    flags.shortcut.enabled = false;
                }
                if (asi)
                {
                    asi.ShortcutKeyEnable(false);
                }

                // Eat one of the held items
                StoreApi.DecreaseItemAmountBought(MoreShopItemsPlugin.TalismanItemId);
            }));

            return(true);
        }
Beispiel #20
0
 public StoreApiTests()
 {
     instance = new StoreApi();
 }
Beispiel #21
0
 public static int GetFeatureLevel()
 {
     return(StoreApi.GetItemAmountBought(StoreItemId));
 }
Beispiel #22
0
 private static bool IsEffectActive()
 {
     // Check from the moment item is bought up to the end of the next day
     return(StoreApi.GetItemAmountBought(RubberStoreId) + StoreApi.GetShopItemEffect(RubberStoreId) > 0);
 }
Beispiel #23
0
 public void SetUp()
 {
     instance = new StoreApi();
 }
 public void Init()
 {
     instance = new StoreApi();
 }