local NewDice = { };

NewDice.MONEY = 0;
NewDice.EMONEY = 1;
NewDice.MACHINE = {
	[1] = NewDice.MONEY,
	[2] = NewDice.EMONEY,
}

NewDice.CHIP = {
	DICE_CHIP_RATE_1 = 1, -- 倍率1
	DICE_CHIP_RATE_2 = 2, -- 倍率2
	DICE_CHIP_RATE_3 = 3, -- 倍率3
	DICE_CHIP_RATE_4 = 4, -- 倍率4
	DICE_CHIP_RATE_5 = 5, -- 倍率5
	DICE_CHIP_RATE_END = 6,
};

--筹码类型
NewDice.DiceBet = {
	[NewDice.MONEY] = {
		[NewDice.CHIP.DICE_CHIP_RATE_1] = 10000,
		[NewDice.CHIP.DICE_CHIP_RATE_2] = 100000,
		[NewDice.CHIP.DICE_CHIP_RATE_3] = 1000000,
		[NewDice.CHIP.DICE_CHIP_RATE_4] = 10000000,
		[NewDice.CHIP.DICE_CHIP_RATE_5] = 100000000,
	},

	[NewDice.EMONEY] = {
		[NewDice.CHIP.DICE_CHIP_RATE_1] = 10,
		[NewDice.CHIP.DICE_CHIP_RATE_2] = 30,
		[NewDice.CHIP.DICE_CHIP_RATE_3] = 100,
		[NewDice.CHIP.DICE_CHIP_RATE_4] = 300,
		[NewDice.CHIP.DICE_CHIP_RATE_5] = 1000,
	},
}

--下注筹码上限
NewDice.DiceBetMax = {
	[1] = 100000000000,
	[2] = 1000000,
}

--筹码Icon
NewDice.DiceBetIcon = {
	[NewDice.MONEY] = {
		[10000] = "tbmain_iconcm1",
		[100000] = "tbmain_iconcm2",
		[1000000] = "tbmain_iconcm3",
		[10000000] = "tbmain_iconcm4",
		[100000000] = "tbmain_iconcm5",
	},

	[NewDice.EMONEY] = {
		[1] = "tbmain_iconcm1",
		[5] = "tbmain_iconcm2",
		[10] = "tbmain_iconcm3",
		[50] = "tbmain_iconcm4",
		[100] = "tbmain_iconcm5",
	},
}

--按钮特效
NewDice.Transition = {
	[1] = "act_chouma10k",
	[2] = "act_chouma100k",
	[3] = "act_chouma1M",
	[4] = "act_chouma10M",
	[5] = "act_chouma100M",
}

--推荐下注筹码
NewDice.DiceRate = {
	[NewDice.MONEY] = {
		[NewDice.CHIP.DICE_CHIP_RATE_1] = 10000000,
		[NewDice.CHIP.DICE_CHIP_RATE_2] = 100000000,
		[NewDice.CHIP.DICE_CHIP_RATE_3] = 1000000000,
		[NewDice.CHIP.DICE_CHIP_RATE_4] = 10000000000,
		[NewDice.CHIP.DICE_CHIP_RATE_5] = 100000000000,
	},

	[NewDice.EMONEY] = {
		[NewDice.CHIP.DICE_CHIP_RATE_1] = 1000,
		[NewDice.CHIP.DICE_CHIP_RATE_2] = 5000,
		[NewDice.CHIP.DICE_CHIP_RATE_3] = 10000,
		[NewDice.CHIP.DICE_CHIP_RATE_4] = 50000,
		[NewDice.CHIP.DICE_CHIP_RATE_5] = 50001,
	},
}

--Money类型
NewDice.GetMoneyType = function(idMachine)
	if NewDice.MACHINE[idMachine] == nil then
		return NewDice.MONEY
	end
	
    return NewDice.MACHINE[idMachine]
end

--下注筹码上限
NewDice.GetDiceBetChipMax = function(idMachine)
	if NewDice.DiceBetMax[idMachine] == nil then
		return 0
	end
	
    return NewDice.DiceBetMax[idMachine]
end

--下注筹码筹码
NewDice.GetDiceBetChip = function(idMachine, ChipRate)
	local nMoneyType = NewDice.GetMoneyType(idMachine);
	if NewDice.DiceBet[nMoneyType] == nil or NewDice.DiceBet[nMoneyType][ChipRate] == nil then
		return 0
	end
	
    return NewDice.DiceBet[nMoneyType][ChipRate]
end

--下注筹码筹码icon
NewDice.GetChipIcon = function(idMachine, Money)
	local nMoneyType = NewDice.GetMoneyType(idMachine);
	if NewDice.DiceBetIcon[nMoneyType] == nil or NewDice.DiceBetIcon[nMoneyType][Money] == nil then
		return ""
	end
	
    return NewDice.DiceBetIcon[nMoneyType][Money]
end

--下注筹码动效
NewDice.GetChipTransition = function(Money)
	if NewDice.Transition[Money] == nil then
		return ""
	end
	
    return NewDice.Transition[Money]
end

--推荐下注筹码
NewDice.GetDiceRate = function(idMachine, HeroMoney)
	local nMoneyType = NewDice.GetMoneyType(idMachine);
	if NewDice.DiceRate[nMoneyType] == nil then
		return 1
	end
	
	for i = 1, #NewDice.DiceRate[nMoneyType] do
		if HeroMoney <= NewDice.DiceRate[nMoneyType][i] then 
			return i
		end
	end
	
    return NewDice.CHIP.DICE_CHIP_RATE_5
end

return NewDice;