public static int GetMainYinJiLevelUpNum(RebornStampData dbInfo, int Index) { int MainUpNum = 0; int result; if (Index != 0 && Index != 8) { result = MainUpNum; } else { int CurrID = RebornStamp.GetCurrMainLevelItemID(dbInfo, Index); if (Index == 0) { foreach (KeyValuePair <int, int> it in RebornStamp.MainYinJiLevelUp[(MainAttrType)dbInfo.StampInfo[Index]]) { if (it.Value > CurrID) { if (dbInfo.StampInfo[3] >= it.Key && dbInfo.StampInfo[5] >= it.Key && dbInfo.StampInfo[7] >= it.Key) { MainUpNum++; } if (MainUpNum > 0 && (dbInfo.StampInfo[3] < it.Key || dbInfo.StampInfo[5] < it.Key || dbInfo.StampInfo[7] < it.Key)) { break; } } } } else if (Index == 8) { foreach (KeyValuePair <int, int> it in RebornStamp.MainYinJiLevelUp[(MainAttrType)dbInfo.StampInfo[Index]]) { if (it.Value > CurrID) { if (dbInfo.StampInfo[11] >= it.Key && dbInfo.StampInfo[13] >= it.Key && dbInfo.StampInfo[15] >= it.Key) { MainUpNum++; } if (MainUpNum > 0 && (dbInfo.StampInfo[11] < it.Key || dbInfo.StampInfo[13] < it.Key || dbInfo.StampInfo[15] < it.Key)) { break; } } } } result = MainUpNum; } 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); }
public void RefreshProps(GameClient client) { double[] _ExtProps = new double[177]; try { if (client.ClientData.RebornYinJi != null) { if (client.ClientData.RebornYinJi.StampInfo != null) { int i = 0; int j = 8; while (i < 8 && j < 16) { bool flag = false; if (i == 0) { int ItemId = RebornStamp.GetCurrMainLevelItemID(client.ClientData.RebornYinJi, 0); if (ItemId == 0) { break; } foreach (KeyValuePair <int, double> it in RebornStamp.MainYinJi[ItemId].AttrList) { _ExtProps[it.Key] += it.Value; } flag = true; } if (j == 8) { int ItemId = RebornStamp.GetCurrMainLevelItemID(client.ClientData.RebornYinJi, 8); if (ItemId == 0) { break; } foreach (KeyValuePair <int, double> it in RebornStamp.MainYinJi[ItemId].AttrList) { _ExtProps[it.Key] += it.Value; } flag = true; } if (!flag) { int ItemId = RebornStamp.GetCurrMinorLevelItemID(client.ClientData.RebornYinJi, i); if (ItemId == 0) { break; } foreach (KeyValuePair <int, double> it in RebornStamp.MinorYinJi[ItemId].AttrList) { _ExtProps[it.Key] += it.Value; } ItemId = RebornStamp.GetCurrMinorLevelItemID(client.ClientData.RebornYinJi, j); if (ItemId == 0) { break; } foreach (KeyValuePair <int, double> it in RebornStamp.MinorYinJi[ItemId].AttrList) { _ExtProps[it.Key] += it.Value; } } i += 2; j += 2; } } } } finally { client.ClientData.PropsCacheManager.SetExtProps(new object[] { PropsSystemTypes.RebornYinJi, _ExtProps }); } }