Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        clientSession = (ClientSession)AuthorizationManager.GetCurrentSessionObject(Context, false);
        string sDate = Request.QueryString["sd"];
        string eDate = Request.QueryString["ed"];
        DateTime startDate = new DateTime();

        if (string.IsNullOrEmpty(sDate))
        {
            startDate = minTime;
        }
        else
        {
            startDate = DateTime.Parse(sDate);
        }

        DateTime endDate = new DateTime();
        if (string.IsNullOrEmpty(eDate))
        {
            endDate = minTime;
        }
        else
        {
            endDate = DateTime.Parse(eDate);
            endDate = new DateTime(endDate.Year, endDate.Month, endDate.Day, 23, 59, 59);
        }

        List<ClientOrder> result = ClientOrderOperation.GetClientOrderListByParameters(clientSession.Id, startDate, endDate);

        rpPrint.DataSource = result;
        rpPrint.DataBind();
    }
Exemplo n.º 2
0
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        string username = Request.Form["tbxUsername"].Trim();
        string password = Request.Form["tbxPassword"];

        if (string.IsNullOrEmpty(username))
        {
            Response.Write("<script language='javascript'>alert('请输入用户名!');location.href='/';</script>");
            return;
        }
        if (string.IsNullOrEmpty(password))
        {
            Response.Write("<script language='javascript'>alert('请输入密码!');location.href='/';</script>");
            return;
        }
        Client client = new Client();
        client.Username = username;
        client.Password = password;
        string msg = "";
        if (ClientOperation.ClientLogin(client, out msg))
        {
            ClientSession cs = new ClientSession();
            Client newClient = ClientOperation.GetClientByUsername(client.Username);
            cs.Id = newClient.Id;
            cs.Username = newClient.Username;
            cs.RealName = newClient.RealName;
            AuthorizationManager.Authorize(cs);
            Response.Redirect("Client/Default.aspx");
        }
        else
        {
            Response.Write("<script language='javascript'>alert('" + msg + "');location.href='/';</script>");
            return;
        }
    }
Exemplo n.º 3
0
        private void HandleConnection(StreamSocket clientSocket)
        {
            using (var clientSession = new ClientSession(clientSocket))
            {
                clientSession.HttpRequestReceived += HandleHttpRequest;
                clientSession.WebSocketConnected += HandleWebSocketConnected;

                try
                {
                    clientSession.Run();
                }
                catch (Exception exception)
                {
                    var comException = exception as COMException;
                    if (comException?.HResult == -2147014843)
                    {
                        return;
                    }

                    Debug.WriteLine("ERROR: Error while handling HTTP client requests. " + exception);
                }
                finally
                {
                    clientSession.HttpRequestReceived -= HandleHttpRequest;
                    clientSession.WebSocketConnected -= WebSocketConnected;
                }
            }
        }
Exemplo n.º 4
0
        public override void Execute(ClientSession client)
        {
            BookFunctions.CreateSymmetryStrategy("FGEQLONG", "SYM_FGHK");
            BookFunctions.CreateSymmetryStrategy("GUOFIC", "SYM_FGHK");
            BookFunctions.CreateSymmetryStrategy("GUOFIC_FX", "SYM_FGHK");
            BookFunctions.CreateSymmetryStrategy("SCWEQ", "SYM_FGHK");
            BookFunctions.CreateSymmetryStrategy("EQNKYOPT1", "SYM_FGLN");
            BookFunctions.CreateSymmetryStrategy("EQSTRESS1", "SYM_FGLN");
            BookFunctions.CreateSymmetryStrategy("GUOFIC", "SYM_FGLN");
            BookFunctions.CreateSymmetryStrategy("GYVXXOPT2", "SYM_FGLN");
            BookFunctions.CreateSymmetryStrategy("INTERNAL", "SYM_FGLN");
            BookFunctions.CreateSymmetryStrategy("KAIHCVOL", "SYM_FGLN");
            BookFunctions.CreateSymmetryStrategy("KAISX5EDIV", "SYM_FGLN");
            BookFunctions.CreateSymmetryStrategy("MACROPM1_EQ", "SYM_FGLN");

            BookFunctions.CreateSymmetryStrategy("BMFOEUR1", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMFOEUR2", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMFOEUR3", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMFOEUR4", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMHEDGE1", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMSALIX1", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMSALIX2", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMSALIX3", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMTSYCA1", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMTSYEU1", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMTSYEU2", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("BMTSYXC1", "SYM_BM");
            BookFunctions.CreateSymmetryStrategy("HDG1", "SYM_FGLN");
            BookFunctions.CreateSymmetryStrategy("EQ2882", "SYM_FGLN");
        }
Exemplo n.º 5
0
 public override void Execute(ClientSession client)
 {
     QuoteFunctions.UpdateRtTickers("ED", ContractUnderlierType.Interest, false, "ED", "2ED");
     QuoteFunctions.UpdateRtTickers("ED", ContractUnderlierType.InterestFuture, true, "ED", "2ED");
     QuoteFunctions.UpdateRtTickers("0E", ContractUnderlierType.InterestFuture, true, "EG", "2EG");
     QuoteFunctions.UpdateRtTickers("2E", ContractUnderlierType.InterestFuture, true, "EH", "2EH");
     QuoteFunctions.UpdateRtTickers("3E", ContractUnderlierType.InterestFuture, true, "EN", "2EN");
 }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     clientSession = (ClientSession)AuthorizationManager.GetCurrentSessionObject(Context, false);
     if (!IsPostBack)
     {
         RpOrderDataBind();
     }
 }
        protected void AddClient()
        {
            var client = new ClientSession<IMarketDataProviderCallback>(ContextSessionId,
                ContextCallbackChannel);

            Console.WriteLine("New client session [{0}] subscribed at [{1}].", client.SessionId, client.SessionStart);
            clients.Add(client);
        }
Exemplo n.º 8
0
 public BroadcastPacket(ClientSession session, string packet, ReceiverType receiver, string someonesCharacterName = "", long someonesCharacterId = -1, int xCoordinate = 0, int yCoordinate = 0)
 {
     Sender = session;
     Packet = packet;
     Receiver = receiver;
     SomeonesCharacterName = someonesCharacterName;
     SomeonesCharacterId = someonesCharacterId;
     XCoordinate = xCoordinate;
     YCoordinate = yCoordinate;
 }
 internal override void LogRequest(RtspMessage request, ClientSession session)
 {
     ConsoleColor previous = Console.ForegroundColor;
     try
     {
         Console.ForegroundColor = RequestColor;
         Logger.Log(string.Format(Format, "Request=>", request, "Session=>", session.Id, null));
     }
     catch { throw; }
     finally { Console.ForegroundColor = previous; }
 }
Exemplo n.º 10
0
        /// <summary>
        /// 二进制消息
        /// </summary>
        void OnBinaryMessage(ClientSession session, ByteBuffer buffer) {
            string str = buffer.ReadString();
            session.uid = buffer.ReadInt();

            ByteBuffer newBuffer = new ByteBuffer();
            newBuffer.WriteByte((byte)ProtocalType.BINARY);
            newBuffer.WriteString(str);
            SocketUtil.SendMessage(session, Protocal.Login, newBuffer);

            UserUtil.Add(session.uid, session);
            Console.WriteLine("OnBinaryMessage--->>>" + str + session.uid);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 数据接收
        /// </summary>
        public void OnRequestReceived(ClientSession session, BinaryRequestInfo requestInfo) {
            ByteBuffer buffer = new ByteBuffer(requestInfo.Body);
            int commandId = buffer.ReadShort();
            Protocal c = (Protocal)commandId;
            string className = "Junfine.Dota.Message." + c;
            Console.WriteLine("OnRequestReceived--->>>" + className);

            Type t = Type.GetType(className);
            IMessage obj = (IMessage)Activator.CreateInstance(t);
            if (obj != null) obj.OnMessage(session, buffer);
            obj = null; t = null;   //释放内存
        }
Exemplo n.º 12
0
        /// <summary>
        /// pbc消息
        /// </summary>
        void OnPbcMessage(ClientSession session, ByteBuffer buffer) {
            tutorial.Person request = ProtoUtil.GetMessage<tutorial.Person>(buffer);
            Console.WriteLine("OnPbcMessage id=>>" + request.id + " name:>>>" + request.name);
            buffer.Close(); buffer = null;

            byte[] data = ProtoUtil.SetMessage<tutorial.Person>(request);

            ByteBuffer newBuffer = new ByteBuffer();
            newBuffer.WriteByte((byte)ProtocalType.PBC);
            newBuffer.WriteBytes(data); //添加数据

            SocketUtil.SendMessage(session, Protocal.Login, newBuffer);
        }
Exemplo n.º 13
0
        public void OnMessage(ClientSession session, ByteBuffer buffer) {
            string str = buffer.ReadString();
            int uid = buffer.ReadInt();

            ushort commandId = (ushort)Protocal.Login;
            ByteBuffer newBuffer = new ByteBuffer();
            newBuffer.WriteShort(commandId);
            newBuffer.WriteByte(1);
            newBuffer.WriteString(str);
            SocketUtil.SendMessage(session, newBuffer);

            session.uid = uid;
            UserUtil.Add(uid, session);
            Console.WriteLine("OnMessage--->>>" + str + uid);
        }
Exemplo n.º 14
0
        /// <summary>
        /// pblua消息
        /// </summary>
        /// <param name="session"></param>
        /// <param name="buffer"></param>
        void OnPbLuaMessage(ClientSession session, ByteBuffer buffer) {
            LoginRequest request = ProtoUtil.GetMessage<LoginRequest>(buffer);
            Console.WriteLine("OnPbLuaMessage id=>>" + request.id + " name:>>>" + request.name + " email:>>" + request.email);
            buffer.Close(); buffer = null;

            LoginResponse response = new LoginResponse();
            response.id = 100; //排队人数
            byte[] data = ProtoUtil.SetMessage<LoginResponse>(response);

            ByteBuffer newBuffer = new ByteBuffer();
            newBuffer.WriteByte((byte)ProtocalType.PB_LUA);
            newBuffer.WriteBytes(data); //添加数据

            SocketUtil.SendMessage(session, Protocal.Login, newBuffer);
        }
Exemplo n.º 15
0
 /// <summary>
 /// 发送消息
 /// </summary>
 public static void SendMessage(ClientSession session, ByteBuffer buffer) {
     byte[] message = buffer.ToBytes();
     using (MemoryStream ms = new MemoryStream()) {
         ms.Position = 0;
         BinaryWriter writer = new BinaryWriter(ms);
         ushort msglen = (ushort)message.Length;
         writer.Write(msglen);
         writer.Write(message);
         writer.Flush();
         if (session != null && session.Connected) {
             byte[] payload = ms.ToArray();
             session.Send(payload, 0, payload.Length);
         } else {
             Console.WriteLine("client.connected----->>false");
         }
     }
 }
Exemplo n.º 16
0
 public void OnMessage(ClientSession session, ByteBuffer buffer) {
     byte b = buffer.ReadByte();
     ProtocalType type = (ProtocalType)b;    //协议类型
     switch (type) {
         case ProtocalType.BINARY: 
             OnBinaryMessage(session, buffer);
         break;
         case ProtocalType.PB_LUA:
             OnPbLuaMessage(session, buffer);
         break;
         case ProtocalType.PBC:
             OnPbcMessage(session, buffer);
         break;
         case ProtocalType.SPROTO:
             OnSprotoMessage(session, buffer);
         break;
     }
 }
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            var envName = Env.GetOption("-env", args);
            if (envName == null)
            {
                Console.WriteLine("Usage: ConsoleClient.exe -env <envName>");
                return;
            }

            var clientSession = new ClientSession(args);
            clientSession.StartAndConnect("orchestra", "SimpleClient", envName, "orchestra");

            //FxSwapUpdate();
            //AccountCleanUp();

            PubSubSessionFactory.CleanUp();
            Console.WriteLine("Enter to Exit ...");
            Console.ReadLine();
        }
