protected void TryUpdateBuff()
 {
     if (!DataReader <Buff> .Contains(this.buffID))
     {
         return;
     }
     if (!this.battleUI)
     {
         return;
     }
     this.battleUI.ShowGuildWarBuff(true, 5619, delegate
     {
         if (!DataReader <Buff> .Contains(this.buffID))
         {
             return;
         }
         Buff buff         = DataReader <Buff> .Get(this.buffID);
         string effectText = string.Empty;
         if (DataReader <Attrs> .Contains(buff.targetPropId))
         {
             Attrs attrs = DataReader <Attrs> .Get(buff.targetPropId);
             if (attrs.attrs.get_Count() > 0 && attrs.values.get_Count() > 0)
             {
                 effectText = AttrUtility.GetStandardDesc(attrs.attrs.get_Item(0), attrs.values.get_Item(0));
             }
         }
         BattleBuffDetailUI battleBuffDetailUI = UIManagerControl.Instance.OpenUI("BattleBuffDetailUI", null, false, UIType.NonPush) as BattleBuffDetailUI;
         if (battleBuffDetailUI)
         {
             battleBuffDetailUI.SetData(5619, 515122, 515123, effectText, 515121);
         }
     });
 }
Example #2
0
    public void RefreshUI(EntitySelf self)
    {
        this.Awake();
        this.TextAtk.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.Atk, RoleAttrTool.GetAtk(self), "ff7d4b"));
        this.TextDefence.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.Defence, RoleAttrTool.GetDefence(self), "ff7d4b"));
        this.TextHpLmt.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HpLmt, RoleAttrTool.GetHpLmt(self), "ff7d4b"));
        this.TextHurtAddRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HurtAddRatio, self.HurtAddRatio, "ff7d4b"));
        this.TextHurtDeRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HurtDeRatio, self.HurtDeRatio, "ff7d4b"));
        this.TextHitRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HitRatio, self.HitRatio, "ff7d4b"));
        this.TextDodgeRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.DodgeRatio, self.DodgeRatio, "ff7d4b"));
        this.TextCritRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.CritRatio, self.CritRatio, "ff7d4b"));
        this.TextCritHurtAddRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.CritAddValue, self.CritAddValue, "ff7d4b"));
        this.TextParryRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.ParryRatio, self.ParryRatio, "ff7d4b"));
        this.TextParryHurtDeRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.ParryHurtDeRatio, self.ParryHurtDeRatio, "ff7d4b"));
        this.TextDeparryRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.DeparryRatio, self.DeparryRatio, "ff7d4b"));
        this.TextDecritRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.DecritRatio, self.DecritRatio, "ff7d4b"));
        this.TextMoveSpeed.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.MoveSpeed, self.MoveSpeed, "ff7d4b"));
        this.TextHpRestore.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HpRestore, self.HpRestore, "ff7d4b"));
        this.TextLV.set_text("Lv" + self.Lv);
        this.TextExp.set_text(Utils.SwitchChineseNumber(self.Exp, 0) + "/" + Utils.SwitchChineseNumber(self.ExpLmt, 0));
        float x;

        if (self.ExpLmt == 0L)
        {
            x = 0f;
        }
        else
        {
            x = 375f * ((float)self.Exp / (float)self.ExpLmt);
        }
        Vector2 sizeDelta = this.ImageProgress.GetComponent <RectTransform>().get_sizeDelta();

        sizeDelta.x = x;
        this.ImageProgress.GetComponent <RectTransform>().set_sizeDelta(sizeDelta);
    }
Example #3
0
    public static List <string> GetAllStandardDesc(int dataID)
    {
        List <string> list = new List <string>();

        if (!DataReader <Attrs> .Contains(dataID))
        {
            return(list);
        }
        Attrs attrs = DataReader <Attrs> .Get(dataID);

        int num = (attrs.attrs.get_Count() >= attrs.values.get_Count()) ? attrs.values.get_Count() : attrs.attrs.get_Count();

        for (int i = 0; i < num; i++)
        {
            list.Add(AttrUtility.GetStandardDesc(attrs.attrs.get_Item(i), attrs.values.get_Item(i)));
        }
        return(list);
    }
Example #4
0
    public void RefreshUI(FindBuddyRes down)
    {
        this.Awake();
        if (down == null)
        {
            return;
        }
        this.TextAtk.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.Atk, down.infoExt.atk, "ff7d4b"));
        this.TextDefence.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.Defence, down.infoExt.defence, "ff7d4b"));
        this.TextHpLmt.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HpLmt, down.infoExt.hp, "ff7d4b"));
        this.TextHurtAddRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HurtAddRatio, down.infoExt.hurtAddRatio, "ff7d4b"));
        this.TextHurtDeRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HurtDeRatio, down.infoExt.hurtDeRatio, "ff7d4b"));
        this.TextHitRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.HitRatio, down.infoExt.hitRatio, "ff7d4b"));
        this.TextDodgeRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.DodgeRatio, down.infoExt.dodgeRatio, "ff7d4b"));
        this.TextCritRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.CritRatio, down.infoExt.critRatio, "ff7d4b"));
        this.TextCritHurtAddRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.CritHurtAddRatio, down.infoExt.critHurtAddRatio, "ff7d4b"));
        this.TextParryRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.ParryRatio, down.infoExt.parryRatio, "ff7d4b"));
        this.TextParryHurtDeRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.ParryHurtDeRatio, down.infoExt.parryHurtDeRatio, "ff7d4b"));
        this.TextDeparryRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.DeparryRatio, down.infoExt.deparryRatio, "ff7d4b"));
        this.TextDecritRatio.set_text(AttrUtility.GetStandardDesc(GameData.AttrType.DecritRatio, down.infoExt.decritRatio, "ff7d4b"));
        this.TextMoveSpeed.set_text(string.Empty);
        this.TextHpRestore.set_text(string.Empty);
        this.TextLV.set_text("Lv" + down.info.lv);
        this.TextExp.set_text(down.infoExt.exp + "/" + down.infoExt.expLmt);
        float x;

        if (down.infoExt.expLmt == 0L)
        {
            x = 0f;
        }
        else
        {
            x = 375f * ((float)down.infoExt.exp / (float)down.infoExt.expLmt);
        }
        Vector2 sizeDelta = this.ImageProgress.GetComponent <RectTransform>().get_sizeDelta();

        sizeDelta.x = x;
        this.ImageProgress.GetComponent <RectTransform>().set_sizeDelta(sizeDelta);
    }
