65 lines
1.9 KiB
Markdown
65 lines
1.9 KiB
Markdown
# poker.js — poker_handler() (satır 546)
|
||
|
||
[← poker.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
Parça 2/6 · [önceki](poker_handler.md) · [sonraki](poker_handler-3.md)
|
||
|
||
```javascript
|
||
// 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ı!");
|
||
```
|