Exemplo n.º 18
0
            /// <summary>
            /// Initializes a new instance of the <see cref="AwaitClientContext"/> class.
            /// </summary>
            /// <param name="clientSession">The client session.</param>
            /// <param name="readyCondition">The ready condition, which determines when the server is ready.</param>
            public AwaitClientContext(ClientSession clientSession, Func<ClientSession, bool> readyCondition)
            {
                this.clientSession = clientSession;

                this.Messages = new List<string>();
                this.CommunicationErrors = new List<Exception>();
                this.UnhandledExceptions = new List<Exception>();
                this.InvalidCredentialMessage = string.Empty;

                this.onStateChanged = this.ClientSessionOnStateChanged(clientSession, readyCondition);

                this.onMessageToShow = (sender, args) =>
                {
                    this.Messages.Add(args.Message);
                    this.handle.Set();
                };

                this.onUnhandledException = (sender, args) =>
                {
                    this.UnhandledExceptions.Add(args.Exception);
                    this.handle.Set();
                };

                this.onCommunicationError = (sender, args) =>
                {
                    this.CommunicationErrors.Add(args.Exception);
                    this.handle.Set();
                };

                this.onInvalidCredentialsError = (sender, args) =>
                {
                    this.InvalidCredentialMessage = args.Message;
                    this.handle.Set();
                };

                this.clientSession.StateChanged += this.onStateChanged;
                this.clientSession.MessageToShow += this.onMessageToShow;
                this.clientSession.UnhandledException += this.onUnhandledException;
                this.clientSession.CommunicationError += this.onCommunicationError;
                this.clientSession.InvalidCredentialsError += this.onInvalidCredentialsError;
            }
Exemplo n.º 19
0
        static public void Main(string[] args)
        {
            var scount = Env.GetOption("-count", args);
            var client = new ClientSession(args);
            client.StartAndConnect("ApplyTermination");
            Logger.Info(".....Apply Termination Started ........................");

            var trade =new Trade(); //Get the Trade for which to apply the Termaition
           var market = new Market(); //Should get the Real Market
           var asOfDate = new DateTime(); //negotiated Trade Date of the Termination/StepOut
            var effDate = new SimpleDate(23,2,2012);
            double fee =10000; //Total Proceeds (Fee > 0, you receive the Amount Fee < 0 you pay to the Counterpary)
            string party = "GS"; //Fill it in case this is a StepOut

            ApplyFullTermination(trade, fee, party, market, asOfDate, effDate);
           
            //Then you can save the Trade 
            if (trade.Id <= 0) Env.Current.Trade.SaveTrade(trade);

            Console.WriteLine("Enter to Exit ...");
            Console.ReadLine();
            Environment.Exit(0);
        }
Exemplo n.º 20
0
 public MatePacketHandler(ClientSession session) => Session = session;
 public ScriptedInstancePacketHandler(ClientSession session)
 {
     Session = session;
 }
Exemplo n.º 22
0
 public override void Execute(NoS0577Packet packet, ClientSession clientSession)
 {
     _loginService.Login(packet.Username, packet.Md5String, packet.ClientVersion, clientSession,
                         packet.AuthToken, true);
 }
Exemplo n.º 23
0
        public override async Task ExecuteAsync(GameStartPacket packet, ClientSession session)
        {
            if (session.GameStarted || !session.HasSelectedCharacter)
            {
                // character should have been selected in SelectCharacter
                return;
            }

            session.GameStarted = true;

            if (session.Character.CurrentScriptId == null)
            {
                _questProvider.RunScriptAsync(session.Character).Forget();
            }

            if (_worldConfiguration.WorldInformation)
            {
                await session.SendPacketAsync(session.Character.GenerateSay("-------------------[NosCore]---------------",
                                                                            SayColorType.Yellow)).ConfigureAwait(false);

                await session.SendPacketAsync(session.Character.GenerateSay("Github : https://github.com/NosCoreIO/NosCore/",
                                                                            SayColorType.Purple)).ConfigureAwait(false);

                await session.SendPacketAsync(session.Character.GenerateSay("-----------------------------------------------",
                                                                            SayColorType.Yellow)).ConfigureAwait(false);
            }

            session.Character.LoadSpeed();
            //            Session.Character.LoadSkills();
            await session.SendPacketAsync(session.Character.GenerateTit()).ConfigureAwait(false);

            await session.SendPacketAsync(session.Character.GenerateSpPoint()).ConfigureAwait(false);

            await session.SendPacketAsync(session.Character.GenerateRsfi()).ConfigureAwait(false);

            await session.SendPacketAsync(session.Character.GenerateQuestPacket()).ConfigureAwait(false);

            if (session.Character.Hp <= 0)
            {
                //                ServerManager.Instance.ReviveFirstPosition(Session.Character.CharacterId);
            }
            else
            {
                await session.ChangeMapAsync().ConfigureAwait(false);
            }

            //            Session.SendPacket(Session.Character.GenerateSki());
            //            Session.SendPacket($"fd {Session.Character.Reput} 0 {(int)Session.Character.Dignity} {Math.Abs(Session.Character.GetDignityIco())}");
            await session.SendPacketAsync(session.Character.GenerateFd()).ConfigureAwait(false);

            await session.SendPacketAsync(session.Character.GenerateStat()).ConfigureAwait(false);

            //            Session.SendPacket("rage 0 250000");
            //            Session.SendPacket("rank_cool 0 0 18000");
            //            SpecialistInstance specialistInstance = Session.Character.Inventory.LoadBySlotAndType<SpecialistInstance>(8, InventoryType.Wear);
            var medal = session.Character.StaticBonusList.FirstOrDefault(s => s.StaticBonusType == StaticBonusType.BazaarMedalGold || s.StaticBonusType == StaticBonusType.BazaarMedalSilver);

            if (medal != null)
            {
                await session.SendPacketAsync(session.Character.GenerateSay(GameLanguage.Instance.GetMessageFromKey(LanguageKey.LOGIN_MEDAL, session.Account.Language), SayColorType.Green)).ConfigureAwait(false);
            }

            //            if (Session.Character.StaticBonusList.Any(s => s.StaticBonusType == StaticBonusType.PetBasket))
            //            {
            //                Session.SendPacket("ib 1278 1");
            //            }

            //            if (Session.Character.MapInstance.Map.MapTypes.Any(m => m.MapTypeId == (short)MapTypeEnum.CleftOfDarkness))
            //            {
            //                Session.SendPacket("bc 0 0 0");
            //            }
            //            if (specialistInstance != null)
            //            {
            //                Session.SendPacket(Session.Character.GenerateSpPoint());
            //            }
            //            Session.SendPacket("scr 0 0 0 0 0 0");
            //            for (int i = 0; i < 10; i++)
            //            {
            //                Session.SendPacket($"bn {i} {Language.Instance.GetMessageFromKey($"BN{i}")}");
            //            }
            session.Character.LoadExpensions();
            await session.SendPacketAsync(session.Character.GenerateExts(_worldConfiguration)).ConfigureAwait(false);

            //            Session.SendPacket(Session.Character.GenerateMlinfo());
            await session.SendPacketAsync(new PclearPacket()).ConfigureAwait(false);

            //            Session.SendPacket(Session.Character.GeneratePinit());
            //            Session.SendPackets(Session.Character.GeneratePst());

            //            Session.SendPacket("zzim");
            //            Session.SendPacket($"twk 2 {Session.Character.CharacterId} {Session.Account.Name} {Session.Character.Name} shtmxpdlfeoqkr");

            await session.SendPacketsAsync(session.Character.Quests.Values.Select(qst => qst.Quest.GenerateTargetPacket())).ConfigureAwait(false);

            //            // sqst bf
            //            Session.SendPacket("act6");
            //            Session.SendPacket(Session.Character.GenerateFaction());
            //            // MATES
            //            Session.SendPackets(Session.Character.GenerateScP());
            //            Session.SendPackets(Session.Character.GenerateScN());
            //            Session.Character.GenerateStartupInventory();

            await session.SendPacketAsync(session.Character.GenerateGold()).ConfigureAwait(false);

            await session.SendPacketAsync(session.Character.GenerateCond()).ConfigureAwait(false);

            await session.SendPacketsAsync(session.Character.GenerateQuicklist()).ConfigureAwait(false);

            //            string clinit = ServerManager.Instance.TopComplimented.Aggregate("clinit",
            //                (current, character) => current + $" {character.CharacterId}|{character.Level}|{character.HeroLevel}|{character.Compliment}|{character.Name}");
            //            string flinit = ServerManager.Instance.TopReputation.Aggregate("flinit",
            //                (current, character) => current + $" {character.CharacterId}|{character.Level}|{character.HeroLevel}|{character.Reput}|{character.Name}");
            //            string kdlinit = ServerManager.Instance.TopPoints.Aggregate("kdlinit",
            //                (current, character) => current + $" {character.CharacterId}|{character.Level}|{character.HeroLevel}|{character.Act4Points}|{character.Name}");

            //            Session.CurrentMapInstance?.Broadcast(Session.Character.GenerateGidx());

            await session.Character.SendFinfoAsync(_friendHttpClient, _packetHttpClient, _packetSerializer, true).ConfigureAwait(false);

            await session.SendPacketAsync(await session.Character.GenerateFinitAsync(_friendHttpClient, _channelHttpClient,
                                                                                     _connectedAccountHttpClient).ConfigureAwait(false)).ConfigureAwait(false);

            await session.SendPacketAsync(await session.Character.GenerateBlinitAsync(_blacklistHttpClient).ConfigureAwait(false)).ConfigureAwait(false);

            //            Session.SendPacket(clinit);
            //            Session.SendPacket(flinit);
            //            Session.SendPacket(kdlinit);

            //            Session.Character.LastPVPRevive = SystemTime.Now;

            //            long? familyId = _familyCharacterDao.FirstOrDefaultAsync(s => s.CharacterId == Session.Character.CharacterId)?.FamilyId;
            //            if (familyId != null)
            //            {
            //                Session.Character.Family = ServerManager.Instance.FamilyList.FirstOrDefault(s => s.FamilyId == familyId.Value);
            //            }

            //            if (Session.Character.Family != null && Session.Character.FamilyCharacter != null)
            //            {
            //                Session.SendPacket(Session.Character.GenerateGInfo());
            //                Session.SendPackets(Session.Character.GetFamilyHistory());
            //                Session.SendPacket(Session.Character.GenerateFamilyMember());
            //                Session.SendPacket(Session.Character.GenerateFamilyMemberMessage());
            //                Session.SendPacket(Session.Character.GenerateFamilyMemberExp());
            //                if (!string.IsNullOrWhiteSpace(Session.Character.Family.FamilyMessage))
            //                {
            //                    Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo("--- Family Message ---\n" + Session.Character.Family.FamilyMessage));
            //                }
            //            }

            //            IEnumerable<PenaltyLogDTO> warning = _penaltyDao.Where(s => s.AccountId == Session.Character.AccountId).Where(p => p.Penalty == PenaltyType.Warning);
            //            IEnumerable<PenaltyLogDTO> penaltyLogDtos = warning as IList<PenaltyLogDTO> ?? warning.ToList();
            //            if (penaltyLogDtos.Any())
            //            {
            //                Session.SendPacket(UserInterfaceHelper.Instance.GenerateInfo(string.Format(Language.Instance.GetMessageFromKey("WARNING_INFO"), penaltyLogDtos.Count())));
            //            }

            //            // finfo - friends info
            var mails = await _mailHttpClient.GetGiftsAsync(session.Character.CharacterId).ConfigureAwait(false);

            await session.Character.GenerateMailAsync(mails).ConfigureAwait(false);

            await session.SendPacketAsync(session.Character.GenerateTitle()).ConfigureAwait(false);

            int giftcount = mails.Select(s => s.MailDto).Count(mail => !mail.IsSenderCopy && mail.ReceiverId == session.Character.CharacterId && mail.ItemInstanceId != null && !mail.IsOpened);
            int mailcount = mails.Select(s => s.MailDto).Count(mail => !mail.IsSenderCopy && mail.ReceiverId == session.Character.CharacterId && mail.ItemInstanceId == null && !mail.IsOpened);

            if (giftcount > 0)
            {
                await session.SendPacketAsync(session.Character.GenerateSay(string.Format(GameLanguage.Instance.GetMessageFromKey(LanguageKey.GIFTED, session.Account.Language), giftcount), SayColorType.Purple)).ConfigureAwait(false);
            }
            if (mailcount > 0)
            {
                await session.SendPacketAsync(session.Character.GenerateSay(string.Format(GameLanguage.Instance.GetMessageFromKey(LanguageKey.NEW_MAIL, session.Account.Language), mailcount), SayColorType.Yellow)).ConfigureAwait(false);
            }

            //            Session.Character.DeleteTimeout();

            //            foreach (StaticBuffDTO sb in _staticBuffDao.Where(s => s.CharacterId == Session.Character.CharacterId))
            //            {
            //                Session.Character.AddStaticBuff(sb);
            //            }
            //            if (Session.Character.MapInstance.Map.MapTypes.Any(m => m.MapTypeId == (short)MapTypeEnum.Act4 || m.MapTypeId == (short)MapTypeEnum.Act42))
            //            {
            //                Session.Character.ConnectAct4();
            //            }
        }
