Reorganization

This commit is contained in:
GreenComfyTea
2022-02-11 00:17:22 +02:00
parent 1c9174ca38
commit 2a2a5c3539
32 changed files with 3073 additions and 3343 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,110 +0,0 @@
local language = {};
local table_helpers;
language.current_language = {};
language.language_names = {};
language.languages = {};
language.language_folder = "MHR Overlay\\languages\\";
language.default_language = {
parts = {
head = "Head",
neck = "Neck",
body = "Body",
torso = "Torso",
abdomen = "Abdomen",
back = "Back",
tail = "Tail",
upper_body = "Upper Body",
lower_body = "Lower Body",
upper_back = "Upper Back",
lower_back = "Lower Back",
left_wing = "Wing L",
right_wing = "Wing R",
wings = "Wings",
left_leg = "Leg L",
right_leg = "Leg R",
legs = "Legs",
left_legs = "Legs L",
right_legs = "Legs R",
left_arm = "Arm L",
right_arm = "Arm R",
arms = "Arms",
left_arm_ice = "Arm L (Ice)",
right_arm_ice = "Arm R (Ice)",
left_cutwing = "Cutwing L",
right_cutwing = "Cutwing R",
head_mud = "Head (Mud)",
tail_mud = "Tail (Mud)",
tail_windsac = "Tail (Windsac)",
chest_windsac = "Chest (Windsac)",
back_windsac = "Back (Windsac)",
large_mudbulb = "Large Mudbulb",
mane = "Mane",
rear = "Rear",
claw = "Claw",
dorsal_fin = "Dorsal Fin",
carapace = "Carapace",
spinning = "Spinning",
rock = "Rock"
}
};
function language.load()
local language_files = fs.glob([[MHR Overlay\\languages\\.*json]]);
if language_files == nil then
return;
end
for i, language_file in ipairs(language_files) do
local language_name = language_file:gsub(language.language_folder, ""):gsub(".json", "");
-- v will be something like `my-cool-mod\config-file-1.json`;
local loaded_language = json.load_file(language.language_folder .. "en-us.json");
if loaded_language ~= nil then
log.info("[MHR Overlay] " .. language_name .. ".json loaded successfully");
table.insert(language.language_names, language_name);
table.insert(language.languages, loaded_language);
else
log.error("[MHR Overlay] Failed to load " .. language_name .. ".json");
end
end
end
function language.save_default()
-- save current config to disk, replacing any existing file
local success = json.dump_file(language.language_folder .. "en-us.json", language.default_language);
if success then
log.info('[MHR Overlay] en-us.json saved successfully');
else
log.error('[MHR Overlay] Failed to save en-us.json');
end
end
function language.update(index)
language.current_language = table_helpers.deep_copy(language.languages[index]);
end
function language.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language.save_default();
language.load();
end
return language;

View File

@@ -1,249 +0,0 @@
local damage_meter_UI = {};
local singletons;
local config;
local customization_menu;
local player;
local quest_status;
local screen;
local drawing;
damage_meter_UI.last_displayed_players = {};
function damage_meter_UI.draw()
if player.total.display.total_damage == 0 and config.current_config.damage_meter_UI.settings.hide_module_if_total_damage_is_zero then
return;
end
if singletons.lobby_manager == nil then
return;
end
if singletons.progress_manager == nil then
return;
end
-- myself player
local myself_player_info = singletons.lobby_manager:get_field("_myHunterInfo");
if myself_player_info == nil then
customization_menu.status = "No myself player info list";
return;
end
local myself_player_name = myself_player_info:get_field("_name");
if myself_player_name == nil then
customization_menu.status = "No myself player name";
return;
end
if quest_status.is_online then
player.myself_id = singletons.lobby_manager:get_field("_myselfQuestIndex");
if player.myself_id == nil then
customization_menu.status = "No myself player id";
return;
end
else
player.myself_id = singletons.lobby_manager:get_field("_myselfIndex");
if player.myself_id == nil then
customization_menu.status = "No myself player id";
return;
end
end
local myself_hunter_rank = singletons.progress_manager:call("get_HunterRank");
if myself_hunter_rank == nil then
customization_menu.status = "No myself hunter rank";
myself_hunter_rank = 0;
end
if player.list[player.myself_id] == nil then
player.list[player.myself_id] = player.new(player.myself_id, myself_player_name, myself_hunter_rank);
player.myself = player.list[player.myself_id];
end
local quest_players = {};
if quest_status.index > 2 then
quest_players = damage_meter_UI.last_displayed_players;
else
-- other players
local player_info_list = singletons.lobby_manager:get_field("_questHunterInfo");
if player_info_list == nil then
customization_menu.status = "No player info list";
end
local count = player_info_list:call("get_Count");
if count == nil then
customization_menu.status = "No player info list count";
return;
end
for i = 0, count - 1 do
local player_info = player_info_list:call("get_Item", i);
if player_info == nil then
goto continue
end
local player_id = player_info:get_field("_memberIndex");
if player_id == nil then
goto continue
end
local player_hunter_rank = player_info:get_field("_hunterRank");
if player_hunter_rank == nil then
goto continue
end
if player_id == player.myself_id and config.current_config.damage_meter_UI.settings.my_damage_bar_location ~= "Normal" then
player.list[player.myself_id].hunter_rank = player_hunter_rank;
goto continue
end
local player_name = player_info:get_field("_name");
if player_name == nil then
goto continue
end
if player.list[player_id] == nil then
player.list[player_id] = player.new(player_id, player_name, player_hunter_rank);
elseif player.list[player_id].name ~= player_name then
player.list[player_id] = player.new(player_id, player_name, player_hunter_rank);
end
table.insert(quest_players, player.list[player_id]);
::continue::
end
-- sort here
if config.current_config.damage_meter_UI.sorting.type == "Normal" and config.current_config.damage_meter_UI.sorting.reversed_order then
local reversed_quest_players = {};
for i = #quest_players, 1, -1 do
table.insert(reversed_quest_players, quest_players[i]);
end
quest_players = reversed_quest_players;
elseif config.current_config.damage_meter_UI.sorting.type == "Damage" then
if config.current_config.damage_meter_UI.sorting.reversed_order then
table.sort(quest_players, function(left, right)
return left.display.total_damage < right.display.total_damage;
end);
else
table.sort(quest_players, function(left, right)
return left.display.total_damage > right.display.total_damage;
end);
end
end
if config.current_config.damage_meter_UI.settings.my_damage_bar_location == "First" then
table.insert(quest_players, 1, player.list[player.myself_id]);
elseif config.current_config.damage_meter_UI.settings.my_damage_bar_location == "Last" then
table.insert(quest_players, #quest_players + 1, player.list[player.myself_id]);
elseif #quest_players == 0 then
table.insert(quest_players, 1, player.list[player.myself_id]);
end
damage_meter_UI.last_displayed_players = quest_players;
end
local top_damage = 0;
for _, _player in ipairs(quest_players) do
if _player.display.total_damage > top_damage then
top_damage = _player.display.total_damage;
end
end
-- draw
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.damage_meter_UI.position);
for _, _player in ipairs(quest_players) do
if _player.display.total_damage == 0 and config.current_config.damage_meter_UI.settings.hide_player_if_player_damage_is_zero then
goto continue1
end
local player_damage_percentage = 0;
if player.total.display.total_damage ~= 0 then
player_damage_percentage = _player.display.total_damage / player.total.display.total_damage;
end
local player_damage_bar_percentage = 0;
if config.current_config.damage_meter_UI.settings.damage_bar_relative_to == "Total Damage" then
if player.total.display.total_damage ~= 0 then
player_damage_bar_percentage = _player.display.total_damage / player.total.display.total_damage;
end
else
if top_damage ~= 0 then
player_damage_bar_percentage = _player.display.total_damage / top_damage;
end
end
if _player.id == player.myself_id and config.current_config.damage_meter_UI.settings.highlighted_bar == "Me" then
drawing.draw_bar(config.current_config.damage_meter_UI.highlighted_damage_bar, position_on_screen, player_damage_bar_percentage);
elseif config.current_config.damage_meter_UI.settings.highlighted_bar == "Top Damage" and _player.display.total_damage == top_damage then
drawing.draw_bar(config.current_config.damage_meter_UI.highlighted_damage_bar, position_on_screen, player_damage_bar_percentage);
else
drawing.draw_bar(config.current_config.damage_meter_UI.damage_bar, position_on_screen, player_damage_bar_percentage);
end
local player_include = config.current_config.damage_meter_UI.player_name_label.include.others;
if _player.id == player.myself_id then
player_include = config.current_config.damage_meter_UI.player_name_label.include.myself;
end
local player_name_text = "";
if player_include.hunter_rank then
player_name_text = string.format("[%d] ", _player.hunter_rank);
end
if player_include.word_player then
player_name_text = player_name_text .. "Player ";
end
if player_include.player_id then
player_name_text = player_name_text .. string.format("%d ", _player.id);
end
if player_include.player_name then
player_name_text = player_name_text .. _player.name;
end
drawing.draw_label(config.current_config.damage_meter_UI.player_name_label, position_on_screen, player_name_text);
drawing.draw_label(config.current_config.damage_meter_UI.damage_value_label, position_on_screen, _player.display.total_damage);
drawing.draw_label(config.current_config.damage_meter_UI.damage_percentage_label, position_on_screen, 100 * player_damage_percentage);
if config.current_config.damage_meter_UI.settings.orientation == "Horizontal" then
position_on_screen.x = position_on_screen.x + config.current_config.damage_meter_UI.spacing.x;
else
position_on_screen.y = position_on_screen.y + config.current_config.damage_meter_UI.spacing.y;
end
::continue1::
end
-- draw total damage
if not config.current_config.damage_meter_UI.settings.total_damage_offset_is_relative then
position_on_screen = screen.calculate_absolute_coordinates(config.current_config.damage_meter_UI.position);
end
drawing.draw_label(config.current_config.damage_meter_UI.total_damage_label, position_on_screen);
drawing.draw_label(config.current_config.damage_meter_UI.total_damage_value_label, position_on_screen, player.total.display.total_damage);
end
function damage_meter_UI.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
customization_menu = require("MHR_Overlay.UI.customization_menu");
player = require("MHR_Overlay.Damage_Meter.player");
quest_status = require("MHR_Overlay.Game_Handler.quest_status");
screen = require("MHR_Overlay.Game_Handler.screen");
drawing = require("MHR_Overlay.UI.drawing");
end
return damage_meter_UI;

