Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions AMANTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,43 +197,6 @@ local function find_enemy_by_name(enemy_name)
if enemy_name:sub(-1) == "y" and enemy.name == enemy_name:sub(1, -2) .. "ies" then
return enemy, i;
end
else
-- Legacy support: no match_type specified, try all methods

-- Exact match
if enemy.name == enemy_name then
return enemy, i;
end

-- Check if enemy.name is a family pattern
local family_type = family.extract_family_type(enemy.name);
if family_type then
if family.is_family_member(enemy_name, family_type) then
return enemy, i;
end
end

-- Try singular/plural variations
if enemy.name == enemy_name .. "s" then
return enemy, i;
end
if enemy.name == enemy_name .. "es" then
return enemy, i;
end
if enemy.name:sub(-1) == "s" and enemy.name:sub(1, -2) == enemy_name then
return enemy, i;
end
if enemy.name:sub(-2) == "es" and enemy.name:sub(1, -3) == enemy_name then
return enemy, i;
end

-- Try y -> ies transformation
if enemy.name:sub(-3) == "ies" and enemy.name:sub(1, -4) .. "y" == enemy_name then
return enemy, i;
end
if enemy_name:sub(-1) == "y" and enemy.name == enemy_name:sub(1, -2) .. "ies" then
return enemy, i;
end
end
end

Expand All @@ -251,7 +214,6 @@ local function handle_tome_interaction()
end

local function handle_training_start()
training_data.is_parsing = true;
clear_training_data();
training_data.is_active = true;
training_data.is_parsing = true;
Expand Down Expand Up @@ -291,7 +253,6 @@ local function handle_training_area(msg)
end

local function handle_regime_confirmation()
print(MESSAGES.REGIME_CONFIRMED_MSG);
local enemy_str = "";
for i, enemy in ipairs(training_data.enemies) do
if i > 1 then enemy_str = enemy_str .. ", " end
Expand Down
4 changes: 0 additions & 4 deletions lib/family.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ local families = {
includes = { "Bat", "Bats", "Stirge", "Gaylas" },
excludes = { "Gigas's", "Goblin's" }
},
["Bats"] = {
includes = { "Bat", "Bats", "Stirge", "Gaylas" },
excludes = { "Gigas's", "Goblin's" }
},
["Antica"] = {
includes = { "Antica" },
excludes = {}
Expand Down
13 changes: 0 additions & 13 deletions lib/packet_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,6 @@ local function get_entity_name(server_id)
return nil;
end

-- Get player server ID
-- Returns:
-- number - Player's server ID or 0
local function get_player_id()
local party = AshitaCore:GetMemoryManager():GetParty();
if party then
return party:GetMemberServerId(0);
end
return 0;
end

-- Check if an actor is in the player's party or is a pet/trust belonging to a party member
-- Args:
-- actor_id (number) - Actor's server ID
Expand Down Expand Up @@ -160,8 +149,6 @@ end
-- Args:
-- am (table) - Parsed action message data
local function handle_action_message(am)
local player_id = get_player_id();

-- Message 6: "${actor} defeats ${target}."
-- Used to capture the enemy name when player defeats an enemy
if am.message_id == MESSAGE_IDS.DEFEAT then
Expand Down
14 changes: 0 additions & 14 deletions lib/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,4 @@ function parser.escape_pattern(str)
return str:gsub("([%^%$%(%)%%%.%[%]%*%+%-%?])", "%%%1");
end

-- Parse single enemy line (legacy format - now unused but kept for compatibility)
-- Returns: count (number), name (string) or nil, nil
function parser.parse_enemy_line(line)
if should_exclude_line(line) then
return nil, nil;
end

local count, name = string.match(line, "^%s*(%d+)%s+([^%.]+)%.");
if count and name then
return tonumber(count), name;
end
return nil, nil;
end

return parser;
52 changes: 5 additions & 47 deletions lib/tracker_ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,13 @@ local font_settings = T{
outline_color = 0xFF000000,
outline_width = 2,
},
progress = T{
font_alignment = gdi.Alignment.Left,
font_color = 0xFF00FF00, -- Green
font_family = 'Consolas',
font_flags = gdi.FontFlags.Bold,
font_height = 14,
outline_color = 0xFF000000,
outline_width = 2,
},
};

