private QuestProgressKinds setProgress() { if (this.State == QuestState.COMPLETE) { return(QuestProgressKinds.NOT_DISP); } Mst_questcount mst_questcount = null; if (!Mst_DataManager.Instance.Mst_questcount.TryGetValue(this.No, ref mst_questcount)) { return(QuestProgressKinds.NOT_DISP); } double num = 0.0; if (mst_questcount.Counter_id.get_Count() != mst_questcount.Clear_num.get_Count()) { double num2 = 0.0; Mem_questcount mem_questcount = null; using (HashSet <int> .Enumerator enumerator = mst_questcount.Counter_id.GetEnumerator()) { while (enumerator.MoveNext()) { int current = enumerator.get_Current(); if (Comm_UserDatas.Instance.User_questcount.TryGetValue(current, ref mem_questcount)) { num2 += (double)mem_questcount.Value; } } } double num3 = (double)Enumerable.First <int>(mst_questcount.Clear_num.get_Values()); num = num2 / num3; return(this.getprogress(num)); } using (HashSet <int> .Enumerator enumerator2 = mst_questcount.Counter_id.GetEnumerator()) { while (enumerator2.MoveNext()) { int current2 = enumerator2.get_Current(); double num4 = 0.0; Mem_questcount mem_questcount2 = null; if (Comm_UserDatas.Instance.User_questcount.TryGetValue(current2, ref mem_questcount2)) { num4 = (double)mem_questcount2.Value; } double num5 = (double)mst_questcount.Clear_num.get_Item(current2); double num6 = num4 / num5; if (num6 >= 1.0) { num6 = 1.0; } num += num6; } } num /= (double)mst_questcount.Counter_id.get_Count(); return(this.getprogress(num)); }
private QuestProgressKinds setProgress() { if (State == QuestState.COMPLETE) { return(QuestProgressKinds.NOT_DISP); } Mst_questcount value = null; if (!Mst_DataManager.Instance.Mst_questcount.TryGetValue(No, out value)) { return(QuestProgressKinds.NOT_DISP); } double num = 0.0; if (value.Counter_id.Count != value.Clear_num.Count) { double num2 = 0.0; Mem_questcount value2 = null; foreach (int item in value.Counter_id) { if (Comm_UserDatas.Instance.User_questcount.TryGetValue(item, out value2)) { num2 += (double)value2.Value; } } double num3 = value.Clear_num.Values.First(); num = num2 / num3; return(getprogress(num)); } foreach (int item2 in value.Counter_id) { double num4 = 0.0; Mem_questcount value3 = null; if (Comm_UserDatas.Instance.User_questcount.TryGetValue(item2, out value3)) { num4 = value3.Value; } double num5 = value.Clear_num[item2]; double num6 = num4 / num5; if (num6 >= 1.0) { num6 = 1.0; } num += num6; } num /= (double)value.Counter_id.Count; return(getprogress(num)); }
public bool Debug_StateChange(int no) { Mem_quest mem_quest = null; if (!Comm_UserDatas.Instance.User_quest.TryGetValue(no, ref mem_quest)) { return(false); } if (mem_quest.State != QuestState.RUNNING) { return(false); } mem_quest.StateChange(this, QuestState.COMPLETE); Mst_questcount mst_questcount = null; if (!Mst_DataManager.Instance.Mst_questcount.TryGetValue(mem_quest.Rid, ref mst_questcount)) { return(true); } using (Dictionary <int, int> .Enumerator enumerator = mst_questcount.Clear_num.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <int, int> current = enumerator.get_Current(); Mem_questcount mem_questcount = null; if (!Comm_UserDatas.Instance.User_questcount.TryGetValue(current.get_Key(), ref mem_questcount)) { mem_questcount = new Mem_questcount(current.get_Key(), current.get_Value()); Comm_UserDatas.Instance.User_questcount.Add(current.get_Key(), mem_questcount); } else { int num = current.get_Value() - mem_questcount.Value; if (num > 0) { mem_questcount.AddCount(num); } } } } return(true); }
public bool Debug_StateChange(int no) { Mem_quest value = null; if (!Comm_UserDatas.Instance.User_quest.TryGetValue(no, out value)) { return(false); } if (value.State != QuestState.RUNNING) { return(false); } value.StateChange(this, QuestState.COMPLETE); Mst_questcount value2 = null; if (!Mst_DataManager.Instance.Mst_questcount.TryGetValue(value.Rid, out value2)) { return(true); } foreach (KeyValuePair <int, int> item in value2.Clear_num) { Mem_questcount value3 = null; if (!Comm_UserDatas.Instance.User_questcount.TryGetValue(item.Key, out value3)) { value3 = new Mem_questcount(item.Key, item.Value); Comm_UserDatas.Instance.User_questcount.Add(item.Key, value3); } else { int num = item.Value - value3.Value; if (num > 0) { value3.AddCount(num); } } } return(true); }
private void slotModelChangeQuestNormalize(Mem_ship flagShip, Mem_quest mem_quest, Mst_quest mst_quest, User_QuestFmt changeFmt) { HashSet <int> hashSet = new HashSet <int>(); if (mem_quest.State == QuestState.COMPLETE) { if (mst_quest.Get_1_type == 15) { hashSet.Add(mst_quest.Get_1_id); } if (mst_quest.Get_2_type == 15) { hashSet.Add(mst_quest.Get_2_id); } } if (hashSet.Count == 0) { return; } Mst_questcount value = null; Mst_DataManager.Instance.Mst_questcount.TryGetValue(mem_quest.Rid, out value); HashSet <int> hashSet2 = new HashSet <int>(); bool flag = false; foreach (int item2 in hashSet) { int mst_id = mst_slotitemchange[item2][0]; bool maxFlag = mst_quest.IsLevelMax(mst_slotitemchange[item2]); if (mst_quest.IsUseCrew(mst_slotitemchange[item2])) { flag = true; } int item = findModelChangeEnableSlotPos(flagShip.Slot, mst_id, maxFlag); hashSet2.Add(item); } if (flag) { int num = 0; Mem_useitem value2 = null; if (Comm_UserDatas.Instance.User_useItem.TryGetValue(70, out value2)) { num = value2.Value; } if (num == 0) { hashSet2.Add(-1); } } List <string> requireShip = QuestKousyou.GetRequireShip(mem_quest.Rid); if (requireShip.Count > 0) { string yomi = Mst_DataManager.Instance.Mst_ship[flagShip.Ship_id].Yomi; if (!requireShip.Any((string x) => x.Equals(yomi))) { hashSet2.Add(-1); } } if (hashSet2.Contains(-1)) { mem_quest.StateChange(this, QuestState.WAITING_START); changeFmt.State = mem_quest.State; if (value != null) { foreach (int item3 in value.Counter_id) { Mem_questcount value3 = null; if (Comm_UserDatas.Instance.User_questcount.TryGetValue(item3, out value3)) { value3.Reset(deleteFlag: false); } } } } else if (hashSet2.Contains(-2)) { changeFmt.InvalidFlag = true; } }
public List <QuestItemGetFmt> ClearItemGet(User_QuestFmt fmt) { Mem_quest value = null; if (!Comm_UserDatas.Instance.User_quest.TryGetValue(fmt.No, out value)) { return(null); } if (value.State != QuestState.COMPLETE) { return(null); } value.StateChange(this, QuestState.END); Mst_questcount value2 = null; if (Mst_DataManager.Instance.Mst_questcount.TryGetValue(value.Rid, out value2)) { foreach (KeyValuePair <int, bool> item in value2.Reset_flag) { if (item.Value) { Mem_questcount value3 = null; if (Comm_UserDatas.Instance.User_questcount.TryGetValue(item.Key, out value3)) { value3.Reset(deleteFlag: true); } } } } Mst_quest mst_quest = this.mst_quest[fmt.No]; List <QuestItemGetFmt> list = new List <QuestItemGetFmt>(); foreach (KeyValuePair <enumMaterialCategory, int> item2 in fmt.GetMaterial) { if (item2.Key <= enumMaterialCategory.Bauxite) { list.Add(_ItemGet(item2.Key, item2.Value)); } } int slotModelChangeId = mst_quest.GetSlotModelChangeId(1); int slotModelChangeId2 = mst_quest.GetSlotModelChangeId(2); bool useCrewFlag = false; bool maxExpFlag = false; if (slotModelChangeId > 0) { maxExpFlag = mst_quest.IsLevelMax(mst_slotitemchange[slotModelChangeId]); useCrewFlag = mst_quest.IsUseCrew(mst_slotitemchange[slotModelChangeId]); } list.Add(_ItemGet(mst_quest.Get_1_type, mst_quest.Get_1_id, mst_quest.Get_1_count, maxExpFlag, useCrewFlag)); bool useCrewFlag2 = false; bool maxExpFlag2 = false; if (slotModelChangeId2 > 0) { maxExpFlag2 = mst_quest.IsLevelMax(mst_slotitemchange[slotModelChangeId2]); useCrewFlag2 = mst_quest.IsUseCrew(mst_slotitemchange[slotModelChangeId2]); } list.Add(_ItemGet(mst_quest.Get_2_type, mst_quest.Get_2_id, mst_quest.Get_2_count, maxExpFlag2, useCrewFlag2)); return(list.FindAll((QuestItemGetFmt item) => item != null)); }
private void slotModelChangeQuestNormalize(Mem_ship flagShip, Mem_quest mem_quest, Mst_quest mst_quest, User_QuestFmt changeFmt) { HashSet <int> hashSet = new HashSet <int>(); if (mem_quest.State == QuestState.COMPLETE) { if (mst_quest.Get_1_type == 15) { hashSet.Add(mst_quest.Get_1_id); } if (mst_quest.Get_2_type == 15) { hashSet.Add(mst_quest.Get_2_id); } } if (hashSet.get_Count() == 0) { return; } Mst_questcount mst_questcount = null; Mst_DataManager.Instance.Mst_questcount.TryGetValue(mem_quest.Rid, ref mst_questcount); HashSet <int> hashSet2 = new HashSet <int>(); bool flag = false; using (HashSet <int> .Enumerator enumerator = hashSet.GetEnumerator()) { while (enumerator.MoveNext()) { int current = enumerator.get_Current(); int mst_id = this.mst_slotitemchange.get_Item(current).get_Item(0); bool maxFlag = mst_quest.IsLevelMax(this.mst_slotitemchange.get_Item(current)); if (mst_quest.IsUseCrew(this.mst_slotitemchange.get_Item(current))) { flag = true; } int num = this.findModelChangeEnableSlotPos(flagShip.Slot, mst_id, maxFlag); hashSet2.Add(num); } } if (flag) { int num2 = 0; Mem_useitem mem_useitem = null; if (Comm_UserDatas.Instance.User_useItem.TryGetValue(70, ref mem_useitem)) { num2 = mem_useitem.Value; } if (num2 == 0) { hashSet2.Add(-1); } } List <string> requireShip = QuestKousyou.GetRequireShip(mem_quest.Rid); if (requireShip.get_Count() > 0) { string yomi = Mst_DataManager.Instance.Mst_ship.get_Item(flagShip.Ship_id).Yomi; if (!Enumerable.Any <string>(requireShip, (string x) => x.Equals(yomi))) { hashSet2.Add(-1); } } if (hashSet2.Contains(-1)) { mem_quest.StateChange(this, QuestState.WAITING_START); changeFmt.State = mem_quest.State; if (mst_questcount == null) { return; } using (HashSet <int> .Enumerator enumerator2 = mst_questcount.Counter_id.GetEnumerator()) { while (enumerator2.MoveNext()) { int current2 = enumerator2.get_Current(); Mem_questcount mem_questcount = null; if (Comm_UserDatas.Instance.User_questcount.TryGetValue(current2, ref mem_questcount)) { mem_questcount.Reset(false); } } } } else if (hashSet2.Contains(-2)) { changeFmt.InvalidFlag = true; } }
public List <QuestItemGetFmt> ClearItemGet(User_QuestFmt fmt) { Mem_quest mem_quest = null; if (!Comm_UserDatas.Instance.User_quest.TryGetValue(fmt.No, ref mem_quest)) { return(null); } if (mem_quest.State != QuestState.COMPLETE) { return(null); } mem_quest.StateChange(this, QuestState.END); Mst_questcount mst_questcount = null; if (Mst_DataManager.Instance.Mst_questcount.TryGetValue(mem_quest.Rid, ref mst_questcount)) { using (Dictionary <int, bool> .Enumerator enumerator = mst_questcount.Reset_flag.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <int, bool> current = enumerator.get_Current(); if (current.get_Value()) { Mem_questcount mem_questcount = null; if (Comm_UserDatas.Instance.User_questcount.TryGetValue(current.get_Key(), ref mem_questcount)) { mem_questcount.Reset(true); } } } } } Mst_quest mst_quest = this.mst_quest.get_Item(fmt.No); List <QuestItemGetFmt> list = new List <QuestItemGetFmt>(); using (Dictionary <enumMaterialCategory, int> .Enumerator enumerator2 = fmt.GetMaterial.GetEnumerator()) { while (enumerator2.MoveNext()) { KeyValuePair <enumMaterialCategory, int> current2 = enumerator2.get_Current(); if (current2.get_Key() <= enumMaterialCategory.Bauxite) { list.Add(this._ItemGet(current2.get_Key(), current2.get_Value())); } } } int slotModelChangeId = mst_quest.GetSlotModelChangeId(1); int slotModelChangeId2 = mst_quest.GetSlotModelChangeId(2); bool useCrewFlag = false; bool maxExpFlag = false; if (slotModelChangeId > 0) { maxExpFlag = mst_quest.IsLevelMax(this.mst_slotitemchange.get_Item(slotModelChangeId)); useCrewFlag = mst_quest.IsUseCrew(this.mst_slotitemchange.get_Item(slotModelChangeId)); } list.Add(this._ItemGet(mst_quest.Get_1_type, mst_quest.Get_1_id, mst_quest.Get_1_count, maxExpFlag, useCrewFlag)); bool useCrewFlag2 = false; bool maxExpFlag2 = false; if (slotModelChangeId2 > 0) { maxExpFlag2 = mst_quest.IsLevelMax(this.mst_slotitemchange.get_Item(slotModelChangeId2)); useCrewFlag2 = mst_quest.IsUseCrew(this.mst_slotitemchange.get_Item(slotModelChangeId2)); } list.Add(this._ItemGet(mst_quest.Get_2_type, mst_quest.Get_2_id, mst_quest.Get_2_count, maxExpFlag2, useCrewFlag2)); list = list.FindAll((QuestItemGetFmt item) => item != null); return(list); }