61 lines
1.9 KiB
Markdown
61 lines
1.9 KiB
Markdown
# poker.js — poker_handler() (satır 546)
|
||
|
||
[← poker.js](index.md) · [← Master](../../wiki.md)
|
||
|
||
Parça 5/6 · [önceki](poker_handler-4.md) · [sonraki](poker_handler-6.md)
|
||
|
||
```javascript
|
||
table.deck = generateDeck();
|
||
table.community_cards = [];
|
||
table.pot = 0;
|
||
table.turn_index = 0;
|
||
|
||
// Her oyuncuya kart dağıt
|
||
for (var i = 0; i < table.players.length; i++) {
|
||
table.players[i].cards = [table.deck.pop(), table.deck.pop()];
|
||
table.players[i].bet = 0;
|
||
table.players[i].folded = false;
|
||
}
|
||
c.executeCommand(
|
||
"/say §aPoker oyunu " + playerName + " tarafından " + table.name + " masasında başlatıldı!"
|
||
);
|
||
saveLobbyData(c, lobby);
|
||
refreshTablePlayers(c, tableId);
|
||
}
|
||
return;
|
||
}
|
||
|
||
// YERE KART AÇ
|
||
if (lastAction === "btn_stage") {
|
||
if (table.host === playerName && table.state === "playing") {
|
||
if (table.community_cards.length === 0) {
|
||
// Flop
|
||
table.community_cards.push(table.deck.pop());
|
||
table.community_cards.push(table.deck.pop());
|
||
table.community_cards.push(table.deck.pop());
|
||
} else if (table.community_cards.length === 3 || table.community_cards.length === 4) {
|
||
// Turn veya River
|
||
table.community_cards.push(table.deck.pop());
|
||
} else {
|
||
player.send("§cTüm kartlar zaten açık!");
|
||
}
|
||
saveLobbyData(c, lobby);
|
||
refreshTablePlayers(c, tableId);
|
||
}
|
||
return;
|
||
}
|
||
|
||
// OYUNU SIFIRLA (El Sonu)
|
||
if (lastAction === "btn_reset") {
|
||
if (table.host === playerName) {
|
||
table.state = "waiting";
|
||
table.community_cards = [];
|
||
table.pot = 0;
|
||
for (var i = 0; i < table.players.length; i++) {
|
||
table.players[i].cards = [];
|
||
table.players[i].bet = 0;
|
||
table.players[i].folded = false;
|
||
}
|
||
c.executeCommand(
|
||
```
|