View File

@@ -1,238 +0,0 @@
local large_monster_UI = {};
local singletons;
local config;
local customization_menu;
local large_monster;
local screen;
local player;
local drawing;
local table_helpers;
function large_monster_UI.draw()
if singletons.enemy_manager == nil then
return;
end
local displayed_monsters = {};
local enemy_count = singletons.enemy_manager:call("getBossEnemyCount");
if enemy_count == nil then
return;
end
for i = 0, enemy_count - 1 do
local enemy = singletons.enemy_manager:call("getBossEnemy", i);
if enemy == nil then
customization_menu.status = "No enemy";
break
end
local monster = large_monster.list[enemy];
if monster == nil then
customization_menu.status = "No monster hp entry";
break
end
table.insert(displayed_monsters, monster);
end
if not config.current_config.large_monster_UI.dynamic_positioning.enabled then
-- sort here
if config.current_config.large_monster_UI.sorting.type == "Normal" and config.current_config.large_monster_UI.sorting.reversed_order then
local reversed_monsters = {};
for i = #displayed_monsters, 1, -1 do
table.insert(reversed_monsters, displayed_monsters[i]);
end
displayed_monsters = reversed_monsters;
elseif config.current_config.large_monster_UI.sorting.type == "Health" then
if config.current_config.large_monster_UI.sorting.reversed_order then
table.sort(displayed_monsters, function(left, right)
return left.health > right.health;
end);
else
table.sort(displayed_monsters, function(left, right)
return left.health < right.health;
end);
end
elseif config.current_config.large_monster_UI.sorting.type == "Health Percentage" then
if config.current_config.large_monster_UI.sorting.reversed_order then
table.sort(displayed_monsters, function(left, right)
return left.health_percentage > right.health_percentage;
end);
else
table.sort(displayed_monsters, function(left, right)
return left.health_percentage < right.health_percentage;
end);
end
end
end
local i = 0;
for _, monster in ipairs(displayed_monsters) do
local position_on_screen;
if config.current_config.large_monster_UI.dynamic_positioning.enabled then
local world_offset = Vector3f.new(config.current_config.large_monster_UI.dynamic_positioning.world_offset.x, config.current_config.large_monster_UI.dynamic_positioning.world_offset.y, config.current_config.large_monster_UI.dynamic_positioning.world_offset.z);
position_on_screen = draw.world_to_screen(monster.position + world_offset);
if position_on_screen == nil then
goto continue
end
position_on_screen.x = position_on_screen.x + config.current_config.large_monster_UI.dynamic_positioning.viewport_offset.x;
position_on_screen.y = position_on_screen.y + config.current_config.large_monster_UI.dynamic_positioning.viewport_offset.y;
else
position_on_screen = screen.calculate_absolute_coordinates(config.current_config.large_monster_UI.position);
if config.current_config.large_monster_UI.settings.orientation == "Horizontal" then
position_on_screen.x = position_on_screen.x + config.current_config.large_monster_UI.spacing.x * i;
else
position_on_screen.y = position_on_screen.y + config.current_config.large_monster_UI.spacing.y * i;
end
end
local monster_name_label = config.current_config.large_monster_UI.monster_name_label;
local health_bar = table_helpers.deep_copy(config.current_config.large_monster_UI.health.bar);
local health_label = config.current_config.large_monster_UI.health.text_label;
local health_value_label = config.current_config.large_monster_UI.health.value_label;
local health_percentage_label = config.current_config.large_monster_UI.health.percentage_label;
local stamina_bar = config.current_config.large_monster_UI.stamina.bar;
local stamina_label = config.current_config.large_monster_UI.stamina.text_label;
local stamina_value_label = config.current_config.large_monster_UI.stamina.value_label;
local stamina_percentage_label = config.current_config.large_monster_UI.stamina.percentage_label;
local rage_bar = config.current_config.large_monster_UI.rage.bar;
local rage_label = config.current_config.large_monster_UI.rage.text_label;
local rage_value_label = table_helpers.deep_copy(config.current_config.large_monster_UI.rage.value_label);
local rage_percentage_label = table_helpers.deep_copy(config.current_config.large_monster_UI.rage.percentage_label);
if monster.health <= monster.capture_health then
health_bar.colors = health_bar.colors.capture;
end
local monster_name_text = "";
if config.current_config.large_monster_UI.monster_name_label.include.monster_name then
monster_name_text = string.format("%s ", monster.name);
end
if config.current_config.large_monster_UI.monster_name_label.include.crown and monster.crown ~= "" then
monster_name_text = monster_name_text .. string.format("%s ", monster.crown);
end
if config.current_config.large_monster_UI.monster_name_label.include.size then
monster_name_text = monster_name_text .. string.format("#%.0f ", 100 * monster.size);
end
if config.current_config.large_monster_UI.monster_name_label.include.scrown_thresholds then
monster_name_text = monster_name_text .. string.format("<=%.0f >=%.0f >=%.0f", 100 * monster.small_border,
100 * monster.big_border, 100 * monster.king_border);
end
local rage_bar_percentage = monster.rage_percentage;
if monster.is_in_rage then
rage_bar_percentage = monster.rage_timer_percentage;
end
if config.current_config.large_monster_UI.dynamic_positioning.enabled then
if config.current_config.large_monster_UI.dynamic_positioning.max_distance == 0 then
return;
end
local distance = (player.myself_position - monster.position):length();
if distance > config.current_config.large_monster_UI.dynamic_positioning.max_distance then
goto continue;
end
if config.current_config.large_monster_UI.dynamic_positioning.opacity_falloff then
local opacity_falloff = 1 - (distance / config.current_config.large_monster_UI.dynamic_positioning.max_distance);
monster_name_label = table_helpers.deep_copy(config.current_config.large_monster_UI.monster_name_label);
health_label = table_helpers.deep_copy(config.current_config.large_monster_UI.health.text_label);
health_value_label = table_helpers.deep_copy(config.current_config.large_monster_UI.health.value_label);
health_percentage_label = table_helpers.deep_copy(config.current_config.large_monster_UI.health.percentage_label);
stamina_bar = table_helpers.deep_copy(config.current_config.large_monster_UI.stamina.bar);
stamina_label = table_helpers.deep_copy(config.current_config.large_monster_UI.stamina.text_label);
stamina_value_label = table_helpers.deep_copy(config.current_config.large_monster_UI.stamina.value_label);
stamina_percentage_label = table_helpers.deep_copy(config.current_config.large_monster_UI.stamina.percentage_label);
rage_bar = table_helpers.deep_copy(config.current_config.large_monster_UI.rage.bar);
rage_label = table_helpers.deep_copy(config.current_config.large_monster_UI.rage.text_label);
drawing.scale_label_opacity(monster_name_label, opacity_falloff);
drawing.scale_bar_opacity(health_bar, opacity_falloff);
drawing.scale_label_opacity(health_label, opacity_falloff);
drawing.scale_label_opacity(health_value_label, opacity_falloff);
drawing.scale_label_opacity(health_percentage_label, opacity_falloff);
drawing.scale_bar_opacity(stamina_bar, opacity_falloff);
drawing.scale_label_opacity(stamina_label, opacity_falloff);
drawing.scale_label_opacity(stamina_value_label, opacity_falloff);
drawing.scale_label_opacity(stamina_percentage_label, opacity_falloff);
drawing.scale_bar_opacity(rage_bar, opacity_falloff);
drawing.scale_label_opacity(rage_label, opacity_falloff);
drawing.scale_label_opacity(rage_value_label, opacity_falloff);
drawing.scale_label_opacity(rage_percentage_label, opacity_falloff);
end
end
if monster.is_in_rage then
rage_value_label.visibility = false;
rage_percentage_label.text = "%.0f:%04.1f";
end
drawing.draw_bar(health_bar, position_on_screen, monster.health_percentage);
drawing.draw_bar(stamina_bar, position_on_screen, monster.stamina_percentage);
drawing.draw_bar(rage_bar, position_on_screen, rage_bar_percentage);
drawing.draw_label(monster_name_label, position_on_screen, monster_name_text);
drawing.draw_label(health_label, position_on_screen);
drawing.draw_label(health_value_label, position_on_screen, monster.health, monster.max_health);
drawing.draw_label(health_percentage_label, position_on_screen, 100 * monster.health_percentage);
drawing.draw_label(stamina_label, position_on_screen);
drawing.draw_label(stamina_value_label, position_on_screen, monster.stamina, monster.max_stamina);
drawing.draw_label(stamina_percentage_label, position_on_screen, 100 * monster.stamina_percentage);
drawing.draw_label(rage_label, position_on_screen);
drawing.draw_label(rage_value_label, position_on_screen, monster.rage_point, monster.rage_limit);
if monster.is_in_rage then
drawing.draw_label(rage_percentage_label, position_on_screen, monster.rage_minutes_left, monster.rage_seconds_left);
else
drawing.draw_label(rage_percentage_label, position_on_screen, 100 * monster.rage_percentage);
end
i = i + 1;
::continue::
end
end
function large_monster_UI.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
customization_menu = require("MHR_Overlay.UI.customization_menu");
large_monster = require("MHR_Overlay.Monsters.large_monster");
screen = require("MHR_Overlay.Game_Handler.screen");
player = require("MHR_Overlay.Damage_Meter.player");
drawing = require("MHR_Overlay.UI.drawing");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
end
return large_monster_UI;

View File

@@ -1,181 +0,0 @@
local small_monster_UI = {};
local singletons;
local config;
local small_monster;
local customization_menu;
local screen;
local player;
local drawing;
local table_helpers;
function small_monster_UI.draw()
if singletons.enemy_manager == nil then
return;
end
local displayed_monsters = {};
local enemy_count = singletons.enemy_manager:call("getZakoEnemyCount");
if enemy_count == nil then
customization_menu.status = "No enemy count";
return;
end
for i = 0, enemy_count - 1 do
local enemy = singletons.enemy_manager:call("getZakoEnemy", i);
if enemy == nil then
customization_menu.status = "No enemy";
break
end
local monster = small_monster.list[enemy];
if monster == nil then
customization_menu.status = "No monster hp entry";
break
end
table.insert(displayed_monsters, monster);
end
if not config.current_config.small_monster_UI.dynamic_positioning.enabled then
-- sort here
if config.current_config.small_monster_UI.sorting.type == "Normal" and config.current_config.small_monster_UI.sorting.reversed_order then
local reversed_monsters = {};
for i = #displayed_monsters, 1, -1 do
table.insert(reversed_monsters, displayed_monsters[i]);
end
displayed_monsters = reversed_monsters;
elseif config.current_config.small_monster_UI.sorting.type == "Health" then
if config.current_config.small_monster_UI.sorting.reversed_order then
table.sort(displayed_monsters, function(left, right)
return left.health > right.health;
end);
else
table.sort(displayed_monsters, function(left, right)
return left.health < right.health;
end);
end
elseif config.current_config.small_monster_UI.sorting.type == "Health Percentage" then
if config.current_config.small_monster_UI.sorting.reversed_order then
table.sort(displayed_monsters, function(left, right)
return left.health_percentage > right.health_percentage;
end);
else
table.sort(displayed_monsters, function(left, right)
return left.health_percentage < right.health_percentage;
end);
end
end
end
x = "";
local i = 0;
for _, monster in ipairs(displayed_monsters) do
local position_on_screen;
if config.current_config.small_monster_UI.dynamic_positioning.enabled then
local world_offset = Vector3f.new(config.current_config.small_monster_UI.dynamic_positioning.world_offset.x, config.current_config.small_monster_UI.dynamic_positioning.world_offset.y, config.current_config.small_monster_UI.dynamic_positioning.world_offset.z);
position_on_screen = draw.world_to_screen(monster.position + world_offset);
if position_on_screen == nil then
goto continue
end
position_on_screen.x = position_on_screen.x + config.current_config.small_monster_UI.dynamic_positioning.viewport_offset.x;
position_on_screen.y = position_on_screen.y + config.current_config.small_monster_UI.dynamic_positioning.viewport_offset.y;
else
position_on_screen = screen.calculate_absolute_coordinates(config.current_config.small_monster_UI.position);
if config.current_config.small_monster_UI.settings.orientation == "Horizontal" then
position_on_screen.x = position_on_screen.x + config.current_config.small_monster_UI.spacing.x * i;
else
position_on_screen.y = position_on_screen.y + config.current_config.small_monster_UI.spacing.y * i;
end
end
local monster_name_label = config.current_config.small_monster_UI.monster_name_label;
local health_bar = config.current_config.small_monster_UI.health.bar;
local health_label = config.current_config.small_monster_UI.health.text_label;
local health_value_label = config.current_config.small_monster_UI.health.value_label;
local health_percentage_label = config.current_config.small_monster_UI.health.percentage_label;
local stamina_bar = config.current_config.small_monster_UI.stamina.bar;
local stamina_label = config.current_config.small_monster_UI.stamina.text_label;
local stamina_value_label = config.current_config.small_monster_UI.stamina.value_label;
local stamina_percentage_label = config.current_config.small_monster_UI.stamina.percentage_label;
if config.current_config.small_monster_UI.dynamic_positioning.enabled then
if config.current_config.small_monster_UI.dynamic_positioning.max_distance == 0 then
return;
end
local distance = (player.myself_position - monster.position):length();
if distance > config.current_config.small_monster_UI.dynamic_positioning.max_distance then
goto continue;
end
if config.current_config.small_monster_UI.dynamic_positioning.opacity_falloff then
local opacity_falloff = 1 - (distance / config.current_config.small_monster_UI.dynamic_positioning.max_distance);
monster_name_label = table_helpers.deep_copy(config.current_config.small_monster_UI.monster_name_label);
health_bar = table_helpers.deep_copy(config.current_config.small_monster_UI.health.bar);
health_label = table_helpers.deep_copy(config.current_config.small_monster_UI.health.text_label);
health_value_label = table_helpers.deep_copy(config.current_config.small_monster_UI.health.value_label);
health_percentage_label = table_helpers.deep_copy(config.current_config.small_monster_UI.health.percentage_label);
stamina_bar = table_helpers.deep_copy(config.current_config.small_monster_UI.stamina.bar);
stamina_label = table_helpers.deep_copy(config.current_config.small_monster_UI.stamina.text_label);
stamina_value_label = table_helpers.deep_copy(config.current_config.small_monster_UI.stamina.value_label);
stamina_percentage_label = table_helpers.deep_copy(config.current_config.small_monster_UI.stamina.percentage_label);
drawing.scale_bar_opacity(health_bar, opacity_falloff);
drawing.scale_bar_opacity(stamina_bar, opacity_falloff)
drawing.scale_label_opacity(monster_name_label, opacity_falloff);
drawing.scale_label_opacity(health_label, opacity_falloff);
drawing.scale_label_opacity(health_value_label, opacity_falloff);
drawing.scale_label_opacity(health_percentage_label, opacity_falloff);
drawing.scale_label_opacity(stamina_label, opacity_falloff);
drawing.scale_label_opacity(stamina_value_label, opacity_falloff);
drawing.scale_label_opacity(stamina_percentage_label, opacity_falloff);
end
end
drawing.draw_bar(health_bar, position_on_screen, monster.health_percentage);
drawing.draw_bar(stamina_bar, position_on_screen, monster.stamina_percentage);
drawing.draw_label(monster_name_label, position_on_screen, monster.name);
drawing.draw_label(health_label, position_on_screen);
drawing.draw_label(health_value_label, position_on_screen, monster.health, monster.max_health);
drawing.draw_label(health_percentage_label, position_on_screen, 100 * monster.health_percentage);
drawing.draw_label(stamina_label, position_on_screen);
drawing.draw_label(stamina_value_label, position_on_screen, monster.stamina, monster.max_stamina);
drawing.draw_label(stamina_percentage_label, position_on_screen, 100 * monster.stamina_percentage);
i = i + 1;
::continue::
end
end
function small_monster_UI.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
config = require("MHR_Overlay.Misc.config");
customization_menu = require("MHR_Overlay.UI.customization_menu");
small_monster = require("MHR_Overlay.Monsters.small_monster");
screen = require("MHR_Overlay.Game_Handler.screen");
player = require("MHR_Overlay.Damage_Meter.player");
drawing = require("MHR_Overlay.UI.drawing");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
end
return small_monster_UI;