Exemplo n.º 24
0
 public override Task ExecuteAsync(FStashEndPacket packet, ClientSession clientSession)
 {
     return(Task.CompletedTask);
 }
Exemplo n.º 25
0
        public override async Task ExecuteAsync(CScalcPacket packet, ClientSession clientSession)
        {
            var bz = await _bazaarHttpClient.GetBazaarLinkAsync(packet.BazaarId).ConfigureAwait(false);

            if ((bz != null) && (bz.SellerName == clientSession.Character.Name))
            {
                var soldedamount = bz.BazaarItem !.Amount - bz.ItemInstance !.Amount;
                var taxes        = bz.BazaarItem.MedalUsed ? (short)0 : (short)(bz.BazaarItem.Price * 0.10 * soldedamount);
                var price        = bz.BazaarItem.Price * soldedamount - taxes;
                if (clientSession.Character.InventoryService.CanAddItem(bz.ItemInstance.ItemVNum))
                {
                    if (clientSession.Character.Gold + price <= _worldConfiguration.Value.MaxGoldAmount)
                    {
                        clientSession.Character.Gold += price;
                        await clientSession.SendPacketAsync(clientSession.Character.GenerateGold()).ConfigureAwait(false);

                        await clientSession.SendPacketAsync(clientSession.Character.GenerateSay(string.Format(
                                                                                                    GameLanguage.Instance.GetMessageFromKey(LanguageKey.REMOVE_FROM_BAZAAR,
                                                                                                                                            clientSession.Account.Language), price), SayColorType.Yellow)).ConfigureAwait(false);

                        var itemInstance = await _itemInstanceDao.FirstOrDefaultAsync(s => s !.Id == bz.ItemInstance.Id).ConfigureAwait(false);

                        if (itemInstance == null)
                        {
                            return;
                        }
                        var item = _itemProvider.Convert(itemInstance);
                        item.Id = Guid.NewGuid();

                        var newInv =
                            clientSession.Character.InventoryService.AddItemToPocket(
                                InventoryItemInstance.Create(item, clientSession.Character.CharacterId));
                        await clientSession.SendPacketAsync(newInv !.GeneratePocketChange()).ConfigureAwait(false);

                        var remove = await _bazaarHttpClient.RemoveAsync(packet.BazaarId, bz.ItemInstance.Amount,
                                                                         clientSession.Character.Name).ConfigureAwait(false);

                        if (remove)
                        {
                            await clientSession.SendPacketAsync(new RCScalcPacket
                            {
                                Type            = VisualType.Player,
                                Price           = bz.BazaarItem.Price,
                                RemainingAmount = (short)(bz.BazaarItem.Amount - bz.ItemInstance.Amount),
                                Amount          = bz.BazaarItem.Amount,
                                Taxes           = taxes,
                                Total           = price + taxes
                            }).ConfigureAwait(false);

                            await clientSession.HandlePacketsAsync(new[]
                                                                   { new CSListPacket {
                                                                         Index = 0, Filter = BazaarStatusType.Default
                                                                     } }).ConfigureAwait(false);

                            return;
                        }

                        _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.BAZAAR_DELETE_ERROR));
                    }
                    else
                    {
                        await clientSession.SendPacketAsync(new MsgiPacket
                        {
                            Message = Game18NConstString.MaxGoldReached,
                            Type    = MessageType.Whisper
                        }).ConfigureAwait(false);
                    }
                }
                else
                {
                    await clientSession.SendPacketAsync(new InfoiPacket
                    {
                        Message = Game18NConstString.NotEnoughSpace
                    }).ConfigureAwait(false);
                }

                await clientSession.SendPacketAsync(new RCScalcPacket
                {
                    Type   = VisualType.Player, Price = bz.BazaarItem.Price, RemainingAmount = 0,
                    Amount = bz.BazaarItem.Amount, Taxes = 0, Total = 0
                }).ConfigureAwait(false);
            }
            else
            {
                await clientSession.SendPacketAsync(new RCScalcPacket
                                                    { Type = VisualType.Player, Price = 0, RemainingAmount = 0, Amount = 0, Taxes = 0, Total = 0 }).ConfigureAwait(false);
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 无效实例产生时调用
        /// </summary>
        public NetState()
        {
            m_Socket = null;
            m_IPToString = "0.0.0.0";
            m_NextCheckActivity = DateTime.MaxValue;

            m_NetAddress = new IPEndPoint(IPAddress.None, 0);
        }
Exemplo n.º 27
0
 public HomeSystemPacketHandler(ClientSession session) => _session = session;
Exemplo n.º 28
0
 public void Handle(ClientSession session, IncomingMessage message)
 {
     session.LastPing.Restart();
     session.SendPacket(PingOutgoingMessage.Instance);
 }
Exemplo n.º 29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     clientSession = (ClientSession)AuthorizationManager.GetCurrentSessionObject(Context, false);
     if (!IsPostBack)
     {
         ddlOrderStatus.SelectedValue = "1";
         RpOrderDataBind(OrderStatus.WAIT_SUBMIT);
     }
 }
        private void ExecuteHandler(ClientSession session)
        {
            PenaltyLogDTO penalty = session.Account.PenaltyLogs.OrderByDescending(s => s.DateEnd).FirstOrDefault();

            if (session.Character.IsMuted() && penalty != null)
            {
                if (session.Character.Gender == GenderType.Female)
                {
                    session.CurrentMapInstance?.Broadcast(
                        session.Character.GenerateSay(Language.Instance.GetMessageFromKey("MUTED_FEMALE"), 1));
                    session.SendPacket(session.Character.GenerateSay(
                                           string.Format(Language.Instance.GetMessageFromKey("MUTE_TIME"),
                                                         (penalty.DateEnd - DateTime.UtcNow).ToString("hh\\:mm\\:ss")), 11));
                }
                else
                {
                    session.CurrentMapInstance?.Broadcast(
                        session.Character.GenerateSay(Language.Instance.GetMessageFromKey("MUTED_MALE"), 1));
                    session.SendPacket(session.Character.GenerateSay(
                                           string.Format(Language.Instance.GetMessageFromKey("MUTE_TIME"),
                                                         (penalty.DateEnd - DateTime.UtcNow).ToString("hh\\:mm\\:ss")), 11));
                }

                return;
            }

            Mate attacker = session.Character.Mates.First(x => x.MateTransportId == MateTransportId);

            if (attacker != null)
            {
                switch (TargetType)
                {
                case UserType.Monster:
                    if (attacker.IsAlive)
                    {
                        MapMonster      target = session.CurrentMapInstance?.GetMonster(TargetId);
                        NpcMonsterSkill skill  = attacker.Monster.Skills.Find(x => x.NpcMonsterSkillId == CastId);
                        session.AttackMonster(attacker, skill?.Skill, target);
                    }
                    return;

                case UserType.Player:
                    if (attacker.IsAlive)
                    {
                        Character target = session.CurrentMapInstance?.GetSessionByCharacterId(TargetId)
                                           ?.Character;
                        if (target != null && session.CurrentMapInstance != null &&
                            ((target.Session.CurrentMapInstance == session.CurrentMapInstance &&
                              target.CharacterId != session.Character.CharacterId &&
                              session.CurrentMapInstance.Map.MapTypes.Any(s =>
                                                                          s.MapTypeId == (short)MapTypeEnum.Act4) && session.Character.Faction
                              != target.Faction && session.CurrentMapInstance.Map
                              .MapId != 130 && session.CurrentMapInstance.Map
                              .MapId != 131) ||
                             (session.CurrentMapInstance.Map.MapTypes.Any(m =>
                                                                          m.MapTypeId == (short)MapTypeEnum.PvpMap) &&
                              (session.Character.Group?
                               .IsMemberOfGroup(
                                   target.CharacterId) != true)) ||
                             (session.CurrentMapInstance.IsPvp && (session.Character.Group?.IsMemberOfGroup(
                                                                       target.CharacterId) != true))))
                        {
                            NpcMonsterSkill skill = attacker.Monster.Skills.Find(x => x.NpcMonsterSkillId == CastId);
                            session.AttackCharacter(attacker, skill?.Skill, target);
                        }
                    }
                    return;

                case UserType.Npc:
                case UserType.Object:
                    return;
                }
            }
        }
Exemplo n.º 31
0
        private void ExecuteHandler(ClientSession session)
        {
            BazaarItemDTO bzItem = DAOFactory.BazaarItemDAO.LoadById(BazaarId);

            if (bzItem != null && Amount > 0)
            {
                long price = Amount * bzItem.Price;

                if (session.Character.Gold >= price)
                {
                    BazaarItemLink bzItemLink = new BazaarItemLink {
                        BazaarItem = bzItem
                    };
                    if (DAOFactory.CharacterDAO.LoadById(bzItem.SellerId) != null)
                    {
                        bzItemLink.OwnerName = DAOFactory.CharacterDAO.LoadById(bzItem.SellerId)?.Name;
                        bzItemLink.Item      = new ItemInstance(DAOFactory.ItemInstanceDAO.LoadById(bzItem.ItemInstanceId));
                    }
                    else
                    {
                        return;
                    }

                    if (Amount <= bzItemLink.Item.Amount)
                    {
                        if (!session.Character.Inventory.CanAddItem(bzItemLink.Item.ItemVNum))
                        {
                            session.SendPacket(
                                UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("NOT_ENOUGH_PLACE"),
                                                                0));
                            return;
                        }
                        if (bzItemLink.Item == null || (bzItem.IsPackage && Amount != bzItem.Amount))
                        {
                            return;
                        }

                        ItemInstance itemInstance =
                            new ItemInstance(DAOFactory.ItemInstanceDAO.LoadById(bzItemLink.BazaarItem.ItemInstanceId));
                        if (Amount > itemInstance.Amount)
                        {
                            return;
                        }

                        itemInstance.Amount    -= Amount;
                        session.Character.Gold -= price;
                        session.SendPacket(session.Character.GenerateGold());
                        DAOFactory.ItemInstanceDAO.InsertOrUpdate(itemInstance);
                        ServerManager.Instance.BazaarRefresh(bzItemLink.BazaarItem.BazaarItemId);
                        session.SendPacket(
                            $"rc_buy 1 {itemInstance.ItemVNum} {bzItemLink.OwnerName} {Amount} {Price} 0 0 0");

                        ItemInstance newBz = bzItemLink.Item.DeepCopy();
                        newBz.Id     = Guid.NewGuid();
                        newBz.Amount = Amount;
                        newBz.Type   = newBz.Item.Type;
                        List <ItemInstance> newInv = session.Character.Inventory.AddToInventory(newBz);

                        if (newInv.Count > 0)
                        {
                            session.SendPacket(session.Character.GenerateSay(
                                                   $"{Language.Instance.GetMessageFromKey("ITEM_ACQUIRED")}: {itemInstance.Item.Name} x {Amount}",
                                                   10));
                        }

                        GameLogger.Instance.LogBazaarBuy(ServerManager.Instance.ChannelId, session.Character.Name,
                                                         session.Character.CharacterId, bzItem, itemInstance.ItemVNum, Amount, price);
                    }
                    else
                    {
                        session.SendPacket(
                            UserInterfaceHelper.GenerateModal(Language.Instance.GetMessageFromKey("STATE_CHANGED"), 1));
                    }
                }
                else
                {
                    session.SendPacket(
                        session.Character.GenerateSay(Language.Instance.GetMessageFromKey("NOT_ENOUGH_MONEY"), 10));
                    session.SendPacket(
                        UserInterfaceHelper.GenerateModal(Language.Instance.GetMessageFromKey("NOT_ENOUGH_MONEY"), 1));
                }
            }
            else
            {
                session.SendPacket(
                    UserInterfaceHelper.GenerateModal(Language.Instance.GetMessageFromKey("STATE_CHANGED"), 1));
            }
        }
