示例#1
0
 /// <summary>
 /// 어플리케이션 구동시 불러온 마스터 리스트를 기반으로 데이터를 검색해서 자동으로 세팅.
 /// </summary>
 /// <param name="MasterId"></param>
 /// <returns></returns>
 private WeaponInfo MasterInfoLoad(int MasterId, int paramId)
 {
     if (this.MasterBinList == null)
     {
         return(new WeaponInfo                //스킬 리스트에 직접 접근하지 못하므로 일단 스킬명은 String.Empty로 설정
         {
             MasterId = MasterId,
             IsManual = true,
             attribute = 1,
             WeaponType = 1,
             ItemName = MasterId.ToString(),
             SkillName1 = string.Empty,
             SkillName2 = string.Empty,
             vSkillLv1 = Visibility.Collapsed,
             vSkillLv2 = Visibility.Collapsed,
         });
     }
     if (this.MasterBinList.ContainsKey(MasterId))
     {
         WeaponInfo t = new WeaponInfo();
         t.MasterId   = MasterId;
         t.ParamId    = paramId;
         t.IsManual   = true;
         t.attribute  = this.MasterBinList[MasterId].attribute;
         t.WeaponType = this.MasterBinList[MasterId].WeaponType;
         t.ItemName   = this.MasterBinList[MasterId].ItemName;
         t.SkillName1 = this.MasterBinList[MasterId].SkillName1;
         t.SkillName2 = this.MasterBinList[MasterId].SkillName2;
         t.vSkillLv1  = this.MasterBinList[MasterId].vSkillLv1;
         t.vSkillLv2  = this.MasterBinList[MasterId].vSkillLv2;
         return(t);
     }
     else                      //해당하는 마스터ID가 없는경우 빈 데이터를 출력한다.
     {
         return(new WeaponInfo //스킬 리스트에 직접 접근하지 못하므로 일단 스킬명은 String.Empty로 설정
         {
             MasterId = MasterId,
             IsManual = true,
             attribute = 1,
             WeaponType = 1,
             ItemName = MasterId.ToString(),
             SkillName1 = string.Empty,
             SkillName2 = string.Empty,
             vSkillLv1 = Visibility.Collapsed,
             vSkillLv2 = Visibility.Collapsed,
         });
     }
 }
示例#2
0
        /// <summary>
        /// UI에서 수동으로 설정한 데이터를 bin파일에 저장한다.
        /// </summary>
        /// <param name="data"></param>
        public void MasterInfoSave(WeaponInfo data)
        {
            string MainFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            var    binPath    = Path.Combine(MainFolder, "Data", "MasterWeapon.bin");

            if (!Directory.Exists(Path.Combine(MainFolder, "Data")))
            {
                Directory.CreateDirectory(Path.Combine(MainFolder, "Data"));
            }

            var items = new Dictionary <int, WeaponInfo>(this.MasterBinList);

            if (File.Exists(binPath))                 //파일이 있는경우
            {
                if (items.ContainsKey(data.MasterId)) //키를 가지고 있으면 해당 키에 해당하는 값을 덮어쓰기
                {
                    items[data.MasterId] = data;
                }
                else                //키가 없으면 추가
                {
                    items.Add(data.MasterId, data);
                }
            }
            else            //파일이 없는경우
            {
                items.Add(data.MasterId, data);
            }

            using (var fileStream = new FileStream(binPath, FileMode.Create, FileAccess.Write, FileShare.None))
                using (var writer = new BinaryWriter(fileStream))
                {
                    foreach (var item in items)
                    {
                        writer.Write(item.Key);
                        writer.Write(item.Value.attribute);
                        writer.Write(item.Value.WeaponType);
                        writer.Write(item.Value.ItemName);
                        writer.Write(item.Value.SkillName1);
                        writer.Write(item.Value.SkillName2);
                    }
                    fileStream.Dispose();
                    fileStream.Close();
                    writer.Dispose();
                    writer.Close();
                }
            MasterInfoListLoad();
        }
示例#3
0
 /// <summary>
 /// 무기 정보를 받아 무기의 스킬배수를 계산
 /// </summary>
 /// <param name="General"></param>
 /// <param name="weapon"></param>
 /// <param name="IsSecond"></param>
 private void SumAtt(int General, WeaponInfo weapon, bool IsSecond = false)
 {
     decimal att = 0;
     if (!IsSecond)
     {
         switch (General)
         {
             case 1://공격
                 switch (weapon.AttackType1)
                 {
                     case 1://일반
                         this.SkillCounter.Noramal += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                         break;
                     case 2://언노운
                         this.SkillCounter.Unknown += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                         break;
                     case 3://스트렝스
                         this.SkillCounter.Str += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                         break;
                     case 4://세이빙
                         this.SkillCounter.Saving += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                         break;
                     case 5://마그나
                         this.SkillCounter.Magna += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                         break;
                     case 6://절대치 상승
                         this.SkillCounter.staticAtt += weapon.Skill_Rank1;
                         break;
                     case 7://vis
                         if (weapon.SkillLv1 == 10)
                         {
                             att += 30;
                         }
                         else
                         {
                             att += 20;//기본
                             att += (weapon.SkillLv1 - 1);//스킬레벨
                         }
                         this.VisBahaList.Add(att);
                         this.IsVisExist = true;
                         break;
                     case 8://con
                         if (weapon.SkillLv1 == 10)
                         {
                             att += 15;
                         }
                         else
                         {
                             att += 10;//기본
                             att += (weapon.SkillLv1 - 1) * 0.5m;//스킬레벨 * 0.5
                         }
                         this.ConBahaList.Add(att);
                         this.IsConcilioExist = true;
                         break;
                 }
                 break;
             case 3://배수
                 break;
         }
     }
     else
     {
         switch (General)
         {
             case 1://공격
                 switch (weapon.AttackType2)
                 {
                     case 1://일반
                         this.SkillCounter.Noramal += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                         break;
                     case 2://언노운
                         this.SkillCounter.Unknown += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                         break;
                     case 3://스트렝스
                         this.SkillCounter.Str += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                         break;
                     case 4://세이빙
                         this.SkillCounter.Saving += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                         break;
                     case 5://마그나
                         this.SkillCounter.Magna += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                         break;
                     case 6://절대치 상승
                         this.SkillCounter.staticAtt += weapon.Skill_Rank2;
                         break;
                     case 7://vis
                         if (weapon.SkillLv2 == 10) att += 30;
                         else
                         {
                             att += 20;
                             att += weapon.SkillLv2 - 1;
                         }
                         this.VisBahaList.Add(att);
                         this.IsVisExist = true;
                         break;
                     case 8://con
                         if (weapon.SkillLv2 == 10) att += 15;
                         else
                         {
                             att += 10;
                             att += (weapon.SkillLv2 - 1) * 0.5m;
                         }
                         this.ConBahaList.Add(att);
                         this.IsConcilioExist = true;
                         break;
                 }
                 break;
             case 3://배수
                 break;
         }
     }
 }
