Beispiel #1
0
 protected override bool EqualsRDATA(RR rr)
 {
     return(MNAME.Equals(((SOA)rr).MNAME) &&
            RNAME.Equals(((SOA)rr).RNAME) &&
            SERIAL.Equals(((SOA)rr).SERIAL) &&
            REFRESH.Equals(((SOA)rr).REFRESH) &&
            RETRY.Equals(((SOA)rr).RETRY) &&
            EXPIRE.Equals(((SOA)rr).EXPIRE) &&
            MINIMUM.Equals(((SOA)rr).MINIMUM));
 }
Beispiel #2
0
 public override string ToString(int namePadding)
 {
     // example.com. IN SOA master.example.com. hostmaster.example.com.  2007061501 3600 1800 604800 600
     return(String.Join(" ", new string[] {
         Base.NAME.PadLeft(namePadding),
         Base.CLASS.ToString(),
         Base.TypeString,
         MNAME.ToString(),
         RNAME.ToString(),
         SERIAL.ToString(),
         REFRESH.ToString(),
         RETRY.ToString(),
         EXPIRE.ToString(),
         Base.TTL.ToString()
     }));
 }
Beispiel #3
0
        /// <summary>
        /// 새로고침
        /// </summary>
        public void Refresh(REFRESH refresh = REFRESH.ALL, bool forceUpdate = false)
        {
            switch (refresh)
            {
            case REFRESH.ALL:
                Refresh(REFRESH.INFO, forceUpdate);
                Refresh(REFRESH.STAT, forceUpdate);
                Refresh(REFRESH.HP, forceUpdate);
                Refresh(REFRESH.EXP, forceUpdate);
                Refresh(REFRESH.SUPPLY, forceUpdate);
                refreshCount++;
                //log.Debug("id={0}, name={1}, refresh_type={2}, refresh_count={3}", this.id, this.name, refresh, this.refreshCount);
                break;

            case REFRESH.INFO:
                // 인형 정보
                //Dictionary<string, string> data = GameData.Doll.GetData(no);
                JObject data = GameData.Doll.GetDollData(no);
                try
                {
                    this.type    = Parser.Json.ParseString(data["type"]);
                    this.name    = LanguageResources.Instance[string.Format("DOLL_{0}", this.no)];
                    this.star    = Parser.Json.ParseInt(data["star"]);
                    this.collabo = Parser.Json.ParseInt(data["collabo"]) == 1 ? true : false;
                }
                catch (Exception ex)
                {
                    log.Warn(ex, "인형 데이터베이스 불러오기 실패");
                }
                break;

            case REFRESH.EXP:
                this.maxLevel = GameData.Doll.GetMaxLevel(this);
                if (GameData.Doll.Exp.GetTotalExp(this.maxLevel) <= this.exp)
                {
                    this.level     = this.maxLevel;
                    this.exp       = GameData.Doll.Exp.GetTotalExp(this.maxLevel);
                    this.remainExp = 0;

                    this.currentExp = 1;
                    this.maxExp     = 1;
                }
                else if (0 < level && level < 120)
                {
                    this.remainExp = GameData.Doll.Exp.GetTotalExp(level + 1) - this.exp;
                    while (this.remainExp <= 0 && this.level != this.maxLevel)
                    {
                        this.level    += 1;
                        this.remainExp = GameData.Doll.Exp.GetTotalExp(this.level + 1) - this.exp;
                    }
                    int currentLevelExp = GameData.Doll.Exp.GetTotalExp(this.level);
                    this.currentExp = exp - currentLevelExp;
                    if (this.level == this.maxLevel)
                    {
                        this.maxExp = GameData.Doll.Exp.GetTotalExp(this.maxLevel) - currentLevelExp;
                    }
                    else
                    {
                        this.maxExp = GameData.Doll.Exp.GetTotalExp(this.level + 1) - currentLevelExp;
                    }
                }
                if (1 <= location && location <= 5 && 1 <= team && team <= 10)
                {
                    if (this.beforeLevel != this.level || this.beforeLocation != this.location || forceUpdate)
                    {
                        runEarnExp = GameData.Doll.GetRunExp(this, Config.Echelon.baseExp, Config.Echelon.levelPenalty, true) * Config.Echelon.battleCount;

                        //earnExp[0] = GameData.Doll.GetRunExp(this, 370, 75, true) * 4;
                        //earnExp[1] = GameData.Doll.GetRunExp(this, 490, 112, true) * 5;
                        //earnExp[2] = GameData.Doll.GetRunExp(this, 500, 120, true) * 5;
                        //earnExp[3] = GameData.Doll.GetRunExp(this, 500, 120, true) * 5;
                        //earnExp[4] = GameData.Doll.GetRunExp(this, 550, 120, true) * 5;
                        //earnExp[5] = GameData.Doll.GetRunExp(this, 500, 115, true) * 5;

                        this.beforeLevel    = this.level;
                        this.beforeLocation = this.location;
                    }

                    if (this.remainExp > 0)
                    {
                        //int[] tempEarnExp = earnExp;
                        //for (int i = 0; i < 6; i++)
                        //{
                        //    toNextLevelRunCount[i] = Convert.ToInt32(Math.Ceiling((double)expRemain / earnExp[i]));
                        //}

                        int nextLevel = this.level + 1;
                        runCount[0] = UserData.Doll.GetRequireRun(id, Config.Echelon.baseExp, Config.Echelon.levelPenalty, Config.Echelon.battleCount, nextLevel);

                        //toNextLevelRunCount[0] = UserData.Doll.GetRequireRun(this.id, 370, 75, 4, nextLevel);   // 4-3e
                        //toNextLevelRunCount[1] = UserData.Doll.GetRequireRun(this.id, 490, 112, 5, nextLevel);  // 0-2
                        //toNextLevelRunCount[2] = UserData.Doll.GetRequireRun(this.id, 500, 120, 5, nextLevel);  // 8-1n
                        //toNextLevelRunCount[3] = UserData.Doll.GetRequireRunCountToLevel(this.id, 500, 120, 5, nextLevel);  // 10-4e
                        //toNextLevelRunCount[4] = UserData.Doll.GetRequireRun(this.id, 550, 120, 5, nextLevel);  // 11-5
                        //toNextLevelRunCount[5] = UserData.Doll.GetRequireRun(this.id, 500, 115, 5, nextLevel);  // sg 3-2
                        //if (this.no == 278)
                        //{
                        //    log.Warn("six12 next_level {0}", nextLevel);
                        //    log.Warn("six12 to_next_level_run {0}", toNextLevelRunCount[0]);
                        //}

                        int nextExpandLevel = UserData.Doll.GetExpandLevel(id);
                        runCount[1] = UserData.Doll.GetRequireRun(id, Config.Echelon.baseExp, Config.Echelon.levelPenalty, Config.Echelon.battleCount, nextExpandLevel);
                        //toNextExpandRunCount[0] = UserData.Doll.GetRequireRun(this.id, 370, 75, 4, nextExpandLevel);
                        //toNextExpandRunCount[1] = UserData.Doll.GetRequireRun(this.id, 490, 112, 5, nextExpandLevel);
                        //toNextExpandRunCount[2] = UserData.Doll.GetRequireRun(this.id, 500, 120, 5, nextExpandLevel);
                        //toNextExpandRunCount[3] = UserData.Doll.GetRequireRunCountToLevel(this.id, 500, 120, 5, nextExpandLevel);
                        //toNextExpandRunCount[4] = UserData.Doll.GetRequireRun(this.id, 550, 120, 5, nextExpandLevel);
                        //toNextExpandRunCount[5] = UserData.Doll.GetRequireRun(this.id, 500, 115, 5, nextExpandLevel);

                        int maxLevel = UserData.Doll.GetMaxLevel(id);
                        runCount[2] = UserData.Doll.GetRequireRun(id, Config.Echelon.baseExp, Config.Echelon.levelPenalty, Config.Echelon.battleCount, maxLevel);
                        //toMaxLevelRunCount[0] = UserData.Doll.GetRequireRun(this.id, 370, 75, 4, maxLevel);
                        //toMaxLevelRunCount[1] = UserData.Doll.GetRequireRun(this.id, 490, 112, 5, maxLevel);
                        //toMaxLevelRunCount[2] = UserData.Doll.GetRequireRun(this.id, 500, 120, 5, maxLevel);
                        //toMaxLevelRunCount[3] = UserData.Doll.GetRequireRunCountToLevel(this.id, 500, 120, 5, maxLevel);
                        //toMaxLevelRunCount[4] = UserData.Doll.GetRequireRun(this.id, 550, 120, 5, maxLevel);
                        //toMaxLevelRunCount[5] = UserData.Doll.GetRequireRun(this.id, 500, 115, 5, maxLevel);

                        //exp43eCount = Convert.ToInt32(Math.Ceiling((double)expRemain / earnExp[0]));
                        //exp02Count = Convert.ToInt32(Math.Ceiling((double)expRemain / earnExp[1]));
                        //exp81nCount = Convert.ToInt32(Math.Ceiling((double)expRemain / earnExp[2]));
                        //exp104eCount = Convert.ToInt32(Math.Ceiling((double)expRemain / earnExp[3]));
                        //exp115Count = Convert.ToInt32(Math.Ceiling((double)expRemain / earnExp[4]));
                        //exp4draCount = Convert.ToInt32(Math.Ceiling((double)expRemain / earnExp[5]));

                        //exp43eMaxCount = UserData.Doll.GetRunCountToMaxLevel(this.id, 370, 75, 4);
                        //exp02MaxCount = UserData.Doll.GetRunCountToMaxLevel(this.id, 490, 112, 5);
                        //exp81nMaxCount = UserData.Doll.GetRunCountToMaxLevel(this.id, 500, 120, 5);
                        //exp104eMaxCount = UserData.Doll.GetRunCountToMaxLevel(this.id, 500, 120, 5);
                        //exp115MaxCount = UserData.Doll.GetRunCountToMaxLevel(this.id, 550, 120, 5);
                        //exp4draMaxCount = UserData.Doll.GetRunCountToMaxLevel(this.id, 500, 115, 5);

                        reportCount[0] = UserData.Doll.GetRequireBattleReport(this.id, this.level + 1);
                        reportCount[1] = UserData.Doll.GetRequireBattleReport(this.id, nextExpandLevel);
                        reportCount[2] = UserData.Doll.GetRequireBattleReport(this.id, maxLevel);
                        //toNextLevelBattleReportCount = UserData.Doll.GetRequireBattleReport(this.id, this.level + 1);
                        //toNextExpandBattleReportCount = UserData.Doll.GetRequireBattleReport(this.id, UserData.Doll.GetExpandLevel(this.id));
                        //toMaxLevelBattleReportCount = UserData.Doll.GetRequireBattleReport(this.id, this.maxLevel);
                    }
                }
                break;

            case REFRESH.STAT:
                // 인형 스탯
                //Dictionary<string, double> stat = GameData.Doll.GetStat(this.no, this.level);
                //this.dummyHp = Convert.ToInt32(stat["hp"]);
                //this.maxHp = this.dummyHp * this.maxLink;
                //this.pow = Convert.ToInt32(stat["pow"]);
                //this.hit = Convert.ToInt32(stat["hit"]);
                //this.dodge = Convert.ToInt32(stat["dodge"]);
                //this.speed = Convert.ToInt32(stat["speed"]);
                //this.rate = Convert.ToInt32(stat["rate"]);
                //this.armor = Convert.ToInt32(stat["armor"]);
                //this.bullet = Convert.ToInt32(stat["bullet"]);
                //this.crit = Convert.ToInt32(stat["crit"]);
                int[] stat = GameData.Doll.Stat.GetStat(this.no, this.level, this.favor);
                //log.Debug("dummy_hp {0}", stat[0]);
                this.dummyHp = stat[0];
                this.maxHp   = this.dummyHp * this.maxLink;
                this.pow     = stat[1];
                this.hit     = stat[2];
                this.dodge   = stat[3];
                this.speed   = stat[4];
                this.rate    = stat[5];
                this.armor   = stat[6];
                this.bullet  = stat[7];
                this.crit    = stat[8];
                break;

            case REFRESH.HP:
                // 체력 경고
                double hpPercent = (double)this.hp / this.maxHp;
                if (hpPercent < 0.3)
                {
                    this.hpWarningLevel = 2;
                }
                else if (hpPercent < 0.8)
                {
                    this.hpWarningLevel = 1;
                }
                else
                {
                    this.hpWarningLevel = 0;
                }
                // 링크
                //log.Debug("{0} dummy_hp {1} hp {2}", this.name, this.dummyHp, this.hp);
                if (this.dummyHp > 0)
                {
                    this.link = (int)Math.Ceiling((double)this.hp / (double)this.dummyHp);
                }
                // 수복
                this.restore = GameData.Doll.Restore.GetRestore(this.type, this.level, this.hp, this.maxHp, this.maxLink, this.married);
                break;

            case REFRESH.SUPPLY:
                // 보급
                //GameData.Doll.GetSupplyCount(this, ref ammoCount, ref mreCount);
                break;
            }
        }
