Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.80 KB | None | 0 0
  1. -- The Giant Hud Base, Rebuilt from the ground up by the D3V Team
  2.  
  3. require("ui.uieditor.widgets.HUD.ZM_Perks.ZMPerksContainerFactory")
  4. require("ui.uieditor.widgets.HUD.ZM_RoundWidget.ZmRndContainer")
  5. require("ui.uieditor.widgets.HUD.ZM_AmmoWidgetFactory.ZmAmmoContainerFactory")
  6. require("ui.uieditor.widgets.HUD.ZM_Score.ZMScr")
  7. require("ui.uieditor.widgets.DynamicContainerWidget")
  8. require("ui.uieditor.widgets.Notifications.Notification")
  9. require("ui.uieditor.widgets.HUD.ZM_NotifFactory.ZmNotifBGB_ContainerFactory")
  10. require("ui.uieditor.widgets.HUD.ZM_CursorHint.ZMCursorHint")
  11. require("ui.uieditor.widgets.HUD.CenterConsole.CenterConsole")
  12. require("ui.uieditor.widgets.HUD.DeadSpectate.DeadSpectate")
  13. require("ui.uieditor.widgets.MPHudWidgets.ScorePopup.MPScr")
  14. require("ui.uieditor.widgets.HUD.ZM_PrematchCountdown.ZM_PrematchCountdown")
  15. require("ui.uieditor.widgets.Scoreboard.CP.ScoreboardWidgetCP")
  16. require("ui.uieditor.widgets.HUD.ZM_TimeBar.ZM_BeastmodeTimeBarWidget")
  17. require("ui.uieditor.widgets.ZMInventory.RocketShieldBluePrint.RocketShieldBlueprintWidget")
  18. require("ui.uieditor.widgets.Chat.inGame.IngameChatClientContainer")
  19. require("ui.uieditor.widgets.BubbleGumBuffs.BubbleGumPackInGame")
  20. -- require("ui.help.t7_ghost_widgets")
  21. require("menu")
  22. -- require("ui.help.notifParts")
  23.  
  24. CoD.Zombie.CommonHudRequire()
  25.  
  26. local function PreLoadCallback(HudRef, InstanceRef)
  27. CoD.Zombie.CommonPreLoadHud(HudRef, InstanceRef)
  28. end
  29.  
  30. local function PostLoadCallback(HudRef, InstanceRef)
  31. CoD.Zombie.CommonPostLoadHud(HudRef, InstanceRef)
  32. end
  33.  
  34. CoD.GauntledHealth = InheritFrom(LUI.UIElement)
  35.  
  36. function CoD.GauntledHealth.new(HudRef, InstanceRef)
  37. local Elem = LUI.UIElement.new()
  38.  
  39. Elem:setClass(CoD.GauntledHealth)
  40. Elem.id = "GauntledHealth"
  41. Elem.soundSet = "default"
  42.  
  43. local SkullLifeBase = LUI.UIImage.new(Elem, InstanceRef)
  44. SkullLifeBase:setLeftRight(false, false, -88, 88)
  45. SkullLifeBase:setTopBottom(true, false, 230, 252)
  46. SkullLifeBase:setImage(RegisterImage("gauntlet_skull_life_base"))
  47. SkullLifeBase:setAlpha(0)
  48. Elem:addElement(SkullLifeBase)
  49. Elem.SkullLifeBase = SkullLifeBase
  50.  
  51. local SkullLifeSlot1 = LUI.UIImage.new(Elem, InstanceRef)
  52. SkullLifeSlot1:setLeftRight(false, false, -73, -21)
  53. SkullLifeSlot1:setTopBottom(true, false, 196, 246)
  54. SkullLifeSlot1:setImage(RegisterImage("gauntlet_skull_life_slot"))
  55. SkullLifeSlot1:setAlpha(0)
  56. Elem:addElement(SkullLifeSlot1)
  57. Elem.SkullLifeSlot1 = SkullLifeSlot1
  58.  
  59. local SkullLifeSlot2 = LUI.UIImage.new(Elem, InstanceRef)
  60. SkullLifeSlot2:setLeftRight(false, false, -26, 26)
  61. SkullLifeSlot2:setTopBottom(true, false, 196, 246)
  62. SkullLifeSlot2:setImage(RegisterImage("gauntlet_skull_life_slot"))
  63. SkullLifeSlot2:setAlpha(0)
  64. Elem:addElement(SkullLifeSlot2)
  65. Elem.SkullLifeSlot2 = SkullLifeSlot2
  66.  
  67. local SkullLifeSlot3 = LUI.UIImage.new(Elem, InstanceRef)
  68. SkullLifeSlot3:setLeftRight(false, false, 21, 73)
  69. SkullLifeSlot3:setTopBottom(true, false, 196, 246)
  70. SkullLifeSlot3:setImage(RegisterImage("gauntlet_skull_life_slot"))
  71. SkullLifeSlot3:setAlpha(0)
  72. Elem:addElement(SkullLifeSlot3)
  73. Elem.SkullLifeSlot3 = SkullLifeSlot3
  74.  
  75. Elem.Life = {}
  76.  
  77. local SkullLife1 = LUI.UIImage.new(Elem, InstanceRef)
  78. SkullLife1:setLeftRight(false, false, -73, -21)
  79. SkullLife1:setTopBottom(true, false, 196, 246)
  80. SkullLife1:setImage(RegisterImage("gauntlet_skull_life"))
  81. SkullLife1:setAlpha(0)
  82. Elem:addElement(SkullLife1)
  83. Elem.Life[1] = SkullLife1
  84.  
  85. local SkullLife2 = LUI.UIImage.new(Elem, InstanceRef)
  86. SkullLife2:setLeftRight(false, false, -26, 26)
  87. SkullLife2:setTopBottom(true, false, 196, 246)
  88. SkullLife2:setImage(RegisterImage("gauntlet_skull_life"))
  89. SkullLife2:setAlpha(0)
  90. Elem:addElement(SkullLife2)
  91. Elem.Life[2] = SkullLife2
  92.  
  93. local SkullLife3 = LUI.UIImage.new(Elem, InstanceRef)
  94. SkullLife3:setLeftRight(false, false, 21, 73)
  95. SkullLife3:setTopBottom(true, false, 196, 246)
  96. SkullLife3:setImage(RegisterImage("gauntlet_skull_life"))
  97. SkullLife3:setAlpha(0)
  98. Elem:addElement(SkullLife3)
  99. Elem.Life[3] = SkullLife3
  100. local val = 0
  101.  
  102. local function SetGauntletDescs(ModelRef)
  103. -- local val = Engine.GetModelValue(ModelRef)
  104. local function ResetFail( a )
  105. -- RoundStateEnd:setAlpha(1)
  106. SkullLifeBase:setAlpha(0)
  107. SkullLifeSlot1:setAlpha(0)
  108. SkullLifeSlot2:setAlpha(0)
  109. SkullLifeSlot3:setAlpha(0)
  110. RoundStateEnd:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  111. if Engine.GetModelValue(ModelRef) == 1 then
  112. SkullLife1:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  113.  
  114. SkullLife1:setAlpha(0)
  115. SkullLife2:setAlpha(0)
  116. SkullLife3:setAlpha(0)
  117. elseif Engine.GetModelValue(ModelRef) == 2 then
  118. SkullLife1:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  119. SkullLife2:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  120.  
  121. SkullLife1:setAlpha(0)
  122. SkullLife2:setAlpha(0)
  123. SkullLife3:setAlpha(0)
  124. elseif Engine.GetModelValue(ModelRef) == 3 then
  125. SkullLife1:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  126. SkullLife2:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  127. SkullLife3:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  128.  
  129. SkullLife1:setAlpha(0)
  130. SkullLife2:setAlpha(0)
  131. SkullLife3:setAlpha(0)
  132. else
  133. SkullLife1:setAlpha(0)
  134. SkullLife2:setAlpha(0)
  135. SkullLife3:setAlpha(0)
  136. end
  137.  
  138. RoundStateEnd:setAlpha(0)
  139. end
  140. if Engine.GetModelValue(ModelRef) ~= 0 then
  141. -- RoundStateEnd:setText(Engine.GetModelValue(ModelRef))
  142. RoundStateEnd:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  143. SkullLifeSlot1:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  144. SkullLifeSlot2:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  145. SkullLifeSlot3:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  146. SkullLifeBase:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  147. RoundStateEnd:setAlpha(1)
  148. SkullLifeBase:setAlpha(1)
  149. SkullLifeSlot1:setAlpha(1)
  150. SkullLifeSlot2:setAlpha(1)
  151. SkullLifeSlot3:setAlpha(1)
  152. for i = 1,Engine.GetModelValue(ModelRef),1 do
  153. Elem.Life[i]:setAlpha(1)
  154. end
  155.  
  156. -- if Engine.GetModelValue(ModelRef) < 3 then
  157. Elem:addElement(LUI.UITimer.newElementTimer(5000.000000, true, ResetFail))
  158. -- end
  159.  
  160. end
  161. end
  162.  
  163. local function setForbiddenAim(ModelRef)
  164. ShootForbidden:setAlpha(Engine.GetModelValue(ModelRef))
  165. end
  166.  
  167. Elem:subscribeToModel( Engine.GetModel(Engine.GetModelForController(InstanceRef),"GauntletFail"), SetGauntletDescs)
  168.  
  169. return Elem
  170. end
  171.  
  172. CoD.GauntletWid = InheritFrom(LUI.UIElement)
  173.  
  174. function CoD.GauntletWid.new(HudRef,InstanceRef)
  175. local Elem = LUI.UIElement.new()
  176.  
  177. Elem:setClass(CoD.GauntletWid)
  178. Elem.id = "GauntletWid"
  179. Elem.soundSet = "default"
  180.  
  181. local GauntletTitleLeft = LUI.UIText.new(Elem,InstanceRef)
  182. GauntletTitleLeft:setLeftRight(true, true, 27, 0)
  183. GauntletTitleLeft:setTopBottom(true, false, 113, 133)
  184. GauntletTitleLeft:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_LEFT)
  185. GauntletTitleLeft:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_BOTTOM)
  186.  
  187. GauntletTitleLeft:setTTF("fonts/black_ops_4.ttf")
  188. GauntletTitleLeft:setText("SHIELDED\n GOOD LUCK ! ")
  189. GauntletTitleLeft:setRGB( 0.9215686, 0.6392156, 0.0392156)
  190.  
  191. Elem:addElement(GauntletTitleLeft)
  192.  
  193. local function SetGauntletTitles(ModelRef)
  194. local titler = Engine.GetModelValue(ModelRef)
  195. GauntletTitleLeft:setText( Engine.Localize( titler ) )
  196. end
  197.  
  198. GauntletTitleLeft:subscribeToModel( Engine.GetModel(Engine.GetModelForController(InstanceRef),"GauntletTitle"), SetGauntletTitles)
  199.  
  200. local GauntletTitleDescLeftBar = LUI.UIImage.new(Elem, InstanceRef)
  201. GauntletTitleDescLeftBar:setTopBottom(true, false, 136, 138)
  202. GauntletTitleDescLeftBar:setLeftRight(true, false, 27, 174)
  203. GauntletTitleDescLeftBar:setRGB(0.92156863, 0.63921569, 0.03921569)
  204. Elem:addElement(GauntletTitleDescLeftBar)
  205.  
  206. local returnval1 = LUI.UIText.new()
  207. returnval1:setLeftRight(true, false, 27.000000, 174.000000)
  208. returnval1:setTopBottom(true, false, 142.000000, 159.5000000)
  209. returnval1:setRGB(1, 1, 1)
  210. returnval1:setText("Possess the Shield at the End of the Round")
  211. returnval1:setTTF("fonts/default.ttf")
  212. returnval1:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_LEFT)
  213. returnval1:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_TOP)
  214. local function __FUNC_86C_(arg0, arg1)
  215. SetStateFromText(Elem, arg0, "DefaultState", "Hidden")
  216. end
  217.  
  218. LUI.OverrideFunction_CallOriginalFirst(returnval1, "setText", __FUNC_86C_)
  219. Elem:addElement(returnval1)
  220. Elem.description = returnval1
  221.  
  222. local function SetGauntletDescs(ModelRef)
  223. local descs = Engine.GetModelValue(ModelRef)
  224. returnval1:setText( Engine.Localize( descs ) )
  225. end
  226.  
  227. returnval1:subscribeToModel( Engine.GetModel(Engine.GetModelForController(InstanceRef),"GauntletDesc"), SetGauntletDescs)
  228.  
  229. local RoundStateEnd = LUI.UIText.new()
  230. RoundStateEnd:setLeftRight(true, true, 0, 0)
  231. RoundStateEnd:setTopBottom(true, false, 90, 145)
  232. RoundStateEnd:setAlignment(Enum.LUIAlignment.LUI_ALIGNMENT_CENTER)
  233. RoundStateEnd:setTTF("fonts/black_ops_4.ttf")
  234. RoundStateEnd:setRGB(0.77647058823,0.0235294117, 0.0705882352)
  235. RoundStateEnd:setText("Manche Perdue")
  236. Elem:addElement(RoundStateEnd)
  237.  
  238. local ShootForbidden = LUI.UIImage.new(Elem, InstanceRef)
  239. ShootForbidden:setLeftRight(false, false, -44, 44)
  240. ShootForbidden:setTopBottom(false, false, -44, 44)
  241. ShootForbidden:setImage(RegisterImage("gauntlet_forbidden_aim"))
  242. ShootForbidden:setAlpha(0)
  243. Elem:addElement(ShootForbidden)
  244.  
  245. local HealthIndic = CoD.GauntledHealth.new(Elem, InstanceRef)
  246. HealthIndic:setLeftRight(false, true, -186, -10)
  247. HealthIndic:setTopBottom(true, false, 60, 82)
  248. HealthIndic:setAlpha(0)
  249.  
  250. Elem:addElement(HealthIndic)
  251.  
  252. local EndGame = CoD.GauntledHealth.new(Elem, InstanceRef)
  253. EndGame:setLeftRight(false, true, -186, -10)
  254. EndGame:setTopBottom(true, false, 60, 82)
  255. EndGame:setAlpha(0)
  256.  
  257. Elem:addElement(EndGame)
  258.  
  259. local function SetGauntletDescs(ModelRef)
  260. -- local val = Engine.GetModelValue(ModelRef)
  261. --[[local function ResetFail( a )
  262. HealthIndic:setAlpha(1)
  263. -- RoundStateEnd:setAlpha(1)
  264. EndGame.SkullLifeBase:setAlpha(0)
  265. EndGame.SkullLifeSlot1:setAlpha(0)
  266. EndGame.SkullLifeSlot2:setAlpha(0)
  267. EndGame.SkullLifeSlot3:setAlpha(0)
  268. RoundStateEnd:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  269. EndGame.SkullLife1:setAlpha(0)
  270. EndGame.SkullLife2:setAlpha(0)
  271. EndGame.SkullLife3:setAlpha(0)
  272.  
  273. RoundStateEnd:setAlpha(0)
  274. end
  275. if Engine.GetModelValue(ModelRef) ~= 0 then
  276. -- RoundStateEnd:setText(Engine.GetModelValue(ModelRef))
  277. HealthIndic:setAlpha(0)
  278. RoundStateEnd:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  279. EndGame.SkullLifeSlot1:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  280. EndGame.SkullLifeSlot2:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  281. EndGame.SkullLifeSlot3:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  282. EndGame.SkullLifeBase:beginAnimation("keyframe", 350, false, false, CoD.TweenType.Linear)
  283. RoundStateEnd:setAlpha(1)
  284. EndGame.SkullLifeBase:setAlpha(1)
  285. EndGame.SkullLifeSlot1:setAlpha(1)
  286. EndGame.SkullLifeSlot2:setAlpha(1)
  287. EndGame.SkullLifeSlot3:setAlpha(1)
  288. for i = 1,Engine.GetModelValue(ModelRef),1 do
  289. EndGame.Life[i]:setAlpha(1)
  290. end
  291.  
  292. -- if Engine.GetModelValue(ModelRef) < 3 then
  293. Elem:addElement(LUI.UITimer.newElementTimer(5000.000000, true, ResetFail))
  294. -- end
  295.  
  296. end]]
  297. local function ResetFail( a )
  298. EndGame:setAlpha(0)
  299. HealthIndic:setAlpha(1)
  300. end
  301. EndGame:setAlpha(1)
  302. Elem:addElement(LUI.UITimer.newElementTimer(5000.000000, true, ResetFail))
  303. end
  304.  
  305. local function setForbiddenAim(ModelRef)
  306. ShootForbidden:setAlpha(Engine.GetModelValue(ModelRef))
  307. end
  308.  
  309. Elem:subscribeToModel( Engine.GetModel(Engine.GetModelForController(InstanceRef),"GauntletFail"), SetGauntletDescs)
  310. Elem:subscribeToModel( Engine.GetModel(Engine.GetModelForController(InstanceRef), "GauntletShootForbbiden"), setForbiddenAim)
  311.  
  312. return Elem
  313. end
  314.  
  315. CoD.ReList = InheritFrom(LUI.UIElement)
  316. function CoD.ReList.new(HudRef, InstanceRef,widgetType,StartAtLeft,StartAtTop,Rows,Collumns,spacement,width, height)
  317. local Elem = LUI.UIElement.new()
  318. Elem:setClass(CoD.ReList)
  319. Elem.id = "ReList"
  320. Elem.soundSet = "default"
  321.  
  322. Elem.List = {}
  323. Elem.FullList = {}
  324. Elem.ListMaxX = Rows
  325. Elem.ListMaxY = Collumns
  326.  
  327. local CurrentElem = 0
  328.  
  329. for x=1,Rows,1 do
  330. Elem.List[x] = {}
  331. for y=1,Collumns,1 do
  332. CurrentElem = CurrentElem+1
  333. --Creating the Elem.List[row][collumn] Array
  334. Elem.List[x][y] = {}
  335.  
  336. --Creating an Parent for the widget for Elem.List[row][collumn]
  337. Elem.List[x][y] = LUI.UIElement.new(Elem, Instance)
  338. Elem.List[x][y].Number = CurrentElem
  339. Elem.List[x][y].GetXY = {X = x, Y = y}
  340. Elem.List[x][y].Base = Elem
  341. --Creating the Children with the specified widget
  342. Elem.List[x][y].Child = widgetType["new"](Elem.List[x][y],Instance)
  343. Elem.List[x][y]:addElement(Elem.List[x][y].Child)
  344.  
  345. --Check if the 1st start at left or right, and other will be created in opposite direction
  346.  
  347. local function GetSideVal(val , side)
  348. if val == true then
  349. if side == "left" or side == "top" then
  350. return true
  351. else
  352. return false
  353. end
  354. else
  355. if side == "left" or side == "top" then
  356. return false
  357. else
  358. return true
  359. end
  360. end
  361.  
  362. -- return value
  363. end
  364.  
  365. local LeftAnchor = GetSideVal(StartAtLeft, "left")
  366. local RightAnchor = GetSideVal(StartAtLeft, "right")
  367. local TopAnchor = GetSideVal(StartAtTop, "top")
  368. local BotAnchor = GetSideVal(StartAtTop, "bottom")
  369.  
  370.  
  371. if StartAtLeft == true then
  372. Elem.List[x][y]:setLeftRight(LeftAnchor, RightAnchor, spacement*(y-1)+(width*(y-1)), spacement*(y-1)+(width*(y-1)) + width)
  373. else
  374. Elem.List[x][y]:setLeftRight(LeftAnchor, RightAnchor, spacement*(1-y)+(width*(1-y)), spacement*(1-y)+(width*(1-y)) + width)
  375. end
  376.  
  377. if StartAtTop == true then
  378. Elem.List[x][y]:setTopBottom(TopAnchor, BotAnchor, spacement*(x-1)+(height*(x-1)), spacement*(x-1)+(height*(x-1)) + height)
  379. else
  380. Elem.List[x][y]:setTopBottom(TopAnchor, BotAnchor, spacement*(1-x)+(height*(1-x)), spacement*(1-x)+(height*(1-x)) + height)
  381. end
  382. Elem:addElement(Elem.List[x][y])
  383. Elem.FullList[CurrentElem] = Elem.List[x][y]
  384. end
  385. end
  386. return Elem
  387. end
  388.  
  389. function LUI.createMenu.T7Hud_zm_factory(InstanceRef)
  390. local HudRef = CoD.Menu.NewForUIEditor("T7Hud_zm_factory")
  391.  
  392. if PreLoadCallback then
  393. PreLoadCallback(HudRef, InstanceRef)
  394. end
  395.  
  396. HudRef.soundSet = "HUD"
  397. HudRef:setOwner(InstanceRef)
  398. HudRef:setLeftRight(true, true, 0, 0)
  399. HudRef:setTopBottom(true, true, 0, 0)
  400. HudRef:playSound("menu_open", InstanceRef)
  401.  
  402. HudRef.buttonModel = Engine.CreateModel(Engine.GetModelForController(InstanceRef), "T7Hud_zm_factory.buttonPrompts")
  403. HudRef.anyChildUsesUpdateState = true
  404.  
  405. --[[local Notif = CoD.GhostNotifs.new(HudRef,InstanceRef,"Origins Shield",{"zmInventory.piece_riotshield_door","zmInventory.piece_riotshield_clamp","zmInventory.piece_riotshield_dolly"})
  406. Notif:setLeftRight(true, false, 574, 963)
  407. Notif:setTopBottom(true, false, 3, 54)
  408. Notif:setScale(0.5)
  409.  
  410. HudRef:addElement(Notif)
  411.  
  412. local Powerups = CoD.PowerupsRemake.new(HudRef,InstanceRef,"vertical", 2,"left", "bottom")
  413. Powerups:setLeftRight(true, true, 70, 0)
  414. Powerups:setTopBottom(true, true, 0, -90)
  415. -- Powerups:setYRot( 35 )
  416. -- Powerups:setXRot( 30 )
  417. HudRef:addElement(Powerups)]]
  418.  
  419. local AmmoWidget = CoD.ZmAmmoContainerFactory.new(HudRef, InstanceRef)
  420. AmmoWidget:setLeftRight(false, true, -427.000000, 3.000000)
  421. AmmoWidget:setTopBottom(false, true, -232.000000, 0.000000)
  422.  
  423. HudRef:addElement(AmmoWidget)
  424. HudRef.Ammo = AmmoWidget
  425.  
  426. --[[local GhostVignette = LUI.UIImage.new(HudRef,InstanceRef)
  427. GhostVignette:setLeftRight(true,true,0,0)
  428. GhostVignette:setTopBottom(true,true,0,0)
  429. GhostVignette:setImage(RegisterImage("uie_t7_ghosts_hud_vignette"))
  430. HudRef:addElement(GhostVignette)
  431. --
  432. local GhostAmmoWidget = CoD.GhostAmmoWidget.new(HudRef,InstanceRef)
  433. GhostAmmoWidget:setLeftRight(false, true, -267, 0)
  434. GhostAmmoWidget:setTopBottom(false, true, -90, 0)
  435. -- GhostAmmoWidget:setYRot( -25 )
  436. -- GhostAmmoWidget:setXRot( 20 )
  437.  
  438. HudRef:addElement(GhostAmmoWidget)
  439. HudRef.Ammo = GhostAmmoWidget]]
  440.  
  441. -- local ChallengesToDo = LUI.UIImage.new(HudRef,InstanceRef)
  442. -- ChallengesToDo:setLeftRight(true, false, 10, 180)
  443. -- ChallengesToDo:setTopBottom(true, false, 10, 180)
  444. -- ChallengesToDo:setImage(RegisterImage("ghost_challenges"))
  445. --
  446. -- HudRef:addElement(ChallengesToDo)
  447. --
  448. -- local ChallengesToDoList = CoD.ReList.new(HudRef, InstanceRef, CoD.GhostChallengesTODO, true, true, 3, 1, 10, 250, 50)
  449. -- ChallengesToDoList:setLeftRight(true, false, 10, 370)
  450. -- ChallengesToDoList:setTopBottom(true, true, 190, 0)
  451. -- HudRef:addElement(ChallengesToDoList)
  452.  
  453. local GauntletWidget = CoD.GauntletWid.new(HudRef,InstanceRef)
  454. GauntletWidget:setLeftRight(true,true,0,0)
  455. GauntletWidget:setTopBottom(true, true, 0, 0)
  456.  
  457. HudRef:addElement(GauntletWidget)
  458.  
  459. local PerksWidget = CoD.ZMPerksContainerFactory.new(HudRef, InstanceRef)
  460. PerksWidget:setLeftRight(true, false, 0.000000, 250.000000)
  461. PerksWidget:setTopBottom(false, true, -280.000000, -66.000000)
  462. PerksWidget:setScale(0.75)
  463.  
  464. PerksWidget.PerkList:setHorizontalCount(2)
  465. PerksWidget.PerkList:setVerticalCount(10)
  466.  
  467. HudRef:addElement(PerksWidget)
  468. HudRef.ZMPerksContainerFactory = PerksWidget
  469.  
  470. --[[local GhostScores = CoD.GhostScoreContainer.new(HudRef, InstanceRef)
  471. GhostScores:setTopBottom(false,true,-90,0)
  472. GhostScores:setLeftRight(true,false,0,250)
  473. HudRef:addElement(GhostScores)
  474.  
  475. local GhostIGScoreBoard = CoD.GhostScoreBoardInGame.new(HudRef, InstanceRef)
  476. GhostIGScoreBoard:setLeftRight(false,true,-350, 0)
  477. GhostIGScoreBoard:setTopBottom(true, false, 0, 200)
  478. -- GhostIGScoreBoard:setYRot(-12)
  479. HudRef:addElement(GhostIGScoreBoard)]]
  480.  
  481.  
  482. local ScoreWidget = CoD.ZMScr.new(HudRef, InstanceRef)
  483. ScoreWidget:setLeftRight(true, false, 30.000000, 164.000000)
  484. ScoreWidget:setTopBottom(false, true, -256.000000, -128.000000)
  485. ScoreWidget:setYRot(30.000000)
  486. -- ScoreWidget:setAlpha(0)
  487.  
  488. local function HudStartScore(Unk1, Unk2, Unk3)
  489. if IsModelValueTrue(InstanceRef, "hudItems.playerSpawned") and
  490. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_VISIBLE) and
  491. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_WEAPON_HUD_VISIBLE) and not
  492. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_HARDCORE) and not
  493. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_GAME_ENDED) and not
  494. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_DEMO_CAMERA_MODE_MOVIECAM) and not
  495. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_DEMO_ALL_GAME_HUD_HIDDEN) and not
  496. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IN_KILLCAM) and not
  497. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED) and not
  498. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_UI_ACTIVE) and not
  499. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_SCOPED) and not
  500. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IN_VEHICLE) and not
  501. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE) and not
  502. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SCOREBOARD_OPEN) and not
  503. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IN_REMOTE_KILLSTREAK_STATIC) and not
  504. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_EMP_ACTIVE) then
  505. return true
  506. else
  507. return false
  508. end
  509. end
  510.  
  511. ScoreWidget:mergeStateConditions({{stateName = "HudStart", condition = HudStartScore}})
  512.  
  513. local function PlayerSpawnCallback(ModelRef)
  514. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  515. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  516. modelName = "hudItems.playerSpawned"})
  517. end
  518.  
  519. local function MergeBitVisible(ModelRef)
  520. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  521. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  522. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_HUD_VISIBLE})
  523. end
  524.  
  525. local function MergeBitWeapon(ModelRef)
  526. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  527. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  528. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_WEAPON_HUD_VISIBLE})
  529. end
  530.  
  531. local function MergeBitHardcore(ModelRef)
  532. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  533. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  534. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_HUD_HARDCORE})
  535. end
  536.  
  537. local function MergeBitEndGame(ModelRef)
  538. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  539. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  540. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_GAME_ENDED})
  541. end
  542.  
  543. local function MergeBitDemoMovie(ModelRef)
  544. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  545. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  546. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_DEMO_CAMERA_MODE_MOVIECAM})
  547. end
  548.  
  549. local function MergeBitDemoHidden(ModelRef)
  550. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  551. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  552. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_DEMO_ALL_GAME_HUD_HIDDEN})
  553. end
  554.  
  555. local function MergeBitInKillcam(ModelRef)
  556. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  557. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  558. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_KILLCAM})
  559. end
  560.  
  561. local function MergeBitFlash(ModelRef)
  562. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  563. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  564. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED})
  565. end
  566.  
  567. local function MergeBitActive(ModelRef)
  568. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  569. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  570. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_UI_ACTIVE})
  571. end
  572.  
  573. local function MergeBitScoped(ModelRef)
  574. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  575. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  576. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IS_SCOPED})
  577. end
  578.  
  579. local function MergeBitVehicle(ModelRef)
  580. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  581. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  582. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_VEHICLE})
  583. end
  584.  
  585. local function MergeBitMissile(ModelRef)
  586. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  587. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  588. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE})
  589. end
  590.  
  591. local function MergeBitBoardOpen(ModelRef)
  592. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  593. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  594. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SCOREBOARD_OPEN})
  595. end
  596.  
  597. local function MergeBitStaticKill(ModelRef)
  598. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  599. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  600. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_REMOTE_KILLSTREAK_STATIC})
  601. end
  602.  
  603. local function MergeBitEmpActive(ModelRef)
  604. HudRef:updateElementState(ScoreWidget, {name = "model_validation",
  605. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  606. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_EMP_ACTIVE})
  607. end
  608.  
  609. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "hudItems.playerSpawned"), PlayerSpawnCallback)
  610. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_HUD_VISIBLE), MergeBitVisible)
  611. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_WEAPON_HUD_VISIBLE), MergeBitWeapon)
  612. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_HUD_HARDCORE), MergeBitHardcore)
  613. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_GAME_ENDED), MergeBitEndGame)
  614. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_DEMO_CAMERA_MODE_MOVIECAM), MergeBitDemoMovie)
  615. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_DEMO_ALL_GAME_HUD_HIDDEN), MergeBitDemoHidden)
  616. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_KILLCAM), MergeBitInKillcam)
  617. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED), MergeBitFlash)
  618. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_UI_ACTIVE), MergeBitActive)
  619. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IS_SCOPED), MergeBitScoped)
  620. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_VEHICLE), MergeBitVehicle)
  621. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE), MergeBitMissile)
  622. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SCOREBOARD_OPEN), MergeBitBoardOpen)
  623. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_REMOTE_KILLSTREAK_STATIC), MergeBitStaticKill)
  624. ScoreWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_EMP_ACTIVE), MergeBitEmpActive)
  625.  
  626. HudRef:addElement(ScoreWidget)
  627. HudRef.Score = ScoreWidget
  628.  
  629. local DynaWidget = CoD.DynamicContainerWidget.new(HudRef, InstanceRef)
  630. DynaWidget:setLeftRight(false, false, -640.000000, 640.000000)
  631. DynaWidget:setTopBottom(false, false, -360.000000, 360.000000)
  632.  
  633. HudRef:addElement(DynaWidget)
  634. HudRef.fullscreenContainer = DynaWidget
  635.  
  636. local NotificationWidget = CoD.Notification.new(HudRef, InstanceRef)
  637. NotificationWidget:setLeftRight(true, true, 0.000000, 0.000000)
  638. NotificationWidget:setTopBottom(true, true, 0.000000, 0.000000)
  639.  
  640. HudRef:addElement(NotificationWidget)
  641. HudRef.Notifications = NotificationWidget
  642.  
  643. local GumWidget = CoD.ZmNotifBGB_ContainerFactory.new(HudRef, InstanceRef)
  644. GumWidget:setLeftRight(false, false, -156.000000, 156.000000)
  645. GumWidget:setTopBottom(true, false, -6.000000, 247.000000)
  646. GumWidget:setScale(0.750000)
  647.  
  648. local function GumCallback(ModelRef)
  649. if IsParamModelEqualToString(ModelRef, "zombie_bgb_token_notification") then
  650. AddZombieBGBTokenNotification(HudRef, GumWidget, InstanceRef, ModelRef) -- Add a popup for a 'free hit'
  651. elseif IsParamModelEqualToString(ModelRef, "zombie_bgb_notification") then
  652. AddZombieBGBNotification(HudRef, GumWidget, ModelRef) -- Add a popup for the gum you got
  653. elseif IsParamModelEqualToString(ModelRef, "zombie_notification") then
  654. AddZombieNotification(HudRef, GumWidget, ModelRef) -- Add a popup for a powerup
  655. end
  656. end
  657.  
  658. GumWidget:subscribeToGlobalModel(InstanceRef, "PerController", "scriptNotify", GumCallback)
  659.  
  660. HudRef:addElement(GumWidget)
  661. HudRef.ZmNotifBGBContainerFactory = GumWidget
  662.  
  663. local HintWidget = CoD.ZMCursorHint.new(HudRef, InstanceRef)
  664. HintWidget:setLeftRight(false, false, -250.000000, 250.000000)
  665. HintWidget:setTopBottom(true, false, 522.000000, 616.000000)
  666.  
  667. local function ActiveState1x1(Unk1, Unk2, Unk3)
  668. if IsCursorHintActive(InstanceRef) and not
  669. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_HARDCORE) and
  670. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_VISIBLE) and not
  671. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE) and not
  672. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_DEMO_PLAYING) and not
  673. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED) and not
  674. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SELECTING_LOCATIONAL_KILLSTREAK) and not
  675. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SPECTATING_CLIENT) and not
  676. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_UI_ACTIVE) then
  677. return (Engine.GetModelValue(Engine.GetModel(DataSources.HUDItems.getModel(InstanceRef), "cursorHintIconRatio")) == 1.0)
  678. else
  679. return false
  680. end
  681. end
  682.  
  683. local function ActiveState2x1(Unk1, Unk2, Unk3)
  684. if IsCursorHintActive(InstanceRef) and not
  685. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_HARDCORE) and
  686. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_VISIBLE) and not
  687. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE) and not
  688. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_DEMO_PLAYING) and not
  689. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED) and not
  690. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SELECTING_LOCATIONAL_KILLSTREAK) and not
  691. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SPECTATING_CLIENT) and not
  692. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_UI_ACTIVE) then
  693. return (Engine.GetModelValue(Engine.GetModel(DataSources.HUDItems.getModel(InstanceRef), "cursorHintIconRatio")) == 2.0)
  694. else
  695. return false
  696. end
  697. end
  698.  
  699. local function ActiveState4x1(Unk1, Unk2, Unk3)
  700. if IsCursorHintActive(InstanceRef) and not
  701. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_HARDCORE) and
  702. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_VISIBLE) and not
  703. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE) and not
  704. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_DEMO_PLAYING) and not
  705. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED) and not
  706. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SELECTING_LOCATIONAL_KILLSTREAK) and not
  707. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SPECTATING_CLIENT) and not
  708. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_UI_ACTIVE) then
  709. return (Engine.GetModelValue(Engine.GetModel(DataSources.HUDItems.getModel(InstanceRef), "cursorHintIconRatio")) == 4.0)
  710. else
  711. return false
  712. end
  713. end
  714.  
  715. local function ActiveStateNoImg(Unk1, Unk2, Unk3)
  716. if IsCursorHintActive(InstanceRef) and not
  717. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_HARDCORE) and
  718. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_HUD_VISIBLE) and not
  719. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE) and not
  720. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_DEMO_PLAYING) and not
  721. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED) and not
  722. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SELECTING_LOCATIONAL_KILLSTREAK) and not
  723. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SPECTATING_CLIENT) and not
  724. Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_UI_ACTIVE) then
  725. return IsModelValueEqualTo(InstanceRef, "hudItems.cursorHintIconRatio", 0.0)
  726. else
  727. return false
  728. end
  729. end
  730.  
  731. HintWidget:mergeStateConditions({
  732. {stateName = "Active_1x1", condition = ActiveState1x1},
  733. {stateName = "Active_2x1", condition = ActiveState2x1},
  734. {stateName = "Active_4x1", condition = ActiveState4x1},
  735. {stateName = "Active_NoImage", condition = ActiveStateNoImg}
  736. })
  737.  
  738. local CursorController = Engine.GetModel(Engine.GetModelForController(InstanceRef), "hudItems.showCursorHint")
  739.  
  740. local function ShowCallback(ModelRef)
  741. HudRef:updateElementState(HintWidget, {name = "model_validation",
  742. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  743. modelName = "hudItems.showCursorHint"})
  744. end
  745.  
  746. HintWidget:subscribeToModel(CursorController, ShowCallback)
  747.  
  748. local function CursorBitHardcore(ModelRef)
  749. HudRef:updateElementState(HintWidget, {name = "model_validation",
  750. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  751. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_HUD_HARDCORE})
  752. end
  753.  
  754. local function CursorBitVisible(ModelRef)
  755. HudRef:updateElementState(HintWidget, {name = "model_validation",
  756. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  757. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_HUD_VISIBLE})
  758. end
  759.  
  760. local function CursorBitMissile(ModelRef)
  761. HudRef:updateElementState(HintWidget, {name = "model_validation",
  762. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  763. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE})
  764. end
  765.  
  766. local function CursorBitDemo(ModelRef)
  767. HudRef:updateElementState(HintWidget, {name = "model_validation",
  768. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  769. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IS_DEMO_PLAYING})
  770. end
  771.  
  772. local function CursorBitFlash(ModelRef)
  773. HudRef:updateElementState(HintWidget, {name = "model_validation",
  774. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  775. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED})
  776. end
  777.  
  778. local function CursorBitMap(ModelRef)
  779. HudRef:updateElementState(HintWidget, {name = "model_validation",
  780. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  781. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SELECTING_LOCATIONAL_KILLSTREAK})
  782. end
  783.  
  784. local function CursorBitSpectating(ModelRef)
  785. HudRef:updateElementState(HintWidget, {name = "model_validation",
  786. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  787. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SPECTATING_CLIENT})
  788. end
  789.  
  790. local function CursorBitActive(ModelRef)
  791. HudRef:updateElementState(HintWidget, {name = "model_validation",
  792. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  793. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_UI_ACTIVE})
  794. end
  795.  
  796. local function CursorRatioChange(ModelRef)
  797. HudRef:updateElementState(HintWidget, {name = "model_validation",
  798. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  799. modelName = "hudItems.cursorHintIconRatio"})
  800. end
  801.  
  802. -- This widget reacts to these controller changes
  803. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_HUD_HARDCORE), CursorBitHardcore)
  804. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_HUD_VISIBLE), CursorBitVisible)
  805. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IN_GUIDED_MISSILE), CursorBitMissile)
  806. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IS_DEMO_PLAYING), CursorBitDemo)
  807. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_IS_FLASH_BANGED), CursorBitFlash)
  808. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SELECTING_LOCATIONAL_KILLSTREAK), CursorBitMap)
  809. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SPECTATING_CLIENT), CursorBitSpectating)
  810. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_UI_ACTIVE), CursorBitActive)
  811. HintWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "hudItems.cursorHintIconRatio"), CursorRatioChange)
  812.  
  813. HudRef:addElement(HintWidget)
  814. HudRef.CursorHint = HintWidget
  815.  
  816. local CenterCon = CoD.CenterConsole.new(HudRef, InstanceRef)
  817. CenterCon:setLeftRight(false, false, -370.000000, 370.000000)
  818. CenterCon:setTopBottom(true, false, 68.500000, 166.500000)
  819.  
  820. HudRef:addElement(CenterCon)
  821. HudRef.ConsoleCenter = CenterCon
  822.  
  823. local DeadOverlay = CoD.DeadSpectate.new(HudRef, InstanceRef)
  824. DeadOverlay:setLeftRight(false, false, -150.000000, 150.000000)
  825. DeadOverlay:setTopBottom(false, true, -180.000000, -120.000000)
  826.  
  827. HudRef:addElement(DeadOverlay)
  828. HudRef.DeadSpectate = DeadOverlay
  829.  
  830. local ScoreBd = CoD.MPScr.new(HudRef, InstanceRef)
  831. ScoreBd:setLeftRight(false, false, -50.000000, 50.000000)
  832. ScoreBd:setTopBottom(true, false, 233.500000, 258.500000)
  833.  
  834. local function MpCallback(ModelRef)
  835. if IsParamModelEqualToString(ModelRef, "score_event") then
  836. PlayClipOnElement(HudRef, {elementName = "MPScore", clipName = "NormalScore"}, InstanceRef)
  837. SetMPScoreText(HudRef, ScoreBd, InstanceRef, ModelRef)
  838. end
  839. end
  840.  
  841. HudRef:subscribeToGlobalModel(InstanceRef, "PerController", "scriptNotify", MpCallback)
  842.  
  843. HudRef:addElement(ScoreBd)
  844. HudRef.MPScore = ScoreBd
  845.  
  846. local PreMatch = CoD.ZM_PrematchCountdown.new(HudRef, InstanceRef)
  847. PreMatch:setLeftRight(false, false, -640.000000, 640.000000)
  848. PreMatch:setTopBottom(false, false, -360.000000, 360.000000)
  849.  
  850. HudRef:addElement(PreMatch)
  851. HudRef.ZMPrematchCountdown0 = PreMatch
  852.  
  853. local ScoreCP = CoD.ScoreboardWidgetCP.new(HudRef, InstanceRef)
  854. ScoreCP:setLeftRight(false, false, -503.000000, 503.000000)
  855. ScoreCP:setTopBottom(true, false, 247.000000, 773.000000)
  856.  
  857. -- ScoreCP:setAlpha(0)
  858.  
  859. HudRef:addElement(ScoreCP)
  860. HudRef.ScoreboardWidget = ScoreCP
  861.  
  862. local BeastTimer = CoD.ZM_BeastmodeTimeBarWidget.new(HudRef, InstanceRef)
  863. HudRef:setLeftRight(false, false, -242.500000, 321.500000)
  864. HudRef:setTopBottom(false, true, -174.000000, -18.000000)
  865.  
  866. HudRef:addElement(BeastTimer)
  867. HudRef.ZMBeastBar = BeastTimer
  868.  
  869. local ShieldWidget = CoD.RocketShieldBlueprintWidget.new(HudRef, InstanceRef)
  870. ShieldWidget:setLeftRight(true, false, -36.500000, 277.500000)
  871. ShieldWidget:setTopBottom(true, false, 104.000000, 233.000000)
  872. ShieldWidget:setScale(0.800000)
  873.  
  874. local function ShieldCallback(Unk1, Unk2, Unk3)
  875. if Engine.IsVisibilityBitSet(InstanceRef, Enum.UIVisibilityBit.BIT_SCOREBOARD_OPEN) then end
  876. return AlwaysFalse() -- Because the shield isn't available...
  877. end
  878.  
  879. ShieldWidget:mergeStateConditions({{stateName = "Scoreboard", condition = ShieldCallback}})
  880.  
  881. local function ShieldParts(ModelRef)
  882. HudRef:updateElementState(ShieldWidget, {name = "model_validation",
  883. menu = HudRef, menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  884. modelName = "zmInventory.widget_shield_parts"})
  885. end
  886.  
  887. local function ShieldBitOpen(ModelRef)
  888. HudRef:updateElementState(ShieldWidget, {name = "model_validation",
  889. menu = HudRef, modelValue = Engine.GetModelValue(ModelRef),
  890. modelName = "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SCOREBOARD_OPEN})
  891. end
  892.  
  893. ShieldWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "zmInventory.widget_shield_parts"), ShieldParts)
  894. ShieldWidget:subscribeToModel(Engine.GetModel(Engine.GetModelForController(InstanceRef), "UIVisibilityBit." .. Enum.UIVisibilityBit.BIT_SCOREBOARD_OPEN), ShieldBitOpen)
  895.  
  896. HudRef:addElement(ShieldWidget)
  897. HudRef.RocketShieldBlueprintWidget = ShieldWidget
  898.  
  899. local ChatContainer = CoD.IngameChatClientContainer.new(HudRef, InstanceRef)
  900. ChatContainer:setLeftRight(true, false, 0.000000, 360.000000)
  901. ChatContainer:setTopBottom(true, false, -2.500000, 717.500000)
  902.  
  903. HudRef:addElement(ChatContainer)
  904. HudRef.IngameChatClientContainer = ChatContainer
  905.  
  906. local ChatContainer2 = CoD.IngameChatClientContainer.new(HudRef, InstanceRef)
  907. ChatContainer2:setLeftRight(true, false, 0.000000, 360.000000)
  908. ChatContainer2:setTopBottom(true, false, -2.500000, 717.500000)
  909.  
  910. HudRef:addElement(ChatContainer2)
  911. HudRef.IngameChatClientContainer0 = ChatContainer2
  912.  
  913. local GumPack = CoD.BubbleGumPackInGame.new(HudRef, InstanceRef)
  914. GumPack:setLeftRight(false, false, -184.000000, 184.000000)
  915. GumPack:setTopBottom(true, false, 36.000000, 185.000000)
  916.  
  917. HudRef:addElement(GumPack)
  918. HudRef.BubbleGumPackInGame = GumPack
  919.  
  920. ScoreWidget.navigation = {up = ScoreCP, right = ScoreCP}
  921. ScoreCP.navigation = {left = ScoreWidget, down = ScoreWidget}
  922.  
  923. CoD.Menu.AddNavigationHandler(HudRef, HudRef, InstanceRef)
  924.  
  925. local function MenuLoadedCallback(HudObj, EventObj)
  926. SizeToSafeArea(HudObj, InstanceRef)
  927. return HudObj:dispatchEventToChildren(EventObj)
  928. end
  929.  
  930. HudRef:registerEventHandler("menu_loaded", MenuLoadedCallback)
  931.  
  932. -- Not sure why these are explicitly set, but they are
  933. ScoreWidget.id = "Score"
  934. ScoreCP.id = "ScoreboardWidget"
  935.  
  936. HudRef:processEvent({name = "menu_loaded", controller = InstanceRef})
  937. HudRef:processEvent({name = "update_state", menu = HudRef})
  938.  
  939. if not HudRef:restoreState() then
  940. HudRef.ScoreboardWidget:processEvent({name = "gain_focus", controller = InstanceRef})
  941. end
  942.  
  943. -- D3V Team logo (Only difference from stock!)
  944. local DevText = CoD.TextWithBg.new(HudRef, InstanceRef)
  945. DevText:setLeftRight(true, false, 20, 255)
  946. DevText:setTopBottom(true, false, 20, 50)
  947. DevText.Text:setText("D3V Team: L3ak Mod Demo v1.0.0")
  948. DevText.Bg:setRGB(0.098, 0.098, 0.098) -- RGBA are all specified in float range (0-1) (Byte / 255)
  949. DevText.Bg:setAlpha(0.8)
  950. DevText:setAlpha(0)
  951. local stringDev = ""
  952.  
  953. -- DevText.Text = DevText
  954. DevText.Text:setText("Ghost HUD thx > Robit" )
  955.  
  956. local function UpdateDevTextLabel(elem)
  957. local function __FUNC_2AD00_(arg1)
  958. UpdateDevTextLabel(DevText)
  959. end
  960. -- elem.Text:setText(stringDev)
  961. while true do
  962. if Dvar.keyboard_touch:get() ~= "nil" then
  963. if Dvar.keyboard_touch:get() ~= "{space}" then
  964. stringDev = stringDev .. tostring(Dvar.keyboard_touch:get())
  965. elseif Dvar.keyboard_touch:get() == "{del}" then
  966. local newstring = ""
  967. for i=1,#stringDev-2,1 do
  968. newstring = newstring .. stringDev[i]
  969. end
  970. stringDev = newstring
  971. else
  972. stringDev = stringDev .. " "
  973. end
  974. elem.Text:setText(stringDev)
  975. Engine.SetDvar("keyboard_touch", "nil")
  976. end
  977. HudRef:addElement(LUI.UITimer.newElementTimer(250.000000, true, __FUNC_2AD00_))
  978.  
  979. break
  980. end
  981. end
  982.  
  983. -- UpdateDevTextLabel(DevText)
  984.  
  985. HudRef:addElement(DevText)
  986. HudRef.DevWins = DevText
  987.  
  988. -- Engine.ExecNow(InstanceRef, "clearKeyStates")
  989. -- Engine.BindCommand(InstanceRef, "+melee", "W")
  990.  
  991. local function HudCloseCallback(SenderObj)
  992. SenderObj.ZMPerksContainerFactory:close()
  993. SenderObj.Rounds:close()
  994. SenderObj.Ammo:close()
  995. SenderObj.Score:close()
  996. SenderObj.fullscreenContainer:close()
  997. SenderObj.Notifications:close()
  998. SenderObj.ZmNotifBGBContainerFactory:close()
  999. SenderObj.CursorHint:close()
  1000. SenderObj.ConsoleCenter:close()
  1001. SenderObj.DeadSpectate:close()
  1002. SenderObj.MPScore:close()
  1003. SenderObj.ZMPrematchCountdown0:close()
  1004. SenderObj.ScoreboardWidget:close()
  1005. SenderObj.ZMBeastBar:close()
  1006. SenderObj.RocketShieldBlueprintWidget:close()
  1007. SenderObj.IngameChatClientContainer:close()
  1008. SenderObj.IngameChatClientContainer0:close()
  1009. SenderObj.BubbleGumPackInGame:close()
  1010. SenderObj.DevWins:close()
  1011.  
  1012. Engine.GetModel(Engine.GetModelForController(InstanceRef), "T7Hud_zm_factory.buttonPrompts")
  1013. Engine.UnsubscribeAndFreeModel()
  1014. end
  1015.  
  1016. LUI.OverrideFunction_CallOriginalSecond(HudRef, "close", HudCloseCallback)
  1017.  
  1018. if PostLoadCallback then
  1019. PostLoadCallback(HudRef, InstanceRef)
  1020. end
  1021.  
  1022. return HudRef
  1023. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement