public static bool IfZhuHunPerfect(GameClient client) { bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun, false)) { result = false; } else { ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID); result = (i != null && client.ClientData.MyWingData.ZhuHunNum >= i.ZhuHunLimit); } return(result); }
public static void SetZhuHunMax_GM(GameClient client) { ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID); if (i != null) { client.ClientData.MyWingData.ZhuHunNum = i.ZhuHunLimit; MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.JinJieFailedNum, client.ClientData.MyWingData.ForgeLevel, client.ClientData.MyWingData.StarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum); 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.CheckReborn(client)) { client._IconStateMgr.SendIconStateToClient(client); } } }
public static TCPProcessCmdResults ProcessReqZhuHun( TCPManager tcpMgr, TMSKSocket socket, TCPClientPool tcpClientPool, TCPOutPacketPool pool, int nID, byte[] data, int count, out TCPOutPacket tcpOutPacket) { tcpOutPacket = null; string cmdData = null; string[] fields = null; try { cmdData = new UTF8Encoding().GetString(data, 0, count); } catch (Exception) //解析错误 { LogManager.WriteLog(LogTypes.Error, string.Format("解析指令字符串错误, CMD={0}, Client={1}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket))); return(TCPProcessCmdResults.RESULT_FAILED); } try { fields = cmdData.Split(':'); if (1 != fields.Length) { LogManager.WriteLog(LogTypes.Error, string.Format("指令参数个数错误, CMD={0}, Client={1}, Recv={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket), fields.Length)); return(TCPProcessCmdResults.RESULT_FAILED); } int roleID = Convert.ToInt32(fields[0]); GameClient client = GameManager.ClientMgr.FindClient(socket); if (null == client || client.ClientData.RoleID != roleID) { LogManager.WriteLog(LogTypes.Error, string.Format("根据RoleID定位GameClient对象失败, CMD={0}, Client={1}, RoleID={2}", (TCPGameServerCmds)nID, Global.GetSocketRemoteEndPoint(socket), roleID)); return(TCPProcessCmdResults.RESULT_FAILED); } ZhuLingZhuHunError e = ZhuLingZhuHunManager.ReqZhuHun(client); string strcmd = string.Format("{0}:{1}:{2}", roleID, (int)e, client.ClientData.MyWingData.ZhuHunNum); tcpOutPacket = TCPOutPacket.MakeTCPOutPacket(pool, strcmd, nID); } catch (Exception ex) { DataHelper.WriteFormatExceptionLog(ex, "ProcessReqZhuHun", false); } return(TCPProcessCmdResults.RESULT_DATA); }
public static double GetZhuHunPct(GameClient client) { double pct = 0.0; double result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun, false)) { result = pct; } else { ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID); if (i == null) { result = pct; } else { pct = (double)client.ClientData.MyWingData.ZhuHunNum / (double)i.ZhuHunLimit; result = pct; } } return(result); }
public static void UpdateZhuLingZhuHunProps(GameClient client) { if (null != client.ClientData.MyWingData) { if (client.ClientData.MyWingData.WingID > 0) { ZhuLingZhuHunEffect e = ZhuLingZhuHunManager.GetEffect(Global.CalcOriginalOccupationID(client)); if (e != null) { double MaxAttackV = 0.0; double MinAttackV = 0.0; double MaxMAttackV = 0.0; double MinMAttackV = 0.0; double MaxDefenseV = 0.0; double MinDefenseV = 0.0; double MaxMDefenseV = 0.0; double MinMDefenseV = 0.0; double LifeV = 0.0; double HitV = 0.0; double DodgeV = 0.0; if (client.ClientData.MyWingData.Using == 1) { MaxAttackV = (double)(e.MaxAttackV * client.ClientData.MyWingData.ZhuLingNum); MaxMAttackV = (double)(e.MaxMAttackV * client.ClientData.MyWingData.ZhuLingNum); MaxDefenseV = (double)(e.MaxDefenseV * client.ClientData.MyWingData.ZhuLingNum); MaxMDefenseV = (double)(e.MaxMDefenseV * client.ClientData.MyWingData.ZhuLingNum); LifeV = (double)(e.LifeV * client.ClientData.MyWingData.ZhuLingNum); HitV = (double)(e.HitV * client.ClientData.MyWingData.ZhuLingNum); DodgeV = (double)(e.DodgeV * client.ClientData.MyWingData.ZhuLingNum); double AllAttribute = e.AllAttribute; SystemXmlItem baseXmlNodeSuit = WingPropsCacheManager.GetWingPropsCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID); SystemXmlItem baseXmlNodeStar = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel); if (baseXmlNodeSuit == null) { baseXmlNodeSuit = new SystemXmlItem(); } if (baseXmlNodeStar == null) { baseXmlNodeStar = new SystemXmlItem(); } MaxAttackV += (baseXmlNodeSuit.GetDoubleValue("MaxAttackV") + baseXmlNodeStar.GetDoubleValue("MaxAttackV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); MinAttackV += (baseXmlNodeSuit.GetDoubleValue("MinAttackV") + baseXmlNodeStar.GetDoubleValue("MinAttackV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); MaxMAttackV += (baseXmlNodeSuit.GetDoubleValue("MaxMAttackV") + baseXmlNodeStar.GetDoubleValue("MaxMAttackV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); MinMAttackV += (baseXmlNodeSuit.GetDoubleValue("MinMAttackV") + baseXmlNodeStar.GetDoubleValue("MinMAttackV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); MaxDefenseV += (baseXmlNodeSuit.GetDoubleValue("MaxDefenseV") + baseXmlNodeStar.GetDoubleValue("MaxDefenseV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); MinDefenseV += (baseXmlNodeSuit.GetDoubleValue("MinDefenseV") + baseXmlNodeStar.GetDoubleValue("MinDefenseV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); MaxMDefenseV += (baseXmlNodeSuit.GetDoubleValue("MaxMDefenseV") + baseXmlNodeStar.GetDoubleValue("MaxMDefenseV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); MinMDefenseV += (baseXmlNodeSuit.GetDoubleValue("MinMDefenseV") + baseXmlNodeStar.GetDoubleValue("MinMDefenseV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); LifeV += (baseXmlNodeSuit.GetDoubleValue("MaxLifeV") + baseXmlNodeStar.GetDoubleValue("MaxLifeV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); HitV += (baseXmlNodeSuit.GetDoubleValue("HitV") + baseXmlNodeStar.GetDoubleValue("HitV")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); DodgeV += (baseXmlNodeSuit.GetDoubleValue("Dodge") + baseXmlNodeStar.GetDoubleValue("Dodge")) * (AllAttribute * (double)client.ClientData.MyWingData.ZhuHunNum); } client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 8, MaxAttackV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 7, MinAttackV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 10, MaxMAttackV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 9, MinMAttackV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 4, MaxDefenseV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 3, MinDefenseV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 6, MaxMDefenseV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 5, MinMDefenseV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 18, HitV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 13, LifeV }); client.ClientData.PropsCacheManager.SetExtPropsSingle(new object[] { 6, 19, DodgeV }); } } } }
public static ZhuLingZhuHunError ReqZhuHun(GameClient client) { int oldLevel = client.ClientData.MyWingData.ZhuHunNum; int oldYinLiang = client.ClientData.YinLiang; int oldMoney = client.ClientData.Money1; ZhuLingZhuHunError result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun, false)) { result = ZhuLingZhuHunError.ZhuHunNotOpen; } else { ZhuLingZhuHunLimit i = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID); if (i == null) { result = ZhuLingZhuHunError.ErrorConfig; } else if (client.ClientData.MyWingData.ZhuHunNum >= i.ZhuHunLimit) { result = ZhuLingZhuHunError.ZhuHunFull; } else if (Global.GetTotalGoodsCountByID(client, ZhuLingZhuHunManager.ZhuHunCostGoodsID) < ZhuLingZhuHunManager.ZhuHunCostGoodsNum) { result = ZhuLingZhuHunError.ZhuHunMaterialNotEnough; } else if (Global.GetTotalBindTongQianAndTongQianVal(client) < ZhuLingZhuHunManager.ZhuHunCostJinBi) { result = ZhuLingZhuHunError.ZhuHunJinBiNotEnough; } else if (!Global.SubBindTongQianAndTongQian(client, ZhuLingZhuHunManager.ZhuHunCostJinBi, "注魂消耗")) { result = ZhuLingZhuHunError.DBSERVERERROR; } else { string strCostList = EventLogManager.NewResPropString(ResLogType.SubJinbi, new object[] { -ZhuLingZhuHunManager.ZhuHunCostJinBi, oldYinLiang, client.ClientData.YinLiang, oldMoney, client.ClientData.Money1 }); bool bUsedBinding = true; bool bUsedTimeLimited = false; if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ZhuLingZhuHunManager.ZhuHunCostGoodsID, ZhuLingZhuHunManager.ZhuHunCostGoodsNum, false, out bUsedBinding, out bUsedTimeLimited, false)) { result = ZhuLingZhuHunError.DBSERVERERROR; } else { GoodsData goodsDataCost = new GoodsData { GoodsID = ZhuLingZhuHunManager.ZhuHunCostGoodsID, GCount = ZhuLingZhuHunManager.ZhuHunCostGoodsNum }; strCostList += EventLogManager.AddGoodsDataPropString(goodsDataCost); int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.JinJieFailedNum, client.ClientData.MyWingData.ForgeLevel, client.ClientData.MyWingData.StarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum + 1); if (iRet < 0) { result = ZhuLingZhuHunError.DBSERVERERROR; } else { client.ClientData.MyWingData.ZhuHunNum++; 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); EventLogManager.AddWingZhuHunEvent(client, oldLevel, client.ClientData.MyWingData.ZhuHunNum, strCostList); if (client._IconStateMgr.CheckReborn(client)) { client._IconStateMgr.SendIconStateToClient(client); } result = ZhuLingZhuHunError.Success; } } } } return(result); }
public static void UpdateZhuLingZhuHunProps(GameClient client) { if (null == client.ClientData.MyWingData) { return; } if (client.ClientData.MyWingData.WingID <= 0) { return; } ZhuLingZhuHunEffect e = ZhuLingZhuHunManager.GetEffect(Global.CalcOriginalOccupationID(client)); if (e == null) { return; } double MaxAttackV = 0.0; double MinAttackV = 0.0; double MaxMAttackV = 0.0; double MinMAttackV = 0.0; double MaxDefenseV = 0.0; double MinDefenseV = 0.0; double MaxMDefenseV = 0.0; double MinMDefenseV = 0.0; double LifeV = 0.0; double HitV = 0.0; double DodgeV = 0.0; double AllAttribute = 0.0; if (client.ClientData.MyWingData.Using == 1) { MaxAttackV = e.MaxAttackV * client.ClientData.MyWingData.ZhuLingNum; MaxMAttackV = e.MaxMAttackV * client.ClientData.MyWingData.ZhuLingNum; MaxDefenseV = e.MaxDefenseV * client.ClientData.MyWingData.ZhuLingNum; MaxMDefenseV = e.MaxMDefenseV * client.ClientData.MyWingData.ZhuLingNum; LifeV = e.LifeV * client.ClientData.MyWingData.ZhuLingNum; HitV = e.HitV * client.ClientData.MyWingData.ZhuLingNum; DodgeV = e.DodgeV * client.ClientData.MyWingData.ZhuLingNum; AllAttribute = e.AllAttribute; SystemXmlItem baseXmlNodeSuit = WingPropsCacheManager.GetWingPropsCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID); SystemXmlItem baseXmlNodeStar = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel); if (baseXmlNodeSuit == null) { baseXmlNodeSuit = new SystemXmlItem(); } if (baseXmlNodeStar == null) { baseXmlNodeStar = new SystemXmlItem(); } // 注魂影响翅膀基础属性的百分比 MaxAttackV += (baseXmlNodeSuit.GetDoubleValue("MaxAttackV") + baseXmlNodeStar.GetDoubleValue("MaxAttackV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); MinAttackV += (baseXmlNodeSuit.GetDoubleValue("MinAttackV") + baseXmlNodeStar.GetDoubleValue("MinAttackV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); MaxMAttackV += (baseXmlNodeSuit.GetDoubleValue("MaxMAttackV") + baseXmlNodeStar.GetDoubleValue("MaxMAttackV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); MinMAttackV += (baseXmlNodeSuit.GetDoubleValue("MinMAttackV") + baseXmlNodeStar.GetDoubleValue("MinMAttackV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); MaxDefenseV += (baseXmlNodeSuit.GetDoubleValue("MaxDefenseV") + baseXmlNodeStar.GetDoubleValue("MaxDefenseV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); MinDefenseV += (baseXmlNodeSuit.GetDoubleValue("MinDefenseV") + baseXmlNodeStar.GetDoubleValue("MinDefenseV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); MaxMDefenseV += (baseXmlNodeSuit.GetDoubleValue("MaxMDefenseV") + baseXmlNodeStar.GetDoubleValue("MaxMDefenseV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); MinMDefenseV += (baseXmlNodeSuit.GetDoubleValue("MinMDefenseV") + baseXmlNodeStar.GetDoubleValue("MinMDefenseV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); LifeV += (baseXmlNodeSuit.GetDoubleValue("MaxLifeV") + baseXmlNodeStar.GetDoubleValue("MaxLifeV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); HitV += (baseXmlNodeSuit.GetDoubleValue("HitV") + baseXmlNodeStar.GetDoubleValue("HitV")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); DodgeV += (baseXmlNodeSuit.GetDoubleValue("Dodge") + baseXmlNodeStar.GetDoubleValue("Dodge")) * (AllAttribute * client.ClientData.MyWingData.ZhuHunNum); } client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MaxAttack, MaxAttackV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MinAttack, MinAttackV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MaxMAttack, MaxMAttackV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MinMAttack, MinMAttackV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MaxDefense, MaxDefenseV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MinDefense, MinDefenseV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MaxMDefense, MaxMDefenseV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MinMDefense, MinMDefenseV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.HitV, HitV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.MaxLifeV, LifeV); client.ClientData.PropsCacheManager.SetExtPropsSingle((int)PropsSystemTypes.ZhuLingZhuHunProps, (int)ExtPropIndexes.Dodge, DodgeV); }
public static ZhuLingZhuHunError ReqZhuHun(GameClient client) { if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.WingZhuHun)) { return(ZhuLingZhuHunError.ZhuHunNotOpen); } ZhuLingZhuHunLimit l = ZhuLingZhuHunManager.GetLimit(client.ClientData.MyWingData.WingID); if (l == null) { return(ZhuLingZhuHunError.ErrorConfig); } if (client.ClientData.MyWingData.ZhuHunNum >= l.ZhuHunLimit) { return(ZhuLingZhuHunError.ZhuHunFull); } if (Global.GetTotalGoodsCountByID(client, ZhuLingZhuHunManager.ZhuHunCostGoodsID) < ZhuLingZhuHunManager.ZhuHunCostGoodsNum) { return(ZhuLingZhuHunError.ZhuHunMaterialNotEnough); } if (Global.GetTotalBindTongQianAndTongQianVal(client) < ZhuLingZhuHunManager.ZhuHunCostJinBi) { return(ZhuLingZhuHunError.ZhuHunJinBiNotEnough); } if (!Global.SubBindTongQianAndTongQian(client, ZhuLingZhuHunManager.ZhuHunCostJinBi, "注魂消耗")) { return(ZhuLingZhuHunError.DBSERVERERROR); } bool bUsedBinding = true; bool bUsedTimeLimited = false; if (!GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ZhuLingZhuHunManager.ZhuHunCostGoodsID, ZhuLingZhuHunManager.ZhuHunCostGoodsNum, false, out bUsedBinding, out bUsedTimeLimited)) { return(ZhuLingZhuHunError.DBSERVERERROR); } int iRet = MUWingsManager.WingUpDBCommand(client, client.ClientData.MyWingData.DbID, client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.JinJieFailedNum, client.ClientData.MyWingData.ForgeLevel, client.ClientData.MyWingData.StarExp, client.ClientData.MyWingData.ZhuLingNum, client.ClientData.MyWingData.ZhuHunNum + 1); if (iRet < 0) { return(ZhuLingZhuHunError.DBSERVERERROR); } client.ClientData.MyWingData.ZhuHunNum++; ZhuLingZhuHunManager.UpdateZhuLingZhuHunProps(client); // 通知客户端属性变化 GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); // 总生命值和魔法值变化通知(同一个地图才需要通知) GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); return(ZhuLingZhuHunError.Success); }