Skip to content

Commit

Permalink
Changed order of messages of the WelcomeMessage when addon is loaded …
Browse files Browse the repository at this point in the history
…to be more logical
  • Loading branch information
Thumbkin committed May 31, 2021
1 parent 9fe7ffa commit b3f6161
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
15 changes: 7 additions & 8 deletions logic/player_npc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ MTSL_LOGIC_PLAYER_NPC = {
-- try and load the player
local current_player = MTSL_PLAYERS[realm][name]

local return_code = "none"

-- Player was saved before, so load it
if current_player then
current_player = MTSL_PLAYERS[realm][name]

if MTSLUI_SAVED_VARIABLES:GetShowWelcomeMessage() == 1 then
print(MTSLUI_FONTS.COLORS.TEXT.SUCCESS .. "MTSL: " .. current_player.NAME .. " (" .. current_player.XP_LEVEL .. ", " .. current_player.FACTION .. ") on " .. current_player.REALM .. " loaded")
end

-- Update class, faction & xp_level, just in case
MTSL_CURRENT_PLAYER.CLASS = string.lower(player_class)
MTSL_CURRENT_PLAYER.XP_LEVEL = xp_level
MTSL_CURRENT_PLAYER.FACTION = faction

return_code = "existing"
-- new player so create it and add it
else
-- Not found so create a new one
Expand All @@ -69,13 +69,12 @@ MTSL_LOGIC_PLAYER_NPC = {
CLASS = player_class,
TRADESKILLS = {},
}
-- Get additional player info to save
print(MTSLUI_FONTS.COLORS.TEXT.WARNING .. "MTSL: Saving new player: " .. current_player.NAME .. " (" .. current_player.XP_LEVEL .. ", " .. current_player.FACTION .. ") on " .. current_player.REALM)
print(MTSLUI_FONTS.COLORS.TEXT.WARNING .. "MTSL: Please open all profession windows to save skills")
-- new player added so sort the table (first the realms, then for new realm, sort by name
MTSL_PLAYERS[realm][name] = current_player
MTSL_TOOLS:SortArray(MTSL_PLAYERS)
MTSL_TOOLS:SortArrayByProperty(MTSL_PLAYERS[realm], "name")

return_code = "new"
end

-- set the loaded or created player as current one
Expand All @@ -85,7 +84,7 @@ MTSL_LOGIC_PLAYER_NPC = {
self:RemoveUnlearnedProfessions()
self:UpdatePlayerSkillLevels()

return "none"
return return_code
end,

------------------------------------------------------------------------------------------------
Expand Down
12 changes: 10 additions & 2 deletions ui/event_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ MTSLUI_EVENT_HANDLER = {
if MTSLUI_TOOLS:SetAddonLocale() then
-- load the data for the player
local error_loading_player = MTSL_LOGIC_PLAYER_NPC:LoadPlayer()
if error_loading_player ~= "none" then
print(MTSLUI_FONTS.COLORS.TEXT.ERROR .. "MTSL: Could not load player info (Empty " .. error_loading_player .." ..! Try reloading this addon")
if error_loading_player ~= "new" and error_loading_player ~= "existing" then
print(MTSLUI_FONTS.COLORS.TEXT.ERROR .. "MTSL: Could not load player info (Empty " .. error_loading_player .."! Try reloading this addon")
self.addon_loaded = 0
else
-- Initialise the minimap button
Expand Down Expand Up @@ -47,6 +47,14 @@ MTSLUI_EVENT_HANDLER = {
if MTSLUI_SAVED_VARIABLES:GetShowWelcomeMessage() == 1 then
print(MTSLUI_FONTS.COLORS.TEXT.TITLE .. MTSLUI_ADDON.NAME .. MTSLUI_FONTS.COLORS.TEXT.NORMAL .. " (by " .. MTSLUI_ADDON.AUTHOR .. ")" .. MTSLUI_FONTS.COLORS.TEXT.TITLE .. " v" .. MTSLUI_ADDON.VERSION .. " loaded!")
print(MTSLUI_FONTS.COLORS.TEXT.TITLE .."MTSL: Using data for phase " .. MTSL_DATA.CURRENT_PATCH_LEVEL .. " (" .. MTSL_LOGIC_WORLD:GetZoneNameById(MTSL_DATA.PHASE_IDS[MTSL_DATA.CURRENT_PATCH_LEVEL]) .. ")")
if error_loading_player == "existing" then
print(MTSLUI_FONTS.COLORS.TEXT.SUCCESS .. "MTSL: " .. MTSL_CURRENT_PLAYER.NAME .. " (" .. MTSL_CURRENT_PLAYER.XP_LEVEL .. ", " .. MTSL_CURRENT_PLAYER.FACTION .. ") on " .. MTSL_CURRENT_PLAYER.REALM .. " loaded")
end
if error_loading_player == "new" then
-- Get additional player info to save
print(MTSLUI_FONTS.COLORS.TEXT.WARNING .. "MTSL: New character: " .. MTSL_CURRENT_PLAYER.NAME .. " (" .. MTSL_CURRENT_PLAYER.XP_LEVEL .. ", " .. MTSL_CURRENT_PLAYER.FACTION .. ") on " .. MTSL_CURRENT_PLAYER.REALM)
print(MTSLUI_FONTS.COLORS.TEXT.WARNING .. "MTSL: Please open all profession windows to save skills!")
end
end

self.addon_loaded = 1
Expand Down
2 changes: 1 addition & 1 deletion ui/global_variables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
MTSLUI_ADDON = {
AUTHOR = "Thumbkin",
NAME = "Missing TradeSkills List (TBC)",
VERSION = "2.5.02",
VERSION = "2.5.03",
SERVER_VERSION_PHASES = {
-- max build number from server for phase 1,
{
Expand Down

0 comments on commit b3f6161

Please sign in to comment.