Exemplo n.º 32
0
        public override async Task ExecuteAsync(ExchangeRequestPacket packet, ClientSession clientSession)
        {
            var target = Broadcaster.Instance.GetCharacter(s =>
                                                           (s.VisualId == packet.VisualId) &&
                                                           (s.MapInstanceId == clientSession.Character.MapInstanceId)) as Character;
            ExcClosePacket closeExchange;

            if ((target != null) && ((packet.RequestType == RequestExchangeType.Confirmed) ||
                                     (packet.RequestType == RequestExchangeType.Cancelled)))
            {
                _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.CANT_FIND_CHARACTER));
                return;
            }

            if (clientSession.Character.InShop || (target?.InShop ?? false))
            {
                _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.PLAYER_IN_SHOP));
                return;
            }

            switch (packet.RequestType)
            {
            case RequestExchangeType.Requested:
                if (_exchangeProvider.CheckExchange(clientSession.Character.CharacterId) ||
                    _exchangeProvider.CheckExchange(target?.VisualId ?? 0))
                {
                    await clientSession.SendPacketAsync(new MsgPacket
                    {
                        Message = GameLanguage.Instance.GetMessageFromKey(LanguageKey.ALREADY_EXCHANGE,
                                                                          clientSession.Account.Language),
                        Type = MessageType.White
                    }).ConfigureAwait(false);

                    return;
                }

                if (target?.ExchangeBlocked ?? true)
                {
                    await clientSession.SendPacketAsync(clientSession.Character.GenerateSay(
                                                            GameLanguage.Instance.GetMessageFromKey(LanguageKey.EXCHANGE_BLOCKED,
                                                                                                    clientSession.Account.Language),
                                                            SayColorType.Purple)).ConfigureAwait(false);

                    return;
                }

                var blacklisteds = await _blacklistHttpClient.GetBlackListsAsync(clientSession.Character.VisualId).ConfigureAwait(false);

                if (blacklisteds.Any(s => s.CharacterId == target.VisualId))
                {
                    await clientSession.SendPacketAsync(new InfoPacket
                    {
                        Message = GameLanguage.Instance.GetMessageFromKey(LanguageKey.BLACKLIST_BLOCKED,
                                                                          clientSession.Account.Language)
                    }).ConfigureAwait(false);

                    return;
                }

                if (clientSession.Character.InShop || target.InShop)
                {
                    await clientSession.SendPacketAsync(new MsgPacket
                    {
                        Message =
                            GameLanguage.Instance.GetMessageFromKey(LanguageKey.HAS_SHOP_OPENED,
                                                                    clientSession.Account.Language),
                        Type = MessageType.White
                    }).ConfigureAwait(false);

                    return;
                }

                await clientSession.SendPacketAsync(new ModalPacket
                {
                    Message = string.Format(GameLanguage.Instance.GetMessageFromKey(LanguageKey.YOU_ASK_FOR_EXCHANGE,
                                                                                    clientSession.Account.Language), target.Name),
                    Type = 0
                }).ConfigureAwait(false);

                await target.SendPacketAsync(new DlgPacket
                {
                    YesPacket = new ExchangeRequestPacket
                    {
                        RequestType = RequestExchangeType.List, VisualId = clientSession.Character.VisualId
                    },
                    NoPacket = new ExchangeRequestPacket
                    {
                        RequestType = RequestExchangeType.Declined, VisualId = clientSession.Character.VisualId
                    },
                    Question = string.Format(GameLanguage.Instance.GetMessageFromKey(LanguageKey.INCOMING_EXCHANGE,
                                                                                     clientSession.Account.Language), clientSession.Character.Name)
                }).ConfigureAwait(false);

                return;

            case RequestExchangeType.List:
                if (!_exchangeProvider.OpenExchange(clientSession.Character.VisualId, target?.CharacterId ?? 0))
                {
                    return;
                }

                await clientSession.SendPacketAsync(clientSession.Character.GenerateServerExcListPacket(null, null, null)).ConfigureAwait(false);

                await(target == null ? Task.CompletedTask : target.SendPacketAsync(target.GenerateServerExcListPacket(null, null, null))).ConfigureAwait(false);
                return;

            case RequestExchangeType.Declined:
                await clientSession.SendPacketAsync(clientSession.Character.GenerateSay(
                                                        GameLanguage.Instance.GetMessageFromKey(LanguageKey.EXCHANGE_REFUSED,
                                                                                                clientSession.Account.Language),
                                                        SayColorType.Yellow)).ConfigureAwait(false);

                await(target == null ? Task.CompletedTask : target.SendPacketAsync(target.GenerateSay(target.GetMessageFromKey(LanguageKey.EXCHANGE_REFUSED),
                                                                                                      SayColorType.Yellow))).ConfigureAwait(false);
                return;

            case RequestExchangeType.Confirmed:
                var targetId = _exchangeProvider.GetTargetId(clientSession.Character.CharacterId);

                if (!targetId.HasValue)
                {
                    _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.INVALID_EXCHANGE));
                    return;
                }

                var exchangeTarget = Broadcaster.Instance.GetCharacter(s =>
                                                                       (s.VisualId == targetId.Value) && (s.MapInstance == clientSession.Character.MapInstance));

                if (exchangeTarget == null)
                {
                    _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.CANT_FIND_CHARACTER));
                    return;
                }

                _exchangeProvider.ConfirmExchange(clientSession.Character.VisualId);

                if (!_exchangeProvider.IsExchangeConfirmed(clientSession.Character.VisualId) ||
                    !_exchangeProvider.IsExchangeConfirmed(exchangeTarget.VisualId))
                {
                    await clientSession.SendPacketAsync(new InfoPacket
                    {
                        Message = string.Format(GameLanguage.Instance.GetMessageFromKey(LanguageKey.IN_WAITING_FOR,
                                                                                        clientSession.Account.Language), exchangeTarget.Name)
                    }).ConfigureAwait(false);

                    return;
                }

                var success = _exchangeProvider.ValidateExchange(clientSession, exchangeTarget);

                if (success.Item1 == ExchangeResultType.Success)
                {
                    foreach (var infoPacket in success.Item2 !)
                    {
                        if (infoPacket.Key == clientSession.Character.CharacterId)
                        {
                            await clientSession.SendPacketAsync(infoPacket.Value).ConfigureAwait(false);
                        }
                        else if (infoPacket.Key == exchangeTarget.VisualId)
                        {
                            await exchangeTarget.SendPacketAsync(infoPacket.Value).ConfigureAwait(false);
                        }
                        else
                        {
                            _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.INVALID_EXCHANGE));
                        }
                    }
                }
                else
                {
                    var itemList = _exchangeProvider.ProcessExchange(clientSession.Character.VisualId,
                                                                     exchangeTarget.VisualId, clientSession.Character.InventoryService, exchangeTarget.InventoryService);

                    foreach (var item in itemList)
                    {
                        if (item.Key == clientSession.Character.CharacterId)
                        {
                            await clientSession.SendPacketAsync(item.Value).ConfigureAwait(false);
                        }
                        else
                        {
                            await exchangeTarget.SendPacketAsync(item.Value).ConfigureAwait(false);
                        }
                    }

                    var getSessionData = _exchangeProvider.GetData(clientSession.Character.CharacterId);
                    await clientSession.Character.RemoveGoldAsync(getSessionData.Gold).ConfigureAwait(false);

                    clientSession.Character.RemoveBankGold(getSessionData.BankGold * 1000);

                    await exchangeTarget.AddGoldAsync(getSessionData.Gold).ConfigureAwait(false);

                    exchangeTarget.AddBankGold(getSessionData.BankGold * 1000);

                    var getTargetData = _exchangeProvider.GetData(exchangeTarget.VisualId);
                    await exchangeTarget.RemoveGoldAsync(getTargetData.Gold).ConfigureAwait(false);

                    exchangeTarget.RemoveBankGold(getTargetData.BankGold * 1000);

                    await clientSession.Character.AddGoldAsync(getTargetData.Gold).ConfigureAwait(false);

                    clientSession.Character.AddBankGold(getTargetData.BankGold * 1000);
                }

                closeExchange = _exchangeProvider.CloseExchange(clientSession.Character.VisualId, success.Item1) !;
                await exchangeTarget.SendPacketAsync(closeExchange).ConfigureAwait(false);

                await clientSession.SendPacketAsync(closeExchange).ConfigureAwait(false);

                return;

            case RequestExchangeType.Cancelled:
                var cancelId = _exchangeProvider.GetTargetId(clientSession.Character.CharacterId);
                if (!cancelId.HasValue)
                {
                    _logger.Error(LogLanguage.Instance.GetMessageFromKey(LogLanguageKey.USER_NOT_IN_EXCHANGE));
                    return;
                }

                var cancelTarget = Broadcaster.Instance.GetCharacter(s => s.VisualId == cancelId.Value);

                closeExchange =
                    _exchangeProvider.CloseExchange(clientSession.Character.VisualId, ExchangeResultType.Failure) !;
                cancelTarget?.SendPacketAsync(closeExchange);
                await clientSession.SendPacketAsync(closeExchange).ConfigureAwait(false);

                return;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public void Call(TaCallPacket packet)
        {
            ConcurrentBag <ArenaTeamMember> arenateam = ServerManager.Instance.ArenaTeams.FirstOrDefault(s => s.Any(o => o.Session == Session));

            if (arenateam == null || Session.CurrentMapInstance.MapInstanceType != MapInstanceType.TalentArenaMapInstance)
            {
                return;
            }
            IEnumerable <ArenaTeamMember> ownteam = arenateam.Where(s => s.ArenaTeamType == arenateam?.FirstOrDefault(e => e.Session == Session)?.ArenaTeamType);
            ClientSession   client = ownteam.Where(s => s.Session != Session).OrderBy(s => s.Order).Skip(packet.CalledIndex).FirstOrDefault()?.Session;
            ArenaTeamMember memb   = arenateam.FirstOrDefault(s => s.Session == client);

            if (client == null || client.CurrentMapInstance != Session.CurrentMapInstance || memb == null || memb.LastSummoned != null || ownteam.Sum(s => s.SummonCount) >= 5)
            {
                return;
            }
            memb.SummonCount++;
            arenateam.ToList().ForEach(arenauser => { arenauser.Session.SendPacket(arenauser.Session.Character.GenerateTaP(2, true)); });
            ArenaTeamMember arenaTeamMember = arenateam.FirstOrDefault(s => s.Session == client);

            if (arenaTeamMember != null)
            {
                arenaTeamMember.LastSummoned = DateTime.Now;
            }
            Session.CurrentMapInstance.Broadcast(Session.Character.GenerateEff(4432));
            for (int i = 0; i < 3; i++)
            {
                Observable.Timer(TimeSpan.FromSeconds(i)).Subscribe(o =>
                {
                    client.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(string.Format(Language.Instance.GetMessageFromKey("ARENA_CALLED"), 3 - i), 0));
                    client.SendPacket(client.Character.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("ARENA_CALLED"), 3 - i), 10));
                });
            }
            short      x     = Session.Character.PositionX;
            short      y     = Session.Character.PositionY;
            const byte timer = 30;

            Observable.Timer(TimeSpan.FromSeconds(3)).Subscribe(o =>
            {
                Session.CurrentMapInstance.Broadcast($"ta_t 0 {client.Character.CharacterId} {timer}");
                client.Character.PositionX = x;
                client.Character.PositionY = y;
                Session.CurrentMapInstance.Broadcast(client.Character.GenerateTp());

                client.SendPacket(UserInterfaceHelper.Instance.GenerateTaSt(TalentArenaOptionType.Nothing));
            });

            Observable.Timer(TimeSpan.FromSeconds(timer + 3)).Subscribe(o =>
            {
                DateTime?lastsummoned = arenateam.FirstOrDefault(s => s.Session == client)?.LastSummoned;
                if (lastsummoned == null || ((DateTime)lastsummoned).AddSeconds(timer) >= DateTime.Now)
                {
                    return;
                }
                ArenaTeamMember firstOrDefault = arenateam.FirstOrDefault(s => s.Session == client);
                if (firstOrDefault != null)
                {
                    firstOrDefault.LastSummoned = null;
                }
                client.Character.PositionX = memb.ArenaTeamType == ArenaTeamType.ERENIA ? (short)120 : (short)19;
                client.Character.PositionY = memb.ArenaTeamType == ArenaTeamType.ERENIA ? (short)39 : (short)40;
                Session?.CurrentMapInstance.Broadcast(client.Character.GenerateTp());
                client.SendPacket(UserInterfaceHelper.Instance.GenerateTaSt(TalentArenaOptionType.Watch));
            });
        }
Exemplo n.º 34
0
        /// <summary>
        /// 有实例产生时调用
        /// </summary>
        /// <param name="clientSocket"></param>
        /// <param name="world"></param>
        public NetState(ClientSession<NetState> clientSocket, WorldBase world)
            : this()
        {
            if (clientSocket == null)
                throw new ArgumentNullException("clientSocket", "NetState.NetState(...) - clientSocket == null error!");

            m_Socket = clientSocket;

            IPAddress ipAddress;
            IPAddress.TryParse(clientSocket.RemoteOnlyIP, out ipAddress);

            if (ipAddress == null)
                m_NetAddress = new IPEndPoint(IPAddress.None, clientSocket.RemotePort);
            else
                m_NetAddress = new IPEndPoint(ipAddress, clientSocket.RemotePort);
            World = world;

            ReceiveBuffer = new ReceiveQueue();
        }
Exemplo n.º 35
0
 public BazaarPacketHandler(ClientSession session) => Session = session;
Exemplo n.º 36
0
 public void SetClientSession(object clientSession)
 {
     _clientSession = (ClientSession)clientSession;
 }
Exemplo n.º 37
0
 public override Task ExecuteAsync(FReposPacket freposPacket, ClientSession clientSession)
 {
     return(Task.CompletedTask);
 }
 public MinilandPacketHandler(ClientSession session) => Session = session;
Exemplo n.º 39
0
        private void Save()
        {
            if (string.IsNullOrEmpty(txtCode.Text.Trim()) || string.IsNullOrEmpty(txtCommonName.Text.Trim()) || string.IsNullOrEmpty(txtModeName.Text.Trim()) || string.IsNullOrEmpty(txtSpecName.Text.Trim()) || string.IsNullOrEmpty(teBASEMEASURE.Text.Trim()) || string.IsNullOrEmpty(teBASEMEASURESPEC.Text.Trim()))
            {
                XtraMessageBox.Show("带 * 为必填项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (issaved == false)
            {
                //定义对接产品对照表实体类
                productmapitemOper = new Gpo_Product_MapModel();

                LogedInUser CurrentUser = ClientSession.GetInstance().CurrentUser;

                productmapitemOper.IsMap = "0";//未匹配

                DataRow crow = gridView3.GetDataRow(gridView3.FocusedRowHandle);
                if (crow != null)
                {
                    productmapitemOper.ProductID  = crow["PROJECT_PROD_ID"].ToString(); //产品ID
                    productmapitemOper.Map_Orgid  = CurrentUser.UserOrg.Id;
                    productmapitemOper.Sender_Id  = crow["Sender_Id"].ToString();       //配送企业ID
                    productmapitemOper.Factory_Id = crow["Factory_Id"].ToString();      //生产企业ID
                    productmapitemOper.HH_Mode_ID = crow["MODEL_ID"].ToString();        //客户端型号ID
                    productmapitemOper.HH_Spec_ID = crow["SPEC_ID"].ToString();         //客户端规格ID

                    productmapitemOper.IsMap = "1";                                     //已匹配
                }
                else
                {
                    productmapitemOper.ProductID  = "0"; //产品ID
                    productmapitemOper.Map_Orgid  = CurrentUser.UserOrg.Id;
                    productmapitemOper.Sender_Id  = "0"; //配送企业ID
                    productmapitemOper.Factory_Id = "0"; //生产企业ID
                    productmapitemOper.HH_Mode_ID = "0"; //客户端型号ID
                    productmapitemOper.HH_Spec_ID = "0"; //客户端规格ID

                    productmapitemOper.IsMap = "0";      //未匹配
                }
                productmapitemOper.ID          = this.strID;
                productmapitemOper.ProductCode = this.txtCode.Text;
                productmapitemOper.CommonName  = this.txtCommonName.Text;

                productmapitemOper.Product_Name = this.txtName.Text;
                productmapitemOper.CommerceName = this.teCName.Text;


                productmapitemOper.Brand = this.txtBrand.Text;

                productmapitemOper.Mode_ID   = this.teMODELID.Text;
                productmapitemOper.Mode_Name = this.txtModeName.Text;

                productmapitemOper.Spec_Unit_Id      = this.teSPEC_ID.Text;
                productmapitemOper.Spec_Unit         = this.txtSpecName.Text;
                productmapitemOper.Base_measure      = this.teBASEMEASURE.Text;
                productmapitemOper.Base_measure_spec = this.teBASEMEASURESPEC.Text;
                productmapitemOper.Base_measure_mate = this.teBASEMEASUREMATE.Text;

                productmapitemOper.Stand_Rate   = this.teSTANDRATE.Text;
                productmapitemOper.Factory_Code = this.teFACTORYCODE.Text;
                productmapitemOper.Factory_Name = this.teFACTORYName.Text;
                productmapitemOper.Saler_Name   = this.teSALERNAME.Text;
                productmapitemOper.Saler_Code   = this.teSALERCODE.Text;
                productmapitemOper.Sender_Code  = this.teSENDERCODE.Text;
                productmapitemOper.Sender_Name  = this.teSENDERNAME.Text;

                productmapitemOper.Stock_Id   = this.teSTOCKID.Text;
                productmapitemOper.Stock_Name = this.teSTOCKNAME.Text;
                productmapitemOper.User       = CurrentUser;

                productmapitemOper.Remark = this.txtRemark.Text;

                //是否阅读
                if (this.cbxRead.Checked == true)
                {
                    productmapitemOper.ProcessFlag = "1";
                }
                else
                {
                    productmapitemOper.ProcessFlag = "0";
                }
                //判断是否作插入操作还是修改操作

                if (IsAdd == true)
                {
                    SaveAdd(productmapitemOper);
                }
                else if (IsAdd == false)
                {
                    SaveUpdate(productmapitemOper);
                }
            }
        }
Exemplo n.º 40
0
        public void Process0x0A(ClientSession session, bool isSend = true)
        {
            if (_dic0x0A.ContainsKey(session))
            {
                if (_dic0x0A[session].Frames != null && _dic0x0A[session].Frames.Count > 0)
                {
                    if (!isSend)
                    {
                        _dic0x0A[session].ThongSoFrame.FrameReceiveCount++;
                        var thongSo = _dic0x0A[session].ThongSoFrame;

                        OnUpdateThongSo(session.SessionID, thongSo.FrameSendCount, thongSo.FrameReceiveCount, thongSo.FrameTotal, thongSo.State);
                    }

                    int index = _dic0x0A[session].Index;

                    Frame frame = new Frame()
                    {
                        Code = Constants.Hx0A,
                    };

                    byte soXe = Constants.Hx01;

                    if (index < _dic0x0A[session].Frames.Count)
                    {
                        frame.Data    = new byte[_dic0x0A[session].Frames[index].Data.Length + 5];
                        frame.Data[0] = soXe;                     //Số xe
                        frame.Data[1] = Constants.Hx00;           //N1
                        frame.Data[2] = Constants.Hx00;           //N2
                        frame.Data[3] = (byte)index.LengthLow();  //byte thấp chỉ số frame
                        frame.Data[4] = (byte)index.LengthHigh(); //byte cao chỉ số frame
                        for (int k = 5; k < _dic0x0A[session].Frames[index].Data.Length + 5; k++)
                        {
                            frame.Data[k] = _dic0x0A[session].Frames[index].Data[k - 5];
                        }
                    }
                    else if (index == _dic0x0A[session].Frames.Count) //Frame nhận biết hết dữ liệu
                    {
                        frame.Data    = new byte[5];
                        frame.Data[0] = soXe;           //Số xe
                        frame.Data[1] = Constants.Hx00; //N1
                        frame.Data[2] = Constants.Hx00; //N2
                        frame.Data[3] = Constants.HxFF; //byte thấp chỉ số frame
                        frame.Data[4] = Constants.HxFF; //byte cao chỉ số frame
                    }

                    if (index <= _dic0x0A[session].Frames.Count)
                    {
                        Server.SendMsg(session, frame.Get());

                        _dic0x0A[session].ThongSoFrame.FrameSendCount++;
                        var thongSo = _dic0x0A[session].ThongSoFrame;

                        OnUpdateThongSo(session.SessionID, thongSo.FrameSendCount, thongSo.FrameReceiveCount, thongSo.FrameTotal, thongSo.State);

                        _dic0x0A[session].Index++;
                        if (index == _dic0x0A[session].Frames.Count)
                        {
                            _dic0x0A[session].Index = 0;
                        }
                    }
                }
            }
        }
Exemplo n.º 41
0
 public override Task ExecuteAsync(GuriPacket guriPacket, ClientSession session)
 {
     _guriProvider.GuriLaunch(session, guriPacket);
     return(Task.CompletedTask);
 }
Exemplo n.º 42
0
 public override Task ExecuteAsync(WithdrawPacket withdrawPacket, ClientSession clientSession)
 {
     return(Task.CompletedTask);
 }
Exemplo n.º 43
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            if (dataGridView.Rows.Count == 0)
            {
                return;
            }

            bool flag = true;
            IList <Gpo_Product_MapModel> productModelList = new List <Gpo_Product_MapModel>();

            try
            {
                foreach (DataGridViewRow row in this.dataGridView.Rows)
                {
                    if (row.Cells[0].Value != null && row.Cells[0].Value.ToString().ToLower() == "true")
                    {
                        Gpo_Product_MapModel model = new Gpo_Product_MapModel();
                        model.ProductCode     = row.Cells["PRODUCT_CODE"].Value.ToString();
                        model.MedicalCode     = row.Cells["MEDICAL_CODE"].Value.ToString();
                        model.CommonName      = row.Cells["COMMON_NAME"].Value.ToString();
                        model.Product_Name    = row.Cells["PRODUCT_NAME"].Value.ToString();
                        model.Mode_ID         = row.Cells["MODE_ID"].Value.ToString();
                        model.Mode_Name       = row.Cells["MODE_NAME"].Value.ToString();
                        model.Medical_Spec_Id = row.Cells["MEDICAL_SPEC_ID"].Value.ToString();
                        model.Medical_Spec    = row.Cells["MEDICAL_SPEC"].Value.ToString();
                        model.UseUnitCode     = row.Cells["USE_UNIT_ID"].Value.ToString();
                        model.Use_Unit        = row.Cells["USE_UNIT"].Value.ToString();
                        model.Spec_Unit_Id    = row.Cells["SPEC_UNIT_ID"].Value.ToString();
                        model.Spec_Unit       = row.Cells["SPEC_UNIT"].Value.ToString();

                        model.Stand_Rate    = row.Cells["STAND_RATE"].Value.ToString();
                        model.Factory_Code  = row.Cells["FACTORY_CODE"].Value.ToString();
                        model.Factory_Name  = row.Cells["FACTORY_NAME"].Value.ToString();
                        model.ProductID     = row.Cells["product_id"].Value.ToString();
                        model.DataProductID = row.Cells["data_product_id"].Value.ToString();

                        model.Permit_No     = row.Cells["PERMIT_NO"].Value.ToString();
                        model.Saler_Code    = row.Cells["SALER_CODE"].Value.ToString();
                        model.Saler_Name    = row.Cells["SALER_NAME"].Value.ToString();
                        model.Sender_Code   = row.Cells["SENDER_CODE"].Value.ToString();
                        model.Sender_Name   = row.Cells["SENDER_NAME"].Value.ToString();
                        model.Category_Id   = row.Cells["CATEGORY_ID"].Value.ToString();
                        model.Category_Name = row.Cells["CATEGORY_NAME"].Value.ToString();
                        model.Stock_Id      = row.Cells["STOCK_ID"].Value.ToString();
                        model.Stock_Name    = row.Cells["STOCK_NAME"].Value.ToString();
                        model.Package_Rate  = string.IsNullOrEmpty(row.Cells["PACKAGE_RATE"].Value.ToString()) ? "1" : row.Cells["PACKAGE_RATE"].Value.ToString();

                        productModelList.Add(model);
                    }
                }

                if (productModelList.Count == 0)
                {
                    ComUtil.MsgBox("请选择所要的导入产品信息!");
                    return;
                }
                //获取当前用户ORGID
                string orgid = ClientSession.GetInstance().CurrentUser.UserOrg.Reg_org_id.ToString();

                flag = ProductCodeCompareBLL.GetInstance("ClientDB").Import_Gpo_Product(orgid, productModelList);

                if (flag == true)
                {
                    ComUtil.MsgBox("导入产品信息成功!");
                }
                else
                {
                    ComUtil.MsgBox("导入产品信息失败!");
                }
            }catch (Exception ex)
            {
                ComUtil.MsgBox("导入产品信息失败!");
                //throw ex;
            }
        }
        private void ExecuteHandler(ClientSession session)
        {
            switch (Option)
            {
            case CharacterOption.BuffBlocked:
                session.Character.BuffBlocked = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.BuffBlocked
                            ? "BUFF_BLOCKED"
                            : "BUFF_UNLOCKED"), 0));
                break;

            case CharacterOption.EmoticonsBlocked:
                session.Character.EmoticonsBlocked = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.EmoticonsBlocked
                            ? "EMO_BLOCKED"
                            : "EMO_UNLOCKED"), 0));
                break;

            case CharacterOption.ExchangeBlocked:
                session.Character.ExchangeBlocked = !IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.ExchangeBlocked
                            ? "EXCHANGE_BLOCKED"
                            : "EXCHANGE_UNLOCKED"), 0));
                break;

            case CharacterOption.FriendRequestBlocked:
                session.Character.FriendRequestBlocked = !IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.FriendRequestBlocked
                            ? "FRIEND_REQ_BLOCKED"
                            : "FRIEND_REQ_UNLOCKED"), 0));
                break;

            case CharacterOption.GroupRequestBlocked:
                session.Character.GroupRequestBlocked = !IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.GroupRequestBlocked
                            ? "GROUP_REQ_BLOCKED"
                            : "GROUP_REQ_UNLOCKED"), 0));
                break;

            case CharacterOption.HeroChatBlocked:
                session.Character.HeroChatBlocked = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.HeroChatBlocked
                            ? "HERO_CHAT_BLOCKED"
                            : "HERO_CHAT_UNLOCKED"), 0));
                break;

            case CharacterOption.HpBlocked:
                session.Character.HpBlocked = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.HpBlocked ? "HP_BLOCKED" : "HP_UNLOCKED"),
                                       0));
                break;

            case CharacterOption.MinilandInviteBlocked:
                session.Character.MinilandInviteBlocked = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.MinilandInviteBlocked
                            ? "MINI_INV_BLOCKED"
                            : "MINI_INV_UNLOCKED"), 0));
                break;

            case CharacterOption.MouseAimLock:
                session.Character.MouseAimLock = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.MouseAimLock
                            ? "MOUSE_LOCKED"
                            : "MOUSE_UNLOCKED"), 0));
                break;

            case CharacterOption.QuickGetUp:
                session.Character.QuickGetUp = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.QuickGetUp
                            ? "QUICK_GET_UP_ENABLED"
                            : "QUICK_GET_UP_DISABLED"), 0));
                break;

            case CharacterOption.WhisperBlocked:
                session.Character.WhisperBlocked = !IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.WhisperBlocked
                            ? "WHISPER_BLOCKED"
                            : "WHISPER_UNLOCKED"), 0));
                break;

            case CharacterOption.FamilyRequestBlocked:
                session.Character.FamilyRequestBlocked = !IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.FamilyRequestBlocked
                            ? "FAMILY_REQ_LOCKED"
                            : "FAMILY_REQ_UNLOCKED"), 0));
                break;

            case CharacterOption.GroupSharing:
                Group grp = ServerManager.Instance.Groups.Find(
                    g => g.IsMemberOfGroup(session.Character.CharacterId));
                if (grp == null)
                {
                    return;
                }

                if (!grp.IsLeader(session))
                {
                    session.SendPacket(
                        UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("NOT_MASTER"), 0));
                    return;
                }

                if (!IsActive)
                {
                    Group group =
                        ServerManager.Instance.Groups.Find(s => s.IsMemberOfGroup(session.Character.CharacterId));
                    if (group != null)
                    {
                        group.SharingMode = 1;
                    }

                    session.CurrentMapInstance?.Broadcast(session,
                                                          UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("SHARING"), 0),
                                                          ReceiverType.Group);
                }
                else
                {
                    Group group =
                        ServerManager.Instance.Groups.Find(s => s.IsMemberOfGroup(session.Character.CharacterId));
                    if (group != null)
                    {
                        group.SharingMode = 0;
                    }

                    session.CurrentMapInstance?.Broadcast(session,
                                                          UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("SHARING_BY_ORDER"), 0),
                                                          ReceiverType.Group);
                }

                break;

            case CharacterOption.AllowRevivalPet:
                session.Character.IsPetAutoRelive = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.IsPetAutoRelive
                                ? "REVIVAL_THIS_PET"
                                : "NOT_REVIVAL_THIS_PET"), 0));
                break;

            case CharacterOption.AllowRevivalPartner:
                session.Character.IsPartnerAutoRelive = IsActive;
                session.SendPacket(UserInterfaceHelper.GenerateMsg(
                                       Language.Instance.GetMessageFromKey(session.Character.IsPartnerAutoRelive
                            ? "REVIVAL_THIS_PARTNER"
                            : "NOT_REVIVAL_THIS_PARTNER"), 0));
                break;
            }

            session.SendPacket(session.Character.GenerateStat());
        }
