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

Some factions now have symbols, which you can see in store & chats in towns

git-svn-id: http://svn.net-core.org/repos/t-engine4@6619 51575b47-30f0-44d4-a5cc-537603b46e54
parent f613726e
No related branches found
No related tags found
No related merge requests found
......@@ -51,10 +51,10 @@ function _M:init(chat, id)
{left=5, top=self.c_desc.h - 10, ui=Separator.new{dir="vertical", size=self.iw - 10}},
}
if self.show_portraits then
uis[#uis+1] = {right=0, top=0, ui=ActorFrame.new{actor=self.npc, w=64, h=64}}
uis[#uis+1] = {left=0, bottom=0, ui=ActorFrame.new{actor=self.player, w=64, h=64}}
uis[#uis+1] = {right=0, top=0, ui=ActorFrame.new{actor=self.npc.chat_display_entity or self.npc, w=64, h=64}}
uis[#uis+1] = {left=0, bottom=0, ui=ActorFrame.new{actor=self.player.chat_display_entity or self.player, w=64, h=64}}
uis[2].left = nil uis[2].right = 0
uis[3].top = math.max(self.c_desc.h, uis[4].ui.h) - 10
uis[3].top = math.max(self.c_desc.h, uis[4].ui.h) + 5
end
self:loadUI(uis)
......
......@@ -70,7 +70,6 @@ function _M:loadup(level, zone)
zone.base_level = zone.store_levels_by_restock[game.state.stores_restock] or zone.base_level
end
print("STORE LEVEL ===================================================", zone.base_level)
if Store.loadup(self, level, zone, self.store.nb_fill) then
self.last_filled = game.state.stores_restock
end
......
......@@ -50,6 +50,15 @@ function _M:tooltip()
if self:knownBy(game.player) then
local res = tstring{{"uid", self.uid}, self:getName()}
if self.is_store then res:add(true, {"font","italic"}, "<Store>", {"font","normal"}) end
if self.store_faction then
local factcolor, factstate, factlevel = "#ANTIQUE_WHITE#", "neutral", Faction:factionReaction(self.store_faction, game.player.faction)
if factlevel < 0 then factcolor, factstate = "#LIGHT_RED#", "hostile"
elseif factlevel > 0 then factcolor, factstate = "#LIGHT_GREEN#", "friendly"
end
if Faction.factions[self.store_faction] then res:add(true, "Faction: ") res:merge(factcolor:toTString()) res:add(("%s (%s, %d)"):format(Faction.factions[self.store_faction].name, factstate, factlevel), {"color", "WHITE"}, true) end
end
if config.settings.cheat then
res:add(true, "UID: "..self.uid, true, "Detect: "..self.detect_power, true, "Disarm: "..self.disarm_power)
end
......
......@@ -104,7 +104,7 @@ newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_GEM",
[Talents.T_CHARGED_AURA]={base=1, every=7, max=5},
[Talents.T_KINETIC_SHIELD]={base=2, every=7, max=5},
},
resolvers.store("GEMSTORE"),
resolvers.store("GEMSTORE", "the-way"),
}
newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_2HANDS",
......@@ -123,7 +123,7 @@ newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_2HANDS",
[Talents.T_CHARGED_AURA]={base=1, every=7, max=5},
[Talents.T_KINETIC_SHIELD]={base=2, every=7, max=5},
},
resolvers.store("TWO_HANDS_WEAPON"),
resolvers.store("TWO_HANDS_WEAPON", "the-way"),
}
newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_1HAND",
......@@ -142,7 +142,7 @@ newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_1HAND",
[Talents.T_CHARGED_AURA]={base=1, every=7, max=5},
[Talents.T_KINETIC_SHIELD]={base=2, every=7, max=5},
},
resolvers.store("ONE_HAND_WEAPON"),
resolvers.store("ONE_HAND_WEAPON", "the-way"),
}
newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_CLOTH",
......@@ -161,7 +161,7 @@ newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_CLOTH",
[Talents.T_CHARGED_AURA]={base=1, every=7, max=5},
[Talents.T_KINETIC_SHIELD]={base=2, every=7, max=5},
},
resolvers.store("CLOTH_ARMOR"),
resolvers.store("CLOTH_ARMOR", "the-way"),
}
newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_LEATHER",
......@@ -180,7 +180,7 @@ newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_LEATHER",
[Talents.T_CHARGED_AURA]={base=1, every=7, max=5},
[Talents.T_KINETIC_SHIELD]={base=2, every=7, max=5},
},
resolvers.store("LIGHT_ARMOR"),
resolvers.store("LIGHT_ARMOR", "the-way"),
}
newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_NATURE",
......@@ -199,5 +199,5 @@ newEntity{ base = "BASE_NPC_IRKKK_TOWN", define_as = "YEEK_STORE_NATURE",
[Talents.T_CHARGED_AURA]={base=1, every=7, max=5},
[Talents.T_KINETIC_SHIELD]={base=2, every=7, max=5},
},
resolvers.store("POTION"),
resolvers.store("POTION", "the-way"),
}
......@@ -21,6 +21,7 @@ require "engine.class"
local Dialog = require "engine.ui.Dialog"
local Inventory = require "engine.ui.Inventory"
local Separator = require "engine.ui.Separator"
local Map = require "engine.Map"
module(..., package.seeall, class.inherit(Dialog))
......@@ -36,6 +37,11 @@ function _M:init(title, store_inven, actor_inven, store_filter, actor_filter, ac
self.actor_filter = actor_filter
Dialog.init(self, title or "Store", math.max(800, game.w * 0.8), math.max(600, game.h * 0.8))
if store_actor.faction then
local i = Map.tiles:loadImage("faction/"..store_actor.faction..".png")
if i then self.faction_image = {i:glTexture()} end
end
self.c_inven = Inventory.new{actor=actor_actor, inven=actor_inven, filter=actor_filter, width=math.floor(self.iw / 2 - 10), height=self.ih - 10,
columns={
{name="", width={20,"fixed"}, display_prop="char", sort="id"},
......@@ -203,3 +209,12 @@ function _M:onDragTakeoff(what)
game.mouse:usedDrag()
end
end
function _M:innerDisplayBack(x, y, nb_keyframes)
if not self.faction_image then return end
print("====faction image")
local w, h = self.title_tex.h + 4, self.title_tex.h + 4
local x, y = x + (self.w - self.title_tex.w) / 2 + self.frame.title_x - 5 - w, y + self.frame.title_y
self.faction_image[1]:toScreenFull(x, y, w, h, self.faction_image[2] * w / self.faction_image[6], self.faction_image[3] * h / self.faction_image[7])
end
......@@ -261,6 +261,7 @@ function resolvers.calc.store(t, e)
return true
end
e.store = game:getStore(t)
e.store.faction = e.store_faction
-- print("[STORE] created for entity", t, e, e.name)
-- Delete the origin field
......@@ -276,6 +277,10 @@ function resolvers.calc.chatfeature(t, e)
e.chat_faction = t[2]
t = t[1]
if e.chat_faction then
e.chat_display_entity = engine.Entity.new{image="faction/"..e.chat_faction..".png"}
end
e.block_move = function(self, x, y, who, act, couldpass)
if who and who.player and act then
if self.chat_faction and who:reactionToward({faction=self.chat_faction}) < 0 then return true end
......
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