public void Setup(Marketplace marketplace, MarketTerminal terminal, VendingMachine vendingMachine) { sourceMarketplace.Set(marketplace); sourceTerminal.Set(terminal); targetVendingMachine.Set(vendingMachine); _state = State.Takeoff; _sinceLastStateChange = 0f; _pickUpTicks = 0; }
private void _LogStats() { while (Trading) { var waitTime = LastStatTime.AddMinutes(15) - DateTime.Now; if (waitTime.TotalMilliseconds > 0) { Thread.Sleep(waitTime); } StrategyStatistics.Snapshot(MarketTerminal.GetBalanceFiat(), MarketTerminal.GetBalanceSecurity(), MarketTerminal.GetLastPrice(), GetCoinbaseBTCPrice()); Log.Write($"USD: {StrategyStatistics.Snapshots.Last().Fiat.ToString("N5")} | Asset: {StrategyStatistics.Snapshots.Last().Security}", 1); Log.Write($"Period PL: {StrategyStatistics.Snapshots.Last().PL.ToString("N5")} | Cumulative PL: {StrategyStatistics.Snapshots.Last().CumulativePL.ToString("N5")}", 1); LastStatTime = DateTime.Now; } }
public uint SendDrone(BasePlayer player, MarketTerminal sourceTerminal, VendingMachine vendingMachine) { if (sourceTerminal == null || vendingMachine == null) { return(0u); } BaseEntity baseEntity = GameManager.server.CreateEntity(deliveryDronePrefab?.resourcePath, droneLaunchPoint.position, droneLaunchPoint.rotation); DeliveryDrone deliveryDrone; if ((object)(deliveryDrone = baseEntity as DeliveryDrone) == null) { baseEntity.Kill(); return(0u); } deliveryDrone.OwnerID = player.userID; deliveryDrone.Spawn(); deliveryDrone.Setup(this, sourceTerminal, vendingMachine); return(deliveryDrone.net.ID); }