From 1a31a4cd9b928c8225d75bd62f3bef730d781ccf Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Tue, 26 Apr 2011 18:14:43 +0000 Subject: [PATCH] Update charsheet dialog to show more info git-svn-id: http://svn.net-core.org/repos/t-engine4@3277 51575b47-30f0-44d4-a5cc-537603b46e54 --- .../engines/default/engine/ui/SurfaceZone.lua | 52 ++ game/engines/default/engine/ui/Tab.lua | 114 ++++ .../tome/class/interface/TooltipsData.lua | 37 ++ game/modules/tome/dialogs/CharacterSheet.lua | 536 ++++++++++++------ 4 files changed, 561 insertions(+), 178 deletions(-) create mode 100644 game/engines/default/engine/ui/SurfaceZone.lua create mode 100644 game/engines/default/engine/ui/Tab.lua diff --git a/game/engines/default/engine/ui/SurfaceZone.lua b/game/engines/default/engine/ui/SurfaceZone.lua new file mode 100644 index 0000000000..33918651af --- /dev/null +++ b/game/engines/default/engine/ui/SurfaceZone.lua @@ -0,0 +1,52 @@ +-- TE4 - T-Engine 4 +-- Copyright (C) 2009, 2010, 2011 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +require "engine.class" +local Base = require "engine.ui.Base" +local Focusable = require "engine.ui.Focusable" + +--- A generic UI list +module(..., package.seeall, class.inherit(Base, Focusable)) + +function _M:init(t) + self.w = assert(t.width, "no surface zone width") + self.h = assert(t.height, "no surface zone height") + self.alpha = t.alpha or 200 + + self.s = core.display.newSurface(self.w, self.h) + + self.texture, self.texture_w, self.texture_h = self.s:glTexture() + + self.color = t.color or {r=255, g=255, b=255} + + Base.init(self, t) +end + +function _M:generate() + self.mouse:reset() + self.key:reset() + + self.s:updateTexture(self.texture) + + self.can_focus = false +end + +function _M:display(x, y) + self.texture:toScreenFull(x, y, self.w, self.h, self.texture_w, self.texture_h) +end diff --git a/game/engines/default/engine/ui/Tab.lua b/game/engines/default/engine/ui/Tab.lua new file mode 100644 index 0000000000..1b2c7bc47c --- /dev/null +++ b/game/engines/default/engine/ui/Tab.lua @@ -0,0 +1,114 @@ +-- TE4 - T-Engine 4 +-- Copyright (C) 2009, 2010, 2011 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org + +require "engine.class" +local Base = require "engine.ui.Base" +local Focusable = require "engine.ui.Focusable" + +--- A generic UI textbox +module(..., package.seeall, class.inherit(Base, Focusable)) + +frame_ox1 = -5 +frame_ox2 = 5 +frame_oy1 = -1 +frame_oy2 = 1 + +function _M:init(t) + self.title = assert(t.title, "no tab title") + self.text = t.text or "" + self.selected = t.default + self.fct = assert(t.fct, "no tab fct") + self.on_change = t.on_change + + Base.init(self, t) +end + +function _M:generate() + self.mouse:reset() + self.key:reset() + + -- Draw UI + self.title_w, self.title_h = self.font:size(self.title) + self.w, self.h = self.title_w - frame_ox1 + frame_ox2, self.title_h - frame_oy1 + frame_oy2 + + local s = core.display.newSurface(self.title_w, self.title_h) + s:drawColorStringBlended(self.font, self.title, 0, 0, 255, 255, 255, true) + self.tex = {s:glTexture()} + + -- Add UI controls + self.mouse:registerZone(0, 0, self.w, self.h, function(button, x, y, xrel, yrel, bx, by, event) + if event == "button" then + self:select() + end + end) + + self.rw, self.rh = self.title_w, self.title_h + self.frame = self:makeFrame("ui/button", self.w, self.h) + self.frame.b2 = self:getUITexture("ui/border_hor_middle.png") + + self.frame_sel = self:makeFrame("ui/button_sel", self.w, self.h) + + self.key:addBind("ACCEPT", function() self.fct(self.selected) end) + self.key:addCommands{ + _SPACE = function() self:select() end, + } + + self.w = self.w + 1 + self.h = self.h + 6 +end + +function _M:drawFrame(f, x, y, r, g, b, a) + -- Sides + f.b8.t:toScreenFull(x + f.b7.w, y, f.w - f.b7.w - f.b9.w + 1, f.b8.h, f.b8.tw, f.b8.th, r, g, b, a) + f.b2.t:toScreenFull(x , y + f.h - 3, f.w , f.b2.h, f.b2.tw, f.b2.th, r, g, b, a) + f.b4.t:toScreenFull(x, y + f.b7.h, f.b4.w, f.h - f.b7.h + 1, f.b4.tw, f.b4.th, r, g, b, a) + f.b6.t:toScreenFull(x + f.w - f.b9.w, y + f.b7.h, f.b6.w, f.h - f.b7.h + 1, f.b6.tw, f.b6.th, r, g, b, a) + + -- Body + f.b5.t:toScreenFull(x + f.b7.w, y + f.b7.h, f.w - f.b7.w - f.b9.w + 1, f.h - f.b7.h + 1, f.b6.tw, f.b6.th, r, g, b, a) + + -- Corners + f.b7.t:toScreenFull(x, y, f.b7.w, f.b7.h, f.b7.tw, f.b7.th, r, g, b, a) + f.b9.t:toScreenFull(x + f.w - f.b9.w, y, f.b9.w, f.b9.h, f.b9.tw, f.b9.th, r, g, b, a) +end + +function _M:select() + self.selected = true + if self.on_change then self.on_change(self.selected) end +end + +function _M:display(x, y, nb_keyframes) + x = x + 3 + y = y + 4 + if self.selected then + self:drawFrame(self.frame_sel, x, y) + self.tex[1]:toScreenFull(x-frame_ox1, y-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3]) + elseif not self.focused then + self:drawFrame(self.frame, x, y, 1, 1, 1, 1) + if self.focus_decay then + self:drawFrame(self.frame_sel, x, y, 1, 0.5, 0.5, self.focus_decay / self.focus_decay_max_d) + self.focus_decay = self.focus_decay - nb_keyframes + if self.focus_decay <= 0 then self.focus_decay = nil end + end + self.tex[1]:toScreenFull(x-frame_ox1, y-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3]) + else + self:drawFrame(self.frame_sel, x, y, 1, 0.5, 0.5, 1) + self.tex[1]:toScreenFull(x-frame_ox1, y-frame_oy1, self.rw, self.rh, self.tex[2], self.tex[3]) + end +end diff --git a/game/modules/tome/class/interface/TooltipsData.lua b/game/modules/tome/class/interface/TooltipsData.lua index 3ac3142e84..d6a6784792 100644 --- a/game/modules/tome/class/interface/TooltipsData.lua +++ b/game/modules/tome/class/interface/TooltipsData.lua @@ -31,12 +31,25 @@ With gold you can buy items in the various stores in town. You can gain money by looting it from your foes, by selling items and by doing some quests. ]] +TOOLTIP_LIVES = [[#GOLD#Lives#LAST# +How many lives you have and how many you lost. +Your total number of lives depends on the difficulty setting you choose. +You may find other ways to save yourself but they are not considered extra lives.]] + TOOLTIP_LIFE = [[#GOLD#Life#LAST# This is your life force, when you take damage this is reduced more and more. If it reaches below zero you die. Death is usually permanent so beware! It is increased by Constitution.]] +TOOLTIP_LIFE_REGEN = [[#GOLD#Life Regeneration#LAST# +How many life you regenerate per turn. +This value can be improved with spells, talents, infusions, equipment.]] + +TOOLTIP_LIFE = [[#GOLD#Healing mod#LAST# +This represents how effective is healing for you. +All healing values are multiplied by this value (including life regeneration).]] + TOOLTIP_AIR = [[#GOLD#Air#LAST# The breath counter only appears when you are suffocating. If it reaches zero you will die. Being stuck in a wall, being in deep water, ... all those kind of situations will decrease your air. @@ -108,6 +121,30 @@ The people of Eyal have found a way to create herbal infusions and runes that ca Those inscriptions give the bearer always accessible powers. Usually most people have a simple regeneration infusion, but there are other kind of potion inscriptions. ]] +------------------------------------------------------------- +-- Speeds +------------------------------------------------------------- +TOOLTIP_SPEED_GLOBAL = [[#GOLD#Global Speed#LAST# +Global speed affects everything you do. +It represents how much "energy" you get per game turn, once you reach a certain point you can act. +I.E: at 200% global speed you get twice as much energy per game turn and thus can act twice when other creatures only act once. +]] +TOOLTIP_SPEED_MOVEMENT = [[#GOLD#Movement Speed#LAST# +The time it takes you to move. +It represents how many movements you can do in the same time. +I.E: at 100% you will be able to do 100% more movements (aka twice as many) in the same time it would have taken you to do one at 0% speed. +]] +TOOLTIP_SPEED_SPELL = [[#GOLD#Spell Speed#LAST# +The time it takes you to cast a spell. +It represents how many spells you can do in the same time. +I.E: at 100% you will be able to cast 100% more spells (aka twice as many) in the same time it would have taken you to do one at 0% speed. +]] +TOOLTIP_SPEED_ATTACK = [[#GOLD#Attack Speed#LAST# +The time it takes you to attack (in melee or ranged). +It represents how many attacks you can do in the same time. +I.E: at 100% you will be able to do 100% more attacks (aka twice as many) in the same time it would have taken you to do one at 0% speed. +]] + ------------------------------------------------------------- -- Stats ------------------------------------------------------------- diff --git a/game/modules/tome/dialogs/CharacterSheet.lua b/game/modules/tome/dialogs/CharacterSheet.lua index 7db7ef3a33..d3ae83d7a0 100644 --- a/game/modules/tome/dialogs/CharacterSheet.lua +++ b/game/modules/tome/dialogs/CharacterSheet.lua @@ -19,35 +19,77 @@ require "engine.class" require "mod.class.interface.TooltipsData" -local Dialog = require "engine.Dialog" +local Dialog = require "engine.ui.Dialog" local DamageType = require "engine.DamageType" local Talents = require "engine.interface.ActorTalents" +local Tab = require "engine.ui.Tab" +local SurfaceZone = require "engine.ui.SurfaceZone" +local Separator = require "engine.ui.Separator" -module(..., package.seeall, class.inherit(engine.Dialog, mod.class.interface.TooltipsData)) +module(..., package.seeall, class.inherit(Dialog, mod.class.interface.TooltipsData)) function _M:init(actor) self.actor = actor - engine.Dialog.init(self, "Character Sheet: "..self.actor.name.." (Press 'd' to save)", 800, 400, nil, nil, nil, core.display.newFont("/data/font/VeraMono.ttf", 12)) + Dialog.init(self, "Character Sheet: "..self.actor.name.." (Press 'd' to save)", 800, 400) - self:keyCommands({ - __TEXTINPUT = function(c) - if c == 'd' or c == 'D' then - self:dump() - end - end, - }, { - ACCEPT = "EXIT", - EXIT = function() - game:unregisterDialog(self) - end, - }) - self:mouseZones{ + self.font = core.display.newFont("/data/font/VeraMono.ttf", 12) + self.font_h = self.font:lineSkip() + + self.c_general = Tab.new{title="General", default=true, fct=function() end, on_change=function(s) if s then self:switchTo("general") end end} + self.c_attack = Tab.new{title="Attack", default=false, fct=function() end, on_change=function(s) if s then self:switchTo("attack") end end} + self.c_defence = Tab.new{title="Defence", default=false, fct=function() end, on_change=function(s) if s then self:switchTo("defence") end end} + + local tw, th = self.font_bold:size(self.title) + + self.hoffset = 17+self.c_general.h + + self.c_desc = SurfaceZone.new{width=self.iw, height=self.ih-self.c_general.h,alpha=0} + + self:loadUI{ + {left=0, top=self.c_general.h, ui=Separator.new{dir="vertical", size=self.iw}}, + + {left=15, top=0, ui=self.c_general}, + {left=15+self.c_general.w, top=0, ui=self.c_attack}, + {left=15+self.c_general.w+self.c_attack.w, top=0, ui=self.c_defence}, + + {left=0, top=self.c_general.h+5, ui=self.c_desc}, } + self:setFocus(self.c_general) + self:setupUI() + + self:switchTo("general") + + self.key:addBinds{ + EXIT = function() game:unregisterDialog(self) end, + } +end + +function _M:switchTo(kind) + self:drawDialog(kind) + if kind == "general" then self.c_attack.selected = false self.c_defence.selected = false + elseif kind == "attack" then self.c_general.selected = false self.c_defence.selected = false + elseif kind == "defence" then self.c_attack.selected = false self.c_general.selected = false + end +end + +function _M:mouseZones(t, no_new) + -- Offset the x and y with the window position and window title + if not t.norestrict then + for i, z in ipairs(t) do + if not z.norestrict then + z.x = z.x + self.display_x + 5 + z.y = z.y + self.display_y + 20 + 3 + end + end + end + + if not no_new then self.mouse = engine.Mouse.new() end + self.mouse:registerZones(t) end function _M:mouseTooltip(text, _, _, _, w, h, x, y) self:mouseZones({ - { x=x, y=y, w=w, h=h, fct=function(button) game.tooltip_x, game.tooltip_y = 1, 1; game.tooltip:displayAtMap(nil, nil, game.w, game.h, text) end}, + { x=x, y=y+self.hoffset, w=w, h=h, fct=function(button) game.tooltip_x, game.tooltip_y = 1, 1; game.tooltip:displayAtMap(nil, nil, game.w, game.h, text) end}, }, true) end @@ -62,199 +104,337 @@ function _M:mouseLink(link, text, _, _, _, w, h, x, y) }, true) end -function _M:drawDialog(s) +function _M:drawDialog(kind) self.mouse:reset() - self:mouseZones({ - { x=0, y=0, w=game.w, h=game.h, norestrict=true, fct=function(button, _, _, _, _, _, _, event) game.tooltip_x, game.tooltip_y = nil, nil; if button == "left" and event == "button" then game:unregisterDialog(self) end end}, - }, true) + + self:setupUI() + + -- self.c_general:generate() + -- self.c_attack:generate() + -- self.c_defence:generate() local player = self.actor - local cur_exp, max_exp = player.exp, player:getExpChart(player.level+1) + local s = self.c_desc.s + + s:erase(0,0,0,s.alpha) - local basey = 0 local h = 0 local w = 0 + if player.__te4_uuid and profile.auth and profile.auth.drupid then local path = "http://te4.org/characters/"..profile.auth.drupid.."/tome/"..player.__te4_uuid - self:mouseLink(path, "You can find your character sheet online", s:drawColorStringBlended(self.font, "Online URL: #LIGHT_BLUE##{underline}#"..path.."#{normal}#", w, h, 255, 255, 255)) h = h + self.font_h - basey = self.font_h + 9 - end + local LinkTxt = "Online URL: #LIGHT_BLUE##{underline}#"..path.."#{normal}#" + local Link_w, Link_h = self.font:size(LinkTxt) + h = self.c_desc.h - Link_h + w = (self.c_desc.w - Link_w) * 0.5 + self:mouseLink(path, "You can find your character sheet online", s:drawColorStringBlended(self.font, LinkTxt, w, h, 255, 255, 255)) + end + + if kind == "general" then + local cur_exp, max_exp = player.exp, player:getExpChart(player.level+1) + h = 0 + w = 0 + s:drawStringBlended(self.font, "Sex : "..(player.descriptor.sex or (player.female and "Female" or "Male")), w, h, 0, 200, 255) h = h + self.font_h + s:drawStringBlended(self.font, "Race : "..(player.descriptor.subrace or player.type:capitalize()), w, h, 0, 200, 255) h = h + self.font_h + s:drawStringBlended(self.font, "Class: "..(player.descriptor.subclass or player.subtype:capitalize()), w, h, 0, 200, 255) h = h + self.font_h + s:drawStringBlended(self.font, "Size : "..(player:TextSizeCategory():capitalize()), w, h, 0, 200, 255) h = h + self.font_h + + h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_LEVEL, s:drawColorStringBlended(self.font, "Level: #00ff00#"..player.level, w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_LEVEL, s:drawColorStringBlended(self.font, ("Exp : #00ff00#%2d%%"):format(100 * cur_exp / max_exp), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_GOLD, s:drawColorStringBlended(self.font, ( "Gold : #00ff00#%0.2f"):format(player.money), w, h, 255, 255, 255)) h = h + self.font_h + + h = h + self.font_h + + self:mouseTooltip(self.TOOLTIP_LIFE, s:drawColorStringBlended(self.font, ("#c00000#Life: #00ff00#%d/%d"):format(player.life, player.max_life), w, h, 255, 255, 255)) h = h + self.font_h + if player:knowTalent(player.T_STAMINA_POOL) then + self:mouseTooltip(self.TOOLTIP_STAMINA, s:drawColorStringBlended(self.font, ("#ffcc80#Stamina: #00ff00#%d/%d"):format(player:getStamina(), player.max_stamina), w, h, 255, 255, 255)) h = h + self.font_h + end + if player:knowTalent(player.T_MANA_POOL) then + self:mouseTooltip(self.TOOLTIP_MANA, s:drawColorStringBlended(self.font, ("#7fffd4#Mana: #00ff00#%d/%d"):format(player:getMana(), player.max_mana), w, h, 255, 255, 255)) h = h + self.font_h + end + if player:knowTalent(player.T_POSITIVE_POOL) then + self:mouseTooltip(self.TOOLTIP_POSITIVE, s:drawColorStringBlended(self.font, ("#7fffd4#Positive:#00ff00#%d/%d"):format(player:getPositive(), player.max_positive), w, h, 255, 255, 255)) h = h + self.font_h + end + if player:knowTalent(player.T_NEGATIVE_POOL) then + self:mouseTooltip(self.TOOLTIP_NEGATIVE, s:drawColorStringBlended(self.font, ("#7fffd4#Negative:#00ff00#%d/%d"):format(player:getNegative(), player.max_negative), w, h, 255, 255, 255)) h = h + self.font_h + end + if player:knowTalent(player.T_VIM_POOL) then + self:mouseTooltip(self.TOOLTIP_VIM, s:drawColorStringBlended(self.font, ("#904010#Vim: #00ff00#%d/%d"):format(player:getVim(), player.max_vim), w, h, 255, 255, 255)) h = h + self.font_h + end + if player:knowTalent(player.T_EQUILIBRIUM_POOL) then + self:mouseTooltip(self.TOOLTIP_EQUILIBRIUM, s:drawColorStringBlended(self.font, ("#00ff74#Equi: #00ff00#%d"):format(player:getEquilibrium()), w, h, 255, 255, 255)) h = h + self.font_h + end + if player:knowTalent(player.T_HATE_POOL) then + self:mouseTooltip(self.TOOLTIP_HATE, s:drawColorStringBlended(self.font, ("#F53CBE#Hate: #00ff00#%.1f/%d"):format(player:getHate(), 10), w, h, 255, 255, 255)) h = h + self.font_h + end - h = basey - w = 0 - s:drawStringBlended(self.font, "Sex: "..(player.descriptor.sex or (player.female and "Female" or "Male")), w, h, 0, 200, 255) h = h + self.font_h - s:drawStringBlended(self.font, "Race: "..(player.descriptor.subrace or player.type:capitalize()), w, h, 0, 200, 255) h = h + self.font_h - s:drawStringBlended(self.font, "Class: "..(player.descriptor.subclass or player.subtype:capitalize()), w, h, 0, 200, 255) h = h + self.font_h - h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_LEVEL, s:drawColorStringBlended(self.font, "Level: #00ff00#"..player.level, w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_LEVEL, s:drawColorStringBlended(self.font, ("Exp: #00ff00#%2d%%"):format(100 * cur_exp / max_exp), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_GOLD, s:drawColorStringBlended(self.font, ("Gold: #00ff00#%0.2f"):format(player.money), w, h, 255, 255, 255)) h = h + self.font_h + h = 0 + w = 200 + + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Speeds:", w, h, 255, 255, 255) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_SPEED_GLOBAL, s:drawColorStringBlended(self.font, ("Global speed : #00ff00#%.2f%%"):format(player.global_speed*100), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_SPEED_MOVEMENT, s:drawColorStringBlended(self.font, ("Movement speed: #00ff00#%.2f%%"):format((1/player:combatMovementSpeed()-1)*100), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_SPEED_SPELL, s:drawColorStringBlended(self.font, ("Spell speed : #00ff00#%.2f%%"):format((player.combat_spellspeed-1)*100), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_SPEED_ATTACK, s:drawColorStringBlended(self.font, ("Attack speed : #00ff00#%.2f%%"):format((player.combat_physspeed-1)*100), w, h, 255, 255, 255)) h = h + self.font_h + h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_LIVES, s:drawColorStringBlended(self.font, ("Times died : #00ff00#%3d"):format(#player.died_times), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_LIVES, s:drawColorStringBlended(self.font, ("Lifes left : #00ff00#%3d"):format(player.easy_mode_lifes), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_HEALING_MOD, s:drawColorStringBlended(self.font, ("Healing mod: #00ff00#%.2f%%"):format(player.healing_factor*100), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_LIFE_REGEN, s:drawColorStringBlended(self.font, ("Life regen : #00ff00#%.2f (%.2f)"):format(player.life_regen,player.life_regen*player.healing_factor), w, h, 255, 255, 255)) h = h + self.font_h + + --player.inc_stats[] + + -- player.life_regen + -- player.forbid_arcane + -- player.exp_mod + -- player.lite + -- player.can_breath[] + + h = 0 + w = 400 + + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Stats (base/current):", w, h, 255, 255, 255) h = h + self.font_h + local StatVal = self.actor:getStr(nil, nil, true) + local StatTxt = "" + if StatVal > player:getStr() then + StatTxt = ("Strength : #ff0000#%3d / %3"):format(player:getStr(nil, nil, true), player:getStr()) + else + StatTxt = ("Strength : #00ff00#%3d / %d"):format(player:getStr(nil, nil, true), player:getStr()) + end + self:mouseTooltip(self.TOOLTIP_STR, s:drawColorStringBlended(self.font, StatTxt, w, h, 255, 255, 255)) h = h + self.font_h - h = h + self.font_h + StatVal = self.actor:getDex(nil, nil, true) + if StatVal > player:getDex() then + StatTxt = ("Dexterity : #ff0000#%3d / %d"):format(player:getDex(nil, nil, true), player:getDex()) + else + StatTxt = ("Dexterity : #00ff00#%3d / %d"):format(player:getDex(nil, nil, true), player:getDex()) + end + self:mouseTooltip(self.TOOLTIP_DEX, s:drawColorStringBlended(self.font, StatTxt, w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_LIFE, s:drawColorStringBlended(self.font, ("#c00000#Life: #00ff00#%d/%d"):format(player.life, player.max_life), w, h, 255, 255, 255)) h = h + self.font_h - if player:knowTalent(player.T_STAMINA_POOL) then - self:mouseTooltip(self.TOOLTIP_STAMINA, s:drawColorStringBlended(self.font, ("#ffcc80#Stamina: #00ff00#%d/%d"):format(player:getStamina(), player.max_stamina), w, h, 255, 255, 255)) h = h + self.font_h - end - if player:knowTalent(player.T_MANA_POOL) then - self:mouseTooltip(self.TOOLTIP_MANA, s:drawColorStringBlended(self.font, ("#7fffd4#Mana: #00ff00#%d/%d"):format(player:getMana(), player.max_mana), w, h, 255, 255, 255)) h = h + self.font_h - end - if player:knowTalent(player.T_POSITIVE_POOL) then - self:mouseTooltip(self.TOOLTIP_POSITIVE, s:drawColorStringBlended(self.font, ("#7fffd4#Positive:#00ff00#%d/%d"):format(player:getPositive(), player.max_positive), w, h, 255, 255, 255)) h = h + self.font_h - end - if player:knowTalent(player.T_NEGATIVE_POOL) then - self:mouseTooltip(self.TOOLTIP_NEGATIVE, s:drawColorStringBlended(self.font, ("#7fffd4#Negative:#00ff00#%d/%d"):format(player:getNegative(), player.max_negative), w, h, 255, 255, 255)) h = h + self.font_h - end - if player:knowTalent(player.T_VIM_POOL) then - self:mouseTooltip(self.TOOLTIP_VIM, s:drawColorStringBlended(self.font, ("#904010#Vim: #00ff00#%d/%d"):format(player:getVim(), player.max_vim), w, h, 255, 255, 255)) h = h + self.font_h - end - if player:knowTalent(player.T_EQUILIBRIUM_POOL) then - self:mouseTooltip(self.TOOLTIP_EQUILIBRIUM, s:drawColorStringBlended(self.font, ("#00ff74#Equi: #00ff00#%d"):format(player:getEquilibrium()), w, h, 255, 255, 255)) h = h + self.font_h - end - if player:knowTalent(player.T_HATE_POOL) then - self:mouseTooltip(self.TOOLTIP_HATE, s:drawColorStringBlended(self.font, ("#F53CBE#Hate: #00ff00#%.1f/%d"):format(player:getHate(), 10), w, h, 255, 255, 255)) h = h + self.font_h - end + StatVal = self.actor:getMag(nil, nil, true) + if StatVal > player:getMag() then + StatTxt = ("Magic : #ff0000#%3d / %d"):format(player:getMag(nil, nil, true), player:getMag()) + else + StatTxt = ("Magic : #00ff00#%3d / %d"):format(player:getMag(nil, nil, true), player:getMag()) + end + self:mouseTooltip(self.TOOLTIP_MAG, s:drawColorStringBlended(self.font, StatTxt, w, h, 255, 255, 255)) h = h + self.font_h - h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_STR, s:drawColorStringBlended(self.font, ("STR: #00ff00#%3d"):format(player:getStr()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_DEX, s:drawColorStringBlended(self.font, ("DEX: #00ff00#%3d"):format(player:getDex()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_MAG, s:drawColorStringBlended(self.font, ("MAG: #00ff00#%3d"):format(player:getMag()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_WIL, s:drawColorStringBlended(self.font, ("WIL: #00ff00#%3d"):format(player:getWil()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_CUN, s:drawColorStringBlended(self.font, ("CUN: #00ff00#%3d"):format(player:getCun()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_CON, s:drawColorStringBlended(self.font, ("CON: #00ff00#%3d"):format(player:getCon()), w, h, 255, 255, 255)) h = h + self.font_h + StatVal = self.actor:getWil(nil, nil, true) + if StatVal > player:getWil() then + StatTxt = ("Willpower : #ff0000#%3d / %d"):format(player:getWil(nil, nil, true), player:getWil()) + else + StatTxt = ("Willpower : #00ff00#%3d / %d"):format(player:getWil(nil, nil, true), player:getWil()) + end + self:mouseTooltip(self.TOOLTIP_WIL, s:drawColorStringBlended(self.font, StatTxt, w, h, 255, 255, 255)) h = h + self.font_h - h = h + self.font_h - local nb_inscriptions = 0 - for i = 1, player.max_inscriptions do if player.inscriptions[i] then nb_inscriptions = nb_inscriptions + 1 end end - self:mouseTooltip(self.TOOLTIP_INSCRIPTIONS, s:drawColorStringBlended(self.font, ("#AQUAMARINE#Inscriptions (%d/%d)"):format(nb_inscriptions, player.max_inscriptions), w, h, 255, 255, 255)) h = h + self.font_h - for i = 1, player.max_inscriptions do if player.inscriptions[i] then - local t = player:getTalentFromId("T_"..player.inscriptions[i]) - local desc = player:getTalentFullDescription(t) - self:mouseTooltip("#GOLD##{bold}#"..t.name.."#{normal}##WHITE#\n"..tostring(desc), s:drawColorStringBlended(self.font, ("#LIGHT_GREEN#%s"):format(t.name), w, h, 255, 255, 255)) h = h + self.font_h - end end + StatVal = self.actor:getCun(nil, nil, true) + if StatVal > player:getCun() then + StatTxt = ("Cunning : #ff0000#%3d / %d"):format(player:getCun(nil, nil, true), player:getCun()) + else + StatTxt = ("Cunning : #00ff00#%3d / %d"):format(player:getCun(nil, nil, true), player:getCun()) + end + self:mouseTooltip(self.TOOLTIP_CUN, s:drawColorStringBlended(self.font, StatTxt, w, h, 255, 255, 255)) h = h + self.font_h - h = basey - w = 200 - -- All weapons in main hands - local mainhand = player:getInven(player.INVEN_MAINHAND) - if mainhand and (#mainhand > 0) then - for i, o in ipairs(player:getInven(player.INVEN_MAINHAND)) do - local mean, dam = o.combat, o.combat - if o.archery and mean then - dam = (player:getInven("QUIVER")[1] and player:getInven("QUIVER")[1].combat) or o.basic_ammo + StatVal = self.actor:getCon(nil, nil, true) + if StatVal > player:getCon() then + StatTxt = ("Constitution: #ff0000#%3d / %d"):format(player:getCon(nil, nil, true), player:getCon()) + else + StatTxt = ("Constitution: #00ff00#%3d / %d"):format(player:getCon(nil, nil, true), player:getCon()) + end + self:mouseTooltip(self.TOOLTIP_CON, s:drawColorStringBlended(self.font, StatTxt, w, h, 255, 255, 255)) h = h + self.font_h + h = h + self.font_h + + local nb_inscriptions = 0 + for i = 1, player.max_inscriptions do if player.inscriptions[i] then nb_inscriptions = nb_inscriptions + 1 end end + self:mouseTooltip(self.TOOLTIP_INSCRIPTIONS, s:drawColorStringBlended(self.font, ("#AQUAMARINE#Inscriptions (%d/%d)"):format(nb_inscriptions, player.max_inscriptions), w, h, 255, 255, 255)) h = h + self.font_h + for i = 1, player.max_inscriptions do if player.inscriptions[i] then + local t = player:getTalentFromId("T_"..player.inscriptions[i]) + local desc = player:getTalentFullDescription(t) + self:mouseTooltip("#GOLD##{bold}#"..t.name.."#{normal}##WHITE#\n"..tostring(desc), s:drawColorStringBlended(self.font, ("#LIGHT_GREEN#%s"):format(t.name), w, h, 255, 255, 255)) h = h + self.font_h + end end + + h = 0 + w = 600 + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Current effects:", w, h, 255, 255, 255) h = h + self.font_h + for tid, act in pairs(player.sustain_talents) do + if act then + local t = player:getTalentFromId(tid) + local desc = "#GOLD##{bold}#"..t.name.."#{normal}##WHITE#\n"..tostring(player:getTalentFullDescription(t)) + self:mouseTooltip(desc, s:drawColorStringBlended(self.font, ("#LIGHT_GREEN#%s"):format(player:getTalentFromId(tid).name), w, h, 255, 255, 255)) h = h + self.font_h end - if mean and dam then - self:mouseTooltip(self.TOOLTIP_COMBAT_ATTACK, s:drawColorStringBlended(self.font, ("Accuracy(Main Hand): #00ff00#%3d"):format(player:combatAttack(mean)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_DAMAGE, s:drawColorStringBlended(self.font, ("Damage (Main Hand): #00ff00#%3d"):format(player:combatDamage(dam)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_APR, s:drawColorStringBlended(self.font, ("APR (Main Hand): #00ff00#%3d"):format(player:combatAPR(dam)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_CRIT, s:drawColorStringBlended(self.font, ("Crit (Main Hand): #00ff00#%3d%%"):format(player:combatCrit(dam)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_SPEED, s:drawColorStringBlended(self.font, ("Speed (Main Hand): #00ff00#%0.2f"):format(player:combatSpeed(mean)), w, h, 255, 255, 255)) h = h + self.font_h + end + for eff_id, p in pairs(player.tmp) do + local e = player.tempeffect_def[eff_id] + local desc = e.long_desc(player, p) + if e.status == "detrimental" then + self:mouseTooltip(desc, s:drawColorStringBlended(self.font, ("#LIGHT_RED#%s"):format(e.desc), w, h, 255, 255, 255)) h = h + self.font_h + else + self:mouseTooltip(desc, s:drawColorStringBlended(self.font, ("#LIGHT_GREEN#%s"):format(e.desc), w, h, 255, 255, 255)) h = h + self.font_h end - if mean and mean.range then self:mouseTooltip(self.TOOLTIP_COMBAT_RANGE, s:drawColorStringBlended(self.font, ("Range (Main Hand): #00ff00#%3d"):format(mean.range), w, h, 255, 255, 255)) h = h + self.font_h end end - -- Handle bare-handed combat - else - local mean, dam = player.combat, player.combat - if mean and dam then - self:mouseTooltip(self.TOOLTIP_COMBAT_ATTACK, s:drawColorStringBlended(self.font, ("Accuracy(Unarmed): #00ff00#%3d"):format(player:combatAttack(mean)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_DAMAGE, s:drawColorStringBlended(self.font, ("Damage (Unarmed): #00ff00#%3d"):format(player:combatDamage(dam)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_APR, s:drawColorStringBlended(self.font, ("APR (Unarmed): #00ff00#%3d"):format(player:combatAPR(dam)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_CRIT, s:drawColorStringBlended(self.font, ("Crit (Unarmed): #00ff00#%3d%%"):format(player:combatCrit(dam)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_SPEED, s:drawColorStringBlended(self.font, ("Speed (Unarmed): #00ff00#%0.2f"):format(player:combatSpeed(mean)), w, h, 255, 255, 255)) h = h + self.font_h - end - if mean and mean.range then self:mouseTooltip(self.TOOLTIP_COMBAT_RANGE, s:drawColorStringBlended(self.font, ("Range (Main Hand): #00ff00#%3d"):format(mean.range), w, h, 255, 255, 255)) h = h + self.font_h end - end + elseif kind=="attack" then + h = 0 + w = 0 + + local mainhand = player:getInven(player.INVEN_MAINHAND) + if mainhand and (#mainhand > 0) then + local WeaponTxt = "#LIGHT_BLUE#Main Hand" + if player:hasTwoHandedWeapon() then + WeaponTxt = WeaponTxt.."(2-handed)" + end + WeaponTxt = WeaponTxt..":" - h = h + self.font_h - -- All weapons in off hands - -- Offhand attacks are with a damage penalty, that can be reduced by talents - if player:getInven(player.INVEN_OFFHAND) then - local offmult = player:getOffHandMult() - for i, o in ipairs(player:getInven(player.INVEN_OFFHAND)) do - local mean, dam = o.combat, o.combat - if o.archery and mean then - dam = (player:getInven("QUIVER")[1] and player:getInven("QUIVER")[1].combat) or o.basic_ammo + for i, o in ipairs(player:getInven(player.INVEN_MAINHAND)) do + local mean, dam = o.combat, o.combat + if o.archery and mean then + dam = (player:getInven("QUIVER")[1] and player:getInven("QUIVER")[1].combat) or o.basic_ammo + end + if mean and dam then + s:drawColorStringBlended(self.font, WeaponTxt, w, h, 255, 255, 255) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_ATTACK, s:drawColorStringBlended(self.font, ("Accuracy : #00ff00#%3d"):format(player:combatAttack(mean)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_DAMAGE, s:drawColorStringBlended(self.font, ("Damage : #00ff00#%3d"):format(player:combatDamage(dam)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_APR, s:drawColorStringBlended(self.font, ("APR : #00ff00#%3d"):format(player:combatAPR(dam)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_CRIT, s:drawColorStringBlended(self.font, ("Crit. chance: #00ff00#%3d%%"):format(player:combatCrit(dam)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_SPEED, s:drawColorStringBlended(self.font, ("Speed : #00ff00#%0.2f%%"):format(player:combatSpeed(mean)*100), w, h, 255, 255, 255)) h = h + self.font_h + end + if mean and mean.range then self:mouseTooltip(self.TOOLTIP_COMBAT_RANGE, s:drawColorStringBlended(self.font, ("Range (Main Hand): #00ff00#%3d"):format(mean.range), w, h, 255, 255, 255)) h = h + self.font_h end end + -- Handle bare-handed combat + else + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Unarmed:", w, h, 255, 255, 255) h = h + self.font_h + local mean, dam = player.combat, player.combat if mean and dam then - self:mouseTooltip(self.TOOLTIP_COMBAT_ATTACK, s:drawColorStringBlended(self.font, ("Accuracy(Off Hand): #00ff00#%3d"):format(player:combatAttack(mean)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_DAMAGE, s:drawColorStringBlended(self.font, ("Damage (Off Hand): #00ff00#%3d"):format(player:combatDamage(dam) * offmult), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_APR , s:drawColorStringBlended(self.font, ("APR (Off Hand): #00ff00#%3d"):format(player:combatAPR(dam)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_CRIT , s:drawColorStringBlended(self.font, ("Crit (Off Hand): #00ff00#%3d%%"):format(player:combatCrit(dam)), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_COMBAT_SPEED , s:drawColorStringBlended(self.font, ("Speed (Off Hand): #00ff00#%0.2f"):format(player:combatSpeed(mean)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_ATTACK, s:drawColorStringBlended(self.font, ("Accuracy : #00ff00#%3d"):format(player:combatAttack(mean)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_DAMAGE, s:drawColorStringBlended(self.font, ("Damage : #00ff00#%3d"):format(player:combatDamage(dam)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_APR, s:drawColorStringBlended(self.font, ("APR : #00ff00#%3d"):format(player:combatAPR(dam)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_CRIT, s:drawColorStringBlended(self.font, ("Crit. chance: #00ff00#%3d%%"):format(player:combatCrit(dam)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_SPEED, s:drawColorStringBlended(self.font, ("Speed : #00ff00#%0.2f%%"):format(player:combatSpeed(mean)*100), w, h, 255, 255, 255)) h = h + self.font_h + end + if mean and mean.range then self:mouseTooltip(self.TOOLTIP_COMBAT_RANGE, s:drawColorStringBlended(self.font, ("Range (Main Hand): #00ff00#%3d"):format(mean.range), w, h, 255, 255, 255)) h = h + self.font_h end + end + + h = h + self.font_h + -- All weapons in off hands + -- Offhand attacks are with a damage penalty, that can be reduced by talents + if player:getInven(player.INVEN_OFFHAND) then + local offmult = player:getOffHandMult() + for i, o in ipairs(player:getInven(player.INVEN_OFFHAND)) do + local mean, dam = o.combat, o.combat + if o.archery and mean then + dam = (player:getInven("QUIVER")[1] and player:getInven("QUIVER")[1].combat) or o.basic_ammo + end + if mean and dam then + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Off Hand:", w, h, 255, 255, 255) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_ATTACK, s:drawColorStringBlended(self.font, ("Accuracy : #00ff00#%3d"):format(player:combatAttack(mean)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_DAMAGE, s:drawColorStringBlended(self.font, ("Damage : #00ff00#%3d"):format(player:combatDamage(dam) * offmult), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_APR , s:drawColorStringBlended(self.font, ("APR : #00ff00#%3d"):format(player:combatAPR(dam)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_CRIT , s:drawColorStringBlended(self.font, ("Crit. chance: #00ff00#%3d%%"):format(player:combatCrit(dam)), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_COMBAT_SPEED , s:drawColorStringBlended(self.font, ("Speed : #00ff00#%0.2f%%"):format(player:combatSpeed(mean)*100), w, h, 255, 255, 255)) h = h + self.font_h + end + if mean and mean.range then self:mouseTooltip(self.TOOLTIP_COMBAT_RANGE, s:drawColorStringBlended(self.font, ("Range (Off Hand): #00ff00#%3d"):format(mean.range), w, h, 255, 255, 255)) h = h + self.font_h end end - if mean and mean.range then self:mouseTooltip(self.TOOLTIP_COMBAT_RANGE, s:drawColorStringBlended(self.font, ("Range (Off Hand): #00ff00#%3d"):format(mean.range), w, h, 255, 255, 255)) h = h + self.font_h end end - end - h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_SPELL_POWER, s:drawColorStringBlended(self.font, ("Spellpower: #00ff00#%3d"):format(player:combatSpellpower()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_SPELL_CRIT, s:drawColorStringBlended(self.font, ("Spell Crit: #00ff00#%3d%%"):format(player:combatSpellCrit()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_SPELL_SPEED, s:drawColorStringBlended(self.font, ("Spell Speed: #00ff00#%3d"):format(player:combatSpellSpeed()), w, h, 255, 255, 255)) h = h + self.font_h + -- player.combat_physcrit + -- player.combat_mindcrit - h = h + self.font_h - if player.inc_damage.all then self:mouseTooltip(self.TOOLTIP_INC_DAMAGE_ALL, s:drawColorStringBlended(self.font, ("All damage: #00ff00#%3d%%"):format(player.inc_damage.all), w, h, 255, 255, 255)) h = h + self.font_h end - for i, t in ipairs(DamageType.dam_def) do - if player.inc_damage[DamageType[t.type]] and player.inc_damage[DamageType[t.type]] ~= 0 then - self:mouseTooltip(self.TOOLTIP_INC_DAMAGE, s:drawColorStringBlended(self.font, ("%s damage: #00ff00#%3d%%"):format(t.name:capitalize(), player.inc_damage[DamageType[t.type]] + (player.inc_damage.all or 0)), w, h, 255, 255, 255)) h = h + self.font_h + h = 0 + w = 200 + + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Magical:", w, h, 255, 255, 255) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_SPELL_POWER, s:drawColorStringBlended(self.font, ("Spellpower : #00ff00#%3d"):format(player:combatSpellpower()), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_SPELL_CRIT, s:drawColorStringBlended(self.font, ("Crit. chance: #00ff00#%d%%"):format(player:combatSpellCrit()), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_SPELL_SPEED, s:drawColorStringBlended(self.font, ("Spell speed : #00ff00#%.2f%%"):format(player:combatSpellSpeed()*100), w, h, 255, 255, 255)) h = h + self.font_h + h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_STR, s:drawColorStringBlended(self.font, ("Mindpower: #00ff00#%3d"):format(player:combatMindpower()), w, h, 255, 255, 255)) h = h + self.font_h + + h = 0 + w = 400 + + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Damage mods.:", w, h, 255, 255, 255) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_STR , s:drawColorStringBlended(self.font, ("Critical mult.: #00ff00#%3d%%"):format(150 + (player.combat_critical_power or 0)), w, h, 255, 255, 255)) h = h + self.font_h + if player.inc_damage.all then self:mouseTooltip(self.TOOLTIP_INC_DAMAGE_ALL, s:drawColorStringBlended(self.font, ("All damage: #00ff00#%3d%%"):format(player.inc_damage.all), w, h, 255, 255, 255)) h = h + self.font_h end + for i, t in ipairs(DamageType.dam_def) do + if player.inc_damage[DamageType[t.type]] and player.inc_damage[DamageType[t.type]] ~= 0 then + self:mouseTooltip(self.TOOLTIP_INC_DAMAGE, s:drawColorStringBlended(self.font, ("%s damage: #00ff00#%3d%%"):format(t.name:capitalize(), player.inc_damage[DamageType[t.type]] + (player.inc_damage.all or 0)), w, h, 255, 255, 255)) h = h + self.font_h + end end - end - h = basey - w = 400 - self:mouseTooltip(self.TOOLTIP_FATIGUE, s:drawColorStringBlended(self.font, ("Fatigue: #00ff00#%3d%%"):format(player:combatFatigue()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_ARMOR, s:drawColorStringBlended(self.font, ("Armor: #00ff00#%3d"):format(player:combatArmor()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_ARMOR_HARDINESS, s:drawColorStringBlended(self.font, ("Armor Hardiness:#00ff00#%3d%%"):format(player:combatArmorHardiness()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_DEFENSE, s:drawColorStringBlended(self.font, ("Defense: #00ff00#%3d"):format(player:combatDefense()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_RDEFENSE,s:drawColorStringBlended(self.font, ("Ranged Defense: #00ff00#%3d"):format(player:combatDefenseRanged()), w, h, 255, 255, 255)) h = h + self.font_h - - h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_PHYS_SAVE, s:drawColorStringBlended(self.font, ("Physical Save: #00ff00#%3d"):format(player:combatPhysicalResist()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_SPELL_SAVE, s:drawColorStringBlended(self.font, ("Spell Save: #00ff00#%3d"):format(player:combatSpellResist()), w, h, 255, 255, 255)) h = h + self.font_h - self:mouseTooltip(self.TOOLTIP_MENTAL_SAVE, s:drawColorStringBlended(self.font, ("Mental Save: #00ff00#%3d"):format(player:combatMentalResist()), w, h, 255, 255, 255)) h = h + self.font_h - - h = h + self.font_h - if player.resists.all then self:mouseTooltip(self.TOOLTIP_RESIST_ALL, s:drawColorStringBlended(self.font, ("All Resists(cap): #00ff00#%3d%%(%3d%%)"):format(player.resists.all, player.resists_cap.all or 0), w, h, 255, 255, 255)) h = h + self.font_h end - for i, t in ipairs(DamageType.dam_def) do - if player.resists[DamageType[t.type]] and player.resists[DamageType[t.type]] ~= 0 then - self:mouseTooltip(self.TOOLTIP_RESIST, s:drawColorStringBlended(self.font, ("%s Resist(cap): #00ff00#%3d%%(%3d%%)"):format(t.name:capitalize(), player:combatGetResist(DamageType[t.type]), (player.resists_cap[DamageType[t.type]] or 0) + (player.resists_cap.all or 0)), w, h, 255, 255, 255)) h = h + self.font_h + elseif kind=="defence" then + h = 0 + w = 0 + + local ArmorTxt = "#LIGHT_BLUE#" + if player:hasHeavyArmor() then + ArmorTxt = ArmorTxt.."Heavy armor" + elseif player:hasMassiveArmor() then + ArmorTxt = ArmorTxt.."Massive armor" + else + ArmorTxt = ArmorTxt.."Light armor" end - end - immune_type = "poison_immune" immune_name = "Poison Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "disease_immune" immune_name = "Disease Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "cut_immune" immune_name = "Bleed Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "confusion_immune" immune_name = "Confusion Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "blind_immune" immune_name = "Blind Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "silence_immune" immune_name = "Silence Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "disarm_immune" immune_name = "Disarm Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "pin_immune" immune_name = "Pinning Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "stun_immune" immune_name = "Stun Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "fear_immune" immune_name = "Fear Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "knockback_immune" immune_name = "Knockback Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "stone_immune" immune_name = "Stoning Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "instakill_immune" immune_name = "Instadeath Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - immune_type = "teleport_immune" immune_name = "Teleport Resistance" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end - - h = basey - w = 600 - s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Current effects:", w, h, 255, 255, 255) h = h + self.font_h - for tid, act in pairs(player.sustain_talents) do - if act then - local t = player:getTalentFromId(tid) - local desc = "#GOLD##{bold}#"..t.name.."#{normal}##WHITE#\n"..tostring(player:getTalentFullDescription(t)) - self:mouseTooltip(desc, s:drawColorStringBlended(self.font, ("#LIGHT_GREEN#%s"):format(player:getTalentFromId(tid).name), w, h, 255, 255, 255)) h = h + self.font_h + ArmorTxt = ArmorTxt..":" + + s:drawColorStringBlended(self.font, ArmorTxt, w, h, 255, 255, 255) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_FATIGUE, s:drawColorStringBlended(self.font, ("Fatigue : #00ff00#%3d%%"):format(player:combatFatigue()), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_ARMOR, s:drawColorStringBlended(self.font, ("Armor : #00ff00#%3d"):format(player:combatArmor()), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_ARMOR_HARDINESS, s:drawColorStringBlended(self.font, ("Armor Hardiness: #00ff00#%3d%%"):format(player:combatArmorHardiness()), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_DEFENSE, s:drawColorStringBlended(self.font, ("Defense : #00ff00#%3d"):format(player:combatDefense()), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_RDEFENSE,s:drawColorStringBlended(self.font, ("Ranged Defense : #00ff00#%3d"):format(player:combatDefenseRanged()), w, h, 255, 255, 255)) h = h + self.font_h + + h = h + self.font_h + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Saves:", w, h, 255, 255, 255) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_PHYS_SAVE, s:drawColorStringBlended(self.font, ("Physical: #00ff00#%3d"):format(player:combatPhysicalResist()), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_SPELL_SAVE, s:drawColorStringBlended(self.font, ("Spell : #00ff00#%3d"):format(player:combatSpellResist()), w, h, 255, 255, 255)) h = h + self.font_h + self:mouseTooltip(self.TOOLTIP_MENTAL_SAVE, s:drawColorStringBlended(self.font, ("Mental : #00ff00#%3d"):format(player:combatMentalResist()), w, h, 255, 255, 255)) h = h + self.font_h + + h = 0 + w = 200 + + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Resistances:", w, h, 255, 255, 255) h = h + self.font_h + + if player.resists.all then self:mouseTooltip(self.TOOLTIP_RESIST_ALL, s:drawColorStringBlended(self.font, ("All (cap): #00ff00#%3d%%(%d%%)"):format(player.resists.all, player.resists_cap.all or 0), w, h, 255, 255, 255)) h = h + self.font_h end + for i, t in ipairs(DamageType.dam_def) do + if player.resists[DamageType[t.type]] and player.resists[DamageType[t.type]] ~= 0 then + self:mouseTooltip(self.TOOLTIP_RESIST, s:drawColorStringBlended(self.font, ("%s (cap): #00ff00#%3d%% (%d%%)"):format(t.name:capitalize(), player:combatGetResist(DamageType[t.type]), (player.resists_cap[DamageType[t.type]] or 0) + (player.resists_cap.all or 0)), w, h, 255, 255, 255)) h = h + self.font_h + end end - end - for eff_id, p in pairs(player.tmp) do - local e = player.tempeffect_def[eff_id] - local desc = e.long_desc(player, p) - if e.status == "detrimental" then - self:mouseTooltip(desc, s:drawColorStringBlended(self.font, ("#LIGHT_RED#%s"):format(e.desc), w, h, 255, 255, 255)) h = h + self.font_h - else - self:mouseTooltip(desc, s:drawColorStringBlended(self.font, ("#LIGHT_GREEN#%s"):format(e.desc), w, h, 255, 255, 255)) h = h + self.font_h + + h = 0 + w = 400 + + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Effect resistances:", w, h, 255, 255, 255) h = h + self.font_h + immune_type = "poison_immune" immune_name = "Poison " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "disease_immune" immune_name = "Disease " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "cut_immune" immune_name = "Bleed " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "confusion_immune" immune_name = "Confusion " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "blind_immune" immune_name = "Blind " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "silence_immune" immune_name = "Silence " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "disarm_immune" immune_name = "Disarm " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "pin_immune" immune_name = "Pinning " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "stun_immune" immune_name = "Stun/Freeze" if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "fear_immune" immune_name = "Fear " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "knockback_immune" immune_name = "Knockback " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "stone_immune" immune_name = "Stoning " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "instakill_immune" immune_name = "Instadeath " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + immune_type = "teleport_immune" immune_name = "Teleport " if player:attr(immune_type) then self:mouseTooltip(self.TOOLTIP_SPECIFIC_IMMUNE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%3d%%"):format(immune_name, util.bound(player:attr(immune_type) * 100, 0, 100)), w, h, 255, 255, 255)) h = h + self.font_h end + + h = 0 + w = 600 + + s:drawColorStringBlended(self.font, "#LIGHT_BLUE#On being hit:", w, h, 255, 255, 255) h = h + self.font_h + + for i, t in ipairs(DamageType.dam_def) do + if player.on_melee_hit[DamageType[t.type]] and player.on_melee_hit[DamageType[t.type]] ~= 0 then + self:mouseTooltip(self.TOOLTIP_INC_DAMAGE, s:drawColorStringBlended(self.font, ("%s: #00ff00#%.2f"):format(t.name:capitalize(), player.on_melee_hit[DamageType[t.type]]), w, h, 255, 255, 255)) h = h + self.font_h + end end + + --player.combat_mentalresist end + self.c_desc:generate() self.changed = false end -- GitLab