示例#4
0
 /// <summary>
 /// 어플리케이션 구동시 불러온 마스터 리스트를 기반으로 데이터를 검색해서 자동으로 세팅.
 /// </summary>
 /// <param name="MasterId"></param>
 /// <returns></returns>
 private WeaponInfo MasterInfoLoad(int MasterId, int paramId)
 {
     if (this.MasterBinList == null)
     {
         return new WeaponInfo//스킬 리스트에 직접 접근하지 못하므로 일단 스킬명은 String.Empty로 설정
         {
             MasterId = MasterId,
             IsManual = true,
             attribute = 1,
             WeaponType = 1,
             ItemName = MasterId.ToString(),
             SkillName1 = string.Empty,
             SkillName2 = string.Empty,
             vSkillLv1 = Visibility.Collapsed,
             vSkillLv2 = Visibility.Collapsed,
         };
     }
     if (this.MasterBinList.ContainsKey(MasterId))
     {
         WeaponInfo t = new WeaponInfo();
         t.MasterId = MasterId;
         t.ParamId = paramId;
         t.IsManual = true;
         t.attribute = this.MasterBinList[MasterId].attribute;
         t.WeaponType = this.MasterBinList[MasterId].WeaponType;
         t.ItemName = this.MasterBinList[MasterId].ItemName;
         t.SkillName1 = this.MasterBinList[MasterId].SkillName1;
         t.SkillName2 = this.MasterBinList[MasterId].SkillName2;
         t.vSkillLv1 = this.MasterBinList[MasterId].vSkillLv1;
         t.vSkillLv2 = this.MasterBinList[MasterId].vSkillLv2;
         return t;
     }
     else//해당하는 마스터ID가 없는경우 빈 데이터를 출력한다.
     {
         return new WeaponInfo//스킬 리스트에 직접 접근하지 못하므로 일단 스킬명은 String.Empty로 설정
         {
             MasterId = MasterId,
             IsManual = true,
             attribute = 1,
             WeaponType = 1,
             ItemName = MasterId.ToString(),
             SkillName1 = string.Empty,
             SkillName2 = string.Empty,
             vSkillLv1 = Visibility.Collapsed,
             vSkillLv2 = Visibility.Collapsed,
         };
     }
 }
示例#5
0
        /// <summary>
        /// 기본 무기 리스트. 강화/리스트/창고가 포함됨
        /// </summary>
        /// <param name="oS"></param>
        private void ListDetail(Session oS)
        {
            this.WeaponListLoad();
            this.ListIsEnd = false;
            this.DeckIsEnd = false;
            if (this.WeaponLists == null)
                this.WeaponLists = new List<WeaponInfo>();
            else
            {
                this.WeaponLists.Clear();
                this.WeaponLists.TrimExcess();
            }
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic test = jsonFull;
            dynamic list = test.list;

            List<dynamic> weaponList = new List<dynamic>();

            for (int i = 0; i < list.Count; i++)
            {
                weaponList.Add(list[i]);
            }

            this.ProgressStatus = new LimitedValue();
            this.ProgressStatus.Max = weaponList.Count;
            this.ProgressStatus.Min = 0;
            this.ProgressStatus.Current = 0;

            this.ProgressBar();

            for (int i = 0; i < weaponList.Count; i++)
            {
                dynamic tempIndex = weaponList[i].master;
                dynamic tempparam = weaponList[i].param;
                WeaponInfo temp = new WeaponInfo();

                temp.MasterId = tempIndex.id;
                temp.ParamId = tempparam.id;//무기 스킬레벨등을 저장하고 구별하기 위한 부분

                temp.ItemName = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponList, "", TranslateKind.Google, temp.MasterId);
                if (temp.ItemName != string.Empty)
                {
                    temp.Element = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.Element, "", TranslateKind.Google, temp.MasterId);
                    temp.Kind = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponType, "", TranslateKind.Google, temp.MasterId);
                }
                else
                {
                    int msid = temp.MasterId;
                    temp = MasterInfoLoad(temp.MasterId, Convert.ToInt32(tempparam.id));

                    if (temp.SkillName1 != string.Empty) temp.SkillDetail1 = GrandcypherClient.Current.Translations.GetSkillInfo(temp.SkillName1, true);
                    else temp.SkillDetail1 = string.Empty;
                    if (temp.SkillName2 != string.Empty) temp.SkillDetail2 = GrandcypherClient.Current.Translations.GetSkillInfo(temp.SkillName2, true);
                    else temp.SkillDetail2 = string.Empty;
                }
                temp.is_used = weaponList[i].is_used;

                temp = this.InputSkillInfo(temp);

                temp.SkillLv1 = WeaponLvLoad(temp.ParamId, 1);
                temp.SkillLv2 = WeaponLvLoad(temp.ParamId, 2);

                if (temp.SkillName1 == string.Empty || temp.SkillName1 == null) temp.vSkillLv1 = Visibility.Collapsed;
                else temp.vSkillLv1 = Visibility.Visible;
                if (temp.SkillName2 == string.Empty || temp.SkillName2 == null) temp.vSkillLv2 = Visibility.Collapsed;
                else temp.vSkillLv2 = Visibility.Visible;

                WeaponLists.Add(temp);
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }
            this.ListIsEnd = true;
            this.LoadingEnd();
        }
