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); } } } }
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; } }
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(); }
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); }
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); }
public static int GetFeatureLevel() { return(StoreApi.GetItemAmountBought(StoreItemId)); }