static void Main(string[] args) { while (true) { AppMessage msg = AppMessage.New("TestClient", 5, false); AppMessage msg2 = Client.Send(msg); Console.WriteLine("from server: pool size: " + ((msg2?.PoolSize).ToString() ?? "")); Thread.Sleep(1000); } }
private void MainLoopTimer_Tick(object sender, EventArgs e) { if (loggedIn && TimeSinceLoginStarted != null && TimeSinceLoginStarted.Elapsed.TotalSeconds > 13) { if ((TimeSinceWatchDogBark?.Elapsed.TotalSeconds ?? int.MaxValue) > 5) { TimeSinceWatchDogBark = Stopwatch.StartNew(); AppMessage resp = Client.Send(AppMessage.New($"Warehouse for {Core.CharacterFilter.AccountName}", 90, true)); if (!WatchDogRegistered && resp != null) { WatchDogRegistered = true; Log($"Registered with watchdog, pool occupancy: {resp.PoolSize + 1}"); } } if (FirstInner) { Log($"CAUTION: Warehouse {VersionString} is running"); Log($"Anyone near you can take all your non-attuned items."); Log($"Commands: whallowretrieve, whplayerdetectionjump, whallowjumpcmd"); FirstInner = false; } if (PendingRetrieveCommand != null && CharToLogin != null && Core.CharacterFilter.Id == CharToLogin.Value && PendingTradeGiveItems.Count > 0) { TradeGiveItem(PendingRetrieveCommand.ChatterId, PendingRetrieveCommand.ChatterName, PendingTradeGiveItems.ToArray()); PendingTradeGiveItems.Clear(); PendingRetrieveCommand = null; CharToLogin = null; } else if (CharToLogin != null) { CharToLogin = null; } if (PlayerDetectionJump) { #region nearby player check try { WorldObjectCollection woc = Core.WorldFilter.GetByObjectClass(ObjectClass.Player); int playerCount = woc.Quantity; if (prevPlayerCount != playerCount) { prevPlayerCount = playerCount; WantToJump = true; } } catch (Exception ex) { errorLogging.LogError(ErrorLogFile, ex); } #endregion } if (!ItemScanInProgress && (TimeSinceScanFinished == null || TimeSinceScanFinished.Elapsed > TimeSpan.FromMinutes(5))) { WantToSyncItems = true; } if (!CramTimer.Enabled && !StackTimer.Enabled) { Cram(); } if (!StackTimer.Enabled) { Stack(); } if (WantToJump) { Core.Foreground(); SendKey("o", true, true); WantToJump = false; } SyncItems(); } else if (!loggedIn) { DoLoginStuff(); return; } }