Esempio n. 1
0
        private static void BiscoLeashAsEquipment()
        {
            BiscoLeashEquipmentDef = new EquipmentDef
            {
                name              = "BiscosLeashEquipment", // its the internal name, no spaces, apostrophes and stuff like that
                cooldown          = 5f,
                pickupModelPrefab = BiscoLeashPrefab,
                pickupIconSprite  = BiscoLeashIcon,
                nameToken         = "BISCOLEASH_NAME", // stylised name
                pickupToken       = "BISCOLEASH_PICKUP",
                descriptionToken  = "BISCOLEASH_DESC",
                loreToken         = "BISCOLEASH_LORE",
                canDrop           = true,
                enigmaCompatible  = false
            };

            var itemDisplayRules = new ItemDisplayRule[1];                         // keep this null if you don't want the item to show up on the survivor 3d model. You can also have multiple rules !

            itemDisplayRules[0].followerPrefab = BiscoLeashPrefab;                 // the prefab that will show up on the survivor
            itemDisplayRules[0].childName      = "Chest";                          // this will define the starting point for the position of the 3d model, you can see what are the differents name available in the prefab model of the survivors
            itemDisplayRules[0].localScale     = new Vector3(0.15f, 0.15f, 0.15f); // scale the model
            itemDisplayRules[0].localAngles    = new Vector3(0f, 180f, 0f);        // rotate the model
            itemDisplayRules[0].localPos       = new Vector3(-0.35f, -0.1f, 0f);   // position offset relative to the childName, here the survivor Chest

            var biscoLeash = new CustomEquipment(BiscoLeashEquipmentDef, itemDisplayRules);

            ItemAPI.Add(biscoLeash);
        }
        private static void AmethystAsEquip()
        {
            R2API.AssetPlus.Languages.AddToken("AMETHYST_NAME_TOKEN", "Gigantic Amethyst");
            R2API.AssetPlus.Languages.AddToken("AMETHYST_PICKUP_TOKEN", "<style=cIsUtility>Reset</style> all your cooldowns.");
            R2API.AssetPlus.Languages.AddToken("AMETHYST_DESCRIPTION_TOKEN", "<style=cIsUtility>Reset</style> all your cooldowns on activation.");
            R2API.AssetPlus.Languages.AddToken("AMETHYST_LORE_TOKEN", "I highly suggest handling this thing with some form of protective gear; we're not sure if it has any effects on the human body.");
            EquipmentDef AmethystEquipmentDef = new EquipmentDef
            {
                name             = "AMETHYST_NAME_TOKEN",
                cooldown         = GiganticAmethyst.Cooldown.Value,
                pickupModelPath  = PrefabPath,
                pickupIconPath   = IconPath,
                nameToken        = "AMETHYST_NAME_TOKEN",
                pickupToken      = "AMETHYST_PICKUP_TOKEN",
                descriptionToken = "AMETHYST_DESCRIPTION_TOKEN",
                loreToken        = "AMETHYST_LORE_TOKEN",
                canDrop          = true,
                enigmaCompatible = true
            };

            ItemDisplayRule[] AmethystDisplayRules = null;

            CustomEquipment AmethystEquipment = new CustomEquipment(AmethystEquipmentDef, AmethystDisplayRules);

            AmethystEquipmentIndex = ItemAPI.Add(AmethystEquipment);
        }
Esempio n. 3
0
        private static void LeechAsEquip()
        {
            LanguageAPI.Add("MASSIVELEECH_NAME_TOKEN", "Massive Leech");
            LanguageAPI.Add("MASSIVELEECH_PICKUP_TOKEN", "Grant massive life on hit for 10 seconds.Heal will increase with your level up.");
            LanguageAPI.Add("MASSIVELEECH_DESCRIPTION_TOKEN", "For 10 seconds, every hit <style=cIsHealing>heals</style> you for <style=cIsHealing>10 health</style>. Each level will gain <style=cIsHealing>1 extra health</style>.");
            LanguageAPI.Add("MASSIVELEECH_LORE_TOKEN", @"- Shipping Method:  Volatile
- Order Details:  Giant leeches found in the pools of HYPERION-5. Very similar to its counterpart on Earth, but it seems to have developed teeth as well, allowing it to eat meat as well as siphon blood. A few have been spotted to ballon to enormous proportions,up to the size of a small dog. Like the common leech, this has obvious medical implications. You will just have to be extra careful, or you may come back to no patient and a giant bloody leech.
");
            LanguageAPI.Add("MASSIVELEECH_NAME_TOKEN", "庞大水蛭", "zh-CN");
            LanguageAPI.Add("MASSIVELEECH_PICKUP_TOKEN", "在10秒内,攻击汲取巨额生命。吸血值随等级上涨。", "zh-CN");
            LanguageAPI.Add("MASSIVELEECH_DESCRIPTION_TOKEN", "10秒内,每次攻击<style=cIsHealing>回复10点生命值</style>。人物每提升一级,就额外获得<style=cIsHealing>1点生命值</style>。", "zh-CN");
            LanguageAPI.Add("MASSIVELEECH_LORE_TOKEN", @"- 邮寄方式:易挥发
- 订单详细信息:在HYPERION-5的水池中发现了巨型水蛭。 它与地球上的对应物非常相似,但它似乎也有牙齿,可以吃肉和虹吸血。已经发现他们可以按比例放大,甚至可以达到狗的大小。 像普通的水蛭一样,这也具有明显的医学含义。 您只需要格外小心。
", "zh-CN");

            EquipmentDef LeechEquipmentDef = new EquipmentDef
            {
                name             = "MASSIVELEECH_NAME_TOKEN",
                cooldown         = 45f,
                pickupModelPath  = PrefabPath,
                pickupIconPath   = IconPath,
                nameToken        = "MASSIVELEECH_NAME_TOKEN",
                pickupToken      = "MASSIVELEECH_PICKUP_TOKEN",
                descriptionToken = "MASSIVELEECH_DESCRIPTION_TOKEN",
                loreToken        = "MASSIVELEECH_LORE_TOKEN",
                canDrop          = true,
                enigmaCompatible = true
            };

            ItemDisplayRule[] LeechDisplayRules = null;
            CustomEquipment   LeechEquipment    = new CustomEquipment(LeechEquipmentDef, LeechDisplayRules);

            MassiveLeechIndex = ItemAPI.Add(LeechEquipment);
        }
Esempio n. 4
0
        public static CustomElite TestElite()
        {
            LoadAssets();

            var eliteDef = new EliteDef
            {
                modifierToken = "Cloaky",
                color         = new Color32(255, 105, 180, 255)
            };
            var equipDef = new EquipmentDef
            {
                cooldown         = 10f,
                pickupModelPath  = "",
                pickupIconPath   = "",
                nameToken        = "Cloaky",
                pickupToken      = "Cloaky",
                descriptionToken = "Cloaky",
                canDrop          = false,
                enigmaCompatible = false
            };
            var buffDef = new BuffDef
            {
                buffColor = eliteDef.color,
                canStack  = false
            };

            var equip = new CustomEquipment(equipDef, _prefab, _icon, _itemDisplayRules);
            var buff  = new CustomBuff("Affix_Cloaky", buffDef, null);
            var elite = new CustomElite("Cloaky", eliteDef, equip, buff, 1);

            return(elite);
        }
Esempio n. 5
0
        public JestersDice()
        {
            _rng = new Xoroshiro128Plus((ulong)DateTime.Now.Ticks);

            var equipDef = new EquipmentDef
            {
                cooldown         = 30f,
                pickupModelPath  = UmbrellaAssets.PrefabJestersDice,
                pickupIconPath   = UmbrellaAssets.IconJestersDice,
                pickupToken      = "Jester's Dice",
                nameToken        = EquipNames.JestersDice,
                descriptionToken = "Jester's Dice",
                canDrop          = true,
                enigmaCompatible = true,
                isLunar          = true
            };

            var prefab = UmbrellaAssets.JestersDicePrefab;
            var rule   = new ItemDisplayRule
            {
                ruleType       = ItemDisplayRuleType.ParentedPrefab,
                followerPrefab = prefab,
                childName      = "Chest",
                localScale     = new Vector3(0.15f, 0.15f, 0.15f),
                localAngles    = new Vector3(0f, 180f, 0f),
                localPos       = new Vector3(-0.35f, -0.1f, 0f)
            };

            var equip = new CustomEquipment(equipDef, new[] { rule });

            EquipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip);
        }
        private bool onSaveClothingClicked(CustomizerUIEvents.ConfirmSaveClickedEvent evt)
        {
            bool flag = false;

            try
            {
                itemModel.CustomEquipmentModel = EquipmentNetworkUtils.GetModelFromCustomizerChildList(customizerChildren, currentTemplateDefition, decalDefinitionIds);
                flag = true;
            }
            catch (Exception ex)
            {
                Log.LogException(this, ex);
            }
            if (flag)
            {
                serviceEventChannel.AddListener <InventoryServiceEvents.EquipmentCreated>(onEquipmentCreated);
                serviceEventChannel.AddListener <InventoryServiceErrors.EquipmentCreationError>(onEquipmentCreationError);
                CustomEquipment equipmentRequest = CustomEquipmentResponseAdaptor.ConvertCustomEquipmentToRequest(itemModel.CustomEquipmentModel);
                Service.Get <INetworkServicesManager>().InventoryService.CreateCustomEquipment(equipmentRequest);
                logItemCreatedAnalytics();
            }
            else
            {
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.SaveClothingItemError));
            }
            return(false);
        }
        private bool onSubmitCatalogChallengeItemClicked(CustomizerUIEvents.ConfirmSubmitClickedEvent evt)
        {
            bool flag = false;

            try
            {
                itemModel.CustomEquipmentModel = EquipmentNetworkUtils.GetModelFromCustomizerChildList(customizerChildren, currentTemplateDefition, decalDefinitionIds);
                flag = true;
            }
            catch (Exception ex)
            {
                Log.LogException(this, ex);
            }
            if (flag)
            {
                CustomEquipment equipment             = CustomEquipmentResponseAdaptor.ConvertCustomEquipmentToRequest(itemModel.CustomEquipmentModel);
                long            activeThemeScheduleId = Service.Get <CatalogServiceProxy>().GetActiveThemeScheduleId();
                Service.Get <INetworkServicesManager>().CatalogService.SubmitCatalogThemeItem(activeThemeScheduleId, equipment);
                CustomizationContext.EventBus.DispatchEvent(new CustomizerUIEvents.SubmitClothingItemStart(itemModel.CustomEquipmentModel));
            }
            else
            {
                CustomizationContext.EventBus.DispatchEvent(default(CustomizerUIEvents.SubmitClothingItemError));
            }
            return(false);
        }
Esempio n. 8
0
        public BulletTimer()
        {
            var equipDef = new EquipmentDef
            {
                cooldown         = 40f,
                pickupModelPath  = UmbrellaAssets.PrefabBulletTimer,
                pickupIconPath   = UmbrellaAssets.IconBulletTimer,
                nameToken        = EquipNames.BulletTimer,
                descriptionToken = "Bullet Timer",
                pickupToken      = "Bullet Timer",
                canDrop          = true,
                enigmaCompatible = true
            };

            var rule = new ItemDisplayRule
            {
                ruleType       = ItemDisplayRuleType.ParentedPrefab,
                followerPrefab = UmbrellaAssets.BulletTimerPrefab,
                childName      = "Chest",
                localScale     = new Vector3(0.15f, 0.15f, 0.15f),
                localAngles    = new Vector3(0f, 180f, 0f),
                localPos       = new Vector3(-0.35f, -0.1f, 0f)
            };

            var equip = new CustomEquipment(equipDef, new[] { rule });

            EquipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip);

            IL.RoR2.Projectile.ProjectileManager.FireProjectileServer += ProjectileManagerOnFireProjectileServer;
            _startTime = float.NaN;
        }
    protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
    {
        CustomEquipmentCollection customEquipmentCollection = offlineDatabase.Read <CustomEquipmentCollection>();

        ClubPenguin.Net.Offline.PlayerOutfitDetails value = default(ClubPenguin.Net.Offline.PlayerOutfitDetails);
        value.Init();
        long[] parts = RequestBody.parts;
        foreach (long num in parts)
        {
            foreach (CustomEquipment item in customEquipmentCollection.Equipment)
            {
                CustomEquipment current = item;
                if (current.equipmentId == num)
                {
                    value.Parts.Add(current);
                    break;
                }
            }
        }
        offlineDatabase.Write(value);
        ResponseBody = new SignedResponse <ClubPenguin.Net.Domain.PlayerOutfitDetails>
        {
            Data = new ClubPenguin.Net.Domain.PlayerOutfitDetails
            {
                parts = value.Parts.ToArray()
            }
        };
    }
Esempio n. 10
0
        private static void RegisterEquipment()
        {
            EquipmentDef equipmentDef = new EquipmentDef
            {
                name             = "TempestuousRage",
                nameToken        = "LUNAR_AFFIX_NAME",
                pickupToken      = "LUNAR_AFFIX_PICK",
                descriptionToken = "LUNAR_AFFIX_DESC",
                loreToken        = "LUNAR_AFFIX_LORE",
                isBoss           = false,
                isLunar          = true,
                enigmaCompatible = false,
                canDrop          = true,
                colorIndex       = ColorCatalog.ColorIndex.LunarItem,
                cooldown         = 120f,
                pickupIconPath   = "@AffixGen:Assets/AffixGen/AffixLunar.png",
                pickupModelPath  = "@AffixGen:Assets/AffixGen/LunarAffix.prefab"
            };

            ItemDisplayRuleDict ruleDict = new ItemDisplayRuleDict();

            CustomEquipment equipment = new CustomEquipment(equipmentDef, ruleDict);

            index = ItemAPI.Add(equipment);
        }
Esempio n. 11
0
        public void SubmitCatalogThemeItem(long scheduledThemeChallengeId, CustomEquipment equipment)
        {
            APICall <ItemSubmissionOperation> aPICall = clubPenguinClient.CatalogApi.ItemSubmission(scheduledThemeChallengeId, equipment);

            aPICall.OnResponse += onSubmitItemResponse;
            aPICall.OnError    += onSubmitItemError;
            aPICall.Execute();
        }
Esempio n. 12
0
 public ItemSubmissionOperation(long scheduledThemeChallengeId, CustomEquipment equipment)
 {
     SubmissionRequest = default(ItemSubmissionRequest);
     SubmissionRequest.scheduledThemeChallengeId = scheduledThemeChallengeId;
     SubmissionRequest.equipment = default(CatalogSubmissionEquipment);
     SubmissionRequest.equipment.definitionId = equipment.definitionId;
     SubmissionRequest.equipment.parts        = equipment.parts;
 }
Esempio n. 13
0
        public StormElitesManager()
        {
            var eliteDef = new EliteDef
            {
                modifierToken = EliteName,
                color         = new Color32(162, 179, 241, 255)
            };
            var equipDef = new EquipmentDef
            {
                cooldown         = 10f,
                pickupModelPath  = "",
                pickupIconPath   = HailstormAssets.IconStormElite,
                nameToken        = EquipName,
                pickupToken      = "Storm Bringer",
                descriptionToken = "Storm Bringer",
                canDrop          = false,
                enigmaCompatible = false
            };
            var buffDef = new BuffDef
            {
                buffColor = eliteDef.color,
                iconPath  = HailstormAssets.IconStormElite,
                canStack  = false
            };

            var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]);
            var buff  = new CustomBuff(BuffName, buffDef);
            var elite = new CustomElite(EliteName, eliteDef, equip, buff, 1);

            EliteIndex = (EliteIndex)ItemAPI.AddCustomElite(elite);
            BuffIndex  = (BuffIndex)ItemAPI.AddCustomBuff(buff);
            EquipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip);
            eliteDef.eliteEquipmentIndex = EquipIndex;
            equipDef.passiveBuff         = BuffIndex;
            buffDef.eliteIndex           = EliteIndex;

            //Storm elites are immune to twisters
            TwisterProjectileController.ImmunityBuff = BuffIndex;
            TornadoLauncher.StormBuff = BuffIndex;

            //Storm elites are tier 2 elites, on the same order as malachites
            //They're a bit less tanky than malachites, but even more dangerous in terms of damage
            var card = new EliteAffixCard
            {
                spawnWeight      = 1.0f,
                costMultiplier   = 30.0f,
                damageBoostCoeff = 6.0f,
                healthBoostCoeff = 20.0f,
                eliteType        = EliteIndex,
                isAvailable      = () => Run.instance.loopClearCount > 0,
                onSpawned        = OnSpawned
            };

            //Register the card for spawning if ESO is enabled
            EsoLib.Cards.Add(card);
            Card = card;
        }
Esempio n. 14
0
        public void CreateCustomEquipment(CustomEquipment equipmentRequest)
        {
            APICall <CreateCustomEquipmentOperation> aPICall = clubPenguinClient.InventoryApi.CreateCustomEquipment(equipmentRequest);

            aPICall.OnResponse += equipmentCreated;
            aPICall.OnError    += handleCPResponseError;
            aPICall.OnError    += onEquipmentCreateError;
            aPICall.Execute();
        }
