/// <summary> /// Removes old bet furni and spawns new bet furni /// </summary> public void SpawnStartingBet(int Number) { try { Room Room = RoleplayManager.GenerateRoom(this.RoomId); if (Room == null) { return; } TexasHoldEmPlayer Player = this.PlayerList[Number]; if (Player == null || Player.UserId == 0) { return; } GameClient Client = PlusEnvironment.GetGame().GetClientManager().GetClientByUserID(Player.UserId); if (Client == null || Client.GetRoleplay() == null || Client.GetHabbo() == null) { return; } RemoveBetFurni(Number); SpawnBetFurni(Number, Player.TotalAmount); } catch (Exception e) { Logging.LogRPGamesError("Error in SpawnStartingBet() void: " + e); } }
/// <summary> /// Places the users bet onto the pot square /// </summary> public void PlacePotFurni(int Number, int Amount) { try { Room Room = RoleplayManager.GenerateRoom(this.RoomId); if (Room == null || Room.GetRoomItemHandler() == null || Room.GetGameMap() == null) { return; } TexasHoldEmPlayer Player = this.PlayerList[Number]; if (Player == null) { return; } if (Player.TotalAmount - Amount < 0) { return; } Player.TotalAmount -= Amount; Player.CurrentBet += Amount; int X = PotSquare.X; int Y = PotSquare.Y; int Thousands = 0; int Hundreds = 0; int Fifties = 0; int Tens = 0; int Fives = 0; double Height = Room.GetGameMap().GetHeightForSquare(new Point(X, Y)); #region Set Values if (Amount >= 1000) { Thousands = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 1000))); Amount -= 1000 * Thousands; } if (Amount >= 100) { Hundreds = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 100))); Amount -= 100 * Hundreds; } if (Amount >= 50) { Fifties = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 50))); Amount -= 50 * Fifties; } if (Amount >= 10) { Tens = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 10))); Amount -= 10 * Tens; } if (Amount >= 5) { Fives = Convert.ToInt32(Math.Floor(Convert.ToDouble((double)Amount / 5))); Amount -= 5 * Fives; } #endregion #region Spawn Bars if (Thousands > 0) { while (Thousands > 0) { // Obsidian Bar RoleplayManager.PlaceItemToRoom(null, 200059, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Thousands--; } } if (Hundreds > 0) { while (Hundreds > 0) { // Diamond Bar RoleplayManager.PlaceItemToRoom(null, 200054, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Hundreds--; } } if (Fifties > 0) { while (Fifties > 0) { // Emerald Bar RoleplayManager.PlaceItemToRoom(null, 200062, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Fifties--; } } if (Tens > 0) { while (Tens > 0) { // Ruby Bar RoleplayManager.PlaceItemToRoom(null, 200058, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Tens--; } } if (Fives > 0) { while (Fives > 0) { // Sapphire Bar RoleplayManager.PlaceItemToRoom(null, 200056, 0, X, Y, Height, 0, false, this.RoomId, false, "0"); Height += 0.5; Fives--; } } #endregion } catch (Exception e) { Logging.LogRPGamesError("Error in AddPlayerToGame() void: " + e); } }