private static bool JugeSucess(int mergeItemID, CacheMergeItem cacheMergeItem, int addSuccessPercent) { int randNum = Global.GetRandomNumber(0, 101); double awardmuti = 0.0; if (50 == mergeItemID) { JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity(); if (null != activity) { JieRiMultConfig config = activity.GetConfig(13); if (null != config) { awardmuti += config.GetMult(); } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != spAct) { awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_MergeFruit); } } awardmuti = Math.Max(1.0, awardmuti); int successRate = (int)((double)cacheMergeItem.SuccessRate * awardmuti); return(randNum <= successRate + addSuccessPercent); }
public static List <CallPetConfig> GetCallPetConfigList(bool freeCall) { List <CallPetConfig> result; lock (CallPetManager._CallPetMutex) { if (freeCall) { result = CallPetManager.FreeCallPetConfigList; } else { SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (spAct != null && spAct.IsChouJiangOpen(SpecPActivityChouJiangType.TeQuanBuHuo)) { result = CallPetManager.TeQuanCallPetConfigList; } else { JieRiFuLiActivity act = HuodongCachingMgr.GetJieriFuLiActivity(); object o_placeholder = null; if (act != null && act.IsOpened(EJieRiFuLiType.CallPetReplace, out o_placeholder)) { result = CallPetManager.HuoDongCallPetConfigList; } else { result = CallPetManager.CallPetConfigList; } } } } return(result); }
private void ProcessAddRoleExperience(GameClient client) { long exp = this.GetBattleExpByLevel(client, client.ClientData.Level); if (exp > 0L) { double awardmuti = 0.0; JieRiMultAwardActivity jieriact = HuodongCachingMgr.GetJieRiMultAwardActivity(); if (null != jieriact) { JieRiMultConfig config = jieriact.GetConfig(2); if (null != config) { awardmuti += config.GetMult(); } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != spAct) { awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_Battle); } awardmuti = Math.Max(1.0, awardmuti); exp = (long)((double)exp * awardmuti); GameManager.ClientMgr.ProcessRoleExperience(client, exp, true, false, false, "none"); } }
public int HandleAdmireStatue(GameClient client, int toCoupleId, int admireType) { int toDay = TimeUtil.MakeYearMonthDay(TimeUtil.NowDateTime()); MoBaiData MoBaiConfig = null; int result; if (!Data.MoBaiDataInfoList.TryGetValue(2, out MoBaiConfig)) { result = -3; } else if (client.ClientData.ChangeLifeCount < MoBaiConfig.MinZhuanSheng || (client.ClientData.ChangeLifeCount == MoBaiConfig.MinZhuanSheng && client.ClientData.Level < MoBaiConfig.MinLevel)) { result = -19; } else { int maxAdmireNum = MoBaiConfig.AdrationMaxLimit; int hadAdmireCount = this.GetAdmireCount(client, toDay); if (this._Statue != null && this._Statue.IsDivorced != 1 && this._Statue.DbCoupleId > 0 && (client.ClientData.RoleID == this._Statue.Man.RoleId || client.ClientData.RoleID == this._Statue.Wife.RoleId)) { maxAdmireNum += MoBaiConfig.ExtraNumber; } int nVIPLev = client.ClientData.VipLevel; int[] nArrayVIPAdded = GameManager.systemParamsList.GetParamValueIntArrayByName("VIPMoBaiNum", ','); if (nVIPLev > VIPEumValue.VIPENUMVALUE_MAXLEVEL || nArrayVIPAdded.Length < 1) { result = -3; } else { maxAdmireNum += nArrayVIPAdded[nVIPLev]; double awardmuti = 0.0; JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity(); if (null != activity) { JieRiMultConfig config = activity.GetConfig(12); if (null != config) { awardmuti += config.GetMult(); } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != spAct) { awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_Admire); } awardmuti = Math.Max(1.0, awardmuti); maxAdmireNum = (int)((double)maxAdmireNum * awardmuti); if (hadAdmireCount >= maxAdmireNum) { result = -16; } else if (admireType == 1 && Global.GetTotalBindTongQianAndTongQianVal(client) < MoBaiConfig.NeedJinBi) { result = -9; } else if (admireType == 2 && client.ClientData.UserMoney < MoBaiConfig.NeedZuanShi) { result = -10; } else { int ec = TianTiClient.getInstance().CoupleWishAdmire(client.ClientData.RoleID, client.ClientData.ZoneID, admireType, toCoupleId); double nRate = (client.ClientData.ChangeLifeCount == 0) ? 1.0 : Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount]; if (admireType == 1) { Global.SubBindTongQianAndTongQian(client, MoBaiConfig.NeedJinBi, "膜拜情侣祝福"); long nExp = (long)(nRate * (double)MoBaiConfig.JinBiExpAward); if (nExp > 0L) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp, true, true, false, "none"); } if (MoBaiConfig.JinBiZhanGongAward > 0) { GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref MoBaiConfig.JinBiZhanGongAward, AddBangGongTypes.CoupleWishMoBai, 0); } if (MoBaiConfig.LingJingAwardByJinBi > 0) { GameManager.ClientMgr.ModifyMUMoHeValue(client, MoBaiConfig.LingJingAwardByJinBi, "膜拜情侣祝福", true, true, false); } } if (admireType == 2) { GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, MoBaiConfig.NeedZuanShi, "膜拜情侣祝福", true, true, false, DaiBiSySType.None); int nExp2 = (int)(nRate * (double)MoBaiConfig.ZuanShiExpAward); if (nExp2 > 0) { GameManager.ClientMgr.ProcessRoleExperience(client, (long)nExp2, true, true, false, "none"); } if (MoBaiConfig.ZuanShiZhanGongAward > 0) { GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref MoBaiConfig.ZuanShiZhanGongAward, AddBangGongTypes.CoupleWishMoBai, 0); } if (MoBaiConfig.LingJingAwardByZuanShi > 0) { GameManager.ClientMgr.ModifyMUMoHeValue(client, MoBaiConfig.LingJingAwardByZuanShi, "膜拜情侣祝福", true, true, false); } } this.AddAdmireCount(client, toDay, toCoupleId, 1); if (this._Statue != null && this._Statue.DbCoupleId > 0 && this._Statue.DbCoupleId == toCoupleId) { this._Statue.BeAdmireCount++; } result = 1; } } } return(result); }
public void HandleClientChargeItem(GameClient client, byte HandleDel = 0) { if (client != null && !GameManager.IsKuaFuServer) { lock (client.ClientData.ChargeItemMutex) { List <TempItemChargeInfo> list = new List <TempItemChargeInfo>(); string cmd = string.Format("{0}:{1}:{2}", client.strUserID, client.ClientData.RoleID, HandleDel); list = Global.sendToDB <List <TempItemChargeInfo>, string>(13320, cmd, client.ServerId); if (list != null && list.Count != 0) { if (HandleDel == 1) { this.ComputeClientChargeItem(client, list); } Dictionary <int, ChargeItemData> ChargeItemDict = Data.ChargeItemDict; for (int i = 0; i < list.Count; i++) { TempItemChargeInfo tempitem = list[i]; if (tempitem.isDel == 0) { int ProcessChargeMoney = 0; int ReturnUserMoney = 0; ChargeItemData configdata = null; if (!ChargeItemDict.TryGetValue(tempitem.zhigouID, out configdata)) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购zhigouID错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } else if (string.Compare(tempitem.chargeTime, configdata.FromDate) < 0 || string.Compare(tempitem.chargeTime, configdata.ToDate) > 0) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购Time错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } else { int Money = 0; if (!Data.ChargeData.ChargeIDVsMoneyDict.TryGetValue(configdata.ChargeDangID, out Money)) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购Dang错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } else { int ZhiGouImplicit = GameManager.PlatConfigMgr.GetGameConfigItemInt("zhigou_implicit", 0); if (ZhiGouImplicit > 0) { if (tempitem.addUserMoney < Money) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购Money错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } else { ReturnUserMoney = Math.Max(tempitem.addUserMoney - Money, 0); } } else if (tempitem.addUserMoney != Money) { LogManager.WriteLog(LogTypes.Error, string.Format("充值直购Money错误 uid={0},rid={1},money={2},itemid={3},chargeTm={4}", new object[] { tempitem.userID, tempitem.chargeRoleID, tempitem.addUserMoney, tempitem.zhigouID, tempitem.chargeTime }), null, true); ProcessChargeMoney = 1; } } } int PurchaseNum = this.GetChargeItemPurchaseNum(client, tempitem.zhigouID); int DayPurchaseNum = this.GetChargeItemDayPurchaseNum(client, tempitem.zhigouID); if (configdata != null && configdata.SinglePurchase > 0 && PurchaseNum >= configdata.SinglePurchase) { ProcessChargeMoney = 1; } if (configdata != null && configdata.DayPurchase > 0) { EverydayActivity everyAct = HuodongCachingMgr.GetEverydayActivity(); if (everyAct == null || !everyAct.CheckValidChargeItem(tempitem.zhigouID)) { ProcessChargeMoney = 1; } if (DayPurchaseNum >= configdata.DayPurchase) { ProcessChargeMoney = 1; } } if (configdata != null && configdata.ThemePurchase > 0) { ThemeZhiGouActivity zhigouAct = HuodongCachingMgr.GetThemeZhiGouActivity(); if (zhigouAct == null || !zhigouAct.CheckValidChargeItem(tempitem.zhigouID)) { ProcessChargeMoney = 1; } if (DayPurchaseNum >= configdata.ThemePurchase) { ProcessChargeMoney = 1; } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (spAct != null && !spAct.CheckValidChargeItem(tempitem.zhigouID)) { ProcessChargeMoney = 1; } RegressActiveDayBuy radbAct = HuodongCachingMgr.GetRegressActiveDayBuy(); if (radbAct != null && !radbAct.CheckValidChargeItem(client, tempitem.zhigouID)) { ProcessChargeMoney = 1; } cmd = string.Format("{0}:{1}:{2}", tempitem.ID, ProcessChargeMoney, ReturnUserMoney); string[] dbFields = null; TCPProcessCmdResults dbRequestResult = Global.RequestToDBServer(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, 13321, cmd, out dbFields, client.ServerId); if (dbRequestResult != TCPProcessCmdResults.RESULT_FAILED && dbFields.Length > 0) { if (ProcessChargeMoney == 0) { this.AddChargeItemPurchaseNum(client, tempitem.zhigouID); this.AddChargeItemDayPurchaseNum(client, tempitem.zhigouID, tempitem.chargeTime); } if (configdata != null && ProcessChargeMoney == 0) { ChargeItemBaseEventObject evObj_ChargeItem = new ChargeItemBaseEventObject(client, configdata); GlobalEventSource.getInstance().fireEvent(evObj_ChargeItem); } if (ProcessChargeMoney != 1) { if (null != configdata) { List <GoodsData> awardList = new List <GoodsData>(); if (configdata.GoodsDataOne != null) { awardList.AddRange(configdata.GoodsDataOne); } List <GoodsData> proGoods = GoodsHelper.GetAwardPro(client, configdata.GoodsDataTwo); if (proGoods != null) { awardList.AddRange(proGoods); } this.GiveClientChargeItem(client, awardList); this.HandleClientChargeMoney(client.strUserID, client.ClientData.RoleID, tempitem.addUserMoney - ReturnUserMoney, false, 0); } } } } } } } } }
public void HandleClientChargeMoney(string userID, int rid, int addMoney, bool transmit, int superInputFanLi = 0) { JieriIPointsExchgActivity act = HuodongCachingMgr.GetJieriIPointsExchgActivity(); if (null != act) { act.OnMoneyChargeEvent(userID, rid, addMoney); } EverydayActivity everyAct = HuodongCachingMgr.GetEverydayActivity(); if (null != everyAct) { everyAct.OnMoneyChargeEvent(userID, rid, addMoney); } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != everyAct) { spAct.OnMoneyChargeEvent(userID, rid, addMoney); } if (superInputFanLi > 0) { JieriSuperInputActivity siAct = HuodongCachingMgr.GetJieRiSuperInputActivity(); if (null != siAct) { siAct.OnMoneyChargeEvent(userID, rid, addMoney, superInputFanLi); } } TMSKSocket clientSocket = GameManager.OnlineUserSession.FindSocketByUserID(userID); if (null == clientSocket) { SpecialActivity specAct = HuodongCachingMgr.GetSpecialActivity(); if (null != specAct) { specAct.OnMoneyChargeEventOffLine(userID, rid, addMoney); } } else { if (transmit) { LogManager.WriteLog(LogTypes.SQL, string.Format("通知账户ID{0}的角色更新元宝数量", userID), null, true); } GameClient otherClient = GameManager.ClientMgr.FindClient(clientSocket); if (null != otherClient) { SpecialActivity specAct = HuodongCachingMgr.GetSpecialActivity(); if (null != specAct) { specAct.OnMoneyChargeEventOnLine(otherClient, addMoney); } GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, otherClient, 0, "", ActivityTypes.None, ""); GameManager.logDBCmdMgr.AddDBLogInfo(-1, "钻石", "GM命令强迫更新", "系统", otherClient.ClientData.RoleName, "增加", addMoney, otherClient.ClientData.ZoneID, otherClient.strUserID, otherClient.ClientData.UserMoney, otherClient.ServerId, null); otherClient._IconStateMgr.FlushChongZhiIconState(otherClient); otherClient._IconStateMgr.CheckJieRiActivity(otherClient, false); otherClient._IconStateMgr.SendIconStateToClient(otherClient); UserReturnManager.getInstance().initUserReturnData(otherClient); SingletonTemplate <SevenDayActivityMgr> .Instance().OnCharge(otherClient); FundManager.initFundData(otherClient); } else { SpecialActivity specAct = HuodongCachingMgr.GetSpecialActivity(); if (null != specAct) { specAct.OnMoneyChargeEventOffLine(userID, rid, addMoney); } } } }
private void ProcessAward(GameClient client) { if (this.BattlingState >= BattleStates.StartFight) { if (this.BattlingState == BattleStates.StartFight) { long ticks = TimeUtil.NOW(); if (ticks < this.StateStartTicks + 1000L) { return; } } lock (this.mutex) { int nFlag; if (!this.TheKingOfPKGetawardFlag.TryGetValue(client.ClientData.RoleID, out nFlag)) { return; } if (nFlag > 0) { return; } this.TheKingOfPKGetawardFlag[client.ClientData.RoleID] = 1; } if (client.ClientData.KingOfPkCurrentPoint > this.TheKingOfPKTopPoint) { this.SetTotalPointInfo(client.ClientData.RoleName, client.ClientData.KingOfPkCurrentPoint); } string strPkAward = GameManager.systemParamsList.GetParamValueByName("PkAward"); string[] strChengJiu = null; string[] strExp = null; if (!string.IsNullOrEmpty(strPkAward)) { string[] strFild = strPkAward.Split(new char[] { '|' }); string strInfo = strFild[0]; strChengJiu = strInfo.Split(new char[] { ',' }); strInfo = strFild[1]; strExp = strInfo.Split(new char[] { ',' }); } HeFuAwardTimesActivity activity = HuodongCachingMgr.GetHeFuAwardTimesActivity(); JieRiMultAwardActivity jieriact = HuodongCachingMgr.GetJieRiMultAwardActivity(); SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); double actTimes = 0.0; if (activity != null && activity.InActivityTime() && (double)activity.activityTimes > 0.0) { actTimes += (double)activity.activityTimes; } if (null != jieriact) { JieRiMultConfig config = jieriact.GetConfig(3); if (null != config) { actTimes += config.GetMult(); } } if (null != spAct) { actTimes += spAct.GetMult(SpecPActivityBuffType.SPABT_PKKing); } actTimes = Math.Max(1.0, actTimes); int nChengjiuPoint = Global.SafeConvertToInt32(strChengJiu[0]) + Global.GMin(Global.SafeConvertToInt32(strChengJiu[1]), client.ClientData.KingOfPkCurrentPoint) * Global.SafeConvertToInt32(strChengJiu[2]); nChengjiuPoint *= (int)actTimes; if (nChengjiuPoint > 0) { ChengJiuManager.AddChengJiuPoints(client, "角斗赛", nChengjiuPoint, true, true); } double nRate = Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount]; long nExp = (long)((int)((double)Global.SafeConvertToInt32(strExp[0]) * nRate + (double)(Global.GMin(Global.SafeConvertToInt32(strExp[1]), client.ClientData.KingOfPkCurrentPoint) * Global.SafeConvertToInt32(strExp[2])) * nRate)); double dblExperience = 1.0; dblExperience += actTimes; nExp = (long)((int)((double)nExp * dblExperience)); if (nExp > 0L) { GameManager.ClientMgr.ProcessRoleExperience(client, nExp, true, true, false, "none"); } string strCmd = string.Format("{0}:{1}:{2}", client.ClientData.KingOfPkCurrentPoint, nChengjiuPoint, nExp); client.ClientData.KingOfPkCurrentPoint = 0; GameManager.ClientMgr.SendToClient(client, strCmd, 569); ProcessTask.ProcessAddTaskVal(client, TaskTypes.PKKing, -1, 1, new object[0]); } }
private void ProcessRoleBattleExpAndFlagAward(GameClient client, int successSide, int paiMing) { ProcessTask.ProcessAddTaskVal(client, TaskTypes.Battle, -1, 1, new object[0]); List <BattleManager.Award> awardByScore = this.BattleAwardByScore; if (null == awardByScore) { LogManager.WriteLog(LogTypes.Error, string.Format("处理大乱斗结束奖励时, 奖励列表项未空", new object[0]), null, true); } else { double expAward = 0.0; double MoJingAward = 0.0; double chengJiuAward = 0.0; AwardsItemList awardsItemList = new AwardsItemList(); bool successed = successSide == client.ClientData.BattleWhichSide; double awardmuti = 0.0; HeFuAwardTimesActivity hefuact = HuodongCachingMgr.GetHeFuAwardTimesActivity(); if (hefuact != null && hefuact.InActivityTime()) { awardmuti += (double)hefuact.activityTimes; } JieRiMultAwardActivity jieriact = HuodongCachingMgr.GetJieRiMultAwardActivity(); if (null != jieriact) { JieRiMultConfig config = jieriact.GetConfig(2); if (null != config) { awardmuti += config.GetMult(); } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != spAct) { awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_Battle); } awardmuti = Math.Max(1.0, awardmuti); foreach (BattleManager.Award award in awardByScore) { if (client.ClientData.BattleKilledNum >= award.MinJiFen && client.ClientData.BattleKilledNum < award.MaxJiFen) { expAward = (double)(client.ClientData.BattleKilledNum * award.ExpXiShu); if (award.MoJingXiShu > 0.0) { MoJingAward = (double)((int)((double)client.ClientData.BattleKilledNum * award.MoJingXiShu)); } if (award.ChengJiuXiShu > 0.0) { chengJiuAward = (double)((int)((double)client.ClientData.BattleKilledNum * award.ChengJiuXiShu)); } if (!successed) { if (expAward > 0.0) { expAward *= 0.8; } if (MoJingAward > 0.0) { MoJingAward *= 0.8; } if (chengJiuAward > 0.0) { chengJiuAward *= 0.8; } } expAward = (double)((long)(expAward * Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount])); expAward = Math.Max(expAward, (double)award.MinExp * Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount]); expAward = Math.Min(expAward, (double)award.MaxExp * Data.ChangeLifeEverydayExpRate[client.ClientData.ChangeLifeCount]); MoJingAward = Math.Max(MoJingAward, (double)award.MinMoJing); MoJingAward = Math.Min(MoJingAward, (double)award.MaxMoJing); chengJiuAward = Math.Max(chengJiuAward, (double)award.MinChengJiu); chengJiuAward = Math.Min(chengJiuAward, (double)award.MaxChengJiu); if (expAward > 0.0) { expAward = (double)((int)(expAward * awardmuti)); } if (MoJingAward > 0.0) { MoJingAward = (double)((int)(MoJingAward * awardmuti)); } if (chengJiuAward > 0.0) { chengJiuAward = (double)((int)(chengJiuAward * awardmuti)); } break; } } foreach (SystemXmlItem xml in GameManager.SystemBattlePaiMingAwards.SystemXmlItemDict.Values) { if (null != xml) { int min = xml.GetIntValue("MinPaiMing", -1) - 1; int max = xml.GetIntValue("MaxPaiMing", -1) - 1; if (paiMing >= min && paiMing <= max) { awardsItemList.AddNoRepeat(xml.GetStringValue("Goods")); } } } if (expAward > 0.0) { GameManager.ClientMgr.ProcessRoleExperience(client, (long)expAward, true, false, false, "none"); } if (MoJingAward > 0.0) { GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, (int)MoJingAward, "阵营战", false, true, false); } if (chengJiuAward > 0.0) { GameManager.ClientMgr.ModifyChengJiuPointsValue(client, (int)chengJiuAward, "阵营战", false, true); } List <GoodsData> goodsDataList = Global.ConvertToGoodsDataList(awardsItemList.Items, -1); if (!Global.CanAddGoodsDataList(client, goodsDataList)) { GameManager.ClientMgr.SendMailWhenPacketFull(client, goodsDataList, GLang.GetLang(13, new object[0]), string.Format(GLang.GetLang(14, new object[0]), paiMing + 1)); } else { for (int i = 0; i < goodsDataList.Count; i++) { Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, goodsDataList[i].GoodsID, goodsDataList[i].GCount, goodsDataList[i].Quality, "", goodsDataList[i].Forge_level, goodsDataList[i].Binding, 0, "", true, 1, "阵营战排名奖励", "1900-01-01 12:00:00", 0, goodsDataList[i].BornIndex, goodsDataList[i].Lucky, 0, goodsDataList[i].ExcellenceInfo, goodsDataList[i].AppendPropLev, 0, null, null, 0, true); } } GameManager.ClientMgr.NotifySelfSuiTangBattleAward(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, this.TangKilledNum, this.SuiKilledNum, (long)expAward, (int)MoJingAward, (int)chengJiuAward, successed, paiMing, awardsItemList.ToString()); } }
public void GiveAwardAngelTempleScene(bool bBossKilled) { List <object> objsList = GameManager.ClientMgr.GetMapClients(this.m_AngelTempleData.MapCode); if (null != objsList) { int roleCount = 0; List <AngelTemplePointInfo> pointList = new List <AngelTemplePointInfo>(); lock (this.m_PointDamageInfoMutex) { for (int i = 0; i < objsList.Count; i++) { if (objsList[i] is GameClient) { GameClient client = objsList[i] as GameClient; AngelTemplePointInfo tmpInfo; if (!this.m_RoleDamageAngelValue.TryGetValue(client.ClientData.RoleID, out tmpInfo)) { this.SendAngelTempleAwardMsg(client, -1, 0, 0, GLang.GetLang(6, new object[0]), "", bBossKilled); } else if (!tmpInfo.LeaveScene) { if (Interlocked.CompareExchange(ref tmpInfo.m_GetAwardFlag, 1, 0) == 0) { if (tmpInfo.m_DamagePoint < this.AngelTempleMinHurt) { this.SendAngelTempleAwardMsg(client, -1, 0, 0, GLang.GetLang(6, new object[0]), "", bBossKilled); } else { roleCount++; pointList.Add(tmpInfo); } } } } } } pointList.Sort(new Comparison <AngelTemplePointInfo>(AngelTemplePointInfo.Compare_static)); if (bBossKilled) { foreach (KeyValuePair <int, SystemXmlItem> kv in GameManager.AngelTempleAward.SystemXmlItemDict) { if (null != kv.Value) { int id = kv.Value.GetIntValue("ID", -1); int minPaiMing = kv.Value.GetIntValue("MinPaiMing", -1); int maxPaiMing = kv.Value.GetIntValue("MaxPaiMing", -1); int shengWang = kv.Value.GetIntValue("ShengWang", -1); int gold = kv.Value.GetIntValue("Gold", -1); string goodsStr = kv.Value.GetStringValue("Goods"); minPaiMing = Global.GMax(0, minPaiMing - 1); maxPaiMing = Global.GMin(10000, maxPaiMing - 1); int i = minPaiMing; while (i <= maxPaiMing && i < roleCount) { pointList[i].m_AwardPaiMing = i + 1; pointList[i].m_AwardShengWang += shengWang; pointList[i].m_AwardGold += gold; pointList[i].GoodsList.AddNoRepeat(goodsStr); i++; } } } int[] luckPaiMings = new int[roleCount]; for (int i = 0; i < roleCount; i++) { luckPaiMings[i] = i; } int luckAwardsCount = 0; foreach (KeyValuePair <int, SystemXmlItem> kv in GameManager.AngelTempleLuckyAward.SystemXmlItemDict) { if (null != kv.Value) { int awardID = kv.Value.GetIntValue("ID", -1); int awardNum = kv.Value.GetIntValue("Number", -1); string luckAwardsName = Global.GetLang(kv.Value.GetStringValue("Name")); string luckAwardGoods = kv.Value.GetStringValue("Goods"); int count = 0; while (count < awardNum && luckAwardsCount < roleCount) { int rand = Global.GetRandomNumber(luckAwardsCount, roleCount); int t = luckPaiMings[luckAwardsCount]; luckPaiMings[luckAwardsCount] = luckPaiMings[rand]; luckPaiMings[rand] = t; int index = luckPaiMings[luckAwardsCount]; pointList[index].m_LuckPaiMingName = luckAwardsName; pointList[index].GoodsList.AddNoRepeat(luckAwardGoods); count++; luckAwardsCount++; } } } } else { SystemXmlItem xmlItem = null; foreach (KeyValuePair <int, SystemXmlItem> kv in GameManager.AngelTempleAward.SystemXmlItemDict) { if (null != kv.Value) { xmlItem = kv.Value; } } if (null != xmlItem) { int id = xmlItem.GetIntValue("ID", -1); int shengWang = xmlItem.GetIntValue("ShengWang", -1); int gold = xmlItem.GetIntValue("Gold", -1); string goodsStr = xmlItem.GetStringValue("Goods"); for (int i = 0; i < roleCount; i++) { pointList[i].m_AwardPaiMing = -1; pointList[i].m_LuckPaiMingName = GLang.GetLang(6, new object[0]); pointList[i].m_AwardShengWang = shengWang; pointList[i].m_AwardGold = gold; pointList[i].GoodsList.AddNoRepeat(goodsStr); } } } double awardmuti = 0.0; JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity(); if (null != activity) { JieRiMultConfig config = activity.GetConfig(1); if (null != config) { awardmuti += config.GetMult(); } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != spAct) { awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_AngelTemple); } awardmuti = Math.Max(1.0, awardmuti); if (awardmuti > 1.0) { foreach (AngelTemplePointInfo dp in pointList) { dp.m_AwardGold = (int)((double)dp.m_AwardGold * awardmuti); dp.m_AwardShengWang = (int)((double)dp.m_AwardShengWang * awardmuti); foreach (AwardsItemData item in dp.GoodsList.Items) { item.GoodsNum = (int)((double)item.GoodsNum * awardmuti); } } } foreach (AngelTemplePointInfo dp in pointList) { GameClient gc = GameManager.ClientMgr.FindClient(dp.m_RoleID); if (null != gc) { ProcessTask.ProcessAddTaskVal(gc, TaskTypes.AngelTemple, -1, 1, new object[0]); if (dp.m_AwardGold > 0) { GameManager.ClientMgr.AddUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, gc, dp.m_AwardGold, "天使神殿奖励", false); } if (dp.m_AwardShengWang > 0) { GameManager.ClientMgr.ModifyShengWangValue(gc, dp.m_AwardShengWang, "天使神殿", true, true); } foreach (AwardsItemData item in dp.GoodsList.Items) { Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, gc, item.GoodsID, item.GoodsNum, 0, "", item.Level, item.Binding, 0, "", true, 1, "天使神殿奖励物品", "1900-01-01 12:00:00", 0, 0, item.IsHaveLuckyProp, 0, item.ExcellencePorpValue, item.AppendLev, 0, null, null, 0, true); } this.SendAngelTempleAwardMsg(gc, dp.m_AwardPaiMing, dp.m_AwardGold, dp.m_AwardShengWang, dp.m_LuckPaiMingName, dp.GoodsList.ToString(), bBossKilled); } } } }
public bool ExecLianZhi(GameClient client, int type, int count) { int roleID = client.ClientData.RoleID; int vipLevel = client.ClientData.VipLevel; int nID = 668; string useMsg = "炼制系统"; List <int> result = new List <int>(); result.Add(1); result.Add(type); result.Add(count); if (!this.ConfigLoadSuccess) { result[0] = -3; client.sendCmd <List <int> >(nID, result, false); } else if (type < 0 || type > 2) { result[0] = -5; client.sendCmd <List <int> >(nID, result, false); } else { int needJinBi = 0; int needBangZuan = 0; int needZuanShi = 0; long addExp = 0L; int addXingHun = 0; int addJinBi = 0; int lianZhiCount = 0; int lianZhiDayID = -1; int lianZhiMaxCount = 0; int dayID = TimeUtil.NowDateTime().DayOfYear; if (type == 0) { useMsg = "金币炼制"; lianZhiCount = Global.GetRoleParamsInt32FromDB(client, "LianZhiJinBiCount"); lianZhiDayID = Global.GetRoleParamsInt32FromDB(client, "LianZhiJinBiDayID"); lianZhiMaxCount = this.JinBiLianZhi[2] + this.VIPJinBiLianZhi[Math.Min(this.VIPJinBiLianZhi.Length - 1, vipLevel)]; needJinBi = this.JinBiLianZhi[0]; addExp = (long)this.JinBiLianZhi[1]; ProcessTask.ProcessAddTaskVal(client, TaskTypes.LianZhi_JinBi, -1, 1, new object[0]); double awardmuti = 0.0; double awardmuticount = 0.0; double awardcount = 0.0; JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity(); if (null != activity) { JieRiMultConfig config = activity.GetConfig(6); if (null != config) { awardmuticount += config.GetMult(); } config = activity.GetConfig(9); if (null != config) { awardmuti += config.GetMult(); } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != spAct) { awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanAward); awardcount += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanCount); } awardmuti = Math.Max(1.0, awardmuti); awardmuticount = Math.Max(1.0, awardmuticount); addExp = (long)((int)((double)addExp * awardmuti)); lianZhiMaxCount = lianZhiMaxCount * (int)awardmuticount + (int)awardcount; } else if (type == 1) { useMsg = "绑钻炼制"; lianZhiCount = Global.GetRoleParamsInt32FromDB(client, "LianZhiBangZuanCount"); lianZhiDayID = Global.GetRoleParamsInt32FromDB(client, "LianZhiBangZuanDayID"); lianZhiMaxCount = this.BangZuanLianZhi[2] + this.VIPBangZuanLianZhi[Math.Min(this.VIPBangZuanLianZhi.Length - 1, vipLevel)]; needBangZuan = this.BangZuanLianZhi[0]; addXingHun = this.BangZuanLianZhi[1]; double awardmuti = 0.0; double awardmuticount = 0.0; double awardcount = 0.0; JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity(); if (null != activity) { JieRiMultConfig config = activity.GetConfig(6); if (null != config) { awardmuticount += config.GetMult(); } config = activity.GetConfig(9); if (null != config) { awardmuti += config.GetMult(); } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != spAct) { awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanAward); awardcount += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanCount); } awardmuti = Math.Max(1.0, awardmuti); awardmuticount = Math.Max(1.0, awardmuticount); addXingHun = (int)((double)addXingHun * awardmuti); lianZhiMaxCount = lianZhiMaxCount * (int)awardmuticount + (int)awardcount; } else if (type == 2) { useMsg = "钻石炼制"; lianZhiCount = Global.GetRoleParamsInt32FromDB(client, "LianZhiZuanShiCount"); lianZhiDayID = Global.GetRoleParamsInt32FromDB(client, "LianZhiZuanShiDayID"); lianZhiMaxCount = this.ZuanShiLianZhi[4] + this.VIPZuanShiLianZhi[Math.Min(this.VIPZuanShiLianZhi.Length - 1, vipLevel)]; needZuanShi = this.ZuanShiLianZhi[0]; addExp = (long)this.ZuanShiLianZhi[1]; addXingHun = this.ZuanShiLianZhi[2]; addJinBi = this.ZuanShiLianZhi[3]; double awardmuti = 0.0; double awardmuticount = 0.0; double awardcount = 0.0; JieRiMultAwardActivity activity = HuodongCachingMgr.GetJieRiMultAwardActivity(); if (null != activity) { JieRiMultConfig config = activity.GetConfig(6); if (null != config) { awardmuticount += config.GetMult(); } config = activity.GetConfig(9); if (null != config) { awardmuti += config.GetMult(); } } SpecPriorityActivity spAct = HuodongCachingMgr.GetSpecPriorityActivity(); if (null != spAct) { awardmuti += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanAward); awardcount += spAct.GetMult(SpecPActivityBuffType.SPABT_ZhuanHuanCount); } awardmuti = Math.Max(1.0, awardmuti); awardmuticount = Math.Max(1.0, awardmuticount); addExp = (long)((int)((double)addExp * awardmuti)); addXingHun = (int)((double)addXingHun * awardmuti); addJinBi = (int)((double)addJinBi * awardmuti); lianZhiMaxCount = lianZhiMaxCount * (int)awardmuticount + (int)awardcount; } if (lianZhiDayID != dayID) { lianZhiCount = 0; } if (count <= 0) { count = lianZhiMaxCount - lianZhiCount; } if (count <= 0 || lianZhiCount + count > lianZhiMaxCount) { result[0] = -16; client.sendCmd <List <int> >(nID, result, false); } else { needJinBi *= count; needBangZuan *= count; needZuanShi *= count; addExp *= (long)count; addXingHun *= count; addJinBi *= count; addExp = Global.GetExpMultiByZhuanShengExpXiShu(client, addExp); if (needJinBi > 0 && !Global.SubBindTongQianAndTongQian(client, needJinBi, useMsg)) { result[0] = -9; client.sendCmd <List <int> >(nID, result, false); } else if (needBangZuan > 0 && !GameManager.ClientMgr.SubUserGold(client, needBangZuan, useMsg)) { result[0] = -17; client.sendCmd <List <int> >(nID, result, false); } else if (needZuanShi > 0 && !GameManager.ClientMgr.SubUserMoney(client, needZuanShi, useMsg, true, true, true, true, DaiBiSySType.None)) { result[0] = -10; client.sendCmd <List <int> >(nID, result, false); } else { if (addExp > 0L) { GameManager.ClientMgr.ProcessRoleExperience(client, addExp, true, true, false, "none"); } if (addJinBi > 0) { GameManager.ClientMgr.AddMoney1(client, addJinBi, useMsg, true); } if (addXingHun > 0) { GameManager.ClientMgr.ModifyStarSoulValue(client, addXingHun, useMsg, true, true); } lianZhiCount += count; lianZhiDayID = dayID; if (type == 0) { GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.JinBiZhuanHuanTimes)); Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiJinBiCount", lianZhiCount, true); Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiJinBiDayID", lianZhiDayID, true); } else if (type == 1) { GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.BangZuanZhuanHuanTimes)); Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiBangZuanCount", lianZhiCount, true); Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiBangZuanDayID", lianZhiDayID, true); } else if (type == 2) { GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.ZuanShiZhuanHuanTimes)); Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiZuanShiCount", lianZhiCount, true); Global.SaveRoleParamsInt32ValueToDB(client, "LianZhiZuanShiDayID", lianZhiDayID, true); } client.sendCmd <List <int> >(nID, result, false); } } } return(true); }