// Token: 0x060017D8 RID: 6104 RVA: 0x00067B08 File Offset: 0x00065D08
 private static void PerformDamage(GameObject attacker, GameObject inflictor, float damage, bool isCrit, ProcChainMask procChainMask, float procCoefficient, DamageColorIndex damageColorIndex, DamageType damageType, Vector3 forceVector, float pushAwayForce, List <OverlapAttack.OverlapInfo> hitList)
 {
     for (int i = 0; i < hitList.Count; i++)
     {
         OverlapAttack.OverlapInfo overlapInfo = hitList[i];
         if (overlapInfo.hurtBox)
         {
             HealthComponent healthComponent = overlapInfo.hurtBox.healthComponent;
             if (healthComponent)
             {
                 DamageInfo damageInfo = new DamageInfo();
                 damageInfo.attacker         = attacker;
                 damageInfo.inflictor        = inflictor;
                 damageInfo.force            = forceVector + pushAwayForce * overlapInfo.pushDirection;
                 damageInfo.damage           = damage;
                 damageInfo.crit             = isCrit;
                 damageInfo.position         = overlapInfo.hitPosition;
                 damageInfo.procChainMask    = procChainMask;
                 damageInfo.procCoefficient  = procCoefficient;
                 damageInfo.damageColorIndex = damageColorIndex;
                 damageInfo.damageType       = damageType;
                 damageInfo.ModifyDamageInfo(overlapInfo.hurtBox.damageModifier);
                 healthComponent.TakeDamage(damageInfo);
                 GlobalEventManager.instance.OnHitEnemy(damageInfo, healthComponent.gameObject);
                 GlobalEventManager.instance.OnHitAll(damageInfo, healthComponent.gameObject);
             }
         }
     }
 }
