· 5 years ago · Jun 27, 2020, 11:42 PM
1// shit for italian
2
3//region api
4const global = [], globals = [], sound = [], cheat = [], local = [], world = [], input = [], render = [], ui = [], convar = [], event = [], entity = [], trace = [], usercmd = [], antiaim = [], exploit = [], ragebot = [], material = [], __filename = [], f = [], f2 = [], already_parsed = [], format = [], g = [], keys = [], k = []; global.print = Global.Print, global.print_chat = Global.PrintChat, global.print_color = Global.PrintColor, global.register_callback = Global.RegisterCallback, global.execute_command = Global.ExecuteCommand, global.frame_stage = Global.FrameStage, global.tickcount = Global.Tickcount, global.tickrate = Global.Tickrate, global.tick_interval = Global.TickInterval, global.curtime = Global.Curtime, global.realtime = Global.Realtime, global.frametime = Global.Frametime, global.latency = Global.Latency, global.get_view_angles = Global.GetViewAngles, global.set_view_angles = Global.SetViewAngles, global.get_map_name = Global.GetMapName, global.is_key_pressed = Global.IsKeyPressed, global.get_screen_size = Global.GetScreenSize, global.get_cursor_position = Global.GetCursorPosition, global.play_sound = Global.PlaySound, global.play_microphone = Global.PlayMicrophone, global.stop_microphone = Global.StopMicrophone, global.get_username = Global.GetUsername, global.set_clan_tag = Global.SetClanTag, globals.tickcount = Globals.Tickcount, globals.tickrate = Globals.Tickrate, globals.tick_interval = Globals.TickInterval, globals.curtime = Globals.Curtime, globals.realtime = Globals.Realtime, globals.frametime = Globals.Frametime, sound.play = Sound.Play, sound.play_microphone = Sound.PlayMicrophone, sound.stop_microphone = Sound.StopMicrophone, cheat.get_username = Cheat.GetUsername, cheat.register_callback = function(c, f) { switch (c) { case 'create_move': Cheat.RegisterCallback("CreateMove", f); break; case 'paint': Cheat.RegisterCallback("Draw", f); break; case 'fsn': Cheat.RegisterCallback("FrameStageNotify", f); break; case 'shutdown': Cheat.RegisterCallback("Unload", f); break; default: Cheat.RegisterCallback(c, f); break; } }, cheat.execute_command = Cheat.ExecuteCommand, cheat.frame_stage = Cheat.FrameStage, cheat.print = Cheat.Print, cheat.print_chat = Cheat.PrintChat, cheat.print_color = Cheat.PrintColor, local.latency = Local.Latency, local.get_view_angles = Local.GetViewAngles, local.set_view_angles = Local.SetViewAngles, local.set_clan_tag = Local.SetClanTag, local.get_real_yaw = Local.GetRealYaw, local.get_fake_yaw = Local.GetFakeYaw, local.get_spread = Local.GetSpread, local.get_inaccuracy = Local.GetInaccuracy, world.get_map_name = World.GetMapName, world.get_server_string = World.GetServerString, input.get_cursor_position = Input.GetCursorPosition, input.is_key_pressed = Input.IsKeyPressed, render.string = Render.String, render.text_size = Render.TextSize, render.line = Render.Line, render.rect = Render.Rect, render.filled_rect = Render.FilledRect, render.gradient_rect = Render.GradientRect, render.circle = Render.Circle, render.filled_circle = Render.FilledCircle, render.polygon = Render.Polygon, render.world_to_screen = Render.WorldToScreen, render.add_font = Render.AddFont, render.find_font = Render.FindFont, render.string_custom = Render.StringCustom, render.textured_rect = Render.TexturedRect, render.add_texture = Render.AddTexture, render.text_size_custom = Render.TextSizeCustom, render.get_screen_size = Render.GetScreenSize, ui.get_value = UI.GetValue, ui.set_value = UI.SetValue, ui.add_checkbox = UI.AddCheckbox, ui.add_slider_int = UI.AddSliderInt, ui.add_slider_float = UI.AddSliderFloat, ui.add_hotkey = UI.AddHotkey, ui.add_label = UI.AddLabel, ui.add_dropdown = UI.AddDropdown, ui.add_multi_dropdown = UI.AddMultiDropdown, ui.add_color_picker = UI.AddColorPicker, ui.add_textbox = UI.AddTextbox, ui.set_enabled = UI.SetEnabled, ui.get_string = UI.GetString, ui.get_color = UI.GetColor, ui.set_color = UI.SetColor, ui.is_hotkey_active = UI.IsHotkeyActive, ui.toggle_hotkey = UI.ToggleHotkey, ui.is_menu_open = UI.IsMenuOpen, convar.get_int = Convar.GetInt, convar.set_int = Convar.SetInt, convar.get_float = Convar.GetFloat, convar.set_float = Convar.SetFloat, convar.get_string = Convar.GetString, convar.set_string = Convar.SetString, event.get_int = Event.GetInt, event.get_float = Event.GetFloat, event.get_string = Event.GetString, entity.get_entities = Entity.GetEntities, entity.get_entities_by_class_i_d = Entity.GetEntitiesByClassID, entity.get_players = Entity.GetPlayers, entity.get_enemies = Entity.GetEnemies, entity.get_teammates = Entity.GetTeammates, entity.get_local_player = Entity.GetLocalPlayer, entity.get_game_rules_proxy = Entity.GetGameRulesProxy, entity.get_entity_from_user_i_d = Entity.GetEntityFromUserID, entity.is_teammate = Entity.IsTeammate, entity.is_enemy = Entity.IsEnemy, entity.is_bot = Entity.IsBot, entity.is_local_player = Entity.IsLocalPlayer, entity.is_valid = Entity.IsValid, entity.is_alive = Entity.IsAlive, entity.is_dormant = Entity.IsDormant, entity.get_class_i_d = Entity.GetClassID, entity.get_class_name = Entity.GetClassName, entity.get_name = Entity.GetName, entity.get_weapon = Entity.GetWeapon, entity.get_weapons = Entity.GetWeapons, entity.get_render_origin = Entity.GetRenderOrigin, entity.get_render_box = Entity.GetRenderBox, entity.get_prop = Entity.GetProp, entity.set_prop = Entity.SetProp, entity.get_hitbox_position = Entity.GetHitboxPosition, entity.get_eye_position = Entity.GetEyePosition, trace.line = Trace.Line, trace.bullet = Trace.Bullet, usercmd.set_movement = UserCMD.SetMovement, usercmd.get_movement = UserCMD.GetMovement, usercmd.set_angles = UserCMD.SetAngles, usercmd.force_jump = UserCMD.ForceJump, usercmd.force_crouch = UserCMD.ForceCrouch, antiaim.get_override = AntiAim.GetOverride, antiaim.set_override = AntiAim.SetOverride, antiaim.set_real_offset = AntiAim.SetRealOffset, antiaim.set_fake_offset = AntiAim.SetFakeOffset, antiaim.set_l_b_y_offset = AntiAim.SetLBYOffset, exploit.get_charge = Exploit.GetCharge, exploit.recharge = Exploit.Recharge, exploit.disable_recharge = Exploit.DisableRecharge, exploit.enable_recharge = Exploit.EnableRecharge, ragebot.get_target = Ragebot.GetTarget, ragebot.ignore_target = Ragebot.IgnoreTarget, ragebot.force_target = Ragebot.ForceTarget, ragebot.force_target_safety = Ragebot.ForceTargetSafety, ragebot.force_target_hitchance = Ragebot.ForceTargetHitchance, ragebot.force_target_minimum_damage = Ragebot.ForceTargetMinimumDamage, ragebot.force_hitbox_safety = Ragebot.ForceHitboxSafety, material.create = Material.Create, material.destroy = Material.Destroy, material.get = Material.Get, material.set_key_value = Material.SetKeyValue, material.refresh = Material.Refresh
5//endregion
6
7
8
9//region dependencies
10
11/**
12 * @title BetterUI
13 * @version 2.0.1
14 * @description A better UI system for Onetap
15 */
16
17var menu = {};
18const menu_spacer = " ";
19
20/**
21 * Concats two elements into an array without increasing the array length.
22 * Prevents the memory leak in 2.0.0 from happening
23 *
24 * @param a {array}
25 * @param b {any}
26 */
27menu.concat = function(a, b)
28{
29 // Creates a new array.
30 var arr = [];
31
32 // Push all items from the array 'a' into our array.
33 for (var c in a)
34 {
35 arr.push(a[c]);
36 }
37
38 // Push the value 'b' into our array.
39 arr.push(b);
40
41 // Return the new array.
42 return arr;
43}
44
45/**
46 * Creates a new menu label
47 *
48 * @param label {string}
49 */
50menu.label = function(label)
51{
52 // Creates the label
53 UI.AddLabel(label);
54};
55
56/**
57 * Creates a new menu element
58 *
59 * @param func {function}
60 * @param name {string}
61 * @param label {string},
62 * @param properties {array}
63 */
64menu.call = function(func, name, label, properties)
65{
66 // Get properties
67 const final_name = name + menu_spacer + label;
68 var final_props = [final_name];
69 const element_info_t = {
70 path: ["Misc", "JAVASCRIPT", "Script Items", final_name]
71 };
72
73 // If our properties aren't null, then pack them together.
74 if (properties != null)
75 {
76 for (var i = 0; i < properties.length; i++)
77 {
78 final_props.push(properties[i]);
79 }
80 }
81
82 // Create our menu element and return properties
83 func.apply(null, final_props);
84 return element_info_t;
85};
86
87/**
88 * Creates a new menu reference
89 *
90 * @param path {array}
91 */
92menu.reference = function(path)
93{
94 const element_info_t = {
95 path: path
96 };
97
98 return element_info_t;
99};
100
101/**
102 * Gets the value of a menu element
103 *
104 * @param elem {array}
105 * @return {*}
106 */
107menu.get = function(elem)
108{
109 // If the element doesn't exist
110 if (!(elem.path))
111 throw new Error("[Menu] This element doesn't exist!");
112
113 // Returns the element's value
114 return UI.GetValue.apply(null, elem.path);
115};
116
117/**
118 * Gets the value of a menu element
119 *
120 * @param elem {array}
121 * @return {*}
122 */
123menu.get_hotkey = function(elem)
124{
125 // If the label doesn't exist
126 if (!(elem.path))
127 throw new Error("[Menu] This element doesn't exist!");
128
129 // Returns the element's value
130 return UI.IsHotkeyActive.apply(null, elem.path);
131};
132
133/**
134 * Gets the value of a menu element
135 *
136 * @param elem {array}
137 * @return {*}
138 */
139menu.get_color = function(elem)
140{
141 // If the label doesn't exist
142 if (!(elem.path))
143 throw new Error("[Menu] This element doesn't exist!");
144
145 // Returns the element's value
146 return UI.GetColor.apply(null, elem.path);
147};
148
149/**
150 * Sets the value of a menu element
151 *
152 * @param elem {array}
153 * @param value {*}
154 */
155menu.set = function(elem, value)
156{
157 // If the label doesn't exist
158 if (!(elem.path))
159 throw new Error("[Menu] This element doesn't exist!");
160
161 // Get properties
162 const properties = elem;
163
164 // Set the element's value
165 UI.SetValue.apply(null, this.concat(properties.path, value));
166};
167
168/**
169 * Sets the value of a color picker
170 *
171 * @param elem {array}
172 * @param color {array|Color}
173 */
174menu.set_color = function(elem, color)
175{
176 // If the label doesn't exist
177 if (!(elem.path))
178 throw new Error("[Menu] This element doesn't exist!");
179
180 // Get properties
181 const properties = elem;
182
183 // Set the element's value
184 UI.SetColor.apply(null, this.concat(properties.path, color));
185};
186
187/**
188 * Toggles a hotkey
189 *
190 * @param elem {array}
191 */
192menu.toggle = function(elem)
193{
194 // If the label doesn't exist
195 if (!(elem.path))
196 throw new Error("[Menu] This element doesn't exist!");
197
198 // Set the element's value
199 UI.ToggleHotkey.apply(null, elem.path);
200};
201
202/**
203 * Changes the visibility of a menu elements
204 *
205 * @param elem {array}
206 * @param visible {boolean}
207 */
208menu.visibility = function(elem, visible)
209{
210 // If the label doesn't exist
211 if (!(elem.path))
212 throw new Error("[Menu] This element doesn't exist!");
213
214 // Get properties
215 const properties = elem;
216
217 // Change the element's visibility
218 UI.SetEnabled.apply(null, this.concat(properties.path, visible));
219};
220
221/**
222 * @title Vector
223 * @description Simple 3d vector system
224 *
225 * @typedef Vector {x: number, y: number, z: number}
226 */
227var vector = {};
228
229/**
230 * @brief Creates a new 3d vector instance.
231 * @param data {array}
232 * @returns {Vector}
233 */
234vector.new = function(data)
235{
236 return {
237 x: data[0],
238 y: data[1],
239 z: data[2]
240 };
241};
242
243/**
244 * @brief Realizes a mathematical operation between two vectors.
245 * @param vec {Vector}
246 * @param vec2 {Vector}
247 * @param operation {string}
248 * @returns {Vector}
249 */
250vector.operate = function(vec, vec2, operation)
251{
252 switch (operation)
253 {
254 case '+':
255 return {
256 x: vec.x + vec2.x,
257 y: vec.y + vec2.y,
258 z: vec.z + vec2.z
259 };
260
261 case '-':
262 return {
263 x: vec.x - vec2.x,
264 y: vec.y - vec2.y,
265 z: vec.z - vec2.z
266 };
267
268 case '*':
269 return {
270 x: vec.x * vec2.x,
271 y: vec.y * vec2.y,
272 z: vec.z * vec2.z
273 };
274
275 case '/':
276 return {
277 x: vec.x / vec2.x,
278 y: vec.y / vec2.y,
279 z: vec.z / vec2.z
280 };
281
282 default:
283 throw new Error("[Vector] Invalid operation type.");
284 }
285};
286
287/**
288 * @brief Returns the 2d length of a vector.
289 * @param vec {Vector}
290 * @returns {number}
291 */
292vector.length2d = function(vec)
293{
294 return Math.sqrt(vec.x * vec.x + vec.y * vec.y);
295};
296
297/**
298 * @brief Converts a vector to angles.
299 * @param vec
300 * @returns {Vector}
301 */
302vector.angles = function(vec)
303{
304 return {
305 x: -Math.atan2(vec.z, this.length2d(vec)) * 180 / Math.PI,
306 y: Math.atan2(vec.y, vec.x) * 180 / Math.PI,
307 z: 0
308 };
309};
310
311/**
312 * @brief Calculates the fov delta between two points based on a specific view angles.
313 * @param origin {Vector}
314 * @param destination {Vector}
315 * @param view {Vector}
316 * @returns {number}
317 */
318vector.fov_to = function(origin, destination, view)
319{
320 const angles = this.angles(this.operate(destination, origin, '-'));
321
322 const delta = this.new(
323 [
324 Math.abs(view.x - angles.x),
325 Math.abs(view.y % 360 - angles.y % 360) % 360,
326 0
327 ]
328 );
329
330 if (delta.y > 180)
331 delta.y = 360 - delta.y;
332
333 return this.length2d(delta);
334};
335
336/**
337 * @brief Unpacks a vector object into an array.
338 * @param vec {Vector}
339 * @returns {[number, number, number]}
340 */
341vector.to_array = function(vec)
342{
343 return [
344 vec.x,
345 vec.y,
346 vec.z
347 ];
348};
349
350/**
351 * Checks whether or not a value is contained inside an array
352 *
353 * @param {Array} array
354 * @param {any} value
355 * @returns {Boolean}
356 */
357function contains(array, value)
358{
359 for (var k in array)
360 {
361 var v = array[k];
362 if (k === value || v === value)
363 return true;
364 }
365
366 return false;
367}
368
369//endregion
370
371//region locals
372
373// Maps our weapon IDs into each configuration
374const ids = [
375 [2, 3, 4, 30, 32, 36, 61, 63],
376 [1, 64],
377 [40],
378 [9],
379 [11, 38]
380];
381
382// Maps our configuration names
383const weapons = [
384 "General",
385 "Pistol",
386 "Heavy Pistol",
387 "Scout",
388 "AWP",
389 "Autosniper"
390];
391
392//endregion
393
394//region menu
395
396// Create our menu
397const config = menu.call(ui.add_dropdown, "Current configuration", "italy_config", [weapons]);
398const options = [
399
400 // General configuration
401 {
402 dmg: menu.call(ui.add_slider_int, "Minimum damage (visible)", "italy_general_dmg", [0, 130]),
403 dmg_override: menu.call(ui.add_slider_int, "Minimum damage (on key)", "italy_general_dmg_override", [0, 130]),
404 dmg_autowall: menu.call(ui.add_slider_int, "Minimum damage (auto wall)", "italy_general_dmg_autowall", [0, 130])
405 },
406
407 // Pistol configuration
408 {
409 dmg: menu.call(ui.add_slider_int, "Minimum damage (visible)", "italy_pistol_dmg", [0, 130]),
410 dmg_override: menu.call(ui.add_slider_int, "Minimum damage (on key)", "italy_pistol_dmg_override", [0, 130]),
411 dmg_autowall: menu.call(ui.add_slider_int, "Minimum damage (auto wall)", "italy_pistol_dmg_autowall", [0, 130])
412 },
413
414 // Heavy pistol configuration
415 {
416 dmg: menu.call(ui.add_slider_int, "Minimum damage (visible)", "italy_hpistol_dmg", [0, 130]),
417 dmg_override: menu.call(ui.add_slider_int, "Minimum damage (on key)", "italy_hpistol_dmg_override", [0, 130]),
418 dmg_autowall: menu.call(ui.add_slider_int, "Minimum damage (auto wall)", "italy_hpistol_dmg_autowall", [0, 130])
419 },
420
421 // Scout configuration
422 {
423 dmg: menu.call(ui.add_slider_int, "Minimum damage (visible)", "italy_scout_dmg", [0, 130]),
424 dmg_override: menu.call(ui.add_slider_int, "Minimum damage (on key)", "italy_scout_dmg_override", [0, 130]),
425 dmg_autowall: menu.call(ui.add_slider_int, "Minimum damage (auto wall)", "italy_scout_dmg_autowall", [0, 130])
426 },
427
428 // AWP configuration
429 {
430 dmg: menu.call(ui.add_slider_int, "Minimum damage (visible)", "italy_awp_dmg", [0, 130]),
431 dmg_override: menu.call(ui.add_slider_int, "Minimum damage (on key)", "italy_awp_dmg_override", [0, 130]),
432 dmg_autowall: menu.call(ui.add_slider_int, "Minimum damage (auto wall)", "italy_awp_dmg_autowall", [0, 130])
433 },
434
435 // Autosniper configuration
436 {
437 dmg: menu.call(ui.add_slider_int, "Minimum damage (visible)", "italy_auto_dmg", [0, 130]),
438 dmg_override: menu.call(ui.add_slider_int, "Minimum damage (on key)", "italy_auto_dmg_override", [0, 130]),
439 dmg_autowall: menu.call(ui.add_slider_int, "Minimum damage (auto wall)", "italy_auto_dmg_autowall", [0, 130])
440 }
441];
442
443const override_key = menu.call(ui.add_hotkey, "Damage override", "italy_override", []);
444const show_dmg = menu.call(ui.add_checkbox, "Show minimum damage", "italy_indicator", []);
445
446//endregion
447
448//region function
449
450/**
451 * @class target
452 * @brief Handles the targeting system
453 */
454var target = {};
455
456/**
457 * Returns the entity ID of the closest player to your crosshair.
458 *
459 * @returns {Number|null}
460 */
461target.get_closest = function( )
462{
463 // Get our entities.
464 const players = entity.get_enemies();
465 const me = entity.get_local_player();
466
467 // Initialize our data struct.
468 const data = {id: null, fov: 180};
469
470 // Get our player's eye position and view angles to make the FOV calculations
471 const origin = vector.new(entity.get_eye_position(me));
472 const angles = vector.new(local.get_view_angles( ));
473
474 // Loop for each enemy.
475 for (var i = 0; i < players.length; i++) {
476 // Get our current enemy
477 const e = players[i];
478
479 // Get the target's position
480 const destination = vector.new(entity.get_hitbox_position(e, 0));
481
482 // Calculate the FOV.
483 const fov = vector.fov_to(origin, destination, angles);
484
485 // If our FOV is lower than the cached one, then this player is closer to our crosshair than the last one.
486 if (fov < data.fov) {
487 // Cache its data.
488 data.id = e;
489 data.fov = fov;
490 }
491 }
492
493 // Return the best target.
494 return data.id;
495}
496
497/**
498 * @class config_system
499 * @brief Handles the configuration updates and the menu visibility.
500 */
501var config_system = {
502 current_config_id: 0,
503 last_weapon: 0,
504
505 override: false
506};
507
508/**
509 * Handles the menu visibility.
510 */
511config_system.handle_visibility = function()
512{
513 // Loop for each configuration we have.
514 for (var i = 0; i < options.length; i++)
515 {
516 // Check if this configuration is the selected one.
517 // Doing this because we only want to display the selected configuration's elements.
518 const draw = i === menu.get(config);
519
520 // Loop for each menu element our current configuration has.
521 for (var j in options[i])
522 {
523 // Update the visibility.
524 menu.visibility(options[i][j], draw);
525 }
526 }
527}
528
529// Update the menu visibility every time the script is loaded.
530config_system.handle_visibility( );
531
532/**
533 * Updates the current configuration
534 */
535config_system.update = function( )
536{
537 // Get our local player.
538 const me = entity.get_local_player( );
539
540 // If our local player isn't valid or if we're dead then there's no need to update anything.
541 if (!me || !entity.is_alive(me))
542 return;
543
544 // Get our active weapon entity handle and then get its item ID.
545 // More about item IDs here: https://tf2b.com/itemlist.php?gid=730.
546 const weapon_hndl = entity.get_prop(me, "CBasePlayer", "m_hActiveWeapon");
547 const weapon_id = entity.get_prop(weapon_hndl, "CBaseAttributableItem", "m_iItemDefinitionIndex") & 0xFFFF;
548
549 // If our active weapon item ID is the same as the cached one then we didn't switch weapons.
550 // So there's no need to update the current configuration.
551 if (weapon_id === this.last_weapon)
552 return;
553
554 // Cache our active weapon item ID for further checks.
555 this.last_weapon = weapon_id;
556
557 // Loop through every item ID array inside our IDs map.
558 for (var i = 0; i < ids.length; i++)
559 {
560 // Check if the current item ID array contains our active weapon ID.
561 if (contains(ids[i], weapon_id))
562 {
563 // If so, then our active weapon is part of this configuration group, so update our current configuration index.
564 // Doing the '+ 1' because the "GENERAL" configuration isn't mapped.
565 this.current_config_id = i + 1;
566 return;
567 }
568 }
569
570 // If our IDs map doesn't contain our current item ID then it means that this weapon does not belong to any configuration.
571 // So this weapon belongs to the GENERAL configuration.
572 this.current_config_id = 0;
573}
574
575/**
576 * @class damage_system
577 * @brief Handles the updates of the minimum damage.
578 */
579var damage_system = {};
580
581/**
582 * Updates the cheat's minimum damage.
583 *
584 * @param {Number} target
585 */
586damage_system.update = function(target)
587{
588 // Get our local player.
589 const me = entity.get_local_player( );
590
591 // If our local player doesn't exist or if we're not alive then there's no need to update the minimum damage.
592 if (!me || !entity.is_alive(me))
593 return;
594
595 // Get our current configuration and minimum damage reference.
596 const current_config = options[config_system.current_config_id];
597 const ref = menu.reference(["Rage", weapons[config_system.current_config_id].toUpperCase( ), "Targeting", "Minimum damage"])
598
599 // Check if we were overriding our minimum damage.
600 if (config_system.override)
601 {
602 // If so, revert our minimum damage.
603 menu.set(ref, menu.get(current_config.dmg));
604 config_system.override = false;
605 }
606
607 // If our target doesn't exist or if the target isn't alive then there's no need to update the minimum damage.
608 if (!target || !entity.is_alive(target))
609 return;
610
611 // Check if we are pressing the override key.
612 if (menu.get_hotkey(override_key))
613 {
614 // If so, update our minimum damage.
615 config_system.override = true;
616 menu.set(ref, menu.get(current_config.dmg_override))
617 return;
618 }
619
620 // Get our local player's eye position so we can do the tracings later.
621 const origin = entity.get_eye_position(me);
622
623 // Loops for every hitbox except limbs.
624 for (var i = 0; i < 7; i++)
625 {
626 // Get our current hitbox's position.
627 const hitbox = entity.get_hitbox_position(target, i);
628
629 // Trace a line from our eye position to the hitbox position in order to see if it is visible.
630 const trace = Trace.Line(me, origin, hitbox);
631
632 // Check if the trace didn't hit an entity or if the trace's length is lower than 0.87
633 if (!trace[0] || trace[1] < 0.87)
634 {
635 // If so, our target is not visible so update the minimum damage.
636 // Returning after because we don't need to further check for visibility.
637 config_system.override = true;
638 menu.set(ref, menu.get(current_config.dmg_autowall))
639 return;
640 }
641 }
642}
643
644/**
645 * @callback Draw
646 * @brief Callbacks the configuration system updates and the indicator rendering.
647 */
648function on_paint( )
649{
650 // Handle the menu visibility.
651 config_system.handle_visibility( );
652
653 // Return if our indicator is not enabled.
654 if (!menu.get(show_dmg))
655 return;
656
657 // Get our drawing properties.
658 const ref = menu.reference(["Rage", weapons[config_system.current_config_id].toUpperCase( ), "Targeting", "Minimum damage"])
659 const y = render.get_screen_size( )[1];
660
661 // Render the minimum damage indicator.
662 Render.String(15, y - 125, 0, (menu.get(ref)).toString(), [255, 255, 255, 200], 4);
663}
664
665/**
666 * @callback CreateMove
667 * @brief Handles the menu visibility and the damage system updates.
668 */
669function on_create_move( )
670{
671 // Update our configuration.
672 config_system.update( );
673
674 // Update our minimum damage settings.
675 damage_system.update(target.get_closest( ));
676}
677
678//endregion
679
680//region callbacks
681
682// Register our callbacks
683cheat.register_callback("Draw", "on_paint");
684cheat.register_callback("CreateMove", "on_create_move");
685
686//endregion