示例#6
0
        /// <summary>
        /// 스킬 정보를 분해하여 플래그를 작성해준다
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        private WeaponInfo InputSkillInfo(WeaponInfo info)
        {
            WeaponInfo temp = new WeaponInfo();
            temp = info;

            var skill_name1 = "";
            if (info.SkillName1 != null) skill_name1 = info.SkillName1;
            var skill_name2 = "";
            if (info.SkillName2 != null) skill_name2 = info.SkillName2;
            if (!info.IsManual)
            {
                skill_name1 = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.FirstSkillName, temp.ItemName, 0, temp.MasterId);
                skill_name2 = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.LastSkillName, temp.ItemName, 0, temp.MasterId);
            }

            var spl_data1 = GrandcypherClient.Current.Translations.GetSkillInfo(skill_name1, false, true).Split(';');
            var spl_data2 = GrandcypherClient.Current.Translations.GetSkillInfo(skill_name2, false, true).Split(';');

            temp.SkillName1 = skill_name1;
            temp.SkillName2 = skill_name2;
            temp.SkillDetail1 = GrandcypherClient.Current.Translations.GetSkillInfo(skill_name1, true);
            temp.SkillDetail2 = GrandcypherClient.Current.Translations.GetSkillInfo(skill_name2, true);

            temp.SkillLv1 = WeaponLvLoad(temp.ParamId, 1);
            temp.SkillLv2 = temp.SkillLv1;

            List<int> data = new List<int>();
            List<int> data2 = new List<int>();

            for (int i = 0; i < spl_data1.Count(); i++)
            {
                if (spl_data1[i] != string.Empty) data.Add(Convert.ToInt32(spl_data1[i]));
            }
            for (int i = 0; i < spl_data2.Count(); i++)
            {
                if (spl_data2[i] != string.Empty) data2.Add(Convert.ToInt32(spl_data2[i]));
            }
            for (int i = 0; i < data.Count; i++)
            {
                switch (i)
                {
                    case 0://General
                        if (info.SkillName1 != string.Empty)
                        {
                            info.GeneralType1 = data[i];
                            info.vSkillLv1 = Visibility.Visible;
                        }
                        break;
                    case 1://Attack
                        if (info.SkillName1 != string.Empty) info.AttackType1 = data[i];
                        break;
                    case 2://Attribute
                        if (info.SkillName1 != string.Empty) info.SkillAttribute1 = data[i];
                        break;
                    case 3://IsUnlimited
                        if (info.SkillName1 != string.Empty) info.Is_Unlimited1 = Convert.ToBoolean(data[i]);
                        break;
                    case 4://SkillRank
                        if (info.SkillName1 != string.Empty) info.Skill_Rank1 = data[i];
                        break;
                    case 5://IsDouble
                        if (info.SkillName1 != string.Empty) info.Is_Double1 = Convert.ToBoolean(data[i]);
                        break;
                }
            }
            for (int i = 0; i < data2.Count; i++)
            {
                switch (i)
                {
                    case 0:
                        if (info.SkillName2 != string.Empty)
                        {
                            info.GeneralType2 = data2[i];
                            info.vSkillLv2 = Visibility.Visible;
                        }
                        break;
                    case 1:
                        if (info.SkillName2 != string.Empty) info.AttackType2 = data2[i];
                        break;
                    case 2:
                        if (info.SkillName2 != string.Empty) info.SkillAttribute2 = data2[i];
                        break;
                    case 3:
                        if (info.SkillName2 != string.Empty) info.Is_Unlimited2 = Convert.ToBoolean(data2[i]);
                        break;
                    case 4:
                        if (info.SkillName2 != string.Empty) info.Skill_Rank2 = data2[i];
                        break;
                    case 5:
                        if (info.SkillName2 != string.Empty) info.Is_Double2 = Convert.ToBoolean(data2[i]);
                        break;
                }
            }

            return temp;
        }
示例#7
0
        /// <summary>
        /// 덱 편성 화면. 공인계산기 포함
        /// </summary>
        /// <param name="oS"></param>
        private void DeckDetail(Session oS)
        {
            this.ListIsEnd = false;
            this.DeckIsEnd = false;

            this.WeaponListLoad();
            int MasterAttribute = 0;

            this.SkillCounter = new Skills();
            this.ConBahaList = new List<decimal>();
            this.VisBahaList = new List<decimal>();

            if (this.WeaponLists == null)
                this.WeaponLists = new List<WeaponInfo>();
            else
            {
                this.WeaponLists.Clear();
                this.WeaponLists.TrimExcess();
            }

            if (this.NPCList == null)
                this.NPCList = new List<NpcInfo>();
            else
            {
                this.NPCList.Clear();
                this.NPCList.TrimExcess();
            }

            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic test = jsonFull;
            dynamic list = test.deck.pc.weapons;
            dynamic npcList = test.deck.npc;

            if (test.deck.pc.skill.count > 0)
            {
                this.SkillList = new List<string>();
                dynamic skilllist = test.deck.pc.skill.description;
                foreach (var item in skilllist)
                {
                    JProperty SkillProperty = item;
                    var Firsts = SkillProperty.First;
                    string SkillComment = (string)Firsts["comment"];
                    int over = (int)Firsts["over"];

                    if (over > 1) SkillList.Add("◎ " + GrandcypherClient.Current.ScenarioHooker.Translator(SkillComment, GrandcypherClient.Current.ScenarioHooker.TranslateSite) + " + " + over.ToString());
                    else SkillList.Add("◎ " + GrandcypherClient.Current.ScenarioHooker.Translator(SkillComment, GrandcypherClient.Current.ScenarioHooker.TranslateSite));
                }
            }
            if (test.deck.pc.param.attribute != null)
            {
                MasterAttribute = Convert.ToInt32(test.deck.pc.param.attribute);
            }
            this.ProgressStatus = new LimitedValue();
            this.ProgressStatus.Max = 15;
            this.ProgressStatus.Min = 0;
            this.ProgressStatus.Current = 0;

            //캐릭터의 속성을 구별할 방법이 외부 DB를 추가로 만드는 방법밖에 없기때문에 일단 모두 같은 속성으로 간주.
            //즉 디 오더 그랑데나 속성 불일치 종족파티를 쓰는 유저는 이 계산기를 사용할수없음
            for (int i = 1; i < 6; i++)
            {
                NpcInfo npc = new NpcInfo();
                string temp = i.ToString();
                JObject jobject = (JObject)npcList[temp];
                JObject param;
                JObject master;
                try
                {
                    param = (JObject)jobject["param"];
                    master = (JObject)jobject["master"];
                }
                catch
                {
                    this.NPCList.Add(npc);
                    continue;
                }
                npc.name = (string)master["name"];
                npc.attack = (int)param["attack"];
                this.NPCList.Add(npc);
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }

            for (int i = 1; i < 11; i++)
            {
                WeaponInfo deck = new WeaponInfo();
                string temp = i.ToString();
                JObject jobject = (JObject)list[temp];
                JObject master;
                JObject param;
                try
                {
                    master = (JObject)jobject["master"];
                    param = (JObject)jobject["param"];
                }
                catch
                {
                    deck.vSkillLv1 = Visibility.Collapsed;
                    deck.vSkillLv2 = Visibility.Collapsed;
                    WeaponLists.Add(deck);
                    continue;
                }
                deck.MasterId = (int)master["id"];
                deck.ParamId = (int)param["id"];//무기 스킬레벨등을 저장하고 구별하기 위한 부분
                deck.ItemName = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponList, "", TranslateKind.Google, deck.MasterId);
                if (deck.ItemName == string.Empty)
                {
                    int msid = deck.MasterId;
                    deck = MasterInfoLoad(deck.MasterId, (int)param["id"]);
                    if (deck.SkillName1 != string.Empty) deck.SkillDetail1 = GrandcypherClient.Current.Translations.GetSkillInfo(deck.SkillName1, true);
                    else deck.SkillDetail1 = string.Empty;
                    if (deck.SkillName2 != string.Empty) deck.SkillDetail2 = GrandcypherClient.Current.Translations.GetSkillInfo(deck.SkillName2, true);
                    else deck.SkillDetail2 = string.Empty;
                }
                deck.vSkillLv1 = Visibility.Collapsed;
                deck.vSkillLv2 = Visibility.Collapsed;

                deck = this.InputSkillInfo(deck);
                deck.attribute = (int)master["attribute"];
                if (!deck.IsManual) deck.Kind = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponType, "", TranslateKind.Google, deck.MasterId);

                if (i == 1)
                {
                    MainWeapon = deck;
                }
                else WeaponLists.Add(deck);

                this.ProgressStatus.Current++;
                this.ProgressBar();
            }

            for (int i = 0; i < WeaponLists.Count; i++)
            {
                if (WeaponLists[i].SkillAttribute1 == MasterAttribute
                    || WeaponLists[i].SkillAttribute1 >= 7)
                    this.SumAtt(WeaponLists[i].GeneralType1, WeaponLists[i]);
                if (WeaponLists[i].SkillAttribute2 == MasterAttribute
                    || WeaponLists[i].SkillAttribute2 >= 7)
                    this.SumAtt(WeaponLists[i].GeneralType2, WeaponLists[i], true);
            }
            if (MainWeapon.SkillAttribute1 == MasterAttribute
                || MainWeapon.SkillAttribute1 >= 7)
                this.SumAtt(MainWeapon.GeneralType1, MainWeapon);
            if (MainWeapon.SkillAttribute2 == MasterAttribute
                || MainWeapon.SkillAttribute2 >= 7)
                this.SumAtt(MainWeapon.GeneralType2, MainWeapon, true);

            this.SkillCounter.Baha += this.TotalBaha(this.ConBahaList);
            this.SkillCounter.Baha += this.TotalBaha(this.VisBahaList);

            this.DeckIsEnd = true;
            if (test.deck.pc.param != null) SkillCounter.BasicAttack = test.deck.pc.param.attack;
            this.DeckLoadingEnd();
        }
