Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add level text #58

Merged
merged 1 commit into from Aug 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 36 additions & 24 deletions VikingNameplates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ local VikingNameplates = {}
-- TODO Delete strings:
-- VikingNameplates_GuildDisplay

-- Disabled DrawLevel as it isn't currently being used

-----------------------------------------------------------------------------------------------
-- Constants
-----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -171,6 +169,7 @@ local karSavedProperties =
["bShowThreatIndicator"] = { default=false, nControlType=1, strControlName="IndividualShowThreatIndicator", fnCallback="OnSettingThreatIndicatorChanged" },
["bShowInterrupt"] = { default=false, nControlType=1, strControlName="IndividualShowInterrupt", fnCallback="OnSettingInterruptChanged" },
["bShowHealthTextMain"] = { default=false, nControlType=1, strControlName="IndividualShowHealthText" },
["bShowLevelMain"] = { default=false, nControlType=1, strControlName="IndividualShowLevel", fnCallback="OnSettingLevelChanged" },
--Reward icons
["bShowRewardTypeQuest"] = { default=true, nControlType=1, strControlName="ShowRewardTypeQuest", fnCallback="UpdateAllNameplateRewards" },
["bShowRewardTypeMission"] = { default=true, nControlType=1, strControlName="ShowRewardTypeMission", fnCallback="UpdateAllNameplateRewards" },
Expand All @@ -193,6 +192,7 @@ local karSavedProperties =
["bShowCastBarTarget"] = { default=true, nControlType=1, strControlName="TargetedShowCastBar" },
["bShowCastBarSpellTarget"] = { default=true, nControlType=1, strControlName="TargetedShowCastBarSpell" },
["bShowHealthTextTarget"] = { default=false, nControlType=1, strControlName="TargetedShowHealthText" },
["bShowLevelTarget"] = { default=false, nControlType=1, strControlName="TargetedShowLevel", fnCallback="OnSettingLevelChanged" },
--Non-targeted nameplates in combat
["bHideInCombat"] = { default=false, nControlType=0 }
}
Expand Down Expand Up @@ -265,7 +265,7 @@ function VikingNameplates:OnDocumentReady()
Apollo.RegisterEventHandler("UnitTitleChanged", "OnUnitTitleChanged", self)
Apollo.RegisterEventHandler("PlayerTitleChange", "OnPlayerTitleChanged", self)
Apollo.RegisterEventHandler("UnitGuildNameplateChanged", "OnUnitGuildNameplateChanged",self)
--Apollo.RegisterEventHandler("UnitLevelChanged", "OnUnitLevelChanged", self)
Apollo.RegisterEventHandler("UnitLevelChanged", "OnUnitLevelChanged", self)
Apollo.RegisterEventHandler("UnitMemberOfGuildChange", "OnUnitMemberOfGuildChange", self)
Apollo.RegisterEventHandler("GuildChange", "OnGuildChange", self)
Apollo.RegisterEventHandler("UnitGibbed", "OnUnitGibbed", self)
Expand Down Expand Up @@ -476,7 +476,6 @@ function VikingNameplates:OnUnitCreated(unitNew) -- build main options here
background = wnd:FindChild("Container:BackgroundContainer"),
castBar = wnd:FindChild("Container:CastBar"),
vulnerable = wnd:FindChild("Container:Vulnerable"),
level = wnd:FindChild("Container:Health:Level"),
guild = wnd:FindChild("Guild"),
name = wnd:FindChild("NameRewardContainer:Name"),
certainDeath = wnd:FindChild("TargetAndDeathContainer:CertainDeath"),
Expand All @@ -502,9 +501,9 @@ function VikingNameplates:OnUnitCreated(unitNew) -- build main options here
self.arUnit2Nameplate[idUnit] = tNameplate
self.arWnd2Nameplate[wnd:GetId()] = tNameplate

self:DrawName(tNameplate)
self:DrawNameAndLevel(tNameplate)
self:DrawGuild(tNameplate)
self:DrawLevel(tNameplate)
--self:DrawLevel(tNameplate)
self:UpdateNameplateRewardInfo(tNameplate)
self:DrawRewards(tNameplate)
self:DrawThreatIndicator(tNameplate)
Expand Down Expand Up @@ -569,6 +568,7 @@ function VikingNameplates:DrawNameplate(tNameplate)
self:DrawThreatIndicator(tNameplate)
self:DrawTargeting(tNameplate)
self:DrawInterrupt(tNameplate)
--self:DrawLevel(tNameplate)
end

