Ejemplo n.º 1
0
        private void GrantEquipment(CharacterBody body, Inventory inventory)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::GrantEquipment(RoR2.CharacterBody,RoR2.Inventory)' called on client");
                return;
            }
            this.waitStartTime = Run.FixedTimeStamp.now;
            EquipmentIndex currentEquipmentIndex = inventory.currentEquipmentIndex;
            EquipmentIndex equipmentIndex        = this.pickupIndex.equipmentIndex;

            inventory.SetEquipmentIndex(equipmentIndex);
            this.NetworkpickupIndex = new PickupIndex(currentEquipmentIndex);
            this.consumed           = false;
            GenericPickupController.SendPickupMessage(inventory.GetComponent <CharacterMaster>(), new PickupIndex(equipmentIndex));
            if (this.pickupIndex == PickupIndex.none)
            {
                UnityEngine.Object.Destroy(base.gameObject);
                return;
            }
            if (this.selfDestructIfPickupIndexIsNotIdeal && this.pickupIndex != PickupIndex.Find(this.idealPickupIndex.pickupName))
            {
                PickupDropletController.CreatePickupDroplet(this.pickupIndex, base.transform.position, new Vector3(UnityEngine.Random.Range(-4f, 4f), 20f, UnityEngine.Random.Range(-4f, 4f)));
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
Ejemplo n.º 2
0
 // Token: 0x06000B4B RID: 2891 RVA: 0x00031D04 File Offset: 0x0002FF04
 private void OnTriggerStay(Collider other)
 {
     if (NetworkServer.active && this.waitStartTime.timeSince >= this.waitDuration && !this.consumed)
     {
         CharacterBody component = other.GetComponent <CharacterBody>();
         if (component)
         {
             ItemIndex itemIndex = this.pickupIndex.itemIndex;
             if (itemIndex != ItemIndex.None && ItemCatalog.GetItemDef(itemIndex).tier == ItemTier.Lunar)
             {
                 return;
             }
             EquipmentIndex equipmentIndex = this.pickupIndex.equipmentIndex;
             if (equipmentIndex != EquipmentIndex.None)
             {
                 if (EquipmentCatalog.GetEquipmentDef(equipmentIndex).isLunar)
                 {
                     return;
                 }
                 if (component.inventory && component.inventory.currentEquipmentIndex != EquipmentIndex.None)
                 {
                     return;
                 }
             }
             if (this.pickupIndex.coinValue != 0U)
             {
                 return;
             }
             if (GenericPickupController.BodyHasPickupPermission(component))
             {
                 this.AttemptGrant(component);
             }
         }
     }
 }
Ejemplo n.º 3
0
 private void GrantItem(CharacterBody body, Inventory inventory)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::GrantItem(RoR2.CharacterBody,RoR2.Inventory)' called on client");
         return;
     }
     inventory.GiveItem(this.pickupIndex.itemIndex, 1);
     GenericPickupController.SendPickupMessage(inventory.GetComponent <CharacterMaster>(), this.pickupIndex);
     UnityEngine.Object.Destroy(base.gameObject);
 }