示例#8
0
        /// <summary>
        /// UI에서 수동으로 설정한 데이터를 bin파일에 저장한다.
        /// </summary>
        /// <param name="data"></param>
        public void MasterInfoSave(WeaponInfo data)
        {
            string MainFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            var binPath = Path.Combine(MainFolder, "Data", "MasterWeapon.bin");
            if (!Directory.Exists(Path.Combine(MainFolder, "Data"))) Directory.CreateDirectory(Path.Combine(MainFolder, "Data"));

            var items = new Dictionary<int, WeaponInfo>(this.MasterBinList);

            if (File.Exists(binPath))//파일이 있는경우
            {
                if (items.ContainsKey(data.MasterId))//키를 가지고 있으면 해당 키에 해당하는 값을 덮어쓰기
                {
                    items[data.MasterId] = data;
                }
                else//키가 없으면 추가
                {
                    items.Add(data.MasterId, data);
                }
            }
            else//파일이 없는경우
            {
                items.Add(data.MasterId, data);
            }

            using (var fileStream = new FileStream(binPath, FileMode.Create, FileAccess.Write, FileShare.None))
            using (var writer = new BinaryWriter(fileStream))
            {
                foreach (var item in items)
                {
                    writer.Write(item.Key);
                    writer.Write(item.Value.attribute);
                    writer.Write(item.Value.WeaponType);
                    writer.Write(item.Value.ItemName);
                    writer.Write(item.Value.SkillName1);
                    writer.Write(item.Value.SkillName2);
                }
                fileStream.Dispose();
                fileStream.Close();
                writer.Dispose();
                writer.Close();
            }
            MasterInfoListLoad();
        }
示例#9
0
        /// <summary>
        /// 마스터 리스트를 불러온다
        /// </summary>
        public void MasterInfoListLoad()
        {
            string MainFolder = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            var binPath = Path.Combine(MainFolder, "Data", "MasterWeapon.bin");

            var items = new Dictionary<int, WeaponInfo>();

            if (File.Exists(binPath))
            {
                var bytes = File.ReadAllBytes(binPath);
                using (var memoryStream = new MemoryStream(bytes))
                using (var reader = new BinaryReader(memoryStream))
                {
                    while (memoryStream.Position < memoryStream.Length)
                    {
                        int paramID = reader.ReadInt32();
                        var item = new WeaponInfo
                        {
                            attribute = reader.ReadInt32(),
                            WeaponType = reader.ReadInt32(),
                            ItemName = reader.ReadString(),
                            SkillName1 = reader.ReadString(),
                            SkillName2 = reader.ReadString(),
                        };
                        items.Add(paramID, item);
                    }
                    memoryStream.Dispose();
                    memoryStream.Close();
                    reader.Dispose();
                    reader.Close();
                }
                //파일 읽기 종료
            }
            this.MasterBinList = items;
        }
示例#10
0
        /// <summary>
        /// 무기 정보를 받아 무기의 스킬배수를 계산
        /// </summary>
        /// <param name="General"></param>
        /// <param name="weapon"></param>
        /// <param name="IsSecond"></param>
        private void SumAtt(int General, WeaponInfo weapon, bool IsSecond = false)
        {
            decimal att = 0;

            if (!IsSecond)
            {
                switch (General)
                {
                case 1:                        //공격
                    switch (weapon.AttackType1)
                    {
                    case 1:                                    //일반
                        this.SkillCounter.Noramal += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                        break;

                    case 2:                                    //언노운
                        this.SkillCounter.Unknown += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                        break;

                    case 3:                                    //스트렝스
                        this.SkillCounter.Str += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                        break;

                    case 4:                                    //세이빙
                        this.SkillCounter.Saving += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                        break;

                    case 5:                                    //마그나
                        this.SkillCounter.Magna += this.RaiseSkillLevel(weapon.Skill_Rank1, weapon.SkillLv1, weapon.Is_Double1);
                        break;

                    case 6:                                    //절대치 상승
                        this.SkillCounter.staticAtt += weapon.Skill_Rank1;
                        break;

                    case 7:                                    //vis
                        if (weapon.SkillLv1 == 10)
                        {
                            att += 30;
                        }
                        else
                        {
                            att += 20;                                            //기본
                            att += (weapon.SkillLv1 - 1);                         //스킬레벨
                        }
                        this.VisBahaList.Add(att);
                        this.IsVisExist = true;
                        break;

                    case 8:                                    //con
                        if (weapon.SkillLv1 == 10)
                        {
                            att += 15;
                        }
                        else
                        {
                            att += 10;                                            //기본
                            att += (weapon.SkillLv1 - 1) * 0.5m;                  //스킬레벨 * 0.5
                        }
                        this.ConBahaList.Add(att);
                        this.IsConcilioExist = true;
                        break;
                    }
                    break;

                case 3:                        //배수
                    break;
                }
            }
            else
            {
                switch (General)
                {
                case 1:                        //공격
                    switch (weapon.AttackType2)
                    {
                    case 1:                                    //일반
                        this.SkillCounter.Noramal += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                        break;

                    case 2:                                    //언노운
                        this.SkillCounter.Unknown += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                        break;

                    case 3:                                    //스트렝스
                        this.SkillCounter.Str += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                        break;

                    case 4:                                    //세이빙
                        this.SkillCounter.Saving += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                        break;

                    case 5:                                    //마그나
                        this.SkillCounter.Magna += this.RaiseSkillLevel(weapon.Skill_Rank2, weapon.SkillLv2, weapon.Is_Double2);
                        break;

                    case 6:                                    //절대치 상승
                        this.SkillCounter.staticAtt += weapon.Skill_Rank2;
                        break;

                    case 7:                                    //vis
                        if (weapon.SkillLv2 == 10)
                        {
                            att += 30;
                        }
                        else
                        {
                            att += 20;
                            att += weapon.SkillLv2 - 1;
                        }
                        this.VisBahaList.Add(att);
                        this.IsVisExist = true;
                        break;

                    case 8:                                    //con
                        if (weapon.SkillLv2 == 10)
                        {
                            att += 15;
                        }
                        else
                        {
                            att += 10;
                            att += (weapon.SkillLv2 - 1) * 0.5m;
                        }
                        this.ConBahaList.Add(att);
                        this.IsConcilioExist = true;
                        break;
                    }
                    break;

                case 3:                        //배수
                    break;
                }
            }
        }