Example #2
0
        private float Voidheart30PercentTimebomb(On.RoR2.HealthComponent.orig_Heal orig, RoR2.HealthComponent self, float amount, RoR2.ProcChainMask procChainMask, bool nonRegen)
        {
            var InventoryCount = GetCount(self.body);

            if (self.body && InventoryCount > 0)
            {
                if (self.combinedHealth <= self.fullCombinedHealth * Mathf.Clamp((voidHeartBaseTickingTimeBombHealthThreshold + (voidHeartAdditionalTickingTimeBombHealthThreshold * InventoryCount - 1)), voidHeartBaseTickingTimeBombHealthThreshold, voidHeartMaxTickingTimeBombHealthThreshold) &&
                    //This check is for the timer to determine time since spawn, at <= 10f it'll only activate after the tenth second
                    self.GetComponent <VoidHeartPrevention>().internalTimer >= 7f)
                {
                    RoR2.DamageInfo damageInfo = new RoR2.DamageInfo();
                    damageInfo.crit             = false;
                    damageInfo.damage           = amount;
                    damageInfo.force            = Vector3.zero;
                    damageInfo.position         = self.transform.position;
                    damageInfo.procChainMask    = procChainMask;
                    damageInfo.procCoefficient  = 0f;
                    damageInfo.damageColorIndex = DamageColorIndex.Default;
                    damageInfo.damageType       = DamageType.Generic;
                    self.TakeDamage(damageInfo);
                    return(orig(self, 0, procChainMask, nonRegen));
                }
            }
            return(orig(self, amount, procChainMask, nonRegen));
        }
        // Token: 0x06000E57 RID: 3671 RVA: 0x00046B08 File Offset: 0x00044D08
        private void DoDamage()
        {
            if (this.pointsList.Count == 0)
            {
                return;
            }
            float   damage = this.damagePerSecond * this.updateInterval;
            Vector3 vector = this.pointsList[this.pointsList.Count - 1].position;
            HashSet <GameObject> hashSet   = new HashSet <GameObject>();
            TeamIndex            teamIndex = TeamIndex.Neutral;

            if (this.owner)
            {
                hashSet.Add(this.owner);
                teamIndex = TeamComponent.GetObjectTeam(this.owner);
            }
            for (int i = this.pointsList.Count - 2; i >= 0; i--)
            {
                Vector3      position  = this.pointsList[i].position;
                Vector3      direction = position - vector;
                RaycastHit[] array     = Physics.SphereCastAll(new Ray(vector, direction), this.radius, direction.magnitude, LayerIndex.entityPrecise.mask, QueryTriggerInteraction.UseGlobal);
                for (int j = 0; j < array.Length; j++)
                {
                    Collider collider = array[j].collider;
                    if (collider.gameObject)
                    {
                        HurtBox component = collider.GetComponent <HurtBox>();
                        if (component)
                        {
                            HealthComponent healthComponent = component.healthComponent;
                            if (healthComponent)
                            {
                                GameObject gameObject = healthComponent.gameObject;
                                if (!hashSet.Contains(gameObject))
                                {
                                    hashSet.Add(gameObject);
                                    if (TeamComponent.GetObjectTeam(gameObject) != teamIndex)
                                    {
                                        healthComponent.TakeDamage(new DamageInfo
                                        {
                                            position         = array[j].point,
                                            attacker         = this.owner,
                                            inflictor        = base.gameObject,
                                            crit             = false,
                                            damage           = damage,
                                            damageColorIndex = DamageColorIndex.Item,
                                            damageType       = DamageType.Generic,
                                            force            = Vector3.zero,
                                            procCoefficient  = 0f
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
                vector = position;
            }
        }
Example #4
0
 private void IceEliteChanges(On.RoR2.HealthComponent.orig_TakeDamage orig, RoR2.HealthComponent self, RoR2.DamageInfo damageInfo)
 {
     RoR2.CharacterBody characterBody = null;
     if (damageInfo.attacker)
     {
         characterBody = damageInfo.attacker.GetComponent <RoR2.CharacterBody>();
     }
     if (damageInfo.damage > 0)
     {
         if (characterBody)
         {
             RoR2.CharacterMaster master = characterBody.master;
             if (master && master.inventory)
             {
                 if (damageInfo.procCoefficient > 0f)
                 {
                     if (characterBody.GetBuffCount(Resources.Load <BuffDef>("buffdefs/AffixWhite")) > 0)
                     {
                         self.body.AddTimedBuff(FreezingBlood.buffIndex, 2f * damageInfo.procCoefficient);
                         if (self.body.GetBuffCount(FreezingBlood.buffIndex) >= 10)
                         {
                             self.body.ClearTimedBuffs(FreezingBlood.buffIndex);
                             RoR2.CharacterBody component     = damageInfo.attacker.GetComponent <RoR2.CharacterBody>();
                             RoR2.ProcChainMask procChainMask = damageInfo.procChainMask;
                             int     AffixWhiteStack          = master.inventory.GetItemCount(AspectsToItems.AspectsToItems.NewDefsList.Find(x => x.name == "AffixWhite").itemIndex);
                             Vector3 position          = damageInfo.position;
                             float   damageCoefficient = 10f + 10f * AffixWhiteStack;
                             if (AffixWhiteStack == 0)
                             {
                                 damageCoefficient = 20f;
                             }
                             float           damage2     = RoR2.Util.OnHitProcDamage(component.damage, component.damage, damageCoefficient);
                             RoR2.DamageInfo damageInfo2 = new RoR2.DamageInfo
                             {
                                 damage           = damage2,
                                 damageColorIndex = DamageColorIndex.Item,
                                 damageType       = DamageType.Generic,
                                 attacker         = damageInfo.attacker,
                                 crit             = damageInfo.crit,
                                 force            = Vector3.zero,
                                 inflictor        = null,
                                 position         = position,
                                 procChainMask    = procChainMask,
                                 procCoefficient  = 1f
                             };
                             RoR2.EffectManager.SimpleImpactEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/IceCullExplosion"), position, Vector3.up, true);
                             self.TakeDamage(damageInfo2);
                         }
                     }
                 }
             }
         }
     }
     orig(self, damageInfo);
 }
 // Token: 0x06000A04 RID: 2564 RVA: 0x0002BE48 File Offset: 0x0002A048
 public void OnTriggerEnter(Collider other)
 {
     if (NetworkServer.active)
     {
         HealthComponent component = other.GetComponent <HealthComponent>();
         if (component)
         {
             component.TakeDamage(new DamageInfo
             {
                 position  = other.transform.position,
                 attacker  = null,
                 inflictor = base.gameObject,
                 damage    = 999999f
             });
         }
     }
 }
Example #6
0
        private static void HandleBulletDamage(NetworkMessage netMsg)
        {
            NetworkReader reader     = netMsg.reader;
            GameObject    gameObject = reader.ReadGameObject();
            DamageInfo    damageInfo = reader.ReadDamageInfo();

            if (reader.ReadBoolean() && gameObject)
            {
                HealthComponent component = gameObject.GetComponent <HealthComponent>();
                if (component)
                {
                    component.TakeDamage(damageInfo);
                }
                GlobalEventManager.instance.OnHitEnemy(damageInfo, gameObject);
            }
            GlobalEventManager.instance.OnHitAll(damageInfo, gameObject);
        }
Example #7
0
        // Token: 0x06000426 RID: 1062 RVA: 0x00010B54 File Offset: 0x0000ED54
        public bool DefaultHitCallback(ref BulletAttack.BulletHit hitInfo)
        {
            bool result = false;

            if (hitInfo.collider)
            {
                result = ((1 << hitInfo.collider.gameObject.layer & this.stopperMask) == 0);
            }
            if (this.hitEffectPrefab)
            {
                EffectManager.SimpleImpactEffect(this.hitEffectPrefab, hitInfo.point, this.HitEffectNormal ? hitInfo.surfaceNormal : (-hitInfo.direction), true);
            }
            if (hitInfo.collider)
            {
                SurfaceDef objectSurfaceDef = SurfaceDefProvider.GetObjectSurfaceDef(hitInfo.collider, hitInfo.point);
                if (objectSurfaceDef && objectSurfaceDef.impactEffectPrefab)
                {
                    EffectData effectData = new EffectData
                    {
                        origin          = hitInfo.point,
                        rotation        = Quaternion.LookRotation(hitInfo.surfaceNormal),
                        color           = objectSurfaceDef.approximateColor,
                        surfaceDefIndex = objectSurfaceDef.surfaceDefIndex
                    };
                    EffectManager.SpawnEffect(objectSurfaceDef.impactEffectPrefab, effectData, true);
                }
            }
            if (this.isCrit)
            {
                EffectManager.SimpleImpactEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/Critspark"), hitInfo.point, this.HitEffectNormal ? hitInfo.surfaceNormal : (-hitInfo.direction), true);
            }
            GameObject entityObject = hitInfo.entityObject;

            if (entityObject)
            {
                float num = 1f;
                switch (this.falloffModel)
                {
                case BulletAttack.FalloffModel.None:
                    num = 1f;
                    break;

                case BulletAttack.FalloffModel.DefaultBullet:
                    num = 0.5f + Mathf.Clamp01(Mathf.InverseLerp(60f, 25f, hitInfo.distance)) * 0.5f;
                    break;

                case BulletAttack.FalloffModel.Buckshot:
                    num = 0.25f + Mathf.Clamp01(Mathf.InverseLerp(25f, 7f, hitInfo.distance)) * 0.75f;
                    break;
                }
                DamageInfo damageInfo = new DamageInfo();
                damageInfo.damage           = this.damage * num;
                damageInfo.crit             = this.isCrit;
                damageInfo.attacker         = this.owner;
                damageInfo.inflictor        = this.weapon;
                damageInfo.position         = hitInfo.point;
                damageInfo.force            = hitInfo.direction * (this.force * num);
                damageInfo.procChainMask    = this.procChainMask;
                damageInfo.procCoefficient  = this.procCoefficient;
                damageInfo.damageType       = this.damageType;
                damageInfo.damageColorIndex = this.damageColorIndex;
                damageInfo.ModifyDamageInfo(hitInfo.damageModifier);
                TeamIndex teamIndex = TeamIndex.Neutral;
                if (this.owner)
                {
                    TeamComponent component = this.owner.GetComponent <TeamComponent>();
                    if (component)
                    {
                        teamIndex = component.teamIndex;
                    }
                }
                TeamIndex     teamIndex2 = TeamIndex.Neutral;
                TeamComponent component2 = hitInfo.entityObject.GetComponent <TeamComponent>();
                if (component2)
                {
                    teamIndex2 = component2.teamIndex;
                }
                bool            flag            = teamIndex == teamIndex2;
                HealthComponent healthComponent = null;
                if (!flag)
                {
                    healthComponent = entityObject.GetComponent <HealthComponent>();
                }
                if (NetworkServer.active)
                {
                    if (healthComponent)
                    {
                        healthComponent.TakeDamage(damageInfo);
                        GlobalEventManager.instance.OnHitEnemy(damageInfo, hitInfo.entityObject);
                    }
                    GlobalEventManager.instance.OnHitAll(damageInfo, hitInfo.entityObject);
                }
                else if (ClientScene.ready)
                {
                    BulletAttack.messageWriter.StartMessage(53);
                    BulletAttack.messageWriter.Write(entityObject);
                    BulletAttack.messageWriter.Write(damageInfo);
                    BulletAttack.messageWriter.Write(healthComponent != null);
                    BulletAttack.messageWriter.FinishMessage();
                    ClientScene.readyConnection.SendWriter(BulletAttack.messageWriter, QosChannelIndex.defaultReliable.intVal);
                }
            }
            return(result);
        }
        // Token: 0x06000C13 RID: 3091 RVA: 0x0003BF50 File Offset: 0x0003A150
        public void OnProjectileImpact(ProjectileImpactInfo impactInfo)
        {
            if (!this.alive)
            {
                return;
            }
            Collider collider = impactInfo.collider;

            if (collider)
            {
                DamageInfo damageInfo = new DamageInfo();
                if (this.projectileDamage)
                {
                    damageInfo.damage           = this.projectileDamage.damage;
                    damageInfo.crit             = this.projectileDamage.crit;
                    damageInfo.attacker         = (this.projectileController.owner ? this.projectileController.owner.gameObject : null);
                    damageInfo.inflictor        = base.gameObject;
                    damageInfo.position         = impactInfo.estimatedPointOfImpact;
                    damageInfo.force            = this.projectileDamage.force * this.transform.forward;
                    damageInfo.procChainMask    = this.projectileController.procChainMask;
                    damageInfo.procCoefficient  = this.projectileController.procCoefficient;
                    damageInfo.damageColorIndex = this.projectileDamage.damageColorIndex;
                }
                HurtBox component = collider.GetComponent <HurtBox>();
                if (component)
                {
                    HealthComponent healthComponent = component.healthComponent;
                    if (healthComponent)
                    {
                        Transform transform = healthComponent.gameObject.transform;
                        if (healthComponent.gameObject == this.projectileController.owner)
                        {
                            return;
                        }
                        if ((!this.pastTargetList.Contains(transform) || (this.canBounceToSameTarget && transform != this.lastTarget)) && (transform == this.currentTarget || this.canHitNonTarget || !this.currentTarget))
                        {
                            this.pastTargetList.Add(transform);
                            if (this.currentTarget)
                            {
                                this.lastTarget = this.currentTarget;
                            }
                            else
                            {
                                this.lastTarget = transform;
                            }
                            this.currentTarget = this.FindTarget();
                            this.bounceCount++;
                            healthComponent.TakeDamage(damageInfo);
                            GlobalEventManager.instance.OnHitAll(damageInfo, collider.gameObject);
                            GlobalEventManager.instance.OnHitEnemy(damageInfo, component.healthComponent.gameObject);
                            if (this.projectileDamage)
                            {
                                this.projectileDamage.damage *= this.damageMultiplier;
                            }
                            if (this.impactEffect)
                            {
                                EffectManager.instance.SimpleImpactEffect(this.impactEffect, this.transform.position, -this.transform.forward, !this.projectileController.isPrediction);
                            }
                            if (this.bounceCount >= this.maxBounceCount)
                            {
                                this.alive = false;
                            }
                        }
                    }
                }
                else if (this.destroyOnWorldIfNoTarget && this.currentTarget == null)
                {
                    damageInfo.position = this.transform.position;
                    GlobalEventManager.instance.OnHitAll(damageInfo, collider.gameObject);
                    if (this.impactEffect)
                    {
                        EffectManager.instance.SimpleImpactEffect(this.impactEffect, this.transform.position, -this.transform.forward, !this.projectileController.isPrediction);
                    }
                    this.alive = false;
                }
            }
            if (!this.alive)
            {
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
Example #9
0
        // Token: 0x0600138F RID: 5007 RVA: 0x0005F7EC File Offset: 0x0005D9EC
        public void OnInteractionBegin(Interactor activator)
        {
            if (!this.CanBeAffordedByInteractor(activator))
            {
                return;
            }
            CharacterBody component = activator.GetComponent <CharacterBody>();

            switch (this.costType)
            {
            case CostType.Money:
                if (component)
                {
                    CharacterMaster master = component.master;
                    if (master)
                    {
                        master.money -= (uint)this.cost;
                    }
                }
                break;

            case CostType.PercentHealth:
            {
                HealthComponent component2 = activator.GetComponent <HealthComponent>();
                if (component2)
                {
                    float health = component2.health;
                    float num    = component2.fullHealth * (float)this.cost / 100f;
                    if (health > num)
                    {
                        component2.TakeDamage(new DamageInfo
                            {
                                damage     = num,
                                attacker   = base.gameObject,
                                position   = base.transform.position,
                                damageType = DamageType.BypassArmor
                            });
                    }
                }
                break;
            }

            case CostType.Lunar:
            {
                NetworkUser networkUser = Util.LookUpBodyNetworkUser(activator.gameObject);
                if (networkUser)
                {
                    networkUser.DeductLunarCoins((uint)this.cost);
                }
                break;
            }

            case CostType.WhiteItem:
            case CostType.GreenItem:
            case CostType.RedItem:
            {
                ItemTier itemTier = PurchaseInteraction.CostTypeToItemTier(this.costType);
                if (component)
                {
                    Inventory inventory = component.inventory;
                    if (inventory)
                    {
                        ItemIndex            itemIndex  = ItemIndex.None;
                        ShopTerminalBehavior component3 = base.GetComponent <ShopTerminalBehavior>();
                        if (component3)
                        {
                            itemIndex = component3.CurrentPickupIndex().itemIndex;
                        }
                        WeightedSelection <ItemIndex> weightedSelection = new WeightedSelection <ItemIndex>(8);
                        foreach (ItemIndex itemIndex2 in ItemCatalog.allItems)
                        {
                            if (itemIndex2 != itemIndex)
                            {
                                int itemCount = inventory.GetItemCount(itemIndex2);
                                if (itemCount > 0 && ItemCatalog.GetItemDef(itemIndex2).tier == itemTier)
                                {
                                    weightedSelection.AddChoice(itemIndex2, (float)itemCount);
                                }
                            }
                        }
                        List <ItemIndex> list = new List <ItemIndex>();
                        int num2 = 0;
                        while (weightedSelection.Count > 0 && num2 < this.cost)
                        {
                            int num3 = weightedSelection.EvaluteToChoiceIndex(this.rng.nextNormalizedFloat);
                            WeightedSelection <ItemIndex> .ChoiceInfo choice = weightedSelection.GetChoice(num3);
                            ItemIndex value = choice.value;
                            int       num4  = (int)choice.weight;
                            num4--;
                            if (num4 <= 0)
                            {
                                weightedSelection.RemoveChoice(num3);
                            }
                            else
                            {
                                weightedSelection.ModifyChoiceWeight(num3, (float)num4);
                            }
                            list.Add(value);
                            num2++;
                        }
                        for (int i = num2; i < this.cost; i++)
                        {
                            list.Add(itemIndex);
                        }
                        for (int j = 0; j < list.Count; j++)
                        {
                            ItemIndex itemIndex3 = list[j];
                            PurchaseInteraction.CreateItemTakenOrb(component.corePosition, base.gameObject, itemIndex3);
                            inventory.RemoveItem(itemIndex3, 1);
                            if (itemIndex3 != itemIndex)
                            {
                                Action <PurchaseInteraction, Interactor> action = PurchaseInteraction.onItemSpentOnPurchase;
                                if (action != null)
                                {
                                    action(this, activator);
                                }
                            }
                        }
                    }
                }
                break;
            }
            }
            IEnumerable <StatDef> statDefsToIncrement = this.purchaseStatNames.Select(new Func <string, StatDef>(StatDef.Find));

            StatManager.OnPurchase <IEnumerable <StatDef> >(component, this.costType, statDefsToIncrement);
            this.onPurchase.Invoke(activator);
            this.lastActivator = activator;
        }
Example #10
0
        private static void Init()
        {
            CostTypeCatalog.costTypeDefs = new CostTypeDef[11];
            CostTypeIndex costType     = CostTypeIndex.None;
            CostTypeDef   costTypeDef7 = new CostTypeDef();

            costTypeDef7.buildCostString = delegate(CostTypeDef costTypeDef, CostTypeDef.BuildCostStringContext context)
            {
                context.stringBuilder.Append("");
            };
            costTypeDef7.isAffordable = ((CostTypeDef costTypeDef, CostTypeDef.IsAffordableContext context) => true);
            costTypeDef7.payCost      = delegate(CostTypeDef costTypeDef, CostTypeDef.PayCostContext context)
            {
            };
            CostTypeCatalog.Register(costType, costTypeDef7);
            CostTypeIndex costType2    = CostTypeIndex.Money;
            CostTypeDef   costTypeDef2 = new CostTypeDef();

            costTypeDef2.costStringFormatToken = "COST_MONEY_FORMAT";
            costTypeDef2.isAffordable          = delegate(CostTypeDef costTypeDef, CostTypeDef.IsAffordableContext context)
            {
                CharacterBody component = context.activator.GetComponent <CharacterBody>();
                if (component)
                {
                    CharacterMaster master = component.master;
                    if (master)
                    {
                        return((ulong)master.money >= (ulong)((long)context.cost));
                    }
                }
                return(false);
            };
            costTypeDef2.payCost = delegate(CostTypeDef costTypeDef, CostTypeDef.PayCostContext context)
            {
                if (context.activatorMaster)
                {
                    context.activatorMaster.money -= (uint)context.cost;
                }
            };
            costTypeDef2.colorIndex = ColorCatalog.ColorIndex.Money;
            CostTypeCatalog.Register(costType2, costTypeDef2);
            CostTypeIndex costType3    = CostTypeIndex.PercentHealth;
            CostTypeDef   costTypeDef3 = new CostTypeDef();

            costTypeDef3.costStringFormatToken         = "COST_PERCENTHEALTH_FORMAT";
            costTypeDef3.saturateWorldStyledCostString = false;
            costTypeDef3.darkenWorldStyledCostString   = true;
            costTypeDef3.isAffordable = delegate(CostTypeDef costTypeDef, CostTypeDef.IsAffordableContext context)
            {
                HealthComponent component = context.activator.GetComponent <HealthComponent>();
                return(component && component.combinedHealth / component.fullCombinedHealth * 100f >= (float)context.cost);
            };
            costTypeDef3.payCost = delegate(CostTypeDef costTypeDef, CostTypeDef.PayCostContext context)
            {
                HealthComponent component = context.activator.GetComponent <HealthComponent>();
                if (component)
                {
                    float combinedHealth = component.combinedHealth;
                    float num            = component.fullCombinedHealth * (float)context.cost / 100f;
                    if (combinedHealth > num)
                    {
                        component.TakeDamage(new DamageInfo
                        {
                            damage     = num,
                            attacker   = context.purchasedObject,
                            position   = context.purchasedObject.transform.position,
                            damageType = (DamageType.NonLethal | DamageType.BypassArmor)
                        });
                    }
                }
            };
            costTypeDef3.colorIndex = ColorCatalog.ColorIndex.Blood;
            CostTypeCatalog.Register(costType3, costTypeDef3);
            CostTypeIndex costType4    = CostTypeIndex.LunarCoin;
            CostTypeDef   costTypeDef4 = new CostTypeDef();

            costTypeDef4.costStringFormatToken         = "COST_LUNARCOIN_FORMAT";
            costTypeDef4.saturateWorldStyledCostString = false;
            costTypeDef4.darkenWorldStyledCostString   = true;
            costTypeDef4.isAffordable = delegate(CostTypeDef costTypeDef, CostTypeDef.IsAffordableContext context)
            {
                NetworkUser networkUser = Util.LookUpBodyNetworkUser(context.activator.gameObject);
                return(networkUser && (ulong)networkUser.lunarCoins >= (ulong)((long)context.cost));
            };
            costTypeDef4.payCost = delegate(CostTypeDef costTypeDef, CostTypeDef.PayCostContext context)
            {
                NetworkUser networkUser = Util.LookUpBodyNetworkUser(context.activator.gameObject);
                if (networkUser)
                {
                    networkUser.DeductLunarCoins((uint)context.cost);
                }
            };
            costTypeDef4.colorIndex = ColorCatalog.ColorIndex.LunarCoin;
            CostTypeCatalog.Register(costType4, costTypeDef4);
            CostTypeCatalog.Register(CostTypeIndex.WhiteItem, new CostTypeDef
            {
                costStringFormatToken = "COST_ITEM_FORMAT",
                isAffordable          = new CostTypeDef.IsAffordableDelegate(CostTypeCatalog.< > c.< > 9. < Init > g__IsAffordableItem | 5_0),
                payCost    = new CostTypeDef.PayCostDelegate(CostTypeCatalog.< > c.< > 9. < Init > g__PayCostItems | 5_1),
                colorIndex = ColorCatalog.ColorIndex.Tier1Item,
                itemTier   = ItemTier.Tier1
            });