1
0
Bifurcation 0

Collecting more info on location to help with dungeon quests.

Converted assertion for a completely unknown loot item to a quiet error, since there seems to be no way to determine exactly why it happens.
Cette révision appartient à :
Nathanial.C.Jones 2011-10-24 10:33:55 +00:00
Parent f041a22687
révision 386b376097
2 fichiers modifiés avec 22 ajouts et 13 suppressions

Voir le fichier

@ -11,14 +11,14 @@ local function signed(c)
end
local function float(c)
if not c then c = -128 end
QuestHelper: Assert( c >= -128, string.format("c is too small. It is %s.", tostring(c)))
QuestHelper: Assert( c < 128, string.format("c is too big. It is %s.", tostring(c)))
-- if not c then c = -128 end
-- QuestHelper: Assert( c >= -128, string.format("c is too small. It is %s.", tostring(c)))
-- QuestHelper: Assert( c < 128, string.format("c is too big. It is %s.", tostring(c)))
local ret = tostring(c):gsub(",",".") -- eliminate issues with locales that use a comma as the decimal separator.
return ret
end
local function BolusizeLocation(delayed, c, z, x, y)
local function BolusizeLocation(delayed, c, z, x, y, dl, mid, mf, f)
-- c and z are *signed* integers that fit within an 8-bit int.
-- x and y are floating-point values, generally between 0 and 1. We'll dedicate 24 bits to the fractional part, largely because we can.
-- Overall we're using a weird 11 bytes on this. Meh.
@ -26,11 +26,15 @@ local function BolusizeLocation(delayed, c, z, x, y)
local float_x = float(x)
local float_y = float(y)
local loc = {}
loc["delayed"] = signed(delayed and 1 or 0)
loc["c"] = signed(c)
loc["z"] = signed(z)
loc["delayed"] = (delayed and 1 or 0)
loc["c"] = c
loc["z"] = z
loc["x"] = float_x
loc["y"] = float_y
loc["dungeonLevel"] = dl
loc["mapid"] = mid
loc["mapfile"] = mf
loc["facing"] = f
return loc;
--return string.format("%s,%s,%s,%s,%s", signed(delayed and 1 or 0), signed(c), signed(z), float_x, float_y)
--return signed(delayed and 1 or 0) .. signed(c) .. signed(z) .. float_x .. float_y

Voir le fichier

@ -526,8 +526,12 @@ local function LootOpened()
local items = {}
items[PseudoIDs["gold"]] = 0
for i = 1, GetNumLootItems() do
tex, name, quant, _ = GetLootSlotInfo(i)
tex, name, quant, qual, locked = GetLootSlotInfo(i)
link = GetLootSlotLink(i)
local curr = LootSlotIsCurrency(i)
local coin = LootSlotIsCoin(i)
local itm = LootSlotIsItem(i)
if quant == 0 then
-- moneys
local tot = 0
@ -537,7 +541,7 @@ local function LootOpened()
tot = (tonumber(gold) or 0) * 10000 + (tonumber(silver) or 0) * 100 + (tonumber(copper) or 0) * 1
items[PseudoIDs["gold"]] = tot
else
if LootSlotIsCurrency(i) then
if curr then
if not QHC.PseudoIDs[name] then
QHC.PseudoIDsMin = QHC.PseudoIDsMin - 1
QHC.PseudoIDs[name] = QHC.PseudoIDsMin
@ -545,13 +549,14 @@ local function LootOpened()
items[QHC.PseudoIDs[name]] = (items[QHC.PseudoIDs[name]] or 0) + quant
else
if not link and not name then
local msg = "Texture is " .. tostring(tex) .. " with a quantity of " .. tostring(quant) .. "."
if LootSlotIsCoin(i) then
local msg = "Texture is " .. tostring(tex) .. " with a quantity of " .. tostring(quant) .. ", a quality of " .. qual .. "."
if coin then
QuestHelper:Assert(false, "Loot slot " .. tostring(i) .. " is coin. " .. msg)
elseif LootSlotIsItem(i) then
elseif itm then
QuestHelper:Assert(false, "Loot slot " .. tostring(i) .. " is item. " .. msg)
else
QuestHelper:Assert(false, "Loot slot " .. tostring(i) .. " is ???. " .. msg)
QuestHelper_ErrorCatcher_ExplicitError(false, "Loot slot " .. tostring(i) .. " is ???. " .. msg)
--QuestHelper:Assert(false, "Loot slot " .. tostring(i) .. " is ???. " .. msg)
end
elseif not link then
QuestHelper:Assert(link, "Need more info on '" .. name .. "'x" .. tostring(quant) .. ".")