/// <summary> /// 返回声望勋章数据 /// </summary> /// <returns></returns> public static PrestigeMedalData GetPrestigeMedalData(GameClient client) { // 如果1.4.1的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1)) { return(null); } //开放等级 声望4阶 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.PrestigeMedal)) { return(null); } PrestigeMedalData prestigeMedalData = client.ClientData.prestigeMedalData; if (prestigeMedalData == null) { PrestigeMedalBasicData basic = null; prestigeMedalData = new PrestigeMedalData(); List <int> data = Global.GetRoleParamsIntListFromDB(client, RoleParamName.PrestigeMedal); if (data == null || data.Count <= 0) { basic = GetPrestigeMedalBasicDataByID(_defaultMedalID); prestigeMedalData.RoleID = client.ClientData.RoleID; prestigeMedalData.MedalID = basic.MedalID; ModifyPrestigeMedalData(client, prestigeMedalData, true); } else { prestigeMedalData.RoleID = client.ClientData.RoleID; prestigeMedalData.MedalID = data[0]; prestigeMedalData.LifeAdd = data[1]; prestigeMedalData.AttackAdd = data[2]; prestigeMedalData.DefenseAdd = data[3]; prestigeMedalData.HitAdd = data[4]; if (prestigeMedalData.MedalID > _prestigeMedalBasicList.Count) { prestigeMedalData.UpResultType = 3; basic = GetPrestigeMedalBasicDataByID(_prestigeMedalBasicList.Count); } else { basic = GetPrestigeMedalBasicDataByID(prestigeMedalData.MedalID); } } prestigeMedalData.Diamond = GetPrestigeMedalDiamond(client, GetPrestigeMedalUpCount(client)); prestigeMedalData.Prestige = basic.PrestigeCost; client.ClientData.prestigeMedalData = prestigeMedalData; } prestigeMedalData.PrestigeLeft = GameManager.ClientMgr.GetShengWangValue(client); return(prestigeMedalData); }
private bool IsGongNengOpened(GameClient client, bool bHint = true) { if (!GameManager.VersionSystemOpenMgr.IsVersionSystemOpen(VersionSystemOpenKey.MoRiJudge)) { return(false); } return(GlobalNew.IsGongNengOpened(client, GongNengIDs.MoRiJudge, bHint)); }
/// <summary> /// 处理塔罗牌升级或激活 /// </summary> /// <param name="client"></param> /// <param name="goodID"></param> /// <param name="partCount"></param> /// <returns></returns> public ETarotResult ProcessTarotUpCmd(GameClient client, int goodID) { //判断功能是否开启 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard)) { return(ETarotResult.NotOpen); } TarotSystemData tarotData = client.ClientData.TarotData; //获取要升级的塔罗牌数据 TarotCardData currentTarot = tarotData.TarotCardDatas.Find(x => x.GoodId == goodID); if (currentTarot == null) { //激活 currentTarot = new TarotCardData(); currentTarot.GoodId = goodID; tarotData.TarotCardDatas.Add(currentTarot); } //判断是否可以升级 if (currentTarot.Level >= TarotMaxLevelDict[goodID]) { return(ETarotResult.MaxLevel); } //获取下级塔罗牌对应配置模板 TarotTemplate nextTemp = TarotTemplates.Find(x => x.GoodsID == goodID && x.Level == currentTarot.Level + 1); if (nextTemp == null) { return(ETarotResult.Error); } //判断背包碎片是否足够 var hasPartCount = Global.GetTotalGoodsCountByID(client, nextTemp.NeedGoodID); if (hasPartCount < nextTemp.NeedPartCount) { return(ETarotResult.NeedPart); } //使用物品 优先使用绑定物品 bool usedBinding = false; bool usedTimeLimited = false; if (Global.UseGoodsBindOrNot(client, nextTemp.NeedGoodID, nextTemp.NeedPartCount, true, out usedBinding, out usedTimeLimited) < 1) { return(ETarotResult.NeedPart); } //处理升级 currentTarot.Level += 1; //更新玩家数据 UpdataPalyerTarotAttr(client); //向DB服更新数据 UpdateTarotData2DB(client, currentTarot, null); return(ETarotResult.Success); }
public static void initSetPrestigeMedalProps(GameClient client) { if (!GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1)) { if (GlobalNew.IsGongNengOpened(client, GongNengIDs.PrestigeMedal, false)) { PrestigeMedalData PrestigeMedalData = PrestigeMedalManager.GetPrestigeMedalData(client); PrestigeMedalManager.SetPrestigeMedalProps(client, PrestigeMedalData); } } }
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); }
/// <summary> /// 设置塔罗牌上阵位置 (0=为上阵) /// </summary> /// <param name="client"></param> /// <param name="goodID"></param> /// <param name="pos"></param> /// <returns></returns> public ETarotResult ProcessSetTarotPosCmd(GameClient client, int goodID, byte pos) { //判断功能是否开启 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard)) { return(ETarotResult.NotOpen); } //判断位置是否合法 if (pos < 0 || pos > 6) { return(ETarotResult.Error); } TarotSystemData tarotData = client.ClientData.TarotData; //获取塔罗牌数据 TarotCardData currentTarot = tarotData.TarotCardDatas.Find(x => x.GoodId == goodID); if (currentTarot == null) { return(ETarotResult.Error); } if (currentTarot.Postion == pos) { return(ETarotResult.Error); } //上阵 if (pos > 0) { //判断当前卡牌是否已在阵上 if (currentTarot.Postion > 0) { return(ETarotResult.Error); } //判断装备的位置是否为空 TarotCardData targetTarot = tarotData.TarotCardDatas.Find(x => x.Postion == pos); if (targetTarot != null) { targetTarot.Postion = 0; } } currentTarot.Postion = pos; //更新玩家塔罗牌加成属性 UpdataPalyerTarotAttr(client); //向DB服更新数据 UpdateTarotData2DB(client, currentTarot, null); return(ETarotResult.Success); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = true; GongNengIDs gongnengId = (GongNengIDs)Convert.ToInt32(arg); if (!GlobalNew.IsGongNengOpened(client, gongnengId, false)) { bOK = false; } if (!bOK) { failedMsg = string.Format("物品对应的功能没有开启", new object[0]); } return(bOK); }
public static bool IsGongNengOpened(GameClient client) { // 如果2.0的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System2Dot0)) { return(false); } if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.PetSkill)) { return(false); } if (!GameManager.VersionSystemOpenMgr.IsVersionSystemOpen(VersionSystemOpenKey.PetSkill)) { return(false); } return(true); }
public TarotManager.ETarotResult ProcessSetTarotPosCmd(GameClient client, int goodID, byte pos) { TarotManager.ETarotResult result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard, false)) { result = TarotManager.ETarotResult.NotOpen; } else if (pos < 0 || pos > 6) { result = TarotManager.ETarotResult.Error; } else { TarotSystemData tarotData = client.ClientData.TarotData; TarotCardData currentTarot = tarotData.TarotCardDatas.Find((TarotCardData x) => x.GoodId == goodID); if (currentTarot == null) { result = TarotManager.ETarotResult.Error; } else if (currentTarot.Postion == pos) { result = TarotManager.ETarotResult.Error; } else { if (pos > 0) { if (currentTarot.Postion > 0) { return(TarotManager.ETarotResult.Error); } TarotCardData targetTarot = tarotData.TarotCardDatas.Find((TarotCardData x) => x.Postion == pos); if (targetTarot != null) { targetTarot.Postion = 0; } } currentTarot.Postion = pos; this.UpdataPalyerTarotAttr(client); TarotManager.UpdateTarotData2DB(client, currentTarot, null); result = TarotManager.ETarotResult.Success; } } return(result); }
/// <summary> /// 设置声望勋章属性 /// </summary> /// <param name="client"></param> public static void initSetPrestigeMedalProps(GameClient client) { // 如果1.4.1的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1)) { return; } //开放等级 声望4阶 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.PrestigeMedal)) { return; } PrestigeMedalData PrestigeMedalData = GetPrestigeMedalData(client); SetPrestigeMedalProps(client, PrestigeMedalData); }
public TarotManager.ETarotResult ProcessTarotUpCmd(GameClient client, int goodID) { TarotManager.ETarotResult result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard, false)) { result = TarotManager.ETarotResult.NotOpen; } else { TarotSystemData tarotData = client.ClientData.TarotData; TarotCardData currentTarot = tarotData.TarotCardDatas.Find((TarotCardData x) => x.GoodId == goodID); if (currentTarot == null) { currentTarot = new TarotCardData(); currentTarot.GoodId = goodID; tarotData.TarotCardDatas.Add(currentTarot); } if (currentTarot.Level >= TarotManager.TarotMaxLevelDict[goodID]) { result = TarotManager.ETarotResult.MaxLevel; } else { TarotManager.TarotTemplate nextTemp = TarotManager.TarotTemplates.Find((TarotManager.TarotTemplate x) => x.GoodsID == goodID && x.Level == currentTarot.Level + 1); if (nextTemp == null) { result = TarotManager.ETarotResult.Error; } else if (currentTarot.TarotMoney < nextTemp.NeedPartCount) { result = TarotManager.ETarotResult.NeedPart; } else { currentTarot.TarotMoney -= nextTemp.NeedPartCount; currentTarot.Level++; this.UpdataPalyerTarotAttr(client); TarotManager.UpdateTarotData2DB(client, currentTarot, null); result = TarotManager.ETarotResult.Success; } } } return(result); }
public bool processCmd(GameClient client, string[] cmdParams) { int nID = (int)this.CmdID; bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.ZhuanHuan, true)) { result = true; } else if (this.CmdID == TCPGameServerCmds.CMD_SPR_EXEC_LIANZHI) { int type = Global.SafeConvertToInt32(cmdParams[1]); int count = Global.SafeConvertToInt32(cmdParams[2]); result = LianZhiManager.GetInstance().ExecLianZhi(client, type, count); } else { result = (this.CmdID == TCPGameServerCmds.CMD_SPR_QUERY_LIANZHICOUNT && LianZhiManager.GetInstance().QueryLianZhiCount(client)); } return(result); }
/// <summary> /// 获取天赋数据 /// </summary> private static TalentData GetTalentData(GameClient client) { //开放 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Talent)) { return(null); } // 如果1.6的功能没开放 if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot6)) { return(null); } client.ClientData.MyTalentData.IsOpen = true; client.ClientData.MyTalentData.SkillOneValue = client.ClientData.MyTalentPropData.SkillOneValue; client.ClientData.MyTalentData.SkillAllValue = client.ClientData.MyTalentPropData.SkillAllValue; client.ClientData.MyTalentData.Occupation = client.ClientData.Occupation; return(client.ClientData.MyTalentData); }
private static TalentData GetTalentData(GameClient client) { TalentData result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Talent, false)) { result = null; } else if (GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot6)) { result = null; } else { client.ClientData.MyTalentData.IsOpen = true; client.ClientData.MyTalentData.SkillOneValue = client.ClientData.MyTalentPropData.SkillOneValue; client.ClientData.MyTalentData.SkillAllValue = client.ClientData.MyTalentPropData.SkillAllValue; client.ClientData.MyTalentData.Occupation = client.ClientData.Occupation; result = client.ClientData.MyTalentData; } return(result); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.GamePayerRolePartChiBang, true)) { result = false; } else { if (client != null && client.ClientData.MyWingData != null && !string.IsNullOrEmpty(arg)) { List <int> iArgList = Global.StringToIntList(arg, '|'); if (iArgList.Count == 2) { if (client.ClientData.MyWingData.WingID < iArgList[0] || (client.ClientData.MyWingData.WingID == iArgList[0] && client.ClientData.MyWingData.ForgeLevel < iArgList[1])) { bOK = true; } } else if (iArgList.Count == 1) { if (client.ClientData.MyWingData.WingID < iArgList[0]) { bOK = true; } } } if (!bOK) { failedMsg = GLang.GetLang(8019, new object[0]); } result = bOK; } return(result); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.GamePayerRolePartXingZuo, true)) { result = false; } else { if (!GameManager.StarConstellationMgr.IfStarConstellationPerfect(client)) { bOK = true; } if (!bOK) { failedMsg = GLang.GetLang(8014, new object[0]); } result = bOK; } return result; }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.GamePayerRolePartChiBang, true)) { result = false; } else { if (!MUWingsManager.IfWingPerfect(client)) { bOK = true; } else if (!LingYuManager.IfLingYuPerfect(client)) { bOK = true; } else if (!ZhuLingZhuHunManager.IfZhuLingPerfect(client)) { bOK = true; } else if (!ZhuLingZhuHunManager.IfZhuHunPerfect(client)) { bOK = true; } if (!bOK) { failedMsg = GLang.GetLang(8018, new object[0]); } result = bOK; } return(result); }
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 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); }
private bool IsGongNengOpened(GameClient client, bool bHint = true) { return(GameManager.VersionSystemOpenMgr.IsVersionSystemOpen("MoRiShenPan") && GlobalNew.IsGongNengOpened(client, GongNengIDs.MoRiJudge, bHint)); }
public static bool IsGongNengOpened(GameClient client) { return(!GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System2Dot0) && GlobalNew.IsGongNengOpened(client, GongNengIDs.ZhanMengShenDian, false) && GameManager.VersionSystemOpenMgr.IsVersionSystemOpen("UnionPalace")); }
public static bool IsGongNengOpened(GameClient client) { return(!GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System2Dot0) && GlobalNew.IsGongNengOpened(client, GongNengIDs.PetSkill, false) && GameManager.VersionSystemOpenMgr.IsVersionSystemOpen("PetSkill")); }
public bool processCmd(Logic.GameClient client, string[] cmdParams) { int nID = (int)TCPGameServerCmds.CMD_SPR_WINGUPGRADE; int nRoleID = Global.SafeConvertToInt32(cmdParams[0]); int nUpWingMode = Global.SafeConvertToInt32(cmdParams[1]); //0: 道具进阶, 1: 钻石进阶 string strCmd = ""; if (null == client.ClientData.MyWingData) { strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } // 已到最高级 if (client.ClientData.MyWingData.WingID >= MUWingsManager.MaxWingID) { strCmd = string.Format("{0}:{1}:{2}:{3}", -8, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } // 获取进阶信息表 SystemXmlItem upStarXmlItem = MUWingsManager.GetWingUPCacheItem(client.ClientData.MyWingData.WingID + 1); if (null == upStarXmlItem) { strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } if (0 == nUpWingMode) { // 获取进阶需要的道具的物品信息 string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods"); // 解析物品ID与数量 string[] itemParams = strReqItemID.Split(','); if (null == itemParams || itemParams.Length != 2) { strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } int originGoodsID = Convert.ToInt32(itemParams[0]); int originGoodsNum = Convert.ToInt32(itemParams[1]); if (originGoodsID <= 0 || originGoodsNum <= 0) { strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } GoodsReplaceResult replaceRet = GoodsReplaceManager.Instance().GetReplaceResult(client, originGoodsID); if (replaceRet == null || replaceRet.TotalGoodsCnt() < originGoodsNum) { // 物品数量不够 strCmd = string.Format("{0}:{1}:{2}:{3}", -4, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } List <GoodsReplaceResult.ReplaceItem> realCostList = new List <GoodsReplaceResult.ReplaceItem>(); // 1:替换后的绑定材料 // 2:替换后的非绑定材料 // 3:原始绑定材料 // 4:原始非绑定材料 realCostList.AddRange(replaceRet.BindList); realCostList.AddRange(replaceRet.UnBindList); realCostList.Add(replaceRet.OriginBindGoods); realCostList.Add(replaceRet.OriginUnBindGoods); int hasUseCnt = 0; int stillNeedCnt = originGoodsNum; foreach (var item in realCostList) { if (item.GoodsCnt <= 0) { continue; } 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)) { 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)) { bFailed = true; } } stillNeedCnt -= realCostCnt; if (bFailed) { strCmd = string.Format("{0}:{1}:{2}:{3}", -5, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } } } else { // 获取进阶需要的钻石数量 int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi"); if (nReqZuanShi <= 0) { strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } // 判断用户点卷额是否不足【钻石】 if (client.ClientData.UserMoney < nReqZuanShi) { //用户点卷额不足【钻石】 strCmd = string.Format("{0}:{1}:{2}:{3}", -6, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } //先DBServer请求扣费 //扣除用户点卷 if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀进阶")) { //扣除用户点卷失败 strCmd = string.Format("{0}:{1}:{2}:{3}", -7, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } } int nLuckOne = upStarXmlItem.GetIntValue("LuckyOne"); int nLuckyTwo = upStarXmlItem.GetIntValue("LuckyTwo"); 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; // LuckyOne+提升获得幸运点 < LuckyTwo;必定不会提升成功 if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < nLuckyTwo) { // 幸运点加1 nNextJinJieFailedNum++; } // LuckyOne+提升获得幸运点>= LuckyTwo,则根据配置得到LuckyTwoRate概率判定是否能够完成进阶操作 else if (nLuckOne + client.ClientData.MyWingData.JinJieFailedNum < 110000) { // int nRandNum = Global.GetRandomNumber(0, 100); if (nRandNum < nLuckTwoRate) { // 进阶成功 nNextWingID++; // 幸运点清0 nNextJinJieFailedNum = 0; // 星级清0 nNextStarLevel = 0; // 星级经验清0 nNextStarExp = 0; } else { // 幸运点加1 nNextJinJieFailedNum++; } } // LuckyOne+提升获得幸运点>=110000时,进阶必定成功 else { // 进阶成功 nNextWingID++; // 幸运点清0 nNextJinJieFailedNum = 0; // 星级清0 nNextStarLevel = 0; // 星级经验清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) { strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); client.sendCmd(nID, strCmd); return(true); } else { strCmd = string.Format("{0}:{1}:{2}:{3}", 0, nRoleID, nNextWingID, nNextJinJieFailedNum); client.sendCmd(nID, strCmd); 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); // 更新翅膀的新等级,星数 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); 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); } //[bing] 刷新客户端活动叹号 if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriWing)) { client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } } } return(true); }
/// <summary> /// 使用国王特权 /// </summary> /// <param name="client"></param> /// <returns></returns> public ETarotResult ProcessUseKingPrivilegeCmd(GameClient client, out string strret) { strret = string.Empty; //判断功能是否开启 if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard)) { return(ETarotResult.NotOpen); } TarotSystemData tarotData = client.ClientData.TarotData; if (tarotData.KingData.StartTime > 0) { //重置 tarotData.KingData = new TarotKingData(); //更新玩家塔罗牌加成属性 UpdataPalyerTarotAttr(client); //向DB服更新数据 UpdateTarotData2DB(client, null, tarotData.KingData); return(ETarotResult.Success); } //判断背包碎片是否足够 var kingItemCount = Global.GetTotalGoodsCountByID(client, KingItemId); if (kingItemCount < UseKingItemCount) { return(ETarotResult.ItemNotEnough); } //使用物品 优先使用绑定物品 bool usedBinding = false; bool usedTimeLimited = false; if (Global.UseGoodsBindOrNot(client, KingItemId, UseKingItemCount, true, out usedBinding, out usedTimeLimited) < 1) { return(ETarotResult.NeedPart); } tarotData.KingData.StartTime = TimeUtil.NOW(); tarotData.KingData.BufferSecs = KingBuffTime; TarotCardIds = Global.RandomSortList(TarotCardIds); KingBuffValueList = Global.RandomSortList(KingBuffValueList); tarotData.KingData.AddtionDict = new Dictionary <int, int>(); var totalNum = KingBuffValueList[0]; if (totalNum < 3) { return(ETarotResult.Error); } for (var i = 0; i < 3; i++) { var ranNum = 1; if (i < 2) { ranNum = Global.GetRandomNumber(0, totalNum - 3); totalNum -= ranNum; } else { ranNum = totalNum - 3; } var ranGoodId = TarotCardIds[i]; strret += ranGoodId + ":" + (int)(ranNum + 1) + ":"; tarotData.KingData.AddtionDict.Add(ranGoodId, ranNum + 1); } //更新玩家塔罗牌加成属性 UpdataPalyerTarotAttr(client); //向DB服更新数据 UpdateTarotData2DB(client, null, tarotData.KingData); strret = strret.TrimEnd(':'); return(ETarotResult.Success); }
public TarotManager.ETarotResult ProcessUseKingPrivilegeCmd(GameClient client, out string strret) { strret = string.Empty; TarotManager.ETarotResult result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard, false)) { result = TarotManager.ETarotResult.NotOpen; } else { TarotSystemData tarotData = client.ClientData.TarotData; if (tarotData.KingData.StartTime > 0L) { tarotData.KingData = new TarotKingData(); this.UpdataPalyerTarotAttr(client); TarotManager.UpdateTarotData2DB(client, null, tarotData.KingData); result = TarotManager.ETarotResult.Success; } else { int kingItemCount = Global.GetTotalGoodsCountByID(client, TarotManager.KingItemId); if (kingItemCount < TarotManager.UseKingItemCount) { result = TarotManager.ETarotResult.ItemNotEnough; } else { bool usedBinding = false; bool usedTimeLimited = false; if (Global.UseGoodsBindOrNot(client, TarotManager.KingItemId, TarotManager.UseKingItemCount, true, out usedBinding, out usedTimeLimited) < 1) { result = TarotManager.ETarotResult.NeedPart; } else { tarotData.KingData.StartTime = TimeUtil.NOW(); tarotData.KingData.BufferSecs = TarotManager.KingBuffTime; TarotManager.TarotCardIds = Global.RandomSortList <int>(TarotManager.TarotCardIds); TarotManager.KingBuffValueList = Global.RandomSortList <int>(TarotManager.KingBuffValueList); tarotData.KingData.AddtionDict = new Dictionary <int, int>(); int totalNum = TarotManager.KingBuffValueList[0]; if (totalNum < 3) { result = TarotManager.ETarotResult.Error; } else { for (int i = 0; i < 3; i++) { int ranNum; if (i < 2) { ranNum = Global.GetRandomNumber(0, totalNum - 3); totalNum -= ranNum; } else { ranNum = totalNum - 3; } int ranGoodId = TarotManager.TarotCardIds[i]; object obj = strret; strret = string.Concat(new object[] { obj, ranGoodId, ":", ranNum + 1, ":" }); tarotData.KingData.AddtionDict.Add(ranGoodId, ranNum + 1); } this.UpdataPalyerTarotAttr(client); TarotManager.UpdateTarotData2DB(client, null, tarotData.KingData); strret = strret.TrimEnd(new char[] { ':' }); result = TarotManager.ETarotResult.Success; } } } } } return(result); }
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); }
public TarotManager.ETarotResult ProcessTarotMoneyCmd(GameClient client, int goodId, int num, int dbid, out int resNum) { resNum = 0; TarotManager.ETarotResult result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.TarotCard, false)) { result = TarotManager.ETarotResult.NotOpen; } else { GoodsData Data = Global.GetGoodsByDbID(client, dbid); if (Data == null) { result = TarotManager.ETarotResult.Error; } else if (TarotManager.TarotNeedCardNum.ContainsKey(goodId)) { if (num < 0 || num > Data.GCount) { result = TarotManager.ETarotResult.MoneyNumError; } else { TarotManager.TarotTemplate nextTemp = TarotManager.TarotTemplates.Find((TarotManager.TarotTemplate x) => x.NeedGoodID == goodId); if (nextTemp == null) { result = TarotManager.ETarotResult.NotFindGood; } else { TarotSystemData tarotData = client.ClientData.TarotData; TarotCardData currentTarot = tarotData.TarotCardDatas.Find((TarotCardData x) => x.GoodId == nextTemp.GoodsID); if (currentTarot == null) { currentTarot = new TarotCardData(); currentTarot.GoodId = nextTemp.GoodsID; tarotData.TarotCardDatas.Add(currentTarot); } int reNum = TarotManager.TarotNeedCardNum[goodId] - this.CountTarotNowToCurrLevel(goodId, currentTarot.Level) - currentTarot.TarotMoney; if (reNum == 0) { result = TarotManager.ETarotResult.HasMaxNum; } else { if (num > reNum) { num = reNum; } if (GameManager.ClientMgr.NotifyUseGoodsByDbId(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, dbid, num, false, false)) { GoodsData goodsData = Global.GetGoodsByDbID(client, dbid); if (null != goodsData) { resNum = goodsData.GCount; } currentTarot.TarotMoney += num; EventLogManager.AddRoleEvent(client, OpTypes.Trace, OpTags.TarotMoney, LogRecordType.TarotMoney, new object[] { num, currentTarot.TarotMoney, dbid, "塔罗牌货币增加" }); this.UpdataPalyerTarotAttr(client); TarotManager.UpdateTarotData2DB(client, currentTarot, null); GameManager.logDBCmdMgr.AddDBLogInfo(dbid, "塔罗牌货币", "塔罗牌", client.ClientData.RoleName, "系统", "修改", 0, client.ClientData.ZoneID, client.strUserID, num, client.ServerId, null); result = TarotManager.ETarotResult.Success; } else { result = TarotManager.ETarotResult.UseGoodError; } } } } } else { result = TarotManager.ETarotResult.GoodIdError; } } 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); }
/// <summary> /// 声望勋章——提升 /// </summary> /// <param name="client"></param> /// <param name="MedalID"></param> /// <returns></returns> public static PrestigeMedalData UpPrestigeMedal(GameClient client, int MedalID) { PrestigeMedalData prestigeMedalData = client.ClientData.prestigeMedalData; if (prestigeMedalData != null && prestigeMedalData.UpResultType == (int)PrestigeMedalResultType.End) { prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.EOver; return(prestigeMedalData); } if (prestigeMedalData == null || prestigeMedalData.MedalID != MedalID) { prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.Fail; return(prestigeMedalData); } //开放等级 声望4阶 bool isOpen = GlobalNew.IsGongNengOpened(client, GongNengIDs.PrestigeMedal); if (!isOpen) { prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.EnoOpen; return(prestigeMedalData); } PrestigeMedalBasicData basicMedal = GetPrestigeMedalBasicDataByID(MedalID); //声望 int prestigeNow = GameManager.ClientMgr.GetShengWangValue(client); if (basicMedal.PrestigeCost > prestigeNow) { prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.EnoPrestige; return(prestigeMedalData); } //钻石 int upCount = GetPrestigeMedalUpCount(client); int diamondNeed = GetPrestigeMedalDiamond(client, upCount); if (diamondNeed > 0 && !GameManager.ClientMgr.SubUserMoney(client, diamondNeed, "声望勋章提升")) { prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.EnoDiamond; return(prestigeMedalData); } try { GameManager.ClientMgr.ModifyShengWangValue(client, -basicMedal.PrestigeCost, "声望勋章提升"); } catch (Exception) { prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.EnoPrestige; return(prestigeMedalData); } //几率 int[] addNums = null; int rate = 0; int r = Global.GetRandomNumber(0, 100); for (int i = 0; i < basicMedal.RateList.Count; i++) { rate += basicMedal.RateList[i]; if (r <= rate) { addNums = basicMedal.AddNumList[i]; prestigeMedalData.BurstType = i;//暴击 break; } } //加成 prestigeMedalData.LifeAdd += addNums[0] * _medalRate; prestigeMedalData.LifeAdd = prestigeMedalData.LifeAdd > basicMedal.LifeMax ? basicMedal.LifeMax : prestigeMedalData.LifeAdd; prestigeMedalData.AttackAdd += addNums[1] * _medalRate; prestigeMedalData.AttackAdd = prestigeMedalData.AttackAdd > basicMedal.AttackMax ? basicMedal.AttackMax : prestigeMedalData.AttackAdd; prestigeMedalData.DefenseAdd += addNums[2] * _medalRate; prestigeMedalData.DefenseAdd = prestigeMedalData.DefenseAdd > basicMedal.DefenseMax ? basicMedal.DefenseMax : prestigeMedalData.DefenseAdd; prestigeMedalData.HitAdd += addNums[3] * _medalRate; prestigeMedalData.HitAdd = prestigeMedalData.HitAdd > basicMedal.HitMax ? basicMedal.HitMax : prestigeMedalData.HitAdd; if (prestigeMedalData.LifeAdd < basicMedal.LifeMax || prestigeMedalData.DefenseAdd < basicMedal.DefenseMax || prestigeMedalData.AttackAdd < basicMedal.AttackMax || prestigeMedalData.HitAdd < basicMedal.HitMax) { prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.Success; prestigeMedalData.Prestige = basicMedal.PrestigeCost; prestigeMedalData.Diamond = GetPrestigeMedalDiamond(client, upCount + 1); } else { prestigeMedalData.MedalID += 1; prestigeMedalData.LifeAdd = 0; prestigeMedalData.AttackAdd = 0; prestigeMedalData.DefenseAdd = 0; prestigeMedalData.HitAdd = 0; prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.Next; if (prestigeMedalData.MedalID > _prestigeMedalBasicList.Count) { prestigeMedalData.UpResultType = (int)PrestigeMedalResultType.End; prestigeMedalData.Prestige = 0; prestigeMedalData.Diamond = 0; } else { basicMedal = GetPrestigeMedalBasicDataByID(prestigeMedalData.MedalID); prestigeMedalData.Prestige = basicMedal.PrestigeCost; prestigeMedalData.Diamond = GetPrestigeMedalDiamond(client, upCount + 1); } } ModifyPrestigeMedalUpCount(client, upCount + 1, true); ModifyPrestigeMedalData(client, prestigeMedalData); client.ClientData.prestigeMedalData = prestigeMedalData; SetPrestigeMedalProps(client, prestigeMedalData); //通知客户端属性变化 GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); // 总生命值和魔法值变化通知(同一个地图才需要通知) GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); prestigeMedalData.PrestigeLeft = GameManager.ClientMgr.GetShengWangValue(client); return(prestigeMedalData); }
/// <summary> /// 翅膀升星处理 /// </summary> public bool processCmd(Logic.GameClient client, string[] cmdParams) { //int nID = (int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR; int nRoleID = Global.SafeConvertToInt32(cmdParams[0]); int nUpStarMode = Global.SafeConvertToInt32(cmdParams[1]); //0: 道具升星, 1: 钻石升星 //string strCmd = ""; SCWingStarUp scData = null; if (null == client.ClientData.MyWingData) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } // 获取升星信息表 SystemXmlItem upStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, client.ClientData.MyWingData.ForgeLevel + 1); if (null == upStarXmlItem) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(StdErrorCode.Error_Level_Reach_Max_Level, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } string strWingShengXing = GameManager.systemParamsList.GetParamValueByName("WingShengXing"); if ("" == strWingShengXing) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } // 解析升级暴率 string[] wingShengXing = strWingShengXing.Split(','); if (3 != wingShengXing.Length) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } // 暴率 int nPowRate = 0; // 增加的星经验 int nAddExp = 0; if (0 == nUpStarMode) { nPowRate = (int)(Convert.ToDouble(wingShengXing[0]) * 100.0); nAddExp = Convert.ToInt32(upStarXmlItem.GetIntValue("GoodsExp")); } else { nPowRate = (int)(Convert.ToDouble(wingShengXing[1]) * 100.0); nAddExp = Convert.ToInt32(upStarXmlItem.GetIntValue("ZuanShiExp")); } // 暴升,乘以经验倍数 int nRandNum = Global.GetRandomNumber(0, 100); if (nRandNum < nPowRate) { nAddExp *= Convert.ToInt32(wingShengXing[2]); } int nUpStarReqExp = upStarXmlItem.GetIntValue("StarExp"); int nNextStarLevel = client.ClientData.MyWingData.ForgeLevel; int nNextStarExp = 0; if (client.ClientData.MyWingData.StarExp + nAddExp >= nUpStarReqExp) { if (nNextStarLevel < MUWingsManager.MaxWingEnchanceLevel) { // 改变星级,剩余的经验改到下级 nNextStarLevel += 1; nNextStarExp = client.ClientData.MyWingData.StarExp + nAddExp - nUpStarReqExp; // 连续升星 while (true) { if (nNextStarLevel >= MUWingsManager.MaxWingEnchanceLevel) { break; } SystemXmlItem nextStarXmlItem = WingStarCacheManager.GetWingStarCacheItem(Global.CalcOriginalOccupationID(client), client.ClientData.MyWingData.WingID, nNextStarLevel + 1); if (null == upStarXmlItem) { break; } int nNextUpStarReqExp = nextStarXmlItem.GetIntValue("StarExp"); if (nNextStarExp >= nNextUpStarReqExp) { nNextStarLevel += 1; nNextStarExp = nNextStarExp - nNextUpStarReqExp; } else { break; } } } else { // 已经达到最高星 nNextStarExp = nUpStarReqExp; } } else { nNextStarExp = client.ClientData.MyWingData.StarExp + nAddExp; } if (0 == nUpStarMode) { //获取强化需要的道具的物品ID string strReqItemID = upStarXmlItem.GetStringValue("NeedGoods"); // 解析物品ID与数量 string[] itemParams = strReqItemID.Split(','); if (null == itemParams || itemParams.Length != 2) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } int originGoodsID = Convert.ToInt32(itemParams[0]); int originGoodsNum = Convert.ToInt32(itemParams[1]); if (originGoodsID <= 0 || originGoodsNum <= 0) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } GoodsReplaceResult replaceRet = GoodsReplaceManager.Instance().GetReplaceResult(client, originGoodsID); if (replaceRet == null || replaceRet.TotalGoodsCnt() < originGoodsNum) { // 物品数量不够 //strCmd = string.Format("{0}:{1}:{2}:{3}", -4, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-4, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } List <GoodsReplaceResult.ReplaceItem> realCostList = new List <GoodsReplaceResult.ReplaceItem>(); // 1:替换后的绑定材料 // 2:替换后的非绑定材料 // 3:原始绑定材料 // 4:原始非绑定材料 realCostList.AddRange(replaceRet.BindList); realCostList.AddRange(replaceRet.UnBindList); realCostList.Add(replaceRet.OriginBindGoods); realCostList.Add(replaceRet.OriginUnBindGoods); int hasUseCnt = 0; int stillNeedCnt = originGoodsNum; foreach (var item in realCostList) { if (item.GoodsCnt <= 0) { continue; } 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)) { 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)) { bFailed = true; } } stillNeedCnt -= realCostCnt; if (bFailed) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -5, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-5, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } } } else { // 获取强化需要的钻石数量 int nReqZuanShi = upStarXmlItem.GetIntValue("NeedZuanShi"); if (nReqZuanShi <= 0) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } //判断用户点卷额是否不足【钻石】 if (client.ClientData.UserMoney < nReqZuanShi) { //用户点卷额不足【钻石】 //strCmd = string.Format("{0}:{1}:{2}:{3}", -6, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-6, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } //先DBServer请求扣费 //扣除用户点卷 if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, nReqZuanShi, "翅膀升星")) { //扣除用户点卷失败 //strCmd = string.Format("{0}:{1}:{2}:{3}", -7, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-7, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } } // 七日活动 // 翅膀升级和升阶次数,成功失败都算 GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingSuitStarTimes)); // 将改变保存到数据库 int iRet = MUWingsManager.WingUpStarDBCommand(client, client.ClientData.MyWingData.DbID, nNextStarLevel, nNextStarExp); if (iRet < 0) { //strCmd = string.Format("{0}:{1}:{2}:{3}", -3, nRoleID, 0, 0); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(-3, nRoleID, 0, 0); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); return(true); } else { //strCmd = string.Format("{0}:{1}:{2}:{3}", 0, nRoleID, nNextStarLevel, nNextStarExp); //client.sendCmd(nID, strCmd); scData = new SCWingStarUp(0, nRoleID, nNextStarLevel, nNextStarExp); client.sendCmd((int)TCPGameServerCmds.CMD_SPR_WINGUPSTAR, scData); 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); client.ClientData.MyWingData.ForgeLevel = nNextStarLevel; // 七日活动 GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.WingLevel)); bool newWingLingYuOpened = GlobalNew.IsGongNengOpened(client, GongNengIDs.WingLingYu); 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); } //[bing] 刷新客户端活动叹号 if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriWing) || client._IconStateMgr.CheckSpecialActivity(client)) { client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } } } return(true); }