function VikingNameplates:ColorNameplate(tNameplate)
Expand Down Expand Up @@ -630,13 +630,16 @@ function VikingNameplates:ColorNameplate(tNameplate)
tNameplate.wnd.guild:SetTextColor(crColorToUse)
end

function VikingNameplates:DrawName(tNameplate)
function VikingNameplates:DrawNameAndLevel(tNameplate)
local wndNameplate = tNameplate.wndNameplate
local unitOwner = tNameplate.unitOwner

local targetUnit = GameLib:GetTargetUnit()
local wndName = tNameplate.wnd.name
local bUseTarget = tNameplate.bIsTarget
local bShow = self.bShowNameMain
local sLevelText = unitOwner:GetLevel() or "--"
local bShowLevel = self.bShowLevelMain == true or (self.bShowLevelTarget == true and unitOwner == targetUnit)

if bUseTarget then
bShow = self.bShowNameTarget
end
Expand All @@ -646,10 +649,19 @@ function VikingNameplates:DrawName(tNameplate)
end
if bShow then
local strNewName
if self.bShowTitle then
strNewName = unitOwner:GetTitleOrName()
if bShowLevel then
local sLevelText = unitOwner:GetLevel() or "-"
if self.bShowTitle then
strNewName = unitOwner:GetTitleOrName() .. " - " .. sLevelText
else
strNewName = unitOwner:GetName() .. " - " .. sLevelText
end
else
strNewName = unitOwner:GetName()
if self.bShowTitle then
strNewName = unitOwner:GetTitleOrName()
else
strNewName = unitOwner:GetName()
end
end

if wndName:GetText() ~= strNewName then
Expand Down Expand Up @@ -696,12 +708,6 @@ function VikingNameplates:DrawGuild(tNameplate)
end
end

function VikingNameplates:DrawLevel(tNameplate)
local unitOwner = tNameplate.unitOwner

tNameplate.wnd.level:SetText(unitOwner:GetLevel() or "-")
end

function VikingNameplates:DrawHealth(tNameplate)
local wndNameplate = tNameplate.wndNameplate
local unitOwner = tNameplate.unitOwner
Expand Down Expand Up @@ -1225,21 +1231,21 @@ end
function VikingNameplates:OnUnitNameChanged(unitUpdated, strNewName)
local tNameplate = self.arUnit2Nameplate[unitUpdated:GetId()]
if tNameplate ~= nil then
self:DrawName(tNameplate)
self:DrawNameAndLevel(tNameplate)
end
end

function VikingNameplates:OnUnitTitleChanged(unitUpdated)
local tNameplate = self.arUnit2Nameplate[unitUpdated:GetId()]
if tNameplate ~= nil then
self:DrawName(tNameplate)
self:DrawNameAndLevel(tNameplate)
end
end

function VikingNameplates:OnPlayerTitleChanged()
local tNameplate = self.arUnit2Nameplate[self.unitPlayer:GetId()]
if tNameplate ~= nil then
self:DrawName(tNameplate)
self:DrawNameAndLevel(tNameplate)
end
end

Expand Down Expand Up @@ -1295,7 +1301,7 @@ function VikingNameplates:OnTargetUnitChanged(unitOwner) -- build targeted optio
tNameplateOther.bIsCluster = false

if bIsTarget or bIsCluster then
self:DrawName(tNameplateOther)
self:DrawNameAndLevel(tNameplateOther)
self:DrawGuild(tNameplateOther)
--self:DrawLevel(tNameplateOther)
self:UpdateNameplateRewardInfo(tNameplateOther)
Expand All @@ -1313,7 +1319,7 @@ function VikingNameplates:OnTargetUnitChanged(unitOwner) -- build targeted optio

if GameLib.GetTargetUnit() == unitOwner then
tNameplate.bIsTarget = true
self:DrawName(tNameplate)
self:DrawNameAndLevel(tNameplate)
self:DrawGuild(tNameplate)
--self:DrawLevel(tNameplate)
self:UpdateNameplateRewardInfo(tNameplate)
Expand Down Expand Up @@ -1434,7 +1440,13 @@ end

function VikingNameplates:OnSettingNameChanged()
for idx, tNameplate in pairs(self.arUnit2Nameplate) do
self:DrawName(tNameplate)
self:DrawNameAndLevel(tNameplate)
end
end

function VikingNameplates:OnSettingLevelChanged()
for idx, tNameplate in pairs(self.arUnit2Nameplate) do
self:DrawNameAndLevel(tNameplate)
end
end

Expand All @@ -1446,7 +1458,7 @@ end

