public static void TakeAllLoot() { var takeAllLootRequest = new TakeAllLootRequest(); takeAllLootRequest.ShipId = selectedShip; connection.InvokeAsync("TakeAllLoot", GetAuthorizationTokenContainer(), takeAllLootRequest); }
/// <summary> /// Given a specific ship contained within the req object and owned by the player, /// vacuum up all the loot at the given ship's coordinates. /// </summary> /// <param name="ctr">A container containing authorization information</param> /// <param name="req">A request containing the ship id of the ship grabbing loot</param> public async Task TakeAllLoot(AuthorizationTokenContainer ctr, TakeAllLootRequest req) { GetPlayerByAccessTokenResponse playerByAccessTokenResponse = _authService.GetPlayerByAccessToken(ctr.Token); if (playerByAccessTokenResponse.Success == true) { GetShipsByPlayerIdResponse getShipsByPlayerIdResponse = _gameService.GetShipsByPlayerId(playerByAccessTokenResponse.Player.Id); if (getShipsByPlayerIdResponse.Success) { Ship ship = getShipsByPlayerIdResponse.Ships.Where(x => x.Id == req.ShipId).SingleOrDefault(); _lootService.TractorAllLoot(ship); await Clients.Caller.ReceiveMessage("Looted all."); } } }