diff --git a/game/engines/default/engine/UserChat.lua b/game/engines/default/engine/UserChat.lua index e34ba862c2899acef131327061f568611ef5ca97..916ddff631bfe964a3d4c460fe7b8847403944d6 100644 --- a/game/engines/default/engine/UserChat.lua +++ b/game/engines/default/engine/UserChat.lua @@ -256,12 +256,16 @@ end ---------------------------------------------------------------- --- Returns the full log -function _M:getLog(channel) +function _M:getLog(channel, extra) channel = channel or self.cur_channel local log = {} if self.channels[channel] then for _, i in ipairs(self.channels[channel].log) do - log[#log+1] = ("<%s> %s"):format(i.name, i.msg) + if extra then + log[#log+1] = {str=("<%s> %s"):format(i.name, i.msg), src=i} + else + log[#log+1] = ("<%s> %s"):format(i.name, i.msg) + end end end return log diff --git a/game/engines/default/engine/ui/Dialog.lua b/game/engines/default/engine/ui/Dialog.lua index 92c67e7e7c5de6f5cac4b37d90ee7edee7ac1441..7575b4aa7744d352bcc8d66b94aac3724ed76c79 100644 --- a/game/engines/default/engine/ui/Dialog.lua +++ b/game/engines/default/engine/ui/Dialog.lua @@ -556,7 +556,7 @@ function _M:toScreen(x, y, nb_keyframes) if not ui.hidden then ui.ui:display(x + ui.x, y + ui.y, nb_keyframes, ox + ui.x, oy + ui.y) end end - self:innerDisplay(x, y, nb_keyframes) + self:innerDisplay(x, y, nb_keyframes, tx, ty) -- Restiore normal opengl matrix if zoom < 1 then core.display.glScale() end diff --git a/game/modules/tome/class/UserChatExtension.lua b/game/modules/tome/class/UserChatExtension.lua index f99cc83adc24cbd54d663bd86f0a0c68b6d43e97..7f07e4c70c6d6ea6e1af804e00ce0340b3f4182e 100644 --- a/game/modules/tome/class/UserChatExtension.lua +++ b/game/modules/tome/class/UserChatExtension.lua @@ -42,6 +42,13 @@ function _M:sendActorLink(m) core.profile.pushOrder(string.format("o='ChatSerialData' channel=%q msg=%q", self.chat.cur_channel, ser)) end +function _M:sendKillerLink(msg, src) + local desc = nil + if src.tooltip then desc = tostring(src:tooltip(src.x, src.y, game.player)):removeUIDCodes() end + local ser = zlib.compress(table.serialize{kind="killer-link", msg=msg, desc=desc}) + core.profile.pushOrder(string.format("o='ChatSerialData' channel=%q msg=%q", self.chat.cur_channel, ser)) +end + -- Receive a custom event function _M:event(e) if e.se == "SerialData" then @@ -51,10 +58,10 @@ function _M:event(e) if not data then return end if data.kind == "object-link" then self.chat:addMessage(e.channel, e.login, e.name, "#ANTIQUE_WHITE#has linked an item: #WHITE# "..data.name, {mode="tooltip", tooltip=data.desc}) - if self.chat.cur_channel == e.channel then game.logChat("#LIGHT_BLUE#%s has linked an item <%s>", e.name, data.name) end elseif data.kind == "actor-link" then self.chat:addMessage(e.channel, e.login, e.name, "#ANTIQUE_WHITE#has linked a creature: #WHITE# "..data.name, {mode="tooltip", tooltip=data.desc}) - if self.chat.cur_channel == e.channel then game.logChat("#LIGHT_BLUE#%s has linked a creature <%s>", e.name, data.name) end + elseif data.kind == "killer-link" then + self.chat:addMessage(e.channel, e.login, e.name, "#CRIMSON#"..data.msg.."#WHITE#", data.desc and {mode="tooltip", tooltip=data.desc} or nil) end end end diff --git a/game/modules/tome/class/interface/PartyDeath.lua b/game/modules/tome/class/interface/PartyDeath.lua index 725c44eee6111a5d16117cb1591a94454f177ebe..e93649546dd7ccce7d7a80bb33ae26fcf861f663 100644 --- a/game/modules/tome/class/interface/PartyDeath.lua +++ b/game/modules/tome/class/interface/PartyDeath.lua @@ -88,6 +88,9 @@ function _M:onPartyDeath(src, death_note) ) game.log("#{bold}#"..msg.."#{normal}#") - if not game.player.easy_mode_lifes or game.player.easy_mode_lifes <= 0 then profile.chat:talk(msg) end + if not game.player.easy_mode_lifes or game.player.easy_mode_lifes <= 0 then + profile.chat.uc_ext:sendKillerLink(msg, src) +-- profile.chat:talk(msg) + end end end diff --git a/game/modules/tome/data/gfx/lore/shertul_fortress_lore7.png b/game/modules/tome/data/gfx/lore/shertul_fortress_lore7.png new file mode 100644 index 0000000000000000000000000000000000000000..a76892324362054bd86341070b7eb59383c2c3f1 Binary files /dev/null and b/game/modules/tome/data/gfx/lore/shertul_fortress_lore7.png differ diff --git a/game/modules/tome/dialogs/ShowChatLog.lua b/game/modules/tome/dialogs/ShowChatLog.lua index 3f5a7c2d762693de589532ac66a8b5f653fd62dd..322cadf16b09d7f93374211b59aca86e7de58e8c 100644 --- a/game/modules/tome/dialogs/ShowChatLog.lua +++ b/game/modules/tome/dialogs/ShowChatLog.lua @@ -90,13 +90,30 @@ function _M:mouseEvent(button, x, y, xrel, yrel, bx, by, event) if button == "wheelup" and event == "button" then self.key:triggerVirtual("MOVE_UP") elseif button == "wheeldown" and event == "button" then self.key:triggerVirtual("MOVE_DOWN") + elseif event == "motion" then + if not self.dlist then return end + local citem = nil + for i = #self.dlist, 1, -1 do + local item = self.dlist[i] + if item.dh and by >= item.dh then citem = self.dlist[i].src break end + end + if citem and citem.extra_data and citem.extra_data.mode == "tooltip" then + game.tooltip_x, game.tooltip_y = 1, 1 + game.tooltip:displayAtMap(nil, nil, game.w, game.h, citem.extra_data.tooltip) + else + game.tooltip_x, game.tooltip_y = nil, nil + end end end function _M:loadLog(log) self.lines = {} for i = #log, 1, -1 do - self.lines[#self.lines+1] = log[i] + if type(log[i]) == "string" then + self.lines[#self.lines+1] = {str=log[i]} + else + self.lines[#self.lines+1] = log[i] + end end self.max_h = self.ih - self.iy @@ -117,7 +134,7 @@ function _M:switchTo(ui) if ui.tab_channel == "__log" then self:loadLog(self.log:getLog()) else - self:loadLog(self.chat:getLog(ui.tab_channel)) + self:loadLog(self.chat:getLog(ui.tab_channel, true)) end -- Set it on the class to persist between invocations _M.last_tab = ui.tab_channel @@ -135,9 +152,9 @@ function _M:setScroll(i) local stop = false local tstr = self.lines[z] if not tstr then break end - local gen = self.font:draw(tstr, self.iw - 10, 255, 255, 255) + local gen = self.font:draw(tstr.str, self.iw - 10, 255, 255, 255) for i = 1, #gen do - self.dlist[#self.dlist+1] = gen[i] + self.dlist[#self.dlist+1] = {d=gen[i], src=self.lines[z].src} nb = nb + 1 if nb >= self.max_display then stop = true break end end @@ -146,12 +163,14 @@ function _M:setScroll(i) self.font:setStyle(old_style) end -function _M:innerDisplay(x, y, nb_keyframes) +function _M:innerDisplay(x, y, nb_keyframes, tx, ty) local h = y + self.iy + self.start_y for i = 1, #self.dlist do - local item = self.dlist[i] + local item = self.dlist[i].d if self.shadow then item._tex:toScreenFull(x+2, h+2, item.w, item.h, item._tex_w, item._tex_h, 0,0,0, self.shadow) end item._tex:toScreenFull(x, h, item.w, item.h, item._tex_w, item._tex_h) + self.dlist[i].dh = h - y +-- print("<<",i,"::",h + ty) h = h + self.font_h end