-- ============================================================================
-- UI Constants
-- ============================================================================

local SPACING_VERTICAL = 5; -- Vertical spacing between elements
local SPACING_HORIZONTAL = 10; -- Horizontal spacing for inline elements
local SPACING_NAME_TO_PROGRESS = 2; -- Space between enemy name and progress bar

-- Window position settings (nil = user controlled, or set {x, y} for default position)
Expand All @@ -71,17 +61,7 @@ local window_position = nil; -- Example: { 100, 100 } to position at x=100, y=1
-- Helper Functions
-- ============================================================================

-- Format enemy names for display with proper capitalization
local function format_enemy_name_for_display(enemy_name)
-- Check if this is a family pattern (e.g., "members of the bee family")
local family_type = enemy_name:match("^[Mm]ember[s]? of (?:the )?(.+) [Ff]amily$");
if family_type then
-- Capitalize "Members" and the first letter of family name
local capitalized_family = family_type:sub(1,1):upper() .. family_type:sub(2):lower();
return string.format("Members of the %s Family", capitalized_family);
end

-- For non-family enemies, return as-is
return enemy_name;
end

Expand All @@ -102,13 +82,8 @@ local function initialize_ui_objects()

-- Clear out old enemy entries
for i, entry in ipairs(ui_objects.enemy_entries) do
if entry ~= nil then
if entry.name_text ~= nil then
gdi:destroy_object(entry.name_text);
end
if entry.progress_text ~= nil then
gdi:destroy_object(entry.progress_text);
end
if entry ~= nil and entry.name_text ~= nil then
gdi:destroy_object(entry.name_text);
end
end
ui_objects.enemy_entries = {};
Expand Down Expand Up @@ -136,9 +111,6 @@ local function set_text_visible(visible, num_enemies)
if entry.name_text then
entry.name_text:set_visible(entry_visible);
end
if entry.progress_text then
entry.progress_text:set_visible(entry_visible);
end
end
end

Expand Down Expand Up @@ -172,13 +144,8 @@ function tracker_ui.set_ui_mode(mode)
ui_objects.level_range_text = nil;
end
for i, entry in ipairs(ui_objects.enemy_entries) do
if entry ~= nil then
if entry.name_text ~= nil then
gdi:destroy_object(entry.name_text);
end
if entry.progress_text ~= nil then
gdi:destroy_object(entry.progress_text);
end
if entry ~= nil and entry.name_text ~= nil then
gdi:destroy_object(entry.name_text);
end
end
ui_objects.enemy_entries = {};
Expand Down Expand Up @@ -346,9 +313,7 @@ local function render_gdifonts_mode()
-- Create entry objects if they don't exist
local entry = ui_objects.enemy_entries[i];
if entry == nil then
entry = {};
entry.name_text = gdi:create_object(font_settings.entry);
entry.progress_text = gdi:create_object(font_settings.progress);
entry = { name_text = gdi:create_object(font_settings.entry) };
ui_objects.enemy_entries[i] = entry;
end

Expand Down Expand Up @@ -385,25 +350,18 @@ local function render_gdifonts_mode()

-- Reset cursor to ensure consistent positioning for next enemy
imgui.SetCursorScreenPos({ cursor_x, cursor_y + offsetY });

-- Hide the progress text object since we're using ImGui progress bar
if entry.progress_text then
entry.progress_text:set_visible(false);
end
end

-- Hide any extra enemy entries that aren't being used
for i = #training_data.enemies + 1, #ui_objects.enemy_entries do
if ui_objects.enemy_entries[i] then
ui_objects.enemy_entries[i].name_text:set_visible(false);
ui_objects.enemy_entries[i].progress_text:set_visible(false);
end
end
else
-- Hide all enemy entries if no data
for i, entry in ipairs(ui_objects.enemy_entries) do
entry.name_text:set_visible(false);
entry.progress_text:set_visible(false);
end
end

Expand Down