public int GetCopyStarNumById(int id) { if (DataDBSCopy.ContainsKey(id)) { return(DataDBSCopy.GetDataById(id).StarNum); } else { return(0); } }
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); }