예제 #1
0
            static void Prefix(PlayerItemBarCtr __instance)
            {
                if (!enabled)
                {
                    return;
                }

                if (KeyDown(settings.ItemBarSwitchKey))
                {
                    for (int index = 0; index < 8; index++)
                    {
                        ItemObject itemObject = Module <Player> .Self.bag.itemBar.itemBarItems[index];
                        ItemObject itemObj    = Module <Player> .Self.bag.GetItems(0).GetItemObj(index);

                        Module <Player> .Self.bag.BagExchangeItemBar(index, index, 0);
                    }

                    MethodInfo dynMethod = __instance.GetType().GetMethod("Unequip", BindingFlags.NonPublic | BindingFlags.Instance);
                    dynMethod.Invoke(__instance, new object[] { });
                }
                else if (KeyDown(settings.OpenStorageKey) && UIStateMgr.Instance.currentState.type == UIStateMgr.StateType.Play)
                {
                    StorageViewer sv = new StorageViewer();
                    FieldRef <StorageViewer, StorageUnit> suRef = FieldRefAccess <StorageViewer, StorageUnit>("storageUnit");
                    suRef(sv) = StorageUnit.GetStorageByGlobalIndex(lastStorageIndex);

                    MethodInfo dynMethod = sv.GetType().GetMethod("InteractStorage", BindingFlags.NonPublic | BindingFlags.Instance);
                    dynMethod.Invoke(sv, new object[] { });
                }
                else if (KeyDown(settings.OpenFactoryKey) && UIStateMgr.Instance.currentState.type == UIStateMgr.StateType.Play)
                {
                    FarmFactory[] factorys = Module <FarmFactoryMgr> .Self.GetAllFactorys();

                    if (factorys.Length == 0)
                    {
                        return;
                    }
                    FarmFactory factory = factorys[0];

                    Action <List <IdCount> > action = delegate(List <IdCount> ls)
                    {
                        factory.SetMatList(ls);
                    };
                    UIStateMgr.Instance.ChangeStateByType(UIStateMgr.StateType.PackageExchangeState, true, new object[]
                    {
                        factory.MatList,
                        TextMgr.GetStr(103440, -1),
                        true,
                        action,
                        103521,
                        300
                    });
                }
            }
예제 #2
0
            public static void Prefix(int ___curStorageGlobalIndex, out StorageUnit __state)
            {
                __state = null;

                if (!Enabled)
                {
                    return;
                }

                try
                {
                    __state = StorageUnit.GetStorageByGlobalIndex(___curStorageGlobalIndex);
                }
                catch (Exception exception) { Main.Logger.Exception(exception); }
            }
예제 #3
0
            static void Prefix(PlayerItemBarCtr __instance)
            {
                if (Input.GetKeyDown(KeyCode.Tab))
                {
                    for (int index = 0; index < 8; index++)
                    {
                        ItemObject itemObject = Module <Player> .Self.bag.itemBar.itemBarItems[index];
                        ItemObject itemObj    = Module <Player> .Self.bag.GetItems(0).GetItemObj(index);

                        if (itemObject != null && itemObj != null && itemObject.ItemBase.ID == itemObj.ItemBase.ID && itemObj.RemainCapacity() != 0)
                        {
                            int num2 = itemObj.RemainCapacity();
                            if (itemObject.Number <= num2)
                            {
                                itemObj.ChangeNumber(itemObject.Number);
                                Module <Player> .Self.bag.itemBar.SetItemObject(null, index);
                            }
                            else
                            {
                                itemObj.ChangeNumber(num2);
                                itemObject.ChangeNumber(-num2);
                            }
                        }
                        else
                        {
                            Module <Player> .Self.bag.BagExchangeItemBar(index, index, 0);
                        }
                    }

                    MethodInfo dynMethod = __instance.GetType().GetMethod("Unequip", BindingFlags.NonPublic | BindingFlags.Instance);
                    dynMethod.Invoke(__instance, new object[] { });
                }
                else if (Input.GetKeyDown(KeyCode.O))
                {
                    StorageViewer sv = new StorageViewer();
                    FieldRef <StorageViewer, StorageUnit> suRef = FieldRefAccess <StorageViewer, StorageUnit>("storageUnit");
                    suRef(sv) = StorageUnit.GetStorageByGlobalIndex(0);

                    MethodInfo dynMethod = sv.GetType().GetMethod("InteractStorage", BindingFlags.NonPublic | BindingFlags.Instance);
                    dynMethod.Invoke(sv, new object[] { });
                }
            }