public static bool Prefix(GameScript __instance, ref Item ___holdingItem, ref bool ___holdingCombatChip, ref bool ___droppingItem)
        {
            Item item = ___holdingItem;

            ___holdingItem = __instance.EmptyItem();
            if (___holdingCombatChip)
            {
                Vector3    position   = new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y, 0f);
                GameObject gameObject = (GameObject)Network.Instantiate(Resources.Load("i2"), position, Quaternion.identity, 0);
                gameObject.GetComponent <NetworkView>().RPC("Chip", RPCMode.AllBuffered, new object[]
                {
                    item.id
                });
                ___droppingItem      = false;
                ___holdingCombatChip = false;
            }
            else
            {
                int[]      array       = GadgetCoreAPI.ConstructIntArrayFromItem(item, true, false);
                Vector3    position2   = new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y, 0f);
                GameObject gameObject2 = (GameObject)Network.Instantiate(Resources.Load("i2"), position2, Quaternion.identity, 0);
                gameObject2.GetComponent <NetworkView>().RPC("Init", RPCMode.AllBuffered, new object[]
                {
                    array
                });
                ___droppingItem = false;
            }
            __instance.RefreshHoldingSlot();
            return(false);
        }
Ejemplo n.º 2
0
 internal void GiveChip(Item item, NetworkPlayer player)
 {
     if (Network.player == player)
     {
         GadgetCoreAPI.SpawnItemLocal(InstanceTracker.PlayerScript.transform.position, item, true).gameObject.SendMessage("Request");
     }
     else
     {
         view.RPC("RPCGiveChip", player, GadgetCoreAPI.ConstructIntArrayFromItem(item, true, true));
     }
 }
 public static bool Prefix(GameScript __instance, ref Item[] ___modSlot)
 {
     if (___modSlot[0].id > 0)
     {
         int[] array = GadgetCoreAPI.ConstructIntArrayFromItem(___modSlot[0], true, false);
         ___modSlot[0] = __instance.EmptyItem();
         GameObject gameObject = (GameObject)Network.Instantiate(Resources.Load("i"), MenuScript.player.transform.position, Quaternion.identity, 0);
         gameObject.GetComponent <NetworkView>().RPC("Init", RPCMode.AllBuffered, new object[]
         {
             array
         });
         __instance.RefreshSlotMod(0);
     }
     return(false);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Gives the player an item.
 /// </summary>
 public static Action GrantItem(Item item, bool randomizeTier = false, int randomQuantityVariation = 0)
 {
     return(() =>
     {
         InstanceTracker.GameScript.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/glitter"), Menuu.soundLevel / 10f);
         int[] itemArray = GadgetCoreAPI.ConstructIntArrayFromItem(item);
         if (randomQuantityVariation > 0)
         {
             itemArray[1] += UnityEngine.Random.Range(0, randomQuantityVariation + 1);
         }
         if (randomQuantityVariation < 0)
         {
             itemArray[1] -= UnityEngine.Random.Range(0, -randomQuantityVariation + 1);
         }
         if (randomizeTier)
         {
             itemArray[3] = InstanceTracker.GameScript.GetRandomTier();
         }
         GameObject itemObject = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("i3"), new Vector3(InstanceTracker.GameScript.transform.position.x, InstanceTracker.GameScript.transform.position.y, 0f), Quaternion.identity);
         itemObject.SendMessage("InitL", itemArray);
     });
 }