Exemplo n.º 45
0
 public override void Execute(ClientSession client)
 {
     QuoteFunctions.SwitchQuotesToBidAsk("%:Future:%", IncludeFilter, "Bloomberg");
     QuoteFunctions.SwitchQuotesToBidAsk("%:ListedOption:%", IncludeFilter, "Bloomberg");
     /*
     ObsoleteStrategy("BMASWEU1", "SYM_BM");
     ObsoleteStrategy("BMASWGB2", "SYM_BM");
     ObsoleteStrategy("BMASWXC1", "SYM_BM");
     ObsoleteStrategy("BMBASCAD", "SYM_BM");
     ObsoleteStrategy("BMBASGBP", "SYM_BM");
     ObsoleteStrategy("BMFOCAD1", "SYM_BM");
     ObsoleteStrategy("BMFOCAD2", "SYM_BM");
     ObsoleteStrategy("BMFOGBP4", "SYM_BM");
     ObsoleteStrategy("BMFRAXC1", "SYM_BM");
     ObsoleteStrategy("BMFRAXC2", "SYM_BM");
     ObsoleteStrategy("BMFUTBX1", "SYM_BM");
     ObsoleteStrategy("BMFUTBX2", "SYM_BM");
     ObsoleteStrategy("BMFUTBX3", "SYM_BM");
     ObsoleteStrategy("BMFUTBX4", "SYM_BM");
     ObsoleteStrategy("BMFUTEU1", "SYM_BM");
     ObsoleteStrategy("BMFUTEU2", "SYM_BM");
     ObsoleteStrategy("BMFUTXC1", "SYM_BM");
     ObsoleteStrategy("BMHEDGE2", "SYM_BM");
     ObsoleteStrategy("BMSCANDI", "SYM_BM");
     ObsoleteStrategy("BMSWOCAD", "SYM_BM");
     ObsoleteStrategy("BMSWOGBP", "SYM_BM");
     ObsoleteStrategy("BMSWPCHF", "SYM_BM");
     ObsoleteStrategy("BMSWPEU1", "SYM_BM");
     ObsoleteStrategy("BMSWPJPY", "SYM_BM");
     ObsoleteStrategy("BMSWPSEK", "SYM_BM");
     ObsoleteStrategy("BMSWPXC3", "SYM_BM");
     ObsoleteStrategy("BMTEST", "SYM_BM");
     ObsoleteStrategy("BMTSYGB1", "SYM_BM");
     ObsoleteStrategy("BMTSYGB2", "SYM_BM");
     ObsoleteStrategy("BMTSYGBS", "SYM_BM");
     ObsoleteStrategy("BMTSYJPY", "SYM_BM");
     ObsoleteStrategy("BMTSYXC3", "SYM_BM");
     ObsoleteStrategy("117BOX", "SYM_ES");
     ObsoleteStrategy("168BASIS", "SYM_ES");
     ObsoleteStrategy("717BOX", "SYM_ES");
     ObsoleteStrategy("AUG23RX", "SYM_ES");
     ObsoleteStrategy("BLANK", "SYM_ES");
     ObsoleteStrategy("CURVE", "SYM_ES");
     ObsoleteStrategy("DELTA", "SYM_ES");
     ObsoleteStrategy("DU_OE_BOX", "SYM_ES");
     ObsoleteStrategy("DUBASIS", "SYM_ES");
     ObsoleteStrategy("DUROLL", "SYM_ES");
     ObsoleteStrategy("EUROPTIONS", "SYM_ES");
     ObsoleteStrategy("OBLBASIS", "SYM_ES");
     ObsoleteStrategy("OE", "SYM_ES");
     ObsoleteStrategy("OEEONIA", "SYM_ES");
     ObsoleteStrategy("OEFLY", "SYM_ES");
     ObsoleteStrategy("OEUEONIA", "SYM_ES");
     ObsoleteStrategy("OEZ1YRFLY", "SYM_ES");
     ObsoleteStrategy("OPTIONS", "SYM_ES");
     ObsoleteStrategy("REPO", "SYM_ES");
     ObsoleteStrategy("SPREAD", "SYM_ES");
     ObsoleteStrategy("STUB2", "SYM_ES");
     ObsoleteStrategy("AUDASW1", "SYM_FGHK");
     ObsoleteStrategy("AUDFRONT", "SYM_FGHK");
     ObsoleteStrategy("AUDIRS1", "SYM_FGHK");
     ObsoleteStrategy("BCFGSCIRS1", "SYM_FGHK");
     ObsoleteStrategy("BCFGSCXMKT1", "SYM_FGHK");
     ObsoleteStrategy("BCSCKRW1", "SYM_FGHK");
     ObsoleteStrategy("EQLONG", "SYM_FGHK");
     ObsoleteStrategy("EQRV1", "SYM_FGHK");
     ObsoleteStrategy("FGASIAPNT1", "SYM_FGHK");
     ObsoleteStrategy("FGAUDSWP1", "SYM_FGHK");
     ObsoleteStrategy("FGJPYIRS2", "SYM_FGHK");
     ObsoleteStrategy("FGPNT1", "SYM_FGHK");
     ObsoleteStrategy("FUTL1", "SYM_FGHK");
     ObsoleteStrategy("FXCHFV", "SYM_FGHK");
     ObsoleteStrategy("FXCROSSS", "SYM_FGHK");
     ObsoleteStrategy("FXCSWAP", "SYM_FGHK");
     ObsoleteStrategy("FXCSWPESU", "SYM_FGHK");
     ObsoleteStrategy("FXD1", "SYM_FGHK");
     ObsoleteStrategy("FXDNT1", "SYM_FGHK");
     ObsoleteStrategy("FXEMASIAS", "SYM_FGHK");
     ObsoleteStrategy("FXJPYS", "SYM_FGHK");
     ObsoleteStrategy("FXRV1", "SYM_FGHK");
     ObsoleteStrategy("FXSGD", "SYM_FGHK");
     ObsoleteStrategy("FXSPOT", "SYM_FGHK");
     ObsoleteStrategy("FXSYSTEMATIC1", "SYM_FGHK");
     ObsoleteStrategy("FXUSDV", "SYM_FGHK");
     ObsoleteStrategy("FXVOL1", "SYM_FGHK");
     ObsoleteStrategy("IRSAUDIRS", "SYM_FGHK");
     ObsoleteStrategy("IRSJPYIRS", "SYM_FGHK");
     ObsoleteStrategy("IRSNZDIRS", "SYM_FGHK");
     ObsoleteStrategy("JPYBOND1", "SYM_FGHK");
     ObsoleteStrategy("JPYBOPT10", "SYM_FGHK");
     ObsoleteStrategy("JPYFUTROLL", "SYM_FGHK");
     ObsoleteStrategy("JPYSUPPLY", "SYM_FGHK");
     ObsoleteStrategy("NZDFRONT", "SYM_FGHK");
     ObsoleteStrategy("SCWBUYALL", "SYM_FGHK");
     ObsoleteStrategy("SCWCNY", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPAEG", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPAEK", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPECJ", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPESU", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPGJU", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPNJE", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPUAC", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPUAJ", "SYM_FGHK");
     ObsoleteStrategy("SCWCSWPUEK", "SYM_FGHK");
     ObsoleteStrategy("SCWEURROLL", "SYM_FGHK");
     ObsoleteStrategy("SCWFGFI", "SYM_FGHK");
     ObsoleteStrategy("SCWFUT", "SYM_FGHK");
     ObsoleteStrategy("SCWFXCHFS", "SYM_FGHK");
     ObsoleteStrategy("SCWFXCROSSS", "SYM_FGHK");
     ObsoleteStrategy("SCWFXDNT1", "SYM_FGHK");
     ObsoleteStrategy("SCWFXDNT2", "SYM_FGHK");
     ObsoleteStrategy("SCWFXDRAX", "SYM_FGHK");
     ObsoleteStrategy("SCWFXEURV", "SYM_FGHK");
     ObsoleteStrategy("SCWFXJPYS", "SYM_FGHK");
     ObsoleteStrategy("SCWFXRV3", "SYM_FGHK");
     ObsoleteStrategy("SCWFXRVJPY", "SYM_FGHK");
     ObsoleteStrategy("SCWFXUSDS", "SYM_FGHK");
     ObsoleteStrategy("SCWOIS", "SYM_FGHK");
     ObsoleteStrategy("SCWOPTJPY", "SYM_FGHK");
     ObsoleteStrategy("SCWRVKRW", "SYM_FGHK");
     ObsoleteStrategy("SCWRVNOK", "SYM_FGHK");
     ObsoleteStrategy("SCWRVSGD", "SYM_FGHK");
     ObsoleteStrategy("SCWTWD", "SYM_FGHK");
     ObsoleteStrategy("SCWVOLPNT", "SYM_FGHK");
     ObsoleteStrategy("SMOOTHIES", "SYM_FGHK");
     ObsoleteStrategy("T3B3", "SYM_FGHK");
     ObsoleteStrategy("XCYBAS4", "SYM_FGHK");
     ObsoleteStrategy("XCYBASGBP", "SYM_FGHK");
     ObsoleteStrategy("BUYALL", "SYM_FGLN");
     ObsoleteStrategy("CADBOND1", "SYM_FGLN");
     ObsoleteStrategy("CADLIB1", "SYM_FGLN");
     ObsoleteStrategy("CADSWP1", "SYM_FGLN");
     ObsoleteStrategy("CHFLIB1", "SYM_FGLN");
     ObsoleteStrategy("CHFSWP1", "SYM_FGLN");
     ObsoleteStrategy("DKKLIB1", "SYM_FGLN");
     ObsoleteStrategy("EM1", "SYM_FGLN");
     ObsoleteStrategy("EQLONG", "SYM_FGLN");
     ObsoleteStrategy("EQRV1", "SYM_FGLN");
     ObsoleteStrategy("EUR36BAS", "SYM_FGLN");
     ObsoleteStrategy("EURASW3", "SYM_FGLN");
     ObsoleteStrategy("EURASW5", "SYM_FGLN");
     ObsoleteStrategy("EURBAS10_HDG", "SYM_FGLN");
     ObsoleteStrategy("EURBAS2", "SYM_FGLN");
     ObsoleteStrategy("EURBAS5C", "SYM_FGLN");
     ObsoleteStrategy("EURDU", "SYM_FGLN");
     ObsoleteStrategy("EURFR", "SYM_FGLN");
     ObsoleteStrategy("EURFUT1", "SYM_FGLN");
     ObsoleteStrategy("EURITBAS", "SYM_FGLN");
     ObsoleteStrategy("EURLIB3", "SYM_FGLN");
     ObsoleteStrategy("EURLIBOPT4", "SYM_FGLN");
     ObsoleteStrategy("EUROIS3", "SYM_FGLN");
     ObsoleteStrategy("EUROIS4", "SYM_FGLN");
     ObsoleteStrategy("EURPERIPH", "SYM_FGLN");
     ObsoleteStrategy("EURPERIPH1", "SYM_FGLN");
     ObsoleteStrategy("EURPERIPH2", "SYM_FGLN");
     ObsoleteStrategy("EURPERIPH3", "SYM_FGLN");
     ObsoleteStrategy("EURSWP4", "SYM_FGLN");
     ObsoleteStrategy("EURSWPTN1", "SYM_FGLN");
     ObsoleteStrategy("EURSWPTN2", "SYM_FGLN");
     ObsoleteStrategy("EURSWPTN3", "SYM_FGLN");
     ObsoleteStrategy("EURTED1", "SYM_FGLN");
     ObsoleteStrategy("FILONG", "SYM_FGLN");
     ObsoleteStrategy("GBPCAL10", "SYM_FGLN");
     ObsoleteStrategy("GBPLIB1", "SYM_FGLN");
     ObsoleteStrategy("GBPLIB2", "SYM_FGLN");
     ObsoleteStrategy("GBPSWP2", "SYM_FGLN");
     ObsoleteStrategy("GBPSWPTN1", "SYM_FGLN");
     ObsoleteStrategy("GBPSWPTN2", "SYM_FGLN");
     ObsoleteStrategy("JPYBOND1", "SYM_FGLN");
     ObsoleteStrategy("JPYOIS1", "SYM_FGLN");
     ObsoleteStrategy("JPYPNT", "SYM_FGLN");
     ObsoleteStrategy("JPYSWP1", "SYM_FGLN");
     ObsoleteStrategy("MACROPM1", "SYM_FGLN");
     ObsoleteStrategy("MACROPM1_BOND", "SYM_FGLN");
     ObsoleteStrategy("MACROPM1_MM", "SYM_FGLN");
     ObsoleteStrategy("MACROPM1_SWP", "SYM_FGLN");
     ObsoleteStrategy("NOKSWP1", "SYM_FGLN");
     ObsoleteStrategy("PNT5", "SYM_FGLN");
     ObsoleteStrategy("PNTEUR", "SYM_FGLN");
     ObsoleteStrategy("SCWFUT", "SYM_FGLN");
     ObsoleteStrategy("SCWOPTEUR", "SYM_FGLN");
     ObsoleteStrategy("SEKBOND", "SYM_FGLN");
     ObsoleteStrategy("SEKBOND1", "SYM_FGLN");
     ObsoleteStrategy("SEKOIS1", "SYM_FGLN");
     ObsoleteStrategy("SEKSWP1", "SYM_FGLN");
     ObsoleteStrategy("USDCAL30", "SYM_FGLN");
     ObsoleteStrategy("USDLIB3", "SYM_FGLN");
     ObsoleteStrategy("VIVEKEUR", "SYM_FGLN");
     ObsoleteStrategy("VIVEKUSD", "SYM_FGLN");
     ObsoleteStrategy("XCYLIBOPT1", "SYM_FGLN");
     ObsoleteStrategy("XCYLIBOPT3", "SYM_FGLN");
     ObsoleteStrategy("XCYOIS1", "SYM_FGLN");
     ObsoleteStrategy("XMKT2", "SYM_FGLN");
     ObsoleteStrategy("XMKTFI1", "SYM_FGLN");
     ObsoleteStrategy("XMKTFUT1", "SYM_FGLN");
     ObsoleteStrategy("XMKTLIB1", "SYM_FGLN");
     ObsoleteStrategy("XMKTLIB2", "SYM_FGLN");
     ObsoleteStrategy("XMKTSWP1", "SYM_FGLN");
     ObsoleteStrategy("XMKTSWP2", "SYM_FGLN");
     ObsoleteStrategy("0E_0R.2R", "SYM_NL");
     ObsoleteStrategy("0E_CS2_BUND.10Y", "SYM_NL");
     ObsoleteStrategy("0E_DUMMY_PNL", "SYM_NL");
     ObsoleteStrategy("0E_ERU3_100C", "SYM_NL");
     ObsoleteStrategy("0E_ERU3_C2P1", "SYM_NL");
     ObsoleteStrategy("0E_EXPIRY", "SYM_NL");
     ObsoleteStrategy("0E_FRONT_ER1", "SYM_NL");
     ObsoleteStrategy("0E_FRONT_ER2", "SYM_NL");
     ObsoleteStrategy("0E_PS2_GREEN", "SYM_NL");
     ObsoleteStrategy("0E_SKEW_0R", "SYM_NL");
     ObsoleteStrategy("0E_SKEW_2R", "SYM_NL");
     ObsoleteStrategy("0E_SKEW_BUND", "SYM_NL");
     ObsoleteStrategy("0E_SOP_1", "SYM_NL");
     ObsoleteStrategy("0EU_BOBL.TY", "SYM_NL");
     ObsoleteStrategy("0U_BLUE.5Y", "SYM_NL");
     ObsoleteStrategy("0U_BLUE.5Y_1", "SYM_NL");
     ObsoleteStrategy("EURMIDCURVE3M", "SYM_NL");
     ObsoleteStrategy("EURSKEW2Y", "SYM_NL");*/
 }
    internal SplitPacketHandler(BytePacketManager bytePacketManager, ClientSession session)
    {
        this.bytePacketManager = bytePacketManager;

        this.Session = session;
    }