示例#11
0
        /// <summary>
        /// 덱 편성 화면. 공인계산기 포함
        /// </summary>
        /// <param name="oS"></param>
        private void DeckDetail(Session oS)
        {
            this.ListIsEnd = false;
            this.DeckIsEnd = false;

            this.WeaponListLoad();
            int MasterAttribute = 0;

            this.SkillCounter = new Skills();
            this.ConBahaList  = new List <decimal>();
            this.VisBahaList  = new List <decimal>();

            if (this.WeaponLists == null)
            {
                this.WeaponLists = new List <WeaponInfo>();
            }
            else
            {
                this.WeaponLists.Clear();
                this.WeaponLists.TrimExcess();
            }

            if (this.NPCList == null)
            {
                this.NPCList = new List <NpcInfo>();
            }
            else
            {
                this.NPCList.Clear();
                this.NPCList.TrimExcess();
            }

            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic test     = jsonFull;
            dynamic list     = test.deck.pc.weapons;
            dynamic npcList  = test.deck.npc;

            if (test.deck.pc.skill.count > 0)
            {
                this.SkillList = new List <string>();
                dynamic skilllist = test.deck.pc.skill.description;
                foreach (var item in skilllist)
                {
                    JProperty SkillProperty = item;
                    var       Firsts        = SkillProperty.First;
                    string    SkillComment  = (string)Firsts["comment"];
                    int       over          = (int)Firsts["over"];

                    if (over > 1)
                    {
                        SkillList.Add("◎ " + GrandcypherClient.Current.ScenarioHooker.Translator(SkillComment, GrandcypherClient.Current.ScenarioHooker.TranslateSite) + " + " + over.ToString());
                    }
                    else
                    {
                        SkillList.Add("◎ " + GrandcypherClient.Current.ScenarioHooker.Translator(SkillComment, GrandcypherClient.Current.ScenarioHooker.TranslateSite));
                    }
                }
            }
            if (test.deck.pc.param.attribute != null)
            {
                MasterAttribute = Convert.ToInt32(test.deck.pc.param.attribute);
            }
            this.ProgressStatus         = new LimitedValue();
            this.ProgressStatus.Max     = 15;
            this.ProgressStatus.Min     = 0;
            this.ProgressStatus.Current = 0;

            //캐릭터의 속성을 구별할 방법이 외부 DB를 추가로 만드는 방법밖에 없기때문에 일단 모두 같은 속성으로 간주.
            //즉 디 오더 그랑데나 속성 불일치 종족파티를 쓰는 유저는 이 계산기를 사용할수없음
            for (int i = 1; i < 6; i++)
            {
                NpcInfo npc     = new NpcInfo();
                string  temp    = i.ToString();
                JObject jobject = (JObject)npcList[temp];
                JObject param;
                JObject master;
                try
                {
                    param  = (JObject)jobject["param"];
                    master = (JObject)jobject["master"];
                }
                catch
                {
                    this.NPCList.Add(npc);
                    continue;
                }
                npc.name   = (string)master["name"];
                npc.attack = (int)param["attack"];
                this.NPCList.Add(npc);
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }

            for (int i = 1; i < 11; i++)
            {
                WeaponInfo deck    = new WeaponInfo();
                string     temp    = i.ToString();
                JObject    jobject = (JObject)list[temp];
                JObject    master;
                JObject    param;
                try
                {
                    master = (JObject)jobject["master"];
                    param  = (JObject)jobject["param"];
                }
                catch
                {
                    deck.vSkillLv1 = Visibility.Collapsed;
                    deck.vSkillLv2 = Visibility.Collapsed;
                    WeaponLists.Add(deck);
                    continue;
                }
                deck.MasterId = (int)master["id"];
                deck.ParamId  = (int)param["id"];               //무기 스킬레벨등을 저장하고 구별하기 위한 부분
                deck.ItemName = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponList, "", TranslateKind.Google, deck.MasterId);
                if (deck.ItemName == string.Empty)
                {
                    int msid = deck.MasterId;
                    deck = MasterInfoLoad(deck.MasterId, (int)param["id"]);
                    if (deck.SkillName1 != string.Empty)
                    {
                        deck.SkillDetail1 = GrandcypherClient.Current.Translations.GetSkillInfo(deck.SkillName1, true);
                    }
                    else
                    {
                        deck.SkillDetail1 = string.Empty;
                    }
                    if (deck.SkillName2 != string.Empty)
                    {
                        deck.SkillDetail2 = GrandcypherClient.Current.Translations.GetSkillInfo(deck.SkillName2, true);
                    }
                    else
                    {
                        deck.SkillDetail2 = string.Empty;
                    }
                }
                deck.vSkillLv1 = Visibility.Collapsed;
                deck.vSkillLv2 = Visibility.Collapsed;

                deck           = this.InputSkillInfo(deck);
                deck.attribute = (int)master["attribute"];
                if (!deck.IsManual)
                {
                    deck.Kind = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponType, "", TranslateKind.Google, deck.MasterId);
                }

                if (i == 1)
                {
                    MainWeapon = deck;
                }
                else
                {
                    WeaponLists.Add(deck);
                }

                this.ProgressStatus.Current++;
                this.ProgressBar();
            }


            for (int i = 0; i < WeaponLists.Count; i++)
            {
                if (WeaponLists[i].SkillAttribute1 == MasterAttribute ||
                    WeaponLists[i].SkillAttribute1 >= 7)
                {
                    this.SumAtt(WeaponLists[i].GeneralType1, WeaponLists[i]);
                }
                if (WeaponLists[i].SkillAttribute2 == MasterAttribute ||
                    WeaponLists[i].SkillAttribute2 >= 7)
                {
                    this.SumAtt(WeaponLists[i].GeneralType2, WeaponLists[i], true);
                }
            }
            if (MainWeapon.SkillAttribute1 == MasterAttribute ||
                MainWeapon.SkillAttribute1 >= 7)
            {
                this.SumAtt(MainWeapon.GeneralType1, MainWeapon);
            }
            if (MainWeapon.SkillAttribute2 == MasterAttribute ||
                MainWeapon.SkillAttribute2 >= 7)
            {
                this.SumAtt(MainWeapon.GeneralType2, MainWeapon, true);
            }

            this.SkillCounter.Baha += this.TotalBaha(this.ConBahaList);
            this.SkillCounter.Baha += this.TotalBaha(this.VisBahaList);

            this.DeckIsEnd = true;
            if (test.deck.pc.param != null)
            {
                SkillCounter.BasicAttack = test.deck.pc.param.attack;
            }
            this.DeckLoadingEnd();
        }
