Skip to content
Snippets Groups Projects
Commit 80456626 authored by DarkGod's avatar DarkGod
Browse files

Can send talent links in the chat fomr the talent's right click menu or in the...

Can send talent links in the chat fomr the talent's right click menu or in the levelup dialog by pressing ctrl+l
parent 9a7c6be0
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -28,6 +28,16 @@ function _M:init(chat)
chat:enableShadow(0.6)
end
function _M:sendTalentLink(t)
local p = game:getPlayer()
t = p:getTalentFromId(t)
local desc = tstring{{"color","GOLD"}, {"font", "bold"}, t.name, {"font", "normal"}, {"color", "LAST"}, true}
desc:merge(p:getTalentFullDescription(t))
desc = desc:toString():removeUIDCodes()
local ser = zlib.compress(table.serialize{kind="talent-link", name="#GOLD#"..t.name.."#LAST#", desc=desc})
core.profile.pushOrder(string.format("o='ChatSerialData' kind='talent-link' channel=%q msg=%q", self.chat.cur_channel, ser))
end
function _M:sendObjectLink(o)
local name = o:getName{do_color=true}:removeUIDCodes()
local desc = tostring(o:getDesc(nil, nil, true)):removeUIDCodes()
......@@ -73,6 +83,8 @@ function _M:event(e)
self.chat:addMessage("link", e.channel, e.login, {e.name, color}, "#ANTIQUE_WHITE#has linked an item: #WHITE# "..data.name, {mode="tooltip", tooltip=data.desc})
elseif data.kind == "actor-link" then
self.chat:addMessage("link", e.channel, e.login, {e.name, color}, "#ANTIQUE_WHITE#has linked a creature: #WHITE# "..data.name, {mode="tooltip", tooltip=data.desc})
elseif data.kind == "talent-link" then
self.chat:addMessage("link", e.channel, e.login, {e.name, color}, "#ANTIQUE_WHITE#has linked a talent: #WHITE# "..data.name, {mode="tooltip", tooltip=data.desc})
elseif data.kind == "killer-link" then
self.chat:addMessage("death", e.channel, e.login, {e.name, color}, "#CRIMSON#"..data.msg.."#WHITE#", data.desc and {mode="tooltip", tooltip=data.desc} or nil)
else
......
......@@ -104,6 +104,10 @@ function _M:init(actor, on_finish, on_birth)
game:registerDialog(require("mod.dialogs.debug.PlotTalent").new(self.actor, self.actor:getTalentFromId(tid)))
end
end end,
[{"_l","ctrl"}] = function() if profile.auth and profile.hash_valid then
local tid = self.last_drawn_talent
if tid then profile.chat.uc_ext:sendTalentLink(tid) end
end end,
__TEXTINPUT = function(c)
if self.focus_ui.ui.last_mz then
if c == "+" and self.focus_ui and self.focus_ui.ui.onUse then
......
......@@ -162,6 +162,7 @@ function _M:use(item, button)
{name="Bind to left mouse click (on a target)", what="left"},
{name="Bind to middle mouse click (on a target)", what="middle"},
}
if profile.auth and profile.hash_valid then table.insert(list, {name="Link in chat", what="chat-link"}) end
if self.actor:isTalentConfirmable(t) then
table.insert(list, 1, {name="#YELLOW#Disable talent confirmation", what="unset-confirm"})
......@@ -211,6 +212,8 @@ function _M:use(item, button)
self.actor:checkSetTalentAuto(item.talent, true, 4)
elseif b.what == "auto-dis" then
self.actor:checkSetTalentAuto(item.talent, false)
elseif b.what == "chat-link" then
profile.chat.uc_ext:sendTalentLink(item.talent)
else
self:triggerHook{"UseTalents:use", what=b.what, actor=self.actor, talent=t, item=item}
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