Esempio n. 15
0
        public BarrierElitesManager()
        {
            var eliteDef = new EliteDef
            {
                modifierToken = BarrierElitesManager.EliteName,
                color         = new Color32(162, 179, 241, 255)
            };
            var equipDef = new EquipmentDef
            {
                cooldown         = 10f,
                pickupModelPath  = "",
                pickupIconPath   = HailstormAssets.IconBarrierElite,
                nameToken        = EquipName,
                pickupToken      = "Shield-Bearer",
                descriptionToken = "Shield-Bearer",
                canDrop          = false,
                enigmaCompatible = false
            };
            var buffDef = new BuffDef
            {
                buffColor = eliteDef.color,
                iconPath  = HailstormAssets.IconBarrierElite,
                canStack  = false
            };

            var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]);
            var buff  = new CustomBuff(BuffName, buffDef);
            var elite = new CustomElite(EliteName, eliteDef, equip, buff, 1);

            _eliteIndex = (EliteIndex)ItemAPI.AddCustomElite(elite);
            _buffIndex  = (BuffIndex)ItemAPI.AddCustomBuff(buff);
            _equipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip);
            eliteDef.eliteEquipmentIndex = _equipIndex;
            equipDef.passiveBuff         = _buffIndex;
            buffDef.eliteIndex           = _eliteIndex;

            //Barrier elites are a bit more uncommon than regular tier 1 elites
            //They're also a bit tankier than usual, but not more damaging
            var card = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 10.0f,
                damageBoostCoeff = 1.0f,
                healthBoostCoeff = 10.0f,
                eliteType        = _eliteIndex
            };

            //Register the card for spawning if ESO is enabled
            EsoLib.Cards.Add(card);
            Card = card;
        }