示例#12
0
        /// <summary>
        /// 기본 무기 리스트. 강화/리스트/창고가 포함됨
        /// </summary>
        /// <param name="oS"></param>

        private void ListDetail(Session oS)
        {
            this.WeaponListLoad();
            this.ListIsEnd = false;
            this.DeckIsEnd = false;
            if (this.WeaponLists == null)
            {
                this.WeaponLists = new List <WeaponInfo>();
            }
            else
            {
                this.WeaponLists.Clear();
                this.WeaponLists.TrimExcess();
            }
            JObject jsonFull = JObject.Parse(oS.GetResponseBodyAsString()) as JObject;
            dynamic test     = jsonFull;
            dynamic list     = test.list;


            List <dynamic> weaponList = new List <dynamic>();

            for (int i = 0; i < list.Count; i++)
            {
                weaponList.Add(list[i]);
            }

            this.ProgressStatus         = new LimitedValue();
            this.ProgressStatus.Max     = weaponList.Count;
            this.ProgressStatus.Min     = 0;
            this.ProgressStatus.Current = 0;

            this.ProgressBar();

            for (int i = 0; i < weaponList.Count; i++)
            {
                dynamic    tempIndex = weaponList[i].master;
                dynamic    tempparam = weaponList[i].param;
                WeaponInfo temp      = new WeaponInfo();

                temp.MasterId = tempIndex.id;
                temp.ParamId  = tempparam.id;               //무기 스킬레벨등을 저장하고 구별하기 위한 부분

                temp.ItemName = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponList, "", TranslateKind.Google, temp.MasterId);
                if (temp.ItemName != string.Empty)
                {
                    temp.Element = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.Element, "", TranslateKind.Google, temp.MasterId);
                    temp.Kind    = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.WeaponType, "", TranslateKind.Google, temp.MasterId);
                }
                else
                {
                    int msid = temp.MasterId;
                    temp = MasterInfoLoad(temp.MasterId, Convert.ToInt32(tempparam.id));

                    if (temp.SkillName1 != string.Empty)
                    {
                        temp.SkillDetail1 = GrandcypherClient.Current.Translations.GetSkillInfo(temp.SkillName1, true);
                    }
                    else
                    {
                        temp.SkillDetail1 = string.Empty;
                    }
                    if (temp.SkillName2 != string.Empty)
                    {
                        temp.SkillDetail2 = GrandcypherClient.Current.Translations.GetSkillInfo(temp.SkillName2, true);
                    }
                    else
                    {
                        temp.SkillDetail2 = string.Empty;
                    }
                }
                temp.is_used = weaponList[i].is_used;

                temp = this.InputSkillInfo(temp);

                temp.SkillLv1 = WeaponLvLoad(temp.ParamId, 1);
                temp.SkillLv2 = WeaponLvLoad(temp.ParamId, 2);

                if (temp.SkillName1 == string.Empty || temp.SkillName1 == null)
                {
                    temp.vSkillLv1 = Visibility.Collapsed;
                }
                else
                {
                    temp.vSkillLv1 = Visibility.Visible;
                }
                if (temp.SkillName2 == string.Empty || temp.SkillName2 == null)
                {
                    temp.vSkillLv2 = Visibility.Collapsed;
                }
                else
                {
                    temp.vSkillLv2 = Visibility.Visible;
                }

                WeaponLists.Add(temp);
                this.ProgressStatus.Current++;
                this.ProgressBar();
            }
            this.ListIsEnd = true;
            this.LoadingEnd();
        }
