Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "engine.class"
- local UI = require "engine.ui.Base"
- local UISet = require "mod.class.uiset.UISet"
- local DebugConsole = require "engine.DebugConsole"
- local HotkeysDisplay = require "engine.HotkeysDisplay"
- local HotkeysIconsDisplay = require "engine.HotkeysIconsDisplay"
- local ActorsSeenDisplay = require "engine.ActorsSeenDisplay"
- local LogDisplay = require "engine.LogDisplay"
- local LogFlasher = require "engine.LogFlasher"
- local FlyingText = require "engine.FlyingText"
- local Shader = require "engine.Shader"
- local Tooltip = require "mod.class.Tooltip"
- local TooltipsData = require "mod.class.interface.TooltipsData"
- local Dialog = require "engine.ui.Dialog"
- local Map = require "engine.Map"
- local FontPackage = require "engine.FontPackage"
- module(..., package.seeall, class.inherit(UISet, TooltipsData))
- --renamed copy from paradox
- libido_c = {0x2f/255, 0xa0/255, 0xb4/255}
- libido_c2 = {0x8f/255, 0x80/255, 0x44/255}
- libido_sha = Shader.new("resources2", {require_shader=4, delay_load=true, color1=libido_c, color2=libido_c2, amp=0.8, speed=20000, distort={0.1,0.25}})
- fshat_libido = {core.display.loadImage("/data/gfx/ui/resources/front_libido.png"):glTexture()}
- fshat_libido_dark = {core.display.loadImage("/data/gfx/ui/resources/front_libido_dark.png"):glTexture()}
- function _M:showResourceTooltip(x, y, w, h, id, desc, is_first)
- if not game.mouse:updateZone(id, x, y, w, h, nil, self.places.resources.scale) then
- game.mouse:registerZone(x, y, w, h, function(button, mx, my, xrel, yrel, bx, by, event)
- if is_first then
- if event == "out" then self.mhandle.resources = nil return
- else self.mhandle.resources = true end
- -- Move handle
- if not self.locked and bx >= self.mhandle_pos.resources.x and bx <= self.mhandle_pos.resources.x + move_handle[6] and by >= self.mhandle_pos.resources.y and by <= self.mhandle_pos.resources.y + move_handle[7] then
- if event == "button" and button == "right" then
- local player = game.player
- local list = {}
- if player:knowTalent(player.T_STAMINA_POOL) then list[#list+1] = {name="Stamina", id="stamina"} end
- if player:knowTalent(player.T_MANA_POOL) then list[#list+1] = {name="Mana", id="mana"} end
- if player:knowTalent(player.T_SOUL_POOL) then list[#list+1] = {name="Necrotic", id="soul"} end
- if player:knowTalent(player.T_EQUILIBRIUM_POOL) then list[#list+1] = {name="Equilibrium", id="equilibrium"} end
- if player:knowTalent(player.T_POSITIVE_POOL) then list[#list+1] = {name="Positive", id="positive"} end
- if player:knowTalent(player.T_NEGATIVE_POOL) then list[#list+1] = {name="Negative", id="negative"} end
- if player:knowTalent(player.T_PARADOX_POOL) then list[#list+1] = {name="Paradox", id="paradox"} end
- if player:knowTalent(player.T_LIBIDO_POOL) then list[#list+1] = {name="Libido", id="libido"} end
- if player:knowTalent(player.T_VIM_POOL) then list[#list+1] = {name="Vim", id="vim"} end
- if player:knowTalent(player.T_HATE_POOL) then list[#list+1] = {name="Hate", id="hate"} end
- if player:knowTalent(player.T_PSI_POOL) then list[#list+1] = {name="Psi", id="psi"} end
- if player:knowTalent(player.T_FEEDBACK_POOL) then list[#list+1] = {name="Feedback", id="feedback"} end
- Dialog:listPopup("Display/Hide resources", "Toggle:", list, 300, 300, function(sel)
- if not sel or not sel.id then return end
- game.player["_hide_resource_"..sel.id] = not game.player["_hide_resource_"..sel.id]
- end)
- return
- end
- self:uiMoveResize("resources", button, mx, my, xrel, yrel, bx, by, event, nil, nil, "\nRight click to toggle resources bars visibility")
- return
- end
- end
- local extra = {log_str=desc}
- game.mouse:delegate(button, mx, my, xrel, yrel, nil, nil, event, "playmap", extra)
- end, nil, id, true, self.places.resources.scale)
- end
- end
- function _M:displayResources(scale, bx, by, a)
- local player = game.player
- if player then
- local orient = self.sizes.resources and self.sizes.resources.orient or "right"
- local x, y = 0, 0
- --------------------libido
- if player:knowTalent(player.T_LIBIDO_POOL) and not player._hide_resource_libido then
- sshat[1]:toScreenFull(x-6, y+8, sshat[6], sshat[7], sshat[2], sshat[3], 1, 1, 1, a)
- bshat[1]:toScreenFull(x, y, bshat[6], bshat[7], bshat[2], bshat[3], 1, 1, 1, a)
- local chance = player:libidoFailChance()
- local s = chance
- if s > 15 then s = 15 end
- s = s / 15
- if libido_sha.shad then
- libido_sha:setUniform("pivot", math.sqrt(s))
- libido_sha:setUniform("a", a)
- libido_sha:setUniform("speed", 10000 - s * 7000)
- libido_sha.shad:use(true)
- end
- local p = util.bound(600-player:getModifiedLibido(), 0, 300) / 300
- --local p = 1 - chance / 100
- shat[1]:toScreenPrecise(x+49, y+10, shat[6] * p, shat[7], 0, p * 1/shat[4], 0, 1/shat[5], libido_c[1], libido_c[2], libido_c[3], a)
- if libido_sha.shad then libido_sha.shad:use(false) end
- local vm = player:getModifiedLibido()
- if not self.res.libido or self.res.libido.vm ~= vm or self.res.libido.vc ~= player.libido or self.res.libido.vr ~= chance then
- self.res.libido = {
- hidable = "Libido",
- vc = player.libido, vr = chance, vm = vm,
- cur = {core.display.drawStringBlendedNewSurface(font_sha, ("%d (%d)"):format(vm, player.libido), 255, 255, 255):glTexture()},
- regen={core.display.drawStringBlendedNewSurface(sfont_sha, ("%d%%"):format(chance), 255, 255, 255):glTexture()},
- }
- end
- local dt = self.res.libido.cur
- dt[1]:toScreenFull(2+x+64, 2+y+10 + (shat[7]-dt[7])/2, dt[6], dt[7], dt[2], dt[3], 0, 0, 0, 0.7 * a)
- dt[1]:toScreenFull(x+64, y+10 + (shat[7]-dt[7])/2, dt[6], dt[7], dt[2], dt[3], 1, 1, 1, a)
- dt = self.res.libido.regen
- dt[1]:toScreenFull(2+x+144, 2+y+10 + (shat[7]-dt[7])/2, dt[6], dt[7], dt[2], dt[3], 0, 0, 0, 0.7 * a)
- dt[1]:toScreenFull(x+144, y+10 + (shat[7]-dt[7])/2, dt[6], dt[7], dt[2], dt[3], 1, 1, 1, a)
- local front = fshat_libido
- if chance <= 10 then front = fshat_libido_dark end
- front[1]:toScreenFull(x, y, front[6], front[7], front[2], front[3], 1, 1, 1, a)
- self:showResourceTooltip(bx+x*scale, by+y*scale, fshat[6], fshat[7], "res:libido", self.TOOLTIP_LIBIDO)
- x, y = self:resourceOrientStep(orient, bx, by, scale, x, y, fshat[6], fshat[7])
- elseif game.mouse:getZone("res:libido") then game.mouse:unregisterZone("res:libido") end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment