98 lines
2.9 KiB
Plaintext
98 lines
2.9 KiB
Plaintext
|
require("LuaUtil")
|
||
|
|
||
|
ConsumeCommon = ConsumeCommon or {}
|
||
|
|
||
|
-- 跟c#重名因此添加lua
|
||
|
LuaConsumeType = {
|
||
|
PropVal = 1,
|
||
|
Item = 3,
|
||
|
Money = 4,
|
||
|
Score = 5,
|
||
|
}
|
||
|
|
||
|
-- 加lua前缀因为跟c#的命名冲突了
|
||
|
LuaMoneyType = {
|
||
|
MoneyTypeCoin = 0, -- 银两
|
||
|
MoneyTypeYuanBao = 1, -- 灵玉
|
||
|
MoneyTypeYuanBaoBind = 2, -- 元宝
|
||
|
MoneyTypeCoinBind = 3, -- 银票
|
||
|
MoneyTypeUserChallenge = 4, -- 门派挑战
|
||
|
MoneyTypeSnatchScore = 5, -- 夺宝积分
|
||
|
|
||
|
-- 仙云
|
||
|
-- 仙灵积分
|
||
|
-- 神将积分
|
||
|
XianYun = 438,
|
||
|
XianLingJiFen = 439,
|
||
|
shenjiangJiFen = 440,
|
||
|
|
||
|
}
|
||
|
|
||
|
function ConsumeCommon.GetMoneyIcon(moneyType)
|
||
|
local iconPath = "yinliang01"
|
||
|
local moneyIcons = {
|
||
|
[LuaMoneyType.MoneyTypeCoin] = "yinliang01",
|
||
|
[LuaMoneyType.MoneyTypeYuanBao] = "lingyu01",
|
||
|
[LuaMoneyType.MoneyTypeYuanBaoBind] = "yuanbao01",
|
||
|
[LuaMoneyType.MoneyTypeCoinBind] = "yinpiao01",
|
||
|
[LuaMoneyType.MoneyTypeUserChallenge] = "menpaiCoin",
|
||
|
[LuaMoneyType.MoneyTypeSnatchScore] = "duobaoCoin",
|
||
|
[LuaMoneyType.XianYun] = "valxianyun",
|
||
|
[LuaMoneyType.XianLingJiFen] = "valxianlingjifen",
|
||
|
[LuaMoneyType.shenjiangJiFen] = "valshenjiangjifen",
|
||
|
}
|
||
|
|
||
|
iconPath = moneyIcons[moneyType] or iconPath
|
||
|
|
||
|
return iconPath
|
||
|
end
|
||
|
|
||
|
function ConsumeCommon.GetConsumeItemIcon(consumeType,subType)
|
||
|
local iconPath = ""
|
||
|
if consumeType == LuaConsumeType.Item then
|
||
|
local itemId = subType
|
||
|
local cnfData = CS.GCGame.Table.TableManager.GetCommonItemByID(itemId, 0)
|
||
|
iconPath = cnfData.Icon
|
||
|
else
|
||
|
iconPath = ConsumeCommon.GetMoneyIcon(subType)
|
||
|
end
|
||
|
return iconPath
|
||
|
end
|
||
|
|
||
|
function ConsumeCommon.GetConsumeItemNum(consumeType,subType)
|
||
|
local num = 0
|
||
|
if consumeType == LuaConsumeType.Item then
|
||
|
local itemId = subType
|
||
|
num = PlayerData:GetItemContainer(ContainerType.TYPE_BACKPACK):GetItemCountByDataId(itemId)
|
||
|
else
|
||
|
local moneyType = subType
|
||
|
if moneyType == LuaMoneyType.MoneyTypeCoin then
|
||
|
-- 银两
|
||
|
num = PlayerData.Money:GetMoney_Coin()
|
||
|
elseif moneyType == LuaMoneyType.MoneyTypeYuanBao then
|
||
|
-- 灵玉
|
||
|
num = PlayerData.Money:GetMoney_YuanBao()
|
||
|
elseif moneyType == LuaMoneyType.MoneyTypeYuanBaoBind then
|
||
|
-- 元宝
|
||
|
num = PlayerData.Money:GetMoney_YuanBaoBind()
|
||
|
elseif moneyType == LuaMoneyType.MoneyTypeCoinBind then
|
||
|
-- 银票
|
||
|
num = PlayerData.Money:GetMoney_CoinBind()
|
||
|
elseif moneyType == LuaMoneyType.MoneyTypeUserChallenge then
|
||
|
num = PlayerData.Money:GetMoney_ChallengeScore()
|
||
|
elseif moneyType == LuaMoneyType.MoneyTypeSnatchScore then
|
||
|
num = PlayerData.Money:GetMoney_SnatchScore()
|
||
|
elseif moneyType == LuaMoneyType.XianYun then
|
||
|
num = PlayerData:GetPropInt(LuaMoneyType.XianYun)
|
||
|
elseif moneyType == LuaMoneyType.XianLingJiFen then
|
||
|
num = PlayerData:GetPropInt(LuaMoneyType.XianLingJiFen)
|
||
|
elseif moneyType == LuaMoneyType.shenjiangJiFen then
|
||
|
num = PlayerData:GetPropInt(LuaMoneyType.shenjiangJiFen)
|
||
|
else
|
||
|
num = PlayerData:GetPropInt(moneyType)
|
||
|
end
|
||
|
end
|
||
|
return num
|
||
|
end
|
||
|
|