View File

@@ -1,46 +0,0 @@
local time_UI = {};
local singletons;
local customization_menu;
local screen;
local config;
local drawing;
function time_UI.draw()
if singletons.quest_manager == nil then
return;
end
local quest_time_elapsed_minutes = singletons.quest_manager:call("getQuestElapsedTimeMin");
if quest_time_elapsed_minutes == nil then
customization_menu.status = "No quest time elapsed minutes";
return;
end
local quest_time_total_elapsed_seconds = singletons.quest_manager:call("getQuestElapsedTimeSec");
if quest_time_total_elapsed_seconds == nil then
customization_menu.status = "No quest time total elapsed seconds";
return;
end
if quest_time_total_elapsed_seconds == 0 then
return;
end
local quest_time_elapsed_seconds = quest_time_total_elapsed_seconds - quest_time_elapsed_minutes * 60;
local position_on_screen = screen.calculate_absolute_coordinates(config.current_config.time_UI.position);
drawing.draw_label(config.current_config.time_UI.time_label, position_on_screen, quest_time_elapsed_minutes, quest_time_elapsed_seconds);
end
function time_UI.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu");
screen = require("MHR_Overlay.Game_Handler.screen");
config = require("MHR_Overlay.Misc.config");
drawing = require("MHR_Overlay.UI.drawing");
end
return time_UI;

View File

