public bool CheckCopy(ECopyType copyType, int chapter, int copyID) { int key = (int)copyType; DWorld db = ReadCfgWorld.GetDataById(chapter); if (DataDBSRaid.ContainsKey(key)) { XRaid raid = DataDBSRaid.GetDataById(key); if (chapter > raid.MaxChapter) { if (chapter != raid.MaxChapter + 1) { GTItemHelper.ShowTip(string.Format("章节超出限制:{0}/{1}", chapter, raid.MaxChapter)); return(false); } if (copyID != db.Copys[0]) { GTItemHelper.ShowTip("非法CopyID" + copyID); return(false); } } else if (chapter == raid.MaxChapter) { if (copyID > raid.MaxCopyId + 1) { GTItemHelper.ShowTip("非法CopyID" + copyID); return(false); } } } return(true); }
public int GetMaxCopyIdByCopyType(ECopyType copyType) { int key = (int)copyType; XRaid raid = DataDBSRaid.GetDataById(key); return(raid == null ? 0 : raid.MaxCopyId); }
public int GetMaxChapterByCopyType(ECopyType copyType) { int key = (int)copyType; XRaid raid = DataDBSRaid.GetDataById(key); return(raid == null ? DWorld.WORLD_ST_CHAPTER_ID : raid.MaxChapter); }
public int GetMaxCanEnterChapter(int difficulty) { int chapter = 0; if (DataDBSRaid.ContainsKey(difficulty)) { XRaid raid = DataDBSRaid.GetDataById(difficulty); DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(raid.MaxChapter); if (chapterDB.Copys[chapterDB.Copys.Length - 1] == raid.MaxCopyId) { chapter = GetNextChapter(raid.MaxChapter); } else { chapter = raid.MaxChapter; } } else { chapter = DCopyMainChapter.MAINCOPY_ST_CHAPTER_ID; } return(chapter); }
public int GetMaxCanEnterChapter(ECopyType copyType) { int key = (int)copyType; int chapter = 0; if (DataDBSRaid.ContainsKey(key)) { XRaid raid = DataDBSRaid.GetDataById(key); DWorld chapterDB = ReadCfgWorld.GetDataById(raid.MaxChapter); if (chapterDB.Copys[chapterDB.Copys.Length - 1] == raid.MaxCopyId) { chapter = GetNextChapter(raid.MaxChapter); } else { chapter = raid.MaxChapter; } } else { chapter = DWorld.WORLD_ST_CHAPTER_ID; } return(chapter); }
private void OnAck_PassCopy(MessageRecv obj) { System.IO.MemoryStream ms = new System.IO.MemoryStream(obj.Data); AckPassCopy ack = Serializer.Deserialize <AckPassCopy>(ms); int chapter = ack.Chapter; int copyID = ack.CopyID; int copyType = ack.CopyType; int starNum = ack.StarNum; XCopy copy; if (!DataDBSCopy.ContainsKey(copyID)) { copy = new XCopy(); copy.Id = copyID; copy.StarNum = starNum; } else { copy = DataDBSCopy.GetDataById(copyID); if (copy.StarNum < starNum) { copy.StarNum = starNum; } } DataDBSCopy.Update(copyID, copy); DCopy copyDB = ReadCfgCopy.GetDataById(copyID); GTDataManager.Instance.UseAction(copyDB.CostActionId, copyDB.CostActionNum); int key = (int)copyType; XRaid raid; if (!DataDBSRaid.ContainsKey(key)) { raid = new XRaid(); } else { raid = DataDBSRaid.GetDataById(key); } raid.MaxChapter = chapter; raid.MaxCopyId = copyID; raid.Id = key; DataDBSRaid.Update(key, raid); if (starNum > 0) { XCharacter role = RoleModule.Instance.GetCurPlayer(); RoleService.Instance.TryAddRoleExp(copyDB.GetExpRatio * role.Level); GTDataManager.Instance.AddMoney(copyDB.GetMoneyId, copyDB.GetMoneyRatio * role.Level); GTDataManager.Instance.UseAction(copyDB.CostActionId, copyDB.CostActionNum); List <KStruct> list = AwardModule.Instance.GetAwardDataByID(copyDB.AwardId); if (list != null) { GTDataManager.Instance.AddNewItemList(list, false); } } GTEventCenter.FireEvent(GTEventID.TYPE_PASS_COPY); }
public int GetMaxCopyIDByDifficulty(int difficulty) { XRaid raid = DataDBSRaid.GetDataById(difficulty); return(raid == null ? 0 : raid.MaxCopyId); }
public int GetMaxChapterByDifficulty(int difficulty) { XRaid raid = DataDBSRaid.GetDataById(difficulty); return(raid == null ? DCopyMainChapter.MAINCOPY_ST_CHAPTER_ID : raid.MaxChapter); }