Files
2026-06-01 12:46:52 +02:00

215 lines
5.7 KiB
Lua

-- Return price based on herein definitions
function cmPrice(id)
local priceRatio = 1
local epro_id = 950020
local epro_cost = 5
local erep_id = 950021
local erep_cost = 3
local spro_id = 950083
local spro_cost = 2
local tpro_id = 960021
local tpro_cost = 10
local masterHammer_id = 491005
local masterHammer_cost = 5
local orielyKit_id = 491006
local orielyKit_cost = 2
local humHeart_id = 601100284
local humHeart_cost = 15
local rebirth_id = 920008
local rebirth_cost = 10
local gp_u120_id = 900005
local gp_u120_cost = 5
local gp_a120_id = 900014
local gp_a120_cost = 10
local gp_a150_id = 0
local gp_a150_cost = 0
local n_sFeather_id = 910007
local n_sFeather_cost = 2
local n_rFeather_id = 910006
local n_rFeather_cost = 2
local n_tFeather_id = 910022
local n_tFeather_cost = 4
local n_uFeather_id = 910008
local n_uFeather_cost = 5
local s_sFeather_id = 910081
local s_sFeather_cost = 4
local s_rFeather_id = 910080
local s_rFeather_cost = 4
local s_tFeather_id = 910083
local s_tFeather_cost = 8
local s_uFeather_id = 910082
local s_uFeather_cost = 10
local augChaos_id = 950000
local augChaos_cost = 1
local comChaos_id = 950001
local comChaos_cost = 2
local reinChaos_id = 950002
local reinChaos_cost = 3
local perfChaos_id = 950003
local perfChaos_cost = 5
local galaxyStone_id = 801320
local galaxyStone_cost = 10
local hairDyes_id = { 960022, 960023, 960027, 960028,
960031, 960033, 960034, 960038,
960039, 960040, 960045, 960048,
960049, 960052, 960053 }
local hairDyes_cost = 2
local cResSpellbook_id = 920001
local cResSpellbook_cost = 2
local aCracker_id = 2902161
local aCracker_cost = 1
local cRespec_id = 920006
local cRespec_cost = 5
local rLydian_15d_id = 540029
local rLydian_15d_cost = 10
local rLydian_30d_id = 540030
local rLydian_30d_cost = 20
local bLydian_15d_id = 540031
local bLydian_15d_cost = 10
local bLydian_30d_id = 540032
local bLydian_30d_cost = 20
local dLydian_15d_id = 540104
local dLydian_15d_cost = 10
local dLydian_30d_id = 2011361
local dLydian_30d_cost = 20
local unicorn_15d_id = 2013242
local unicorn_15d_cost = 10
local unicorn_30d_id = 2013243
local unicorn_30d_cost = 20
local camel_30d_id = 2013288
local camel_30d_cost = 7
local wCamel_30d_id = 2013482
local wCamel_30d_cost = 7
local transmog_id = 601100285
local transmog_cost = 10
local wTiger_7d_id = 550020
local wTiger_7d_cost = 5
local cost = 0
if id == epro_id then
cost = epro_cost
elseif id == erep_id then
cost = erep_cost
elseif id == spro_id then
cost = spro_cost
elseif id == tpro_id then
cost = tpro_cost
elseif id == masterHammer_id then
cost = masterHammer_cost
elseif id == orielyKit_id then
cost = orielyKit_cost
elseif id == humHeart_id then
cost = humHeart_cost
elseif id == rebirth_id then
cost = rebirth_cost
elseif id == gp_u120_id then
cost = gp_u120_cost
elseif id == gp_a120_id then
cost = gp_a120_cost
elseif id == n_sFeather_id then
cost = n_sFeather_cost
elseif id == n_rFeather_id then
cost = n_rFeather_cost
elseif id == n_tFeather_id then
cost = n_tFeather_cost
elseif id == n_uFeather_id then
cost = n_uFeather_cost
elseif id == s_sFeather_id then
cost = s_sFeather_cost
elseif id == s_rFeather_id then
cost = s_rFeather_cost
elseif id == s_tFeather_id then
cost = s_tFeather_cost
elseif id == s_uFeather_id then
cost = s_uFeather_cost
elseif id == augChaos_id then
cost = augChaos_cost
elseif id == comChaos_id then
cost = comChaos_cost
elseif id == reinChaos_id then
cost = reinChaos_cost
elseif id == perfChaos_id then
cost = perfChaos_cost
elseif id == galaxyStone_id then
cost = galaxyStone_cost
elseif inTable(hairDyes_id, id) then
cost = hairDyes_cost
elseif id == cResSpellbook_id then
cost = cResSpellbook_cost
elseif id == aCracker_id then
cost = aCracker_cost
elseif id == cRespec_id then
cost = cRespec_cost
elseif id == rLydian_15d_id then
cost = rLydian_15d_cost
elseif id == rLydian_30d_id then
cost = rLydian_30d_cost
elseif id == bLydian_15d_id then
cost = bLydian_15d_cost
elseif id == bLydian_30d_id then
cost = bLydian_30d_cost
elseif id == dLydian_15d_id then
cost = bLydian_30d_cost
elseif id == dLydian_30d_id then
cost = dLydian_15d_cost
elseif id == unicorn_15d_id then
cost = unicorn_15d_cost
elseif id == unicorn_30d_id then
cost = unicorn_30d_cost
elseif id == camel_30d_id then
cost = camel_30d_cost
elseif id == wCamel_30d_id then
cost = wCamel_30d_cost
elseif id == wTiger_7d_id then
cost = wTiger_7d_cost
end
return calculatePrice(priceRatio, cost)
end
-- Calculate the final price returned to menus calling cmPrice
function calculatePrice(ratio, price)
return price * ratio
end
-- Checks that a user has (cost) amount of Challenge Marks
function validateMarks(cost)
local cmCount = find_item(2021300)
if cmCount >= cost then
return true
else
return false
end
end
-- Remove given amountof marks from users inventory
function removeMarks(amount)
delete_item(get_item_handle(2021300), amount)
cprint("<b>You have a strange sensation as " ..amount.. " Challenge Marks vanish from your inventory.")
end
-- Attempts to insert given item with given amount
function attemptCMInsert(id, amount)
insert_item(id, amount)
cprint("<b>You have received ("..amount.."): " ..get_item_name_by_code(id))
end
-- Attempts to insert a creatureBuff with given level and time
function attemptCM_creatureBuff(sId, sLv, sTime, sName)
add_cstate(sId, sLv, sTime)
cprint("Your pet has received LV: <b>" ..sLv.. " " ..sName.. "</b> state");
end
-- Returns true if item exists in the given table
function inTable(tbl, item)
for key, value in pairs(tbl) do
if value == item then return true end
end
return false
end