local TeenPatti = {};

TeenPatti.MACHINE_MONEY = 7;
TeenPatti.MACHINE_EMONEY = 8;
TeenPatti.MONEY = 0;
TeenPatti.EMONEY = 1;
-- 机器ID -> 币种
TeenPatti.MACHINE = {
	[TeenPatti.MACHINE_MONEY] = { money_type = TeenPatti.MONEY, },
	[TeenPatti.MACHINE_EMONEY] = { money_type = TeenPatti.EMONEY, },
}

-- 币种->机器ID
TeenPatti.Machine = {
	[TeenPatti.MONEY] = TeenPatti.MACHINE_MONEY,
	[TeenPatti.EMONEY] = TeenPatti.MACHINE_EMONEY,
}

-- 发牌间隔(单张)
TeenPatti.DealTime = 0.3;
-- 显示庄闲牌型延迟(开牌结束延迟多久显示牌型)
TeenPatti.LayWinTime = 0.4;
TeenPatti.OpenTime = { [1] = 0.7, [2] = 0.7 }

-- 发牌音效.10秒内相同音效路径只播放一次.
TeenPatti.Sound = {
	-- PK入场音效
	["pk"] = "sound/cop_pokermaster_popup.mp3",
	-- 收回筹码音效
	["chip_settle"] = "sound/cop_baccarat_chip_02.mp3",
	-- 玩家中奖WIN音效
	["win"] = "sound/cop_baccarat_win.mp3",
	-- 玩家Jackpot音效
	["jackpot"] = "sound/cop_jackpot_prize.mp3",
	-- 点击筹码音效
	["chip_change"] = "sound/cop_jackpot_changechips.mp3",
	-- 筹码飞行音效
	["chip_move"] = "sound/cop_baccarat_chip_01.mp3",
	-- 发牌音效
	["card_deal"] = "sound/cop_baccarat_poker_01.mp3",
	-- 开牌音效
	["card_open"] = "sound/cop_baccarat_poker_02.mp3",
}
-- 庄家Spine和动作
TeenPatti.Banker = {
	--待机
	["idle"] = { ["spine"] = "jinhua_falao", ["act"] = "act1", ["eft"] = "" },
	--胜利
	["win"] = { ["spine"] = "jinhua_falao", ["act"] = "act3", ["eft"] = "mst_shengli" },
	--失败
	["lose"] = { ["spine"] = "jinhua_falao", ["act"] = "act2", ["eft"] = "mst_shibai" },
}
-- 闲家Spine和动作
TeenPatti.Player = {
	--待机
	["idle"] = { ["spine"] = "jinhua_wanghou", ["act"] = "act1", ["eft"] = "" },
	--胜利
	["win"] = { ["spine"] = "jinhua_wanghou", ["act"] = "act3", ["eft"] = "mst_shengli" },
	--失败
	["lose"] = { ["spine"] = "jinhua_wanghou", ["act"] = "act2", ["eft"] = "mst_shibai" },
}

TeenPatti.CHIP = {
	CHIP_RATE_1 = 1, -- 倍率1
	CHIP_RATE_2 = 2, -- 倍率2
	CHIP_RATE_3 = 3, -- 倍率3
	CHIP_RATE_4 = 4, -- 倍率4
	CHIP_RATE_5 = 5, -- 倍率4
	CHIP_RATE_END = 6,
};

TeenPatti.BET_AREA = {
    BANKER = 1, -- 庄赢
    PLAYER = 2, -- 闲赢
    TIE = 3,    -- 平局
	HIGH_CARD = 4, -- 高牌
    PAIR = 5, -- 1对
    FLUSH = 6,  -- 同花
    STRAIGHT = 7,    -- 顺子
    FLUSHSTRAIGHT_3KIND = 8,  -- 同花顺/三条
};

