예제 #1
0
        public AsyncResultSync BeginLogin(string nexonID, string characterID, IPAddress loginAddress, IPAddress remoteAddress, bool canTry, bool isTrial, MachineID machineID, int gameRoomClient, object state)
        {
            if (!this.Valid)
            {
                return(null);
            }
            AsyncResultSync asyncResultSync = new AsyncResultSync(base.Thread);

            if (FeatureMatrix.IsEnable("zhCN"))
            {
                this.connection.BeginChineseLogin(nexonID, characterID, remoteAddress, canTry, new AsyncCallback(asyncResultSync.AsyncCallback), state);
            }
            else
            {
                if (!FeatureMatrix.IsEnable("jaJP"))
                {
                    return(null);
                }
                this.connection.BeginLogin(nexonID, characterID, loginAddress, remoteAddress, canTry, isTrial, machineID, (gameRoomClient == 0) ? null : new int[]
                {
                    gameRoomClient
                }, new AsyncCallback(asyncResultSync.AsyncCallback), state);
            }
            return(asyncResultSync);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public Whisper.WhisperResult GetWhisperResult(ISynchronizable syncObj)
        {
            AsyncResultSync asyncResultSync = syncObj as AsyncResultSync;

            if (asyncResultSync == null || this.RelayClient == null)
            {
                Log <TalkService> .Logger.Error("RelayClient is not connected");

                return(Whisper.WhisperResult.LogicalFail);
            }
            if (!this.RelayClient.EndWhisper(asyncResultSync.AsyncResult))
            {
                return(Whisper.WhisperResult.OffLine);
            }
            return(Whisper.WhisperResult.Success);
        }
예제 #4
0
        public override IEnumerable <object> Run()
        {
            AsyncResultSync sync = new AsyncResultSync(this.service.Thread);
            IAsyncResult    ar   = base.Entity.BeginInventoryInquiry(new AsyncCallback(sync.AsyncCallback), "DirectPurchase");

            if (ar != null)
            {
                yield return(sync);
            }
            if (ar == null && !sync.Result)
            {
                base.Finished = true;
                yield return(new FailMessage("[QueryCashShopInventoryProcessor] sync.Result")
                {
                    Reason = FailMessage.ReasonCode.LogicalFail
                });
            }
            else
            {
                IList <CashShopInventoryElement> value = base.Entity.EndInventoryInquiry(ar);
                base.Finished = true;
                if (value == null)
                {
                    yield return(new FailMessage("[QueryCashShopInventoryProcessor] value")
                    {
                        Reason = FailMessage.ReasonCode.LogicalFail
                    });
                }
                else
                {
                    yield return(value);
                }
                base.Entity.FinishInventoryInquiry(ar);
            }
            yield break;
        }
예제 #5
0
        public override IEnumerable <object> Run()
        {
            if (this.service.IsCashShopStopped)
            {
                base.Entity.SendErrorDialog("CashShop_EmergencyStop");
                base.Finished = true;
                yield return(new FailMessage("[DirectPickUpProcessor] service.IsCashShopStopped")
                {
                    Reason = FailMessage.ReasonCode.LogicalFail
                });
            }
            else
            {
                DateTime currentTime = DateTime.UtcNow;
                if (base.Entity.IsConsecutivePurchase(currentTime))
                {
                    base.Entity.SendErrorDialog("CashShop_ConsecutivePurchase");
                    base.Finished = true;
                    yield return(new FailMessage("[DirectPickUpProcessor] Entity.IsConsecutivePurchase")
                    {
                        Reason = FailMessage.ReasonCode.LogicalFail
                    });
                }
                else
                {
                    base.Entity.UpdatePurchaseTime(currentTime);
                    List <CashShopPurchaseRequestArguments> args = new List <CashShopPurchaseRequestArguments>();
                    List <int> productnos = new List <int>();
                    foreach (CashShopItem product in base.Operation.QueryList)
                    {
                        CashShopProductListElement request;
                        if (!this.service.ProductByCashShopItemKey.TryGetValue(product.Key, out request))
                        {
                            base.Finished = true;
                            Log <DirectPickUpProcessor> .Logger.ErrorFormat("No Cash Item : [{0}/{1}/{2}]", product.ItemClass, product.Price, product.Expire);

                            yield return(new FailMessage("[DirectPickUpProcessor] product.Key")
                            {
                                Reason = FailMessage.ReasonCode.LogicalFail
                            });

                            yield break;
                        }
                        CashShopPurchaseRequestArguments arg = new CashShopPurchaseRequestArguments
                        {
                            ProductNo     = request.ProductNo,
                            OrderQuantity = 1,
                            Attribute0    = product.Attribute0,
                            Attribute1    = product.Attribute1,
                            Attribute2    = product.Attribute2,
                            Attribute3    = product.Attribute3,
                            Attribute4    = product.Attribute4
                        };
                        args.Add(arg);
                        productnos.Add(request.ProductNo);
                    }
                    AsyncResultSync sync = new AsyncResultSync(this.service.Thread);
                    IAsyncResult    ar   = base.Entity.BeginDirectPurchaseItem(args, base.Operation.TotalPrice, base.Operation.IsCredit, new AsyncCallback(sync.AsyncCallback), "DirectPurchase");
                    if (ar != null)
                    {
                        yield return(sync);
                    }
                    if (ar == null && !sync.Result)
                    {
                        base.Finished = true;
                        foreach (CashShopPurchaseRequestArguments cashShopPurchaseRequestArguments in args)
                        {
                            Log <DirectPickUpProcessor> .Logger.ErrorFormat("[directPickupProcessor Fail - sync.Result : [ UTC : {0}] : {1}", DateTime.UtcNow, cashShopPurchaseRequestArguments.ProductNo);
                        }
                        yield return(new FailMessage("[DirectPickUpProcessor] sync.Result")
                        {
                            Reason = FailMessage.ReasonCode.LogicalFail
                        });
                    }
                    else
                    {
                        IList <string> value = base.Entity.EndDirectPurchaseItem(ar);
                        base.Finished = true;
                        if (value.Count != base.Operation.QueryList.Count)
                        {
                            foreach (CashShopPurchaseRequestArguments cashShopPurchaseRequestArguments2 in args)
                            {
                                Log <DirectPickUpProcessor> .Logger.ErrorFormat("[directPickupProcessor Fail - value.Count : [ UTC : {0}] : {1}", DateTime.UtcNow, cashShopPurchaseRequestArguments2.ProductNo);
                            }
                            yield return(new FailMessage("[DirectPickUpProcessor] value.Count")
                            {
                                Reason = FailMessage.ReasonCode.LogicalFail
                            });
                        }
                        else
                        {
                            yield return(base.Entity.GetDirectPurchaseOrderNo(ar));

                            yield return(productnos);
                        }
                    }
                }
            }
            yield break;
        }
예제 #6
0
        public override IEnumerable <object> Run()
        {
            if (this.service.IsCashShopStopped)
            {
                base.Entity.SendErrorDialog("CashShop_EmergencyStop");
                base.Finished = true;
                yield return(new FailMessage("[DirectPickUpByProductNoProcessor] service.IsCashShopStopped")
                {
                    Reason = FailMessage.ReasonCode.LogicalFail
                });
            }
            else
            {
                DateTime currentTime = DateTime.UtcNow;
                if (base.Entity.IsConsecutivePurchase(currentTime))
                {
                    base.Entity.SendErrorDialog("CashShop_ConsecutivePurchase");
                    base.Finished = true;
                    yield return(new FailMessage("[DirectPickUpByProductNoProcessor] Entity.IsConsecutivePurchase")
                    {
                        Reason = FailMessage.ReasonCode.LogicalFail
                    });
                }
                else
                {
                    base.Entity.UpdatePurchaseTime(currentTime);
                    List <CashShopPurchaseRequestArguments> args = new List <CashShopPurchaseRequestArguments>();
                    Dictionary <string, int> resultDic           = new Dictionary <string, int>();
                    int price = 0;
                    foreach (int productNo in base.Operation.ProductNoList)
                    {
                        CashShopProductListElement request;
                        if (!this.service.ProductByProductID.TryGetValue(productNo, out request))
                        {
                            base.Finished = true;
                            Log <DirectPickUpByProductNoProcessor> .Logger.ErrorFormat("No Cash Item : [{0}]", productNo);

                            yield return(new FailMessage("[DirectPickUpByProductNoProcessor] productNo")
                            {
                                Reason = FailMessage.ReasonCode.LogicalFail
                            });

                            yield break;
                        }
                        CashShopPurchaseRequestArguments arg = new CashShopPurchaseRequestArguments
                        {
                            ProductNo     = request.ProductNo,
                            OrderQuantity = 1,
                            Attribute0    = "",
                            Attribute1    = "",
                            Attribute2    = "",
                            Attribute3    = "",
                            Attribute4    = ""
                        };
                        if (resultDic.ContainsKey(request.ProductID))
                        {
                            Dictionary <string, int> dictionary;
                            string productID;
                            (dictionary = resultDic)[productID = request.ProductID] = dictionary[productID] + 1;
                        }
                        else
                        {
                            resultDic.Add(request.ProductID, 1);
                        }
                        args.Add(arg);
                        price += request.SalePrice;
                    }
                    AsyncResultSync sync = new AsyncResultSync(this.service.Thread);
                    IAsyncResult    ar   = base.Entity.BeginDirectPurchaseItem(args, price, base.Operation.IsCredit, new AsyncCallback(sync.AsyncCallback), "DirectPurchase");
                    if (ar != null)
                    {
                        yield return(sync);
                    }
                    if (ar == null && !sync.Result)
                    {
                        base.Finished = true;
                        string failReason = "BeginDirectPurchaseItem failed";
                        yield return(failReason);

                        yield return(new FailMessage("[DirectPickUpByProductNoProcessor] sync.Result")
                        {
                            Reason = FailMessage.ReasonCode.LogicalFail
                        });
                    }
                    else
                    {
                        IList <string> value = base.Entity.EndDirectPurchaseItem(ar);
                        base.Finished = true;
                        if (value == null || value.Count != base.Operation.ProductNoList.Count)
                        {
                            string failReason = "EndDirectPurchaseItem failed.";
                            yield return(failReason);

                            yield return(new FailMessage("[DirectPickUpByProductNoProcessor] value.Count")
                            {
                                Reason = FailMessage.ReasonCode.LogicalFail
                            });
                        }
                        else
                        {
                            yield return(base.Entity.GetDirectPurchaseOrderNo(ar));

                            yield return(resultDic);
                        }
                    }
                }
            }
            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;
        }
예제 #8
0
        public override IEnumerable <object> Run()
        {
            if (!this.Service.Valid)
            {
                base.Finished = true;
                yield return(true);

                yield return(false);

                yield return(0);

                yield return(false);

                yield return(0);
            }
            else if (!this.Service.Running)
            {
                base.Finished = true;
                yield return(false);

                yield return(false);

                yield return(0);

                yield return(false);

                yield return(0);
            }
            else
            {
                AsyncResultSync sync = base.Entity.BeginLogin(base.Operation.NexonID, base.Operation.CharacterID, base.Operation.LocalAddress, base.Operation.RemoteAddress, base.Operation.CanTry, base.Operation.IsTrial, new MachineID(base.Operation.MachineID.ToByteArray()), base.Operation.GameRoomClient, base.Entity);
                if (sync == null)
                {
                    Log <CafeAuthJPNVersionService> .Logger.InfoFormat("sync is NULL from CafeAuth service : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                    base.Finished = true;
                    yield return(false);

                    yield return(false);

                    yield return(0);

                    yield return(0);
                }
                else
                {
                    IAsyncResult ar = sync.AsyncResult;
                    if (ar == null)
                    {
                        Log <CafeAuthJPNVersionService> .Logger.InfoFormat("ar is NULL from CafeAuth service : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);
                    }
                    Scheduler.Schedule(this.Service.Thread, Job.Create <AsyncResultSync, IAsyncResult>(delegate(AsyncResultSync async, IAsyncResult asyncResult)
                    {
                        if (sync.AsyncResult == ar && sync.AsyncResult.AsyncState == this.Entity)
                        {
                            Log <CafeAuthJPNVersionService> .Logger.InfoFormat("No response from CafeAuth service : {0} / {1}", this.Operation.NexonID, this.Operation.CharacterID);
                            sync.AsyncCallback(asyncResult);
                        }
                    }, sync, ar), this.ackCompleteTimeout);
                    yield return(sync);

                    base.Finished = true;
                    if (sync.Result)
                    {
                        Log <CafeAuthJPNVersionService> .Logger.InfoFormat("sync.Result is true from CafeAuth service : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                        CafeAuthResult result = this.Service.EndLogin(sync.AsyncResult);
                        if (result == null)
                        {
                            Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult Is NULL : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                            yield return("");
                        }
                        else
                        {
                            yield return(result.Result != Nexon.CafeAuthJPN.Result.Trial);

                            if (result.Option == Option.NoOption && result.Result != Nexon.CafeAuthJPN.Result.Trial)
                            {
                                Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #1", result.Result, result.Option);

                                yield return(true);
                            }
                            else
                            {
                                Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #2", result.Result, result.Option);

                                yield return(result.Result == Nexon.CafeAuthJPN.Result.Forbidden || result.Result == Nexon.CafeAuthJPN.Result.Terminate);
                            }
                            Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #3", result.Result, result.Option);

                            yield return((int)result.Option);

                            yield return(false);

                            if (result.Result == Nexon.CafeAuthJPN.Result.Trial)
                            {
                                Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #4", result.Result, result.Option);

                                yield return(0);
                            }
                            else
                            {
                                Log <CafeAuthJPNVersionService> .Logger.InfoFormat("CafeAuthResult, Result={0}, Option={1} #5", result.Result, result.Option);

                                yield return(1);
                            }
                        }
                    }
                    else
                    {
                        yield return("");
                    }
                }
            }
            yield break;
        }
 public override IEnumerable <object> Run()
 {
     if (this.service.IsCashShopStopped)
     {
         base.Entity.SendErrorDialog("CashShop_EmergencyStop");
         base.Finished = true;
         yield return(new FailMessage("[RequestGoddessProtectionProcessor] service.IsCashShopStopped")
         {
             Reason = FailMessage.ReasonCode.LogicalFail
         });
     }
     else if (base.Entity.CID == -1L)
     {
         base.Finished = true;
         base.Entity.SendErrorDialog("CashShop_NotReady");
         yield return(new FailMessage("[RequestGoddessProtectionProcessor] Entity.CID")
         {
             Reason = FailMessage.ReasonCode.LogicalFail
         });
     }
     else
     {
         List <CashShopPurchaseRequestArguments> args = new List <CashShopPurchaseRequestArguments>();
         string targetItem;
         if (base.Operation.RequestType == 0)
         {
             targetItem = "goddess_protection";
         }
         else
         {
             targetItem = "goddess_protection_personal";
         }
         CashShopProductListElement product;
         if (!this.service.ProductByItemClass.TryGetValue(targetItem, out product))
         {
             base.Finished = true;
             yield return(new FailMessage("[RequestGoddessProtectionProcessor] targetItem")
             {
                 Reason = FailMessage.ReasonCode.LogicalFail
             });
         }
         else
         {
             CashShopPurchaseRequestArguments arg = new CashShopPurchaseRequestArguments
             {
                 ProductNo     = product.ProductNo,
                 OrderQuantity = 1,
                 Attribute0    = "",
                 Attribute1    = "",
                 Attribute2    = "",
                 Attribute3    = "",
                 Attribute4    = ""
             };
             args.Add(arg);
             AsyncResultSync sync = new AsyncResultSync(this.service.Thread);
             IAsyncResult    ar   = base.Entity.BeginDirectPurchaseItem(args, product.SalePrice, base.Operation.IsCredit, new AsyncCallback(sync.AsyncCallback), "GoddessProtection");
             if (ar != null)
             {
                 yield return(sync);
             }
             if (ar == null && !sync.Result)
             {
                 base.Finished = true;
                 yield return(new FailMessage("[RequestGoddessProtectionProcessor] !sync.Result")
                 {
                     Reason = FailMessage.ReasonCode.LogicalFail
                 });
             }
             else
             {
                 IList <string> value = base.Entity.EndDirectPurchaseItem(ar);
                 base.Finished = true;
                 if (value.Count == 0)
                 {
                     yield return(new FailMessage("[RequestGoddessProtectionProcessor] value.Count")
                     {
                         Reason = FailMessage.ReasonCode.LogicalFail
                     });
                 }
                 else
                 {
                     yield return(new OkMessage());
                 }
             }
         }
     }
     yield break;
 }
예제 #10
0
        public override IEnumerable <object> Run()
        {
            Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService sync starting : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

            if (!this.Service.Valid)
            {
                base.Finished = true;
                Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService is invalid : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                yield return(true);

                yield return(false);

                yield return(0);

                yield return(false);

                yield return(1);
            }
            else if (!this.Service.Running)
            {
                base.Finished = true;
                Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService is not working : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                yield return(false);

                yield return(false);

                yield return(0);

                yield return(false);

                yield return(0);
            }
            else
            {
                AsyncResultSync sync = base.Entity.BeginLogin(base.Operation.NexonID, base.Operation.CharacterID, base.Operation.LocalAddress, base.Operation.RemoteAddress, base.Operation.CanTry, base.Operation.IsTrial, new MachineID(base.Operation.MachineID.ToByteArray()), base.Operation.GameRoomClient, base.Entity);
                if (sync == null)
                {
                    Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService sync null : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                    base.Finished = true;
                    yield return(false);

                    yield return(false);

                    yield return(0);

                    yield return(false);

                    yield return(0);
                }
                else
                {
                    IAsyncResult ar = sync.AsyncResult;
                    if (ar == null)
                    {
                        Log <CafeAuthOldVersionService> .Logger.InfoFormat("ar is NULL from CafeAuth service : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);
                    }
                    Scheduler.Schedule(this.Service.Thread, Job.Create <AsyncResultSync, IAsyncResult>(delegate(AsyncResultSync async, IAsyncResult asyncResult)
                    {
                        if (sync.AsyncResult == ar && (sync.AsyncResult == null || sync.AsyncResult.AsyncState == this.Entity))
                        {
                            Log <CafeAuthOldVersionService> .Logger.InfoFormat("No response from CafeAuth service : {0} / {1}", this.Operation.NexonID, this.Operation.CharacterID);
                            sync.AsyncCallback(asyncResult);
                        }
                    }, sync, ar), this.ackCompleteTimeout);
                    yield return(sync);

                    Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuthService sync : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                    base.Finished = true;
                    if (sync.Result)
                    {
                        CafeAuthResult result = this.Service.EndLogin(sync.AsyncResult);
                        if (result == null)
                        {
                            Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuth fail : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                            yield return("");
                        }
                        else
                        {
                            Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuth : {0} / {1} = {2} {3} {4}", new object[]
                            {
                                base.Operation.NexonID,
                                base.Operation.CharacterID,
                                result.Result,
                                result.Option,
                                result.CafeLevel
                            });

                            yield return(result.Result != Nexon.CafeAuthOld.Result.Trial);

                            if (result.Option == Option.NoOption && result.Result != Nexon.CafeAuthOld.Result.Trial)
                            {
                                yield return(true);
                            }
                            else
                            {
                                yield return(result.Result == Nexon.CafeAuthOld.Result.Forbidden || result.Result == Nexon.CafeAuthOld.Result.Terminate);
                            }
                            yield return((int)result.Option);

                            yield return(false);

                            yield return((int)result.CafeLevel);
                        }
                    }
                    else
                    {
                        base.Finished = true;
                        Log <CafeAuthOldVersionService> .Logger.InfoFormat("CafeAuth Auth Time Out  : {0} / {1}", base.Operation.NexonID, base.Operation.CharacterID);

                        yield return(false);

                        yield return(false);

                        yield return(0);

                        yield return(false);

                        yield return(0);
                    }
                }
            }
            yield break;
        }