예제 #1
0
    public void UpdateFromServerData(sg.Role_General source)
    {
        this.GeneralID     = source.generalListId;
        this.ArmySoulPoint = source.armySoulPoint;
        if (null != source.roleGeneralBase)
        {
            BasicData.LogicID    = source.roleGeneralBase.generalId;
            BasicData.Name       = source.roleGeneralBase.admiralName;
            BasicData.Avatar     = source.roleGeneralBase.admiralAvatar;
            BasicData.IsAdmiral  = source.roleGeneralBase.isAdmiral;
            BasicData.Profession = (EGeneralProfession)source.roleGeneralBase.profession;

            BasicData.FillDataFromConfig();
        }

        if (null != source.roleGeneralDegree)
        {
            BasicData.Level        = source.roleGeneralDegree.generalDegree;
            BasicData.CurrentExp   = source.roleGeneralDegree.generalExp;
            BasicData.NextLevelExp = source.roleGeneralDegree.nextLevelExp;
        }

        if (null != source.roleGeneralProperty)
        {
            if (null == PropertyData)
            {
                PropertyData = new GeneralPropertyData();
            }

            PropertyData.Life    = source.roleGeneralProperty.maxLife;
            PropertyData.MaxLife = source.roleGeneralProperty.maxLife;
            PropertyData.Defense = source.roleGeneralProperty.warShipDefense;

            PropertyData.Valiant      = source.roleGeneralProperty.generalChivalrous;
            PropertyData.Command      = source.roleGeneralProperty.generalCommand;
            PropertyData.Intelligence = source.roleGeneralProperty.generalIntelligence;

            PropertyData.MinSeaAttack       = source.roleGeneralProperty.minSeaAttack;
            PropertyData.MaxSeaAttack       = source.roleGeneralProperty.maxSeaAttack;
            PropertyData.MinSubmarineAttack = source.roleGeneralProperty.minSubmarineAttack;
            PropertyData.MaxSubmarineAttack = source.roleGeneralProperty.maxSubmarineAttack;
            PropertyData.SkillAttack        = source.roleGeneralProperty.skillAddition;

            PropertyData.SeaAttack       = (int)(0.5f * (PropertyData.MinSeaAttack + PropertyData.MaxSeaAttack));
            PropertyData.SubmarineAttack = (int)(0.5f * (PropertyData.MinSubmarineAttack + PropertyData.MaxSubmarineAttack));

            // PropertyData.HitRate = source.roleGeneralProperty.hitRate;
            // PropertyData.CritRate = source.roleGeneralProperty.critRate;
            // PropertyData.DodgeRate = source.roleGeneralProperty.dodgeRate;
            PropertyData.Range = source.roleGeneralProperty.range;

            PropertyData.Power           = source.roleGeneralProperty.powerInitial;
            PropertyData.PowerTimeUp     = source.roleGeneralProperty.powerTimeUp;
            PropertyData.PowerAttackUp   = source.roleGeneralProperty.powerAttackUp;
            PropertyData.PowerAttackedUp = source.roleGeneralProperty.powerAttackedUp;

            BasicData.QualityStar = PropertyData.CalculateQualityStar();
        }

        if (null != source.roleGeneralCulture)
        {
            // Train
            if (null == TrainData)
            {
                TrainData = new GeneralTrainData();
            }

            TrainData.TrainCount          = source.roleGeneralCulture.cultureNum;
            TrainData.BaseChivalrousMod   = source.roleGeneralCulture.baseChivalrousMod;
            TrainData.BaseCommandMod      = source.roleGeneralCulture.baseCommandMod;
            TrainData.BaseIntelligenceMod = source.roleGeneralCulture.baseIntelligenceMod;
            TrainData.TempChivalrousMod   = source.roleGeneralCulture.tempChivalrousMod;
            TrainData.TempCommandMod      = source.roleGeneralCulture.tempCommandMod;
            TrainData.TempIntelligenceMod = source.roleGeneralCulture.tempIntelligenceMod;
        }

        if (null != source.roleGeneralPharmacy)
        {
            if (null == PotionData)
            {
                PotionData = new GeneralPotionData();
            }

            PotionData.PotionYongWuLevel[0] = source.roleGeneralPharmacy.pharmacyChivalrous1Num;
            PotionData.PotionYongWuLevel[1] = source.roleGeneralPharmacy.pharmacyChivalrous2Num;
            PotionData.PotionYongWuLevel[2] = source.roleGeneralPharmacy.pharmacyChivalrous3Num;
            PotionData.PotionYongWuLevel[3] = source.roleGeneralPharmacy.pharmacyChivalrous4Num;
            PotionData.PotionYongWuLevel[4] = source.roleGeneralPharmacy.pharmacyChivalrous5Num;
            PotionData.PotionYongWuLevel[5] = source.roleGeneralPharmacy.pharmacyChivalrous6Num;

            PotionData.PotionTongShuaiLevel[0] = source.roleGeneralPharmacy.pharmacyCommand1Num;
            PotionData.PotionTongShuaiLevel[1] = source.roleGeneralPharmacy.pharmacyCommand2Num;
            PotionData.PotionTongShuaiLevel[2] = source.roleGeneralPharmacy.pharmacyCommand3Num;
            PotionData.PotionTongShuaiLevel[3] = source.roleGeneralPharmacy.pharmacyCommand4Num;
            PotionData.PotionTongShuaiLevel[4] = source.roleGeneralPharmacy.pharmacyCommand5Num;
            PotionData.PotionTongShuaiLevel[5] = source.roleGeneralPharmacy.pharmacyCommand6Num;

            PotionData.PotionZhiLiLevel[0] = source.roleGeneralPharmacy.pharmacyIntelligence1Num;
            PotionData.PotionZhiLiLevel[1] = source.roleGeneralPharmacy.pharmacyIntelligence2Num;
            PotionData.PotionZhiLiLevel[2] = source.roleGeneralPharmacy.pharmacyIntelligence3Num;
            PotionData.PotionZhiLiLevel[3] = source.roleGeneralPharmacy.pharmacyIntelligence4Num;
            PotionData.PotionZhiLiLevel[4] = source.roleGeneralPharmacy.pharmacyIntelligence5Num;
            PotionData.PotionZhiLiLevel[5] = source.roleGeneralPharmacy.pharmacyIntelligence6Num;
        }

        if (null != source.roleGeneralSkill)
        {
            SkillDatas.Clear();
            foreach (int id in source.roleGeneralSkill.skillIds)
            {
                SkillData data = new SkillData(id);
                data.FillDataFromConfig();

                SkillDatas[id] = data;
            }
        }

        foreach (sg.Item_Pack info in source.roleGeneralEquipmentList)
        {
            ItemSlotData slotData = new ItemSlotData();
            slotData.UpdateFromServerData(info);
            this.EquipmentDatas[slotData.LocationID] = slotData;
        }

        foreach (sg.Item_Pack info in source.roleGeneralArmySoulList)
        {
            ItemSlotData slotData = new ItemSlotData();
            slotData.UpdateFromServerData(info);
            this.JunHunDatas[slotData.LocationID] = slotData;
        }
    }