show precondition player_offered_item

This commit is contained in:
Sokomine 2022-01-05 01:23:42 +01:00
parent 5644ad0cb2
commit 2c8437f6a4
2 changed files with 27 additions and 1 deletions

View File

@ -2093,7 +2093,7 @@ yl_speak_up.get_fs_edit_option_action_npc_wants_or_accepts = function(
amount = tostring(parts[2])
end
local size_list = {"any amount", "exactly "..amount,
"less than "..amount, "more than "..amount, "other amount than "..amount}
"less than "..amount, "more than "..amount, "another amount than "..amount}
local match_size = 1
for i, list_text in ipairs(size_list) do
if(data.match_stack_size and data.match_stack_size == list_text:split(" ")[ 1 ]) then

View File

@ -232,6 +232,32 @@ yl_speak_up.show_precondition = function(p, pname)
end
return who.." has an empty inventory."
end
elseif(p.p_type == "player_offered_item") then
local item = tostring(p.p_value:split(" ")[1])
local amount = tostring(p.p_value:split(" ")[2])
local match = "any amount"
if(p.p_match_stack_size == "any") then
match = "any amount"
elseif(p.p_match_stack_size == "exactly") then
match = "exactly "..tostring(amount)
elseif(p.p_match_stack_size == "less"
or p.p_match_stack_size == "more") then
match = p.p_match_stack_size.." than "..tostring(amount)
elseif(p.p_match_stack_size == "another") then
match = "another amount than " ..tostring(amount)
end
if(p.p_item_group and p.p_item_group ~= "") then
return "The player offered "..tostring(match).." item(s) of the group \""..
tostring(item).."\"."
elseif((p.p_item_quest_id and p.p_item_quest_id ~= "")
or (p.p_item_desc and p.p_item_desc ~= "")) then
return "The player offered "..tostring(match).." of \""..
tostring(p.p_item_desc or "- default description -")..
"\" (\""..tostring(item or "- ? -").."\") "..
"with ID \""..tostring(p.p_item_quest_id or "- no special ID -").."\"."
else
return "The player offered "..tostring(match).." of \""..tostring(item).."\"."
end
elseif(p.p_type == "custom") then
return "Call custom function with param: \""..tostring(p.p_value).."\"."
elseif(p.p_type == "other") then