diff --git a/scripts/zm/_zm_reimagined.gsc b/scripts/zm/_zm_reimagined.gsc index 99c818ed..a6fbf3cd 100644 --- a/scripts/zm/_zm_reimagined.gsc +++ b/scripts/zm/_zm_reimagined.gsc @@ -496,15 +496,6 @@ health_bar_hud() x = 5; y = -104; - if (level.script == "zm_buried") - { - y -= 25; - } - else if (level.script == "zm_tomb") - { - y -= 60; - } - hud = self createbar((1, 1, 1), level.primaryprogressbarwidth - 10, level.primaryprogressbarheight); hud.alignx = "left"; hud.bar.alignx = "left"; @@ -587,15 +578,6 @@ shield_bar_hud() x = 5; y = -104; - if (level.script == "zm_buried") - { - y -= 25; - } - else if (level.script == "zm_tomb") - { - y -= 60; - } - hud = self createbar((0.5, 0.5, 0.5), level.primaryprogressbarwidth - 10, int(level.primaryprogressbarheight / 2)); hud.alignx = "left"; hud.bar.alignx = "left"; @@ -981,15 +963,6 @@ zone_hud() x = 5; y = -119; - if (level.script == "zm_buried") - { - y -= 25; - } - else if (level.script == "zm_tomb") - { - y -= 60; - } - hud = newClientHudElem(self); hud.alignx = "left"; hud.aligny = "middle"; diff --git a/ui_mp/t6/zombie/hudcraftablestombzombie.lua b/ui_mp/t6/zombie/hudcraftablestombzombie.lua new file mode 100644 index 00000000..040666a8 --- /dev/null +++ b/ui_mp/t6/zombie/hudcraftablestombzombie.lua @@ -0,0 +1,148 @@ +require("T6.Zombie.CraftableItemTombDisplay") +require("T6.Zombie.QuestItemTombDisplay") +require("T6.Zombie.PersistentItemTombDisplay") +require("T6.Zombie.CaptureZoneWheelTombDisplay") +CoD.CraftablesTomb = {} +CoD.CraftablesTomb.ContainerHeight = CoD.QuestItemTombDisplay.IconSize + CoD.textSize[CoD.QuestItemTombDisplay.FontName] + 10 +CoD.CraftablesTomb.ONSCREEN_DURATION = 3000 +CoD.CraftablesTomb.WHEEL_ONSCREEN_DURATION = 5000 +CoD.CraftablesTomb.FADE_IN_DURATION = 500 +CoD.CraftablesTomb.FADE_OUT_DURATION = 500 +CoD.CraftablesTomb.NEED_ALL_ZONES = 0 +CoD.CraftablesTomb.ALL_ZONES_CAPTURED = 1 +CoD.CraftablesTomb.ZONE_CAPTURED = 1 +CoD.CraftablesTomb.ZONE_LOST = 2 +CoD.CraftablesTomb.TotalZoneCount = 6 +CoD.CraftablesTomb.ZoneWheelBlueColor = CoD.greenBlue +CoD.CraftablesTomb.ZoneWheelRedColor = CoD.red +CoD.CraftablesTomb.TabletTopStart = CoD.RoundStatus.ChalkSize + 94 +CoD.CraftablesTomb.OneInchIconWidth = 50 +CoD.CraftablesTomb.OneInchIconHeight = CoD.CraftablesTomb.OneInchIconWidth +CoD.CraftablesTomb.NEED_TABLET = 0 +CoD.CraftablesTomb.HAVE_TABLET_CLEAN = 1 +CoD.CraftablesTomb.NEED_TABLET_DIRTY = 2 +LUI.createMenu.CraftablesTombArea = function (f1_arg0) + local f1_local0 = CoD.Menu.NewSafeAreaFromState("CraftablesTombArea", f1_arg0) + f1_local0:setOwner(f1_arg0) + f1_local0.topLeftScaleContainer = CoD.SplitscreenScaler.new(nil, CoD.Zombie.SplitscreenMultiplier) + f1_local0.topLeftScaleContainer:setLeftRight(true, false, 0, 0) + f1_local0.topLeftScaleContainer:setTopBottom(true, false, 0, 0) + f1_local0:addElement(f1_local0.topLeftScaleContainer) + local f1_local1 = CoD.QuestItemTombDisplay.IconSize + local f1_local2 = CoD.QuestItemTombDisplay.ContainerSize / 4 + local f1_local3 = false + local f1_local4 = LUI.UIHorizontalList.new() + f1_local4:setLeftRight(true, true, 0, 0) + f1_local4:setTopBottom(true, false, 0, CoD.CraftablesTomb.ContainerHeight) + local f1_local5 = CoD.PersistentItemTombDisplay.new(f1_local4) + f1_local0.topLeftScaleContainer:addElement(f1_local5) + CoD.PersistentItemTombDisplay.AddPersistentStatusDisplay(f1_local5, f1_local2, f1_local3) + local f1_local6 = 90 + local f1_local7 = LUI.UIHorizontalList.new() + f1_local7:setLeftRight(true, true, 0, 0) + f1_local7:setTopBottom(true, false, f1_local6, f1_local6 + CoD.CraftablesTomb.ContainerHeight) + local f1_local8 = CoD.QuestItemTombDisplay.new(f1_local7) + f1_local0.topLeftScaleContainer:addElement(f1_local8) + if not CoD.Zombie.LocalSplitscreenMultiplePlayers then + CoD.QuestItemTombDisplay.AddQuestStatusDisplay(f1_local8, f1_local2, f1_local3) + f1_local8.shouldFadeOutQuestStatus = true + f1_local8.highlightRecentItem = true + end + local f1_local9 = f1_local6 + 100 + local f1_local10 = LUI.UIVerticalList.new() + f1_local10:setLeftRight(true, true, 0, 0) + f1_local10:setTopBottom(true, false, f1_local9, f1_local9 + CoD.CraftablesTomb.ContainerHeight) + local f1_local11 = CoD.CraftableItemTombDisplay.new(f1_local10) + f1_local0.topLeftScaleContainer:addElement(f1_local11) + if not CoD.Zombie.LocalSplitscreenMultiplePlayers then + CoD.CraftableItemTombDisplay.AddDisplayContainer(f1_local11, CoD.CraftableItemTombDisplay.ContainerSize / 4, f1_local3) + f1_local11.shouldFadeOutQuestStatus = true + f1_local11.highlightRecentItem = true + end + f1_local0.topRightScaleContainer = CoD.SplitscreenScaler.new(nil, CoD.Zombie.SplitscreenMultiplier) + f1_local0.topRightScaleContainer:setLeftRight(false, true, 0, 0) + f1_local0.topRightScaleContainer:setTopBottom(true, false, 0, 0) + f1_local0:addElement(f1_local0.topRightScaleContainer) + local f1_local12 = 10 + local f1_local13 = 10 + local f1_local14 = 120 + local Widget = LUI.UIElement.new() + Widget:setLeftRight(false, true, -f1_local14 - f1_local12, -f1_local12) + Widget:setTopBottom(true, false, f1_local13, f1_local14 + f1_local13) + Widget:setAlpha(0) + f1_local0.topRightScaleContainer:addElement(Widget) + f1_local0.captureZoneWheelContainer = Widget + local f1_local16 = CoD.CaptureZoneWheelTombDisplay.new(f1_local0.captureZoneWheelContainer) + if not CoD.Zombie.LocalSplitscreenMultiplePlayers then + CoD.CaptureZoneWheelTombDisplay.AddCaptureZoneWheel(f1_local16, f1_local14, f1_local3) + f1_local16.shouldFadeOutQuestStatus = true + end + CoD.CraftablesTomb.OneInchPunchCleanMaterial = RegisterMaterial("zm_hud_icon_oneinch_clean") + CoD.CraftablesTomb.OneInchPunchDirtyMaterial = RegisterMaterial("zm_hud_icon_oneinch_dirty") + f1_local0.bottomLeftScaleContainer = CoD.SplitscreenScaler.new(nil, CoD.Zombie.SplitscreenMultiplier) + f1_local0.bottomLeftScaleContainer:setLeftRight(true, false, 0, 0) + f1_local0.bottomLeftScaleContainer:setTopBottom(false, true, 0, 0) + f1_local0:addElement(f1_local0.bottomLeftScaleContainer) + local f1_local17 = CoD.CraftablesTomb.TabletTopStart + local Widget = LUI.UIElement.new() + Widget:setLeftRight(true, false, 0, CoD.CraftablesTomb.OneInchIconWidth) + Widget:setTopBottom(false, true, -CoD.CraftablesTomb.OneInchIconHeight - f1_local17, -f1_local17) + Widget:setAlpha(0) + f1_local0.bottomLeftScaleContainer:addElement(Widget) + f1_local0.tabletContainer = Widget + + local tabletIcon = LUI.UIImage.new() + tabletIcon:setLeftRight(true, true, 0, 0) + tabletIcon:setTopBottom(true, true, 0, 0) + tabletIcon:setImage(CoD.CraftablesTomb.OneInchPunchDirtyMaterial) + Widget:addElement(tabletIcon) + f1_local0.tabletIcon = tabletIcon + + f1_local0:registerEventHandler("player_tablet_state", CoD.CraftablesTomb.UpdateTabletState) + f1_local0:registerEventHandler("hud_update_refresh", CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_HUD_VISIBLE, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_EMP_ACTIVE, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_DEMO_CAMERA_MODE_MOVIECAM, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_DEMO_ALL_GAME_HUD_HIDDEN, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_VEHICLE, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_GUIDED_MISSILE, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_REMOTE_KILLSTREAK_STATIC, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_AMMO_COUNTER_HIDE, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_FLASH_BANGED, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_UI_ACTIVE, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_SPECTATING_CLIENT, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_SCOREBOARD_OPEN, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_PLAYER_DEAD, CoD.CraftablesTomb.UpdateVisibility) + f1_local0:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_SCOPED, CoD.CraftablesTomb.UpdateVisibility) + f1_local0.visible = true + return f1_local0 +end + +CoD.CraftablesTomb.UpdateVisibility = function (f2_arg0, f2_arg1) + local f2_local0 = f2_arg1.controller + if UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_HUD_VISIBLE) == 1 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_EMP_ACTIVE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_DEMO_CAMERA_MODE_MOVIECAM) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_DEMO_ALL_GAME_HUD_HIDDEN) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IN_VEHICLE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IN_GUIDED_MISSILE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IN_REMOTE_KILLSTREAK_STATIC) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_AMMO_COUNTER_HIDE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IS_FLASH_BANGED) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_UI_ACTIVE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_SCOREBOARD_OPEN) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IS_SCOPED) == 0 and (not CoD.IsShoutcaster(f2_local0) or CoD.ExeProfileVarBool(f2_local0, "shoutcaster_scorestreaks") and Engine.IsSpectatingActiveClient(f2_local0)) and CoD.FSM_VISIBILITY(f2_local0) == 0 then + if f2_arg0.visible ~= true then + f2_arg0:setAlpha(1) + f2_arg0.m_inputDisabled = nil + f2_arg0.visible = true + end + elseif f2_arg0.visible == true then + f2_arg0:setAlpha(0) + f2_arg0.m_inputDisabled = true + f2_arg0.visible = nil + end + f2_arg0:dispatchEventToChildren(f2_arg1) +end + +CoD.CraftablesTomb.UpdateTabletState = function (f3_arg0, f3_arg1) + local f3_local0 = f3_arg1.newValue + if f3_local0 == CoD.CraftablesTomb.NEED_TABLET then + f3_arg0.tabletContainer:setAlpha(0) + elseif f3_local0 == CoD.CraftablesTomb.HAVE_TABLET_CLEAN then + f3_arg0.tabletIcon:setImage(CoD.CraftablesTomb.OneInchPunchCleanMaterial) + f3_arg0.tabletContainer:setAlpha(1) + elseif f3_local0 == CoD.CraftablesTomb.NEED_TABLET_DIRTY then + f3_arg0.tabletIcon:setImage(CoD.CraftablesTomb.OneInchPunchDirtyMaterial) + f3_arg0.tabletContainer:setAlpha(1) + end +end \ No newline at end of file diff --git a/ui_mp/t6/zombie/hudperkszombie.lua b/ui_mp/t6/zombie/hudperkszombie.lua new file mode 100644 index 00000000..c40fb454 --- /dev/null +++ b/ui_mp/t6/zombie/hudperkszombie.lua @@ -0,0 +1,309 @@ +CoD.Perks = {} +CoD.Perks.TopStart = -140 +CoD.Perks.IconSize = 36 +CoD.Perks.Spacing = 8 +CoD.Perks.STATE_NOTOWNED = 0 +CoD.Perks.STATE_OWNED = 1 +CoD.Perks.STATE_PAUSED = 2 +CoD.Perks.STATE_TBD = 3 +CoD.Perks.ClientFieldNames = {} +CoD.Perks.ClientFieldNames[1] = { + clientFieldName = "perk_additional_primary_weapon", + material = RegisterMaterial("specialty_additionalprimaryweapon_zombies") +} +CoD.Perks.ClientFieldNames[2] = { + clientFieldName = "perk_dead_shot", + material = RegisterMaterial("specialty_ads_zombies") +} +CoD.Perks.ClientFieldNames[3] = { + clientFieldName = "perk_dive_to_nuke", + material = RegisterMaterial("specialty_divetonuke_zombies") +} +CoD.Perks.ClientFieldNames[4] = { + clientFieldName = "perk_double_tap", + material = RegisterMaterial("specialty_doubletap_zombies") +} +CoD.Perks.ClientFieldNames[5] = { + clientFieldName = "perk_juggernaut", + material = RegisterMaterial("specialty_juggernaut_zombies") +} +CoD.Perks.ClientFieldNames[6] = { + clientFieldName = "perk_marathon", + material = RegisterMaterial("specialty_marathon_zombies") +} +CoD.Perks.ClientFieldNames[7] = { + clientFieldName = "perk_quick_revive", + material = RegisterMaterial("specialty_quickrevive_zombies") +} +CoD.Perks.ClientFieldNames[8] = { + clientFieldName = "perk_sleight_of_hand", + material = RegisterMaterial("specialty_fastreload_zombies") +} +CoD.Perks.ClientFieldNames[9] = { + clientFieldName = "perk_tombstone", + material = RegisterMaterial("specialty_tombstone_zombies") +} +CoD.Perks.ClientFieldNames[10] = { + clientFieldName = "perk_chugabud", + material = RegisterMaterial("specialty_chugabud_zombies") +} +CoD.Perks.ClientFieldNames[11] = { + clientFieldName = "perk_electric_cherry", + material = RegisterMaterial("specialty_electric_cherry_zombie") +} +CoD.Perks.ClientFieldNames[12] = { + clientFieldName = "perk_vulture", + material = RegisterMaterial("specialty_vulture_zombies"), + glowMaterial = RegisterMaterial("zm_hud_stink_perk_glow") +} +CoD.Perks.PulseDuration = 200 +CoD.Perks.PulseScale = 1.3 +CoD.Perks.PausedAlpha = 0.3 +LUI.createMenu.PerksArea = function (LocalClientIndex) + local PerksAreaWidget = CoD.Menu.NewSafeAreaFromState("PerksArea", LocalClientIndex) + PerksAreaWidget:setOwner(LocalClientIndex) + PerksAreaWidget.scaleContainer = CoD.SplitscreenScaler.new(nil, CoD.Zombie.SplitscreenMultiplier) + PerksAreaWidget.scaleContainer:setLeftRight(true, false, 10, 0) + PerksAreaWidget.scaleContainer:setTopBottom(false, true, 0, 0) + PerksAreaWidget:addElement(PerksAreaWidget.scaleContainer) + CoD.Perks.MeterBlackMaterial = RegisterMaterial("zm_hud_stink_ani_black") + CoD.Perks.MeterGreenMaterial = RegisterMaterial("zm_hud_stink_ani_green") + local f1_local1, f1_local2 = nil, nil + PerksAreaWidget.perks = {} + for ClientFieldIndex = 1, #CoD.Perks.ClientFieldNames, 1 do + f1_local1 = (CoD.Perks.IconSize + CoD.Perks.Spacing) * (ClientFieldIndex - 1) + f1_local2 = f1_local1 + CoD.Perks.IconSize + local Widget = LUI.UIElement.new() + Widget:setLeftRight(true, false, f1_local1, f1_local2) + Widget:setTopBottom(false, true, CoD.Perks.TopStart, CoD.Perks.TopStart + CoD.Perks.IconSize) + Widget:setScale(1) + Widget.perkId = nil + + local perkIcon = LUI.UIImage.new() + perkIcon:setLeftRight(true, true, 0, 0) + perkIcon:setTopBottom(true, true, 0, 0) + perkIcon:setAlpha(0) + Widget:addElement(perkIcon) + Widget.perkIcon = perkIcon + + Widget:registerEventHandler("transition_complete_pulse", CoD.Perks.IconPulseFinish) + PerksAreaWidget.scaleContainer:addElement(Widget) + PerksAreaWidget.perks[ClientFieldIndex] = Widget + PerksAreaWidget:registerEventHandler(CoD.Perks.ClientFieldNames[ClientFieldIndex].clientFieldName, CoD.Perks.Update) + end + PerksAreaWidget:registerEventHandler("hud_update_refresh", CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_HUD_VISIBLE, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_PLAYER_IN_AFTERLIFE, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_EMP_ACTIVE, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_DEMO_CAMERA_MODE_MOVIECAM, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_DEMO_ALL_GAME_HUD_HIDDEN, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_VEHICLE, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_GUIDED_MISSILE, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IN_REMOTE_KILLSTREAK_STATIC, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_AMMO_COUNTER_HIDE, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_FLASH_BANGED, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_UI_ACTIVE, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_SPECTATING_CLIENT, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_SCOREBOARD_OPEN, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_PLAYER_DEAD, CoD.Perks.UpdateVisibility) + PerksAreaWidget:registerEventHandler("hud_update_bit_" .. CoD.BIT_IS_SCOPED, CoD.Perks.UpdateVisibility) + PerksAreaWidget.visible = true + return PerksAreaWidget +end + +CoD.Perks.UpdateVisibility = function (Menu, ClientInstance) + local f2_local0 = ClientInstance.controller + if UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_HUD_VISIBLE) == 1 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IS_PLAYER_IN_AFTERLIFE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_EMP_ACTIVE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_DEMO_CAMERA_MODE_MOVIECAM) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_DEMO_ALL_GAME_HUD_HIDDEN) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IN_VEHICLE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IN_GUIDED_MISSILE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IN_REMOTE_KILLSTREAK_STATIC) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_AMMO_COUNTER_HIDE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IS_FLASH_BANGED) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_UI_ACTIVE) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_SCOREBOARD_OPEN) == 0 and UIExpression.IsVisibilityBitSet(f2_local0, CoD.BIT_IS_SCOPED) == 0 and (not CoD.IsShoutcaster(f2_local0) or CoD.ExeProfileVarBool(f2_local0, "shoutcaster_scorestreaks") and Engine.IsSpectatingActiveClient(f2_local0)) and CoD.FSM_VISIBILITY(f2_local0) == 0 then + if Menu.visible ~= true then + Menu:setAlpha(1) + Menu.m_inputDisabled = nil + Menu.visible = true + end + elseif Menu.visible == true then + Menu:setAlpha(0) + Menu.m_inputDisabled = true + Menu.visible = nil + end + Menu:dispatchEventToChildren(ClientInstance) +end + +CoD.Perks.GetMaterial = function (Menu, ClientFieldName) + local Material = nil + for ClientFieldIndex = 1, #CoD.Perks.ClientFieldNames, 1 do + if CoD.Perks.ClientFieldNames[ClientFieldIndex].clientFieldName == ClientFieldName then + Material = CoD.Perks.ClientFieldNames[ClientFieldIndex].material + break + end + end + return Material +end + +CoD.Perks.GetGlowMaterial = function (Menu, ClientFieldName) + local Material = nil + for ClientFieldIndex = 1, #CoD.Perks.ClientFieldNames, 1 do + if CoD.Perks.ClientFieldNames[ClientFieldIndex].clientFieldName == ClientFieldName then + if CoD.Perks.ClientFieldNames[ClientFieldIndex].glowMaterial then + Material = CoD.Perks.ClientFieldNames[ClientFieldIndex].glowMaterial + break + end + end + end + return Material +end + +CoD.Perks.RemovePerkIcon = function (Menu, OwnedPerkIndex) + local PerkWidget, NextPerkWidget = nil, nil + for PerkIndex = OwnedPerkIndex, #CoD.Perks.ClientFieldNames, 1 do + PerkWidget = Menu.perks[PerkIndex] + if not PerkWidget.perkId then + break + elseif PerkIndex ~= #CoD.Perks.ClientFieldNames then + NextPerkWidget = Menu.perks[PerkIndex + 1] + end + if not NextPerkWidget then + PerkWidget.perkIcon:setAlpha(0) + if PerkWidget.perkGlowIcon then + + else + PerkWidget.perkId = nil + break + end + PerkWidget.perkGlowIcon:setAlpha(0) + elseif not NextPerkWidget.perkId then + PerkWidget.perkIcon:setAlpha(0) + if PerkWidget.perkGlowIcon then + PerkWidget.perkGlowIcon:close() + PerkWidget.perkGlowIcon = nil + end + if PerkWidget.meterContainer then + + else + PerkWidget.perkId = nil + break + end + PerkWidget.meterContainer:close() + PerkWidget.meterContainer = nil + else + PerkWidget.perkIcon:setImage(CoD.Perks.GetMaterial(Menu, NextPerkWidget.perkId)) + local f5_local5 = CoD.Perks.GetGlowMaterial(Menu, NextPerkWidget.perkId) + if f5_local5 and PerkWidget.perkGlowIcon then + PerkWidget.perkGlowIcon:setImage(f5_local5) + end + end + PerkWidget.perkId = NextPerkWidget.perkId + end +end + +CoD.Perks.Update = function (Menu, ClientInstance) + local PerkWidget = nil + for OwnedPerkIndex = 1, #CoD.Perks.ClientFieldNames, 1 do + PerkWidget = Menu.perks[OwnedPerkIndex] + if ClientInstance.newValue == CoD.Perks.STATE_OWNED then + if not PerkWidget.perkId then + PerkWidget.perkId = ClientInstance.name + PerkWidget.perkIcon:setImage(CoD.Perks.GetMaterial(Menu, ClientInstance.name)) + PerkWidget.perkIcon:setAlpha(1) + if PerkWidget.perkId == "perk_vulture" then + + else + local f6_local4 = CoD.Perks.GetGlowMaterial(Menu, ClientInstance.name) + if f6_local4 and PerkWidget.perkGlowIcon then + PerkWidget.perkGlowIcon:setImage(f6_local4) + end + end + CoD.Perks.AddGlowIcon(Menu, PerkWidget) + CoD.Perks.AddVultureMeter(Menu, PerkWidget) + + break + elseif PerkWidget.perkId == ClientInstance.name then + PerkWidget:beginAnimation("pulse", CoD.Perks.PulseDuration) + PerkWidget:setScale(CoD.Perks.PulseScale) + PerkWidget.perkIcon:beginAnimation("pulse", CoD.Perks.PulseDuration) + PerkWidget.perkIcon:setAlpha(1) + if PerkWidget.perkGlowIcon then + PerkWidget.perkGlowIcon:beginAnimation("pulse", CoD.Perks.PulseDuration) + end + + break + end + end + if ClientInstance.newValue == CoD.Perks.STATE_NOTOWNED then + if PerkWidget.perkId == ClientInstance.name then + CoD.Perks.RemovePerkIcon(Menu, OwnedPerkIndex) + break + end + end + if ClientInstance.newValue == CoD.Perks.STATE_PAUSED then + if PerkWidget.perkId == ClientInstance.name then + PerkWidget:beginAnimation("pulse", CoD.Perks.PulseDuration) + PerkWidget:setScale(CoD.Perks.PulseScale) + PerkWidget.perkIcon:beginAnimation("pulse", CoD.Perks.PulseDuration) + PerkWidget.perkIcon:setAlpha(CoD.Perks.PausedAlpha) + if PerkWidget.perkGlowIcon then + PerkWidget.perkGlowIcon:beginAnimation("pulse", CoD.Perks.PulseDuration) + PerkWidget.perkGlowIcon:setAlpha(0) + end + + break + end + end + if ClientInstance.newValue == CoD.Perks.STATE_TBD then + + end + end +end + +CoD.Perks.IconPulseFinish = function (Menu, ClientInstance) + if ClientInstance.interrupted ~= true then + Menu:beginAnimation("pulse_done", CoD.Perks.PulseDuration) + Menu:setScale(1) + end +end + +CoD.Perks.AddGlowIcon = function (Menu, PerkWidget) + if not PerkWidget.perkGlowIcon then + local GlowIcon = LUI.UIImage.new() + GlowIcon:setLeftRight(true, true, -CoD.Perks.IconSize / 2, CoD.Perks.IconSize / 2) + GlowIcon:setTopBottom(true, true, -CoD.Perks.IconSize / 2, CoD.Perks.IconSize / 2) + GlowIcon:setAlpha(0) + PerkWidget:addElement(GlowIcon) + PerkWidget.perkGlowIcon = GlowIcon + end +end + +CoD.Perks.AddVultureMeter = function (Menu, PerkWidget) + if not PerkWidget.meterContainer then + local f9_local0 = CoD.Perks.TopStart + CoD.Perks.IconSize * 2 + local f9_local1 = -CoD.Perks.IconSize + + local meterContainer = LUI.UIElement.new() + meterContainer:setLeftRight(true, false, 0, CoD.Perks.IconSize) + meterContainer:setTopBottom(false, true, f9_local0 + 5, f9_local1 + 5) + meterContainer:setAlpha(0) + meterContainer:setPriority(-10) + PerkWidget:addElement(meterContainer) + PerkWidget.meterContainer = meterContainer + + local f9_local3 = LUI.UIImage.new() + f9_local3:setLeftRight(true, true, -CoD.Perks.IconSize / 2, CoD.Perks.IconSize / 2) + f9_local3:setTopBottom(true, true, 0, 0) + f9_local3:setImage(CoD.Perks.MeterBlackMaterial) + meterContainer:addElement(f9_local3) + local f9_local4 = LUI.UIImage.new() + f9_local4:setLeftRight(true, true, -CoD.Perks.IconSize / 2, CoD.Perks.IconSize / 2) + f9_local4:setTopBottom(true, true, 0, 0) + f9_local4:setImage(CoD.Perks.MeterGreenMaterial) + meterContainer:addElement(f9_local4) + PerkWidget:registerEventHandler("vulture_perk_disease_meter", CoD.Perks.UpdateVultureDiseaseMeter) + end +end + +CoD.Perks.UpdateVultureDiseaseMeter = function (Menu, ClientInstance) + local f10_local0 = ClientInstance.newValue + if Menu.meterContainer then + Menu.meterContainer:setAlpha(f10_local0) + end + if Menu.perkGlowIcon then + Menu.perkGlowIcon:setAlpha(f10_local0) + end +end \ No newline at end of file