示例#13
0
        /// <summary>
        /// 스킬 정보를 분해하여 플래그를 작성해준다
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        private WeaponInfo InputSkillInfo(WeaponInfo info)
        {
            WeaponInfo temp = new WeaponInfo();

            temp = info;

            var skill_name1 = "";

            if (info.SkillName1 != null)
            {
                skill_name1 = info.SkillName1;
            }
            var skill_name2 = "";

            if (info.SkillName2 != null)
            {
                skill_name2 = info.SkillName2;
            }
            if (!info.IsManual)
            {
                skill_name1 = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.FirstSkillName, temp.ItemName, 0, temp.MasterId);
                skill_name2 = GrandcypherClient.Current.Translations.GetTranslation(Translations.TranslationType.LastSkillName, temp.ItemName, 0, temp.MasterId);
            }

            var spl_data1 = GrandcypherClient.Current.Translations.GetSkillInfo(skill_name1, false, true).Split(';');
            var spl_data2 = GrandcypherClient.Current.Translations.GetSkillInfo(skill_name2, false, true).Split(';');

            temp.SkillName1   = skill_name1;
            temp.SkillName2   = skill_name2;
            temp.SkillDetail1 = GrandcypherClient.Current.Translations.GetSkillInfo(skill_name1, true);
            temp.SkillDetail2 = GrandcypherClient.Current.Translations.GetSkillInfo(skill_name2, true);

            temp.SkillLv1 = WeaponLvLoad(temp.ParamId, 1);
            temp.SkillLv2 = temp.SkillLv1;


            List <int> data  = new List <int>();
            List <int> data2 = new List <int>();

            for (int i = 0; i < spl_data1.Count(); i++)
            {
                if (spl_data1[i] != string.Empty)
                {
                    data.Add(Convert.ToInt32(spl_data1[i]));
                }
            }
            for (int i = 0; i < spl_data2.Count(); i++)
            {
                if (spl_data2[i] != string.Empty)
                {
                    data2.Add(Convert.ToInt32(spl_data2[i]));
                }
            }
            for (int i = 0; i < data.Count; i++)
            {
                switch (i)
                {
                case 0:                        //General
                    if (info.SkillName1 != string.Empty)
                    {
                        info.GeneralType1 = data[i];
                        info.vSkillLv1    = Visibility.Visible;
                    }
                    break;

                case 1:                        //Attack
                    if (info.SkillName1 != string.Empty)
                    {
                        info.AttackType1 = data[i];
                    }
                    break;

                case 2:                        //Attribute
                    if (info.SkillName1 != string.Empty)
                    {
                        info.SkillAttribute1 = data[i];
                    }
                    break;

                case 3:                        //IsUnlimited
                    if (info.SkillName1 != string.Empty)
                    {
                        info.Is_Unlimited1 = Convert.ToBoolean(data[i]);
                    }
                    break;

                case 4:                        //SkillRank
                    if (info.SkillName1 != string.Empty)
                    {
                        info.Skill_Rank1 = data[i];
                    }
                    break;

                case 5:                        //IsDouble
                    if (info.SkillName1 != string.Empty)
                    {
                        info.Is_Double1 = Convert.ToBoolean(data[i]);
                    }
                    break;
                }
            }
            for (int i = 0; i < data2.Count; i++)
            {
                switch (i)
                {
                case 0:
                    if (info.SkillName2 != string.Empty)
                    {
                        info.GeneralType2 = data2[i];
                        info.vSkillLv2    = Visibility.Visible;
                    }
                    break;

                case 1:
                    if (info.SkillName2 != string.Empty)
                    {
                        info.AttackType2 = data2[i];
                    }
                    break;

                case 2:
                    if (info.SkillName2 != string.Empty)
                    {
                        info.SkillAttribute2 = data2[i];
                    }
                    break;

                case 3:
                    if (info.SkillName2 != string.Empty)
                    {
                        info.Is_Unlimited2 = Convert.ToBoolean(data2[i]);
                    }
                    break;

                case 4:
                    if (info.SkillName2 != string.Empty)
                    {
                        info.Skill_Rank2 = data2[i];
                    }
                    break;

                case 5:
                    if (info.SkillName2 != string.Empty)
                    {
                        info.Is_Double2 = Convert.ToBoolean(data2[i]);
                    }
                    break;
                }
            }

            return(temp);
        }
        public void SaveData()
        {
            if (this.SelectedMasterId < 1) return;
            WeaponInfo temp = new WeaponInfo
            {
                MasterId = this.SelectedMasterId,
                ItemName = this.ItemName,
                attribute = AttributeTable[this.SelectedAttribute],
                WeaponType = WeaponKindTable[this.SelectedWeaponKind],
            };
            if (this.SkillName1 != null) temp.SkillName1 = this.SkillName1;
            else temp.SkillName1 = string.Empty;
            if (this.SkillName2 != null) temp.SkillName2 = this.SkillName2;
            else temp.SkillName2 = string.Empty;

            if (this.SelectedDetail1 != null) temp.SkillDetail1 = this.SelectedDetail1;
            if (this.SelectedDetail2 != null) temp.SkillDetail2 = this.SelectedDetail2;

            GrandcypherClient.Current.WeaponHooker.MasterInfoSave(temp);
            GrandcypherClient.Current.WeaponHooker.Reload();
        }