From 32cb4d75ef976a26a7a2a25139488fd632dfafcf Mon Sep 17 00:00:00 2001 From: Beu Date: Wed, 5 May 2021 11:27:25 +0200 Subject: [PATCH] Let the game compute other medals & add humain readable time --- Plugin_MapValidator.as | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Plugin_MapValidator.as b/Plugin_MapValidator.as index 9bffdb4..9ffed49 100644 --- a/Plugin_MapValidator.as +++ b/Plugin_MapValidator.as @@ -1,6 +1,8 @@ #name "Map Validator" #author "Beu" #category "Map Editor" +#siteid 91 +#version "1.2" // Based on the Moski plugin which is also based on the Miss plugin :) @@ -24,9 +26,6 @@ void validate(int author_time) { } if (map !is null) { map.TMObjective_AuthorTime = author_time; - map.TMObjective_BronzeTime = author_time * 4; - map.TMObjective_SilverTime = author_time * 3; - map.TMObjective_GoldTime = author_time * 2; } } @@ -40,10 +39,22 @@ void Render() { UI::Begin("\\$cf9" + Icons::Flag + "\\$z Map Validator###MapValidator", menu_visibility, UI::WindowFlags::NoResize | UI::WindowFlags::AlwaysAutoResize | UI::WindowFlags::NoCollapse); if (app.RootMap !is null) { author_time = UI::InputInt("Author time in ms", author_time ,1); + + if (author_time < 0) author_time = 0; + if (UI::Button("Validate")) { validate(author_time); menu_visibility = false; } + + // Convert time in ms to humain readable time + string display_time = Text::Format('%02d',(author_time / 1000 / 60) % 60) + ":" + Text::Format('%02d',(author_time / 1000) % 60) + "." + Text::Format('%03d',author_time % 1000); + if (Math::Floor(author_time / 1000 / 60 / 60) > 0) { + display_time = Text::Format('%d',author_time / 1000 / 60 / 60) + ":" + display_time; + } + UI::SameLine(); + UI::Text("with " + display_time + " of author time"); + } else { UI::Text("Open this plugin in the map editor"); }