function VikingNameplates:OnSettingHealthChanged()
for idx, tNameplate in pairs(self.arUnit2Nameplate) do
self:DrawLevel(tNameplate)
--self:DrawLevel(tNameplate)
end
end

Expand Down
13 changes: 10 additions & 3 deletions VikingNameplates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@
<Event Name="ButtonCheck" Function="OnGenericSingleCheck"/>
<Event Name="ButtonUncheck" Function="OnGenericSingleCheck"/>
</Control>
<Control Class="Button" Base="BK3:btnHolo_Check" Font="CRB_InterfaceMedium" ButtonType="Check" RadioGroup="" LAnchorPoint="0" LAnchorOffset="212" TAnchorPoint="0" TAnchorOffset="187" RAnchorPoint="1" RAnchorOffset="-12" BAnchorPoint="0" BAnchorOffset="213" DT_VCENTER="1" DT_CENTER="0" Name="IndividualShowLevel" BGColor="white" TextColor="white" NormalTextColor="UI_BtnTextHoloNormal" PressedTextColor="UI_BtnTextHoloPressed" FlybyTextColor="UI_BtnTextHoloFlyby" PressedFlybyTextColor="UI_BtnTextHoloPressedFlyby" DisabledTextColor="UI_BtnTextHoloDisabled" Template="CRB_Normal" NewControlDepth="3" Text="" TextId="Friends_LevelHeader" DT_WORDBREAK="1" RadioDisallowNonSelection="0" DrawAsCheckbox="1" TooltipColor="" BottomEdgeControlsAnchor="">
<Event Name="ButtonCheck" Function="OnGenericSingleCheck"/>
<Event Name="ButtonUncheck" Function="OnGenericSingleCheck"/>
</Control>
</Control>
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="0" TAnchorPoint="VikingNameplates_IndividualPanel_Bottom" TAnchorOffset="15" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="VikingNameplates_IndividualPanel_Bottom" BAnchorOffset="110" RelativeToClient="1" Font="Default" Text="" Template="Default" Name="HealthBarFraming" BGColor="white" TextColor="white" Picture="1" IgnoreMouse="1" Sprite="" TooltipColor="" HideInEditor="0" Tooltip="" BottomEdgeControlsAnchor="NameplateO_HealthBarFraming_Bottom">
<Control Class="Button" Base="BK3:btnHolo_Radio_Big" Font="CRB_InterfaceSmall" ButtonType="Check" RadioGroup="" LAnchorPoint="0" LAnchorOffset="20" TAnchorPoint="0" TAnchorOffset="52" RAnchorPoint="0" RAnchorOffset="146" BAnchorPoint="0" BAnchorOffset="77" DT_VCENTER="1" DT_CENTER="0" Name="MainShowHealthBarAlways" BGColor="white" TextColor="white" NormalTextColor="UI_BtnTextBlueNormal" PressedTextColor="UI_BtnTextHoloPressed" FlybyTextColor="UI_BtnTextHoloFlyby" PressedFlybyTextColor="UI_BtnTextHoloPressedFlyby" DisabledTextColor="UI_BtnTextHoloDisabled" Template="CRB_Normal" NewControlDepth="3" Text="" TextId="Nameplates_AlwaysShow" DT_WORDBREAK="1" GlobalRadioGroup="MainShowHealthBarGroup" RadioDisallowNonSelection="1" TooltipColor="" DrawAsCheckbox="1">
Expand Down Expand Up @@ -237,7 +241,7 @@
<Event Name="ButtonCheck" Function="OnGenericSingleCheck"/>
<Event Name="ButtonUncheck" Function="OnGenericSingleCheck"/>
</Control>
<Control Class="Button" Base="BK3:btnHolo_Check" Font="CRB_InterfaceMedium" ButtonType="Check" RadioGroup="" LAnchorPoint="0" LAnchorOffset="20" TAnchorPoint="0" TAnchorOffset="200" RAnchorPoint="1" RAnchorOffset="-13" BAnchorPoint="0" BAnchorOffset="226" DT_VCENTER="1" DT_CENTER="0" Name="TargetedShowHealth" BGColor="white" TextColor="white" NormalTextColor="UI_BtnTextHoloNormal" PressedTextColor="UI_BtnTextHoloPressed" FlybyTextColor="UI_BtnTextHoloFlyby" PressedFlybyTextColor="UI_BtnTextHoloPressedFlyby" DisabledTextColor="UI_BtnTextHoloDisabled" Template="CRB_Normal" NewControlDepth="3" Text="" TextId="Nameplates_HealthBarLabel" DT_WORDBREAK="1" RadioDisallowNonSelection="0" DrawAsCheckbox="1" TooltipColor="" CheckboxRight="0" DrawHotkey="0">
<Control Class="Button" Base="BK3:btnHolo_Check" Font="CRB_InterfaceMedium" ButtonType="Check" RadioGroup="" LAnchorPoint="0" LAnchorOffset="20" TAnchorPoint="0" TAnchorOffset="200" RAnchorPoint="0.5" RAnchorOffset="0" BAnchorPoint="0" BAnchorOffset="226" DT_VCENTER="1" DT_CENTER="0" Name="TargetedShowHealth" BGColor="white" TextColor="white" NormalTextColor="UI_BtnTextHoloNormal" PressedTextColor="UI_BtnTextHoloPressed" FlybyTextColor="UI_BtnTextHoloFlyby" PressedFlybyTextColor="UI_BtnTextHoloPressedFlyby" DisabledTextColor="UI_BtnTextHoloDisabled" Template="CRB_Normal" NewControlDepth="3" Text="" TextId="Nameplates_HealthBarLabel" DT_WORDBREAK="1" RadioDisallowNonSelection="0" DrawAsCheckbox="1" TooltipColor="" CheckboxRight="0" DrawHotkey="0">
<Event Name="ButtonCheck" Function="OnGenericSingleCheck"/>
<Event Name="ButtonUncheck" Function="OnGenericSingleCheck"/>
</Control>
Expand All @@ -257,8 +261,12 @@
<Event Name="ButtonCheck" Function="OnGenericSingleCheck"/>
<Event Name="ButtonUncheck" Function="OnGenericSingleCheck"/>
</Control>
<Control Class="Button" Base="BK3:btnHolo_Check" Font="CRB_InterfaceMedium" ButtonType="Check" RadioGroup="" LAnchorPoint="0.5" LAnchorOffset="0" TAnchorPoint="0" TAnchorOffset="200" RAnchorPoint="1" RAnchorOffset="-12" BAnchorPoint="0" BAnchorOffset="226" DT_VCENTER="1" DT_CENTER="0" Name="TargetedShowLevel" BGColor="white" TextColor="white" NormalTextColor="UI_BtnTextHoloNormal" PressedTextColor="UI_BtnTextHoloPressed" FlybyTextColor="UI_BtnTextHoloFlyby" PressedFlybyTextColor="UI_BtnTextHoloPressedFlyby" DisabledTextColor="UI_BtnTextHoloDisabled" Template="CRB_Normal" NewControlDepth="3" Text="" TextId="Friends_LevelHeader" DT_WORDBREAK="1" RadioDisallowNonSelection="0" DrawAsCheckbox="1" TooltipColor="" CheckboxRight="0" DrawHotkey="0">
<Event Name="ButtonCheck" Function="OnGenericSingleCheck"/>
<Event Name="ButtonUncheck" Function="OnGenericSingleCheck"/>
</Control>
</Control>
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="0" TAnchorPoint="VikingNameplates_TargetOptionsFraming_Bottom" TAnchorOffset="10" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="VikingNameplates_TargetOptionsFraming_Bottom" BAnchorOffset="153" RelativeToClient="1" Font="Default" Text="" Template="Default" Name="TargetedNameplateFraming" BGColor="UI_TextMetalBodyHighlight" TextColor="white" Picture="1" IgnoreMouse="1" Sprite="" TooltipColor="">
<Control Class="Window" LAnchorPoint="0.5" LAnchorOffset="-211" TAnchorPoint="VikingNameplates_TargetOptionsFraming_Bottom" TAnchorOffset="10" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="VikingNameplates_TargetOptionsFraming_Bottom" BAnchorOffset="153" RelativeToClient="1" Font="Default" Text="" Template="Default" Name="TargetedNameplateFraming" BGColor="UI_TextMetalBodyHighlight" TextColor="white" Picture="1" IgnoreMouse="1" Sprite="" TooltipColor="">
<Pixie LAnchorPoint="0" LAnchorOffset="0" TAnchorPoint="0" TAnchorOffset="0" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="1" BAnchorOffset="0" Sprite="BK3:UI_BK3_Holo_InsetHeader" BGColor="white" TextColor="black" Rotation="0" Font="Default"/>
<Pixie LAnchorPoint="0" LAnchorOffset="0" TAnchorPoint="0" TAnchorOffset="9" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="0" BAnchorOffset="32" BGColor="white" Font="CRB_HeaderSmall" TextColor="white" Text="" TextId="Nameplates_NonTargetedHeader" DT_CENTER="1" DT_VCENTER="0" DT_BOTTOM="0" Line="0"/>
<Control Class="Button" Base="BK3:btnHolo_Blue_Med" Font="CRB_InterfaceSmall" ButtonType="Check" RadioGroup="NameplateOptionTargetHideCombat" LAnchorPoint="0" LAnchorOffset="15" TAnchorPoint="1" TAnchorOffset="-100" RAnchorPoint=".5" RAnchorOffset="-1" BAnchorPoint="1" BAnchorOffset="-5" DT_VCENTER="1" DT_CENTER="1" Name="MainHideInCombatOff" BGColor="white" TextColor="white" NormalTextColor="UI_BtnTextHoloNormal" PressedTextColor="UI_BtnTextHoloPressed" FlybyTextColor="UI_BtnTextHoloFlyby" PressedFlybyTextColor="UI_BtnTextHoloPressedFlyby" DisabledTextColor="UI_BtnTextHoloDisabled" Text="" TextId="" DrawAsCheckbox="0" CheckboxRight="0" Template="CRB_Normal" NoClip="0" DT_WORDBREAK="1" GlobalRadioGroup="" TooltipColor="" RadioDisallowNonSelection="1">
Expand Down Expand Up @@ -302,7 +310,6 @@
</Control>
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="0" TAnchorPoint="1" TAnchorOffset="-45" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="1" BAnchorOffset="0" RelativeToClient="1" Font="Default" Text="" Template="Default" Name="Container" BGColor="white" TextColor="white" Visible="1" TooltipColor="" Tooltip="" UseParentOpacity="0" IgnoreMouse="1">
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="15" TAnchorPoint="0" TAnchorOffset="5" RAnchorPoint="1" RAnchorOffset="-10" BAnchorPoint="1" BAnchorOffset="0" RelativeToClient="1" Font="Default" Text="" Template="Default" TooltipType="OnCursor" Name="Health" BGColor="white" TextColor="white" TooltipColor="" Sprite="" Picture="1" IgnoreMouse="1" HideInEditor="0">
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="103" TAnchorPoint="0" TAnchorOffset="-22" RAnchorPoint="0" RAnchorOffset="121" BAnchorPoint="1" BAnchorOffset="-44" RelativeToClient="1" Font="CRB_InterfaceTiny_BB" Text="" Template="Default" TooltipType="OnCursor" Name="Level" BGColor="white" TextColor="white" TooltipColor="" Picture="1" IgnoreMouse="1" Sprite="" TextId="Challenges_NoProgress" DT_VCENTER="0" DT_CENTER="0" NewControlDepth="1" DT_RIGHT="1"/>
<Control Class="Window" LAnchorPoint="0" LAnchorOffset="0" TAnchorPoint="0" TAnchorOffset="0" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="1" BAnchorOffset="-6" RelativeToClient="1" Font="CRB_Pixel_O" Text="" Template="Default" Name="HealthBars" BGColor="white" TextColor="white" Visible="1" TextId="" Picture="1" IgnoreMouse="1" Sprite="" DT_CENTER="1" DT_VCENTER="1" TooltipColor="" Tooltip="">
<Control Class="Window" Text="" LAnchorPoint="0" LAnchorOffset="0" TAnchorPoint="0" TAnchorOffset="-10" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="0" BAnchorOffset="10" AutoSetText="0" UseValues="0" RelativeToClient="1" SetTextToProgress="0" DT_CENTER="1" DT_VCENTER="1" ProgressFull="CRB_NameplateSprites:sprNp_HealthBarHostile" Name="MaxHealth" BGColor="white" TextColor="white" Sprite="" Picture="1" IgnoreMouse="1" NeverBringToFront="0" TooltipColor="" BarColor="">
<Control Class="ProgressBar" Text="" LAnchorPoint="0" LAnchorOffset="0" TAnchorPoint="0" TAnchorOffset="10" RAnchorPoint="1" RAnchorOffset="0" BAnchorPoint="1" BAnchorOffset="0" AutoSetText="0" UseValues="0" RelativeToClient="1" SetTextToProgress="0" DT_CENTER="1" DT_VCENTER="1" ProgressEmpty="" ProgressFull="BasicSprites:WhiteFill" TooltipType="OnCursor" Name="HealthFill" BGColor="992b273d" TextColor="ffffffff" TooltipColor="" BarColor="ff06ff5e" Font="CRB_InterfaceTiny_BB" UsePercent="0" Sprite="BasicSprites:WhiteFill" Picture="1"/>
Expand Down