var renderer = {
triangle: function(x0, y0, x1, y1, x2, y2, r, g, b, a) {
return Render.Polygon([[x0, y0], [x1, y1], [x2, y2]], [r, g, b, a]);
}
}
UI.AddSubTab(["Rage", "SUBTAB_MGR"], "Yumeno"),
UI.AddCheckbox(["Rage", "Yumeno", "Yumeno"], 'Enable China hat'),
UI.AddColorPicker(["Rage", "Yumeno", "Yumeno"], "China color"),
UI.AddCheckbox(["Rage", "Yumeno", "Yumeno"], 'Gradient'),
UI.AddSliderInt(["Rage", "Yumeno", "Yumeno"], "Speed China", 1, 360)
var renderer_triangle = function(v2_A, v2_B, v2_C, r, g, b, a) {
var i = function(j, k, l) {
var m = (k.y - j.y) * (l.x - k.x) - (k.x - j.x) * (l.y - k.y)
if (m < 0) {
return true
}
return false
}
if (i(v2_A, v2_B, v2_C)) {
renderer.triangle(v2_A.x, v2_A.y, v2_B.x, v2_B.y, v2_C.x ,v2_C.y, r, g, b, a)
} else if (i(v2_A, v2_C, v2_B)) {
renderer.triangle(v2_A.x, v2_A.y, v2_C.x, v2_C.y, v2_B.x, v2_B.y, r, g, b, a)
} else if (i(v2_B, v2_C, v2_A)) {
renderer.triangle(v2_B.x, v2_B.y, v2_C.x, v2_C.y, v2_A.x, v2_A.y, r, g, b, a)
} else if (i(v2_B, v2_A, v2_C)) {
renderer.triangle(v2_B.x, v2_B.y, v2_A.x, v2_A.y, v2_C.x, v2_C.y, r, g, b, a)
} else if (i(v2_C, v2_A, v2_B)) {
renderer.triangle(v2_C.x, v2_C.y, v2_A.x, v2_A.y, v2_B.x, v2_B.y, r, g, b, a)
} else {
renderer.triangle(v2_C.x, v2_C.y, v2_B.x, v2_B.y, v2_A.x, v2_A.y, r, g, b, a)
}
}
var hsv_to_rgb = function(h, s, v) {
var r, g, b, i, f, p, q, t;
if (arguments.length === 1) {
s = h.s, v = h.v, h = h.h;
}
i = Math.floor(h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0: r = v, g = t, b = p; break;
case 1: r = q, g = v, b = p; break;
case 2: r = p, g = v, b = t; break;
case 3: r = p, g = q, b = v; break;
case 4: r = t, g = p, b = v; break;
case 5: r = v, g = p, b = q; break;
}
return {
r: Math.round(r * 255),
g: Math.round(g * 255),
b: Math.round(b * 255)
}
}
Math.rad = function(degree){
return degree * Math.PI / 180.0;
}
var world_circle = function(origin, size) {
if(origin[0] == null) return
var last_point = null
var gradient_g = UI.GetValue(["Rage", "Yumeno", "Yumeno", "Gradient"])
var color_g = UI.GetColor(["Rage", "Yumeno", "Yumeno", "China color"])
for (var i = 0; i < 361; i++) {
var new_point = [
origin[0] - (Math.sin(Math.rad(i)) * size),
origin[1] - (Math.cos(Math.rad(i)) * size),
origin[2]
]
var actual_color = color_g
if (gradient_g) {
var hue_offset = 0
hue_offset = ((Globals.Realtime() * (UI.GetValue(["Rage", "Yumeno", "Yumeno", "Speed China"]) * 50)) + i) % 360
hue_offset = Math.min(360, Math.max(0, hue_offset))
var g_color = hsv_to_rgb(hue_offset / 360, 1, 1)
color_g = [g_color.r, g_color.g, g_color.b, 255]
}
if (last_point != null) {
var old_screen_point = Render.WorldToScreen([last_point[0], last_point[1], last_point[2]])
var new_screen_point = Render.WorldToScreen([new_point[0], new_point[1], new_point[2]])
var origin_screen_point = Render.WorldToScreen([origin[0], origin[1], origin[2] + 8])
if (old_screen_point[0] != null && new_screen_point[0] != null && origin_screen_point[0] != null) {
renderer_triangle({"x": old_screen_point[0], "y": old_screen_point[1]}, {"x": new_screen_point[0], "y": new_screen_point[1]}, {"x": origin_screen_point[0], "y": origin_screen_point[1]}, color_g[0], color_g[1], color_g[2], 50)
}
}
last_point = new_point
}
}
var on_paint = function() {
var master_state = UI.GetValue(["Rage", "Yumeno", "Yumeno", "Enable China hat"])
if (!master_state || !UI.GetValue(["Misc.", "Keys", "Thirdperson"]) || !Entity.GetLocalPlayer() || !Entity.IsAlive(Entity.GetLocalPlayer())) {
return
}
var hb = Entity.GetHitboxPosition(Entity.GetLocalPlayer(), 0)
world_circle([hb[0], hb[1], hb[2]], 10)
}
Cheat.RegisterCallback("Draw", "on_paint");