private static int ProcessMergeNewGoods(GameClient client, int mergeItemID, CacheMergeItem cacheMergeItem, int luckyGoodsID, int nUseBindItemFirst) { int newGoodsBinding = 0; int addSuccessPercent = 0; bool bLeftGrid = false; int nNewGoodsID = cacheMergeItem.NewGoodsID[0]; if (cacheMergeItem.NewGoodsID.Count > 1) { if (!Global.CanAddGoodsNum(client, 1)) { return(-1); } nNewGoodsID = cacheMergeItem.NewGoodsID[Global.GetRandomNumber(0, cacheMergeItem.NewGoodsID.Count)]; bLeftGrid = true; } int ret = MergeNewGoods.CanMergeNewGoods(client, cacheMergeItem, nNewGoodsID, bLeftGrid); int result; if (ret < 0) { result = ret; } else { if (luckyGoodsID > 0) { int luckyPercent = Global.GetLuckyValue(luckyGoodsID); if (luckyPercent > 0) { bool usedBinding = false; bool usedTimeLimited = false; if (GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, luckyGoodsID, 1, false, out usedBinding, out usedTimeLimited, false)) { if (newGoodsBinding <= 0) { newGoodsBinding = (usedBinding ? 1 : 0); } addSuccessPercent = luckyPercent; } } } bool success = MergeNewGoods.JugeSucess(mergeItemID, cacheMergeItem, addSuccessPercent); for (int i = 0; i < cacheMergeItem.OrigGoodsIDList.Count; i++) { int usingGoodsNum = MergeNewGoods.GetUsingGoodsNum(success, cacheMergeItem, cacheMergeItem.OrigGoodsIDList[i], cacheMergeItem.OrigGoodsNumList[i]); int nBindGoodNum = Global.GetTotalBindGoodsCountByID(client, cacheMergeItem.OrigGoodsIDList[i]); int nNotBindGoodNum = Global.GetTotalNotBindGoodsCountByID(client, cacheMergeItem.OrigGoodsIDList[i]); if (usingGoodsNum > nBindGoodNum + nNotBindGoodNum) { return(-10); } bool usedBinding = false; bool usedTimeLimited = false; if (nUseBindItemFirst > 0 && nBindGoodNum > 0) { int nSum; int nSubNum; if (usingGoodsNum > nBindGoodNum) { nSum = nBindGoodNum; nSubNum = usingGoodsNum - nBindGoodNum; } else { nSum = usingGoodsNum; nSubNum = 0; } if (nSum > 0) { if (!GameManager.ClientMgr.NotifyUseBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, cacheMergeItem.OrigGoodsIDList[i], nSum, false, out usedBinding, out usedTimeLimited, true)) { return(-10); } } if (nSubNum > 0) { if (!GameManager.ClientMgr.NotifyUseNotBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, cacheMergeItem.OrigGoodsIDList[i], nSubNum, false, out usedBinding, out usedTimeLimited, true)) { return(-10); } } newGoodsBinding = 1; } else { int nSum; int nSubNum; if (usingGoodsNum > nNotBindGoodNum) { nSum = nNotBindGoodNum; nSubNum = usingGoodsNum - nNotBindGoodNum; } else { nSum = usingGoodsNum; nSubNum = 0; } if (nSum > 0) { if (!GameManager.ClientMgr.NotifyUseNotBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, cacheMergeItem.OrigGoodsIDList[i], nSum, false, out usedBinding, out usedTimeLimited, true)) { return(-10); } } if (nSubNum > 0) { if (!GameManager.ClientMgr.NotifyUseBindGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, cacheMergeItem.OrigGoodsIDList[i], nSubNum, false, out usedBinding, out usedTimeLimited, true)) { return(-10); } newGoodsBinding = 1; } } } if (cacheMergeItem.DianJuan > 0) { if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, cacheMergeItem.DianJuan, "合成新物品", true, true, false, DaiBiSySType.None)) { return(-11); } } if (cacheMergeItem.Money > 0) { if (!Global.SubBindTongQianAndTongQian(client, cacheMergeItem.Money, "材料合成")) { return(-12); } } if (cacheMergeItem.JingYuan > 0) { GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, -cacheMergeItem.JingYuan, "材料合成", true, true, false); } if (!success) { result = -1000; } else { int dbRet = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, nNewGoodsID, 1, 0, "", 0, newGoodsBinding, 0, "", true, 1, "材料合成新物品", "1900-01-01 12:00:00", 0, 0, 0, 0, 0, 0, 0, null, null, 0, true); if (dbRet < 0) { result = -20; } else { if (90 == Global.GetGoodsCatetoriy(nNewGoodsID)) { if (Global.GetJewelLevel(nNewGoodsID) >= 6) { Global.BroadcastMergeJewelOk(client, nNewGoodsID); } } if (120 == Global.GetGoodsCatetoriy(nNewGoodsID)) { } ChengJiuManager.OnFirstHeCheng(client); ChengJiuManager.OnRoleGoodsHeCheng(client, nNewGoodsID); SevenDayGoalEventObject evObj = SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.HeChengTimes); evObj.Arg1 = nNewGoodsID; GlobalEventSource.getInstance().fireEvent(evObj); ProcessTask.ProcessAddTaskVal(client, TaskTypes.Merge_GuoShi, cacheMergeItem.MergeType, 1, new object[0]); result = 0; } } } return(result); }
public static int ReqFinishCaiJi(GameClient client, int monsterId) { int result; if (monsterId != client.ClientData.CaijTargetId || client.ClientData.CaiJiStartTick == 0U || client.ClientData.CaijTargetId == 0) { CaiJiLogic.CancelCaiJiState(client); result = -3; } else if (client.ClientData.CurrentLifeV <= 0) { CaiJiLogic.CancelCaiJiState(client); result = -3; } else { Monster monster = GameManager.MonsterMgr.FindMonster(client.ClientData.MapCode, monsterId); if (null == monster) { CaiJiLogic.CancelCaiJiState(client); result = -1; } else if (monster.UniqueID != client.ClientData.CaiJiTargetUniqueID) { CaiJiLogic.CancelCaiJiState(client); result = -1; } else if (monster.MonsterType != 1601) { CaiJiLogic.CancelCaiJiState(client); result = -4; } else { SystemXmlItem CaiJiMonsterXmlItem = null; SceneUIClasses sceneType = Global.GetMapSceneType(client.ClientData.MapCode); GetCaiJiTimeEventObject eventObj = new GetCaiJiTimeEventObject(client, monster); bool handled = GlobalEventSource4Scene.getInstance().fireEvent(eventObj, (int)sceneType); int GatherTime; if (handled) { if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 600.0) { return(-301); } GatherTime = eventObj.GatherTime; if (GatherTime < 0) { return(GatherTime); } } else if (sceneType == SceneUIClasses.HuanYingSiYuan) { GatherTime = HuanYingSiYuanManager.getInstance().GetCaiJiMonsterTime(client, monster); if (GatherTime < 0) { return(-4); } } else if (sceneType == SceneUIClasses.YongZheZhanChang) { GatherTime = YongZheZhanChangManager.getInstance().GetCaiJiMonsterTime(client, monster); if (GatherTime < 0) { return(-4); } } else if (sceneType == SceneUIClasses.KingOfBattle) { GatherTime = KingOfBattleManager.getInstance().GetCaiJiMonsterTime(client, monster); if (GatherTime < 0) { return(-4); } } else if (sceneType == SceneUIClasses.Comp) { GatherTime = CompManager.getInstance().GetCaiJiMonsterTime(client, monster); if (GatherTime < 0) { return(-4); } } else if (sceneType == SceneUIClasses.KarenEast) { GatherTime = KarenBattleManager_MapEast.getInstance().GetCaiJiMonsterTime(client, monster); if (GatherTime < 0) { return(-4); } } else if (sceneType == SceneUIClasses.LingDiCaiJi) { GatherTime = LingDiCaiJiManager.getInstance().GetCaiJiMonsterTime(client, monster); if (GatherTime < 0) { CaiJiLogic.CancelCaiJiState(client); return(GatherTime); } } else if (sceneType == SceneUIClasses.EscapeBattle) { GatherTime = EscapeBattleManager.getInstance().GetCaiJiMonsterTime(client, monster); if (GatherTime < 0) { return(-4); } } else { if (sceneType == SceneUIClasses.ShuiJingHuanJing) { if (client.ClientData.DailyCrystalCollectNum >= CaiJiLogic.DailyNum) { CaiJiLogic.CancelCaiJiState(client); return(-6); } } if (!GameManager.systemCaiJiMonsterMgr.SystemXmlItemDict.TryGetValue(monster.MonsterInfo.ExtensionID, out CaiJiMonsterXmlItem) || null == CaiJiMonsterXmlItem) { CaiJiLogic.CancelCaiJiState(client); return(-4); } GatherTime = CaiJiMonsterXmlItem.GetIntValue("GatherTime", -1); } GatherTime = GatherTime * CaiJiLogic.GatherTimePer / 100; uint intervalmsec = TimeUtil.timeGetTime() - client.ClientData.CaiJiStartTick; if ((ulong)intervalmsec < (ulong)((long)(GatherTime * 1000))) { CaiJiLogic.CancelCaiJiState(client); LogManager.WriteLog(LogTypes.Error, string.Format("采集读条时间不足intervalmsec={0}", intervalmsec), null, true); result = -5; } else { CaiJiLogic.CancelCaiJiState(client); if (Global.GetTwoPointDistance(client.CurrentPos, monster.CurrentPos) > 400.0) { result = -2; } else { lock (monster.CaiJiStateLock) { if (monster.IsCollected) { return(-4); } monster.IsCollected = true; } if (!GlobalEventSource4Scene.getInstance().fireEvent(new CaiJiEventObject(client, monster), (int)sceneType)) { if (sceneType == SceneUIClasses.HuanYingSiYuan) { HuanYingSiYuanManager.getInstance().OnCaiJiFinish(client, monster); } else if (sceneType == SceneUIClasses.LingDiCaiJi) { LingDiCaiJiManager.getInstance().OnCaiJiFinish(client, monster); } else { CaiJiLogic.UpdateCaiJiData(client); CaiJiLogic.NotifyCollectLastNum(client, 0, CaiJiLogic.DailyNum - client.ClientData.DailyCrystalCollectNum); float AwardRate = 1f; int rangeIndex = CaiJiLogic.JugeDateTimeInTimeRange(TimeUtil.NowDateTime(), CaiJiLogic.dateTimeRangeArray, true); if (rangeIndex >= 0) { AwardRate = CaiJiLogic.dateTimeRangeArray[rangeIndex].DoubleAwardRate; } int ExpAward = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("ExpAward", -1)); int XingHunAward = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("XingHunAward", -1)); int BindZuanShiAward = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("BindZuanShiAward", -1)); int BindJinBiAward = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("BindJinBiAward", -1)); int MoJingAward = (int)(AwardRate * (float)CaiJiMonsterXmlItem.GetIntValue("MoJingAward", -1)); if (ExpAward > 0) { GameManager.ClientMgr.ProcessRoleExperience(client, (long)ExpAward, true, true, false, "none"); } if (XingHunAward > 0) { GameManager.ClientMgr.ModifyStarSoulValue(client, XingHunAward, "采集获得星魂", true, true); } if (BindZuanShiAward > 0) { GameManager.ClientMgr.AddUserGold(client, BindZuanShiAward, "采集获得绑钻"); } if (BindJinBiAward > 0) { GameManager.ClientMgr.AddMoney1(client, BindJinBiAward, "采集获得绑金", true); GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(28, new object[0]), new object[] { BindJinBiAward }), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlyErr, 0); } if (MoJingAward > 0) { GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, MoJingAward, "采集获得魔晶", true, true, false); } ProcessTask.ProcessAddTaskVal(client, TaskTypes.CaiJi_ShuiJingHuanJing, -1, 1, new object[0]); } } GameManager.MonsterMgr.DeadMonsterImmediately(monster); ProcessTask.Process(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, monster.RoleID, monster.MonsterInfo.ExtensionID, -1, TaskTypes.CaiJiGoods, null, 0, -1L, null); result = 0; } } } } return(result); }
public void HandleActiveTuJian(GameClient client, string[] itemArr) { if (itemArr != null && itemArr.Length != 0 && client != null) { bool anySuccess = false; foreach (string strItemID in itemArr) { int itemID = Convert.ToInt32(strItemID); TuJianItem item = null; TuJianType type = null; if (this.TuJianItems.TryGetValue(itemID, out item) && this.TuJianTypes.TryGetValue(item.TypeID, out type)) { if (client.ClientData.ChangeLifeCount >= type.OpenChangeLife && (client.ClientData.ChangeLifeCount != type.OpenChangeLife || client.ClientData.Level >= type.OpenLevel)) { int hadReferCnt = 0; if (client.ClientData.PictureJudgeReferInfo.ContainsKey(itemID)) { hadReferCnt = client.ClientData.PictureJudgeReferInfo[itemID]; } if (hadReferCnt < item.CostGoodsCnt) { int needReferCnt = item.CostGoodsCnt - hadReferCnt; int hasGoodsCnt = Global.GetTotalGoodsCountByID(client, item.CostGoodsID); if (hasGoodsCnt > 0) { int thisTimeReferCnt = Math.Min(needReferCnt, hasGoodsCnt); bool usedBinding_just_placeholder = false; bool usedTimeLimited_just_placeholder = false; if (GameManager.ClientMgr.NotifyUseGoods(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, item.CostGoodsID, thisTimeReferCnt, false, out usedBinding_just_placeholder, out usedTimeLimited_just_placeholder, false)) { string strDbCmd = string.Format("{0}:{1}:{2}", client.ClientData.RoleID, itemID, hadReferCnt + thisTimeReferCnt); string[] dbRsp = Global.ExecuteDBCmd(10155, strDbCmd, client.ServerId); if (dbRsp == null || dbRsp.Length != 1 || Convert.ToInt32(dbRsp[0]) <= 0) { LogManager.WriteLog(LogTypes.Error, string.Format("角色RoleID={0},RoleName={1} 激活图鉴Item={2}时,与db通信失败,物品已扣除GoodsID={3},Cnt={4}", new object[] { client.ClientData.RoleID, client.ClientData.RoleName, itemID, item.CostGoodsID, thisTimeReferCnt }), null, true); } else { anySuccess = true; if (!client.ClientData.PictureJudgeReferInfo.ContainsKey(itemID)) { client.ClientData.PictureJudgeReferInfo.Add(itemID, hadReferCnt + thisTimeReferCnt); } else { client.ClientData.PictureJudgeReferInfo[itemID] = hadReferCnt + thisTimeReferCnt; } ProcessTask.ProcessAddTaskVal(client, TaskTypes.JiHuoTuJian, -1, 1, new object[0]); } } } } } } } if (anySuccess) { this.UpdateTuJianProps(client); SingletonTemplate <GuardStatueManager> .Instance().OnActiveTuJian(client); GlobalEventSource.getInstance().fireEvent(SevenDayGoalEvPool.Alloc(client, ESevenDayGoalFuncType.CompleteTuJian)); GameManager.ClientMgr.NotifyUpdateEquipProps(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client); GameManager.ClientMgr.NotifyOthersLifeChanged(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, true, false, 7); } } }
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); }