public static ResOpcode ProcessRebornYinJiChoose(GameClient client, int RoldID, int StampType1, int StampType2) { ResOpcode result; if (StampType1 < 1 || StampType1 > 6) { result = ResOpcode.ChooseYinJiTypeErr; } else if (StampType2 < 1 || StampType2 > 6) { result = ResOpcode.ChooseYinJiTypeErr; } else if (StampType1 == StampType2) { result = ResOpcode.ChooseYinJiTypeErr; } else { RebornStampData db; if (RebornStamp.GetRebornYinJiInfo(client, out db)) { lock (db) { if (db.StampInfo != null && db.StampInfo.Count > 0) { return(ResOpcode.ChooseGetInfoYinJiIsActive); } if (!RebornStamp.UpdateRebornYinJiInfo(client, RebornStamp.MakeYinJiUpdateInfoByType(StampType1, StampType2), db.UsePoint, db.ResetNum)) { return(ResOpcode.ChooseYinJiIsActiveErr); } RebornStampData NewData; if (RebornStamp.GetRebornYinJiInfo(client, out NewData)) { client.ClientData.RebornYinJi = NewData; } Global.RefreshEquipProp(client); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); return(ResOpcode.ChooseGetInfoYinJiIsActive); } } if (!RebornStamp.InsertRebornYinJi(client, RebornStamp.MakeYinJiUpdateInfoByType(StampType1, StampType2))) { result = ResOpcode.ChooseYinJiIsActiveErr; } else { RebornStampData NewData; if (RebornStamp.GetRebornYinJiInfo(client, out NewData)) { client.ClientData.RebornYinJi = NewData; } Global.RefreshEquipProp(client); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); result = ResOpcode.ChooseGetInfoYinJiIsActive; } } return(result); }
public static ResOpcode ProcessRebornYinJiGetInfo(GameClient client, int RoldID, out RebornStampData dbInfo) { dbInfo = null; ResOpcode result; if (!RebornStamp.GetRebornYinJiInfo(client, out dbInfo)) { result = ResOpcode.GetYinJiInfoErr; } else { result = ResOpcode.Succ; } return(result); }
public static ResOpcode ProcessRebornYinJiReset(GameClient client, int RoldID) { RebornStampData db; ResOpcode result; if (!RebornStamp.GetRebornYinJiInfo(client, out db)) { result = ResOpcode.ChooseGetInfoYinJiNotActive; } else { lock (db) { int UseZuanShiNum; if (db.ResetNum < RebornStamp.YinJiReset.Count) { UseZuanShiNum = RebornStamp.YinJiReset[db.ResetNum]; } else { UseZuanShiNum = RebornStamp.YinJiReset[RebornStamp.YinJiReset.Count - 1]; } db.ResetNum++; if (!GameManager.ClientMgr.SubUserMoney(client, UseZuanShiNum, "重生印记洗点", true, true, true, true, DaiBiSySType.None)) { return(ResOpcode.ResetYinJiZuanShiErr); } if (!RebornStamp.UpdateRebornYinJiInfo(client, "", 0, db.ResetNum)) { return(ResOpcode.ResetYinJiInfoErr); } } RebornStampData NewData; if (RebornStamp.GetRebornYinJiInfo(client, out NewData)) { client.ClientData.RebornYinJi = NewData; } Global.RefreshEquipProp(client); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); result = ResOpcode.Succ; } return(result); }
public static ResOpcode ProcessRebornYinJiLevelUp(GameClient client, int RoldID, int StampID, int StampType, int UpNum, out int IDZhu, out int OutMainYinJiID1, out int OutUsePoint) { IDZhu = -1; OutMainYinJiID1 = 0; OutUsePoint = 0; RebornStampData dbInfo; ResOpcode result; if (!RebornStamp.GetRebornYinJiInfo(client, out dbInfo)) { result = ResOpcode.ChooseGetInfoYinJiNotActive; } else { lock (dbInfo) { int Index = 0; int MainAttr = 0; if (!RebornStamp.CheckTypeMatch(dbInfo, StampID, StampType, out Index, out MainAttr)) { return(ResOpcode.LevelUpYinJiCheckErr); } if (UpNum <= 0) { return(ResOpcode.LevelUpYinJiUpNumErr); } lock (client.ClientData.PropPointMutex) { long AllPoint = (long)Global.GetRoleParamsInt32FromDB(client, "10246"); long IsUsePoint = AllPoint - (long)dbInfo.UsePoint; if (IsUsePoint < (long)UpNum) { return(ResOpcode.LevelUpYinJiPointErr); } } int IsLevelUpNum = RebornStamp.MinorLevelLimit[StampType] - dbInfo.StampInfo[Index + 1]; if (0 >= IsLevelUpNum) { return(ResOpcode.LevelUpYinJiMaxLv); } if (IsLevelUpNum < UpNum) { return(ResOpcode.LevelUpYinJiOverUpLvErr); } int CurrID = RebornStamp.GetCurrMinorLevelItemID(dbInfo, Index); OutMainYinJiID1 = CurrID + UpNum; ChongShengYinJiZi data; if (!RebornStamp.MinorYinJi.TryGetValue(OutMainYinJiID1, out data)) { return(ResOpcode.LevelUpYinJiMaxLv); } dbInfo.StampInfo[Index + 1] = data.Level; if (RebornStamp.IsMainLevelUp(dbInfo, MainAttr, out IDZhu)) { if (MainAttr == 1) { int MID = RebornStamp.GetCurrMainLevelItemID(dbInfo, 0); int LevelUp = MID + RebornStamp.GetMainYinJiLevelUpNum(dbInfo, 0); dbInfo.StampInfo[1] = RebornStamp.MainYinJi[LevelUp].Level; IDZhu = LevelUp; } if (MainAttr == 2) { int MID = RebornStamp.GetCurrMainLevelItemID(dbInfo, 8); int LevelUp = MID + RebornStamp.GetMainYinJiLevelUpNum(dbInfo, 8); dbInfo.StampInfo[9] = RebornStamp.MainYinJi[LevelUp].Level; IDZhu = LevelUp; } } string UpdateInfo = RebornStamp.MakeYinJiUpdateInfo(dbInfo.StampInfo); OutUsePoint = dbInfo.UsePoint + UpNum; if (!RebornStamp.UpdateRebornYinJiInfo(client, UpdateInfo, OutUsePoint, dbInfo.ResetNum)) { return(ResOpcode.LevelUpYinJiSaveErr); } } client.ClientData.RebornYinJi = dbInfo; Global.RefreshEquipProp(client); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); result = ResOpcode.Succ; } return(result); }