public MarryOtherResult ChangeRing(GameClient client, int nRingID) { MarryOtherResult result; if (-1 == client.ClientData.MyMarriageData.byMarrytype) { result = MarryOtherResult.NotMarriaged; } else if (nRingID - client.ClientData.MyMarriageData.nRingID != 1) { result = MarryOtherResult.NotNexRise; } else { SystemXmlItem RingXmlItem = null; if (!this.WeddingRingDic.SystemXmlItemDict.TryGetValue(nRingID, out RingXmlItem) || null == RingXmlItem) { result = MarryOtherResult.NotRing; } else { SystemXmlItem NowRingXmlItem = null; if (!this.WeddingRingDic.SystemXmlItemDict.TryGetValue(client.ClientData.MyMarriageData.nRingID, out NowRingXmlItem) || null == NowRingXmlItem) { result = MarryOtherResult.NotRing; } else { string strCostList = ""; int oldUserMoney = client.ClientData.UserMoney; int oldUserGlod = client.ClientData.Gold; int nCostGam = RingXmlItem.GetIntValue("NeedZuanShi", -1); int nBeforeCostGam = NowRingXmlItem.GetIntValue("NeedZuanShi", -1); int chajia = nCostGam - nBeforeCostGam; if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, chajia, "更换婚戒扣除", true, true, false, DaiBiSySType.None)) { result = MarryOtherResult.NeedGam; } else { strCostList += EventLogManager.NewResPropString(ResLogType.FristBindZuanShi, new object[] { -chajia, oldUserGlod, client.ClientData.Gold, oldUserMoney, client.ClientData.UserMoney }); client.ClientData.MyMarriageData.nRingID = nRingID; EventLogManager.AddRingBuyEvent(client, 1, nRingID, (int)client.ClientData.MyMarriageData.byGoodwilllevel, (int)client.ClientData.MyMarriageData.byGoodwilllevel, (int)client.ClientData.MyMarriageData.byGoodwillstar, (int)client.ClientData.MyMarriageData.byGoodwillstar, strCostList); this.UpdateRingAttr(client, true, false); MarryFuBenMgr.UpdateMarriageData2DB(client); this.SendMarriageDataToClient(client, true); result = MarryOtherResult.Success; } } } } return(result); }
private bool ProcessHuiJiStarUpCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams) { int result = 0; HuiJiUpdateResultData resultData = new HuiJiUpdateResultData(); RoleHuiJiData huiJiData = client.ClientData.HuiJiData; int exp = 0; HuiJiUpdateResultData requestData = DataHelper.BytesToObject <HuiJiUpdateResultData>(bytes, 0, bytes.Length); int type = requestData.Type; int zuanshi = requestData.ZuanShi; int auto = requestData.Auto; long nowTicks = TimeUtil.NOW(); if (!this.IsGongNengOpened(client)) { result = -12; } else { lock (this.RuntimeData.Mutex) { EmblemStarInfo starInfo; EmblemStarInfo starInfo2; if (huiJiData.huiji != requestData.HuiJi) { result = -3; } else if (!this.RuntimeData.EmblemStarDict.Value.TryGetValue(huiJiData.huiji, out starInfo)) { result = -3; } else if (!this.RuntimeData.EmblemStarDict.Value.TryGetValue(huiJiData.huiji + 1, out starInfo2)) { result = -4004; } else { bool useBind = false; bool useTimeLimit = false; string strCostList; if (type == 0) { if (starInfo.EmblemUpInfo.MaxStarLevel == starInfo.EmblemStar) { result = -4; goto IL_646; } if (Global.UseGoodsBindOrNot(client, starInfo.NeedGoods[0], starInfo.NeedGoods[1], true, out useBind, out useTimeLimit) < 0) { if (zuanshi <= 0 || zuanshi != starInfo.NeedDiamond) { result = -6; goto IL_646; } if (!GameManager.ClientMgr.SubUserMoney(client, zuanshi, "徽记升星", true, true, true, true, DaiBiSySType.HuiJiShengXing)) { result = -10; goto IL_646; } exp = starInfo.ZuanShiExp; strCostList = EventLogManager.NewResPropString(ResLogType.ZuanShi, new object[] { -zuanshi, client.ClientData.UserMoney + zuanshi, client.ClientData.UserMoney }); if (Global.GetRandom() < this.RuntimeData.EmblemShengXing[1]) { exp = (int)((double)exp * this.RuntimeData.EmblemShengXing[2]); } } else { exp = starInfo.GoodsExp; strCostList = EventLogManager.NewGoodsDataPropString(new GoodsData { GoodsID = starInfo.NeedGoods[0], GCount = starInfo.NeedGoods[1] }); if (Global.GetRandom() < this.RuntimeData.EmblemShengXing[0]) { exp = (int)((double)exp * this.RuntimeData.EmblemShengXing[2]); } } huiJiData.Exp += exp; if (huiJiData.Exp >= starInfo.StarExp) { huiJiData.huiji++; if (starInfo.EmblemStar < starInfo.EmblemUpInfo.MaxStarLevel - 1) { huiJiData.Exp -= starInfo.StarExp; } else { huiJiData.Exp = 0; } } } else { if (starInfo.EmblemUpInfo.MaxStarLevel != starInfo.EmblemStar) { result = -4; goto IL_646; } if (Global.UseGoodsBindOrNot(client, starInfo.EmblemUpInfo.NeedGoods[0], starInfo.EmblemUpInfo.NeedGoods[1], true, out useBind, out useTimeLimit) < 0) { if (zuanshi <= 0 || zuanshi != starInfo.EmblemUpInfo.NeedDiamond) { result = -6; goto IL_646; } if (!GameManager.ClientMgr.SubUserMoney(client, zuanshi, "徽记升阶", true, true, true, true, DaiBiSySType.HuiJiShengJie)) { result = -10; goto IL_646; } strCostList = EventLogManager.NewResPropString(ResLogType.ZuanShi, new object[] { -zuanshi, client.ClientData.UserMoney + zuanshi, client.ClientData.UserMoney }); } else { strCostList = EventLogManager.NewGoodsDataPropString(new GoodsData { GoodsID = starInfo.EmblemUpInfo.NeedGoods[0], GCount = starInfo.EmblemUpInfo.NeedGoods[1] }); exp = starInfo.GoodsExp; } huiJiData.Exp++; if (starInfo.EmblemUpInfo.LuckyOne + huiJiData.Exp >= 110000) { huiJiData.huiji++; huiJiData.Exp = 0; } else if (starInfo.EmblemUpInfo.LuckyOne + huiJiData.Exp > starInfo.EmblemUpInfo.LuckyTwo) { if (Global.GetRandom() < starInfo.EmblemUpInfo.LuckyTwoRate) { huiJiData.huiji++; huiJiData.Exp = 0; } } } Global.SendToDB <RoleDataCmdT <RoleHuiJiData> >(1446, new RoleDataCmdT <RoleHuiJiData>(client.ClientData.RoleID, huiJiData), client.ServerId); if (huiJiData.huiji > requestData.HuiJi) { client.ClientData.PropsCacheManager.SetExtProps(new object[] { PropsSystemTypes.HuiJiHuTi, starInfo2.ExtPropValues }); client.delayExecModule.SetDelayExecProc(new DelayExecProcIds[] { DelayExecProcIds.RecalcProps, DelayExecProcIds.NotifyRefreshProps }); EventLogManager.AddHuiJiEvent(client, type, (zuanshi > 0) ? 1 : 0, exp, starInfo.EmblemLevel, starInfo.EmblemStar, starInfo2.EmblemLevel, starInfo2.EmblemStar, huiJiData.Exp, strCostList); } else { EventLogManager.AddHuiJiEvent(client, type, (zuanshi > 0) ? 1 : 0, exp, starInfo.EmblemLevel, starInfo.EmblemStar, starInfo.EmblemLevel, starInfo.EmblemStar, huiJiData.Exp, strCostList); } } } } IL_646: if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieRiHuiJi)) { client._IconStateMgr.SendIconStateToClient(client); } resultData.Result = result; resultData.HuiJi = huiJiData.huiji; resultData.Exp = huiJiData.Exp; resultData.Auto = auto; resultData.Type = type; client.sendCmd <HuiJiUpdateResultData>(nID, resultData, false); return(true); }
private bool ProcessArmorStarUpCmd(GameClient client, int nID, byte[] bytes, string[] cmdParams) { int result = 0; ArmorUpdateResultData resultData = new ArmorUpdateResultData(); RoleArmorData ArmorData = client.ClientData.ArmorData; int exp = 0; ArmorUpdateResultData requestData = DataHelper.BytesToObject <ArmorUpdateResultData>(bytes, 0, bytes.Length); int type = requestData.Type; int zuanshi = requestData.ZuanShi; int auto = requestData.Auto; long nowTicks = TimeUtil.NOW(); if (!this.IsGongNengOpened(client)) { result = -12; } else { bool updateProps = false; lock (this.RuntimeData.Mutex) { if (ArmorData.Armor != requestData.Armor) { result = -3; goto IL_611; } ArmorStarInfo starInfo; if (!this.RuntimeData.ArmorStarDict.Value.TryGetValue(ArmorData.Armor, out starInfo)) { result = -3; goto IL_611; } ArmorStarInfo starInfo2; if (!this.RuntimeData.ArmorStarDict.Value.TryGetValue(ArmorData.Armor + 1, out starInfo2)) { result = -4004; goto IL_611; } bool useBind = false; bool useTimeLimit = false; string strCostList; if (type == 0) { if (starInfo.ArmorUpInfo.MaxStarLevel == starInfo.StarLevel) { result = -4; goto IL_611; } if (Global.UseGoodsBindOrNot(client, starInfo.NeedGoods[0], starInfo.NeedGoods[1], true, out useBind, out useTimeLimit) < 0) { if (zuanshi <= 0 || zuanshi != starInfo.NeedDiamond) { result = -6; goto IL_611; } if (!GameManager.ClientMgr.SubUserMoney(client, zuanshi, "神圣护盾升星", true, true, true, true, DaiBiSySType.None)) { result = -10; goto IL_611; } exp = starInfo.ZuanShiExp; strCostList = EventLogManager.NewResPropString(ResLogType.ZuanShi, new object[] { -zuanshi, client.ClientData.UserMoney + zuanshi, client.ClientData.UserMoney }); if (Global.GetRandom() < this.RuntimeData.HudunBaoji[1]) { exp = (int)((double)exp * this.RuntimeData.HudunBaoji[2]); } } else { exp = starInfo.GoodsExp; strCostList = EventLogManager.NewGoodsDataPropString(new GoodsData { GoodsID = starInfo.NeedGoods[0], GCount = starInfo.NeedGoods[1] }); if (Global.GetRandom() < this.RuntimeData.HudunBaoji[0]) { exp = (int)((double)exp * this.RuntimeData.HudunBaoji[2]); } } ArmorData.Exp += exp; if (ArmorData.Exp >= starInfo.StarExp) { ArmorData.Armor++; if (starInfo.StarLevel < starInfo.ArmorUpInfo.MaxStarLevel - 1) { ArmorData.Exp -= starInfo.StarExp; } else { ArmorData.Exp = 0; } } } else { if (starInfo.ArmorUpInfo.MaxStarLevel != starInfo.StarLevel) { result = -4; goto IL_611; } if (Global.UseGoodsBindOrNot(client, starInfo.ArmorUpInfo.NeedGoods[0], starInfo.ArmorUpInfo.NeedGoods[1], true, out useBind, out useTimeLimit) < 0) { if (zuanshi <= 0 || zuanshi != starInfo.ArmorUpInfo.NeedDiamond) { result = -6; goto IL_611; } if (!GameManager.ClientMgr.SubUserMoney(client, zuanshi, "神圣护盾升阶", true, true, true, true, DaiBiSySType.None)) { result = -10; goto IL_611; } strCostList = EventLogManager.NewResPropString(ResLogType.ZuanShi, new object[] { -zuanshi, client.ClientData.UserMoney + zuanshi, client.ClientData.UserMoney }); } else { strCostList = EventLogManager.NewGoodsDataPropString(new GoodsData { GoodsID = starInfo.ArmorUpInfo.NeedGoods[0], GCount = starInfo.ArmorUpInfo.NeedGoods[1] }); exp = starInfo.GoodsExp; } ArmorData.Exp++; if (starInfo.ArmorUpInfo.LuckyOne + ArmorData.Exp >= 110000) { ArmorData.Armor++; ArmorData.Exp = 0; } else if (starInfo.ArmorUpInfo.LuckyOne + ArmorData.Exp > starInfo.ArmorUpInfo.LuckyTwo) { if (Global.GetRandom() < starInfo.ArmorUpInfo.LuckyTwoRate) { ArmorData.Armor++; ArmorData.Exp = 0; } } } Global.SendToDB <RoleDataCmdT <RoleArmorData> >(1447, new RoleDataCmdT <RoleArmorData>(client.ClientData.RoleID, ArmorData), client.ServerId); if (ArmorData.Armor > requestData.Armor) { updateProps = true; EventLogManager.AddArmorEvent(client, type, (zuanshi > 0) ? 1 : 0, exp, starInfo.ArmorupStage, starInfo.StarLevel, starInfo2.ArmorupStage, starInfo2.StarLevel, ArmorData.Exp, strCostList); } else { EventLogManager.AddArmorEvent(client, type, (zuanshi > 0) ? 1 : 0, exp, starInfo.ArmorupStage, starInfo.StarLevel, starInfo.ArmorupStage, starInfo.StarLevel, ArmorData.Exp, strCostList); } } if (updateProps) { this.ResetArmor(client, true); } } IL_611: resultData.Result = result; resultData.Armor = ArmorData.Armor; resultData.Exp = ArmorData.Exp; resultData.Auto = auto; resultData.Type = type; client.sendCmd <ArmorUpdateResultData>(nID, resultData, false); return(true); }