public static void Postfix(GameScript __instance, int i, ref Item[] ___craft)
 {
     if (___craft[i].q > 0)
     {
         AnimIcon animIcon = (AnimIcon)__instance.craftIconBack[i].GetComponent("AnimIcon");
         if ((ItemRegistry.GetTypeByID(___craft[i].id) & ItemType.LEVELING) != ItemType.LEVELING)
         {
             __instance.craftIconBack[i].SetActive(false);
             animIcon.anim = 0;
         }
         else
         {
             __instance.craftIconBack[i].GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___craft[i].tier);
             MonoBehaviour.print("(GadgetCore Patched) inviconback tier " + ___craft[i].tier);
             if (___craft[i].tier == 3)
             {
                 animIcon.anim = 1;
             }
             else
             {
                 animIcon.anim = 0;
             }
             __instance.craftIconBack[i].SetActive(true);
         }
     }
 }
 public static void Postfix(GameScript __instance, ref Item[] ___gatherStorage)
 {
     for (int i = 0; i < 9; i++)
     {
         AnimIcon animIcon = (AnimIcon)__instance.gatherStorageIconBack[i].GetComponent("AnimIcon");
         if ((ItemRegistry.GetTypeByID(___gatherStorage[i].id) & ItemType.LEVELING) != ItemType.LEVELING)
         {
             __instance.gatherStorageIconBack[i].SetActive(false);
             animIcon.anim = 0;
         }
         else
         {
             __instance.gatherStorageIconBack[i].GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___gatherStorage[i].tier);
             if (___gatherStorage[i].tier == 3)
             {
                 animIcon.anim = 1;
             }
             else
             {
                 animIcon.anim = 0;
             }
             __instance.gatherStorageIconBack[i].SetActive(true);
         }
     }
 }
 public static void Postfix(GameScript __instance, int i, ref Item[] ___inventoryQuest)
 {
     if (___inventoryQuest[i].q > 0)
     {
         AnimIcon animIcon = (AnimIcon)__instance.invQuestIconBack[i].GetComponent("AnimIcon");
         if ((ItemRegistry.GetTypeByID(___inventoryQuest[i].id) & ItemType.LEVELING) != ItemType.LEVELING)
         {
             __instance.invQuestIconBack[i].SetActive(false);
             animIcon.anim = 0;
         }
         else
         {
             __instance.invQuestIconBack[i].GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___inventoryQuest[i].tier);
             if (___inventoryQuest[i].tier == 3)
             {
                 animIcon.anim = 1;
             }
             else
             {
                 animIcon.anim = 0;
             }
             __instance.invQuestIconBack[i].SetActive(true);
         }
     }
 }
예제 #4
0
        public static bool Prefix(ItemScript __instance, int[] stats, ref Item ___item, ref Package ___package)
        {
            ___item    = GadgetCoreAPI.ConstructItemFromIntArray(stats);
            ___package = new Package(___item, __instance.gameObject, __instance.localItem);
            __instance.b.GetComponent <Renderer>().material = (Material)Resources.Load("i/i" + ___item.id);
            AnimIcon animIcon = (AnimIcon)__instance.back.GetComponent("AnimIcon");

            if ((ItemRegistry.GetTypeByID(___item.id) & ItemType.LEVELING) != ItemType.LEVELING)
            {
                __instance.back.SetActive(false);
                animIcon.anim = 0;
            }
            else
            {
                __instance.back.GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___item.tier);
                if (___item.tier == 3)
                {
                    animIcon.anim = 1;
                }
                else
                {
                    animIcon.anim = 0;
                }
                __instance.back.SetActive(true);
            }
            __instance.StartCoroutine(Burst.Invoke(__instance, new object[] { }) as IEnumerator);
            return(false);
        }
예제 #5
0
 public static void Postfix(GameScript __instance, bool ___holdingCombatChip, Item ___holdingItem)
 {
     if (!___holdingCombatChip && ___holdingItem.id != 0 && ___holdingItem.q > 0)
     {
         AnimIcon animIcon = (AnimIcon)__instance.holdingItemBack.GetComponent("AnimIcon");
         if ((ItemRegistry.GetTypeByID(___holdingItem.id) & ItemType.LEVELING) != ItemType.LEVELING)
         {
             __instance.holdingItemBack.SetActive(false);
             animIcon.anim = 0;
         }
         else
         {
             __instance.holdingItemBack.GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___holdingItem.tier);
             if (___holdingItem.tier == 3)
             {
                 animIcon.anim = 1;
             }
             else
             {
                 animIcon.anim = 0;
             }
             __instance.holdingItemBack.SetActive(true);
         }
     }
 }
예제 #6
0
        /// <summary>
        /// Chargement d'un item
        /// </summary>
        /// <param name="guid"></param>
        private void LoadAction(Guid guid)
        {
            Cursor.Current = Cursors.WaitCursor;

            //Code de chargement
            CurrentAction = GameCore.Instance.GetActionById(guid);

            //Désactiver les eventhandler
            txtDescription.TextChanged -= new EventHandler(txtDescription_TextChanged);
            txtName.LostFocus          -= new EventHandler(txtName_TextChanged);

            //Afficher les groupes
            grpIcons.Visible        = true;
            grpInformations.Visible = true;

            if (CurrentAction.InventoryIcon != new Guid())
            {
                AnimInventory.LoadAnimation(CurrentAction.InventoryIcon);
                AnimInventory.Start();
            }
            else
            {
                AnimInventory.LoadAnimation(new Guid());
            }

            if (CurrentAction.Icon != new Guid())
            {
                AnimIcon.LoadAnimation(CurrentAction.Icon);
                AnimIcon.Start();
            }
            else
            {
                AnimIcon.LoadAnimation(new Guid());
            }

            if (CurrentAction.ActiveIcon != new Guid())
            {
                AnimActiveIcon.LoadAnimation(CurrentAction.ActiveIcon);
                AnimActiveIcon.Start();
            }
            else
            {
                AnimActiveIcon.LoadAnimation(new Guid());
            }


            //Bind des infos dans les contrôles
            txtDescription.Text = CurrentAction.Description;
            txtName.Text        = CurrentAction.Title;

            //Activer les eventhandler
            txtDescription.TextChanged += new EventHandler(txtDescription_TextChanged);
            txtName.LostFocus          += new EventHandler(txtName_TextChanged);

            Cursor.Current = DefaultCursor;
        }
