TA的每日心情 | 衰 2022-12-15 19:48 |
---|
签到天数: 6 天 [LV.2]偶尔看看I
中级会员
- 积分
- 355
|
這些資源是從對岸拿到的,我也不記得是從哪個拿的,就分享一下我比較常逛的論壇:楓業物語論壇我記得原本是可以輸入賭注的,但是我使用的時候輸入問題還沒解決,所以全部改為統一賭注,如果有需要輸入賭注的話可以自己修改掉。 有一些已經很多人分享過了,我這邊就再貼一次順便加上一些註解。 在開始之前先說幾個重點函數: - Math.random() 函數隨機產生一數在範圍 [0,1),包括 0 但不包括 1。
- Math.floor() 函式會回傳無條件捨去後的最大整數。
[Java] 纯文本查看 复制代码 cm.getPlayer().getCSPoints(1); //判斷玩家GASH數 (1是GASH,2是楓葉點數
cm.getPlayer().modifyCSPoints(1, -50, true); //給予或扣除GASH
cm.haveItem(物品id, 數量); //判断玩家背包是否有此道具數量
cm.gainItem(物品id, 數量); //给予或者收取指定物品數量
cm.getPlayer().itemQuantity(物品id); //判斷玩家背包中這個物品有多少數
cm.getPlayer().getMeso(); //判斷玩家楓幣數
cm.gainMeso(-10000000); //給予或扣除(-)玩家楓幣
cm.getPlayer().getLevel(); //判斷玩家等級
cm.worldMessage(6,"公告"); //6為藍字廣播,5為紅字廣播 [JavaScript] 纯文本查看 复制代码 /*
* 賭博21点
*
*
*/
var text = "";
var text1 = "";
var score = 0;
var zhuangScore = 0;
var xianScore = 0;
var paiArray = Array("A", 2, 3, 4, 5, 6, 7, 8, 9, 10, "J", "Q", "K");
var paiArray2 = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10);
var ran = -1;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (status == 0 && mode == 0) {
cm.sendOk("歡迎下次光臨~");
cm.dispose();
return;
}
if (mode == 1) {
status++;
} else {
if (status == 0) {
cm.sendNext("歡迎下次光臨~");
cm.dispose();
}
status--;
}
if (status == 0) {
score = cm.getMeso();
text += "#fUI/UIWindow/Quest/icon3/6# ";
text += "你好,在我這裡可以玩21點,一次#r50GASH#k哦。";
text += " #fUI/UIWindow/Quest/icon3/6#\r\n";
text += "#L0# 開始遊戲 #l\r\n";
text += "#L1# 遊戲說明 #l\r\n";
cm.sendSimple(text);
} else if (status == 1) {
if (selection == 0) {
cm.sendOk("賭友你要繼續下注嗎?");
} else if (selection == 1) {
text1 += "#fUI/UIWindow/Quest/icon3/6# ";
text1 += "玩法說明:";
text1 += " #fUI/UIWindow/Quest/icon3/6#\r\n";
text1 += " 莊家的點數會在15點-22點之間(#r莊家也有可能爆掉#k),你有4次要牌的機會,如果你的點數大於莊家的點數即贏得你下注的金額,如果大於21點或者小於等於莊家的點數,即輸掉你所下注的金額,10、J、Q、K都算十點,小賭怡情,大賭傷人,請慎重。";
cm.sendOk(text1);
cm.dispose();
}
}
//-------------第一次要牌-----------------//
else if (status == 2) {
if (cm.getPlayer().getLevel() < 70) { //這邊可以設定玩家等級限制
cm.sendOk("必須達到70級才能使用。");
cm.dispose();
} else if (cm.getPlayer().getCSPoints(1) < 50) { //這邊可以設置賭注
cm.sendOk("你沒有50GASH");
cm.dispose();
} else {
cm.getPlayer().modifyCSPoints(1, -50, true);
zhuangScore = parseInt(Math.random() * 8 + 15);
ran = parseInt(Math.random() * paiArray.length);
xianScore = paiArray2[ran];
var text2 = "";
text2 += "拿到了 #r#e" + paiArray[ran] + "#n#k,您目前的點數為: #r#e" + xianScore + "#n#k ,";
text2 += "您繼續要牌嗎? \r\n";
text2 += "#L2# 要 \r\n";
text2 += "#L3# 不要 \r\n";
cm.sendSimple(text2);
}
}
//------------第二次要牌------------------//
else if (status == 3) {
if (selection == 2) {
ran = parseInt(Math.random() * paiArray.length);
xianScore += paiArray2[ran];
if (xianScore > 21) {
cm.sendOk("對不起,您的點數大於21點,您輸了。");
cm.dispose();
} else {
text2 = "";
text2 += "拿到了 #r#e" + paiArray[ran] + "#n#k,您目前的點數為: #r#e" + xianScore + "#n#k ,";
text2 += "您繼續要牌嗎? \r\n";
text2 += "#L4# 要 \r\n";
text2 += "#L5# 不要 \r\n";
cm.sendSimple(text2);
}
} else if (selection == 3) {
if ((xianScore < 22 && xianScore <= zhuangScore && zhuangScore < 22) || (xianScore >= 22 && zhuangScore >= 22)) {
cm.sendOk("莊家的點數為 #r#e" + zhuangScore + "#n#k,您的點數為 #r#e" + xianScore + "#n#k,您輸了。");
cm.dispose();
} else {
cm.sendOk("#fUI/UIWindow/Quest/reward#\r\n 莊家的點數為 #r#e" + zhuangScore + "#n#k,您的點數為 #r#e" + xianScore + "#n#k,您贏了。");
cm.worldMessage(6,"[賭博公告]:玩家 " + cm.getPlayer().getName() + " ,在賭場二十一點贏了,將籌碼翻了【兩倍】獲得100點GASH!");
cm.getPlayer().modifyCSPoints(1, 100, true);
cm.gainItem(4031189,1); //這裡可以另外設定獎勵,不要的話可刪除
cm.dispose();
}
}
}
//-----------第三次要牌---------------
else if (status == 4) {
if (selection == 4) {
ran = parseInt(Math.random() * paiArray.length);
xianScore += paiArray2[ran];
if (xianScore > 21) {
cm.sendOk("對不起,您的點數大於21點,您輸了");
cm.dispose();
} else {
text2 = "";
text2 += "拿到了 #r#e" + paiArray[ran] + "#n#k,您目前的點數為: #r#e" + xianScore + "#n#k ,";
text2 += "您繼續要牌嗎? \r\n";
text2 += "#L6# 要 \r\n";
text2 += "#L7# 不要 \r\n";
cm.sendSimple(text2);
}
} else if (selection == 5) {
if ((xianScore < 22 && xianScore <= zhuangScore && zhuangScore < 22) || (xianScore >= 22 && zhuangScore >= 22)) {
cm.sendOk("莊家的點數為 #r#e" + zhuangScore + "#n#k,您的點數為 #r#e" + xianScore + "#n#k,您輸了。");
cm.dispose();
} else {
cm.sendOk("#fUI/UIWindow/Quest/reward#\r\n 莊家的點數為 #r#e" + zhuangScore + "#n#k,您的點數為 #r#e" + xianScore + "#n#k,您贏了。");
cm.worldMessage(6,"[賭博公告]:玩家 " + cm.getPlayer().getName() + " ,在賭場二十一點贏了,將籌碼翻了【兩倍】獲得100點GASH!");
cm.getPlayer().modifyCSPoints(1,100, true);
cm.gainItem(4031189,1);
cm.dispose();
}
}
}
//--------第四次要牌----------
else if (status == 5) {
if (selection == 6) {
ran = parseInt(Math.random() * paiArray.length);
xianScore += paiArray2[ran];
if (xianScore > 21) {
cm.sendOk("對不起,您的點數大於21點,您輸了");
cm.dispose();
} else {
if ((xianScore < 22 && xianScore <= zhuangScore && zhuangScore < 22) || (xianScore >= 22 && zhuangScore >= 22)) {
cm.sendOk("莊家的點數為 #r#e" + zhuangScore + "#n#k,您的點數為 #r#e" + xianScore + "#n#k,您輸了。");
cm.dispose();
} else {
cm.sendOk("#fUI/UIWindow/Quest/reward#\r\n 莊家的點數為 #r#e" + zhuangScore + "#n#k,您的點數為 #r#e" + xianScore + "#n#k,您贏了。");
cm.worldMessage(6,"[賭博公告]:玩家 " + cm.getPlayer().getName() + " ,在賭場二十一點贏了,將籌碼翻了【兩倍】獲得100點GASH!");
cm.getPlayer().modifyCSPoints(1, 100, true);
cm.gainItem(4031189,1);
cm.dispose();
}
}
} else if (selection == 7) {
if ((xianScore < 22 && xianScore <= zhuangScore && zhuangScore < 22) || (xianScore >= 22 && zhuangScore >= 22)) {
cm.sendOk("莊家的點數為 #r#e" + zhuangScore + "#n#k,您的點數為 #r#e" + xianScore + "#n#k,您是輸了。");
cm.dispose();
} else {
cm.sendOk("#fUI/UIWindow/Quest/reward#\r\n 莊家的點數為 #r#e" + zhuangScore + "#n#k,您的點數為 #r#e" + xianScore + "#n#k,您贏了。");
cm.worldMessage(6,"[賭博公告]:玩家 " + cm.getPlayer().getName() + " ,在賭場二十一點贏了,將籌碼翻了【兩倍】獲得100點GASH!");
cm.getPlayer().modifyCSPoints(1, 100, true);
cm.gainItem(4031189,1);
cm.dispose();
}
}
}
}
}
十倍賭博機其實就只是一個靠運氣的機器,沒有什麼玩法。 [JavaScript] 纯文本查看 复制代码 var status = 0;
var fee;
var chance = Math.floor(Math.random() * 12 + 1); //這裡可以設定機率
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0) {
cm.sendOk("#i3994125# - 我會繼續在這裡等著你。");
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendAcceptDecline("#r【十倍賭博機】\r\n#d-看來你的心很大啊,其他賭博機滿足不了你了嗎?#i3994125# #k\r\n ");
} else if (status == 1) {
cm.sendOk("#i3994125#\r\n如果你能贏我,我會將你的籌碼數倍奉還,而且還有神秘禮品");
} else if (status == 2) {
fee = cm.getText();
cm.sendYesNo("#i3994125# - 你確認要繼續下注嗎?一次消耗#r50GASH#k。");
} else if (status == 3) {
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("必須達到70級才能使用。");
cm.dispose();
} else if (cm.getPlayer().getCSPoints(1) < 50) {
cm.sendOk("你沒有50GASH");
cm.dispose();
} else {
if (chance <= 1) {
cm.getPlayer().modifyCSPoints(1, -50, true);
cm.sendNext("#i3994125# - #r你輸了#k");
// cm.worldMessage(6, "[賭場公告]:玩家 " + cm.getChar().getName() + " ,在賭場十倍賭博機輸了,看來今天並不被女神眷顧!");
cm.dispose();
} else if (chance == 2) {
cm.sendNext("#i3994125# - #r這把不算,重新再來,你手不要抖動。#k");
cm.dispose();
} else if (chance == 3) {
cm.getPlayer().modifyCSPoints(1, -50, true);
cm.sendNext("#i3994125# - #r你輸了#k");
cm.dispose();
} else if (chance == 4) {
cm.getPlayer().modifyCSPoints(1, -50, true);
cm.sendNext("#i3994125# - #r你輸了#k");
cm.dispose();
} else if (chance == 5) {
cm.sendNext("#i3994125# - #r這把不算,重新再來,你手不要抖動。#k");
cm.dispose();
} else if (chance == 6) {
cm.getPlayer().modifyCSPoints(1, -50, true);
cm.sendNext("#i3994125# - #r你輸了#k");
cm.dispose();
} else if (chance == 7) {
cm.sendNext("#i3994125# - #r這把不算,重新再來,你手不要抖動。#k");
cm.dispose();
} else if (chance == 8) {
cm.getPlayer().modifyCSPoints(1, -50, true);
cm.sendNext("#i3994125# - #r你輸了#k");
cm.dispose();
} else if (chance == 9) {
cm.getPlayer().modifyCSPoints(1, -50, true);
cm.sendNext("#i3994125# - #r你輸了#k");
cm.dispose();
} else if (chance == 10) {
cm.getPlayer().modifyCSPoints(1, -50, true);
cm.sendNext("#i3994125# - #r你輸了#k");
cm.dispose();
} else if (chance == 11) {
cm.getPlayer().modifyCSPoints(1, -50, true);
cm.sendNext("哦··你的運氣不怎麼好哦··哈哈 再來一把嘛!");
cm.dispose();
} else if (chance >= 12) {
cm.getPlayer().modifyCSPoints(1, 500, true);
cm.gainItem(4031189,1);
cm.sendNext("#i3994125# -#r不錯哦,恭喜你贏了,我願賭服輸!獲得500點數");
cm.worldMessage(6,"[賭場公告]:玩家 " + cm.getPlayer().getName() + " ,在賭場十倍賭博機贏了,將籌碼翻了【十倍】獲得500點數!");
cm.dispose();
}
}
}
}
}
比大小
[JavaScript] 纯文本查看 复制代码 var status = 0;
//var 黑水晶 = 4021008;
//var 藍色箭頭 = "#fUI/UIWindow/Quest/icon2/7#";
//var 紅色箭頭 = "#fUI/UIWindow/Quest/icon6/7#";
//var 圓形 = "#fUI/UIWindow/Quest/icon3/6#";
//var 美化new = "#fUI/UIWindow/Quest/icon5/1#";
//var 驚嘆號 = "#fUI/UIWindow/Quest/icon0#";
var 正方箭頭 = "#fUI/Basic/BtHide3/mouseOver/0#";
/*以上都是小圖示路徑,用來裝飾的,可以修改*/
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (status >= 0 && mode == 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
var a1 = "#L1##b" + 正方箭頭 + " 50 GASH 【大】【小】\r\n";
var a2 = "#L2##b" + 正方箭頭 + " 250GASH 【大】【小】\r\n";
var a3 = "#L3##b" + 正方箭頭 + " 500GASH 【大】【小】\r\n";
cm.sendSimple("\r\n#d-來來來,買大買小,買定離手#i3994122# #r【大小賭博機】\r\n#r 【賠率】1:2【概率】5:5\r\n" + a1 + "" + a2 + "" + a3 + "");
} else if (selection == 1) {
if (cm.getPlayer().getLevel() < 70) {
cm.sendOk("必須達到70級才能使用。");
cm.dispose();
return;
} else {
if (cm.getPlayer().getCSPoints(1) >= 50) {
cm.getPlayer().modifyCSPoints(1, -50, true);
var rand = Math.floor(Math.random() * 100);
if (rand < 50) {
cm.getPlayer().modifyCSPoints(1, 100, true);
cm.gainItem(4031189,1);
cm.sendOk("恭喜你,贏了");
cm.dispose();
cm.worldMessage(6,"[賭場公告]:玩家 " + cm.getPlayer().getName() + " ,在賭場選大小點贏了,將籌碼x1翻了【兩倍】獲得100點GASH!");
return;
} else {
cm.sendOk("唉,輸了");
cm.dispose();
return;
}
} else {
cm.sendOk("你沒有足夠的GASH.~");
cm.dispose();
return;
}
}
} else if (selection == 2) {
if (cm.getPlayer().getLevel() < 25) {
cm.sendOk("必須達到25級才能使用。");
cm.dispose();
return;
} else {
if (cm.getPlayer().getCSPoints(1) >= 250) {
cm.getPlayer().modifyCSPoints(1, -250, true);
var rand = Math.floor(Math.random() * 100);
if (rand < 50) {
cm.getPlayer().modifyCSPoints(1, 500, true);
cm.gainItem(4031189,1);
cm.sendOk("恭喜你,贏了");
cm.dispose();
cm.worldMessage(6,"[賭場公告]:玩家 " + cm.getPlayer().getName() + " ,在賭場選大小點贏了,將籌碼x5翻了【兩倍】獲得500點GASH!");
return;
} else {
cm.sendOk("唉,輸了");
cm.dispose();
return;
}
} else {
cm.sendOk("你沒有足夠的GASH~");
cm.dispose();
return;
}
}
} else if (selection == 3) {
if (cm.getPlayer().getLevel() < 25) {
cm.sendOk("必須達到25級才能使用。");
cm.dispose();
return;
} else {
if (cm.getPlayer().getCSPoints(1) >= 500) {
cm.getPlayer().modifyCSPoints(1, -500, true);
var rand = Math.floor(Math.random() * 100);
if (rand < 50) {
cm.getPlayer().modifyCSPoints(1, 1000, true);
cm.gainItem(4031189,1);
cm.sendOk("恭喜你,贏了");
cm.dispose();
cm.worldMessage(6,"[賭場公告]:玩家 " + cm.getPlayer().getName() + " ,在賭場選大小點贏了,將籌碼x10翻了【兩倍】獲得1000點GASH!");
return;
} else {
cm.sendOk("唉,輸了");
cm.dispose();
return;
}
} else {
cm.sendOk("你沒有足夠的GASH~");
cm.dispose();
return;
}
}
}
}
}
踩地雷
[JavaScript] 纯文本查看 复制代码 var DEBUG = false;
var HIDDEN_ITEM = 4031325, MINE_ITEM = 5021013, EXPLODED_ITEM = 5120009;//這邊可以設定隱藏的圖示(HIDDEN_ITEM)、鞭炮的圖示(EXPLODED_ITEM)、地雷的圖示(MINE_ITEM)
var Modes = [
["#d簡單#k", 5, 5, 4], //5*5 , 有3個地雷+1個鞭炮
["#b中等#k", 6, 6, 8], //6*6 , 有7個地雷+1個鞭炮
["#r困難#k", 7, 7, 15] //7*7 , 有14個地雷+1個鞭炮
];
var text = "";
var status;
var Board, Revealed;
var VALUE_REVEALED = 1, VALUE_HIDDEN = 0;
var ModeSelected = -1, StartTime = -1, NumCols = -1,
NumRows = -1, NumMines = -1, LeftToBeRevealed = -1;
var Neighbors = [
[-1, -1], [-1, 0], [-1, 1], [0, -1],
[0, 1], [1, -1], [1, 0], [1, 1]
];
var Numbers = [ //這邊可以設定數字的樣式,預設是裝飾聖誕樹的紅色數字
3990009, 3990000, 3990001, 3990002, 3990003,
3990004, 3990005, 3990006, 3990007, 3990008
];
function start() {
status = -1;
action(1, 0, 0);
}
function Header() {
return "#d============ 踩地雷 ============#k\r\n\r\n";
}
function ConstructModeSelectionString() {
var ret = "";
for (var i = 0; i < Modes.length; i++) {
ret += "#L" + i + "#" + Modes[i][0] + " (" + Modes[i][1] + "x" + Modes[i][2] + ") 地雷數: " + Modes[i][3] + "#l\r\n";
}
return ret;
}
function InitializeBoard() {
NumCols = Modes[ModeSelected][1];
NumRows = Modes[ModeSelected][2];
NumMines = Modes[ModeSelected][3];
LeftToBeRevealed = NumCols * NumRows - NumMines;
if (LeftToBeRevealed == 21) {
text = "簡單模式";
} else if (LeftToBeRevealed == 28) {
text = "中等模式";
} else if (LeftToBeRevealed == 34) {
text = "困難模式";
}
Board = new Array(NumCols);
for (var i = 0; i < NumCols; i++) {
Board[i] = new Array(NumRows);
}
Revealed = new Array(NumCols);
for (i = 0; i < NumCols; i++) {
Revealed[i] = new Array(NumRows);
for (var j = 0; j < NumRows; j++) {
Revealed[i][j] = VALUE_HIDDEN;
}
}
InitializeMines();
InitializeMineCounts();
InitializeBlankSpaces();
}
function InitializeMines() {
var AllPosition = new Array(NumRows * NumCols);
for (var i = 0; i < NumCols; i++) {
for (var j = 0; j < NumRows; j++) {
AllPosition[(i * NumCols) + j] = [i, j];
}
}
Shuffle(AllPosition);
for (i = 0; i < NumMines && AllPosition.length > 0; i++) {
var NewMine = AllPosition.pop();
Board[NewMine[0]][NewMine[1]] = MINE_ITEM;
}
}
function InitializeMineCounts() {
for (var r = 0; r < NumCols; r++) {
for (var c = 0; c < NumRows; c++) {
if (Board[r][c] != MINE_ITEM) {
var Count = 0;
for (var k = 0; k < Neighbors.length; k++) {
var NewR = r + Neighbors[k][0];
var NewC = c + Neighbors[k][1]
if (ValidPosition(NewR, NewC) && Board[NewR][NewC] == MINE_ITEM) {
Count++;
}
}
Board[r][c] = Numbers[Count];
}
}
}
}
function InitializeBlankSpaces() {
for (var i = 0; i < NumCols; i++) {
for (var j = 0; j < NumRows; j++) {
if (Board[i][j] == null) {
Board[i][j] = HIDDEN_ITEM;
}
}
}
}
function ConstructBoardString() {
var ret = "剩下的數字數目: " + LeftToBeRevealed + "\r\n";
var num = 0;
for (var i = 0; i < NumCols; i++) {
for (var j = 0; j < NumRows; j++) {
if (Revealed[i][j] == VALUE_REVEALED) {
ret += "#L" + num + "##v" + Board[i][j] + "##l";
} else {
if (DEBUG && Board[i][j] == MINE_ITEM) {
ret += "#L" + num + "##v" + MINE_ITEM + "##l";
} else {
ret += "#L" + num + "##v" + HIDDEN_ITEM + "##l";
}
}
num++;
}
ret += "\r\n";
}
return ret;
}
function ConstructEndBoardString() {
var ret = "";
var num = 0;
for (var i = 0; i < NumCols; i++) {
for (var j = 0; j < NumRows; j++) {
if (Revealed[i][j] == VALUE_REVEALED) {
if (Board[i][j] == MINE_ITEM) {
ret += "#v" + EXPLODED_ITEM + "#";
} else {
ret += "#v" + Board[i][j] + "#";
}
} else {
if (Board[i][j] == MINE_ITEM) {
ret += "#v" + MINE_ITEM + "#";
} else {
ret += "#v" + HIDDEN_ITEM + "#";
}
}
num++;
}
ret += "\r\n";
}
return ret;
}
function Shuffle(arr) {
var i = arr.length;
if (i == 0)
return;
while (--i) {
var j = Math.floor(Math.random() * (i + 1));
var tempi = arr[i];
var tempj = arr[j];
arr[i] = tempj;
arr[j] = tempi;
}
}
function ValidPosition(r, c) {
return r >= 0 && r < NumRows && c >= 0 && c < NumCols;
}
function GetPositionFromSelection(sel) {
return [(sel / NumCols) | 0, (sel % NumCols) | 0];
}
function IsGameOver() {
return LeftToBeRevealed == 0;
}
function GetGameTime(End) {
var Diff = End - StartTime;
var MilliSec = (Diff % 1000) | 0;
Diff /= 1000;
var Min = (Diff / 60) | 0;
var Sec = (Diff % 60) | 0;
return ((Min < 10) ? "0" + Min : Min) + ":" + ((Sec < 10) ? "0" + Sec : Sec)
+ "." + ((MilliSec < 100) ? "0" + ((MilliSec < 10) ? "0" + MilliSec : MilliSec) : MilliSec);
}
function action(mode, type, selection) {
if (mode == -1 || mode == 0)
cm.dispose();
else {
if (status != 2)
status++;
if (status == 0) {
cm.sendSimple(Header() + "請選擇模式:\r\n" + ConstructModeSelectionString())
} else if (status == 1) {
if (selection < 0 || selection > Modes.length) {
cm.dispose();
return;
}
ModeSelected = selection;
InitializeBoard();
cm.sendSimple(Header() + ConstructBoardString());
} else if (status == 2) {
if (StartTime == -1) {
StartTime = (new Date()).getTime();
}
var SendStr = Header();
var Move = GetPositionFromSelection(selection);
if (!ValidPosition(Move[0], Move[1])) {
cm.sendOk("PE Detected ...");
return;
}
if (Revealed[Move[0]][Move[1]] == VALUE_REVEALED) {
SendStr += "該空格已被打開啟 ...\r\n\r\n" + ConstructBoardString();
cm.sendSimple(SendStr);
return;
}
Revealed[Move[0]][Move[1]] = VALUE_REVEALED;
LeftToBeRevealed--;
SendStr += ConstructBoardString();
if (Board[Move[0]][Move[1]] == MINE_ITEM) {
cm.sendOk(Header() + ConstructEndBoardString() + "\r\n你輸了!! 遊戲時間: " + GetGameTime((new Date()).getTime()));
cm.dispose();
} else {
if (IsGameOver()) {
cm.sendOk(Header() + ConstructEndBoardString() + "\r\n你贏了!! 遊戲時間: " + GetGameTime((new Date()).getTime()));
cm.worldMessage(6,"『踩地雷小遊戲』:恭喜玩家:" + cm.getPlayer().getName() + " 花費: " + GetGameTime((new Date()).getTime()) + " 成功完成了" + text + "的踩地雷!!!");
cm.getPlayer().modifyCSPoints(1, 200, true);
cm.gainItem(4031189,1);
cm.dispose();
} else {
cm.sendSimple(SendStr);
}
}
}
}
}
老虎機
[JavaScript] 纯文本查看 复制代码 /*老虎機*/
var status = 0;
var fee;
var winner;
var item=4021000;
var card1 = Math.floor(Math.random()*8+item);
var card2 = Math.floor(Math.random()*8+item);
var card3 = Math.floor(Math.random()*8+item);
var card4 = Math.floor(Math.random()*8+item);
var card5 = Math.floor(Math.random()*8+item);
var card6 = Math.floor(Math.random()*8+item);
var card7 = Math.floor(Math.random()*8+item);
var card8 = Math.floor(Math.random()*8+item);
var card9 = Math.floor(Math.random()*8+item);
/*這台老虎機是用各類水晶來遊戲的,從4021000(石榴石)-4021007(鑽石)*/
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 0) {
cm.sendOk("你的損失。你或許可以贏得大錢。");
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendNext("你想玩#b老虎機#k嗎? 這個機台是六倍的賠率喔!!\r\n#v4021000##v4021001##v4021002##v4021003##v4021004##v4021005##v4021006##v4021007#寶石連線,就可獲勝");
} else if (status == 1) {
fee = 10000000;
cm.sendYesNo("你確定要下注 #r" + fee + "#k 楓幣嗎?... ");
} else if (status == 2) {
if (cm.getMeso() < fee) {
cm.sendOk("你沒有那麼多錢");
cm.dispose();
} else if (cm.getMeso() + fee * 6 > 2100000000) {
cm.sendOk("如果你贏了這一把,身上的錢會超過21億,請先將金錢存放至倉庫。");
cm.dispose();
} else { //這邊是判斷連線的部分
if (card1 == card2 && card2 == card3) {
winner = 1;
} else if (card1 == card5 && card5 == card9) {
winner = 1;
} else if (card4 == card5 && card5 == card6) {
winner = 1;
} else if (card7 == card8 && card8 == card9) {
winner = 1;
} else if (card7 == card5 && card5 == card3) {
winner = 1;
} else if (card1 == card4 && card4 == card7) {
winner = 1;
} else if (card2 == card5 && card5 == card8) {
winner = 1;
} else if (card3 == card6 && card6 == card9) {
winner = 1;
} else {
winner = 2;
}
if (winner == 1) {
cm.sendOk("老虎機: \r\n\r\n#v" +
card1 + "##v " + card2 + "##v " + card3 + "# \r\n#v" +
card4 + "##v " + card5 + "##v " + card6 + "# \r\n#v" +
card7 + "##v " + card8 + "##v " + card9 +
"#\r\n\r\n 恭喜!你贏了!");
cm.gainMeso(fee * 6); //這裡設定獎勵
cm.gainItem(4031189,1);
cm.dispose();
} else if (winner == 2) {
cm.sendOk("老虎機: \r\n\r\n#v" +
card1 + "##v " + card2 + "##v " + card3 + "# \r\n#v" +
card4 + "##v " + card5 + "##v " + card6 + "# \r\n#v" +
card7 + "##v " + card8 + "##v " + card9 +
"#\r\n\r\n 你輸了!再接再厲!");
cm.gainMeso(-fee);
cm.dispose();
} else {
cm.dispose();
}
}
}
}
}
|
|