Esempio n. 1
0
            static bool Prefix(string changTyp, int itemId, int number = 1)
            {
                //Logger.Log("点击物品 " + changTyp + " " + itemId.ToString() + " " + number.ToString());
                if (Main.settings.useWarehouse == 2)
                {
                    return(true);
                }
                int num = 1;

                if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
                {
                    if (int.Parse(DateFile.instance.GetItemDate(itemId, 6, true)) > 0)
                    {
                        num = DateFile.instance.GetItemNumber(changTyp == "ActorItem" ? DateFile.instance.MianActorID() : -999, itemId);
                    }
                }
                else if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
                {
                    if (int.Parse(DateFile.instance.GetItemDate(itemId, 6, true)) > 0)
                    {
                        int maxNum = DateFile.instance.GetItemNumber(changTyp == "ActorItem" ? DateFile.instance.MianActorID() : -999, itemId);
                        if (Main.settings.tackNum > maxNum)
                        {
                            num = maxNum;
                        }
                        else
                        {
                            num = Main.settings.tackNum;
                        }
                    }
                }
                if (changTyp == "ActorItem")
                {
                    DateFile.instance.ChangeTwoActorItem(DateFile.instance.MianActorID(), -999, itemId, num, -1);
                }
                else
                {
                    DateFile.instance.ChangeTwoActorItem(-999, DateFile.instance.MianActorID(), itemId, num, -1);
                }
                Main.OnChangeItem = true;
                Warehouse_UpdateActorItems_Patch.Prefix(true, Warehouse.instance.actorItemTyp);
                Warehouse_UpdateActorItems_Patch.Prefix(false, Warehouse.instance.warehouseItemTyp);
                Main.OnChangeItem = false;
                return(false);
            }