Exemplo n.º 47
0
 public override Task ConfigureClientSession(
     ClientSession clientSession,
     CancellationToken cancellationToken = default(CancellationToken))
 => clientSession.InstallPackageAsync(
     new PackageViewModel(
         InteractivePackageManager.FixedXamarinFormsPackageIdentity));
Exemplo n.º 48
0
 public CharacterScreenPacketHandler(ClientSession session)
 {
     _session = session;
 }
 /// <summary>
 /// Factory method which ensures that the UI is properly updated
 /// upon initialization
 /// </summary>
 /// <param name="session">The session which state is to be updated</param>
 /// <param name="visualization">The visualization of the client</param>
 public static void SetAsState(ClientSession session, ClientTagVisualization visualization)
 {
     CalibrationState cs = new CalibrationState(session, visualization);
     session.State = cs;
     cs.UpdateUI();
 }
Exemplo n.º 50
0
        public override async Task ExecuteAsync(SetHeroLevelCommandPacket levelPacket, ClientSession session)
        {
            if (string.IsNullOrEmpty(levelPacket.Name) || (levelPacket.Name == session.Character.Name))
            {
                await session.Character.SetHeroLevelAsync(levelPacket.Level).ConfigureAwait(false);

                return;
            }

            var data = new StatData
            {
                ActionType = UpdateStatActionType.UpdateHeroLevel,
                Character  = new Character {
                    Name = levelPacket.Name
                },
                Data = levelPacket.Level
            };

            var channels = (await _channelHttpClient.GetChannelsAsync().ConfigureAwait(false))
                           ?.Where(c => c.Type == ServerType.WorldServer);

            ConnectedAccount?   receiver = null;
            ServerConfiguration?config   = null;

            foreach (var channel in channels ?? new List <ChannelInfo>())
            {
                var accounts = await
                               _connectedAccountHttpClient.GetConnectedAccountAsync(channel).ConfigureAwait(false);

                var target = accounts.FirstOrDefault(s => s.ConnectedCharacter?.Name == levelPacket.Name);

                if (target == null)
                {
                    continue;
                }

                receiver = target;
                config   = channel.WebApi;
            }

            if (receiver == null) //TODO: Handle 404 in WebApi
            {
                await session.SendPacketAsync(new InfoPacket
                {
                    Message = GameLanguage.Instance.GetMessageFromKey(LanguageKey.CANT_FIND_CHARACTER,
                                                                      session.Account.Language)
                }).ConfigureAwait(false);

                return;
            }

            await _statHttpClient.ChangeStatAsync(data, config !).ConfigureAwait(false);
        }
Exemplo n.º 51
0
        private void btnSetRealCADSvcIP_Click(object sender, EventArgs e)
        {
            if (_isRealCADSvcIPSet)
            {
                //Unset

                //Need to cut off the client proxy with CAD
                //Need confirmation!!!
                session = null;
                incidentSession = null;

                this.txtRealCADSvcIP.Enabled = true;
                this.btnSetRealCADSvcIP.Text = "Set";
                _isRealCADSvcIPSet = false;
            }
            else
            {
                //Set
                try
                {
                    Log("Set session and incident session");
                    //This part need to edit (How does they link up the Endpoint, in order for me to dynamic change IP)
                    //sessionEP and incidentSessionEP just return a string that corresponding to key in appconfig
                    //How does it access to the appconfig endpoint setting
                    string sessionEPaddress = "net.tcp://" + this.txtRealCADSvcIP.Text.Trim() + ":2044/IncidentIntegrationService/";
                    var sessionEP = ConfigurationManager.AppSettings.Get("SessionEndPoint");
                    configsetting.SaveEndpointAddress(sessionEPaddress, sessionEP); //overwrite endpoint address in appconfig
                    
                    string incidentSessionEPaddress = "net.tcp://" + this.txtRealCADSvcIP.Text.Trim() + ":2045/IntegrationSessionService/";
                    var incidentSessionEP = ConfigurationManager.AppSettings.Get("IncidentIntegrationServiceEndPoint");
                    configsetting.SaveEndpointAddress(incidentSessionEPaddress, incidentSessionEP); //overwrite endpoint address in appconfig

                    ConfigurationManager.RefreshSection("system.serviceModel/client");

                    session = new ClientSession(sessionEP);
                    incidentSession = new IncidentIntegrationClient(incidentSessionEP);

                    this.txtRealCADSvcIP.Enabled = false;
                    //Change button Text
                    this.btnSetRealCADSvcIP.Text = "Unset";
                    _isRealCADSvcIPSet = true;
                }
                catch(Exception exception)
                {
                    Log(exception.ToString());
                    MessageBox.Show("Invalid IP address...");
                }

            }
        }
Exemplo n.º 52
0
 internal abstract void LogRequest(RtspMessage request, ClientSession session);
