public void ActivationStarConstellationAll(GameClient client) { int nOccupation = client.ClientData.Occupation; Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > dicTmp = null; if (this.m_StarConstellationDetailInfo.TryGetValue(nOccupation, out dicTmp) && dicTmp != null) { if (client.ClientData.RoleStarConstellationInfo == null) { client.ClientData.RoleStarConstellationInfo = new Dictionary <int, int>(); } foreach (KeyValuePair <int, Dictionary <int, StarConstellationDetailInfo> > kvp in dicTmp) { TCPOutPacket tcpOutPacket = null; string strDbCmd = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, kvp.Key, this.m_MaxStarSlotID); TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer2(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 10166, strDbCmd, out tcpOutPacket, client.ServerId); if (TCPProcessCmdResults.RESULT_FAILED != dbRequestResult) { Global.PushBackTcpOutPacket(tcpOutPacket); } client.ClientData.RoleStarConstellationInfo[kvp.Key] = this.m_MaxStarSlotID; StarConstellationDetailInfo tmpInfo = null; if (kvp.Value.TryGetValue(this.m_MaxStarSlotID, out tmpInfo) && null != tmpInfo.Propertyinfo) { this.ActivationStarConstellationProp(client, tmpInfo.Propertyinfo, 1); } this.ActivationStarConstellationExtendProp(client, kvp.Key); GameManager.StarConstellationMgr.InitPlayerStarConstellationPorperty(client); } GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.ActiveXingZuo)); ProcessTask.ProcessRoleTaskVal(client, TaskTypes.XingZuoStar, -1); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); client.ClientData.LifeV = (int)RoleAlgorithm.GetMaxLifeV(client); client.ClientData.MagicV = (int)RoleAlgorithm.GetMaxMagicV(client); GameManager.ClientMgr.NotifySelfLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); client.sendCmd <Dictionary <int, int> >(661, client.ClientData.RoleStarConstellationInfo, false); } }
public int ActivationStarConstellation(GameClient client, int nStarSiteID) { int result; if (nStarSiteID < 1 || nStarSiteID > this.m_MaxStarSiteID) { result = -1; } else { if (client.ClientData.RoleStarConstellationInfo == null) { client.ClientData.RoleStarConstellationInfo = new Dictionary <int, int>(); } int nStarSlot = 0; client.ClientData.RoleStarConstellationInfo.TryGetValue(nStarSiteID, out nStarSlot); if (nStarSlot >= this.m_MaxStarSlotID) { result = -1; } else if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.GamePayerRolePartXingZuo, false)) { result = -1; } else { nStarSlot++; int nOccupation = client.ClientData.Occupation; Dictionary <int, Dictionary <int, StarConstellationDetailInfo> > dicTmp = null; if (!this.m_StarConstellationDetailInfo.TryGetValue(nOccupation, out dicTmp) || dicTmp == null) { result = -2; } else { Dictionary <int, StarConstellationDetailInfo> dicTmpInfo = null; if (!dicTmp.TryGetValue(nStarSiteID, out dicTmpInfo) || dicTmpInfo == null) { result = -2; } else { StarConstellationDetailInfo tmpInfo = null; if (!dicTmpInfo.TryGetValue(nStarSlot, out tmpInfo) || tmpInfo == null) { result = -2; } else { int nNeeChangeLife = tmpInfo.ChangeLifeLimit; int nNeedLev = tmpInfo.LevelLimit; int nReqUnionLevel = Global.GetUnionLevel(nNeeChangeLife, nNeedLev, false); if (Global.GetUnionLevel(client.ClientData.ChangeLifeCount, client.ClientData.Level, false) < nReqUnionLevel) { result = -3; } else { int nGoods = tmpInfo.NeedGoodsID; int nNum = tmpInfo.NeedGoodsNum; if (nGoods > 0 && nNum > 0) { GoodsData goods = Global.GetGoodsByID(client, nGoods); if (goods == null || goods.GCount < nNum) { GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(533, new object[0]), new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0); return(-5); } } int nNeedStarSoul = tmpInfo.NeedStarSoul; if (nNeedStarSoul > 0) { if (nNeedStarSoul > client.ClientData.StarSoul) { GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(534, new object[0]), new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0); return(-9); } } int nNeedMoney = tmpInfo.NeedJinBi; if (nNeedMoney > 0) { if (!Global.SubBindTongQianAndTongQian(client, nNeedMoney, "激活星座")) { GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(535, new object[0]), new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0); return(-10); } } if (nGoods > 0 && nNum > 0) { bool usedBinding = false; bool usedTimeLimited = false; if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nGoods, nNum, false, out usedBinding, out usedTimeLimited, false)) { return(-6); } } if (nNeedStarSoul > 0) { GameManager.ClientMgr.ModifyStarSoulValue(client, -nNeedStarSoul, "激活星座", true, true); } int nRate = Global.GetRandomNumber(1, 10001); if (nRate > tmpInfo.SuccessRate) { GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(536, new object[0]), new object[0]), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.ErrAndBox, 0); result = -100; } else { TCPOutPacket tcpOutPacket = null; string strDbCmd = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, nStarSiteID, nStarSlot); TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer2(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 10166, strDbCmd, out tcpOutPacket, client.ServerId); if (TCPProcessCmdResults.RESULT_FAILED == dbRequestResult) { result = -7; } else { Global.PushBackTcpOutPacket(tcpOutPacket); PropertyInfo tmpProp = tmpInfo.Propertyinfo; if (tmpProp == null) { result = -8; } else { client.ClientData.RoleStarConstellationInfo[nStarSiteID] = nStarSlot; this.ActivationStarConstellationProp(client, tmpProp, 1); if (0 == nStarSlot % 12) { this.ActivationStarConstellationExtendProp(client, nStarSiteID); GameManager.StarConstellationMgr.InitPlayerStarConstellationPorperty(client); } GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.ActiveXingZuo)); ProcessTask.ProcessRoleTaskVal(client, TaskTypes.XingZuoStar, -1); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); client.ClientData.LifeV = (int)RoleAlgorithm.GetMaxLifeV(client); client.ClientData.MagicV = (int)RoleAlgorithm.GetMaxMagicV(client); GameManager.ClientMgr.NotifySelfLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); result = 1; } } } } } } } } } return(result); }
public bool processCmd(GameClient client, string[] cmdParams) { int nID = 609; int nRoleID = Global.SafeConvertToInt32(cmdParams[0]); int nUpWingMode = Global.SafeConvertToInt32(cmdParams[1]); bool result; if (null == client.ClientData.MyWingData) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -3, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); result = true; } else if (client.ClientData.MyWingData.WingID >= MUWingsManager.MaxWingID) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -8, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); result = true; } else { SystemXmlItem upStarXmlItem = MUWingsManager.GetWingUPCacheItem(client.ClientData.MyWingData.WingID + 1); if (null == upStarXmlItem) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -3, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); result = true; } else { SystemXmlItem upStarXmlItem2 = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel + 1); if (null != upStarXmlItem2) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -3, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); result = true; } else { string strCostList = ""; if (0 == nUpWingMode) { string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods"); string[] itemParams = strReqItemID.Split(new char[] { ',' }); if (itemParams == null || itemParams.Length != 2) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -3, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); return(true); } int originGoodsID = Convert.ToInt32(itemParams[0]); int originGoodsNum = Convert.ToInt32(itemParams[1]); if (originGoodsID <= 0 || originGoodsNum <= 0) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -3, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); return(true); } GoodsReplaceResult replaceRet = SingletonTemplate <GoodsReplaceManager> .Instance().GetReplaceResult(client, originGoodsID); if (replaceRet == null || replaceRet.TotalGoodsCnt() < originGoodsNum) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -4, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); return(true); } List <GoodsReplaceResult.ReplaceItem> realCostList = new List <GoodsReplaceResult.ReplaceItem>(); realCostList.AddRange(replaceRet.BindList); realCostList.AddRange(replaceRet.UnBindList); realCostList.Add(replaceRet.OriginBindGoods); realCostList.Add(replaceRet.OriginUnBindGoods); int stillNeedCnt = originGoodsNum; foreach (GoodsReplaceResult.ReplaceItem item in realCostList) { if (item.GoodsCnt > 0) { int realCostCnt = Math.Min(stillNeedCnt, item.GoodsCnt); if (realCostCnt <= 0) { break; } bool bUsedBinding = false; bool bUsedTimeLimited = false; bool bFailed = false; if (item.IsBind) { if (!GameManager.ClientMgr.NotifyUseBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited, false)) { bFailed = true; } } else if (!GameManager.ClientMgr.NotifyUseNotBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited, false)) { bFailed = true; } stillNeedCnt -= realCostCnt; if (bFailed) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -5, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); return(true); } GoodsData goodsDataLog = new GoodsData { GoodsID = item.GoodsID, GCount = realCostCnt }; strCostList = EventLogManager.NewGoodsDataPropString(goodsDataLog); } } } else { int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi", -1); if (nReqZuanShi <= 0) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -3, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); return(true); } int oldUserMoney = client.ClientData.UserMoney; int oldUserGlod = client.ClientData.Gold; if (client.ClientData.UserMoney < nReqZuanShi && !HuanLeDaiBiManager.GetInstance().HuanledaibiEnough(client, nReqZuanShi)) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -6, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); return(true); } if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀进阶", true, true, false, DaiBiSySType.ChiBangShengJie)) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -7, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); return(true); } strCostList = EventLogManager.NewResPropString(ResLogType.FristBindZuanShi, new object[] { -nReqZuanShi, oldUserGlod, client.ClientData.Gold, oldUserMoney, client.ClientData.UserMoney }); } int nLuckOne = upStarXmlItem.GetIntValue("LuckyOne", -1); int nLuckyTwo = upStarXmlItem.GetIntValue("LuckyTwo", -1); int nLuckTwoRate = (int)(upStarXmlItem.GetDoubleValue("LuckyTwoRate") * 100.0); int nNextWingID = client.ClientData.MyWingData.WingID; int nNextJinJieFailedNum = client.ClientData.MyWingData.JinJieFailedNum; int nNextStarLevel = client.ClientData.MyWingData.ForgeLevel; int nNextStarExp = client.ClientData.MyWingData.StarExp; int nOldWingID = client.ClientData.MyWingData.WingID; int nOldJinJieFailedNum = client.ClientData.MyWingData.JinJieFailedNum; int nOldStarLevel = client.ClientData.MyWingData.ForgeLevel; int nOldStarExp = client.ClientData.MyWingData.StarExp; if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < nLuckyTwo) { nNextJinJieFailedNum++; } else if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < 110000) { int nRandNum = Global.GetRandomNumber(0, 100); if (nRandNum < nLuckTwoRate) { nNextWingID++; nNextJinJieFailedNum = 0; nNextStarLevel = 0; nNextStarExp = 0; } else { nNextJinJieFailedNum++; } } else { nNextWingID++; nNextJinJieFailedNum = 0; nNextStarLevel = 0; nNextStarExp = 0; } GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingSuitStarTimes)); int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, nNextWingID, nNextJinJieFailedNum, nNextStarLevel, nNextStarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum); if (iRet < 0) { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { -3, nRoleID, 0, 0 }); client.sendCmd(nID, strCmd, false); result = true; } else { string strCmd = string.Format("{0}:{1}:{2}:{3}", new object[] { 0, nRoleID, nNextWingID, nNextJinJieFailedNum }); client.sendCmd(nID, strCmd, false); client.ClientData.MyWingData.JinJieFailedNum = nNextJinJieFailedNum; if (client.ClientData.MyWingData.WingID != nNextWingID) { if (1 == client.ClientData.MyWingData.Using) { MUWingsManager.UpdateWingDataProps(client, false); } bool oldWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu, false); client.ClientData.MyWingData.WingID = nNextWingID; client.ClientData.MyWingData.ForgeLevel = 0; client.ClientData.MyWingData.StarExp = 0; GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingLevel)); bool newWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu, false); if (!oldWingLingYuOpened && newWingLingYuOpened) { LingYuManager.InitAsOpened(client); } if (1 == client.ClientData.MyWingData.Using) { MUWingsManager.UpdateWingDataProps(client, true); ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7); } if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriWing) || client._IconStateMgr.CheckReborn(client)) { client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } EventLogManager.AddWingStarEvent(client, 2, 0, nOldStarLevel, client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel, client.ClientData.MyWingData.StarExp, strCostList); } EventLogManager.AddWingUpgradeEvent(client, nUpWingMode, nOldJinJieFailedNum, client.ClientData.MyWingData.JinJieFailedNum, nOldWingID, client.ClientData.MyWingData.WingID, nOldStarLevel, client.ClientData.MyWingData.ForgeLevel, nOldStarExp, client.ClientData.MyWingData.StarExp, strCostList); ProcessTask.ProcessRoleTaskVal(client, TaskTypes.WingIDLevel, -1); result = true; } } } } return(result); }
public static FuBenTongGuanData GiveCopyMapGiftNoScore(GameClient client, FuBenMapItem fuBenMapItem, bool bFirstPass) { FuBenTongGuanData result; if (null == fuBenMapItem) { result = null; } else { List <GoodsData> goodNormal = new List <GoodsData>(); List <int> goodsID = new List <int>(); WanMotaCopySceneManager.GetFubenItemReward(client, fuBenMapItem, bFirstPass, goodNormal, goodsID); if (bFirstPass) { WanMotaCopySceneManager.GetFubenItemReward(client, fuBenMapItem, false, goodNormal, goodsID); } FuBenTongGuanData fuBenTongGuanData = new FuBenTongGuanData(); fuBenTongGuanData.FuBenID = fuBenMapItem.FuBenID; fuBenTongGuanData.TotalScore = 0; fuBenTongGuanData.KillNum = 0; fuBenTongGuanData.KillScore = 0; fuBenTongGuanData.MaxKillScore = 0; fuBenTongGuanData.UsedSecs = 0; fuBenTongGuanData.TimeScore = 0; fuBenTongGuanData.MaxTimeScore = 0; fuBenTongGuanData.DieCount = 0; fuBenTongGuanData.DieScore = 0; fuBenTongGuanData.MaxDieScore = 0; fuBenTongGuanData.GoodsIDList = goodsID; string strTitle; if (bFirstPass) { strTitle = string.Format(GLang.GetLang(570, new object[0]), client.ClientData.WanMoTaNextLayerOrder + 1); } else { strTitle = string.Format(GLang.GetLang(571, new object[0]), client.ClientData.WanMoTaNextLayerOrder + 1); } if (bFirstPass) { fuBenTongGuanData.AwardExp = fuBenMapItem.nFirstExp + fuBenMapItem.Experience; fuBenTongGuanData.AwardJinBi = fuBenMapItem.nFirstGold + fuBenMapItem.Money1; fuBenTongGuanData.AwardXingHun = fuBenMapItem.nFirstXingHunAward + fuBenMapItem.nXingHunAward; } else { fuBenTongGuanData.AwardExp = fuBenMapItem.Experience; fuBenTongGuanData.AwardJinBi = fuBenMapItem.Money1; fuBenTongGuanData.AwardXingHun = fuBenMapItem.nXingHunAward; } WanMotaCopySceneManager.AddRewardToClient(client, goodNormal, fuBenTongGuanData.AwardExp, fuBenTongGuanData.AwardJinBi, fuBenTongGuanData.AwardXingHun, strTitle); int nWanMoTaNextLayerOrder = GameManager.ClientMgr.GetWanMoTaPassLayerValue(client) + 1; GameManager.ClientMgr.SaveWanMoTaPassLayerValue(client, nWanMoTaNextLayerOrder, false); client.ClientData.WanMoTaNextLayerOrder = nWanMoTaNextLayerOrder; SingletonTemplate <WanMoTaTopLayerManager> .Instance().OnClientPass(client, nWanMoTaNextLayerOrder); GameManager.ClientMgr.NotifySelfParamsValueChange(client, RoleCommonUseIntParamsIndexs.WanMoTaCurrLayerOrder, 0); WanMoTaDBCommandManager.LayerChangeDBCommand(client, nWanMoTaNextLayerOrder); ProcessTask.ProcessRoleTaskVal(client, TaskTypes.WanMoTa, -1); result = fuBenTongGuanData; } return(result); }
public bool processCmd(GameClient client, string[] cmdParams) { int nRoleID = Global.SafeConvertToInt32(cmdParams[0]); int nUpStarMode = Global.SafeConvertToInt32(cmdParams[1]); string strCostList = ""; bool result; if (null == client.ClientData.MyWingData) { SCWingStarUp scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); result = true; } else { SystemXmlItem upStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel + 1); if (null == upStarXmlItem) { SCWingStarUp scData = new SCWingStarUp(-23, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); result = true; } else { string strWingShengXing = GameManager.systemParamsList.GetParamValueByName("WingShengXing"); if ("" == strWingShengXing) { SCWingStarUp scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); result = true; } else { string[] wingShengXing = strWingShengXing.Split(new char[] { ',' }); if (3 != wingShengXing.Length) { SCWingStarUp scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); result = true; } else { int nAddExp = 0; int nPowRate; if (0 == nUpStarMode) { nPowRate = (int)(Convert.ToDouble(wingShengXing[0]) * 100.0); nAddExp = Convert.ToInt32(upStarXmlItem.GetIntValue("GoodsExp", -1)); } else { nPowRate = (int)(Convert.ToDouble(wingShengXing[1]) * 100.0); nAddExp = Convert.ToInt32(upStarXmlItem.GetIntValue("ZuanShiExp", -1)); } int nRandNum = Global.GetRandomNumber(0, 100); if (nRandNum < nPowRate) { nAddExp *= Convert.ToInt32(wingShengXing[2]); } int nUpStarReqExp = upStarXmlItem.GetIntValue("StarExp", -1); int nOldStarLevel = client.ClientData.MyWingData.ForgeLevel; int nNextStarLevel = client.ClientData.MyWingData.ForgeLevel; int nNextStarExp = 0; if (client.ClientData.MyWingData.StarExp + nAddExp >= nUpStarReqExp) { if (nNextStarLevel < MUWingsManager.MaxWingEnchanceLevel) { nNextStarLevel++; nNextStarExp = client.ClientData.MyWingData.StarExp + nAddExp - nUpStarReqExp; while (nNextStarLevel < MUWingsManager.MaxWingEnchanceLevel) { SystemXmlItem nextStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, nNextStarLevel + 1); if (null != upStarXmlItem) { int nNextUpStarReqExp = nextStarXmlItem.GetIntValue("StarExp", -1); if (nNextStarExp >= nNextUpStarReqExp) { nNextStarLevel++; nNextStarExp -= nNextUpStarReqExp; continue; } } break; } } else { nNextStarExp = nUpStarReqExp; } } else { nNextStarExp = client.ClientData.MyWingData.StarExp + nAddExp; } if (0 == nUpStarMode) { string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods"); string[] itemParams = strReqItemID.Split(new char[] { ',' }); if (itemParams == null || itemParams.Length != 2) { SCWingStarUp scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); return(true); } int originGoodsID = Convert.ToInt32(itemParams[0]); int originGoodsNum = Convert.ToInt32(itemParams[1]); if (originGoodsID <= 0 || originGoodsNum <= 0) { SCWingStarUp scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); return(true); } GoodsReplaceResult replaceRet = SingletonTemplate <GoodsReplaceManager> .Instance().GetReplaceResult(client, originGoodsID); if (replaceRet == null || replaceRet.TotalGoodsCnt() < originGoodsNum) { SCWingStarUp scData = new SCWingStarUp(-4, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); return(true); } List <GoodsReplaceResult.ReplaceItem> realCostList = new List <GoodsReplaceResult.ReplaceItem>(); realCostList.AddRange(replaceRet.BindList); realCostList.AddRange(replaceRet.UnBindList); realCostList.Add(replaceRet.OriginBindGoods); realCostList.Add(replaceRet.OriginUnBindGoods); int stillNeedCnt = originGoodsNum; foreach (GoodsReplaceResult.ReplaceItem item in realCostList) { if (item.GoodsCnt > 0) { int realCostCnt = Math.Min(stillNeedCnt, item.GoodsCnt); if (realCostCnt <= 0) { break; } bool bUsedBinding = false; bool bUsedTimeLimited = false; bool bFailed = false; if (item.IsBind) { if (!GameManager.ClientMgr.NotifyUseBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited, false)) { bFailed = true; } } else if (!GameManager.ClientMgr.NotifyUseNotBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, item.GoodsID, realCostCnt, false, out bUsedBinding, out bUsedTimeLimited, false)) { bFailed = true; } stillNeedCnt -= realCostCnt; if (bFailed) { SCWingStarUp scData = new SCWingStarUp(-5, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); return(true); } GoodsData goodsData = new GoodsData { GoodsID = item.GoodsID, GCount = realCostCnt }; strCostList = EventLogManager.NewGoodsDataPropString(goodsData); } } } else { int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi", -1); if (nReqZuanShi <= 0) { SCWingStarUp scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); return(true); } if (client.ClientData.UserMoney < nReqZuanShi) { SCWingStarUp scData = new SCWingStarUp(-6, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); return(true); } int oldUserMoney = client.ClientData.UserMoney; int oldUserGlod = client.ClientData.Gold; if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀升星", true, true, false, DaiBiSySType.ChiBangShengXing)) { SCWingStarUp scData = new SCWingStarUp(-7, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); return(true); } strCostList = EventLogManager.NewResPropString(ResLogType.FristBindZuanShi, new object[] { -nReqZuanShi, oldUserGlod, client.ClientData.Gold, oldUserMoney, client.ClientData.UserMoney }); } GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingSuitStarTimes)); int iRet = MUWingsManager.WingUpStarDBCommand(client, client.ClientData.MyWingData.DbID, nNextStarLevel, nNextStarExp); if (iRet < 0) { SCWingStarUp scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd <SCWingStarUp>(608, scData, false); result = true; } else { SCWingStarUp scData = new SCWingStarUp(0, nRoleID, nNextStarLevel, nNextStarExp); client.sendCmd <SCWingStarUp>(608, scData, false); client.ClientData.MyWingData.StarExp = nNextStarExp; if (client.ClientData.MyWingData.ForgeLevel != nNextStarLevel) { if (1 == client.ClientData.MyWingData.Using) { MUWingsManager.UpdateWingDataProps(client, false); } bool oldWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu, false); client.ClientData.MyWingData.ForgeLevel = nNextStarLevel; GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingLevel)); bool newWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu, false); if (!oldWingLingYuOpened && newWingLingYuOpened) { LingYuManager.InitAsOpened(client); } if (1 == client.ClientData.MyWingData.Using) { MUWingsManager.UpdateWingDataProps(client, true); ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7); } if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriWing) || client._IconStateMgr.CheckSpecialActivity(client) || client._IconStateMgr.CheckEverydayActivity(client) || client._IconStateMgr.CheckReborn(client)) { client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } } EventLogManager.AddWingStarEvent(client, nUpStarMode, nAddExp, nOldStarLevel, client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel, client.ClientData.MyWingData.StarExp, strCostList); ProcessTask.ProcessRoleTaskVal(client, TaskTypes.WingIDLevel, -1); result = true; } } } } } return(result); }