/// <summary> /// 一场活动结束结果 /// </summary> /// <param name="cityId">城池ID</param> /// <param name="bhid">占领方帮会ID</param> /// <returns></returns> public int GameFuBenComplete(LangHunLingYuStatisticalData data) { int result = StdErrorCode.Error_Server_Busy; try { IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { result = kuaFuService.GameFuBenComplete(data); } catch (System.Exception ex) { result = StdErrorCode.Error_Server_Busy; ResetKuaFuService(); } } } catch (System.Exception ex) { result = StdErrorCode.Error_Server_Busy; LogManager.WriteExceptionUseCache(ex.ToString()); } return(result); }
public int GameFuBenComplete(LangHunLingYuStatisticalData data) { int result = -11000; try { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { result = kuaFuService.GameFuBenComplete(data); } catch (Exception ex) { result = -11000; this.ResetKuaFuService(); } } } catch (Exception ex) { result = -11000; LogManager.WriteExceptionUseCache(ex.ToString()); } return(result); }
public int EnterKuaFuMap(int roleId, int mapCode, int kuaFuLine, int roleSourceServerId, KuaFuServerLoginData kuaFuServerLoginData) { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { int kuaFuServerId = kuaFuService.EnterKuaFuMap(this.ClientInfo.ServerId, roleId, mapCode, kuaFuLine); if (kuaFuServerId > 0) { kuaFuServerLoginData.RoleId = roleId; kuaFuServerLoginData.ServerId = roleSourceServerId; kuaFuServerLoginData.GameType = 7; kuaFuServerLoginData.GameId = (long)mapCode; KuaFuServerInfo kuaFuServerInfo; if (KuaFuManager.getInstance().TryGetValue(kuaFuServerId, out kuaFuServerInfo)) { kuaFuServerLoginData.ServerIp = kuaFuServerInfo.Ip; kuaFuServerLoginData.ServerPort = kuaFuServerInfo.Port; return(kuaFuServerId); } } } catch (Exception ex) { this.ResetKuaFuService(); } } return(-11003); }
public int GameFuBenChangeState(int gameId, GameFuBenState state, DateTime time) { int result = -11000; IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { lock (this.Mutex) { YongZheZhanChangFuBenData yongZheZhanChangFuBenData; if (this.FuBenDataDict.TryGetValue(gameId, out yongZheZhanChangFuBenData)) { yongZheZhanChangFuBenData.State = state; } } result = kuaFuService.GameFuBenChangeState(gameId, state, time); } catch (Exception ex) { this.ResetKuaFuService(); result = -11003; } } return(result); }
public int LangHunLingYuSignUp(string bhName, int bhid, int zoneId, int gameType, int groupIndex, int zhanDouLi) { int result = -11000; try { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { result = kuaFuService.LangHunLingYuSignUp(bhName, bhid, zoneId, gameType, groupIndex, zhanDouLi); } catch (Exception ex) { result = -11000; this.ResetKuaFuService(); } } } catch (Exception ex) { result = -11000; LogManager.WriteExceptionUseCache(ex.ToString()); } return(result); }
/// <summary> /// 游戏副本状态变更 /// </summary> /// <param name="gameId"></param> /// <param name="state"></param> /// <param name="time"></param> /// <returns></returns> public int GameFuBenChangeState(int gameId, GameFuBenState state, DateTime time) { int result = StdErrorCode.Error_Server_Busy; IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { YongZheZhanChangFuBenData yongZheZhanChangFuBenData; lock (Mutex) { if (FuBenDataDict.TryGetValue(gameId, out yongZheZhanChangFuBenData)) { yongZheZhanChangFuBenData.State = state; } } result = kuaFuService.GameFuBenChangeState(gameId, state, time); } catch (System.Exception ex) { ResetKuaFuService(); result = StdErrorCode.Error_Server_Internal_Error; } } return(result); }
/// <summary> /// 匹配报名 /// </summary> /// <param name="bhName"></param> /// <param name="bhid"></param> /// <param name="zoneId"></param> /// <param name="gameType"></param> /// <param name="groupIndex"></param> /// <returns></returns> public int LangHunLingYuSignUp(string bhName, int bhid, int zoneId, int gameType, int groupIndex, int zhanDouLi) { int result = StdErrorCode.Error_Server_Busy; try { IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { result = kuaFuService.LangHunLingYuSignUp(bhName, bhid, zoneId, gameType, groupIndex, zhanDouLi); } catch (System.Exception ex) { result = StdErrorCode.Error_Server_Busy; ResetKuaFuService(); } } } catch (System.Exception ex) { result = StdErrorCode.Error_Server_Busy; LogManager.WriteExceptionUseCache(ex.ToString()); } return(result); }
/// <summary> /// 改变角色的在某个游戏副本中的状态 /// </summary> /// <param name="roleId"></param> /// <param name="state"></param> /// <param name="serverId">如果不知道,传0</param> /// <param name="gameId"></param> /// <returns></returns> public int GameFuBenRoleChangeState(int roleId, int state, int serverId = 0, int gameId = 0) { try { IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { if (serverId <= 0 || gameId <= 0) { KuaFuRoleData kuaFuRoleData; if (!RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { return((int)KuaFuRoleStates.None); } serverId = kuaFuRoleData.ServerId; gameId = kuaFuRoleData.GameId; } return(KuaFuService.GameFuBenRoleChangeState(serverId, roleId, gameId, state)); } } catch (System.Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } return(0); }
public YongZheZhanChangFuBenData GetKuaFuFuBenData(int gameId) { YongZheZhanChangFuBenData yongZheZhanChangFuBenData = null; lock (this.Mutex) { if (this.FuBenDataDict.TryGetValue(gameId, out yongZheZhanChangFuBenData)) { return(yongZheZhanChangFuBenData); } } if (yongZheZhanChangFuBenData == null) { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { yongZheZhanChangFuBenData = kuaFuService.GetFuBenData(gameId); if (null != yongZheZhanChangFuBenData) { lock (this.Mutex) { this.FuBenDataDict[gameId] = yongZheZhanChangFuBenData; } } } catch (Exception ex) { yongZheZhanChangFuBenData = null; } } } return(yongZheZhanChangFuBenData); }
public void TimerProc(object sender, EventArgs e) { try { DateTime now = TimeUtil.NowDateTime(); if (this.NextClearFuBenTime < now) { this.NextClearFuBenTime = now.AddHours(1.0); this.ClearOverTimeFuBen(now); } string YongZheZhanChangUri = this.CoreInterface.GetRuntimeVariable("YongZheZhanChangUri", null); if (this.RemoteServiceUri != YongZheZhanChangUri) { this.RemoteServiceUri = YongZheZhanChangUri; } IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { if (this.ClientInfo.ClientId > 0) { AsyncDataItem[] items = kuaFuService.GetClientCacheItems(this.ClientInfo.ServerId); if (items != null && items.Length > 0) { this.ExecuteEventCallBackAsync(items); } } } } catch (Exception ex) { this.ResetKuaFuService(); } }
public void TimerProc(object sender, EventArgs e) { try { DateTime now = TimeUtil.NowDateTime(); if (NextClearFuBenTime < now) { NextClearFuBenTime = now.AddHours(1); ClearOverTimeFuBen(now); } string YongZheZhanChangUri = CoreInterface.GetRuntimeVariable(RuntimeVariableNames.YongZheZhanChangUri, null); if (RemoteServiceUri != YongZheZhanChangUri) { RemoteServiceUri = YongZheZhanChangUri; } IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { if (ClientInfo.ClientId > 0) { List <KuaFuServerInfo> dict = kuaFuService.GetKuaFuServerInfoData(ServerInfoAsyncAge); if (null != dict && dict.Count > 0) { lock (Mutex) { ServerIdServerInfoDict.Clear(); bool first = true; foreach (var item in dict) { ServerIdServerInfoDict[item.ServerId] = item; if (first) { first = false; ServerInfoAsyncAge = item.Age; } if (ClientInfo.ServerId == item.ServerId) { LocalServerFlags = item.Flags; } } } } //同步数据 AsyncDataItem[] items = kuaFuService.GetClientCacheItems(ClientInfo.ServerId); if (null != items && items.Length > 0) { //ThreadPool.QueueUserWorkItem(new WaitCallback(ExecuteEventCallBackAsync), items); ExecuteEventCallBackAsync(items); } } } } catch (System.Exception ex) { ResetKuaFuService(); } }
private void ResetKuaFuService() { RemoteServiceUri = CoreInterface.GetRuntimeVariable("YongZheZhanChangUri", null); lock (Mutex) { KuaFuService = null; } }
public int YongZheZhanChangSignUp(string userId, int roleId, int zoneId, int gameType, int groupIndex, int zhanDouLi) { int result2; if (string.IsNullOrEmpty(userId) || roleId <= 0) { result2 = -20; } else { userId = userId.ToUpper(); int count = Interlocked.Increment(ref this.CurrentRequestCount); try { if (count < this.MaxRequestCount) { lock (this.Mutex) { KuaFuRoleData kuaFuRoleData; if (this.RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { if (kuaFuRoleData.ServerId != this.ClientInfo.ServerId) { return(-11); } } } IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null == kuaFuService) { return(-11001); } try { IGameData YongZheZhanChangGameData = new IGameData { ZhanDouLi = zhanDouLi }; int result = kuaFuService.RoleSignUp(this.ClientInfo.ServerId, userId, zoneId, roleId, gameType, groupIndex, YongZheZhanChangGameData); } catch (Exception ex) { this.ResetKuaFuService(); } } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } finally { Interlocked.Decrement(ref this.CurrentRequestCount); } result2 = 1; } return(result2); }
public bool LangHunLingYuKuaFuLoginData(int roleId, int cityId, int gameId, KuaFuServerLoginData kuaFuServerLoginData) { try { IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { LangHunLingYuFuBenData fuBenData; lock (Mutex) { if (!LangHunLingYuFuBenDataDict.TryGetValue(gameId, out fuBenData)) { fuBenData = null; } } if (null == fuBenData) { fuBenData = kuaFuService.GetLangHunLingYuGameFuBenDataByCityId(cityId); } if (null != fuBenData) { kuaFuServerLoginData.RoleId = roleId; kuaFuServerLoginData.GameId = fuBenData.GameId; kuaFuServerLoginData.GameType = (int)GameTypes.LangHunLingYu; kuaFuServerLoginData.EndTicks = fuBenData.EndTime.Ticks; kuaFuServerLoginData.ServerId = ClientInfo.ServerId; lock (Mutex) { KuaFuServerInfo kuaFuServerInfo; if (ServerIdServerInfoDict.TryGetValue(fuBenData.ServerId, out kuaFuServerInfo)) { kuaFuServerLoginData.ServerIp = kuaFuServerInfo.Ip; kuaFuServerLoginData.ServerPort = kuaFuServerInfo.Port; return(true); } } } } catch (System.Exception ex) { ResetKuaFuService(); } } } catch (System.Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } return(false); }
public void PushGameResultData(object data) { IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { kuaFuService.UpdateStatisticalData(data); } catch (System.Exception ex) { ResetKuaFuService(); } } }
public int ExecuteCommand(string cmd) { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { return(kuaFuService.ExecuteCommand(cmd)); } catch (Exception ex) { this.ResetKuaFuService(); } } return(-11003); }
public int ChangeRoleState(int roleId, KuaFuRoleStates state, bool noWait = false) { int result = StdErrorCode.Error_Operation_Faild; IYongZheZhanChangService kuaFuService = null; KuaFuRoleData kuaFuRoleData = null; int serverId = ClientInfo.ServerId; lock (Mutex) { if (RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { serverId = kuaFuRoleData.ServerId; } } kuaFuService = GetKuaFuService(noWait); if (null != kuaFuService) { try { result = kuaFuService.RoleChangeState(serverId, roleId, (int)state); if (result >= 0) { lock (Mutex) { if (RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { kuaFuRoleData.State = (KuaFuRoleStates)result; } } if (null != kuaFuRoleData) { UpdateRoleData(kuaFuRoleData); } } } catch (System.Exception ex) { result = StdErrorCode.Error_Server_Internal_Error; } } return(result); }
public KuaFuMapRoleData GetKuaFuMapRoleData(int roleId) { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { return(kuaFuService.GetKuaFuMapRoleData(roleId)); } catch (Exception ex) { this.ResetKuaFuService(); } } return(null); }
public object GetKuaFuLineDataList(int mapCode) { IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { return(kuaFuService.GetKuaFuLineDataList(mapCode)); } catch (System.Exception ex) { ResetKuaFuService(); } } return(null); }
public int ExecuteCommand(string cmd) { IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { return(kuaFuService.ExecuteCommand(cmd)); } catch (System.Exception ex) { ResetKuaFuService(); } } return(StdErrorCode.Error_Server_Internal_Error); }
public int RoleChangeState(int serverId, int rid, int state) { int result = -11; IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { result = kuaFuService.RoleChangeState(serverId, rid, state); } catch (Exception ex) { this.ResetKuaFuService(); } } return(result); }
public KuaFuRoleData GetKuaFuRoleDataFromServer(int serverId, int roleId) { KuaFuRoleData kuaFuRoleData = null; IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { kuaFuRoleData = kuaFuService.GetKuaFuRoleData(serverId, roleId); this.UpdateRoleData(kuaFuRoleData, 0); } catch (Exception ex) { kuaFuRoleData = null; } } return(kuaFuRoleData); }
public void PushGameResultData(object data) { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { kuaFuService.UpdateStatisticalData(new AsyncDataItem(KuaFuEventTypes.UpdateStatisticalData, new object[] { data })); } catch (Exception ex) { this.ResetKuaFuService(); } } }
public int ChangeRoleState(int roleId, KuaFuRoleStates state, bool noWait = false) { int result = -11; KuaFuRoleData kuaFuRoleData = null; int serverId = this.ClientInfo.ServerId; lock (this.Mutex) { if (this.RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { serverId = kuaFuRoleData.ServerId; } } IYongZheZhanChangService kuaFuService = this.GetKuaFuService(noWait); if (null != kuaFuService) { try { result = kuaFuService.RoleChangeState(serverId, roleId, (int)state); if (result >= 0) { lock (this.Mutex) { if (this.RoleId2RoleDataDict.TryGetValue(roleId, out kuaFuRoleData)) { kuaFuRoleData.State = (KuaFuRoleStates)result; } } if (null != kuaFuRoleData) { this.UpdateRoleData(kuaFuRoleData, 0); } } } catch (Exception ex) { result = -11003; } } return(result); }
/// <summary> /// 从服务器获取角色数据 /// </summary> /// <param name="serverId"></param> /// <param name="roleId"></param> /// <returns></returns> public KuaFuRoleData GetKuaFuRoleDataFromServer(int serverId, int roleId) { KuaFuRoleData kuaFuRoleData = null; IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { kuaFuRoleData = (KuaFuRoleData)kuaFuService.GetKuaFuRoleData(serverId, roleId); UpdateRoleData(kuaFuRoleData); //更新 } catch (System.Exception ex) { kuaFuRoleData = null; } } return(kuaFuRoleData); }
public void UpdateKuaFuMapClientCount(Dictionary <int, int> dict) { lock (this.Mutex) { this.ClientInfo.MapClientCountDict = dict; } IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { kuaFuService.UpdateKuaFuMapClientCount(this.ClientInfo.ServerId, dict); } catch (Exception ex) { this.ResetKuaFuService(); } } }
/// <summary> /// 角色状态修改 /// </summary> /// <param name="rid"></param> /// <param name="gameType"></param> /// <param name="groupIndex"></param> /// <param name="state"></param> /// <returns></returns> public int RoleChangeState(int serverId, int rid, int state) { int result = StdErrorCode.Error_Operation_Faild; IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { result = kuaFuService.RoleChangeState(serverId, rid, state); } catch (System.Exception ex) { ResetKuaFuService(); } } return(result); }
public object GetKuaFuLineDataList(int mapCode) { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { try { AsyncDataItem item = kuaFuService.GetKuaFuLineDataList(mapCode); if (item != null && item.Args != null && item.Args.Length > 0) { return(item.Args[0]); } } catch (Exception ex) { this.ResetKuaFuService(); } } return(null); }
public int GetKuaFuRoleState(int roleId) { int state = 0; try { IYongZheZhanChangService kuaFuService = this.GetKuaFuService(false); if (null != kuaFuService) { object result = kuaFuService.GetRoleExtendData(this.ClientInfo.ServerId, roleId, 2); if (null != result) { state = (int)result; } } } catch (Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } return(state); }
/// <summary> /// 膜拜 /// </summary> public bool LangHunLingYunAdmire(int rid) { try { IYongZheZhanChangService kuaFuService = GetKuaFuService(); if (null != kuaFuService) { try { return(kuaFuService.LangHunLingYuAdmaire(rid)); } catch (System.Exception ex) { ResetKuaFuService(); } } } catch (System.Exception ex) { LogManager.WriteExceptionUseCache(ex.ToString()); } return(false); }