Exemplo n.º 53
0
 /// <summary>
 /// 断开连接
 /// </summary>
 private void InsideDispose()
 {
     m_Socket.Close();
     m_Socket = null;
 }
Exemplo n.º 54
0
 internal abstract void LogResponse(RtspMessage response, ClientSession session);
Exemplo n.º 55
0
    protected void Page_Load(object sender, EventArgs e)
    {
        seo.Title = "在线录单";
        clientSession = (ClientSession)AuthorizationManager.GetCurrentSessionObject(Context, false);

        if (!IsPostBack)
        {
            DdlCarrierDataBind();
            txtCreateDate.Value = DateTime.Now.ToShortDateString();
        }
    }
Exemplo n.º 56
0
        // Only call this from EvaluateCodeCellAsync, for CanEvaluate handling
        async Task DoEvaluateCodeCellAsync(CodeCellState codeCellState, bool evaluateAll = false)
        {
            await ClientSession.EnsureAgentConnectionAsync();

            var codeCellsToEvaluate   = ImmutableList <CodeCellState> .Empty;
            var originalCodeCellState = codeCellState;

            if (ClientSession.ViewControllers.ReplHistory != null)
            {
                ClientSession.ViewControllers.ReplHistory.UpdateLastAppended(
                    codeCellState.Cell.Buffer.Value.Trim());
                ClientSession.ViewControllers.ReplHistory.Save();
            }

            var codeCell    = originalCodeCellState.Cell;
            var isLastCell  = codeCell.GetNextCell <CodeCell> () == null;
            var isFirstCell = codeCell.GetPreviousCell <CodeCell> () == null;

            if (isFirstCell && ClientSession.SessionKind == ClientSessionKind.Workbook)
            {
                await ClientSession.Agent.Api.ResetStateAsync();
            }

            while (codeCell != null)
            {
                if (CodeCells.TryGetValue(codeCell.View.Editor, out codeCellState))
                {
                    var evaluateCodeCell =
                        codeCellState == originalCodeCellState ||
                        codeCellState.EvaluationCount == 0 ||
                        codeCellState.View.IsDirty ||
                        codeCellState.View.IsOutdated;

                    if (ClientSession.CompilationWorkspace.HaveAnyLoadDirectiveFilesChanged(
                            codeCellState.DocumentId))
                    {
                        codeCellState.Cell.CodeAnalysisBuffer.Invalidate();
                        evaluateCodeCell = true;
                    }

                    if (evaluateCodeCell)
                    {
                        codeCellsToEvaluate = codeCellsToEvaluate.Insert(0, codeCellState);
                    }
                }

                codeCell = codeCell.GetPreviousCell <CodeCell> ();
            }

            codeCell = originalCodeCellState.Cell;
            var skipRemainingCodeCells = false;

            while (true)
            {
                codeCell = codeCell.GetNextCell <CodeCell> ();
                if (codeCell == null)
                {
                    break;
                }

                if (CodeCells.TryGetValue(codeCell.View.Editor, out codeCellState))
                {
                    if (skipRemainingCodeCells || codeCellState.AgentTerminatedWhileEvaluating)
                    {
                        skipRemainingCodeCells = true;
                    }
                    else if (evaluateAll || codeCellState.EvaluationCount > 0)
                    {
                        codeCellsToEvaluate = codeCellsToEvaluate.Add(codeCellState);
                    }
                    codeCellState.View.IsOutdated = true;
                }
            }

            foreach (var evaluatableCodeCell in codeCellsToEvaluate)
            {
                evaluatableCodeCell.View.Reset();
                evaluatableCodeCell.View.IsEvaluating = true;

                switch (await CoreEvaluateCodeCellAsync(evaluatableCodeCell))
                {
                case CodeCellEvaluationStatus.ErrorDiagnostic:
                case CodeCellEvaluationStatus.Disconnected:
                    return;
                }
            }

            if (isLastCell && !evaluateAll)
            {
                StartNewCodeCell();
            }

            // NOTE: I cannot remember why this has to be run after awaiting
            // CoreEvaluateCodeCellAsync but it does... so don't move it? -abock
            if (ClientSession.ViewControllers.ReplHistory != null)
            {
                ClientSession.ViewControllers.ReplHistory.CursorToEnd();
                ClientSession.ViewControllers.ReplHistory.Append(null);
            }
        }
 public AuthenticationState(ClientSession session)
     : base(session)
 {
 }
Exemplo n.º 58
0
        async Task <CodeCellEvaluationStatus> CoreEvaluateCodeCellAsync(
            CodeCellState codeCellState,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            cancellationToken = ClientSession.CancellationToken.LinkWith(cancellationToken);

            if (!ClientSession.Agent.IsConnected || ClientSession.CompilationWorkspace == null)
            {
                codeCellState.View.IsEvaluating        = false;
                codeCellState.View.HasErrorDiagnostics = true;
                codeCellState.View.RenderDiagnostic(new InteractiveDiagnostic(
                                                        DiagnosticSeverity.Error,
                                                        "Cannot evaluate: not connected to agent."));
                return(CodeCellEvaluationStatus.Disconnected);
            }

            CodeAnalysis.Compilation compilation = null;
            ExceptionNode            exception   = null;
            bool agentTerminatedWhileEvaluating  = false;

            try {
                compilation = await ClientSession.CompilationWorkspace.GetSubmissionCompilationAsync(
                    codeCellState.DocumentId,
                    new EvaluationEnvironment (ClientSession.WorkingDirectory),
                    cancellationToken);

                var integrationAssemblies = compilation
                                            .References
                                            .Where(ra => ra.HasIntegration)
                                            .ToArray();
                if (integrationAssemblies.Length > 0)
                {
                    await ClientSession.Agent.Api.LoadAssembliesAsync(
                        ClientSession.CompilationWorkspace.EvaluationContextId,
                        integrationAssemblies);
                }

                foreach (var dependency in ClientSession.CompilationWorkspace.WebDependencies)
                {
                    if (ClientSession.AddWebResource(dependency.Location, out var guid))
                    {
                        await LoadWorkbookDependencyAsync(guid + dependency.Location.Extension);
                    }
                }
            } catch (Exception e) {
                exception = ExceptionNode.Create(e);
            }

            var diagnostics = ClientSession.CompilationWorkspace.CurrentSubmissionDiagnostics.Filter();

            codeCellState.View.HasErrorDiagnostics = diagnostics.HasErrors;

            foreach (var diagnostic in diagnostics)
            {
                codeCellState.View.RenderDiagnostic((InteractiveDiagnostic)diagnostic);
            }

            try {
                if (compilation != null)
                {
                    codeCellState.LastEvaluationRequestId = compilation.MessageId;
                    codeCellState.IsResultAnExpression    = compilation.IsResultAnExpression;

                    await ClientSession.Agent.Api.EvaluateAsync(
                        compilation,
                        cancellationToken);
                }
            } catch (XipErrorMessageException e) {
                exception = e.XipErrorMessage.Exception;
            } catch (Exception e) {
                Log.Error(TAG, "marking agent as terminated", e);
                agentTerminatedWhileEvaluating         = true;
                codeCellState.View.HasErrorDiagnostics = true;
                codeCellState.View.RenderDiagnostic(new InteractiveDiagnostic(
                                                        DiagnosticSeverity.Error,
                                                        Catalog.GetString(
                                                            "The application terminated during evaluation of this cell. " +
                                                            "Run this cell manually to try again.")));
            }

            codeCellState.View.IsEvaluating = false;

            CodeCellEvaluationStatus evaluationStatus;

            if (exception != null)
            {
                codeCellState.View.RenderResult(
                    CultureInfo.CurrentCulture,
                    FilterException(exception),
                    EvaluationResultHandling.Replace);
                evaluationStatus = CodeCellEvaluationStatus.EvaluationException;
            }
            else if (diagnostics.HasErrors)
            {
                return(CodeCellEvaluationStatus.ErrorDiagnostic);
            }
            else if (agentTerminatedWhileEvaluating)
            {
                evaluationStatus = CodeCellEvaluationStatus.Disconnected;
            }
            else
            {
                evaluationStatus = CodeCellEvaluationStatus.Success;
            }

            if (ClientSession.SessionKind != ClientSessionKind.Workbook)
            {
                codeCellState.Freeze();
            }

            codeCellState.NotifyEvaluated(agentTerminatedWhileEvaluating);
            return(evaluationStatus);
        }
Exemplo n.º 59
0
        private static UnexpectedDialogHandler GetUnexpectedDialogHandler(ClientSession clientSession)
        {
            object dialogHandlerObj;
            if (clientSession.Attributes.TryGetValue(UnexpectedDialogHandler.UnexpectedDialogHandlerKey, out dialogHandlerObj))
            {
                UnexpectedDialogHandler unexpectedDialogHandler = dialogHandlerObj as UnexpectedDialogHandler;
                if (unexpectedDialogHandler != null)
                {
                    return unexpectedDialogHandler;
                }
            }

            return null;
        }
Exemplo n.º 60
0
        //TODO: Remove these clientsessions as parameter
        public Tuple <ExchangeResultType, Dictionary <long, InfoPacket> > ValidateExchange(ClientSession session,
                                                                                           ICharacterEntity targetSession)
        {
            var exchangeInfo = GetData(session.Character.CharacterId);
            var targetInfo   = GetData(targetSession.VisualId);
            var dictionary   = new Dictionary <long, InfoPacket>();

            if (exchangeInfo.Gold + targetSession.Gold > _worldConfiguration.MaxGoldAmount)
            {
                dictionary.Add(targetSession.VisualId, new InfoPacket
                {
                    Message = Language.Instance.GetMessageFromKey(LanguageKey.INVENTORY_FULL,
                                                                  targetSession.AccountLanguage)
                });
            }

            if (targetInfo.Gold + session.Character.Gold > _worldConfiguration.MaxGoldAmount)
            {
                dictionary.Add(targetSession.VisualId, new InfoPacket
                {
                    Message = Language.Instance.GetMessageFromKey(LanguageKey.MAX_GOLD, session.Account.Language)
                });
                return(new Tuple <ExchangeResultType, Dictionary <long, InfoPacket> >(ExchangeResultType.Failure,
                                                                                      dictionary));
            }

            if (exchangeInfo.BankGold + targetSession.BankGold > _worldConfiguration.MaxBankGoldAmount)
            {
                dictionary.Add(targetSession.VisualId, new InfoPacket
                {
                    Message = Language.Instance.GetMessageFromKey(LanguageKey.BANK_FULL, session.Account.Language)
                });
                return(new Tuple <ExchangeResultType, Dictionary <long, InfoPacket> >(ExchangeResultType.Failure,
                                                                                      dictionary));
            }

            if (targetInfo.BankGold + session.Account.BankMoney > _worldConfiguration.MaxBankGoldAmount)
            {
                dictionary.Add(session.Character.CharacterId, new InfoPacket
                {
                    Message = Language.Instance.GetMessageFromKey(LanguageKey.BANK_FULL, session.Account.Language)
                });
                return(new Tuple <ExchangeResultType, Dictionary <long, InfoPacket> >(ExchangeResultType.Failure,
                                                                                      dictionary));
            }

            if (exchangeInfo.ExchangeItems.Keys.Any(s => !s.Item.IsTradable))
            {
                dictionary.Add(session.Character.CharacterId, new InfoPacket
                {
                    Message = Language.Instance.GetMessageFromKey(LanguageKey.ITEM_NOT_TRADABLE,
                                                                  session.Account.Language)
                });
                return(new Tuple <ExchangeResultType, Dictionary <long, InfoPacket> >(ExchangeResultType.Failure,
                                                                                      dictionary));
            }

            if (!session.Character.Inventory.EnoughPlace(targetInfo.ExchangeItems.Keys.ToList()) ||
                !targetSession.Inventory.EnoughPlace(exchangeInfo.ExchangeItems.Keys.ToList()))
            {
                dictionary.Add(session.Character.CharacterId, new InfoPacket
                {
                    Message = Language.Instance.GetMessageFromKey(LanguageKey.INVENTORY_FULL, session.Account.Language)
                });
                dictionary.Add(targetSession.VisualId, new InfoPacket
                {
                    Message = Language.Instance.GetMessageFromKey(LanguageKey.INVENTORY_FULL,
                                                                  targetSession.AccountLanguage)
                });
                return(new Tuple <ExchangeResultType, Dictionary <long, InfoPacket> >(ExchangeResultType.Failure,
                                                                                      dictionary));
            }

            return(new Tuple <ExchangeResultType, Dictionary <long, InfoPacket> >(ExchangeResultType.Success, null));
        }