public void SendMessage <T>(T message) where T : IMessage { if (this.FrontendConn != null && !this.FrontendConn.IsClosed) { this.FrontendConn.RequestOperation(SendPacket.Create <T>(message)); } }
private void connection_LoginRecoveryRequested(LoginResponse response) { if (response != null) { CafeAuth cafeAuth = null; if (this.NxIDToEntityDic.TryGetValue(response.NexonID, out cafeAuth)) { if (response.Result == AuthorizeResult.Allowed) { cafeAuth.FrontendConn.RequestOperation(new NotifyCafeAuthResult()); } if (response.Result == AuthorizeResult.Forbidden || response.Result == AuthorizeResult.Terminate) { SendPacket op; if (response.Option == Option.AccountShutdowned || (response.ExtendInfos != null && response.ExtendInfos.IsShutDownEnabled)) { op = SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_Shutdown")); } else if (response.ExtendInfos != null && response.ExtendInfos.IsShutDownEnabled) { op = SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_IPBlocked")); } else { op = SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_Expired")); } cafeAuth.FrontendConn.RequestOperation(op); Scheduler.Schedule(base.Thread, Job.Create <CafeAuth>(new Action <CafeAuth>(this.Kick_User), cafeAuth), 5000); } cafeAuth.SessionNo = response.SessionNo; this.WaitQueue.Remove(cafeAuth); cafeAuth.SetValid(); } } }
internal void MakeTcProtectRequest() { if (this.Handle.IsClosed) { this.Entity.Close(); return; } if (this.FrontendConn == null) { this.Entity.Close(); return; } if (FeatureMatrix.IsEnable("TcProtect")) { TcProtectRequestMessage serializeObject = new TcProtectRequestMessage(this.Service.TcProtectMd5, this.Service.TcProtectEncoded); this.FrontendConn.RequestOperation(SendPacket.Create <TcProtectRequestMessage>(serializeObject)); if (!FeatureMatrix.IsEnable("RepeatTcProtectCheckOff")) { Log <HackShieldService> .Logger.Warn("Current FeatureMatrix Info [RepeatTcprotectCheckOff Off]"); Scheduler.Schedule(this.Service.Thread, Job.Create(new Action(this.MakeTcProtectRequest)), this.Service.NextMilliseconds()); return; } Log <HackShieldService> .Logger.Warn("Current FeatureMatrix Info [RepeatTcprotectCheckOff On]"); } }
private void TryLogin(CafeAuth entity) { AsyncResultSync sync = new AsyncResultSync(base.Thread); sync.OnFinished += delegate(ISynchronizable __) { if (sync != null && this.WaitQueue.Contains(entity)) { LoginResponse loginResponse = this.connection.EndLogin(sync.AsyncResult); if (loginResponse != null) { if (loginResponse.Result == AuthorizeResult.Allowed) { entity.FrontendConn.RequestOperation(new NotifyCafeAuthResult()); } if (loginResponse.Result == AuthorizeResult.Forbidden || loginResponse.Result == AuthorizeResult.Terminate) { SendPacket op = SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_Expired")); entity.FrontendConn.RequestOperation(op); Scheduler.Schedule(this.Thread, Job.Create <CafeAuth>(new Action <CafeAuth>(this.Kick_User), entity), 5000); } entity.SessionNo = loginResponse.SessionNo; this.WaitQueue.Remove(entity); entity.SetValid(); } } }; this.connection.BeginLogin(entity.NexonID, entity.CharacterID, entity.LocalAddress, entity.RemoteAddress, entity.CanTry, entity.IsTrial, entity.MID, (entity.GameRoomClient == 0) ? null : new int[] { entity.GameRoomClient }, new AsyncCallback(sync.AsyncCallback), entity); }
private void EquipmentObserver_SetDirty(IObserver observer, Action <IObserver> callback) { QueryConsumablesInTown consumableQuery = new QueryConsumablesInTown { CID = this.CID }; consumableQuery.OnComplete += delegate(Operation op) { observer.Cache = consumableQuery; if (consumableQuery.Consumables != null) { BattleInventory battleInventory = new BattleInventory(); foreach (KeyValuePair <int, ConsumablesInfo> keyValuePair in consumableQuery.Consumables) { battleInventory.SetConsumable(keyValuePair.Key, keyValuePair.Value); } this.FrontendConn.RequestOperation(SendPacket.Create <UpdateBattleInventoryInTownMessage>(new UpdateBattleInventoryInTownMessage { BattleInventory = battleInventory })); } observer.EndSync(true); callback(observer); }; consumableQuery.OnFail += delegate(Operation op) { observer.EndSync(false); callback(observer); }; observer.Connection.RequestOperation(consumableQuery); }
public bool WhisperToGameClient(string from, long cid, string message) { IEntity entityByID = base.GetEntityByID(cid); if (entityByID == null) { if (base.LookUp.GetLocationCount(base.Category) > 1) { int num = this.FindServiceID(cid, base.Category); if (num > 0 && base.ID != num) { base.RequestOperation(num, new WhisperToGameClient(from, cid, message)); return(true); } } return(false); } TalkClient talkClient = entityByID.Tag as TalkClient; if (talkClient != null && talkClient.FrontendConn != null) { talkClient.FrontendConn.RequestOperation(SendPacket.Create <WhisperMessage>(new WhisperMessage { Sender = from, Contents = message })); return(true); } return(false); }
internal void MakeRequest() { if (this.Handle.IsClosed) { this.Entity.Close(); return; } if (this.FrontendConn == null) { this.Entity.Close(); return; } ArraySegment <byte> request; AntiCpXSvr.Error error = AntiCpXSvr.MakeRequest(this.Handle, out request); AntiCpXSvr.Error error2 = error; if (error2 == AntiCpXSvr.Error.Success) { HackShieldRequestMessage serializeObject = new HackShieldRequestMessage(request); this.FrontendConn.RequestOperation(SendPacket.Create <HackShieldRequestMessage>(serializeObject)); Scheduler.Schedule(this.Service.Thread, Job.Create(new Action(this.MakeRequest)), this.Service.NextMilliseconds()); return; } this.Entity.Close(); }
public void ResetOnlineGuildDailyGPScheduleFunc() { HeroesDataContext heroesDataContext = new HeroesDataContext(); List <long> list = new List <long>(this.OnlineGuildIDList); GuildGainGPMessage guildGainGPMessage = new GuildGainGPMessage(0L); foreach (long id in list) { IEntity entityByID = base.GetEntityByID(id); if (entityByID != null && !entityByID.IsClosed) { GuildEntity guildEntity = entityByID.Tag as GuildEntity; if (entityByID != null) { heroesDataContext.ResetInGameGuildDailyGainGP(guildEntity.GuildSN); guildEntity.GuildInfo.DailyGainGP.Clear(); guildGainGPMessage.GuildPoint = guildEntity.GuildInfo.GuildPoint; foreach (OnlineGuildMember onlineGuildMember in guildEntity.OnlineMembers.Values) { onlineGuildMember.RequestFrontendOperation(SendPacket.Create <GuildGainGPMessage>(guildGainGPMessage)); } } } } DateTime d = GuildContents.GetPrevDailyGPResetTime() + TimeSpan.FromDays(1.0); this.DailyGPResetScheduleID = Scheduler.Schedule(JobProcessor.Current, Job.Create(new Action(this.ResetOnlineGuildDailyGPScheduleFunc)), d - DateTime.UtcNow + TimeSpan.FromSeconds(30.0)); }
public void SendGuildStorageLogsMessage(bool sendTodayLog) { if (this.GuildMember.Rank > GuildMemberRank.Member) { return; } this.RequestFrontendOperation(SendPacket.Create <GuildStorageLogsMessage>(this.Parent.Storage.LogMessage(sendTodayLog))); }
public void SendGuildStorageInfoMessage() { if (this.GuildMember.Rank > GuildMemberRank.Member) { return; } this.RequestFrontendOperation(SendPacket.Create <GuildInventoryInfoMessage>(this.Parent.Storage.InventoryMessage)); }
public void SendMessage <T>(T message) where T : IMessage { if (this.FrontendConn == null) { Log <DSPlayer> .Logger.InfoFormat("[to {0}] {1}", this.CID, message); return; } this.FrontendConn.RequestOperation(SendPacket.Create <T>(message)); }
internal void MakeRequest() { if (!FeatureMatrix.IsEnable("GRCService")) { if (!this.Entity.IsClosed) { this.Entity.Close(); } return; } if (this.Entity.IsClosed) { return; } if (this.FrontendConn == null) { this.Entity.Close(); return; } if (this.State == GRCClient.GRCClientState.RespondWaiting) { Log <GRCService> .Logger.InfoFormat("GRCClient received no reply", new object[0]); using (GRCServiceErrorLogDataContext grcserviceErrorLogDataContext = new GRCServiceErrorLogDataContext()) { try { grcserviceErrorLogDataContext.AddGRCServiceError(new long?(this.Entity.ID), new int?(1), "NoReply"); } catch (Exception ex) { Log <GRCService> .Logger.Error(string.Format("GRCService Error while making log : [CharacterID = {0}]", this.Entity.ID), ex); } } this.Entity.Close(); return; } this.Service.Content.MakeQuestionRandom(out this.LastQuestion, out this.LastAnswer); if (this.LastAnswer.Length > 0 || this.LastQuestion.Length > 0) { GameResourceRequestMessage serializeObject = new GameResourceRequestMessage(0, this.LastQuestion); this.FrontendConn.RequestOperation(SendPacket.Create <GameResourceRequestMessage>(serializeObject)); this.State = GRCClient.GRCClientState.RespondWaiting; } else { this.State = GRCClient.GRCClientState.RequestSkipped; } Scheduler.Schedule(this.Service.Thread, Job.Create(new Action(this.MakeRequest)), this.Service.NextMilliseconds()); }
private void connection_MessageReceived(LoginResponse Response) { SystemMessage serializeObject = (SystemMessage)null; bool flag = false; switch (Response.Option) { case Option.AddressExpired: case Option.PrepaidExpired: case Option.PrepaidExhausted: serializeObject = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_Expired"); flag = true; break; case Option.WelcomePrepaid: if (Response.Argument > 60) { serializeObject = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_TimeLeft", new object[1] { (object)(Response.Argument / 60) }); break; } serializeObject = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_TimeLeft_LessThanOneHour"); break; } if (serializeObject == null) { return; } Log <CafeAuthOldVersionService> .Logger.InfoFormat("Response from CafeAuth service: {0}", (object)Response); CafeAuth cafeAuth; if (!this.NxIDToEntityDic.TryGetValue(Response.NexonID, out cafeAuth)) { return; } SendPacket sendPacket = SendPacket.Create <SystemMessage>(serializeObject); cafeAuth.FrontendConn.RequestOperation((Operation)sendPacket); if (!flag) { return; } Scheduler.Schedule(this.Thread, Job.Create <CafeAuth>(new Action <CafeAuth>(this.Kick_User), cafeAuth), 5000); }
private void SendAsyncResult(TalkService.WhisperAnyncArguments args) { if (args != null) { IEntity entityByID = base.GetEntityByID(args.FromCid); if (entityByID != null && entityByID.Tag != null) { TalkClient talkClient = entityByID.Tag as TalkClient; if (talkClient.FrontendConn != null) { SendPacket op = SendPacket.Create <WhisperFailMessage>(new WhisperFailMessage(args.ToName, "GameUI_Heroes_Chat_Whisper_Not_Online")); talkClient.FrontendConn.RequestOperation(op); } } } }
public bool WhipserResultToGameClient(long cid, int resultNo, string receiverName) { Log <TalkService> .Logger.InfoFormat("WhipserResultToGameClient is called. [ cid:{0}, result:{1}, receiver:{2} ]", cid, resultNo, receiverName); IEntity entityByID = base.GetEntityByID(cid); if (entityByID == null) { if (base.LookUp.GetLocationCount(base.Category) > 1) { int num = this.FindServiceID(cid, base.Category); if (num > 0 && base.ID != num) { base.RequestOperation(num, new WhisperResultToGameClient(cid, resultNo, receiverName)); return(true); } } Log <TalkService> .Logger.WarnFormat("WhipserResultToGameClient the end of the function", new object[0]); return(false); } TalkClient talkClient = entityByID.Tag as TalkClient; if (talkClient != null && talkClient.FrontendConn != null) { if (resultNo == 11) { talkClient.FrontendConn.RequestOperation(SendPacket.Create <WhisperFailMessage>(new WhisperFailMessage(receiverName, "GameUI_Heroes_Chat_Whisper_Not_Online"))); } else { Log <TalkService> .Logger.ErrorFormat("WhipserResultToGameClient Unknown ResultNo : {0}", resultNo); } return(true); } Log <TalkService> .Logger.WarnFormat("WhipserResultToGameClient TalkClient is null.", new object[0]); return(false); }
public override IEnumerable <object> Run() { CashShopPeer cashShopPeer = base.Entity; int orderNo = base.Operation.OrderNo; Log <QueryCashShopGiftSenderProcessor> .Logger.InfoFormat("Array Size {0}", cashShopPeer.GiftSenderCIDDict.Count); long senderCID; if (cashShopPeer.GiftSenderCIDDict.TryGetValue(base.Operation.OrderNo, out senderCID)) { QueryNameByCID queryName = new QueryNameByCID(senderCID); queryName.OnComplete += delegate(Operation _) { SendPacket op = SendPacket.Create <CashShopGiftSenderMessage>(new CashShopGiftSenderMessage(orderNo, queryName.Name)); cashShopPeer.FrontendConnection.RequestOperation(op); }; queryName.OnFail += delegate(Operation _) { SendPacket op = SendPacket.Create <CashShopGiftSenderMessage>(new CashShopGiftSenderMessage(orderNo, "")); cashShopPeer.FrontendConnection.RequestOperation(op); }; this.service.RequestOperation("PlayerService.PlayerService", queryName); base.Finished = true; yield return(new OkMessage()); } else { base.Finished = true; Log <QueryCashShopGiftSenderProcessor> .Logger.ErrorFormat("No CID match for sender. OrderNo [{0}]", base.Operation.OrderNo); yield return(new FailMessage("[QueryCashShopGiftSenderProcessor] Operation.OrderNo") { Reason = FailMessage.ReasonCode.LogicalFail }); } yield break; }
public void SendOperationFailedDialog(string errorCode) { this.RequestFrontendOperation(SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Dialog, string.Format("GameUI_Heroes_{0}", errorCode)))); }
public override IEnumerable <object> Run() { ChannelMember channelMember = base.Entity.FindMember(base.Operation.CID); if (channelMember == null) { Log <StartSharingProcessor> .Logger.Error("member is null"); } else if (base.Operation.TargetsCID == null) { Log <StartSharingProcessor> .Logger.Error("TargetsCID is null"); } else if (base.Operation.SharingInfo == null) { Log <StartSharingProcessor> .Logger.Error("SharingInfo is null"); } else { if (base.Operation.SharingInfo.ItemClassName.Equals("dancing_pipe")) { channelMember.SharingInfo = base.Operation.SharingInfo; ServiceCore.CharacterServiceOperations.AddStatusEffect op = new ServiceCore.CharacterServiceOperations.AddStatusEffect { Type = channelMember.SharingInfo.StatusEffect, Level = channelMember.SharingInfo.EffectLevel, RemainTime = channelMember.SharingInfo.DurationSec }; channelMember.CharacterConn.RequestOperation(op); } using (List <long> .Enumerator enumerator = base.Operation.TargetsCID.GetEnumerator()) { while (enumerator.MoveNext()) { long cid = enumerator.Current; ChannelMember channelMember2 = base.Entity.FindMember(cid); if (channelMember2 != null) { channelMember2.SharingInfo = base.Operation.SharingInfo; if (base.Operation.SharingInfo.ItemClassName.Equals("dancing_pipe")) { ServiceCore.CharacterServiceOperations.AddStatusEffect op2 = new ServiceCore.CharacterServiceOperations.AddStatusEffect { Type = channelMember2.SharingInfo.StatusEffect, Level = channelMember2.SharingInfo.EffectLevel, RemainTime = channelMember2.SharingInfo.DurationSec }; channelMember2.CharacterConn.RequestOperation(op2); } else { channelMember2.FrontendConn.RequestOperation(SendPacket.Create <SharingCheckMessage>(new SharingCheckMessage { SharingCharacterName = channelMember.Look.CharacterID, ItemClassName = base.Operation.SharingInfo.ItemClassName, StatusEffect = base.Operation.SharingInfo.StatusEffect, EffectLevel = base.Operation.SharingInfo.EffectLevel, DurationSec = base.Operation.SharingInfo.DurationSec })); } } } yield break; } } yield break; }
public override IEnumerable <object> Run() { if (this.service.IsCashShopStopped) { base.Finished = true; base.Entity.SendErrorDialog("CashShop_EmergencyStop"); yield return(new FailMessage("[QueryCashShopItemPickUpProcessor] service.IsCashShopStopped") { Reason = FailMessage.ReasonCode.LogicalFail }); } else if (base.Entity.CID == -1L) { base.Finished = true; base.Entity.SendErrorDialog("CashShop_NotReady"); yield return(new FailMessage("[QueryCashShopItemPickUpProcessor] Entity.CID") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { AsyncResultSync sync = new AsyncResultSync(this.service.Thread); IAsyncResult ar = base.Entity.BeginInventoryPickup(base.Operation.OrderNo, base.Operation.ProductNo, base.Operation.Quantity, new AsyncCallback(sync.AsyncCallback), "DirectPurchase"); if (ar != null) { yield return(sync); } if (ar == null && !sync.Result) { base.Finished = true; yield return(new FailMessage("[QueryCashShopItemPickUpProcessor] !sync.Result") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { InventoryPickupOnceResponse asyncResult = base.Entity.EndInventoryPickUp(ar); if (asyncResult == null) { base.Finished = true; yield return(new FailMessage("[QueryCashShopItemPickUpProcessor] asyncResult") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { bool isGift = base.Entity.GiftSenderCIDDict.ContainsKey(base.Operation.OrderNo); GiveItem giveItemOp = asyncResult.ToGiveItem(this.service, isGift); if (giveItemOp != null && giveItemOp.ItemRequestInfo.Count > 0) { foreach (ItemRequestInfo.Element element in giveItemOp.ItemRequestInfo.Elements) { Log <QueryCashShopItemPickUpProcessor> .Logger.InfoFormat("{0} x {1}", element.ItemClassEx, element.Num); } OperationSync giveItemSync = new OperationSync { Connection = base.Entity.ItemConnection, Operation = giveItemOp }; yield return(giveItemSync); base.Entity.CashShopProcessLog(base.Operation.OrderNo, giveItemOp, giveItemSync.Result); if (!giveItemSync.Result || giveItemOp.ErrorCode != GiveItem.ResultEnum.Success) { Log <QueryCashShopItemPickUpProcessor> .Logger.ErrorFormat("GiveItemSync is failed. NexonID: {0}, CID: {1}", base.Entity.NexonID, base.Entity.CID); base.Entity.EndInventoryPickUp_OnFail(asyncResult); base.Finished = true; yield return(new FailMessage("[QueryCashShopItemPickUpProcessor] giveItemOp.ErrorCode") { Reason = FailMessage.ReasonCode.LogicalFail }); } OperationSync giveMileageSync = new OperationSync(); bool useMileageSystem = FeatureMatrix.IsEnable("CashShop_MileageSystem"); if (useMileageSystem) { double mileageRatio = (double)((float)FeatureMatrix.GetInteger("CashShop_MileageRatio") / 100f); int totalPrice = this.service.ProductByProductID.TryGetValue(base.Operation.ProductNo).SalePrice *(int)asyncResult.ProductPieces; int mileagePoint = Convert.ToInt32(Math.Floor((double)totalPrice * mileageRatio)); mileagePoint = ((mileagePoint == 0) ? 1 : mileagePoint); CashshopMileage mileageOp = null; if (isGift) { long cid = base.Entity.GiftSenderCIDDict.TryGetValue(base.Operation.OrderNo); mileageOp = new CashshopMileage(cid, mileagePoint, CashshopMileage.ProcessEnum.ADD_GIFT_USER); } else { mileageOp = new CashshopMileage(0L, mileagePoint, CashshopMileage.ProcessEnum.ADD); } giveMileageSync.Connection = base.Entity.ItemConnection; giveMileageSync.Operation = mileageOp; yield return(giveMileageSync); if (!giveMileageSync.Result) { Log <QueryCashShopItemPickUpProcessor> .Logger.ErrorFormat("GiveItemSync is failed. NexonID: {0}, CID: {1}", base.Entity.NexonID, base.Entity.CID); base.Entity.CashShopProcessLog("", base.Operation.OrderNo.ToString(), base.Operation.OrderNo, mileagePoint, base.Entity.CID, base.Entity.NexonSN, "Mileage", "GiveFail"); } } base.Entity.EndInventoryPickUp_OnComplete(asyncResult); int tircoinCount = 0; foreach (ItemRequestInfo.Element element2 in giveItemOp.ItemRequestInfo.Elements) { if (element2.ItemClassEx.StartsWith("tir_coin")) { tircoinCount += element2.Num; } } if (tircoinCount > 0) { SendPacket op = SendPacket.Create <OpenCustomDialogUIMessage>(new OpenCustomDialogUIMessage { DialogType = 3, Arg = new List <string> { tircoinCount.ToString() } }); base.Entity.FrontendConnection.RequestOperation(op); SystemMessage serializeObject = new SystemMessage(SystemMessageCategory.System, "GameUI_Heroes_SystemMessage_TirCoin_BuyOK", new object[] { tircoinCount }); SendPacket op2 = SendPacket.Create <SystemMessage>(serializeObject); base.Entity.FrontendConnection.RequestOperation(op2); } base.Finished = true; yield return(new OkMessage()); } else { Log <QueryCashShopItemPickUpProcessor> .Logger.ErrorFormat("ToGiveItem is failed or there's no given item. NexonID: {0}, CID: {1}", base.Entity.NexonID, base.Entity.CID); base.Entity.EndInventoryPickUp_OnFail(asyncResult); base.Finished = true; yield return(new FailMessage("[QueryCashShopItemPickUpProcessor] giveItemOp.ItemRequestInfo.Count") { Reason = FailMessage.ReasonCode.LogicalFail }); } } } } yield break; }
private void NotifyMessage(Option option, ExtendInformation extendInfo, int arument, string nxID) { CafeAuth cafeAuth; SendPacket sendPacket; bool flag; SystemMessage systemMessage = null; Option option1 = option; switch (option1) { case Option.NoOption: { if (extendInfo == null) { break; } switch (extendInfo.ShutDownErrorCode) { case PolicyInfoErrorCode.Success: { if (systemMessage != null) { if (this.NxIDToEntityDic.TryGetValue(nxID, out cafeAuth) && systemMessage != null) { sendPacket = SendPacket.Create <SystemMessage>(systemMessage); cafeAuth.FrontendConn.RequestOperation(sendPacket); } if (this.ScheduleShutdownMessageNexonID.Contains(nxID)) { flag = this.ScheduleShutdownMessageNexonID.Remove(nxID); } return; } DateTime shutDownTime = extendInfo.ShutDownTime; if (extendInfo.ShutDownTime == DateTime.MinValue) { if (this.NxIDToEntityDic.TryGetValue(nxID, out cafeAuth) && systemMessage != null) { sendPacket = SendPacket.Create <SystemMessage>(systemMessage); cafeAuth.FrontendConn.RequestOperation(sendPacket); } if (this.ScheduleShutdownMessageNexonID.Contains(nxID)) { flag = this.ScheduleShutdownMessageNexonID.Remove(nxID); } return; } object[] month = new object[] { extendInfo.ShutDownTime.Month, extendInfo.ShutDownTime.Day, extendInfo.ShutDownTime.Hour }; systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_Shutdown_Notify_EndTime", month); break; } case PolicyInfoErrorCode.CannotFindAgeInfo: { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_CannotFindAgeInfo"); goto case PolicyInfoErrorCode.Success; } case PolicyInfoErrorCode.CannotAutholizing: { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_CannotAutholizing"); goto case PolicyInfoErrorCode.Success; } case PolicyInfoErrorCode.BlockFromShutdownSystem: { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_Shutdown"); goto case PolicyInfoErrorCode.Success; } case PolicyInfoErrorCode.BlockFromSelectiveShutdownSystem: { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_SelectiveShutdown"); goto case PolicyInfoErrorCode.Success; } default: { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_CannotPlayGame"); goto case PolicyInfoErrorCode.Success; } } break; } case Option.AddressNotAllowed: { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_IPBlocked"); break; } case Option.AddressMaxConnected: { systemMessage = new SystemMessage(SystemMessageCategory.Dialog, "GameUI_Login_Fail_Cafe_MaxConnected"); break; } case Option.AddressExpired: { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_Expired"); break; } default: { switch (option1) { case Option.WelcomePrepaid: { if (arument <= 60) { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_TimeLeft_LessThanOneHour"); } else { object[] objArray = new object[] { arument / 60 }; systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_TimeLeft", objArray); } break; } case Option.PrepaidExpired: break; case Option.PrepaidExhausted: { systemMessage = new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Cafe_Expired"); break; } default: { systemMessage = (option1 == Option.AccountShutdowned ? new SystemMessage(SystemMessageCategory.Notice, "GameUI_Heroes_Policy_Shutdown") : new SystemMessage(SystemMessageCategory.Dialog, "GameUI_Heroes_Policy_CannotPlayGame")); break; } } break; } } if (this.NxIDToEntityDic.TryGetValue(nxID, out cafeAuth) && systemMessage != null) { sendPacket = SendPacket.Create <SystemMessage>(systemMessage); cafeAuth.FrontendConn.RequestOperation(sendPacket); } if (this.ScheduleShutdownMessageNexonID.Contains(nxID)) { flag = this.ScheduleShutdownMessageNexonID.Remove(nxID); } }
public static void SendConsole(this IEntityProxy frontendConn, object format, params object[] arg) { frontendConn.RequestOperation(SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Console, format.ToString(), arg))); }
public override IEnumerable <object> Run() { base.Entity.SetLoginInformation(base.Operation.NexonSN, base.Operation.NexonID, base.Operation.CharacterID, base.Operation.LocalAddress, base.Operation.RemoteAddress, base.Operation.CanTry, base.Operation.IsTrial, base.Operation.MachineID, base.Operation.GameRoomClient, base.Operation.ChannelCode); if (!this.Service.Valid) { this.Service.PCRoomManager.AddUser(255, base.Entity); Log <LoginProcessor> .Logger.Info("Invalid CafeAuth Session Server - Passed"); base.Finished = true; yield return(true); yield return(false); yield return(0); yield return(false); yield return(1); } else if (!this.Service.Running) { Log <LoginProcessor> .Logger.Info("Session Server is shut down : add to queue"); base.Finished = true; this.Service.AddToWaitQueue(base.Entity); yield return(false); yield return(false); yield return(0); yield return(false); yield return(0); } else { base.Entity.BeginLogin(); yield return(base.Entity.LoginSync); if (base.Entity.LoginSync.Result) { CafeAuthResult result = base.Entity.EndLogin(); if (result == null) { Log <LoginProcessor> .Logger.ErrorFormat("Timeout for user [{{{0}}}] : Disconnected", base.Operation.NexonID); base.Entity.ReportCafeAuthMessage("Timeout"); base.Finished = true; yield return(new FailMessage("Entity.LoginSync.Result") { Reason = FailMessage.ReasonCode.LogicalFail }); } else { base.Entity.SessionNo = result.SessionNo; if (this.Service.SessionDic.ContainsKey(result.SessionNo)) { Log <CafeAuthService> .Logger.WarnFormat("Duplicate Session : [{0}]", result.SessionNo); } else { this.Service.SessionDic.Add(result.SessionNo, base.Entity); } if (result.ReloginRequired) { Scheduler.Schedule(this.Service.Thread, Job.Create(delegate { SendPacket op = SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Dialog, "GameUI_Heroes_Policy_Shutdown_Relogin_Required")); base.Entity.FrontendConn.RequestOperation(op); }), 3000); } base.Entity.ReportCafeAuthLogin(); if (result.PCRoomNo > 0) { this.Service.PCRoomManager.AddUser(result.PCRoomNo, base.Entity); } base.Finished = true; yield return(result.Result != AuthorizeResult.Trial); if (result.Option == Option.NoOption && result.Result != AuthorizeResult.Trial) { yield return(true); } else { yield return(result.Result == AuthorizeResult.Forbidden || result.Result == AuthorizeResult.Terminate); } yield return((int)result.Option); yield return(result.IsShutDownEnabled); yield return((result.Result != AuthorizeResult.Trial) ? 1 : 0); } } else { yield return(""); } } yield break; }
public override IEnumerable <object> Run() { ArraySegment <byte> response = new ArraySegment <byte>(base.Operation.Buffer); string errorType = ""; string errorValue = ""; bool toClose = false; if (response.Array.Length >= 4 && response.Array[0] == 204 && response.Array[1] == 20 && response.Array[2] == 234 && response.Array[3] == 30) { errorType = "ClientCheat"; errorValue = Encoding.ASCII.GetString(response.Array, 4, response.Array.Length - 4); if (Log <RespondProcessor> .Logger.IsWarnEnabled) { string text = ""; for (int i = 0; i < response.Array.Length; i++) { text += string.Format("{0:X2} ", response.Array[i]); } Log <RespondProcessor> .Logger.WarnFormat("Client Hack/Cheat Detected {{ Entity.ID = {0:o} }} Msg = {1}", base.Entity.ID, text); } } else { AntiCpXSvr.Recommend recommend; AntiCpXSvr.Error error = AntiCpXSvr.VerifyResponse(base.Entity.Handle, response, out recommend); if (recommend == AntiCpXSvr.Recommend.KeepSession) { if (Log <RespondProcessor> .Logger.IsInfoEnabled) { Log <RespondProcessor> .Logger.InfoFormat("AntiCpXSvr.VerifyResponse(clientHandle, responseBuffer, out recommend = {0}) = {1} {{ Entity.ID = {2:o} }}", recommend, error, base.Entity.ID); } } else { if (Log <RespondProcessor> .Logger.IsWarnEnabled) { Log <RespondProcessor> .Logger.WarnFormat("AntiCpXSvr.VerifyResponse(clientHandle, responseBuffer, out recommend = {0}) = {1} {{ Entity.ID = {2:o} }}", recommend, error, base.Entity.ID); } errorType = error.ToString(); toClose = true; } } if (errorType.Length > 0) { using (HackShieldErrorLogDataContext hackShieldErrorLogDataContext = new HackShieldErrorLogDataContext()) { try { hackShieldErrorLogDataContext.AddHackShieldError(new long?(base.Operation.CharacterID), errorType, errorValue); } catch (Exception ex) { Log <RespondProcessor> .Logger.Error(string.Format("Error while making log : [CharacterID = {0}]", base.Operation.CharacterID), ex); } } if (toClose) { SendPacket packet; if (!base.Operation.IsCheat) { packet = SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Dialog, "GameUI_HackSheild_Error")); } else { packet = SendPacket.Create <SystemMessage>(new SystemMessage(SystemMessageCategory.Notice, "GameUI_HackSheild_Contact")); } OperationSync sync = new OperationSync { Connection = base.Entity.FrontendConn, Operation = packet }; yield return(sync); Scheduler.Schedule(this.Service.Thread, Job.Create(new Action(base.Entity.Entity.Close)), 3000); } } base.Finished = true; yield break; }