prt_in.gat,222,36,5 script PVP Blackjack 816,{ if ($@game == 1 && strcharinfo(0) == $@bp$[4]) goto B_Pending; if ($@game == 1) goto B_JoinGame; if ($@game == 2) goto B_PlayerCheck; // No game started, player may start one mes "[PVP Blackjack]"; mes "ようこそPvPブラックジャックへ!"; mes "現在エントリーしている方は居ないようです。"; mes "エントリー受付を開始しますか?"; next; menu "はい",-,"いいえ",L_Cancel; if ($@game != 0) goto ER_GameStarted; mes "[PVP Blackjack]"; mes "エントリー受付開始しました。"; mes "プレイヤーさんの参加待ちです。"; mes "最低二人からの参加者でゲームを開始出来ます。"; // Resets variables set $@game,1; set $@players,0; set $@turn,0; set @topscore,0; set $@deck[1],4; set $@deck[2],4; set $@deck[3],4; set $@deck[4],4; set $@deck[5],4; set $@deck[6],4; set $@deck[7],4; set $@deck[8],4; set $@deck[9],4; set $@deck[10],4; set $@deck[11],4; set $@deck[12],4; set $@deck[13],4; set $@bp$[0],""; set $@bp$[1],""; set $@bp$[2],""; set $@bp$[3],""; set $@bp$[4],""; set $@bp[0],0; set $@bp[1],0; set $@bp[2],0; set $@bp[3],0; set $@bp[4],0; set $@charlie[0],0; set $@charlie[1],0; set $@charlie[2],0; set $@charlie[3],0; set $@charlie[4],0; set @joined,1; set @hit,0; set @aces,0; set @total,0; set @card[0],0; set @card[1],0; set @card[2],0; set @card[3],0; set @card[4],0; set @dispall$,""; set $@bp$[4],strcharinfo(0); initnpctimer; announce $@bp$[4] + " さんがブラックジャックのエントリー受付を開始しました。",2; close; // Host may check status or manual start B_Pending: if ($@players >= 1) goto L_ManualStart; mes "[PVP Blackjack]"; mes "他のプレイヤーさんのエントリーまでお待ちください。"; mes "なお、エントリーの待ち時間の方は1分となっております。"; mes "時間切れになってしまった場合お手数ですが再度エントリーの方をお願いします。"; close; L_ManualStart: mes "[PVP Blackjack]"; mes "現在" + $@players + "人の方がゲームにエントリーしています。"; mes "ゲームを始めますか?"; menu "始める",L_StartGame,"やめておく",L_Cancel; // Players may join the game B_JoinGame: if (@joined != 0) goto ER_AlreadyJoined; if ($@players >= 5) goto ER_FullGame; mes "[PVP Blackjack]"; mes "現在" + $@players + "人の方がゲームにエントリーしています。"; mes "あなたも参加しますか?"; next; menu "参加する",-,"やめておく",L_Cancel; set $@bp$[$@players],strcharinfo(0); set $@players,$@players+1; announce strcharinfo(0) + "さんがゲームに参加しました [" + $@players + "]",2; set @joined,1; set @hit,0; set @aces,0; set @total,0; set @card[0],0; set @card[1],0; set @card[2],0; set @card[3],0; set @card[4],0; set @dispall$,""; mes "[PVP Blackjack]"; mes "がんばってくださいね。"; if ($@players >= 4) goto L_StartGame; close; // Game starts L_StartGame: if ($@game > 1) goto ER_AlreadyStarted; set $@game,2; announce "ブラックジャック開始します。",2; mapannounce "prt_in.gat","" + $@bp$[0] + "さんのターンです",16; setnpctimer 0; close; // Checks if it is the player's turn B_PlayerCheck: if (strcharinfo(0) == $@bp$[0]) goto L_P0; if (strcharinfo(0) == $@bp$[1]) goto L_P1; if (strcharinfo(0) == $@bp$[2]) goto L_P2; if (strcharinfo(0) == $@bp$[3]) goto L_P3; if (strcharinfo(0) == $@bp$[4]) goto L_P4; mes "[PVP Blackjack]"; mes "You are not part of this game."; close; L_P0: if ($@turn != 0) goto ER_NotTurn; goto L_TakeTurn; L_P1: if ($@turn != 1) goto ER_NotTurn; goto L_TakeTurn; L_P2: if ($@turn != 2) goto ER_NotTurn; goto L_TakeTurn; L_P3: if ($@turn != 3) goto ER_NotTurn; goto L_TakeTurn; L_P4: if ($@turn != 4) goto ER_NotTurn; goto L_TakeTurn; // Player's turn L_TakeTurn: if ($@bp$[$@turn] != strcharinfo(0)) goto ER_NotTurn; if (@hit == 5) goto L_Stay; mes "[PVP Blackjack]"; set @joined,0; L_TakeTurn_3: set @rand,rand (1, 13); if ($@deck[@rand] == 0) goto L_TakeTurn_3; set $@deck[@rand],$@deck[@rand]-1; set @disp$,""+@rand+""; if (@rand == 11) set @disp$,"J"; if (@rand == 12) set @disp$,"Q"; if (@rand == 13) set @disp$,"K"; if (@rand == 1) set @disp$,"A"; set @colour,rand(0, 1); if (@colour == 1) set @colour$,"^FF0000"; if (@colour == 0) set @colour$,""; // Added for cosmetics, it's possible to get 3 queens for example set @dispall$,@dispall$ + " [" + @colour$ + @disp$ + "^000000]"; if (@hit > 1) announce strcharinfo(0) + " hit [" + @disp$ + "]",2; if (@rand > 10) set @rand,10; set @card[@hit],@rand; if (@hit != 0) mes @dispall$; if (@card[@hit] == 1) set @aces,@aces+1; set @total,@card[0] + @card[1] + @card[2] + @card[3] + @card[4]; if (@aces == 0) goto L_TakeTurn_1; set @acestotal,@aces*10; set @acestotal,@total+@acestotal; if (@hit >= 1) mes "Total: " + @total + " or " + @acestotal; goto L_TakeTurn_2; L_TakeTurn_1: if (@hit >= 1) mes "Total: " + @total; L_TakeTurn_2: set @hit,@hit+1; if (@hit == 1) goto L_TakeTurn_3; // Deals two initial cards if (@hit == 5) goto L_Stay; next; menu "ヒット(カードを取る)",L_TakeTurn,"スタンド(勝負!)",L_Stay; L_Stay: if (@aces == 0) goto L_Stay_1; menu @total,L_Stay_1,@acestotal,-; set @total,@acestotal; goto L_Stay_1; L_Stay_1: set $@bp[$@turn],@total; if (@card[4] != 0 && @total <= 21) set $@charlie[$@turn],1; announce strcharinfo(0) + " has chosen to stay",2; L_NextTurn: set $@turn,$@turn+1; if ($@turn >= 5) goto L_EndGame; if ($@bp$[$@turn] == "") set $@turn,4; mapannounce "prt_in.gat","" + $@bp$[$@turn] + "さんのターンです",16; setnpctimer 0; close; end; // End of game L_EndGame: stopnpctimer; setnpctimer 0; if ($@bp$[0] != "") mapannounce "prt_in.gat", $@bp$[0] + "'s total: " + $@bp[0],16; if ($@bp$[1] != "") mapannounce "prt_in.gat", $@bp$[1] + "'s total: " + $@bp[1],16; if ($@bp$[2] != "") mapannounce "prt_in.gat", $@bp$[2] + "'s total: " + $@bp[2],16; if ($@bp$[3] != "") mapannounce "prt_in.gat", $@bp$[3] + "'s total: " + $@bp[3],16; if ($@bp$[4] != "") mapannounce "prt_in.gat", $@bp$[4] + "'s total: " + $@bp[4],16; // Sets busts to 0 set @bust,0; L_Bust: if ($@bp[@bust] > 21) set $@bp[@bust],0; set @bust,@bust+1; if (@bust < 5) goto L_Bust; set @sort,0; L_Sort: if ($@bp[@sort] > @topscore && $@bp[@sort] <= 21) set @topscore,$@bp[@sort]; set @sort,@sort+1; if (@sort < 5) goto L_Sort; if ($@charlie[0] > 0 || $@charlie[1] > 0 || $@charlie[2] > 0 || $@charlie[3] > 0 || $@charlie[4] > 0) goto L_Charlie; if (@topscore == 0) goto L_EndGame_2; set @ann,0; L_AnnounceWin: if ($@bp[@ann] == @topscore) mapannounce "prt_in.gat", "勝者: " + $@bp$[@ann] + "さん!おめでとうございます!",16; set @ann,@ann+1; if (@ann < 5) goto L_AnnounceWin; goto L_EndGame_2; set @charlie,0; L_Charlie: if ($@charlie[@charlie] > 0) mapannounce "prt_in.gat", "勝者: " + $@bp$[@charlie] + " (Five Card Charlie)",16; set @charlie,@charlie+1; if (@charlie < 5) goto L_Charlie; L_EndGame_2: set $@game,0; set @joined,0; close; L_Cancel:bbbb: mes "[PVP Blackjack]"; mes "またお越しください"; close; ER_GameStarted: mes "[PVP Blackjack]"; mes "申し訳ございません。ただ今ゲーム中のためもうしばらくお待ちください。"; close; ER_NotTurn: set @total,@card[0] + @card[1] + @card[2] + @card[3] + @card[4]; mes "[PVP Blackjack]"; if (@dispall$ != "") mes @dispall$; mes "カード合計: " + @total; close; ER_FullGame: mes "[PVP Blackjack]"; mes "申し訳ございません。ただ今満席となっております。"; close; ER_AlreadyJoined: mes "[PVP Blackjack]"; mes "あなたはすでにゲームにエントリーしています。"; mes "何らかのエラーの場合一度ログアウトの方をお願いします。"; close; ER_AlreadyStarted: mes "[PVP Blackjack]"; mes "既にゲームを開始しています。"; close; OnTimer30000: if ($@game == 1) goto L_PendingTimeout; mapannounce "prt_in.gat", $@bp$[$@turn] + "待ち時間30秒を過ぎました。次の方へスキップします。",2; goto L_NextTurn; end; L_PendingTimeout: end; OnTimer60000: if ($@game == 2) end; if ($@players > 0) goto L_StartGame; mapannounce "prt_in.gat", "エントリー受付時間が切れてしまいました。",16; set $@game,0; end; } prontera.gat,96,255,0 warp lounge01 1,1,prt_in.gat,227,16 prt_in.gat,227,14,0 warp lounge02 1,1,prontera.gat,98,253