예제 #7
0
        public static bool Prefix(ItemScript __instance, int[] stats, ref Item ___item, ref Package ___package)
        {
            if (stats[1] > 9999)
            {
                if (stats[0] == 52)
                {
                    int trophies = (stats[1] - 1) / 9999;
                    stats[1] -= trophies * 9999;
                    if (trophies > 0)
                    {
                        GadgetCoreAPI.SpawnItemLocal(__instance.transform.position, new Item(59, trophies, 0, 0, 0, new int[3], new int[3]));
                    }
                }
                else
                {
                    int extraStacks = (stats[1] - 1) / 9999;
                    stats[1] -= extraStacks * 9999;
                    int[] extraStackArray = stats;
                    extraStackArray[1] = 9999;
                    for (int i = 0; i < extraStacks; i++)
                    {
                        GadgetCoreAPI.SpawnItemLocal(__instance.transform.position, GadgetCoreAPI.ConstructItemFromIntArray(extraStackArray));
                    }
                }
            }
            ___item    = GadgetCoreAPI.ConstructItemFromIntArray(stats);
            ___package = new Package(___item, __instance.gameObject, __instance.localItem);
            __instance.b.GetComponent <Renderer>().material = (Material)Resources.Load("i/i" + ___item.id);
            AnimIcon animIcon = (AnimIcon)__instance.back.GetComponent("AnimIcon");

            if ((ItemRegistry.GetTypeByID(___item.id) & ItemType.LEVELING) != ItemType.LEVELING)
            {
                __instance.back.SetActive(false);
                animIcon.anim = 0;
            }
            else
            {
                __instance.back.GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___item.tier);
                if (___item.tier == 3)
                {
                    animIcon.anim = 1;
                }
                else
                {
                    animIcon.anim = 0;
                }
                __instance.back.SetActive(true);
            }
            __instance.StartCoroutine(Burst.Invoke(__instance, new object[] { }) as IEnumerator);
            return(false);
        }
        public static void Postfix(GameScript __instance, int i, ref Item[] ___storage, ref int ___curStoragePage)
        {
            int      num      = i + (___curStoragePage * 30);
            AnimIcon animIcon = (AnimIcon)__instance.storageIconBack[i].GetComponent("AnimIcon");

            if ((ItemRegistry.GetTypeByID(___storage[num].id) & ItemType.LEVELING) != ItemType.LEVELING)
            {
                __instance.storageIconBack[i].SetActive(false);
                animIcon.anim = 0;
            }
            else
            {
                __instance.storageIconBack[i].GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___storage[num].tier);
                if (___storage[num].tier == 3)
                {
                    animIcon.anim = 1;
                }
                else
                {
                    animIcon.anim = 0;
                }
                __instance.storageIconBack[i].SetActive(true);
            }
        }
예제 #9
0
        /// <summary>
        /// Chargement d'un item
        /// </summary>
        /// <param name="guid"></param>
        private void LoadItem(Guid guid)
        {
            Cursor.Current = Cursors.WaitCursor;

            //Code de chargement
            CurrentItem = GameCore.Instance.GetItemById(guid);

            //Désactiver les eventhandler
            txtDescription.TextChanged -= new EventHandler(txtDescription_TextChanged);
            txtName.LostFocus          -= new EventHandler(txtName_TextChanged);

            //Afficher les groupes
            grpIcons.Visible        = true;
            grpInformations.Visible = true;
            grpView.Visible         = true;

            if (CurrentItem.InventoryIcon != new Guid())
            {
                AnimInventory.LoadAnimation(CurrentItem.InventoryIcon);
                AnimInventory.Start();
            }
            else
            {
                AnimInventory.LoadAnimation(new Guid());
            }

            if (CurrentItem.Icon != new Guid())
            {
                AnimIcon.LoadAnimation(CurrentItem.Icon);
                AnimIcon.Start();
            }
            else
            {
                AnimIcon.LoadAnimation(new Guid());
            }

            if (CurrentItem.ActiveIcon != new Guid())
            {
                AnimActiveIcon.LoadAnimation(CurrentItem.ActiveIcon);
                AnimActiveIcon.Start();
            }
            else
            {
                AnimActiveIcon.LoadAnimation(new Guid());
            }


            //Bind des infos dans les contrôles
            txtDescription.Text = CurrentItem.Description;
            txtName.Text        = CurrentItem.Title;

            //Bind des actions
            listActions.Items.Clear();
            foreach (VO_Base action in GameCore.Instance.Game.Actions)
            {
                if (!((VO_Action)action).GoAction && !((VO_Action)action).UseAction)
                {
                    listActions.Items.Add(action);
                }
            }
            listActions.DisplayMember = "Title";
            listActions.ValueMember   = "Id";
            if (listActions.Items.Count > 0)
            {
                listActions.SelectedIndex = 0;
            }

            //Activer les eventhandler
            txtDescription.TextChanged += new EventHandler(txtDescription_TextChanged);
            txtName.LostFocus          += new EventHandler(txtName_TextChanged);

            Cursor.Current = DefaultCursor;
        }