Example #5
0
    private void CreateAttr(int key, int value, bool isShowNext = false, int nextValue = 0)
    {
        GameObject gameObject = this.mAttrList.Find((GameObject e) => e.get_name() == "Unused");

        if (gameObject == null)
        {
            gameObject = Object.Instantiate <GameObject>(this.mGoAttrPrefab);
            UGUITools.SetParent(this.mAttrPanel, gameObject, false);
            this.mAttrList.Add(gameObject);
        }
        gameObject.get_gameObject().set_name(key.ToString());
        gameObject.get_gameObject().SetActive(true);
        gameObject.get_transform().FindChild("Attr").GetComponentInChildren <Text>().set_text(AttrUtility.GetStandardDesc(key, value, "ff7d4b"));
        GameObject gameObject2 = gameObject.get_transform().FindChild("Next").get_gameObject();

        if (isShowNext)
        {
            gameObject2.SetActive(true);
            gameObject2.GetComponentInChildren <Text>().set_text(AttrUtility.GetAttrValueDisplay(key, nextValue));
        }
        else
        {
            gameObject2.SetActive(false);
        }
    }
    public static BattleCalculator.DamageResult CalculateDamage(BattleBaseAttrs caster, BattleBaseAttrs target, bool isCasterPlayer, bool isTargetPlayer, XDict <GameData.AttrType, long> casterTempAttrs, XDict <GameData.AttrType, long> targetTempAttrs)
    {
        FileStream    fileStream    = null;
        StreamWriter  streamWriter  = null;
        StringBuilder stringBuilder = null;

        if (ClientApp.Instance.isShowFightLog)
        {
            string text = Application.get_dataPath() + "/../BattleLog.txt";
            try
            {
                fileStream    = new FileStream(text, 4, 3);
                streamWriter  = new StreamWriter(fileStream, Encoding.get_UTF8());
                stringBuilder = new StringBuilder();
            }
            catch (Exception ex)
            {
                Debug.LogError("Can't Write Log File!\n" + ex.get_Message());
                return(null);
            }
            stringBuilder.Append("Caster: \n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.Atk, caster.Atk) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.Defence, caster.Defence) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.PveAtk, caster.PveAtk) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.PvpAtk, caster.PvpAtk) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.HitRatio, caster.HitRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.CritRatio, caster.CritRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.CritHurtAddRatio, caster.CritHurtAddRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.DeparryRatio, caster.DeparryRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.SuckBloodScale, caster.SuckBloodScale) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.HurtAddRatio, caster.HurtAddRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.PveHurtAddRatio, caster.PveHurtAddRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.PvpHurtAddRatio, caster.PvpHurtAddRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.AtkMulAmend, caster.AtkMulAmend) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.PveAtkMulAmend, caster.PveAtkMulAmend) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.PvpAtkMulAmend, caster.PvpAtkMulAmend) + "\n");
            stringBuilder.Append("Target: \n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.Defence, target.Defence) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.HpLmt, target.HpLmt) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.DodgeRatio, target.DodgeRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.DecritRatio, target.DecritRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.ParryRatio, target.ParryRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.ParryHurtDeRatio, target.ParryHurtDeRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.HurtDeRatio, target.ParryHurtDeRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.PveHurtDeRatio, target.PveHurtDeRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.PvpHurtDeRatio, target.PvpHurtDeRatio) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.DefMulAmend, target.DefMulAmend) + "\n");
            stringBuilder.Append(AttrUtility.GetStandardDesc(GameData.AttrType.HpLmtMulAmend, target.HpLmtMulAmend) + "\n");
            stringBuilder.Append("Calculate: \n");
        }
        BattleCalculator.DamageResult damageResult = new BattleCalculator.DamageResult();
        if (BattleCalculator.CheckHit(caster, target, stringBuilder))
        {
            if (ClientApp.Instance.isShowFightLog)
            {
                stringBuilder.Append("IsHit: " + true + "\n");
            }
            bool   flag = BattleCalculator.CheckParry(caster, target, out damageResult.parryRandomIndex, stringBuilder);
            double finalParryAddRatio = BattleCalculator.GetFinalParryAddRatio(target, flag);
            if (ClientApp.Instance.isShowFightLog)
            {
                stringBuilder.Append("IsParry: " + flag + "\n");
            }
            bool   flag2             = BattleCalculator.CheckCrit(caster, target, out damageResult.critRandomIndex, stringBuilder);
            double finalCritAddRatio = BattleCalculator.GetFinalCritAddRatio(caster, flag2);
            if (ClientApp.Instance.isShowFightLog)
            {
                stringBuilder.Append("IsCrit: " + flag2 + "\n");
            }
            double        tempDamage         = BattleCalculator.GetTempDamage(caster, target, isTargetPlayer);
            double        holyDamage         = BattleCalculator.GetHolyDamage(caster, target, casterTempAttrs);
            double        ignoreTargetDamage = BattleCalculator.GetIgnoreTargetDamage(caster, isTargetPlayer, casterTempAttrs);
            double        num  = (double)BattleCalculator.GetCritAddDamage(caster, flag2);
            List <double> list = new List <double>();
            list.Add(tempDamage * (double)caster.TryAddValue(GameData.AttrType.SkillNmlDmgScale, casterTempAttrs) * 0.001 + (double)caster.TryAddValue(GameData.AttrType.SkillNmlDmgAddAmend, casterTempAttrs));
            list.Add(finalCritAddRatio);
            list.Add(finalParryAddRatio);
            list.Add((!isCasterPlayer || !isTargetPlayer) ? Math.Max(0.0, (1000.0 + (double)caster.PveHurtAddRatio - (double)target.PveHurtDeRatio) * 0.001) : Math.Max(0.0, (1000.0 + (double)caster.PvpHurtAddRatio - (double)target.PvpHurtDeRatio) * 0.001));
            list.Add(Math.Max(0.0, (double)(1000 + caster.HurtAddRatio - target.HurtDeRatio) * 0.001));
            double num2 = BattleCalculator.GetMultipleResult(list) + holyDamage + ignoreTargetDamage + num;
            double num3 = Math.Max(1.0, num2 * (double)BattleCalculator.serverRandom.Next(9500, 10500, out damageResult.damageRandomIndex) * 9.9999997473787516E-05);
            double num4 = BattleCalculator.CalculateLifeSteal(caster, (int)num3);
            damageResult.IsMiss    = false;
            damageResult.IsCrit    = flag2;
            damageResult.IsParry   = flag;
            damageResult.Damage    = (long)num3;
            damageResult.Lifesteal = (long)num4;
            if (ClientApp.Instance.isShowFightLog)
            {
                stringBuilder.Append("TempDamage: " + tempDamage + "\n");
                stringBuilder.Append("HolyDamage: " + holyDamage + "\n");
                stringBuilder.Append("SkillNmlDmgScale: " + caster.TryAddValue(GameData.AttrType.SkillNmlDmgScale, casterTempAttrs) + "\n");
                stringBuilder.Append("SkillNmlDmgAddAmend: " + caster.TryAddValue(GameData.AttrType.SkillNmlDmgAddAmend, casterTempAttrs) + "\n");
                stringBuilder.Append("FixFinalDamage: " + num3 + "\n");
                stringBuilder.Append("Lifesteal: " + num4 + "\n");
            }
        }
        else
        {
            damageResult.parryRandomIndex  = 0;
            damageResult.critRandomIndex   = 0;
            damageResult.damageRandomIndex = 0;
            damageResult.IsMiss            = true;
            damageResult.IsParry           = false;
            damageResult.IsCrit            = false;
            damageResult.Damage            = 0L;
            damageResult.Lifesteal         = 0L;
            if (ClientApp.Instance.isShowFightLog)
            {
                stringBuilder.Append("IsHit: " + false + "\n");
            }
        }
        if (ClientApp.Instance.isShowFightLog)
        {
            stringBuilder.Append("================================================================\n\n");
            Debug.LogError(stringBuilder.ToString());
            streamWriter.Write(stringBuilder.ToString());
            streamWriter.Close();
            fileStream.Close();
        }
        return(damageResult);
    }