@@ -1,164 +1,165 @@
x = "";
local quest_status = require("MHR_Overlay.Game_Handler.quest_status");
local screen = require("MHR_Overlay.Game_Handler.screen");
local singletons = require("MHR_Overlay.Game_Handler.singletons");
local config = require("MHR_Overlay.Misc.config");
local language = require("MHR_Overlay.Misc.language");
local table_helpers = require("MHR_Overlay.Misc.table_helpers");
local part_names = require("MHR_Overlay.Misc.part_names");
local player = require("MHR_Overlay.Damage_Meter.player");
local damage_hook = require("MHR_Overlay.Damage_Meter.damage_hook");
local body_part = require("MHR_Overlay.Monsters.body_part");
local large_monster = require("MHR_Overlay.Monsters.large_monster");
local monster_hook = require("MHR_Overlay.Monsters.monster_hook");
local small_monster = require("MHR_Overlay.Monsters.small_monster");
local damage_meter_UI = require("MHR_Overlay.UI.Modules.damage_meter_UI");
local large_monster_UI = require("MHR_Overlay.UI.Modules.large_monster_UI");
local small_monster_UI = require("MHR_Overlay.UI.Modules.small_monster_UI");
local time_UI = require("MHR_Overlay.UI.Modules.time_UI");
local body_part_UI_entity = require("MHR_Overlay.UI.UI_Entities.body_part_UI_entity");
local damage_UI_entity = require("MHR_Overlay.UI.UI_Entities.damage_UI_entity");
local health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
local stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
local rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
local customization_menu = require("MHR_Overlay.UI.customization_menu");
local drawing = require("MHR_Overlay.UI.drawing");
------------------------INIT MODULES-------------------------
-- #region
screen.init_module();
singletons.init_module();
table_helpers.init_module();
language.init_module();
config.init_module();
quest_status.init_module();
part_names.init_module();
damage_UI_entity.init_module();
health_UI_entity.init_module();
stamina_UI_entity.init_module();
rage_UI_entity.init_module();
damage_hook.init_module();
player.init_module();
body_part.init_module();
large_monster.init_module();
monster_hook.init_module();
small_monster.init_module();
customization_menu.init_module();
body_part_UI_entity.init_module();
damage_meter_UI.init_module();
drawing.init_module();
large_monster_UI.init_module();
small_monster_UI.init_module();
time_UI.init_module();
log.info("[MHR Overlay] loaded");
-- #endregion
------------------------INIT MODULES-------------------------
--------------------------RE_IMGUI---------------------------
-- #region
re.on_draw_ui(function()
if imgui.button("MHR Overlay " .. config.current_config.version) then
customization_menu.is_opened = not customization_menu.is_opened;
end
end);
re.on_frame(function()
if not reframework:is_drawing_ui() then
customization_menu.is_opened = false;
end
if customization_menu.is_opened then
pcall(customization_menu.draw);
end
end);
re.on_frame(function()
--draw.text("x: " .. tostring(x), 450, 50, 0xFFFFFFFF);
end);
-- #endregion
--------------------------RE_IMGUI---------------------------
----------------------------D2D------------------------------
-- #region
d2d.register(function()
drawing.init_font();
end, function()
customization_menu.status = "OK";
screen.update_window_size();
singletons.init();
player.update_myself_position();
quest_status.update_is_online();
if quest_status.index < 2 then
quest_status.update_is_training_area();
if quest_status.is_training_area then
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.training_area.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.training_area.large_monster_static_UI;
if dynamic_enabled or static_enabled then
large_monster_UI.draw(dynamic_enabled, static_enabled);
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.training_area.damage_meter_UI then
damage_meter_UI.draw();
end
end
elseif quest_status.index == 2 then
if config.current_config.small_monster_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.small_monster_UI then
small_monster_UI.draw();
end
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.during_quest.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.during_quest.large_monster_static_UI;
if dynamic_enabled or static_enabled then
large_monster_UI.draw(dynamic_enabled, static_enabled);
end
if config.current_config.time_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.time_UI then
time_UI.draw();
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.damage_meter_UI then
damage_meter_UI.draw();
end
elseif quest_status.index > 2 then
if config.current_config.small_monster_UI.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.small_monster_UI then
small_monster_UI.draw();
end
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.large_monster_static_UI;
if dynamic_enabled or static_enabled then
large_monster_UI.draw(dynamic_enabled, static_enabled);
end
if config.current_config.time_UI.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.time_UI then
time_UI.draw();
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.damage_meter_UI then
damage_meter_UI.draw();
end
end
end);
x = "";
local quest_status = require("MHR_Overlay.Game_Handler.quest_status");
local screen = require("MHR_Overlay.Game_Handler.screen");
local singletons = require("MHR_Overlay.Game_Handler.singletons");
local config = require("MHR_Overlay.Misc.config");
local language = require("MHR_Overlay.Misc.language");
local table_helpers = require("MHR_Overlay.Misc.table_helpers");
local part_names = require("MHR_Overlay.Misc.part_names");
local player = require("MHR_Overlay.Damage_Meter.player");
local damage_hook = require("MHR_Overlay.Damage_Meter.damage_hook");
local body_part = require("MHR_Overlay.Monsters.body_part");
local large_monster = require("MHR_Overlay.Monsters.large_monster");
local monster_hook = require("MHR_Overlay.Monsters.monster_hook");
local small_monster = require("MHR_Overlay.Monsters.small_monster");
local damage_meter_UI = require("MHR_Overlay.UI.Modules.damage_meter_UI");
local large_monster_UI = require("MHR_Overlay.UI.Modules.large_monster_UI");
local small_monster_UI = require("MHR_Overlay.UI.Modules.small_monster_UI");
local time_UI = require("MHR_Overlay.UI.Modules.time_UI");
local body_part_UI_entity = require("MHR_Overlay.UI.UI_Entities.body_part_UI_entity");
local damage_UI_entity = require("MHR_Overlay.UI.UI_Entities.damage_UI_entity");
local health_UI_entity = require("MHR_Overlay.UI.UI_Entities.health_UI_entity");
local stamina_UI_entity = require("MHR_Overlay.UI.UI_Entities.stamina_UI_entity");
local rage_UI_entity = require("MHR_Overlay.UI.UI_Entities.rage_UI_entity");
local customization_menu = require("MHR_Overlay.UI.customization_menu");
local drawing = require("MHR_Overlay.UI.drawing");
------------------------INIT MODULES-------------------------
-- #region
screen.init_module();
singletons.init_module();
table_helpers.init_module();
language.init_module();
config.init_module();
quest_status.init_module();
part_names.init_module();
damage_UI_entity.init_module();
health_UI_entity.init_module();
stamina_UI_entity.init_module();
rage_UI_entity.init_module();
damage_hook.init_module();
player.init_module();
body_part.init_module();
large_monster.init_module();
monster_hook.init_module();
small_monster.init_module();
customization_menu.init_module();
body_part_UI_entity.init_module();
damage_meter_UI.init_module();
drawing.init_module();
large_monster_UI.init_module();
small_monster_UI.init_module();
time_UI.init_module();
log.info("[MHR Overlay] loaded");
-- #endregion
------------------------INIT MODULES-------------------------
--------------------------RE_IMGUI---------------------------
-- #region
re.on_draw_ui(function()
if imgui.button(language.current_language.customization_menu.mod_name .. " " .. config.current_config.version) then
customization_menu.is_opened = not customization_menu.is_opened;
end
end);
re.on_frame(function()
if not reframework:is_drawing_ui() then
customization_menu.is_opened = false;
end
if customization_menu.is_opened then
pcall(customization_menu.draw);
end
end);
re.on_frame(function()
--draw.text("x: " .. tostring(x), 451, 51, 0xFF000000);
--draw.text("x: " .. tostring(x), 450, 50, 0xFFFFFFFF);
end);
-- #endregion
--------------------------RE_IMGUI---------------------------
----------------------------D2D------------------------------
-- #region
d2d.register(function()
drawing.init_font();
end, function()
customization_menu.status = "OK";
screen.update_window_size();
singletons.init();
player.update_myself_position();
quest_status.update_is_online();
if quest_status.index < 2 then
quest_status.update_is_training_area();
if quest_status.is_training_area then
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.training_area.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.training_area.large_monster_static_UI;
if dynamic_enabled or static_enabled then
large_monster_UI.draw(dynamic_enabled, static_enabled);
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.training_area.damage_meter_UI then
damage_meter_UI.draw();
end
end
elseif quest_status.index == 2 then
if config.current_config.small_monster_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.small_monster_UI then
small_monster_UI.draw();
end
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.during_quest.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.during_quest.large_monster_static_UI;
if dynamic_enabled or static_enabled then
large_monster_UI.draw(dynamic_enabled, static_enabled);
end
if config.current_config.time_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.time_UI then
time_UI.draw();
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.during_quest.damage_meter_UI then
damage_meter_UI.draw();
end
elseif quest_status.index > 2 then
if config.current_config.small_monster_UI.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.small_monster_UI then
small_monster_UI.draw();
end
local dynamic_enabled = config.current_config.large_monster_UI.dynamic.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.large_monster_dynamic_UI;
local static_enabled = config.current_config.large_monster_UI.static.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.large_monster_static_UI;
if dynamic_enabled or static_enabled then
large_monster_UI.draw(dynamic_enabled, static_enabled);
end
if config.current_config.time_UI.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.time_UI then
time_UI.draw();
end
if config.current_config.damage_meter_UI.enabled and config.current_config.global_settings.module_visibility.quest_summary_screen.damage_meter_UI then
damage_meter_UI.draw();
end
end
end);

View File

@@ -246,7 +246,7 @@ function player.update_myself_position()
local master_player_position = get_position_method:call(master_player_transform);
if master_player_position == nil then
customization_menu.status = "No masterplayer position";
customization_menu.status = "No master player position";
return;
end

View File