Esempio n. 16
0
    private void createEquipment(long equipmentId, OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
    {
        CustomEquipmentCollection value           = offlineDatabase.Read <CustomEquipmentCollection>();
        CustomEquipment           customEquipment = default(CustomEquipment);

        customEquipment.dateTimeCreated = DateTime.UtcNow.GetTimeInMilliseconds();
        customEquipment.definitionId    = CustomEquipmentRequest.definitionId;
        customEquipment.equipmentId     = equipmentId;
        customEquipment.parts           = CustomEquipmentRequest.parts;
        CustomEquipment item = customEquipment;

        value.Equipment.Add(item);
        offlineDefinitions.SubtractEquipmentCost(item.definitionId);
        offlineDatabase.Write(value);
    }
    protected override void SetOfflineData(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions)
    {
        CustomEquipmentCollection value = offlineDatabase.Read <CustomEquipmentCollection>();

        foreach (CustomEquipment item in value.Equipment)
        {
            CustomEquipment current = item;
            if (current.equipmentId == EquipmentId)
            {
                value.Equipment.Remove(current);
                break;
            }
        }
        offlineDatabase.Write(value);
    }
Esempio n. 18
0
 public static bool IsCustomEquipmentOwned(CustomEquipment equipment)
 {
     if (Service.Get <CPDataEntityCollection>().TryGetComponent <InventoryData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle, out var component) && component.Inventory != null)
     {
         Dictionary <long, InventoryIconModel <DCustomEquipment> > .Enumerator enumerator = component.Inventory.GetEnumerator();
         while (enumerator.MoveNext())
         {
             InventoryIconModel <DCustomEquipment> value = enumerator.Current.Value;
             if (IsEquipmentEqual(value.Data, equipment))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
 public static bool TryGetDCustomEquipment(CustomEquipment equipment, out DCustomEquipment equipmentData)
 {
     if (Service.Get <CPDataEntityCollection>().TryGetComponent(Service.Get <CPDataEntityCollection>().LocalPlayerHandle, out InventoryData component) && component.Inventory != null)
     {
         Dictionary <long, InventoryIconModel <DCustomEquipment> > .Enumerator enumerator = component.Inventory.GetEnumerator();
         while (enumerator.MoveNext())
         {
             InventoryIconModel <DCustomEquipment> value = enumerator.Current.Value;
             if (IsEquipmentEqual(value.Data, equipment))
             {
                 equipmentData = value.Data;
                 return(true);
             }
         }
     }
     equipmentData = default(DCustomEquipment);
     return(false);
 }
Esempio n. 20
0
 public static bool IsEquipmentEqual(DCustomEquipment equipment1, CustomEquipment equipment2)
 {
     if (equipment1.DefinitionId != equipment2.definitionId)
     {
         return(false);
     }
     if (equipment1.Parts.Length != equipment2.parts.Length)
     {
         return(false);
     }
     for (int i = 0; i < equipment1.Parts.Length; i++)
     {
         if (!IsEquipmentPartEqual(equipment1.Parts[i], equipment2.parts[i]))
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 21
0
        public Lumpkin()
        {
            {
                LanguageAPI.Add("LUMPKIN_ITEM_LORE_TOKEN", "\"Lumpkin, one of the many commanders in the War of 2019, possessed a scream that could deafen his oppenents, and allies. It was unknown how he could scream so loudly, until he was killed in the final battle of WW19 and had his lungs ripped from his chest. \r\n\r\nHis lungs, pictured above, allowed him to scream loudly without injuring himself.\"\r\n\r\n-Exhibit at The National WW19 Museum");
                LanguageAPI.Add("LUMPKIN_ITEM_TOKEN", "The Lumpkin");
                LanguageAPI.Add("LUMPKIN_ITEM_DESCRIPTION_TOKEN", "Release a Brazilian scream, stunning enemies within the immediate vicinity.");
                LanguageAPI.Add("LUMPKIN_ITEM_PICKUP_TOKEN", "And his screams were Brazilian...");
                //yo
                var equipDef = new EquipmentDef
                {
                    cooldown         = 45,
                    pickupModelPath  = "Prefabs/PickupModels/PickupMystery",
                    pickupIconPath   = "Textures/MiscIcons/texMysteryIcon",
                    pickupToken      = "LUMPKIN_ITEM_PICKUP_TOKEN",
                    nameToken        = "LUMPKIN_ITEM_TOKEN",
                    descriptionToken = "LUMPKIN_ITEM_DESCRIPTION_TOKEN",
                    canDrop          = true,
                    isLunar          = false,
                    enigmaCompatible = true,
                    name             = "Lumpkin",
                    loreToken        = "LUMPKIN_ITEM_LORE_TOKEN",
                };

                var prefab = Resources.Load <GameObject>("Prefabs/PickupModels/PickupMystery");

                var rule = new ItemDisplayRule
                {
                    ruleType       = ItemDisplayRuleType.ParentedPrefab,
                    followerPrefab = prefab,
                    childName      = "Chest",
                    localScale     = new Vector3(0f, 0, 0f),
                    localAngles    = new Vector3(0f, 0f, 0f),
                    localPos       = new Vector3(0, 0f, 0f)
                };

                var equip = new CustomEquipment(equipDef, new[] { rule });
                EquipIndex = ItemAPI.Add(equip);
            };
        }
Esempio n. 22
0
        private static void RegisterEquipment()
        {
            EquipmentDef equipmentDef = new EquipmentDef
            {
                name             = "UntappedPotential",
                nameToken        = "BASE_AFFIX_NAME",
                pickupToken      = "BASE_AFFIX_PICK",
                descriptionToken = "BASE_AFFIX_DESC",
                loreToken        = "BASE_AFFIX_LORE",
                isBoss           = false,
                isLunar          = false,
                enigmaCompatible = false,
                canDrop          = true,
                cooldown         = 60f,
                pickupIconPath   = "@AffixGen:Assets/AffixGen/AffixBase.png",
                pickupModelPath  = "@AffixGen:Assets/AffixGen/BaseAffix.prefab"
            };

            ItemDisplayRuleDict ruleDict = new ItemDisplayRuleDict();

            CustomEquipment equipment = new CustomEquipment(equipmentDef, ruleDict);

            index = ItemAPI.Add(equipment);
        }
Esempio n. 23
0
        public Equipment()
        {
            {
                LanguageAPI.Add("HERETICSBOX_ITEM_TOKEN", "Heretic's box");
                LanguageAPI.Add("HERETICSBOX_ITEM_DESCRIPTION_TOKEN", "its dead");
                LanguageAPI.Add("HERETICSBOX_ITEM_PICKUP_TOKEN", "The heretic's box...?");
                var equipDef = new EquipmentDef
                {
                    cooldown         = 145,
                    pickupModelPath  = "Prefabs/PickupModels/PickupMystery",
                    pickupIconPath   = "Textures/MiscIcons/texMysteryIcon",
                    pickupToken      = "HERETICSBOX_ITEM_PICKUP_TOKEN",
                    nameToken        = "HERETICSBOX_ITEM_TOKEN",
                    descriptionToken = "HERETICSBOX_ITEM_DESCRIPTION_TOKEN",
                    canDrop          = true,
                    enigmaCompatible = true,
                    isLunar          = true,
                    name             = "HereticBox",
                };

                var prefab = Resources.Load <GameObject>("Prefabs/PickupModels/PickupMystery");

                var rule = new ItemDisplayRule
                {
                    ruleType       = ItemDisplayRuleType.ParentedPrefab,
                    followerPrefab = prefab,
                    childName      = "Chest",
                    localScale     = new Vector3(0f, 0, 0f),
                    localAngles    = new Vector3(0f, 0f, 0f),
                    localPos       = new Vector3(0, 0f, 0f)
                };

                var equip = new CustomEquipment(equipDef, new[] { rule });
                EquipIndex = ItemAPI.Add(equip);
            };
        }
Esempio n. 24
0
        private static void RegisterEquipment()
        {
            EquipmentDef equipmentDef = new EquipmentDef
            {
                name             = "AffixGenNullEquip",
                nameToken        = "NULL_AFFIX_NAME",
                pickupToken      = "NULL_AFFIX_PICK",
                descriptionToken = "NULL_AFFIX_DESC",
                loreToken        = "NULL_AFFIX_LORE",
                isBoss           = false,
                isLunar          = false,
                enigmaCompatible = false,
                canDrop          = false,
                cooldown         = 60f,
                pickupIconPath   = null,
                pickupModelPath  = null
            };

            ItemDisplayRuleDict ruleDict = new ItemDisplayRuleDict();

            CustomEquipment equipment = new CustomEquipment(equipmentDef, ruleDict);

            index = ItemAPI.Add(equipment);
        }
Esempio n. 25
0
        public static bool Init()
        {
            On.RoR2.GlobalEventManager.OnCharacterDeath += GlobalEventManager_OnCharacterDeath;

            var equipDef = new EquipmentDef
            {
                name             = EquipName,
                cooldown         = 10f,
                pickupModelPath  = "",
                pickupIconPath   = "",
                nameToken        = EquipName,
                pickupToken      = "Pickup_Tarborne",
                descriptionToken = "Description_Tarborne",
                canDrop          = false,
                enigmaCompatible = false
            };

            On.RoR2.CharacterBody.OnEquipmentLost   += CharacterBody_OnEquipmentLost;
            On.RoR2.CharacterBody.OnEquipmentGained += CharacterBody_OnEquipmentGained;
            var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]);

            var buffDef = new BuffDef
            {
                name      = BuffName,
                buffColor = new Color32(41, 41, 41, 255),
                iconPath  = "",
                canStack  = false
            };
            var buff = new CustomBuff(buffDef);

            var eliteDef = new EliteDef
            {
                name                = EliteName,
                modifierToken       = "ELITE_MODIFIER_TARBORNE",
                color               = buffDef.buffColor,
                eliteEquipmentIndex = _equipIndex
            };

            var elite = new CustomElite(eliteDef, 1);

            _eliteIndex = EliteAPI.Add(elite);
            _buffIndex  = BuffAPI.Add(buff);
            _equipIndex = ItemAPI.Add(equip);
            eliteDef.eliteEquipmentIndex = _equipIndex;
            equipDef.passiveBuff         = _buffIndex;
            buffDef.eliteIndex           = _eliteIndex;


            var card = new EliteAffixCard
            {
                spawnWeight      = 1f,
                costMultiplier   = 6f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 4.0f,
                eliteOnlyScaling = 1f,
                eliteType        = _eliteIndex,
                onSpawned        = OnSpawned,
                isAvailable      = new Func <bool>(() => true)
            };

            //Register the card for spawning if ESO is enabled
            EsoLib.Cards.Add(card);
            Card = card;

            //Description of elite in UI when boss
            LanguageAPI.Add(eliteDef.modifierToken, "Tarborne {0}");
            LanguageAPI.Add(equipDef.pickupToken, "Dunestrider's Dominion");
            LanguageAPI.Add(equipDef.descriptionToken, "Become an aspect of Tar");

            return(true);
        }
    public void AddReward(Reward reward, CPResponse responseBody)
    {
        ClubPenguin.Net.Offline.PlayerAssets value = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>();
        ProgressionService progressionService      = Service.Get <ProgressionService>();

        if (reward.TryGetValue(out CoinReward rewardable))
        {
            value.Assets.coins += rewardable.Coins;
        }
        if (reward.TryGetValue(out MascotXPReward rewardable2))
        {
            foreach (KeyValuePair <string, int> item in rewardable2.XP)
            {
                if (value.Assets.mascotXP.ContainsKey(item.Key))
                {
                    value.Assets.mascotXP[item.Key] = progressionService.addXp(item.Key, item.Value, value.Assets.mascotXP[item.Key]);
                }
                else
                {
                    value.Assets.mascotXP[item.Key] = progressionService.addXp(item.Key, item.Value, 0L);
                }
            }
            int level = progressionService.Level;
            int num   = 0;
            foreach (long value5 in value.Assets.mascotXP.Values)
            {
                num += ProgressionService.GetMascotLevelFromXP(value5);
            }
            if (num > level)
            {
                if (responseBody.wsEvents == null)
                {
                    responseBody.wsEvents = new List <SignedResponse <WebServiceEvent> >();
                }
                responseBody.wsEvents.Add(new SignedResponse <WebServiceEvent>
                {
                    Data = new WebServiceEvent
                    {
                        details = num,
                        type    = 3
                    }
                });
            }
        }
        if (reward.TryGetValue(out CollectibleReward rewardable3))
        {
            foreach (KeyValuePair <string, int> collectible in rewardable3.Collectibles)
            {
                if (value.Assets.collectibleCurrencies.ContainsKey(collectible.Key))
                {
                    Dictionary <string, int> collectibleCurrencies;
                    string key;
                    (collectibleCurrencies = value.Assets.collectibleCurrencies)[key = collectible.Key] = collectibleCurrencies[key] + collectible.Value;
                }
                else
                {
                    value.Assets.collectibleCurrencies[collectible.Key] = collectible.Value;
                }
            }
        }
        if (reward.TryGetValue(out DecalReward rewardable4))
        {
            value.Assets.decals.AddRange(rewardable4.Decals);
        }
        if (reward.TryGetValue(out FabricReward rewardable5))
        {
            value.Assets.fabrics.AddRange(rewardable5.Fabrics);
        }
        if (reward.TryGetValue(out EmoteReward rewardable6))
        {
            value.Assets.emotePacks.AddRange(rewardable6.Emotes);
        }
        if (reward.TryGetValue(out EquipmentTemplateReward rewardable7))
        {
            value.Assets.equipmentTemplates.AddRange(rewardable7.EquipmentTemplates);
        }
        if (reward.TryGetValue(out EquipmentInstanceReward rewardable8))
        {
            System.Random             random = new System.Random();
            byte[]                    array  = new byte[8];
            CustomEquipmentCollection value2 = offlineDatabase.Read <CustomEquipmentCollection>();
            foreach (CustomEquipment equipmentInstance in rewardable8.EquipmentInstances)
            {
                CustomEquipment current3 = equipmentInstance;
                random.NextBytes(array);
                value2.Equipment.Add(new CustomEquipment
                {
                    dateTimeCreated = DateTime.UtcNow.GetTimeInMilliseconds(),
                    definitionId    = current3.definitionId,
                    equipmentId     = BitConverter.ToInt64(array, 0),
                    parts           = current3.parts
                });
            }
            offlineDatabase.Write(value2);
        }
        if (reward.TryGetValue(out LotReward rewardable9))
        {
            value.Assets.lots.AddRange(rewardable9.Lots);
        }
        if (reward.TryGetValue(out DecorationInstanceReward rewardable10))
        {
            DecorationInventoryEntity value3 = offlineDatabase.Read <DecorationInventoryEntity>();
            foreach (KeyValuePair <int, int> decoration in rewardable10.Decorations)
            {
                DecorationId decorationId = new DecorationId(decoration.Key, DecorationType.Decoration);
                if (value3.Inventory.ContainsKey(decorationId))
                {
                    DecorationInventoryEntity.InventoryWrapper inventory;
                    DecorationId id;
                    (inventory = value3.Inventory)[id = decorationId] = inventory[id] + decoration.Value;
                }
                else
                {
                    value3.Inventory[decorationId] = decoration.Value;
                }
            }
            offlineDatabase.Write(value3);
        }
        if (reward.TryGetValue(out StructureInstanceReward rewardable11))
        {
            DecorationInventoryEntity value3 = offlineDatabase.Read <DecorationInventoryEntity>();
            foreach (KeyValuePair <int, int> decoration2 in rewardable11.Decorations)
            {
                DecorationId decorationId = new DecorationId(decoration2.Key, DecorationType.Structure);
                if (value3.Inventory.ContainsKey(decorationId))
                {
                    DecorationInventoryEntity.InventoryWrapper inventory;
                    DecorationId id;
                    (inventory = value3.Inventory)[id = decorationId] = inventory[id] + decoration2.Value;
                }
                else
                {
                    value3.Inventory[decorationId] = decoration2.Value;
                }
            }
            offlineDatabase.Write(value3);
        }
        if (reward.TryGetValue(out DecorationReward rewardable12))
        {
            value.Assets.decorations.AddRange(rewardable12.Decorations);
        }
        if (reward.TryGetValue(out StructureReward rewardable13))
        {
            value.Assets.structures.AddRange(rewardable13.Structures);
        }
        if (reward.TryGetValue(out MusicTrackReward rewardable14))
        {
            value.Assets.musicTracks.AddRange(rewardable14.MusicTracks);
        }
        if (reward.TryGetValue(out LightingReward rewardable15))
        {
            value.Assets.lighting.AddRange(rewardable15.Lighting);
        }
        if (reward.TryGetValue(out DurableReward rewardable16))
        {
            value.Assets.durables.AddRange(rewardable16.Durables);
        }
        if (reward.TryGetValue(out IglooSlotsReward rewardable17))
        {
            value.IglooSlots += rewardable17.IglooSlots;
        }
        if (reward.TryGetValue(out ConsumableReward rewardable18))
        {
            value.Assets.partySupplies.AddRange(rewardable18.Consumable);
        }
        if (reward.TryGetValue(out TubeReward rewardable19))
        {
            value.Assets.tubes.AddRange(rewardable19.Tubes);
        }
        if (reward.TryGetValue(out ConsumableInstanceReward rewardable20))
        {
            ClubPenguin.Net.Offline.ConsumableInventory value4 = offlineDatabase.Read <ClubPenguin.Net.Offline.ConsumableInventory>();
            foreach (KeyValuePair <string, int> consumable in rewardable20.Consumables)
            {
                if (value4.Inventory.ContainsKey(consumable.Key))
                {
                    value4.Inventory[consumable.Key].itemCount += consumable.Value;
                }
                else
                {
                    value4.Inventory[consumable.Key] = new InventoryItemStock
                    {
                        itemCount = consumable.Value
                    };
                }
                value4.Inventory[consumable.Key].lastPurchaseTimestamp = DateTime.UtcNow.GetTimeInMilliseconds();
            }
            offlineDatabase.Write(value4);
        }
        offlineDatabase.Write(value);
    }
Esempio n. 27
0
    public static CustomEquipment ConvertCustomEquipmentToRequest(DCustomEquipment equipment)
    {
        CustomEquipment result = default(CustomEquipment);
        Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
        bool flag = false;

        foreach (TemplateDefinition value in dictionary.Values)
        {
            if (value.AssetName.Equals(equipment.Name))
            {
                result.definitionId = value.Id;
                flag = true;
                break;
            }
        }
        if (!flag)
        {
            Log.LogFatalFormatted(typeof(CustomEquipmentResponseAdaptor), "No known equipment template definition for asset named {0}", equipment.Name);
        }
        CustomEquipmentPart[] array = new CustomEquipmentPart[equipment.Parts.Length];
        for (int i = 0; i < equipment.Parts.Length; i++)
        {
            CustomEquipmentPart customEquipmentPart = default(CustomEquipmentPart);
            customEquipmentPart.slotIndex = equipment.Parts[i].SlotIndex;
            if (equipment.Parts[i].Decals != null)
            {
                Dictionary <int, FabricDefinition> dictionary2 = Service.Get <GameData>().Get <Dictionary <int, FabricDefinition> >();
                Dictionary <int, DecalDefinition>  dictionary3 = Service.Get <GameData>().Get <Dictionary <int, DecalDefinition> >();
                CustomEquipmentCustomization[]     array2      = new CustomEquipmentCustomization[equipment.Parts[i].Decals.Length];
                for (int j = 0; j < equipment.Parts[i].Decals.Length; j++)
                {
                    DCustomEquipmentDecal        dCustomEquipmentDecal        = equipment.Parts[i].Decals[j];
                    CustomEquipmentCustomization customEquipmentCustomization = default(CustomEquipmentCustomization);
                    customEquipmentCustomization.index    = dCustomEquipmentDecal.Index;
                    customEquipmentCustomization.scale    = dCustomEquipmentDecal.Scale;
                    customEquipmentCustomization.rotation = dCustomEquipmentDecal.Rotation;
                    customEquipmentCustomization.uoffset  = dCustomEquipmentDecal.Uoffset;
                    customEquipmentCustomization.voffset  = dCustomEquipmentDecal.Voffset;
                    flag = false;
                    if (dCustomEquipmentDecal.Type == EquipmentDecalType.FABRIC)
                    {
                        foreach (FabricDefinition value2 in dictionary2.Values)
                        {
                            if (value2.AssetName.Equals(dCustomEquipmentDecal.TextureName))
                            {
                                customEquipmentCustomization.type         = EquipmentCustomizationType.FABRIC;
                                customEquipmentCustomization.definitionId = value2.Id;
                                flag = true;
                                break;
                            }
                        }
                    }
                    else if (dCustomEquipmentDecal.Type == EquipmentDecalType.DECAL)
                    {
                        foreach (DecalDefinition value3 in dictionary3.Values)
                        {
                            if (value3.AssetName.Equals(dCustomEquipmentDecal.TextureName))
                            {
                                customEquipmentCustomization.type         = EquipmentCustomizationType.DECAL;
                                customEquipmentCustomization.definitionId = value3.Id;
                                customEquipmentCustomization.repeat       = dCustomEquipmentDecal.Repeat;
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (!flag)
                    {
                        Log.LogFatalFormatted(typeof(CustomEquipmentResponseAdaptor), "No known customization definition for texture {0}", dCustomEquipmentDecal.TextureName);
                    }
                    array2[j] = customEquipmentCustomization;
                }
                customEquipmentPart.customizations = array2;
            }
            array[i] = customEquipmentPart;
        }
        result.parts = array;
        return(result);
    }
Esempio n. 28
0
    public static DCustomEquipment ConvertResponseToCustomEquipment(CustomEquipment data)
    {
        Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
        DCustomEquipment result = default(DCustomEquipment);

        result.Id              = data.equipmentId;
        result.DefinitionId    = data.definitionId;
        result.DateTimeCreated = data.dateTimeCreated;
        if (!dictionary.ContainsKey(data.definitionId))
        {
            Log.LogErrorFormatted(typeof(CustomEquipmentResponseAdaptor), "No known equipment template definition for id {0}", data.definitionId);
            throw new KeyNotFoundException();
        }
        result.Name = dictionary[data.definitionId].AssetName;
        if (data.parts != null)
        {
            DCustomEquipmentPart[] array = new DCustomEquipmentPart[data.parts.Length];
            for (int i = 0; i < data.parts.Length; i++)
            {
                DCustomEquipmentPart dCustomEquipmentPart = default(DCustomEquipmentPart);
                dCustomEquipmentPart.SlotIndex = data.parts[i].slotIndex;
                if (data.parts[i].customizations != null)
                {
                    Dictionary <int, FabricDefinition> dictionary2 = Service.Get <GameData>().Get <Dictionary <int, FabricDefinition> >();
                    Dictionary <int, DecalDefinition>  dictionary3 = Service.Get <GameData>().Get <Dictionary <int, DecalDefinition> >();
                    DCustomEquipmentDecal[]            array2      = new DCustomEquipmentDecal[data.parts[i].customizations.Length];
                    for (int j = 0; j < array2.Length; j++)
                    {
                        CustomEquipmentCustomization customEquipmentCustomization = data.parts[i].customizations[j];
                        DCustomEquipmentDecal        dCustomEquipmentDecal        = default(DCustomEquipmentDecal);
                        dCustomEquipmentDecal.DefinitionId = customEquipmentCustomization.definitionId;
                        dCustomEquipmentDecal.Index        = customEquipmentCustomization.index;
                        dCustomEquipmentDecal.Scale        = customEquipmentCustomization.scale;
                        dCustomEquipmentDecal.Rotation     = customEquipmentCustomization.rotation;
                        dCustomEquipmentDecal.Uoffset      = customEquipmentCustomization.uoffset;
                        dCustomEquipmentDecal.Voffset      = customEquipmentCustomization.voffset;
                        switch (customEquipmentCustomization.type)
                        {
                        case EquipmentCustomizationType.DECAL:
                            if (!dictionary3.ContainsKey(customEquipmentCustomization.definitionId))
                            {
                                Log.LogErrorFormatted(typeof(CustomEquipmentResponseAdaptor), "No known decal template definition for id {0}", customEquipmentCustomization.definitionId);
                                continue;
                            }
                            dCustomEquipmentDecal.TextureName = dictionary3[customEquipmentCustomization.definitionId].AssetName;
                            dCustomEquipmentDecal.Repeat      = customEquipmentCustomization.repeat;
                            dCustomEquipmentDecal.Type        = EquipmentDecalType.DECAL;
                            break;

                        case EquipmentCustomizationType.FABRIC:
                            if (!dictionary2.ContainsKey(customEquipmentCustomization.definitionId))
                            {
                                Log.LogErrorFormatted(typeof(CustomEquipmentResponseAdaptor), "No known fabric template definition for id {0}", customEquipmentCustomization.definitionId);
                                continue;
                            }
                            dCustomEquipmentDecal.TextureName = dictionary2[customEquipmentCustomization.definitionId].AssetName;
                            dCustomEquipmentDecal.Type        = EquipmentDecalType.FABRIC;
                            dCustomEquipmentDecal.Repeat      = true;
                            break;
                        }
                        array2[j] = dCustomEquipmentDecal;
                    }
                    dCustomEquipmentPart.Decals = array2;
                }
                else
                {
                    dCustomEquipmentPart.Decals = new DCustomEquipmentDecal[0];
                }
                array[i] = dCustomEquipmentPart;
            }
            result.Parts = array;
        }
        else
        {
            result.Parts = new DCustomEquipmentPart[0];
        }
        return(result);
    }
Esempio n. 29
0
 public CreateCustomEquipmentOperation(CustomEquipment equipment)
 {
     CustomEquipmentRequest = equipment;
 }
Esempio n. 30
0
        public static bool Init()
        {
            On.RoR2.GlobalEventManager.ServerDamageDealt += GlobalEventManager_ServerDamageDealt;

            var equipDef = new EquipmentDef
            {
                name             = EquipName,
                cooldown         = 10f,
                pickupModelPath  = "",
                pickupIconPath   = "",
                nameToken        = EquipName,
                pickupToken      = "Pickup_Blightborne",
                descriptionToken = "Description_Blightborne",
                canDrop          = false,
                enigmaCompatible = false
            };

            var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]);

            var buffDef = new BuffDef
            {
                name      = BuffName,
                buffColor = new Color32(141, 51, 19, 255),
                iconPath  = "",
                canStack  = false
            };
            var buff = new CustomBuff(buffDef);

            var eliteDef = new EliteDef
            {
                name                = EliteName,
                modifierToken       = "ELITE_MODIFIER_BLIGHTBORNE",
                color               = buffDef.buffColor,
                eliteEquipmentIndex = _equipIndex
            };

            var elite = new CustomElite(eliteDef, 1);

            _eliteIndex = EliteAPI.Add(elite);
            _buffIndex  = BuffAPI.Add(buff);
            _equipIndex = ItemAPI.Add(equip);
            eliteDef.eliteEquipmentIndex = _equipIndex;
            equipDef.passiveBuff         = _buffIndex;
            buffDef.eliteIndex           = _eliteIndex;

            On.RoR2.CharacterBody.OnEquipmentLost   += CharacterBody_OnEquipmentLost;
            On.RoR2.CharacterBody.OnEquipmentGained += CharacterBody_OnEquipmentGained;
            var card = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 16f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 8.0f,
                eliteOnlyScaling = 1f,
                eliteType        = _eliteIndex,
                onSpawned        = OnSpawned,
                isAvailable      = new Func <bool>(() => Run.instance.stageClearCount > 3 && Run.instance.selectedDifficulty != DifficultyIndex.Easy)
            };

            //Register the card for spawning if ESO is enabled
            EsoLib.Cards.Add(card);
            Card = card;

            //Description of elite in UI when boss
            LanguageAPI.Add(eliteDef.modifierToken, "Blightborne {0}");
            LanguageAPI.Add(equipDef.pickupToken, "Blight's Embrace");
            LanguageAPI.Add(equipDef.descriptionToken, "Become an aspect of Blight");

            return(true);
        }