Ejemplo n.º 4
0
        private void GrantLunarCoin(CharacterBody body, uint count)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::GrantLunarCoin(RoR2.CharacterBody,System.UInt32)' called on client");
                return;
            }
            CharacterMaster master      = body.master;
            NetworkUser     networkUser = Util.LookUpBodyNetworkUser(body);

            if (networkUser)
            {
                if (master)
                {
                    GenericPickupController.SendPickupMessage(master, this.pickupIndex);
                }
                networkUser.AwardLunarCoins(count);
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
Ejemplo n.º 5
0
        // Token: 0x06000B57 RID: 2903 RVA: 0x000320E0 File Offset: 0x000302E0
        public Interactability GetInteractability(Interactor activator)
        {
            if (!base.enabled)
            {
                return(Interactability.Disabled);
            }
            if (this.waitStartTime.timeSince < this.waitDuration || this.consumed)
            {
                return(Interactability.Disabled);
            }
            CharacterBody component = activator.GetComponent <CharacterBody>();

            if (!component)
            {
                return(Interactability.Disabled);
            }
            if (!GenericPickupController.BodyHasPickupPermission(component))
            {
                return(Interactability.Disabled);
            }
            return(Interactability.Available);
        }
Ejemplo n.º 6
0
        private void GenericPickupController_GrantItem(On.RoR2.GenericPickupController.orig_GrantItem orig, RoR2.GenericPickupController self, RoR2.CharacterBody body, RoR2.Inventory inventory)
        {
            orig.Invoke(self, body, inventory);

            //Debug.Log(self.pickupIndex);

            PickupIndex dio = new PickupIndex(ItemIndex.ExtraLife);

            if (self.pickupIndex == dio)
            {
                //List<PickupIndex> tier3Items = Run.instance.availableTier3DropList;

                //int rng = random.Next(0, tier3Items.Count);
                //if (tier3Items[rng] == dio)
                //    rng++;

                //ItemIndex rngItem = tier3Items[rng].itemIndex;
                //tier3Items[rng].itemIndex.ToString();
                //tier3Items[rng].GetPickupNameToken();

                string pickupName = self.GetComponentInChildren <PickupDisplay>().transform.GetChild(1).name.Replace("(Clone)", "");
                //Debug.Log(pickupName);


                ItemDef[] items    = typeof(ItemCatalog).GetFieldValue <ItemDef[]>("itemDefs");
                ItemDef   fakeItem = items[0];
                //Debug.Log(items.Length);
                //Debug.Log(items[0]);
                foreach (ItemDef item in items)
                {
                    if (item.pickupModelPath.Contains(pickupName))
                    {
                        Debug.Log("FOUND!!!!!!!!");
                        fakeItem = item;
                        break;
                    }
                }

                PickupIndex ogItem = new PickupIndex(fakeItem.itemIndex);
                //Debug.Log("----------");
                //Debug.Log(ogItem.GetPickupNameToken());
                //Debug.Log(Language.GetString(ogItem.GetPickupNameToken()));
                //Debug.Log(ogItem.itemIndex);
                //Debug.Log("----------");

                //PickupIndex ogItem = new PickupIndex(ItemIndex.Behemoth);

                //string rngItemName = Language.GetString(tier3Items[rng].GetPickupNameToken());
                //Color32 color = tier3Items[rng].GetPickupColor();
                //Color32 colorDark = tier3Items[rng].GetPickupColorDark();

                string  rngItemName = Language.GetString(ogItem.GetPickupNameToken());
                Color32 color       = ogItem.GetPickupColor();
                Color32 colorDark   = ogItem.GetPickupColorDark();


                //<color=#307FFF>Lunar Coin</color><style=cEvent> Dropped</style>
                Chat.AddMessage(String.Format("<style=cEvent>You were expecting </style>{0} {1}", Util.GenerateColoredString(rngItemName, color), Util.GenerateColoredString("BUT IT WAS ME DIO", colorDark)));
            }
        }
Ejemplo n.º 7
0
 private void GenericPickupControllerGrantItem(On.RoR2.GenericPickupController.orig_GrantItem orig, RoR2.GenericPickupController self, CharacterBody body, Inventory inventory)
 {
     orig(self, body, inventory);
     _pickups[inventory] = new PickupRecord(Time.time, PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex);
 }
Ejemplo n.º 8
0
        private void GenericPickupController_GrantItem(On.RoR2.GenericPickupController.orig_GrantItem orig, RoR2.GenericPickupController self, RoR2.CharacterBody body, RoR2.Inventory inventory)
        {
            orig.Invoke(self, body, inventory);

            //Debug.Log(self.pickupIndex);

            PickupIndex trashDio = new PickupIndex(ItemIndex.Bear);

            if (self.pickupIndex == trashDio)
            {
                List <PickupIndex> tier1Items = Run.instance.availableTier1DropList;

                int rng = random.Next(0, tier1Items.Count);
                if (tier1Items[rng] == trashDio)
                {
                    rng++;
                }

                //ItemIndex rngItem = tier3Items[rng].itemIndex;
                //tier3Items[rng].itemIndex.ToString();
                //tier3Items[rng].GetPickupNameToken();

                string  rngItemName = Language.GetString(tier1Items[rng].GetPickupNameToken());
                Color32 color       = tier1Items[rng].GetPickupColor();
                Color32 colorDark   = tier1Items[rng].GetPickupColorDark();



                //<color=#307FFF>Lunar Coin</color><style=cEvent> Dropped</style>
                Chat.AddMessage(String.Format("<style=cEvent>You were expecting </style>{0} {1}", Util.GenerateColoredString(rngItemName, color), Util.GenerateColoredString("BUT IT WAS ME TRASH DIO", colorDark)));
            }
        }
Ejemplo n.º 9
0
        private void GenericPickupController_AttemptGrant(On.RoR2.GenericPickupController.orig_AttemptGrant orig, RoR2.GenericPickupController self, RoR2.CharacterBody body)
        {
            if (PickupCatalog.GetPickupDef(self.pickupIndex).equipmentIndex != EquipmentIndex.None)
            {
                orig(self, body);
                return;
            }
            InventoryLimits limits = null;

            limits = body.master.gameObject.GetComponent <InventoryLimits>();
            if (limits != null && PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex != ItemIndex.None)
            {
                if (limits.Limited)
                {
                    /*
                     * Chat.AddMessage($"<color=#FFFF00>Inventory full: {limits.amount}/{limits.limit}. Gain experience to gain free space.</color>");
                     */
                    return;
                }
            }
            orig(self, body);
            if (limits != null && PickupCatalog.GetPickupDef(self.pickupIndex).itemIndex != ItemIndex.None)
            {
                if (NetworkServer.active)
                {
                    DropperChat.ItemCountMessage(body.GetUserName(), limits.amount, limits.limit);
                }
            }
        }
Ejemplo n.º 10
0
 private void GenericPickupController_OnTriggerStay(On.RoR2.GenericPickupController.orig_OnTriggerStay orig, RoR2.GenericPickupController self, Collider other)
 {
 }