public void processEvent(EventObject eventObject) { if (eventObject.getEventType() == 18) { Monster monster = (eventObject as MonsterBlooadChangedEventObject).getMonster(); GameClient client = (eventObject as MonsterBlooadChangedEventObject).getGameClient(); if (monster != null && null != client) { if (client.ClientData.CopyMapID > 0 && client.ClientData.FuBenSeqID > 0 && MapTypes.MarriageCopy == Global.GetMapType(client.ClientData.MapCode) && MapTypes.MarriageCopy == Global.GetMapType(monster.CurrentMapCode)) { SystemXmlItem XMLItem = null; if (this.ManAndWifeBossXmlItems.SystemXmlItemDict.TryGetValue(monster.MonsterInfo.ExtensionID, out XMLItem) && null != XMLItem) { if (XMLItem.GetIntValue("Need", -1) != (int)client.ClientData.MyMarriageData.byMarrytype) { BufferData bufferData = Global.GetMonsterBufferDataByID(monster, XMLItem.GetIntValue("GoodsID", -1)); if (bufferData == null || Global.IsBufferDataOver(bufferData, 0L)) { double[] newActionParams = new double[] { 15.0, 1.0 }; EquipPropItem item = GameManager.EquipPropsMgr.FindEquipPropItem(2000808); if (null != item) { newActionParams[1] = item.ExtProps[24]; } Global.UpdateMonsterBufferData(monster, BufferItemTypes.MU_MARRIAGE_SUBDAMAGEPERCENTTIMER, newActionParams); string text = string.Format(GLang.GetLang(484, new object[0]), client.ClientData.RoleName, monster.MonsterInfo.VSName); GameManager.ClientMgr.BroadSpecialHintText(monster.CurrentMapCode, monster.CurrentCopyMapID, text); } } } } } } else if (eventObject.getEventType() == 12) { GameClient client = (eventObject as PlayerLogoutEventObject).getPlayer(); this.ClientExitRoom(client); } }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; int needAddIntoBH = Global.SafeConvertToInt32(arg); if (client != null) { if (needAddIntoBH > 0 && client.ClientData.Faction > 0) { bOK = true; } } if (!bOK) { failedMsg = GLang.GetLang(2002, new object[0]); } return(bOK); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; if (client != null && !string.IsNullOrEmpty(arg)) { int iNeedLvl = -1; if (int.TryParse(arg, out iNeedLvl) && GameManager.ClientMgr.GetShengWangLevelValue(client) >= iNeedLvl) { bOK = true; } } if (!bOK) { failedMsg = string.Format(GLang.GetLang(140, new object[0]), string.Format(GLang.GetLang(677, new object[0]), arg)); } return(bOK); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; if (client != null && !string.IsNullOrEmpty(arg)) { int iNeedSuit = int.MaxValue; if (int.TryParse(arg, out iNeedSuit) && client.UsingEquipMgr.GetUsingEquipArchangelWeaponSuit() >= iNeedSuit) { bOK = true; } } if (!bOK) { failedMsg = string.Format(GLang.GetLang(140, new object[0]), string.Format(GLang.GetLang(682, new object[0]), arg)); } return(bOK); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; if (client != null && !string.IsNullOrEmpty(arg)) { int iNeedYB = int.MaxValue; if (int.TryParse(arg, out iNeedYB) && client.ClientData.UserMoney >= iNeedYB) { bOK = true; } } if (!bOK) { failedMsg = string.Format(GLang.GetLang(140, new object[0]), string.Format(GLang.GetLang(686, new object[0]), arg)); } return(bOK); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; int needTaskId = Global.SafeConvertToInt32(arg); if (client != null) { if (client.ClientData.MainTaskID >= needTaskId) { bOK = true; } } if (!bOK) { failedMsg = string.Format(GLang.GetLang(140, new object[0]), string.Format(GLang.GetLang(685, new object[0]), GlobalNew.GetTaskName(needTaskId))); } return(bOK); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; int Strength = Global.GetRoleParamsInt32FromDB(client, "PropStrengthChangeless"); int Intelligence = Global.GetRoleParamsInt32FromDB(client, "PropIntelligenceChangeless"); int Dexterity = Global.GetRoleParamsInt32FromDB(client, "PropDexterityChangeless"); int Constitution = Global.GetRoleParamsInt32FromDB(client, "PropConstitutionChangeless"); if (Strength < UseFruitVerify.GetFruitAddPropLimit(client, "Strength") || Intelligence < UseFruitVerify.GetFruitAddPropLimit(client, "Intelligence") || Dexterity < UseFruitVerify.GetFruitAddPropLimit(client, "Dexterity") || Constitution < UseFruitVerify.GetFruitAddPropLimit(client, "Constitution")) { bOK = true; } if (!bOK) { failedMsg = GLang.GetLang(8015, new object[0]); } return(bOK); }
private void GiveClientChargeItem(GameClient client, List <GoodsData> awardList) { int outBag; if (!RebornEquip.MoreIsCanIntoRebornOrBaseBag(client, awardList, out outBag)) { Global.UseMailGivePlayerAward2(client, awardList, GLang.GetLang(553, new object[0]), GLang.GetLang(554, new object[0]), 0, 0, 0); } else { for (int i = 0; i < awardList.Count; i++) { GoodsData goodsData = awardList[i]; if (null != goodsData) { goodsData.Id = Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, "充值直购", goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, 0, 0, null, null, 0, true); } } } }
public string GetErGuoTouBufferName(GameClient client) { BufferData bufferData = Global.GetBufferDataByID(client, 48); string result; if (null == bufferData) { result = GLang.GetLang(426, new object[0]); } else if (Global.IsBufferDataOver(bufferData, 0L)) { result = GLang.GetLang(426, new object[0]); } else { long goodsID = (long)(0xffff_ffffUL & (ulong)(bufferData.BufferVal >> 32)); result = Global.GetGoodsNameByID((int)goodsID); } return(result); }
public bool CheckTrade(GameClient client, MoneyTypes moneyType, bool notify = true) { if (moneyType == MoneyTypes.YuanBao) { if ((Data.OpenData.paimaihangzuanshi == 2 && client.ClientSocket.session.IsAdult == 0) || Data.OpenData.paimaihangzuanshi <= 0) { if (notify) { string tip = GLang.GetLang(37, new object[0]); GameManager.ClientMgr.NotifyHintMsg(client, tip); } return(false); } } else if (moneyType == MoneyTypes.MoBi) { if ((Data.OpenData.paimaihangmobi == 2 && client.ClientSocket.session.IsAdult != 0) || Data.OpenData.paimaihangmobi <= 0) { if (notify) { string tip = GLang.GetLang(38, new object[0]); GameManager.ClientMgr.NotifyHintMsg(client, tip); } return(false); } } else if (moneyType == MoneyTypes.YinLiang) { if ((Data.OpenData.paimaihangjinbi == 2 && client.ClientSocket.session.IsAdult != 0) || Data.OpenData.paimaihangjinbi <= 0) { if (notify) { string tip = GLang.GetLang(39, new object[0]); GameManager.ClientMgr.NotifyHintMsg(client, tip); } return(false); } } return(true); }
public static WangChengMapInfoData FormatWangChengMapInfoData() { string nextBattleTime = GLang.GetLang(43, new object[0]); long endTime = 0L; if (WangChengZhanStates.None == WangChengManager.WangChengZhanState) { nextBattleTime = WangChengManager.GetNextCityBattleTime(); } else { endTime = WangChengManager.GetBattleEndMs(); } return(new WangChengMapInfoData { FightingEndTime = endTime, FightingState = (WangChengManager.WaitingHuangChengResult ? 1 : 0), NextBattleTime = nextBattleTime, WangZuBHName = WangChengManager.WangZuBHName, WangZuBHid = WangChengManager.WangZuBHid }); }
private static void _SendAward2Player(GameClient client, YueKaAward award) { if (!GameFuncControlManager.IsGameFuncDisabled(GameFuncType.System1Dot4Dot1)) { List <GoodsData> goodsDataList = award.GetGoodsByOcc(Global.CalcOriginalOccupationID(client)); if (!Global.CanAddGoodsNum(client, goodsDataList.Count)) { foreach (GoodsData item in goodsDataList) { Global.UseMailGivePlayerAward(client, item, GLang.GetLang(576, new object[0]), string.Format(GLang.GetLang(577, new object[0]), award.Day), 1.0); } } else { foreach (GoodsData goodsData in goodsDataList) { goodsData.Id = Global.AddGoodsDBCommand_Hook(Global._TCPManager.TcpOutPacketPool, client, goodsData.GoodsID, goodsData.GCount, goodsData.Quality, goodsData.Props, goodsData.Forge_level, goodsData.Binding, 0, goodsData.Jewellist, true, 1, string.Format("第{0}天月卡返利", award.Day), false, goodsData.Endtime, goodsData.AddPropIndex, goodsData.BornIndex, goodsData.Lucky, goodsData.Strong, goodsData.ExcellenceInfo, goodsData.AppendPropLev, goodsData.ChangeLifeLevForEquip, true, null, null, "1900-01-01 12:00:00", 0, true); } } GameManager.ClientMgr.AddUserGold(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, award.BindZuanShi, string.Format("第{0}天月卡返利", award.Day)); } }
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; if (client != null && !string.IsNullOrEmpty(arg)) { GoodsData usingHuFu = client.UsingEquipMgr.GetGoodsDataByCategoriy(client, 22); if (usingHuFu != null) { int iNeedSuit = -1; if (int.TryParse(arg, out iNeedSuit) && Global.GetEquipGoodsSuitID(usingHuFu.GoodsID) >= iNeedSuit) { bOK = true; } } } if (!bOK) { failedMsg = string.Format(GLang.GetLang(140, new object[0]), string.Format(GLang.GetLang(681, new object[0]), arg)); } return(bOK); }
public string GetErGuoTouBufferLeftTime(GameClient client) { BufferData bufferData = Global.GetBufferDataByID(client, 48); string result; if (null == bufferData) { result = GLang.GetLang(427, new object[0]); } else if (Global.IsBufferDataOver(bufferData, 0L)) { result = GLang.GetLang(427, new object[0]); } else { result = StringUtil.substitute(GLang.GetLang(428, new object[0]), new object[] { bufferData.BufferSecs / 60, bufferData.BufferSecs % 60 }); } return(result); }
private void SendMailForGiftCode(List <GoodsData> GoodList, GiftCodeAwardData ItemData, string subject, string content) { if (GoodList != null && null != ItemData) { subject = (string.IsNullOrEmpty(subject) ? GLang.GetLang(121, new object[0]) : subject); content = (string.IsNullOrEmpty(content) ? GLang.GetLang(122, new object[0]) : content); content = string.Format(content, ItemData.GiftId, ItemData.CodeNo); bool bSuccess = Global.UseMailGivePlayerAward3(ItemData.RoleID, GoodList, subject, content, 0, 0, 0); if (bSuccess) { GameClient client = GameManager.ClientMgr.FindClient(ItemData.RoleID); if (null != client) { GameManager.ClientMgr.SendSystemChatMessageToClient(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, GLang.GetLang(123, new object[0])); } this.AddLogEvent(ItemData, 1); } else { this.AddLogEvent(ItemData, -3); } } }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool result; if (!GameManager.MerlinMagicBookMgr.IsOpenMerlin(client)) { result = false; } else { int nCurLevel = client.ClientData.MerlinData._Level; int nCurStarNum = client.ClientData.MerlinData._StarNum; List <int> iArgList = Global.StringToIntList(arg, '|'); bool bOK = nCurLevel < iArgList[0] || (nCurLevel == iArgList[0] && nCurStarNum < iArgList[1]); if (!bOK) { failedMsg = GLang.GetLang(8013, 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 void SetBanTradeToTicks(int roleid, long toTicks) { toTicks = Math.Max(0L, toTicks); GameManager.DBCmdMgr.AddDBCmd(10119, string.Format("{0}:{1}:{2}", roleid, 3, toTicks), null, 0); TradeBlackObject obj = this.LoadTradeBlackObject(roleid, true); if (obj != null) { lock (obj) { obj.BanTradeToTicks = toTicks; } } long banTradeSec = 0L; if (toTicks > TimeUtil.NowDateTime().Ticks) { banTradeSec = (long)(new DateTime(toTicks) - TimeUtil.NowDateTime()).TotalSeconds; banTradeSec = Math.Max(0L, banTradeSec); } if (banTradeSec > 0L) { LogManager.WriteLog(LogTypes.Error, string.Format("roleid={0} 被封禁交易,秒数={1}", roleid, banTradeSec), null, true); } GameClient client = GameManager.ClientMgr.FindClient(roleid); if (client != null) { client.ClientData.BanTradeToTicks = toTicks; if (banTradeSec > 0L) { string tip = string.Format(GLang.GetLang(35, new object[0]), banTradeSec); GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, tip, GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0); } } }
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 bool SendDivorceMail(int roleID, string subject, string content, GameClient client, int serverId) { string mailGoodsString = ""; string strDbCmd = string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}:{7}:{8}:{9}", new object[] { -1, GLang.GetLang(112, new object[0]), roleID, "", subject, content, 0, 0, 0, mailGoodsString }); string[] fieldsData = Global.ExecuteDBCmd(10086, strDbCmd, serverId); if (client != null) { client._IconStateMgr.CheckEmailCount(client, true); } return(fieldsData == null); }
protected bool GiveEffectiveTimeAward(GameClient client, AwardItem myAwardItem) { bool result; if (client == null || null == myAwardItem) { result = false; } else { if (myAwardItem.GoodsDataList != null) { for (int i = 0; i < myAwardItem.GoodsDataList.Count; i++) { int nGoodsID = myAwardItem.GoodsDataList[i].GoodsID; if (Global.IsCanGiveRewardByOccupation(client, nGoodsID)) { client.ClientData.AddAwardRecord((RoleAwardMsg)this.ActivityType, myAwardItem.GoodsDataList[i], false); Global.AddEffectiveTimeGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, myAwardItem.GoodsDataList[i].GoodsID, myAwardItem.GoodsDataList[i].GCount, myAwardItem.GoodsDataList[i].Quality, "", myAwardItem.GoodsDataList[i].Forge_level, myAwardItem.GoodsDataList[i].Binding, 0, "", false, 1, Activity.GetActivityChineseName((ActivityTypes)this.ActivityType), myAwardItem.GoodsDataList[i].Starttime, myAwardItem.GoodsDataList[i].Endtime, myAwardItem.GoodsDataList[i].AddPropIndex, myAwardItem.GoodsDataList[i].BornIndex, myAwardItem.GoodsDataList[i].Lucky, myAwardItem.GoodsDataList[i].Strong, myAwardItem.GoodsDataList[i].ExcellenceInfo, myAwardItem.GoodsDataList[i].AppendPropLev, myAwardItem.GoodsDataList[i].ChangeLifeLevForEquip, null, null); } } } if (myAwardItem.AwardYuanBao > 0) { GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType), ActivityTypes.None, ""); GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(386, new object[0]), new object[] { myAwardItem.AwardYuanBao }), GameInfoTypeIndexes.Normal, ShowGameInfoTypes.OnlyErr, 0); GameManager.DBCmdMgr.AddDBCmd(10113, string.Format("{0}:{1}:{2}", client.ClientData.RoleID, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType)), null, client.ServerId); } result = true; } return(result); }
public bool InitConfig() { lock (this.RuntimeData.Mutex) { this.RuntimeData.SystemOpen = false; string fileName = Global.GameResPath("Config/TenRetutnAward.xml"); XElement xml = CheckHelper.LoadXml(fileName, true); if (null == xml) { return(true); } try { this.RuntimeData.SystemOpen = false; this.RuntimeData._tenAwardDic.Clear(); IEnumerable <XElement> xmlItems = xml.Elements(); foreach (XElement xmlItem in xmlItems) { if (xmlItem != null) { TenRetutnAwardsData config = new TenRetutnAwardsData(); config.ID = Convert.ToInt32(Global.GetSafeAttributeLong(xmlItem, "ID")); config.MailUser = GLang.GetLang(112, new object[0]); config.MailTitle = Global.GetSafeAttributeStr(xmlItem, "MailTitle"); config.MailContent = Global.GetSafeAttributeStr(xmlItem, "MailContent"); ConfigParser.ParseAwardsItemList(Global.GetDefAttributeStr(xmlItem, "GoodsID1", ""), ref config.GoodsID1, '|', ','); ConfigParser.ParseAwardsItemList(Global.GetDefAttributeStr(xmlItem, "GoodsID2", ""), ref config.GoodsID2, '|', ','); config.UserList = Global.GetSafeAttributeStr(xmlItem, "UserList"); string beginTime = Global.GetDefAttributeStr(xmlItem, "BeginTime", "2019-12-31"); string finishTime = Global.GetDefAttributeStr(xmlItem, "FinishTime", "2011-11-11"); config.BeginTimeStr = beginTime.Replace(':', '$'); config.FinishTimeStr = finishTime.Replace(':', '$'); if (DateTime.TryParse(beginTime, out config.BeginTime) && DateTime.TryParse(finishTime, out config.FinishTime) && TimeUtil.NowDateTime() < config.FinishTime) { config.SystemOpen = true; this.RuntimeData._tenAwardDic.Add(config.ID, config); fileName = Global.GameResPath("Config/" + config.UserList); if (File.Exists(fileName)) { string[] allUserIds = File.ReadAllLines(fileName); foreach (string userid in allUserIds) { if (!string.IsNullOrEmpty(userid)) { config._tenUserIdAwardsDict[userid.ToLower()] = false; } } } if (config._tenUserIdAwardsDict.Count == 0) { config.SystemOpen = false; } } this.RuntimeData.SystemOpen |= config.SystemOpen; } } } catch (Exception ex) { LogManager.WriteLog(LogTypes.Warning, "加载Config/TenRetutnAward.xml时文件出现异常!!!", ex, true); } } return(true); }
public bool processCmdEx(GameClient client, int nID, byte[] bytes, string[] cmdParams) { bool result; if (!this.IsGongNengOpen(client, false)) { GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(3, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0); result = true; } else { switch (nID) { case 1450: result = this.ProcessJingLingYuanSuJueXingActiveCmd(client, nID, bytes, cmdParams); break; case 1451: result = this.ProcessJingLingYuanSuJueXingUpgradeCmd(client, nID, bytes, cmdParams); break; default: result = true; break; } } return(result); }
protected bool GiveAwardByOccupation(GameClient client, AwardItem myAwardItem, int occupation) { bool result; if (client == null || null == myAwardItem) { result = false; } else { if (myAwardItem.GoodsDataList != null && myAwardItem.GoodsDataList.Count > 0) { int count = myAwardItem.GoodsDataList.Count; for (int i = 0; i < count; i++) { GoodsData data = myAwardItem.GoodsDataList[i]; if (Global.IsCanGiveRewardByOccupation(client, data.GoodsID)) { Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, data.GoodsID, data.GCount, data.Quality, "", data.Forge_level, data.Binding, 0, "", true, 1, Activity.GetActivityChineseName((ActivityTypes)this.ActivityType), "1900-01-01 12:00:00", data.AddPropIndex, data.BornIndex, data.Lucky, data.Strong, data.ExcellenceInfo, data.AppendPropLev, data.ChangeLifeLevForEquip, null, null, 0, true); } } } if (myAwardItem.AwardYuanBao > 0) { GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType), ActivityTypes.None, ""); GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(386, new object[0]), new object[] { myAwardItem.AwardYuanBao }), GameInfoTypeIndexes.Normal, ShowGameInfoTypes.OnlyErr, 0); GameManager.DBCmdMgr.AddDBCmd(10113, string.Format("{0}:{1}:{2}", client.ClientData.RoleID, myAwardItem.AwardYuanBao, string.Format("领取{0}活动奖励", (ActivityTypes)this.ActivityType)), null, client.ServerId); } result = true; } return(result); }
public bool processCmdEx(GameClient client, int nID, byte[] bytes, string[] cmdParams) { bool result; if (!GlobalNew.IsGongNengOpened(client, GongNengIDs.Building, false)) { GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(3, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0); result = true; } else { switch (nID) { case 1080: result = this.ProcessShenJiAddEffectCmd(client, nID, bytes, cmdParams); break; case 1081: result = this.ProcessShenJiAddExpCmd(client, nID, bytes, cmdParams); break; case 1082: result = this.ProcessShenJiWashCmd(client, nID, bytes, cmdParams); break; default: result = true; break; } } return(result); }
public bool Judge(GameClient client, string arg, out string failedMsg) { failedMsg = ""; bool bOK = false; if (client != null && !string.IsNullOrEmpty(arg)) { int iNeedChangeLife = -1; if (int.TryParse(arg, out iNeedChangeLife) && client.ClientData.ChangeLifeCount >= iNeedChangeLife) { bOK = true; } } if (!bOK) { failedMsg = string.Format(GLang.GetLang(140, new object[0]), string.Format(GLang.GetLang(678, new object[0]), arg)); } return(bOK); }
public void TimerProc() { if (!GameManager.IsKuaFuServer) { if (155 == this.ActivityType && this.InActivityTime()) { DateTime now = TimeUtil.NowDateTime(); long nowTicks = now.Ticks / 10000L; lock (ThemeBoss.Mutex) { if (Math.Abs(nowTicks - ThemeBoss.LastHeartBeatTicks) < 1000L) { return; } ThemeBoss.LastHeartBeatTicks = nowTicks; this.GenerateThemeBossScene(); } foreach (KeyValuePair <int, ThemeBossScene> scenes in this.SceneDict) { lock (ThemeBoss.Mutex) { switch (scenes.Value.State) { case BattleStates.NoBattle: if (this.JudgeCanTriggerActivity(scenes.Value, now)) { if (this.GetStartEndTime(scenes.Key, out scenes.Value.StartTick, out scenes.Value.EndTick)) { scenes.Value.State = BattleStates.WaitingFight; } } break; case BattleStates.WaitingFight: if (nowTicks >= scenes.Value.StartTick) { ThemeBossConfig BossConfigInfo = scenes.Value.BossConfigInfo; Monster bossSeed = GameManager.MonsterZoneMgr.AddDynamicMonsters(scenes.Value.MapCode, BossConfigInfo.MonstersID, -1, BossConfigInfo.Num, BossConfigInfo.PosX / 100, BossConfigInfo.PosY / 100, BossConfigInfo.Radius, 0, SceneUIClasses.Normal, null, null); if (null != bossSeed) { scenes.Value.State = BattleStates.StartFight; scenes.Value.AliveBossNum = BossConfigInfo.Num; Global.BroadcastRoleActionMsg(null, RoleActionsMsgTypes.HintMsg, GLang.GetLang(4013, new object[0]), true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.HintAndBox, 0, 0, 100, 100); } } break; case BattleStates.StartFight: if (!scenes.Value.BroadCast4014 && (scenes.Value.EndTick - nowTicks) / 1000L <= 180L) { Global.BroadcastRoleActionMsg(null, RoleActionsMsgTypes.HintMsg, GLang.GetLang(4014, new object[0]), true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.HintAndBox, 0, 0, 100, 100); scenes.Value.BroadCast4014 = true; } if (nowTicks >= scenes.Value.EndTick) { scenes.Value.State = BattleStates.EndFight; List <object> monsterList = GameManager.MonsterMgr.GetObjectsByMap(scenes.Value.MapCode); foreach (object item in monsterList) { Monster monster = item as Monster; if (monster != null && monster.MonsterInfo.ExtensionID == scenes.Value.BossConfigInfo.MonstersID) { GameManager.MonsterMgr.DeadMonsterImmediately(monster); } } } break; case BattleStates.EndFight: scenes.Value.State = BattleStates.NoBattle; scenes.Value.BroadCast4014 = false; scenes.Value.AliveBossNum = 0; break; } } } } } }
private string TodayAward(GameClient client, bool isAll, int todayID) { string result = "{0}:{1}"; string result2; if (!this.IsGongNengOpened()) { result2 = string.Format(result, -11, 0); } else { TodayInfo oneInfo = null; if (!isAll) { oneInfo = this.GetTadayInfoByID(client, todayID); if (oneInfo == null) { return(string.Format(result, -3, 0)); } if (oneInfo.NumMax - oneInfo.NumEnd <= 0) { return(string.Format(result, -4, 0)); } } List <TodayInfo> listAll = new List <TodayInfo>(); if (isAll) { listAll = this.InitToday(client); } else { listAll.Add(oneInfo); } if (listAll.IsNullOrEmpty <TodayInfo>()) { result2 = string.Format(result, -3, 0); } else { IEnumerable <TodayInfo> fubenList = from info in listAll where info.FuBenID > 0 && client.ClientData.FuBenID > 0 && client.ClientData.FuBenID == info.FuBenID && info.NumMax - info.NumEnd > 0 && info.NumEnd >= 0 select info; if (fubenList.Any <TodayInfo>()) { result2 = string.Format(result, -6, 0); } else { IEnumerable <TodayInfo> awardList = from info in listAll where info.NumMax - info.NumEnd > 0 select info; if (!awardList.Any <TodayInfo>()) { result2 = string.Format(result, -5, 0); } else { int goodsCount = 0; foreach (TodayInfo info2 in awardList) { goodsCount += info2.AwardInfo.GoodsList.Count; } if (!Global.CanAddGoodsNum(client, goodsCount)) { result2 = string.Format(result, -2, 0); } else { foreach (TodayInfo info2 in awardList) { SystemXmlItem fuBenInfo = null; if (info2.Type == 6) { TaskData taskData = TodayManager.GetTaoTask(client); if (taskData != null) { if (!Global.CancelTask(client, taskData.DbID, taskData.DoingTaskID)) { return(string.Format(result, -8, 0)); } } } else if (info2.Type == 9) { BufferData bufferData = Global.GetBufferDataByID(client, 34); if (bufferData != null) { bufferData.BufferVal = 0L; bufferData.BufferSecs = 0; GameManager.ClientMgr.NotifyBufferData(client, bufferData); } } else if (!GameManager.systemFuBenMgr.SystemXmlItemDict.TryGetValue(info2.FuBenID, out fuBenInfo)) { return(string.Format(result, -7, 0)); } if (!this.SetFinishNum(client, info2, fuBenInfo)) { return(string.Format(result, -1, 0)); } } TodayAwardInfo awardInfo = new TodayAwardInfo(); foreach (TodayInfo info2 in awardList) { int num = info2.NumMax - info2.NumEnd; for (int i = 0; i < info2.AwardInfo.GoodsList.Count; i++) { GoodsData goods = info2.AwardInfo.GoodsList[i]; Global.AddGoodsDBCommand(Global._TCPManager.TcpOutPacketPool, client, goods.GoodsID, goods.GCount * num, goods.Quality, "", goods.Forge_level, goods.Binding, 0, "", true, 1, "每日专享", "1900-01-01 12:00:00", goods.AddPropIndex, goods.BornIndex, goods.Lucky, goods.Strong, goods.ExcellenceInfo, goods.AppendPropLev, 0, null, null, 0, true); } awardInfo.AddAward(info2.AwardInfo, num); } if (awardInfo.Exp > 0.0) { GameManager.ClientMgr.ProcessRoleExperience(client, (long)awardInfo.Exp, true, true, false, "none"); GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(30, new object[0]), new object[] { awardInfo.Exp }), GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlyErr, 0); } if (awardInfo.GoldBind > 0.0) { GameManager.ClientMgr.AddMoney1(client, (int)awardInfo.GoldBind, "每日专享", true); } if (awardInfo.MoJing > 0.0) { GameManager.ClientMgr.ModifyTianDiJingYuanValue(client, (int)awardInfo.MoJing, "每日专享", true, true, false); } if (awardInfo.ChengJiu > 0.0) { GameManager.ClientMgr.ModifyChengJiuPointsValue(client, (int)awardInfo.ChengJiu, "每日专享", true, true); } if (awardInfo.ShengWang > 0.0) { GameManager.ClientMgr.ModifyShengWangValue(client, (int)awardInfo.ShengWang, "每日专享", true, true); } if (awardInfo.ZhanGong > 0.0) { int zhanGong = (int)awardInfo.ZhanGong; GameManager.ClientMgr.AddBangGong(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, ref zhanGong, AddBangGongTypes.Today, 0); } if (awardInfo.DiamondBind > 0.0 || awardInfo.ExtDiamondBind > 0.0) { GameManager.ClientMgr.AddUserGold(client, (int)(awardInfo.DiamondBind + awardInfo.ExtDiamondBind), "每日专享"); } if (awardInfo.XingHun > 0.0) { GameManager.ClientMgr.ModifyStarSoulValue(client, (int)awardInfo.XingHun, "每日专享", true, true); } if (awardInfo.YuanSuFenMo > 0.0) { GameManager.ClientMgr.ModifyYuanSuFenMoValue(client, (int)awardInfo.YuanSuFenMo, "每日专享", true, false); } if (awardInfo.ShouHuDianShu > 0.0) { SingletonTemplate <GuardStatueManager> .Instance().AddGuardPoint(client, (int)awardInfo.ShouHuDianShu, "每日专享"); } if (awardInfo.ZaiZao > 0.0) { GameManager.ClientMgr.ModifyZaiZaoValue(client, (int)awardInfo.ZaiZao, "每日专享", true, true, false); } if (awardInfo.LingJing > 0.0) { GameManager.ClientMgr.ModifyMUMoHeValue(client, (int)awardInfo.LingJing, "每日专享", true, true, false); } if (awardInfo.RongYao > 0.0) { GameManager.ClientMgr.ModifyTianTiRongYaoValue(client, (int)awardInfo.RongYao, "每日专享", true); } result2 = this.GetTodayData(client); } } } } } return(result2); }
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); }