PDA

View Full Version : Zero charge turn-ins


provocating
02-12-2016, 01:37 PM
Is there a trick to getting item_lib.check_turn_in to accept an item with zero charges? I have the latest items.lua but zero charge items are not recognized.

provocating
02-12-2016, 01:47 PM
Yeah, there is something off on the lua item module. Going back to the Perl script worked wonderfully on zero charge items.

Uleat
02-12-2016, 02:24 PM
I don't know lua or the modules themselves that well...


function items.check_turn_in(trade, trade_check)
--create trade_return table == trade
--shallow copy
local trade_return = {};
for key, value in pairs(trade) do
trade_return[key] = value;
end

--for every item in trade_check check trade_return
--if item exists in trade_return then
--remove that item from trade_return
--else
--failure
for i = 1, 4 do
local key = "item" .. i;
if(trade_check[key] ~= nil and trade_check[key] ~= 0) then
local found = false;
for j = 1, 4 do
local inst = trade_return["item" .. j];
if(inst.valid and trade_check[key] == inst:GetID()) then
*** -> trade_return["item" .. j] = ItemInst();
found = true;
break;
end
end

if(not found) then
return false;
end
end
end
...
end



There is a 'default' constructor declared for ItemInst in lua: https://github.com/EQEmu/Server/blob/master/zone/lua_iteminst.cpp#L269

..but, there doesn't appear to be a definition: https://github.com/EQEmu/Server/blob/master/zone/lua_iteminst.cpp#L11


That said, the marked line should probably be:
trade_return["item" .. j] = ItemInst(inst:GetID());
..or..
trade_return["item" .. j] = inst;


I honestly just don't know since I don't code these scripts...

provocating
02-12-2016, 02:53 PM
No worry man. Hell I still prefer using Perl with the Emu over Lua.

cray5678
02-16-2016, 02:40 AM
thank you sir

Furniture
02-28-2016, 03:45 PM
I've tried those changes and no luck. Im trying to run the quests from al kabor but they are in lua. Any chance lua hand ins will get fixed?