static void Postfix(TVBenchUnitViewer __instance, GameObject ___placeHolder, ref TVCtr ___tVCtr) { if (!enabled || __instance.GetComponentInParent <PhotoFrameCtr>() == null) { return; } Dbgl($"Fresh Items"); ItemObject item = ItemObject.CreateItem(4030001); GameObject tvObject = GameUtils.AddChild(___placeHolder, item.ItemBase.DropModelPath, false, AssetType.ItemSystem); MeshRenderer[] tvms = tvObject.GetComponentsInChildren <MeshRenderer>(); for (int i = 0; i < tvms.Length; i++) { MeshRenderer m = tvms[i]; m.gameObject.SetActive(false); } ___tVCtr = tvObject.GetComponentInChildren <TVCtr>(true); AudioSource audioSource = typeof(TVCtr).GetField("audioSource", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as AudioSource; audioSource.spatialBlend = settings.Spatiality; audioSource.volume = 1f; typeof(TVCtr).GetField("audioSource", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(___tVCtr, audioSource); //VideoPlayer videoPlayer = typeof(TVCtr).GetField("videoPlayer", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as VideoPlayer; //typeof(TVCtr).GetField("videoPlayer", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(___tVCtr, videoPlayer); GameObject newObj = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Home, "HomeItem_ADBoard"); GameObject screen = typeof(TVCtr).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(___tVCtr) as GameObject; MeshRenderer[] bbms = newObj.GetComponentsInChildren <MeshRenderer>(); foreach (MeshRenderer m in bbms) { //Dbgl($"mesh: {m.name}"); if (m.name == "Item_Billboard_2") { screen.GetComponentInChildren <MeshFilter>().mesh = m.GetComponentInChildren <MeshFilter>().mesh; screen.GetComponentInChildren <MeshRenderer>().materials = m.materials; //screen.GetComponentInChildren<Transform>().position = m.gameObject.GetComponentInChildren<Transform>().position; break; } } /* * Component[] components = screen.GetComponents(typeof(Component)); * foreach (Component component in components) * { * Dbgl($"component: {component.ToString()}"); * } */ //Vector3 scale = screen.GetComponentInChildren<MeshFilter>().transform.localScale; //screen.GetComponentInChildren<MeshFilter>().transform.localScale = new Vector3(scale.x, 1.6f, scale.z); //Dbgl($"local scale: {screen.transform.localScale}"); //screen.GetComponentInChildren<VideoPlayer>().aspectRatio = VideoAspectRatio.NoScaling; Vector3 pos = screen.GetComponentInChildren <MeshFilter>().transform.position; screen.transform.position = new Vector3(pos.x, pos.y - 0.84f, pos.z) - screen.GetComponentInChildren <MeshFilter>().transform.forward * 0.02f; }
static void Postfix(List <IdCount> __result) { if (__result == null) { return; } foreach (IdCount idc in __result) { try { Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(idc.id, idc.count), true); } catch { } } }
static void Postfix() { //Module<FavorManager>.Self.GainFavorValue(4000141, -1, 1000); if (false) { TimeManager.Self.JumpTimeByGameTime(60 * 60); } if (false) { Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7000041, 100), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8000019, 100), true); } //relationId = FavorRelationshipId.SoulMate; //FavorUtility.SetNpcRelation(f.ID, relationId, 1); }
static void Postfix() { Dbgl("new Vector3" + Module <Player> .Self.actor.gamePos.ToString() + ","); return; Module <Player> .Self.bag.ChangeMoney(1000000, true, 0); Module <Player> .Self.AddExp(400000, true); //Object here is necessary. //Dbgl("OtherConfig: " + string.Format(str)); //trialDungeonMonsterConfInfo.ActorID; //trialDungeonMonsterConfInfo.Faction; //ActorAgent aa new ActorAgent(vp, vr,); /* * int id = ruleData.PickOneBossMonster(); * TrialDungeonMonsterConfInfo trialDungeonMonsterConfInfo = Module<DungeonConfCreator>.Self.RandomDungeonMonsterConfList.Find((TrialDungeonMonsterConfInfo m) => m.ID == id); * if (trialDungeonMonsterConfInfo == null) * { * Debug.LogError(string.Format("monster {0} not existed!", id)); * return; * } * GameObject gameObject = spawnPoint.Spawn(new object[] * { * trialDungeonMonsterConfInfo.ActorID, * trialDungeonMonsterConfInfo.Faction * }); * if (gameObject != null) * { * Actor component = gameObject.GetComponent<Actor>(); * this.mCreatedActorList.Add(component); * Module<TrialRandomDungeonManager>.Self.AddMonster(component, trialDungeonMonsterConfInfo); * component.killEvent += Module<TrialRandomDungeonManager>.Self.MonsterBeKilledCBMethod; * } */ //FavorObject ff = FavorManager.Self.GetFavorObject(-1); //bool test = ff.IsDebut; if (true) { FavorObject[] fa = FavorManager.Self.GetAllFavorObjects(); foreach (FavorObject f in fa) { if (!f.IsDebut || f.RelationshipType == FavorRelationshipType.Couple) { FavorManager.Self.GainFavorValue(f.ID, -1, 100); if (false) { FavorRelationshipId relationId = FavorRelationshipId.UltimateCouple; relationId = FavorRelationshipId.Friend; FavorUtility.SetNpcRelation(f.ID, relationId, 1); relationId = FavorRelationshipId.SoulMate; FavorUtility.SetNpcRelation(f.ID, relationId, 1); } } } if (false) { Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7000041, 100), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8000019, 100), true); Module <Player> .Self.bag.ChangeMoney(100000, true, 0); } } }
private static void OnUpdate(UnityModManager.ModEntry arg1, float arg2) { if (Input.GetKeyDown(",")) { float scale = 1f; int rewardId = 6601; CreateTreasure(Player.Self.actor.transform, OtherConfig.Self.UnlimitedRewardBox[3], rewardId, false, scale); } return; if (Input.GetKeyDown(",")) { GameObject[] gos = SceneManager.GetActiveScene().GetRootGameObjects(); string output = ""; foreach (GameObject go in gos) { output += $"GO: {go.name} {go.transform.position}\r\n"; } Dbgl(output); //lUnityEngine.Object.Instantiate } return; if (Input.GetKeyDown(",") && Module <Player> .Self.actor != null) { GameObject[] roots = SceneManager.GetActiveScene().GetRootGameObjects(); List <Collider> cols = new List <Collider>(); foreach (GameObject go in roots) { Collider[] colliders = go.GetComponentsInChildren <Collider>(); cols.AddRange(colliders); } noclip = !noclip; Rigidbody component = Module <Player> .Self.actor.GetComponent <Rigidbody>(); if (component != null) { component.useGravity = !noclip; } Module <Player> .Self.actor.IgnoreCollision(cols, noclip); } return; if (Input.GetKeyDown(",")) { Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3000319, 1), true); } return; if (Input.GetKeyDown(".")) { HUDFPS component = Module <TestClick> .Self.gameObject.GetComponent <HUDFPS>(); if (component != null) { UnityEngine.Object.Destroy(component); } else { Module <TestClick> .Self.gameObject.AddComponent <HUDFPS>(); } } if (Input.GetKeyDown("/")) { DeviceInfo component = Module <TestClick> .Self.gameObject.GetComponent <DeviceInfo>(); if (component != null) { UnityEngine.Object.Destroy(component); } else { Module <TestClick> .Self.gameObject.AddComponent <DeviceInfo>(); } } if (Input.GetKeyDown("'")) { GraphicCtr component = Module <TestClick> .Self.GetComponent <GraphicCtr>(); if (component) { UnityEngine.Object.Destroy(component); } else { Module <TestClick> .Self.gameObject.AddComponent <GraphicCtr>(); } } return; if (Input.GetKeyDown(",")) { Module <Player> .Self.bag.ChangeMoney(100000, true, 0); } if (Input.GetKeyDown(".")) { Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(1001300, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(1001301, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3044001, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3044002, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3044003, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(3044004, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(4000328, 1), true); //Module<Player>.Self.bag.AddItem(ItemObject.CreateItem(5000028, 1), true); //Module<Player>.Self.bag.AddItem(ItemObject.CreateItem(5000029, 1), true); //Module<Player>.Self.bag.AddItem(ItemObject.CreateItem(5000131, 1), true); //Module<Player>.Self.bag.AddItem(ItemObject.CreateItem(5010004, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000002, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000019, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000020, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000021, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000024, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000025, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000026, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000027, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000028, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000029, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(6000030, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7000008, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7000023, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010001, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010002, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010003, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010005, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010006, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010007, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010008, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010009, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(7010010, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8000010, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8000028, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8010001, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8010002, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8010003, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8010004, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8020008, 1), true); Module <Player> .Self.bag.AddItem(ItemObject.CreateItem(8020009, 1), true); } }
static void OnUpdate(UnityModManager.ModEntry modEntry, float dt) { if ( null == itemMenu && Input.GetKeyDown(Main.modSettings.GiveItemKey.keyCode) && Pathea.Player.Self.actor != null ) { if (items == null) { mod.Logger.Log("making item list"); items = new List <ItemObject>(); // items.Add(ItemObject.CreateItem(ItemConstants.ItemID_Sofa, 1)); // items.Add(ItemObject.CreateItem(ItemConstants.ItemID_BronzeSword, 1)); ItemDataMgr.Instance.ForeachItemBase(delegate(ItemBaseConfData itemData) { if ( itemData.ItemType.Contains(ItemType.BoxItem) || itemData.ItemType.Contains(ItemType.Equipment) || itemData.ItemType.Contains(ItemType.FarmFloor) || itemData.ItemType.Contains(ItemType.FarmItem) || itemData.ItemType.Contains(ItemType.Food) // those can cause crashes? // || itemData.ItemType.Contains(ItemType.CreationBook) // assembly // || itemData.ItemType.Contains(ItemType.ProductionBook) // craft || itemData.ItemType.Contains(ItemType.Home) || itemData.ItemType.Contains(ItemType.HomeMaterial) || itemData.ItemType.Contains(ItemType.HomeSystemUnit) || itemData.ItemType.Contains(ItemType.Material) || itemData.ItemType.Contains(ItemType.Nutrient) || itemData.ItemType.Contains(ItemType.NutrientContainer) || itemData.ItemType.Contains(ItemType.Other) || itemData.ItemType.Contains(ItemType.PutDownItem) || itemData.ItemType.Contains(ItemType.Seed) ) { items.Add(ItemObject.CreateItem(itemData.ID, 999)); } }); items.Sort(delegate(ItemObject a, ItemObject b) { int num3 = (2 * SortCompareType(a, b)) + SortCompareID(a, b); if (num3 == 0) { return(0); } return(num3 > 0 ? 1 : -1); }); } // because this doesn't work by default? bool currentCursorState = Pathea.UISystemNs.UIStateComm.Instance.cursorVisiable; // not previously in a menu otherwise could get stuck if (!currentCursorState) { itemMenu = Pathea.UISystemNs.UIUtils.ShowItemChoice(items, null, true, GiveItem, false); Pathea.UISystemNs.UIStateComm.Instance.SetCursor(true); itemMenu.OnCancelCallBack = delegate { Pathea.UISystemNs.UIStateComm.Instance.SetCursor(false); }; } } }
public static void GiveItem(int itemId, int number) { mod.Logger.Log(string.Format("give item {0} {1}", itemId, number)); Pathea.Player.Self.bag.AddItem(ItemObject.CreateItem(itemId, number), true); }
static void Postfix(PhotoFrameCtr __instance) { if (!enabled) { return; } Dbgl($"starting photoframectr"); MeshRenderer[] bbms = __instance.gameObject.GetComponentsInChildren <MeshRenderer>(); MeshRenderer screenMr = null; foreach (MeshRenderer m in bbms) { //Dbgl($"mesh: {m.name}"); if (m.name == "Item_Billboard_2") { screenMr = m; break; } } if (screenMr == null) { return; } GameObject tvt = Singleton <ResMgr> .Instance.LoadSyncByType <GameObject>(AssetType.Home, "HomeItem_TVTable"); TVBenchUnitViewer tvtv = tvt.GetComponentInChildren <TVBenchUnitViewer>(true); /* * CabinetUnit unit = new CabinetUnit(3031001); * unit.PutCabinet(4030001, 1, out ItemObject item); * typeof(TVBenchUnitViewer).GetMethod("SetUnitInternal", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(tvtv, new object[] { unit }); * Dbgl($"Set Unit"); */ GameObject tvtr = UnityEngine.Object.Instantiate(tvt, __instance.gameObject.transform); //Dbgl($"Instantiated"); ItemObject item = ItemObject.CreateItem(4030001); //Dbgl($"got item {item.ItemBase.Name}"); GameUtils.ClearChildren(typeof(TVBenchUnitViewer).GetField("placeHolder", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvtv) as GameObject, false); GameObject tvObject = GameUtils.AddChild(typeof(TVBenchUnitViewer).GetField("placeHolder", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvtv) as GameObject, item.ItemBase.DropModelPath, false, AssetType.ItemSystem); TVCtr tvc = tvObject.GetComponentInChildren <TVCtr>(true); //Dbgl($"tvc is null? {tvc == null}"); typeof(TVBenchUnitViewer).GetField("tVCtr", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(tvtv, tvc); MeshRenderer[] tvtms = tvtr.GetComponentsInChildren <MeshRenderer>(); for (int i = 0; i < tvtms.Length; i++) { MeshRenderer m = tvtms[i]; m.gameObject.SetActive(false); } MeshRenderer[] tvms = tvObject.GetComponentsInChildren <MeshRenderer>(); for (int i = 0; i < tvms.Length; i++) { MeshRenderer m = tvms[i]; m.gameObject.SetActive(false); } GameObject screen = typeof(TVCtr).GetField("screen", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(tvc) as GameObject; screen.GetComponentInChildren <MeshFilter>().mesh = screenMr.GetComponentInChildren <MeshFilter>().mesh; //screen.transform.localScale = new Vector3(32f, 18f, 1f); PlayerTargetMultiAction CurPlayerTarget = (PlayerTargetMultiAction)typeof(UnitViewer).GetProperty("CurPlayerTarget", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance, null); CurPlayerTarget.SetAction(ActionType.ActionRoll, 103809, ActionTriggerMode.Normal); }