TeenPatti.BetOdds = {
	[TeenPatti.MACHINE_MONEY] = {
		[TeenPatti.BET_AREA.BANKER] = 2.1,
		[TeenPatti.BET_AREA.PLAYER] = 2.1,
		[TeenPatti.BET_AREA.TIE] = 14,
		[TeenPatti.BET_AREA.HIGH_CARD] = 3,
		[TeenPatti.BET_AREA.PAIR] = 3.1,
		[TeenPatti.BET_AREA.FLUSH] = 10,
		[TeenPatti.BET_AREA.STRAIGHT] = 15,
		[TeenPatti.BET_AREA.FLUSHSTRAIGHT_3KIND] = 110,
	},

	[TeenPatti.MACHINE_EMONEY] = {
		[TeenPatti.BET_AREA.BANKER] = 2.1,
		[TeenPatti.BET_AREA.PLAYER] = 2.1,
		[TeenPatti.BET_AREA.TIE] = 14,
		[TeenPatti.BET_AREA.HIGH_CARD] = 3,
		[TeenPatti.BET_AREA.PAIR] = 3.1,
		[TeenPatti.BET_AREA.FLUSH] = 10,
		[TeenPatti.BET_AREA.STRAIGHT] = 15,
		[TeenPatti.BET_AREA.FLUSHSTRAIGHT_3KIND] = 110,
	},
}


--筹码类型
--[Machineid]
TeenPatti.Bet = {
	[TeenPatti.MACHINE_MONEY] = {
		[TeenPatti.CHIP.CHIP_RATE_1] = 10000,
		[TeenPatti.CHIP.CHIP_RATE_2] = 100000,
		[TeenPatti.CHIP.CHIP_RATE_3] = 1000000,
		[TeenPatti.CHIP.CHIP_RATE_4] = 10000000,
		[TeenPatti.CHIP.CHIP_RATE_5] = 100000000,
	},

	[TeenPatti.MACHINE_EMONEY] = {
		[TeenPatti.CHIP.CHIP_RATE_1] = 10,
		[TeenPatti.CHIP.CHIP_RATE_2] = 30,
		[TeenPatti.CHIP.CHIP_RATE_3] = 100,
		[TeenPatti.CHIP.CHIP_RATE_4] = 300,
		[TeenPatti.CHIP.CHIP_RATE_5] = 1000,
	},
}

TeenPatti.Machine = {
	[TeenPatti.MONEY] = TeenPatti.MACHINE_MONEY,
	[TeenPatti.EMONEY] = TeenPatti.MACHINE_EMONEY,
}

--下注筹码上限
--[Machineid]
TeenPatti.BetMax = {
	[TeenPatti.MACHINE_MONEY] = 100000000000,
	[TeenPatti.MACHINE_EMONEY] = 1000000,
}

--下注筹码上限
--[Machineid]
TeenPatti.BetAllMax = {
	[TeenPatti.MACHINE_MONEY] = 100000000000,
	[TeenPatti.MACHINE_EMONEY] = 1000000,
}

--筹码Icon
--[Machineid]
TeenPatti.BetIcon = {
	[TeenPatti.MACHINE_MONEY] = {
		[10000] = "tbmain_iconcm1",
		[100000] = "tbmain_iconcm2",
		[1000000] = "tbmain_iconcm3",
		[10000000] = "tbmain_iconcm4",
		[100000000] = "tbmain_iconcm5",
	},

	[TeenPatti.MACHINE_EMONEY] = {
		[10] = "tbmain_choumat1",
		[30] = "tbmain_choumat2",
		[100] = "tbmain_choumat3",
		[300] = "tbmain_choumat4",
		[1000] = "tbmain_choumat5",
	},
}

--按钮特效
TeenPatti.Transition = {
	[1] = "act_kapaichouma10k",
	[2] = "act_kapaichouma100k",
	[3] = "act_kapaichouma1M",
	[4] = "act_kapaichouma10M",
	[5] = "act_kapaichouma100M",
}

--推荐下注筹码
--[Machineid]
TeenPatti.Rate = {
	[TeenPatti.MACHINE_MONEY] = {
		[TeenPatti.CHIP.CHIP_RATE_1] = 11000000,
		[TeenPatti.CHIP.CHIP_RATE_2] = 110000000,
		[TeenPatti.CHIP.CHIP_RATE_3] = 1100000000,
		[TeenPatti.CHIP.CHIP_RATE_4] = 11000000000,
		[TeenPatti.CHIP.CHIP_RATE_5] = 110000000000,
	},

	[TeenPatti.MACHINE_EMONEY] = {
		[TeenPatti.CHIP.CHIP_RATE_1] = 1000,
		[TeenPatti.CHIP.CHIP_RATE_2] = 5000,
		[TeenPatti.CHIP.CHIP_RATE_3] = 10000,
		[TeenPatti.CHIP.CHIP_RATE_4] = 50000,
		[TeenPatti.CHIP.CHIP_RATE_5] = 50001,
	},
}

--Spine
TeenPatti.Spine = {
	[0] = {
		[1] = "hongxinA",
		[2] = "hongxin2",
		[3] = "hongxin3",
		[4] = "hongxin4",
		[5] = "hongxin5",
		[6] = "hongxin6",
		[7] = "hongxin7",
		[8] = "hongxin8",
		[9] = "hongxin9",
		[10] = "hongxin10",
		[11] = "hongxinJ",
		[12] = "hongxinQ",
		[13] = "hongxinK",
	},

	[1] = {
		[1] = "heitaoA",
		[2] = "heitao2",
		[3] = "heitao3",
		[4] = "heitao4",
		[5] = "heitao5",
		[6] = "heitao6",
		[7] = "heitao7",
		[8] = "heitao8",
		[9] = "heitao9",
		[10] = "heitao10",
		[11] = "heitaoJ",
		[12] = "heitaoQ",
		[13] = "heitaoK",
	},
	
	[2] = {
		[1] = "meihuaA",
		[2] = "meihua2",
		[3] = "meihua3",
		[4] = "meihua4",
		[5] = "meihua5",
		[6] = "meihua6",
		[7] = "meihua7",
		[8] = "meihua8",
		[9] = "meihua9",
		[10] = "meihua10",
		[11] = "meihuaJ",
		[12] = "meihuaQ",
		[13] = "meihuaK",
	},
	
	[3] = {
		[1] = "fangkuaiA",
		[2] = "fangkuai2",
		[3] = "fangkuai3",
		[4] = "fangkuai4",
		[5] = "fangkuai5",
		[6] = "fangkuai6",
		[7] = "fangkuai7",
		[8] = "fangkuai8",
		[9] = "fangkuai9",
		[10] = "fangkuai10",
		[11] = "fangkuaiJ",
		[12] = "fangkuaiQ",
		[13] = "fangkuaiK",
	},
}

--推荐下注筹码
TeenPatti.GetOddsShow = function(idMachine, eBetArea)
	if TeenPatti.BetOdds[idMachine] == nil then
		return "1:1"
	end

	if TeenPatti.BetOdds[idMachine][eBetArea] == nil then
		return "1:1"
	end
	return "1:"..TeenPatti.BetOdds[idMachine][eBetArea]
end

--推荐下注筹码
TeenPatti.GetRate = function(idMachine, HeroMoney)
	if TeenPatti.Rate[idMachine] == nil then
		return 1
	end
	
	for i = 1, #TeenPatti.Rate[idMachine] do
		if HeroMoney <= TeenPatti.Rate[idMachine][i] then 
			return i
		end
	end
	
    return TeenPatti.CHIP.CHIP_RATE_5
end

TeenPatti.GetChip = function(idMachine, nRate)
	if TeenPatti.Rate[idMachine] == nil then
		return 0
	end
	if TeenPatti.Rate[idMachine][nRate] == nil then
		return 0
	end

	return TeenPatti.Rate[idMachine][nRate]
end

--Money类型
TeenPatti.GetMoneyType = function(idMachine)
	for k, v in pairs(TeenPatti.Machine) do
		if v == idMachine then
			return k
		end
	end

	return TeenPatti.MONEY
end

--下注筹码筹码icon
TeenPatti.GetChipIcon = function(idMachine, Money)
	if TeenPatti.BetIcon[idMachine] == nil or TeenPatti.BetIcon[idMachine][Money] == nil then
		return ""
	end
	
    return TeenPatti.BetIcon[idMachine][Money]
end

--Jackpot图标
TeenPatti.GetJackpotIcon = function(idMachine)
	if TeenPatti.MACHINE_EMONEY == idMachine then
		return "tbmain_tianshi"
	end

	return "tbmain_jinbi"
end


--筹码选项图标
TeenPatti.GetBetRateIcon = function(idMachine, nIndex)
	if TeenPatti.MACHINE_EMONEY == idMachine then
		return "tbmain_choumat"..nIndex
	end

	return "tbmain_chouma"..nIndex
end

return TeenPatti;