@@ -4,6 +4,7 @@ local customization_menu;
local player;
local small_monster;
local large_monster;
local damage_meter_UI;
quest_status.index = 0;
quest_status.is_online = false;
@@ -25,6 +26,7 @@ sdk.hook(on_changed_game_status, function(args)
player.total = player.new(0, "Total", 0);
small_monster.list = {};
large_monster.list = {};
damage_meter_UI.freeze_displayed_players = false;
end
quest_status.index = new_quest_status;
@@ -60,6 +62,10 @@ function quest_status.update_is_online()
return;
end
if quest_status.is_online and not is_quest_online then
damage_meter_UI.freeze_displayed_players = true;
end
quest_status.is_online = is_quest_online;
end
@@ -83,6 +89,7 @@ function quest_status.init_module()
player = require("MHR_Overlay.Damage_Meter.player");
small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster");
damage_meter_UI = require("MHR_Overlay.UI.Modules.damage_meter_UI");
quest_status.init();
end

View File

@@ -16,20 +16,24 @@ function screen.update_window_size()
end
function screen.calculate_absolute_coordinates(position)
-- top left
if position.anchor == "Top-Left" then
return {x = position.x, y = position.y};
end
-- top right
if position.anchor == "Top-Right" then
local screen_x = screen.width - position.x;
return {x = screen_x, y = position.y};
end
-- bottom left
if position.anchor == "Bottom-Left" then
local screen_y = screen.height - position.y;
return {x = position.x, y = screen_y};
end
-- bottom right
if position.anchor == "Bottom-Right" then
local screen_x = screen.width - position.x;
local screen_y = screen.height - position.y;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,277 @@
local language = {};
local table_helpers;
language.language_folder = "MHR Overlay\\languages\\";
language.default_language = {
parts = {
head = "Head",
neck = "Neck",
body = "Body",
torso = "Torso",
abdomen = "Abdomen",
back = "Back",
tail = "Tail",
upper_body = "Upper Body",
lower_body = "Lower Body",
upper_back = "Upper Back",
lower_back = "Lower Back",
left_wing = "Wing L",
right_wing = "Wing R",
wings = "Wings",
left_leg = "Leg L",
right_leg = "Leg R",
legs = "Legs",
left_legs = "Legs L",
right_legs = "Legs R",
left_arm = "Arm L",
right_arm = "Arm R",
arms = "Arms",
left_arm_ice = "Arm L (Ice)",
right_arm_ice = "Arm R (Ice)",
left_cutwing = "Cutwing L",
right_cutwing = "Cutwing R",
head_mud = "Head (Mud)",
tail_mud = "Tail (Mud)",
tail_windsac = "Tail (Windsac)",
chest_windsac = "Chest (Windsac)",
back_windsac = "Back (Windsac)",
large_mudbulb = "Large Mudbulb",
mane = "Mane",
rear = "Rear",
claw = "Claw",
dorsal_fin = "Dorsal Fin",
carapace = "Carapace",
spinning = "Spinning",
rock = "Rock"
},
UI = {
HP = "HP:",
stamina = "Stamina:",
rage = "Rage:",
gold = "Gold",
silver = "Silver",
mini = "Mini"
},
customization_menu = {
mod_name = "MHR Overlay";
status = "Status",
modules = "Modules",
global_settings = "Global Settings",
small_monster_UI = "Small Monster UI",
large_monster_UI = "Large Monster UI",
time_UI = "Time UI",
damage_meter_UI = "Damage Meter UI",
large_monster_dynamic_UI = "Large Monster Dynamic UI",
large_monster_static_UI = "Large Monster Static UI",
language = "Language",
module_visibility_on_different_screens = "Module Visibility on Different Screens",
during_quest = "During Quest",
quest_summary_screen = "Quest Summary Screen",
training_area = "Training Area",
performance = "Performance",
max_monster_updates_per_tick = "Max Monster Updates per Tick",
prioritize_large_monsters = "Large Monsters on High Priority";
font_notice = "Any changes to the font require script reload!",
font = "Font",
family = "Family",
size = "Size",
bold = "Bold",
italic = "Italic",
enabled = "Enabled",
settings = "Settings",
dynamic_positioning = "Dynamic Positioning",
static_position = "Static Position",
static_spacing = "Static Spacing",
static_sorting = "Static Sorting",
monster_name_label = "Monster Name Label",
health = "Health",
stamina = "Stamina",
static_orientation = "Static Orientation",
opacity_falloff = "Opacity Falloff",
max_distance = "Max Distance",
world_offset = "World Offset",
viewport_offset = "Viewport Offset",
x = "X",
y = "Y",
z = "Z",
anchor = "Anchor",
top_left = "Top-Left",
top_right = "Top-Right",
bottom_left = "Bottom-Left",
bottom_right = "Bottom-Right",
type = "Type",
normal = "Normal",
health_percentage = "Health Percentage",
distance = "Distance",
reversed_order = "Reversed Order",
visible = "Visible",
offset = "Offset",
color = "Color",
colors = "Colors",
shadow = "Shadow",
text_label = "Text Label",
value_label = "Value Label",
percentage_label = "Percentage Label",
bar = "Bar",
width = "Width",
height = "Height",
foreground = "Foreground",
background = "Background",
dynamically_positioned = "Dynamically Positioned",
statically_positioned = "Statically Positioned",
include = "Include",
monster_name = "Monster Name",
crown = "Crown",
crown_thresholds = "Crown Thresholds",
rage = "Rage",
body_parts = "Body Parts",
hide_undamaged_parts = "Hide Undamaged Parts",
part_name = "Part Name",
break_count = "Break Count",
orientation = "Orientation",
horizontal = "Horizontal",
vertical = "Vertical",
position = "Position",
spacing = "Spacing",
sorting = "Sorting",
part_name_label = "Part Name Label",
time_label = "Time Label",
tracked_monster_types = "Tracked Monster Types",
tracked_damage_types = "Tracked Damage Types",
player_name_label = "Player Name Label",
damage_value_label = "Damage Value Label",
damage_percentage_label = "Damage Percetange Label",
total_damage_label = "Total Damage Label",
total_damage_value_label = "Total Damage Value Label",
damage_bar = "Damage Bar",
highlighted_damage_bar = "Highlighted Damage Bar",
monster_can_be_captured = "Monster can be captured",
hide_module_if_total_damage_is_zero = "Hide Module if Total Damage is 0",
hide_player_if_player_damage_is_zero = "Hide Player if Player Damage is 0",
hide_total_if_total_damage_is_zero = "Hide Total if Total Damage is 0",
total_damage_offset_is_relative = "Total Damage Offset is Relative",
higlighted_bar = "Highlighted Bar",
me = "Me",
top_damage = "Top Damage",
none = "None",
damage_bars_are_relative_to = "Damage Bars are relative to",
total_damage = "Total Damage",
my_damage_bar_location = "My Damage Bar Location",
first = "First",
last = "Last",
small_monsters = "Small Monsters",
large_monsters = "Large Monsters",
player_damage = "Player Damage",
bomb_damage = "Bomb Damage",
kunai_damage = "Kunai Damage",
installation_damage = "Installation Damage",
otomo_damage = "Otomo Damage",
monster_damage = "Monster Damage",
damage = "Damage",
other_players = "Other Players",
hunter_rank = "Hunter Rank",
word_player = "Word \"Player\"";
player_id = "Player ID",
player_name = "Player Name",
}
};
language.current_language = {};
language.language_names = {"default"};
language.languages = {language.default_language};
function language.load()
local language_files = fs.glob([[MHR Overlay\\languages\\.*json]]);
if language_files == nil then
return;
end
for i, language_file in ipairs(language_files) do
local language_name = language_file:gsub(language.language_folder, ""):gsub(".json", "");
-- v will be something like `my-cool-mod\config-file-1.json`;
local loaded_language = json.load_file(language_file);
if loaded_language ~= nil then
log.info("[MHR Overlay] " .. language_name .. ".json loaded successfully");
table.insert(language.language_names, language_name);
table.insert(language.languages, loaded_language);
else
log.error("[MHR Overlay] Failed to load " .. language_name .. ".json");
end
end
end
function language.save_default()
-- save current config to disk, replacing any existing file
local success = json.dump_file(language.language_folder .. "en-us.json", language.default_language);
if success then
log.info('[MHR Overlay] en-us.json saved successfully');
else
log.error('[MHR Overlay] Failed to save en-us.json');
end
end
function language.update(index)
language.current_language = table_helpers.deep_copy(language.languages[index]);
end
function language.init_module()
table_helpers = require("MHR_Overlay.Misc.table_helpers");
language.save_default();
language.load();
language.current_language = table_helpers.deep_copy(language.default_language);
end
return language;

View File

@@ -2,12 +2,14 @@ local large_monster = {};
local singletons;
local customization_menu;
local config;
local language;
local table_helpers;
local health_UI_entity;
local stamina_UI_entity;
local rage_UI_entity;
local screen;
local drawing;
local body_part;
local part_names;
@@ -74,8 +76,23 @@ function large_monster.get_monster(enemy)
return large_monster.list[enemy];
end
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_type_field = enemy_character_base_type_def:get_field("<EnemyType>k__BackingField");
local get_monster_list_register_scale_method = enemy_character_base_type_def:get_method("get_MonsterListRegisterScale");
local message_manager_type_def = sdk.find_type_definition("snow.gui.MessageManager");
local get_enemy_name_message_method = message_manager_type_def:get_method("getEnemyNameMessage");
local enemy_manager_type_def = sdk.find_type_definition("snow.enemy.EnemyManager");
local find_enemy_size_info_method = enemy_manager_type_def:get_method("findEnemySizeInfo");
local size_info_type = find_enemy_size_info_method:get_return_type();
local get_small_border_method = size_info_type:get_method("get_SmallBorder");
local get_big_border_method = size_info_type:get_method("get_BigBorder");
local get_king_border_method = size_info_type:get_method("get_KingBorder");
function large_monster.init(monster, enemy)
local enemy_type = enemy:get_field("<EnemyType>k__BackingField");
local enemy_type = enemy_type_field:get_data(enemy);
if enemy_type == nil then
customization_menu.status = "No enemy type";
return;
@@ -83,18 +100,18 @@ function large_monster.init(monster, enemy)
monster.id = enemy_type;
local enemy_name = singletons.message_manager:call("getEnemyNameMessage", enemy_type);
local enemy_name = get_enemy_name_message_method:call(singletons.message_manager, enemy_type);
if enemy_name ~= nil then
monster.name = enemy_name;
end
local size_info = singletons.enemy_manager:call("findEnemySizeInfo", enemy_type);
local size_info = find_enemy_size_info_method:call(singletons.enemy_manager, enemy_type);
if size_info ~= nil then
local small_border = size_info:call("get_SmallBorder");
local big_border = size_info:call("get_BigBorder");
local king_border = size_info:call("get_KingBorder");
local small_border = get_small_border_method:call(size_info);
local big_border = get_big_border_method:call(size_info);
local king_border = get_king_border_method:call(size_info);
local size = enemy:call("get_MonsterListRegisterScale");
local size = get_monster_list_register_scale_method:call(enemy);
if small_border ~= nil then
monster.small_border = small_border;
@@ -108,17 +125,16 @@ function large_monster.init(monster, enemy)
monster.king_border = king_border;
end
if size ~= nil then
monster.size = size;
end
if monster.size <= monster.small_border then
monster.crown = "Mini";
monster.crown = language.current_language.UI.mini;
elseif monster.size >= monster.king_border then
monster.crown = "Gold";
monster.crown = language.current_language.UI.gold;
elseif monster.size >= monster.big_border then
monster.crown = "Silver";
monster.crown = language.current_language.UI.silver;
end
end
end
@@ -187,26 +203,25 @@ function large_monster.init_dynamic_UI(monster)
end
end
local enemy_character_base_type = sdk.find_type_definition("snow.enemy.EnemyCharacterBase")
local physical_param_field = enemy_character_base_type:get_field("<PhysicalParam>k__BackingField");
local status_param_field = enemy_character_base_type:get_field("<StatusParam>k__BackingField")
local stamina_param_field = enemy_character_base_type:get_field("<StaminaParam>k__BackingField")
local anger_param_field = enemy_character_base_type:get_field("<AngerParam>k__BackingField")
local physical_param_field = enemy_character_base_type_def:get_field("<PhysicalParam>k__BackingField");
local status_param_field = enemy_character_base_type_def:get_field("<StatusParam>k__BackingField")
local stamina_param_field = enemy_character_base_type_def:get_field("<StaminaParam>k__BackingField")
local anger_param_field = enemy_character_base_type_def:get_field("<AngerParam>k__BackingField")
local physical_param_type = physical_param_field:get_type()
local physical_param_type = physical_param_field:get_type();
local get_vital_method = physical_param_type:get_method("getVital")
local get_capture_hp_vital_method = physical_param_type:get_method("get_CaptureHpVital")
local vital_list_field = physical_param_type:get_field("_VitalList")
local vital_param_type = get_vital_method:get_return_type()
local vital_param_type = get_vital_method:get_return_type();
local get_current_method = vital_param_type:get_method("get_Current")
local get_max_method = vital_param_type:get_method("get_Max")
local stamina_param_type = stamina_param_field:get_type()
local stamina_param_type = stamina_param_field:get_type();
local get_stamina_method = stamina_param_type:get_method("getStamina")
local get_max_stamina_method = stamina_param_type:get_method("getMaxStamina")
local anger_param_type = anger_param_field:get_type()
local anger_param_type = anger_param_field:get_type();
local is_anger_method = anger_param_type:get_method("isAnger")
local get_anger_point_method = anger_param_type:get_method("get_AngerPoint")
local get_limit_anger_method = anger_param_type:get_method("get_LimitAnger")
@@ -225,7 +240,9 @@ function large_monster.update_position(enemy)
end
local monster = large_monster.get_monster(enemy);
if not monster then return end
if not monster then
return;
end
-- cache off the game object and transform
-- as these are pretty much guaranteed to stay constant
@@ -617,6 +634,7 @@ end
function large_monster.init_module()
singletons = require("MHR_Overlay.Game_Handler.singletons");
customization_menu = require("MHR_Overlay.UI.customization_menu");
language = require("MHR_Overlay.Misc.language");
config = require("MHR_Overlay.Misc.config");
table_helpers = require("MHR_Overlay.Misc.table_helpers");
body_part = require("MHR_Overlay.Monsters.body_part");

View File

@@ -1,6 +1,7 @@
local monster = {};
local small_monster;
local large_monster;
local config;
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_character_base_type_def_update_method = enemy_character_base_type_def:get_method("update");
@@ -13,16 +14,15 @@ end, function(retval)
return retval;
end);
local tick_count = 0
local last_update_tick = 0
local recorded_monsters = {}
local updated_monsters = {}
local known_big_monsters = {}
local num_known_monsters = 0
local num_updated_monsters = 0
local tick_count = 0;
local last_update_tick = 0;
local recorded_monsters = {};
local updated_monsters = {};
local known_big_monsters = {};
local num_known_monsters = 0;
local num_updated_monsters = 0;
local updates_this_tick = 0
local MAX_UPDATES_PER_TICK = 2
local updates_this_tick = 0;
-- run every tick to keep track of msonsters
-- whenever we've updated enough monsters to surpass how many we've seen,
@@ -73,26 +73,31 @@ function monster.update_monster(enemy)
-- due to how infrequently we update the monster(s).
if is_large then
large_monster.update_position(enemy);
if not config.current_config.global_settings.performance.prioritize_large_monsters then
return
end
else
small_monster.update_position(enemy);
return;
end
return
end
-- only updates N monsters per tick to increase performance
if tick_count == last_update_tick then
if updates_this_tick >= MAX_UPDATES_PER_TICK then
if updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
-- this is the VERY LEAST thing we should do all the time
-- so the position doesn't lag all over the place
-- due to how infrequently we update the monster(s).
if is_large then
large_monster.update_position(enemy);
if not config.current_config.global_settings.performance.prioritize_large_monsters then
return
end
else
small_monster.update_position(enemy);
return;
end
return
end
end
@@ -113,6 +118,7 @@ end
function monster.init_module()
small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster");
config = require("MHR_Overlay.Misc.config");
end
return monster;

