169 lines
4.1 KiB
Lua
169 lines
4.1 KiB
Lua
-- System scripts
|
|
|
|
|
|
function has_hv_pass()
|
|
-- 30days 7days
|
|
local hvPassesTable = { 6100006, 6100007 }
|
|
local itemCount = 0
|
|
for i = 1, #hvPassesTable do
|
|
itemCount = find_item(hvPassesTable[i])
|
|
if itemCount ~= 0 then
|
|
debug_notice("has_hv_pass true")
|
|
return true
|
|
end
|
|
end
|
|
|
|
if itemCount ~= 0 then
|
|
debug_notice("has_hv_pass true")
|
|
return true
|
|
end
|
|
|
|
debug_notice("has_hv_pass false")
|
|
return false
|
|
end
|
|
|
|
function dlg_start() -- Function to output NPC title. So all you do is type "dlg_start()" now instead of long ass "dlg_title(get_npc_title())"
|
|
dlg_title(get_npc_title())
|
|
end
|
|
|
|
function get_npc_title() -- Function to get NPC title; Using this way: npc_title(get_npc_title())
|
|
local firstName = '@' .. get_npc_type()-- .. ' ' .. '@' .. get_npc_name()
|
|
local secondName = '@' .. get_npc_name()
|
|
if firstName == nil or firstName == "" then firstName = " " end
|
|
if secondName == nil or secondName == "" then secondName = " " end
|
|
local result = sconv("@509011","#@first_name@#",firstName,"#@second_name@#",secondName)
|
|
return result
|
|
end
|
|
|
|
function dlg_end() -- Twice less space to end dialogue now
|
|
debug_notice("NPC ID: " .. get_npc_id())
|
|
check_auto_user()
|
|
dlg_menu("@90010002","")
|
|
dlg_show()
|
|
end
|
|
|
|
--Secret Dungeon Exit Prop Gates
|
|
function warp_to_stored_position()
|
|
warp(get_flag("rx"),get_flag("ry"))
|
|
end
|
|
|
|
-- Checking if respawn point exist
|
|
function respawn_point_check()
|
|
if (gv('rx') == nil or gv('rx') == "") and (gv('ry') == nil or gv('ry') == "") then
|
|
return false -- Temp solution. Returns false if respawn point not set
|
|
end
|
|
return true -- And true if set
|
|
end
|
|
|
|
-- Market system: Low price for premium; original price for common player; high prices for auto_user
|
|
function market_system( market_string )
|
|
|
|
if is_auto_user() then
|
|
debug_notice("Opening market " .. market_string .. "_auto")
|
|
open_market(market_string..'_auto')
|
|
elseif is_premium() then
|
|
debug_notice("Opening market " .. market_string .. "_premium")
|
|
open_market(market_string..'_premium')
|
|
else
|
|
debug_notice("Opening market " .. market_string)
|
|
open_market(market_string)
|
|
end
|
|
|
|
end
|
|
|
|
|
|
function set_debug( var )
|
|
local flag = get_flag("debug")
|
|
if var == nil or var == '' then
|
|
if flag == nil or flag == '' or flag == 0 then
|
|
set_flag("debug", 1)
|
|
else
|
|
set_flag("debug", 0)
|
|
end
|
|
else
|
|
set_flag("debug", flag)
|
|
end
|
|
|
|
|
|
end
|
|
|
|
function debug()
|
|
local debug_flag = get_flag("debug")
|
|
if debug_flag == 1 then -- If debug was turned on
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
|
|
function debug_notice(string)
|
|
if debug() then
|
|
private_notice("<shadow><#00FF00>"..string)
|
|
end
|
|
end
|
|
|
|
function segment_warp(map_x, map_y)
|
|
|
|
if map_x == "" or map_x == nil or map_y == "" or map_y == nil then
|
|
private_notice("Wrong format. Usage: segment_warp(map_x, map_y)")
|
|
return
|
|
end
|
|
|
|
local x_offset = math.floor(( ((map_x + 1) * 16128 ) - ( map_x * 16128 ) ) / 2 )
|
|
local y_offset = math.floor(( ((map_y + 1) * 16128 ) - ( map_y * 16128 ) ) / 2 )
|
|
|
|
local x_tp, y_tp
|
|
if map_x > 0 then
|
|
x_tp = math.floor( (map_x * 16128) + 8064 )
|
|
elseif map_x == 0 then
|
|
x_tp = 8064
|
|
else
|
|
debug_notice("Wrong map_x!")
|
|
end
|
|
|
|
if map_y > 0 then
|
|
y_tp = math.floor( (map_y * 16128) + 8064 )
|
|
elseif map_y == 0 then
|
|
y_tp = 8064
|
|
else
|
|
debug_notice("Wrong map_y!")
|
|
end
|
|
|
|
debug_notice( "force_warp(" .. x_tp .. ", ".. y_tp .. ")" )
|
|
force_warp(x_tp, y_tp)
|
|
end
|
|
|
|
|
|
function os_library_test()
|
|
local info = {}
|
|
|
|
local handle = io.popen('neofetch.exe') -- adjust path if needed
|
|
if handle then
|
|
for line in handle:lines() do
|
|
-- parse lines with format "Key: Value"
|
|
local key, value = line:match("^(.-):%s*(.+)$")
|
|
if key and value then
|
|
-- clean up key (remove spaces, make lowercase)
|
|
key = key:gsub("%s+", "_"):lower()
|
|
info[key] = value
|
|
end
|
|
end
|
|
handle:close()
|
|
else
|
|
private_notice("Failed to run neofetch")
|
|
end
|
|
|
|
local outputStr = ""
|
|
-- print the table
|
|
for k, v in pairs(info) do
|
|
outputStr = outputStr .. k .. v .. "<br>"
|
|
-- private_notice(k, v)
|
|
end
|
|
|
|
-- example access:
|
|
--private_notice("CPU detected:", info["cpu"])
|
|
--private_notice("RAM:", info["ram"])
|
|
|
|
dlg_general(outputStr)
|
|
|
|
end |