public void OnLeaveScene(GameClient client, SceneUIClasses sceneType, bool logout = false) { if (client.ClientSocket.IsKuaFuLogin) { switch (sceneType) { case SceneUIClasses.HuanYingSiYuan: HuanYingSiYuanManager.getInstance().OnLogout(client); break; case SceneUIClasses.TianTi: TianTiManager.getInstance().OnLogout(client); break; case SceneUIClasses.YongZheZhanChang: YongZheZhanChangManager.getInstance().OnLogout(client); break; case SceneUIClasses.KingOfBattle: KingOfBattleManager.getInstance().OnLogout(client); break; case SceneUIClasses.MoRiJudge: MoRiJudgeManager.Instance().OnLogOut(client); break; case SceneUIClasses.ElementWar: ElementWarManager.getInstance().OnLogout(client); break; case SceneUIClasses.LangHunLingYu: LangHunLingYuManager.getInstance().OnLogout(client); break; case SceneUIClasses.CopyWolf: CopyWolfManager.getInstance().OnLogout(client); break; case SceneUIClasses.KFZhengBa: ZhengBaManager.Instance().OnLogout(client); break; case SceneUIClasses.CoupleArena: CoupleArenaManager.Instance().OnLeaveFuBen(client); break; } if (!logout) { GotoLastMap(client); } } }
public bool OnInitGame(GameClient client) { int gameType = Global.GetClientKuaFuServerLoginData(client).GameType; switch (gameType) { case (int)GameTypes.HuanYingSiYuan: return(HuanYingSiYuanManager.getInstance().OnInitGame(client)); case (int)GameTypes.TianTi: return(TianTiManager.getInstance().OnInitGame(client)); case (int)GameTypes.YongZheZhanChang: return(YongZheZhanChangManager.getInstance().OnInitGame(client)); case (int)GameTypes.KingOfBattle: return(KingOfBattleManager.getInstance().OnInitGame(client)); case (int)GameTypes.MoRiJudge: return(MoRiJudgeManager.Instance().OnInitGame(client)); case (int)GameTypes.ElementWar: return(ElementWarManager.getInstance().OnInitGame(client)); case (int)GameTypes.KuaFuBoss: return(KuaFuBossManager.getInstance().OnInitGame(client)); case (int)GameTypes.KuaFuMap: return(KuaFuMapManager.getInstance().OnInitGame(client)); case (int)GameTypes.KuaFuCopy: return(CopyTeamManager.Instance().HandleKuaFuInitGame(client)); case (int)GameTypes.LangHunLingYu: return(LangHunLingYuManager.getInstance().OnInitGameKuaFu(client)); case (int)GameTypes.ZhengBa: return(ZhengBaManager.Instance().KuaFuInitGame(client)); case (int)GameTypes.CoupleArena: return(CoupleArenaManager.Instance().KuaFuInitGame(client)); } return(false); }
//刷新当前的功能开启状态,处理有关逻辑 public static void RefreshGongNeng(GameClient client) { CaiJiLogic.InitRoleDailyCaiJiData(client, false, false); HuanYingSiYuanManager.getInstance().InitRoleDailyHYSYData(client); Global.InitRoleDailyTaskData(client, false); // 检测触发开启守护之灵 GuardStatueManager.Instance().OnTaskComplete(client); // 检测开启梅林魔法书 [XSea 2015/6/23] GameManager.MerlinMagicBookMgr.InitMerlinMagicBook(client); // 魂石系统 SoulStoneManager.Instance().CheckOpen(client); ZhengBaManager.Instance().CheckGongNengCanOpen(client); FundManager.initFundData(client); CoupleArenaManager.Instance().CheckGongNengOpen(client); }
public static void initialize() { #if BetaConfig int round = 9; Console.WriteLine("连接调试器或按任意键继续"); do { Console.Write("\b\b" + round); if (Console.KeyAvailable) { break; } Thread.Sleep(1000); } while (--round > 0); Console.Write("\b\b"); #endif //战盟事件管理器 ZhanMengShiJianManager.getInstance().initialize(); //竞技场管理器 JingJiChangManager.getInstance().initialize(); //离线摆摊 LiXianBaiTanManager.getInstance().initialize(); //离线挂机 LiXianGuaJiManager.getInstance().initialize(); //副本活动组队管理器 CopyTeamManager.Instance().initialize(); //指令注册管理器 CmdRegisterTriggerManager.getInstance().initialize(); //发送指令管理 SendCmdManager.getInstance().initialize(); //Boss AI管理器 BossAIManager.getInstance().initialize(); //洗炼管理器 WashPropsManager.initialize(); //MU交易所 SaleManager.getInstance().initialize(); //炼制系统 LianZhiManager.GetInstance().initialize(); // 成就升级 ChengJiuManager.GetInstance().initialize(); //声望勋章 PrestigeMedalManager.getInstance().initialize(); UnionPalaceManager.getInstance().initialize(); UserActivateManager.getInstance().initialize(); PetSkillManager.getInstance().initialize(); //玩家召回 UserReturnManager.getInstance().initialize(); //天赋 TalentManager.getInstance().initialize(); //每日专享 TodayManager.getInstance().initialize(); FundManager.getInstance().initialize(); //警告 WarnManager.getInstance().initialize(); //恶魔来袭 EMoLaiXiCopySceneManager.LoadEMoLaiXiCopySceneInfo(); //罗兰法阵副本 LuoLanFaZhenCopySceneManager.initialize(); //情侣副本管理器 MarryFuBenMgr.getInstance().initialize(); MarryLogic.LoadMarryBaseConfig(); MarryPartyLogic.getInstance().LoadMarryPartyConfig(); //领地 BuildingManager.getInstance().initialize(); // 藏宝秘境 OnePieceManager.getInstance().initialize(); //初始化跨服相关管理器 RegisterManager4Scene((int)SceneUIClasses.Normal, KuaFuManager.getInstance()); // RegisterManager4Scene((int)SceneUIClasses.LangHunLingYu, LangHunLingYuManager.getInstance()); //注册罗兰城战管理器 RegisterManager4Scene((int)SceneUIClasses.LuoLanChengZhan, LuoLanChengZhanManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.Normal, FashionManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.HuanYingSiYuan, HuanYingSiYuanManager.getInstance()); RegisterManager4Scene((int)ManagerTypes.ClientGoodsList, JingLingQiYuanManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.TianTi, TianTiManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.YongZheZhanChang, YongZheZhanChangManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.KingOfBattle, KingOfBattleManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.MoRiJudge, MoRiJudgeManager.Instance()); RegisterManager4Scene((int)SceneUIClasses.ElementWar, ElementWarManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.CopyWolf, CopyWolfManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.KuaFuBoss, KuaFuBossManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.KuaFuMap, KuaFuMapManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.Spread, SpreadManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.KFZhengBa, ZhengBaManager.Instance()); RegisterManager4Scene((int)SceneUIClasses.CoupleArena, CoupleArenaManager.Instance()); RegisterManager4Scene((int)SceneUIClasses.Ally, AllyManager.getInstance()); RegisterManager4Scene((int)SceneUIClasses.CoupleWish, CoupleWishManager.Instance()); // 读取外挂列表和相关配置 RobotTaskValidator.getInstance().Initialize(false, 0, 0, ""); //初始化圣物系统相关配置 HolyItemManager.getInstance().Initialize(); //初始化塔罗牌相关配置 TarotManager.getInstance().Initialize(); // 七日活动 SevenDayActivityMgr.Instance().initialize(); // 魂石 SoulStoneManager.Instance().initialize(); TradeBlackManager.Instance().LoadConfig(); //调用所有注册的管理模块的初始化函数 lock (Scene2ManagerDict) { foreach (var list in Scene2ManagerDict.Values) { foreach (var m in list) { bool success = m.initialize(); IManager2 m2 = m as IManager2; if (null != m2) { success = success && m2.initialize(GameCoreInterface.getinstance()); } if (GameManager.ServerStarting && !success) { LogManager.WriteLog(LogTypes.Fatal, string.Format("执行{0}.initialize()失败,按任意键继续启动!", m.GetType())); //Console.ReadKey(); HX_SERVER close the copy scenes; } } } } //应用宝 TenManager.getInstance().initialize(); TenRetutnManager.getInstance().initialize(); //礼包码 GiftCodeNewManager.getInstance().initialize(); }
/// <summary> /// 加载参数配置文件 /// </summary> /// <returns></returns> private static int ReloadXmlFile_config_systemparams() { int ret = GameManager.systemParamsList.ReloadLoadParamsList(); //解析插旗战的日期和时间 JunQiManager.ParseWeekDaysTimes(); if (GameManager.OPT_ChengZhanType == 0) { //解析皇城战的日期和时间 HuangChengManager.ParseWeekDaysTimes(); //解析王城战的日期和时间 WangChengManager.ParseWeekDaysTimes(); } //重新读取罗兰城战配置文件 LuoLanChengZhanManager.getInstance().InitConfig(); //重置皇城地图编号 Global.ResetHuangChengMapCode(); //重置皇宫的地图编号 Global.ResetHuangGongMapCode(); //坐骑的名称 Global.HorseNamesList = null; //坐骑的速度 Global.HorseSpeedList = null; //生肖竞猜配置 GameManager.ShengXiaoGuessMgr.ReloadConfig(); //古墓配置 Global.InitGuMuMapCodes(); Global.InitVipGumuExpMultiple(); //充值限制掉落的时间项 GameManager.GoodsPackMgr.ResetLimitTimeRange(); //缓存的二锅头物品列表 Global.ErGuoTouGoodsIDList = null; //绑定铜钱符每日使用次数列表缓存 Global._VipUseBindTongQianGoodsIDNum = null; //自动给予的物品的 GameManager.AutoGiveGoodsIDList = null; //加载采集配置 CaiJiLogic.LoadConfig(); // 加载魔剑士静态数据 [XSea 2015/4/14] GameManager.MagicSwordMgr.LoadMagicSwordData(); // 加载梅林魔法书静态数据 [XSea 2015/6/19] GameManager.MerlinMagicBookMgr.LoadMerlinSystemParamsConfigData(); // LogGoods Global.LoadItemLogMark(); // logTradeGoods Global.LoadLogTradeGoods(); //强化最大等级相关配置 Global.LoadForgeSystemParams(); // 副本惩罚时间 KuaFuManager.getInstance().InitCopyTime(); // 魂石精华的经验配置 SoulStoneManager.Instance().LoadJingHuaExpConfig(); // 加载需要记录日志的怪物 MonsterAttackerLogManager.Instance().LoadRecordMonsters(); // 玩家创建角色限制管理 CreateRoleLimitManager.Instance().LoadConfig(); SpeedUpTickCheck.Instance().LoadConfig(); NameManager.Instance().LoadConfig(); CoupleArenaManager.Instance().InitSystenParams(); return(ret); }
public bool OnUserLogin(TMSKSocket socket, int verSign, string userID, string userName, string lastTime, string userToken, string isadult, string signCode, int serverId, string ip, int port, int roleId, int gameType, long gameId) { KuaFuServerLoginData kuaFuServerLoginData = socket.ClientKuaFuServerLoginData; kuaFuServerLoginData.ServerId = serverId; kuaFuServerLoginData.ServerIp = ip; kuaFuServerLoginData.ServerPort = port; kuaFuServerLoginData.RoleId = roleId; kuaFuServerLoginData.GameType = gameType; kuaFuServerLoginData.GameId = gameId; if (kuaFuServerLoginData.WebLoginToken == null) { kuaFuServerLoginData.WebLoginToken = new WebLoginToken() { VerSign = verSign, UserID = userID, UserName = userName, LastTime = lastTime, Isadult = isadult, SignCode = signCode, }; } if (roleId > 0) { // 跨服服务器的两个ID相等,如果不想等,则配置错误; // 如果想要去掉这个限制,允许区游戏服务器兼作跨服活动服务器(混合使用),必须先修改GameManager.ServerLineID相关的逻辑,使其可以兼容 // 完成修改前,这个限制不可取消. if (GameManager.ServerLineID != GameManager.ServerId) { LogManager.WriteLog(LogTypes.Error, "GameManager.ServerLineID未配置,禁止跨服登录"); return(false); } //跨服登录,限制rid if (!string.IsNullOrEmpty(ip) && port > 0 && gameType > 0 && gameId > 0 /* && HuanYingSiYuanClient.getInstance().CanKuaFuLogin()*/) { string dbIp = ""; int dbPort = 0; string logDbIp = ""; int logDbPort = 0; socket.ServerId = serverId; switch (gameType) { case (int)GameTypes.HuanYingSiYuan: { if (!HuanYingSiYuanClient.getInstance().CanKuaFuLogin()) { return(false); } socket.IsKuaFuLogin = HuanYingSiYuanClient.getInstance().KuaFuLogin(kuaFuServerLoginData); if (!HuanYingSiYuanClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId)); return(false); } } break; case (int)GameTypes.TianTi: { if (!TianTiClient.getInstance().CanKuaFuLogin()) { return(false); } socket.IsKuaFuLogin = TianTiClient.getInstance().KuaFuLogin(kuaFuServerLoginData); if (!TianTiClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId)); return(false); } } break; case (int)GameTypes.KingOfBattle: case (int)GameTypes.YongZheZhanChang: case (int)GameTypes.KuaFuBoss: { if (!YongZheZhanChangClient.getInstance().CanKuaFuLogin()) { return(false); } socket.IsKuaFuLogin = YongZheZhanChangClient.getInstance().KuaFuLogin(kuaFuServerLoginData); if (!YongZheZhanChangClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId)); return(false); } } break; case (int)GameTypes.KuaFuMap: { if (!YongZheZhanChangClient.getInstance().CanKuaFuLogin()) { return(false); } socket.IsKuaFuLogin = YongZheZhanChangClient.getInstance().CanEnterKuaFuMap(kuaFuServerLoginData); if (!YongZheZhanChangClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId)); return(false); } } break; case (int)GameTypes.LangHunLingYu: { if (!YongZheZhanChangClient.getInstance().CanKuaFuLogin()) { return(false); } socket.IsKuaFuLogin = LangHunLingYuManager.getInstance().CanEnterKuaFuMap(kuaFuServerLoginData); if (!YongZheZhanChangClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId)); return(false); } } break; case (int)GameTypes.KuaFuCopy: { if (!KFCopyRpcClient.getInstance().CanKuaFuLogin()) { return(false); } socket.IsKuaFuLogin = CopyTeamManager.Instance().HandleKuaFuLogin(kuaFuServerLoginData); if (!KFCopyRpcClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId)); return(false); } } break; case (int)GameTypes.ZhengBa: { if (!TianTiClient.getInstance().CanKuaFuLogin()) { return(false); } socket.IsKuaFuLogin = ZhengBaManager.Instance().CanKuaFuLogin(kuaFuServerLoginData); if (!TianTiClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId)); return(false); } } break; case (int)GameTypes.CoupleArena: { if (!TianTiClient.getInstance().CanKuaFuLogin()) { return(false); } socket.IsKuaFuLogin = CoupleArenaManager.Instance().CanKuaFuLogin(kuaFuServerLoginData); if (!TianTiClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId)); return(false); } } break; } if (socket.IsKuaFuLogin && serverId != 0) { if (serverId != 0) { if (!InitGameDbConnection(serverId, dbIp, dbPort, logDbIp, logDbPort)) { LogManager.WriteLog(LogTypes.Error, string.Format("连接角色{0}的原服务器的GameDBServer和LogDBServer失败", kuaFuServerLoginData.RoleId)); return(false); } } return(socket.IsKuaFuLogin); } } else { LogManager.WriteLog(LogTypes.Error, string.Format("角色{0}未能在服务器列表中找本服务器,作为跨服服务器", kuaFuServerLoginData.RoleId)); return(false); } } else { //非跨服登录 if (HuanYingSiYuanClient.getInstance().LocalLogin(userID)) { kuaFuServerLoginData.RoleId = 0; kuaFuServerLoginData.GameId = 0; kuaFuServerLoginData.GameType = 0; kuaFuServerLoginData.ServerId = 0; socket.ServerId = 0; socket.IsKuaFuLogin = false; return(true); } } LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的跨服活动或副本信息", kuaFuServerLoginData.RoleId)); return(false); }
/// <summary> /// 离婚 /// </summary> public static MarryResult MarryDivorce(GameClient client, MarryDivorceType divorceType) { if (!MarryLogic.IsVersionSystemOpenOfMarriage()) { return(MarryResult.NotOpen); } if (0 >= client.ClientData.MyMarriageData.byMarrytype) { return(MarryResult.NotMarried); } if (!CoupleArenaManager.Instance().IsNowCanDivorce(TimeUtil.NowDateTime())) { return(MarryResult.DeniedByCoupleAreanTime); } int spouseID = client.ClientData.MyMarriageData.nSpouseID; GameClient spouseClient = GameManager.ClientMgr.FindClient(spouseID); if (divorceType == MarryDivorceType.DivorceForce || divorceType == MarryDivorceType.DivorceFree || divorceType == MarryDivorceType.DivorceFreeAccept) { if (client.ClientData.ExchangeID > 0 || true == client.ClientSocket.IsKuaFuLogin || client.ClientData.CopyMapID > 0) { return(MarryResult.SelfBusy); } if (-1 != client.ClientData.FuBenID && MapTypes.MarriageCopy == Global.GetMapType(client.ClientData.MapCode)) { return(MarryResult.SelfBusy); } if (null != spouseClient) { if (-1 != spouseClient.ClientData.FuBenID && MapTypes.MarriageCopy == Global.GetMapType(spouseClient.ClientData.MapCode)) { return(MarryResult.TargetBusy); } } if (divorceType == MarryDivorceType.DivorceForce || divorceType == MarryDivorceType.DivorceFree) { if (true == ApplyExist(client.ClientData.RoleID)) { return(MarryResult.SelfBusy); } } } int _man = client.ClientData.RoleID, _wife = spouseID; if (client.ClientData.MyMarriageData.byMarrytype == 2) { DataHelper2.Swap(ref _man, ref _wife);; } if (divorceType == MarryDivorceType.DivorceForce) { if (client.ClientData.UserMoney < DivorceForceCost) { return(MarryResult.MoneyNotEnough); } // 情侣竞技和情侣祝福都需要离婚清除数据,所以,可能会导致部分清除失败,由于竞技更要求数据的准确性,所以先清除情侣祝福,再清楚情侣竞技 // 情侣祝福排行版通知清除排行数据 // 必须保证先清除成功,才能强制离婚离婚 if (!CoupleWishManager.Instance().PreClearDivorceData(_man, _wife)) { return(MarryResult.NotOpen); } // 情侣竞技通知中心竞技、排行数据,dbserver清除战报数据 // 必须保证先清除成功,才能强制离婚离婚 if (!CoupleArenaManager.Instance().PreClearDivorceData(_man, _wife)) { return(MarryResult.NotOpen); } //强制离婚 if (false == GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, DivorceForceCost, "强制离婚", false)) { // return MarryResult.MoneyNotEnough; } client.ClientData.MyMarriageData.byMarrytype = -1; client.ClientData.MyMarriageData.nSpouseID = -1; MarryFuBenMgr.UpdateMarriageData2DB(client); MarriageOtherLogic.getInstance().ResetRingAttr(client); if (null != spouseClient) { spouseClient.ClientData.MyMarriageData.nSpouseID = -1; spouseClient.ClientData.MyMarriageData.byMarrytype = -1; MarryFuBenMgr.UpdateMarriageData2DB(spouseClient); MarriageOtherLogic.getInstance().ResetRingAttr(spouseClient); //[bing] 给配偶发送CMD_SPR_MARRY_UPDATE MarriageOtherLogic.getInstance().SendMarriageDataToClient(spouseClient); //[bing] 刷新客户端活动叹号 if (spouseClient._IconStateMgr.CheckJieRiFanLi(spouseClient, ActivityTypes.JieriMarriage) == true) { spouseClient._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, spouseClient._IconStateMgr.IsAnyJieRiTipActived()); spouseClient._IconStateMgr.SendIconStateToClient(spouseClient); } } else { string tcpstring = string.Format("{0}", spouseID); MarriageData spouseMarriageData = Global.sendToDB <MarriageData, string>((int)TCPGameServerCmds.CMD_DB_GET_MARRY_DATA, tcpstring, client.ServerId); if (null != spouseMarriageData && 0 < spouseMarriageData.byMarrytype) { spouseMarriageData.byMarrytype = -1; spouseMarriageData.nSpouseID = -1; MarryFuBenMgr.UpdateMarriageData2DB(spouseID, spouseMarriageData, client); } } // 取消婚宴 MarryPartyLogic.getInstance().MarryPartyRemove(client.ClientData.RoleID, true, client); MarryPartyLogic.getInstance().MarryPartyRemove(spouseID, true, client); //[bing] 给自己发送CMD_SPR_MARRY_UPDATE MarriageOtherLogic.getInstance().SendMarriageDataToClient(client); //[bing] 刷新客户端活动叹号 if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage) == true) { client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } // send mail string msg = string.Format(Global.GetLang("在您收到这封邮件的时候,您的伴侣{0}已经申请与您强制离婚,现在您已经恢复单身。您的定情信物将被封存,所有属性暂时失效,直至下次结婚时生效。最后,预祝您再次觅得真心人,相伴共度美好的游戏时光。感谢您阅读这封邮件。"), client.ClientData.RoleName); SendDivorceMail(spouseID, Global.GetLang("离婚"), msg, spouseClient, client.ServerId); CoupleArenaManager.Instance().OnDivorce(client.ClientData.RoleID, spouseID); } else if (divorceType == MarryDivorceType.DivorceFree) { //申请离婚 if (null == spouseClient) { return(MarryResult.TargetOffline); } if (spouseClient.ClientData.ExchangeID > 0 || true == spouseClient.ClientSocket.IsKuaFuLogin || spouseClient.ClientData.CopyMapID > 0) { return(MarryResult.TargetBusy); } if (Global.GetTotalBindTongQianAndTongQianVal(client) < DivorceCost) { return(MarryResult.MoneyNotEnough); } if (Global.SubBindTongQianAndTongQian(client, DivorceCost, "申请离婚") == false) { return(MarryResult.MoneyNotEnough); } AddMarryApply(client.ClientData.RoleID, MarryApplyType.ApplyDivorce, spouseID); //发送离婚申请 string notifyData = string.Format("{0}:{1}", client.ClientData.RoleID, (int)MarryDivorceType.DivorceFree); spouseClient.sendCmd((int)TCPGameServerCmds.CMD_SPR_MARRY_DIVORCE, notifyData); CoupleArenaManager.Instance().OnSpouseRequestDivorce(spouseClient, client); } else { if (null == spouseClient) { return(MarryResult.TargetOffline); } if (RemoveMarryApply(spouseID, MarryApplyType.ApplyDivorce) == false) { return(MarryResult.ApplyTimeout); } RemoveMarryApply(spouseID); if (divorceType == MarryDivorceType.DivorceFreeAccept) { // 情侣竞技通知中心竞技、排行数据,dbserver清除战报数据 // 必须保证先清除成功,才能自由离婚 if (CoupleWishManager.Instance().PreClearDivorceData(_man, _wife) && CoupleArenaManager.Instance().PreClearDivorceData(_man, _wife)) { client.ClientData.MyMarriageData.byMarrytype = -1; client.ClientData.MyMarriageData.nSpouseID = -1; spouseClient.ClientData.MyMarriageData.byMarrytype = -1; spouseClient.ClientData.MyMarriageData.nSpouseID = -1; MarryFuBenMgr.UpdateMarriageData2DB(client); MarryFuBenMgr.UpdateMarriageData2DB(spouseClient); MarriageOtherLogic.getInstance().SendMarriageDataToClient(client); MarriageOtherLogic.getInstance().SendMarriageDataToClient(spouseClient); //更新婚戒属性 MarriageOtherLogic.getInstance().ResetRingAttr(client); MarriageOtherLogic.getInstance().ResetRingAttr(spouseClient); //取消婚宴 MarryPartyLogic.getInstance().MarryPartyRemove(client.ClientData.RoleID, true, client); MarryPartyLogic.getInstance().MarryPartyRemove(spouseID, true, client); //[bing] 刷新客户端活动叹号 if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage) == true) { client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } //[bing] 刷新客户端活动叹号 if (spouseClient._IconStateMgr.CheckJieRiFanLi(spouseClient, ActivityTypes.JieriMarriage) == true) { spouseClient._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, spouseClient._IconStateMgr.IsAnyJieRiTipActived()); spouseClient._IconStateMgr.SendIconStateToClient(spouseClient); } CoupleArenaManager.Instance().OnDivorce(client.ClientData.RoleID, spouseID); } else { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, DivorceCost, "自由离婚拒绝返还绑金", false); //GameManager.ClientMgr.AddUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, DivorceCost, "自由离婚拒绝返还绑金"); Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.HintMsg, "自由离婚操作失败", true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint); Global.BroadcastRoleActionMsg(spouseClient, RoleActionsMsgTypes.HintMsg, "自由离婚操作失败", true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint); } } else if (divorceType == MarryDivorceType.DivorceFreeReject) { GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, DivorceCost, "自由离婚拒绝返还绑金", false); //GameManager.ClientMgr.AddUserYinLiang(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, DivorceCost, "自由离婚拒绝返还绑金"); //发送离婚拒绝讯息 string notifyData = string.Format("{0}:{1}", client.ClientData.RoleID, (int)MarryDivorceType.DivorceFreeReject); spouseClient.sendCmd((int)TCPGameServerCmds.CMD_SPR_MARRY_DIVORCE, notifyData); } } return(MarryResult.Success); }
/// <summary> /// 对方回复求婚 /// </summary> public static MarryResult MarryReply(GameClient client, int sourceID, int accept) { if (!MarryLogic.IsVersionSystemOpenOfMarriage()) { return(MarryResult.NotOpen); } if (client.ClientData.MyMarriageData.byMarrytype > 0) { return(MarryResult.SelfMarried); } GameClient sourceClient = GameManager.ClientMgr.FindClient(sourceID); if (sourceClient == null) { return(MarryResult.ApplyTimeout); } if (sourceClient.ClientData.MyMarriageData.byMarrytype > 0) { return(MarryResult.TargetMarried); } if (RemoveMarryApply(sourceID, MarryApplyType.ApplyInit) == false) { return(MarryResult.ApplyTimeout); } if (accept == 0 || client.ClientData.MyMarriageData.byAutoReject == 1) { // 拒绝返钱 string notifyData = string.Format("{0}:{1}:{2}", (int)MarryNotifyType.NotifyRejectInit, client.ClientData.RoleID, client.ClientData.RoleName); sourceClient.sendCmd((int)TCPGameServerCmds.CMD_SPR_MARRY_NOTIFY, notifyData); GameManager.ClientMgr.AddUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, MarryCost, "求婚被拒绝返还钻石"); } else { // 同意 RemoveMarryApply(sourceID); // 如果自己在申请狀态,需取消返钱 MarryLogic.ApplyLogoutClear(client); RemoveMarryApply(client.ClientData.RoleID); // 初始婚戒 int initRingID = 0; if (null != MarriageOtherLogic.getInstance().WeddingRingDic.SystemXmlItemDict) { initRingID = MarriageOtherLogic.getInstance().WeddingRingDic.SystemXmlItemDict.Keys.First(); } if (sourceClient.ClientData.MyMarriageData.nRingID <= 0) { sourceClient.ClientData.MyMarriageData.nRingID = initRingID; } if (client.ClientData.MyMarriageData.nRingID <= 0) { client.ClientData.MyMarriageData.nRingID = initRingID; } // 更新婚姻狀态 // marry type 1:丈夫 2:妻子 sbyte sourceType = (sourceClient.ClientData.RoleSex != 1 || client.ClientData.RoleSex == sourceClient.ClientData.RoleSex)? (sbyte)1 : (sbyte)2; sourceClient.ClientData.MyMarriageData.byMarrytype = sourceType; client.ClientData.MyMarriageData.byMarrytype = (sourceType == 1)? (sbyte)2 : (sbyte)1; // 更新伴侶role id sourceClient.ClientData.MyMarriageData.nSpouseID = client.ClientData.RoleID; client.ClientData.MyMarriageData.nSpouseID = sourceID; // 初始化0星1阶 [bing] 因为再结婚还会走这个函数就会被初始化为1阶 应该不初始化它 是个bug 这里FIX下 if (sourceClient.ClientData.MyMarriageData.byGoodwilllevel == 0) { //[bing] 更新时间 sourceClient.ClientData.MyMarriageData.ChangTime = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss"); sourceClient.ClientData.MyMarriageData.byGoodwilllevel = 1; } if (client.ClientData.MyMarriageData.byGoodwilllevel == 0) { client.ClientData.MyMarriageData.ChangTime = TimeUtil.NowDateTime().ToString("yyyy-MM-dd HH:mm:ss"); client.ClientData.MyMarriageData.byGoodwilllevel = 1; } MarryFuBenMgr.UpdateMarriageData2DB(sourceClient); MarryFuBenMgr.UpdateMarriageData2DB(client); MarriageOtherLogic.getInstance().SendMarriageDataToClient(sourceClient); MarriageOtherLogic.getInstance().SendMarriageDataToClient(client); //更新婚戒属性 MarriageOtherLogic.getInstance().UpdateRingAttr(sourceClient, true); //[bing] 刷新客户端活动叹号 if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage) == true) { client._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, client._IconStateMgr.IsAnyJieRiTipActived()); client._IconStateMgr.SendIconStateToClient(client); } //[bing] 刷新客户端活动叹号 if (sourceClient._IconStateMgr.CheckJieRiFanLi(sourceClient, ActivityTypes.JieriMarriage) == true) { sourceClient._IconStateMgr.AddFlushIconState((ushort)ActivityTipTypes.JieRiActivity, sourceClient._IconStateMgr.IsAnyJieRiTipActived()); sourceClient._IconStateMgr.SendIconStateToClient(sourceClient); } // 好友逻辑 FriendData friendData = Global.FindFriendData(client, sourceID); if (friendData != null && friendData.FriendType != 0) { GameManager.ClientMgr.RemoveFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, friendData.DbID); friendData = null; } if (friendData == null) { GameManager.ClientMgr.AddFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, -1, sourceID, Global.FormatRoleName(sourceClient, sourceClient.ClientData.RoleName), 0); } friendData = Global.FindFriendData(sourceClient, client.ClientData.RoleID); if (friendData != null && friendData.FriendType != 0) { GameManager.ClientMgr.RemoveFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, friendData.DbID); friendData = null; } if (friendData == null) { GameManager.ClientMgr.AddFriend(Global._TCPManager, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, sourceClient, -1, client.ClientData.RoleID, Global.FormatRoleName(client, client.ClientData.RoleName), 0); } //扩播消息 string broadCastMsg = string.Format(Global.GetLang("恭喜 {0} 和 {1} 喜结连理!"), sourceClient.ClientData.RoleName, client.ClientData.RoleName); Global.BroadcastRoleActionMsg(client, RoleActionsMsgTypes.Bulletin, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.OnlySysHint); CoupleArenaManager.Instance().OnMarry(sourceClient, client); } return(MarryResult.Success); }