View File

@@ -8,6 +8,7 @@ local screen;
local drawing;
damage_meter_UI.last_displayed_players = {};
damage_meter_UI.freeze_displayed_players = false;
local lobby_manager_type_def = sdk.find_type_definition("snow.LobbyManager");
local my_hunter_info_field = lobby_manager_type_def:get_field("_myHunterInfo");
@@ -26,7 +27,6 @@ local get_item_method = quest_hunter_info_type_def:get_method("get_Item");
local hunter_info_type_def = sdk.find_type_definition("snow.LobbyManager.HunterInfo");
local member_index_field = hunter_info_type_def:get_field("_memberIndex");
local hunter_rank_field = hunter_info_type_def:get_field("_hunterRank");
--local name_field = hunter_info_type_def:get_field("_name");
local progress_manager_type_def = sdk.find_type_definition("snow.progress.ProgressManager");
local get_hunter_rank_method = progress_manager_type_def:get_method("get_HunterRank");
@@ -87,7 +87,7 @@ function damage_meter_UI.draw()
local quest_players = {};
if quest_status.index > 2 then
if damage_meter_UI.freeze_displayed_players then
quest_players = damage_meter_UI.last_displayed_players;
else
-- other players

View File

@@ -12,7 +12,7 @@ function rage_UI_entity.new(visibility, bar, text_label, value_label, percentage
entity.percentage_label = table_helpers.deep_copy(percentage_label);
entity.timer_label = table_helpers.deep_copy(percentage_label);
entity.timer_label.text = "%.0f:%04.1f";
entity.timer_label.text = "%.0f:%02.0f";
return entity;
end

View File

@@ -0,0 +1,173 @@
{
"UI": {
"HP": "HP:",
"gold": "Gold",
"mini": "Mini",
"rage": "Rage:",
"silver": "Silver",
"stamina": "Stamina:"
},
"customization_menu": {
"anchor": "Anchor",
"background": "Background",
"bar": "Bar",
"body_parts": "Body Parts",
"bold": "Bold",
"bomb_damage": "Bomb Damage",
"bottom_left": "Bottom-Left",
"bottom_right": "Bottom-Right",
"break_count": "Break Count",
"color": "Color",
"colors": "Colors",
"crown": "Crown",
"crown_thresholds": "Crown Thresholds",
"damage": "Damage",
"damage_bar": "Damage Bar",
"damage_bars_are_relative_to": "Damage Bars are relative to",
"damage_meter_UI": "Damage Meter UI",
"damage_percentage_label": "Damage Percetange Label",
"damage_value_label": "Damage Value Label",
"distance": "Distance",
"during_quest": "During Quest",
"dynamic_positioning": "Dynamic Positioning",
"dynamically_positioned": "Dynamically Positioned",
"enabled": "Enabled",
"family": "Family",
"first": "First",
"font": "Font",
"font_notice": "Any changes to the font require script reload!",
"foreground": "Foreground",
"global_settings": "Global Settings",
"health": "Health",
"health_percentage": "Health Percentage",
"height": "Height",
"hide_module_if_total_damage_is_zero": "Hide Module if Total Damage is 0",
"hide_player_if_player_damage_is_zero": "Hide Player if Player Damage is 0",
"hide_total_if_total_damage_is_zero": "Hide Total if Total Damage is 0",
"hide_undamaged_parts": "Hide Undamaged Parts",
"highlighted_damage_bar": "Highlighted Damage Bar",
"higlighted_bar": "Highlighted Bar",
"horizontal": "Horizontal",
"hunter_rank": "Hunter Rank",
"include": "Include",
"installation_damage": "Installation Damage",
"italic": "Italic",
"kunai_damage": "Kunai Damage",
"language": "Language",
"large_monster_UI": "Large Monster UI",
"large_monster_dynamic_UI": "Large Monster Dynamic UI",
"large_monster_static_UI": "Large Monster Static UI",
"large_monsters": "Large Monsters",
"last": "Last",
"max_distance": "Max Distance",
"max_monster_updates_per_tick": "Max Monster Updates per Tick",
"me": "Me",
"mod_name": "MHR Overlay",
"module_visibility_on_different_screens": "Module Visibility on Different Screens",
"modules": "Modules",
"monster_can_be_captured": "Monster can be captured",
"monster_damage": "Monster Damage",
"monster_name": "Monster Name",
"monster_name_label": "Monster Name Label",
"my_damage_bar_location": "My Damage Bar Location",
"none": "None",
"normal": "Normal",
"offset": "Offset",
"opacity_falloff": "Opacity Falloff",
"orientation": "Orientation",
"other_players": "Other Players",
"otomo_damage": "Otomo Damage",
"part_name": "Part Name",
"part_name_label": "Part Name Label",
"percentage_label": "Percentage Label",
"performance": "Performance",
"player_damage": "Player Damage",
"player_id": "Player ID",
"player_name": "Player Name",
"player_name_label": "Player Name Label",
"position": "Position",
"prioritize_large_monsters": "Large Monsters on High Priority",
"quest_summary_screen": "Quest Summary Screen",
"rage": "Rage",
"reversed_order": "Reversed Order",
"settings": "Settings",
"shadow": "Shadow",
"size": "Size",
"small_monster_UI": "Small Monster UI",
"small_monsters": "Small Monsters",
"sorting": "Sorting",
"spacing": "Spacing",
"stamina": "Stamina",
"static_orientation": "Static Orientation",
"static_position": "Static Position",
"static_sorting": "Static Sorting",
"static_spacing": "Static Spacing",
"statically_positioned": "Statically Positioned",
"status": "Status",
"text_label": "Text Label",
"time_UI": "Time UI",
"time_label": "Time Label",
"top_damage": "Top Damage",
"top_left": "Top-Left",
"top_right": "Top-Right",
"total_damage": "Total Damage",
"total_damage_label": "Total Damage Label",
"total_damage_offset_is_relative": "Total Damage Offset is Relative",
"total_damage_value_label": "Total Damage Value Label",
"tracked_damage_types": "Tracked Damage Types",
"tracked_monster_types": "Tracked Monster Types",
"training_area": "Training Area",
"type": "Type",
"value_label": "Value Label",
"vertical": "Vertical",
"viewport_offset": "Viewport Offset",
"visible": "Visible",
"width": "Width",
"word_player": "Word \"Player\"",
"world_offset": "World Offset",
"x": "X",
"y": "Y",
"z": "Z"
},
"parts": {
"abdomen": "Abdomen",
"arms": "Arms",
"back": "Back",
"back_windsac": "Back (Windsac)",
"body": "Body",
"carapace": "Carapace",
"chest_windsac": "Chest (Windsac)",
"claw": "Claw",
"dorsal_fin": "Dorsal Fin",
"head": "Head",
"head_mud": "Head (Mud)",
"large_mudbulb": "Large Mudbulb",
"left_arm": "Arm L",
"left_arm_ice": "Arm L (Ice)",
"left_cutwing": "Cutwing L",
"left_leg": "Leg L",
"left_legs": "Legs L",
"left_wing": "Wing L",
"legs": "Legs",
"lower_back": "Lower Back",
"lower_body": "Lower Body",
"mane": "Mane",
"neck": "Neck",
"rear": "Rear",
"right_arm": "Arm R",
"right_arm_ice": "Arm R (Ice)",
"right_cutwing": "Cutwing R",
"right_leg": "Leg R",
"right_legs": "Legs R",
"right_wing": "Wing R",
"rock": "Rock",
"spinning": "Spinning",
"tail": "Tail",
"tail_mud": "Tail (Mud)",
"tail_windsac": "Tail (Windsac)",
"torso": "Torso",
"upper_back": "Upper Back",
"upper_body": "Upper Body",
"wings": "Wings"
}
}