Files

1.9 KiB
Raw Permalink Blame History

poker.js — poker_handler() (satır 546)

← poker.js · ← Master

Parça 2/6 · önceki · sonraki

  // YENİ MASA OLUŞTUR
  if (lastAction === "lobby_create") {
    var newId = "t_" + new Date().getTime();
    var tableNum = lobby.tables.length + 1;
    var newTable = {
      id: newId,
      name: "Masa #" + tableNum,
      state: "waiting",
      players: [{
        name: playerName,
        cards: [],
        bet: 0,
        folded: false,
        money: 1000
      }],
      community_cards: [],
      deck: [],
      pot: 0,
      turn_index: 0,
      host: playerName
    };
    lobby.tables.push(newTable);
    saveLobbyData(c, lobby);
    c.send("§a" + playerName + " yeni bir poker masası oluşturdu!");
    openPokerUI(c, player, newId);
    return;
  }

  // LOBİ TÜM MASALARI SİL (OP Admin yetkisi)
  if (lastAction === "lobby_cancel_all") {
    if (isPlayerOP(player)) {
      lobby.tables = [];
      saveLobbyData(c, lobby);
      c.send("§cTüm aktif poker masaları sunucu yöneticisi " + playerName + " tarafından silindi!");
      openLobbyUI(c, player);
    }
    return;
  }

  // LOBİ KATIL/İZLE
  if (lastAction.indexOf("lobby_join_") === 0) {
    var targetId = lastAction.replace("lobby_join_", "");
    var table = getTableData(lobby, targetId);
    if (table) {
      var pIndex = getPlayerIndex(table, playerName);
      if (pIndex === -1) {
        if (table.state === "waiting") {
          if (table.players.length < 6) {
            table.players.push({
              name: playerName,
              cards: [],
              bet: 0,
              folded: false,
              money: 1000
            });
            c.send("§a" + playerName + " §e" + table.name + "§a poker masasına katıldı!");