Beispiel #4
0
        /// <summary>
        /// 새로고침
        /// </summary>
        /// <param name="refresh"></param>
        public void Refresh(REFRESH refresh = REFRESH.ALL)
        {
            switch (refresh)
            {
            case REFRESH.ALL:
                Refresh(REFRESH.INFO);
                Refresh(REFRESH.EXP);
                break;

            case REFRESH.INFO:
                // 요정 정보
                //Dictionary<string, string> data = GameData.Fairy.GetData(no);
                JObject fairy = GameData.Fairy.GetData(this.no);
                if (fairy != null)
                {
                    this.name     = GameData.Fairy.GetName(this.no);
                    this.category = Parser.Json.ParseString(fairy["category"]);
                }
                JObject trait = GameData.Fairy.GetTraitData(this.traitId);
                if (trait != null)
                {
                    this.traitName   = GameData.Fairy.GetTraitName(this.traitId);
                    this.isRareTrait = Parser.Json.ParseInt(trait["is_rare"]) == 1 ? true : false;
                }
                break;

            case REFRESH.EXP:
                maxLevel = 100;

                if (GameData.Fairy.Exp.totalExp[maxLevel] <= exp)
                {
                    level     = maxLevel;
                    exp       = GameData.Fairy.Exp.totalExp[maxLevel];
                    remainExp = 0;

                    currentExp = 1;
                    maxExp     = 1;
                }
                else if (level > 0 && level < 100 && GameData.Fairy.Exp.totalExp.ContainsKey(level + 1))
                {
                    remainExp = GameData.Fairy.Exp.totalExp[level + 1] - exp;
                    while (remainExp < 0 && level != maxLevel)
                    {
                        level    += 1;
                        remainExp = GameData.Fairy.Exp.totalExp[level + 1] - exp;
                    }

                    int currentLevelExp = GameData.Fairy.Exp.totalExp[level];
                    currentExp = exp - currentLevelExp;
                    if (level == maxLevel)
                    {
                        maxExp = GameData.Fairy.Exp.totalExp[maxLevel] - currentLevelExp;
                    }
                    else
                    {
                        maxExp = GameData.Fairy.Exp.totalExp[level + 1] - currentLevelExp;
                    }
                }
                break;

            case REFRESH.CHANGE_TEAM_EXP:
                // 같은 제대 인형 경험치 가져오기
                if (1 <= team && team <= 10)
                {
                    try
                    {
                        runEarnExp = UserData.Fairy.GetTeamRunEarnExp(team);
                        if (runEarnExp == 0)
                        {
                            runCount = new long[] { 0, 0, 0 };
                        }
                        else
                        {
                            runCount[0] = (int)((double)remainExp / runEarnExp + 1);
                            runCount[1] = UserData.Fairy.GetRunCountToMaxLevel(id, runEarnExp);
                            runCount[2] = runCount[1];
                        }
                        reportCount[0] = UserData.Fairy.GetBattleReportCountToMaxLevel(id, level + 1);
                        reportCount[1] = UserData.Fairy.GetBattleReportCountToMaxLevel(id);
                        reportCount[2] = reportCount[1];
                    }
                    catch (Exception ex)
                    {
                        log.Error(ex, "요정 거지런 횟수 계산 중 에러");
                    }
                }
                break;
            }
        }