mirror of
https://github.com/GreenComfyTea/MHR-Overlay.git
synced 2026-01-24 04:18:11 -08:00
Add Option to Set Infinite Buffs Location
This commit is contained in:
@@ -7492,6 +7492,7 @@ function this.init_default()
|
||||
hide_bar_for_infinite_buffs = true,
|
||||
hide_timer_for_infinite_buffs = true,
|
||||
orientation = "Vertical", -- "Vertical" or "Horizontal"
|
||||
infinite_buffs_location = "Last"
|
||||
},
|
||||
|
||||
spacing = {
|
||||
|
||||
@@ -778,6 +778,8 @@ this.default_language = {
|
||||
update_myself_position_delay = "Update Myself Position (seconds)",
|
||||
update_player_info_delay = "Update Player Info (seconds)",
|
||||
update_buffs_delay = "Update Buffs (seconds)",
|
||||
|
||||
infinite_buffs_location = "Infinite Buffs Location",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -131,36 +131,199 @@ function this.update()
|
||||
end
|
||||
|
||||
function this.sort_buffs(_displayed_buffs, cached_config)
|
||||
local infinite_buffs_location = cached_config.settings.infinite_buffs_location;
|
||||
cached_config = cached_config.sorting;
|
||||
|
||||
if cached_config.type == "Name" then
|
||||
if cached_config.reversed_order then
|
||||
table.sort(_displayed_buffs, function(left, right)
|
||||
return left.name > right.name;
|
||||
|
||||
if infinite_buffs_location == "First" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.name < right.name;
|
||||
elseif left.is_infinite then
|
||||
return true;
|
||||
elseif right.is_infinite then
|
||||
return false;
|
||||
else
|
||||
return left.name < right.name;
|
||||
end
|
||||
|
||||
elseif infinite_buffs_location == "Last" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.name < right.name;
|
||||
elseif left.is_infinite then
|
||||
return false;
|
||||
elseif right.is_infinite then
|
||||
return true;
|
||||
else
|
||||
return left.name < right.name;
|
||||
end
|
||||
|
||||
else
|
||||
return left.name < right.name;
|
||||
end
|
||||
end);
|
||||
else
|
||||
table.sort(_displayed_buffs, function(left, right)
|
||||
return left.name < right.name;
|
||||
|
||||
if infinite_buffs_location == "First" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.name > right.name;
|
||||
elseif left.is_infinite then
|
||||
return false;
|
||||
elseif right.is_infinite then
|
||||
return true;
|
||||
else
|
||||
return left.name > right.name;
|
||||
end
|
||||
|
||||
elseif infinite_buffs_location == "Last" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.name > right.name;
|
||||
elseif left.is_infinite then
|
||||
return true;
|
||||
elseif right.is_infinite then
|
||||
return false;
|
||||
else
|
||||
return left.name > right.name;
|
||||
end
|
||||
|
||||
else
|
||||
return left.name > right.name;
|
||||
end
|
||||
end);
|
||||
end
|
||||
elseif cached_config.type == "Timer" then
|
||||
if cached_config.reversed_order then
|
||||
table.sort(_displayed_buffs, function(left, right)
|
||||
return left.timer > right.timer;
|
||||
|
||||
if infinite_buffs_location == "First" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.timer < right.timer;
|
||||
elseif left.is_infinite then
|
||||
return true;
|
||||
elseif right.is_infinite then
|
||||
return false;
|
||||
else
|
||||
return left.timer < right.timer;
|
||||
end
|
||||
|
||||
elseif infinite_buffs_location == "Last" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.timer < right.timer;
|
||||
elseif left.is_infinite then
|
||||
return false;
|
||||
elseif right.is_infinite then
|
||||
return true;
|
||||
else
|
||||
return left.timer < right.timer;
|
||||
end
|
||||
|
||||
else
|
||||
return left.timer < right.timer;
|
||||
end
|
||||
end);
|
||||
else
|
||||
table.sort(_displayed_buffs, function(left, right)
|
||||
return left.timer < right.timer;
|
||||
|
||||
if infinite_buffs_location == "First" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.timer > right.timer;
|
||||
elseif left.is_infinite then
|
||||
return false;
|
||||
elseif right.is_infinite then
|
||||
return true;
|
||||
else
|
||||
return left.timer > right.timer;
|
||||
end
|
||||
|
||||
elseif infinite_buffs_location == "Last" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.timer > right.timer;
|
||||
elseif left.is_infinite then
|
||||
return true;
|
||||
elseif right.is_infinite then
|
||||
return false;
|
||||
else
|
||||
return left.timer > right.timer;
|
||||
end
|
||||
|
||||
else
|
||||
return left.timer > right.timer;
|
||||
end
|
||||
end);
|
||||
end
|
||||
else
|
||||
else -- Duration
|
||||
if cached_config.reversed_order then
|
||||
table.sort(_displayed_buffs, function(left, right)
|
||||
return left.duration > right.duration;
|
||||
|
||||
if infinite_buffs_location == "First" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.duration < right.duration;
|
||||
elseif left.is_infinite then
|
||||
return true;
|
||||
elseif right.is_infinite then
|
||||
return false;
|
||||
else
|
||||
return left.duration < right.duration;
|
||||
end
|
||||
|
||||
elseif infinite_buffs_location == "Last" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.duration < right.duration;
|
||||
elseif left.is_infinite then
|
||||
return false;
|
||||
elseif right.is_infinite then
|
||||
return true;
|
||||
else
|
||||
return left.duration < right.duration;
|
||||
end
|
||||
|
||||
else
|
||||
return left.duration < right.duration;
|
||||
end
|
||||
end);
|
||||
else
|
||||
table.sort(_displayed_buffs, function(left, right)
|
||||
return left.duration < right.duration;
|
||||
|
||||
if infinite_buffs_location == "First" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.duration > right.duration;
|
||||
elseif left.is_infinite then
|
||||
return false;
|
||||
elseif right.is_infinite then
|
||||
return true;
|
||||
else
|
||||
return left.duration > right.duration;
|
||||
end
|
||||
|
||||
elseif infinite_buffs_location == "Last" then
|
||||
|
||||
if left.is_infinite and right.is_infinite then
|
||||
return left.duration > right.duration;
|
||||
elseif left.is_infinite then
|
||||
return true;
|
||||
elseif right.is_infinite then
|
||||
return false;
|
||||
else
|
||||
return left.duration > right.duration;
|
||||
end
|
||||
|
||||
else
|
||||
return left.duration > right.duration;
|
||||
end
|
||||
end);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -99,6 +99,9 @@ this.displayed_monster_UI_sorting_types = {};
|
||||
this.buff_UI_sorting_types = {};
|
||||
this.displayed_buff_UI_sorting_types = {};
|
||||
|
||||
this.buff_UI_infinite_buffs_location_types = {};
|
||||
this.displayed_buff_UI_infinite_buffs_location_types = {};
|
||||
|
||||
this.damage_meter_UI_highlighted_entity_types = {};
|
||||
this.displayed_damage_meter_UI_highlighted_entity_types = {};
|
||||
|
||||
@@ -237,6 +240,20 @@ function this.init()
|
||||
current.duration
|
||||
};
|
||||
|
||||
this.buff_UI_infinite_buffs_location_types =
|
||||
{
|
||||
default.normal,
|
||||
default.first,
|
||||
default.last
|
||||
};
|
||||
|
||||
this.displayed_buff_UI_infinite_buffs_location_types =
|
||||
{
|
||||
current.normal,
|
||||
current.first,
|
||||
current.last
|
||||
};
|
||||
|
||||
this.damage_meter_UI_highlighted_entity_types =
|
||||
{
|
||||
default.top_damage,
|
||||
@@ -2317,6 +2334,17 @@ function this.draw_buff_UI()
|
||||
cached_config.settings.orientation = this.orientation_types[index];
|
||||
end
|
||||
|
||||
changed, index = imgui.combo(
|
||||
language.current_language.customization_menu.infinite_buffs_location,
|
||||
utils.table.find_index(this.buff_UI_infinite_buffs_location_types, cached_config.settings.infinite_buffs_location),
|
||||
this.displayed_buff_UI_infinite_buffs_location_types);
|
||||
|
||||
config_changed = config_changed or changed;
|
||||
|
||||
if changed then
|
||||
cached_config.settings.infinite_buffs_location = this.buff_UI_infinite_buffs_location_types[index];
|
||||
end
|
||||
|
||||
imgui.tree_pop();
|
||||
end
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
"in_lobby": "In Lobby",
|
||||
"in_training_area": "In Training Area",
|
||||
"include": "Include",
|
||||
"infinite_buffs_location": "Infinite Buffs Location",
|
||||
"inside": "Inside",
|
||||
"installations": "Installations",
|
||||
"italic": "Italic",
|
||||
|
||||
@@ -225,6 +225,7 @@
|
||||
"in_lobby": "In Lobby",
|
||||
"in_training_area": "In Training Area",
|
||||
"include": "含める情報",
|
||||
"infinite_buffs_location": "Infinite Buffs Location",
|
||||
"init_singletons_delay": "Init Singletons Delay (seconds)",
|
||||
"inside": "Inside",
|
||||
"installations": "Installations",
|
||||
|
||||
@@ -226,6 +226,7 @@
|
||||
"in_lobby": "로비 내",
|
||||
"in_training_area": "훈련구역 내",
|
||||
"include": "포함",
|
||||
"infinite_buffs_location": "Infinite Buffs Location",
|
||||
"init_singletons_delay": "Init Singletons Delay (seconds)",
|
||||
"inside": "내부",
|
||||
"installations": "설치",
|
||||
|
||||
@@ -226,6 +226,7 @@
|
||||
"in_lobby": "В лобби",
|
||||
"in_training_area": "В тренировочной зоне",
|
||||
"include": "Элементы",
|
||||
"infinite_buffs_location": "Infinite Buffs Location",
|
||||
"init_singletons_delay": "Init Singletons Delay (seconds)",
|
||||
"inside": "Внутри",
|
||||
"installations": "Установки",
|
||||
|
||||
@@ -226,6 +226,7 @@
|
||||
"in_lobby": "在大厅",
|
||||
"in_training_area": "在修炼场",
|
||||
"include": "包含",
|
||||
"infinite_buffs_location": "Infinite Buffs Location",
|
||||
"init_singletons_delay": "Init Singletons Delay (seconds)",
|
||||
"inside": "里面",
|
||||
"installations": "狩猎设备",
|
||||
|
||||
@@ -226,6 +226,7 @@
|
||||
"in_lobby": "In Lobby",
|
||||
"in_training_area": "In Training Area",
|
||||
"include": "細部資訊調整",
|
||||
"infinite_buffs_location": "Infinite Buffs Location",
|
||||
"init_singletons_delay": "Init Singletons Delay (seconds)",
|
||||
"inside": "內部",
|
||||
"installations": "Installations",
|
||||
|
||||
Reference in New Issue
Block a user