//Ruirize's Candy Log Plugin (converted by Blaze)
//Makes the kill log TF2-style, like Ruirize did in Candy Mod.
if !variable_global_exists("candyLogged") global.candyLogged = 0;
else global.candyLogged = 1;
out("Ruirize's Candy Log Plugin");
if global.candyLogged != 1 {

object_event_clear(KillLog,ev_draw,0);
object_event_add(KillLog,ev_draw,0,'var i, map, n1, t1, w1, n2, t2, col, red, blu;

if (instance_exists(MusicBox))
{
    hide = false;
    with(MusicBox)
    {
        if (drop) other. hide = true;
    }
    if (hide) exit;
}

draw_set_halign(fa_left);
draw_set_valign(fa_center);

for (i = 0; i < ds_list_size(kills); i += 1) {
    map = ds_list_find_value(kills, i);
    n1 = ds_map_find_value(map, 0); // Name of the Player who killed
    t1 = ds_map_find_value(map, 1); // Their team
    w1 = ds_map_find_value(map, 2); // Their weapon sprite
    n2 = ds_map_find_value(map, 3); // Name of the Player who died
    t2 = ds_map_find_value(map, 4); // Their team
    
    if global.myself.name == n1 or global.myself.name == n2 then {
        col = make_color_rgb(255,255,230)
    } else {
        col = c_black
        //red = make_color_rgb(241, 59, 49)
        //blu = make_color_rgb(50, 91, 218)
    }
    
    red = make_color_rgb(171, 78, 70)
    blu = make_color_rgb(100, 116, 132)
    
    if n1 == "" n1 = " "
    if n2 == "" n2 = " "
    
//Non-script version of draw_panel
var _x, _y, width, height, alph;

_x     = view_xview[0] + view_wview[0] - string_width(n1 + n2) - sprite_get_width(w1) - 12
_y     = view_yview[0] + i * 20 + 20
width  = string_width(n1 + n2) + sprite_get_width(w1) + 12
height = 16
alph   = 0.7

draw_set_alpha(alph)
draw_set_color(col)
draw_roundrect(_x,_y,_x+width,_y+height,0)              

    draw_set_alpha(1);
    if (t1 == TEAM_RED) {
        draw_set_color(red);
        spriteoffset=0;
    } else {
        draw_set_color(blu);
        spriteoffset=1;
    }
    draw_text(view_xview[0] + view_wview[0] - string_width(n1 + n2) - 8 - sprite_get_width(w1), view_yview[0] + i * 20 + 28, n1);
    
    draw_set_halign(fa_center);
    if w1 != -1 draw_sprite(w1, spriteoffset, floor(view_xview[0] + view_wview[0] - string_width(n2) - 6 - sprite_get_width(w1)/2 - sprite_get_xoffset(w1)),
    floor(view_yview[0] + i * 20)+sprite_get_yoffset(w1)-sprite_get_height(w1)/2+29);
    draw_set_halign(fa_left);
    
    if (t2 == TEAM_RED) {
        draw_set_color(red);
    } else {
        draw_set_color(blu);
    }
    draw_text(view_xview[0] + view_wview[0] - string_width(n2) - 4, view_yview[0] + i * 20 + 28, n2);
}');

}