Skip to content
Snippets Groups Projects
Commit c586d4b7 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@947 51575b47-30f0-44d4-a5cc-537603b46e54
parent de0308f2
No related branches found
No related tags found
No related merge requests found
......@@ -113,8 +113,8 @@ function _M:doBuy(who, o, item, nb, store_dialog)
who:sortInven(inven)
self.changed = true
who.changed = true
if store_dialog then store_dialog:updateStore() end
self:onBuy(who, o, item, nb)
if store_dialog then store_dialog:updateStore() end
end end)
end
end
......@@ -134,8 +134,8 @@ function _M:doSell(who, o, item, nb, store_dialog)
who:sortInven(inven)
self.changed = true
who.changed = true
if store_dialog then store_dialog:updateStore() end
self:onSell(who, o, item, nb)
if store_dialog then store_dialog:updateStore() end
end end)
end
end
......
......@@ -291,6 +291,8 @@ function _M:finishEntity(level, type, e, ego_chance)
-- The ego requested instant resolving before merge ?
if ego.instant_resolve then ego:resolve(nil, nil, e) end
ego.instant_resolve = nil
-- Void the uid, we dont want to erase the base entity's one
ego.uid = nil
-- Merge additively but with array appending, so that nameless resolvers are not lost
table.mergeAddAppendArray(e, ego, true)
e.name = newname
......
......@@ -150,27 +150,27 @@ function string.bookCapitalize(str)
return table.concat(words, " ")
end
function string.lpegSub(s, patt, repl)
patt = lpeg.P(patt)
patt = lpeg.Cs((patt / repl + 1)^0)
return lpeg.match(patt, s)
end
-- Those matching patterns are used both by splitLine and drawColorString*
local Puid = "UID:" * lpeg.R"09"^1 * ":" * lpeg.R"09"
local Puid_cap = "UID:" * lpeg.C(lpeg.R"09"^1) * ":" * lpeg.C(lpeg.R"09")
local Pcolorname = (lpeg.R"AZ" + "_")^3
local Pcode = (lpeg.R"af" + lpeg.R"09" + lpeg.R"AF")
local Pcolorcode = Pcode * Pcode
local Pcolorcodefull = Pcolorcode * Pcolorcode * Pcolorcode
function string.splitLine(str, max_width, font)
local space_w = font:size(" ")
local lines = {}
local cur_line, cur_size = "", 0
for _, v in ipairs(str:split(lpeg.S"\n ")) do
local w, h = font:size(v)
-- Ignore the size of color markers
local _, _, color1 = v:find("(#%x%x%x%x%x%x#)")
local _, _, color2 = v:find("(#[A-Z_]+#)")
local _, _, uid = v:find("(#UID:[0-9]+:[0-9]#)")
if color1 then
local color_w = font:size(color1)
w = w - color_w
elseif color2 then
local color_w = font:size(color2)
w = w - color_w
elseif uid then
local color_w = font:size(uid)
w = w - color_w
end
local shortv = v:lpegSub("#" * (Puid + Pcolorcodefull + Pcolorname) * "#", "")
local w, h = font:size(shortv)
if cur_size + space_w + w < max_width then
cur_line = cur_line..(cur_size==0 and "" or " ")..v
......@@ -243,13 +243,7 @@ end
local tmps = core.display.newSurface(1, 1)
getmetatable(tmps).__index.drawColorString = function(s, font, str, x, y, r, g, b)
local Puid = "UID:" * lpeg.R"09"^1 * ":" * lpeg.R"09"
local Puid_cap = "UID:" * lpeg.C(lpeg.R"09"^1) * ":" * lpeg.C(lpeg.R"09")
local Pcolorname = (lpeg.R"AZ" + "_")^3
local Pcode = (lpeg.R"af" + lpeg.R"09" + lpeg.R"AF")
local Pcolorcode = Pcode * Pcode
local list = str:split("#" * (Puid + (Pcolorcode * Pcolorcode * Pcolorcode) + Pcolorname) * "#", true)
local list = str:split("#" * (Puid + Pcolorcodefull + Pcolorname) * "#", true)
r = r or 255
g = g or 255
b = b or 255
......@@ -298,13 +292,7 @@ end
getmetatable(tmps).__index.drawColorStringBlended = function(s, font, str, x, y, r, g, b)
local Puid = "UID:" * lpeg.R"09"^1 * ":" * lpeg.R"09"
local Puid_cap = "UID:" * lpeg.C(lpeg.R"09"^1) * ":" * lpeg.C(lpeg.R"09")
local Pcolorname = (lpeg.R"AZ" + "_")^3
local Pcode = (lpeg.R"af" + lpeg.R"09" + lpeg.R"AF")
local Pcolorcode = Pcode * Pcode
local list = str:split("#" * (Puid + (Pcolorcode * Pcolorcode * Pcolorcode) + Pcolorname) * "#", true)
local list = str:split("#" * (Puid + Pcolorcodefull + Pcolorname) * "#", true)
r = r or 255
g = g or 255
b = b or 255
......
......@@ -113,7 +113,7 @@ function _M:descAttribute(attr)
elseif attr == "MONEY" then
return ("worth %0.2f"):format(self.money_value / 10)
elseif attr == "USE_TALENT" then
return self:getTalentFromId(self.use_talent.id).name
return self:getTalentFromId(self.use_talent.id).name:lower()
end
end
......
......@@ -103,8 +103,7 @@ newEntity{ base = "BASE_NPC_MULTIHUED_DRAKE",
resists = { [DamageType.PHYSICAL] = 40, [DamageType.FIRE] = 40, [DamageType.COLD] = 40, [DamageType.ACID] = 40, [DamageType.LIGHTNING] = 40, },
summon = {
{type="dragon", subtype="multihued", number=2, hasxp=false},
{type="dragon", subtype="multihued", number=3, hasxp=false},
{type="dragon", number=2, hasxp=false},
},
resolvers.talents{
......
......@@ -34,7 +34,7 @@ return {
class = "engine.generator.map.Roomer",
nb_rooms = 10,
rooms = {"simple", "pilar", {"money_vault",5}, {"pit",7}},
rooms_config = {pit={filters={{type="undead"}}},
rooms_config = {pit={filters={{type="undead"}}}},
lite_room_chance = 100,
['.'] = "FLOOR",
['#'] = "WALL",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment