Welcome Message¶
Greet players when they log in and optionally give login rewards.
Basic Welcome¶
local function OnPlayerLogin(aIndex)
local player = GetUser(aIndex)
if player == nil then return end
GCNoticeSend(aIndex, 1, "Welcome to MuDevs, " .. player.Name .. "!")
LogAdd(LOG_GREEN, "[Welcome] " .. player.Name .. " connected from " .. player.IpAddr)
end
BridgeFunctionAttach("OnCharacterEntry", OnPlayerLogin)
Welcome with Class-Based Message¶
local CLASS_NAMES = {
[CLASS_DW] = "Dark Wizard",
[CLASS_DK] = "Dark Knight",
[CLASS_FE] = "Fairy Elf",
[CLASS_MG] = "Magic Gladiator",
[CLASS_DL] = "Dark Lord",
[CLASS_SU] = "Summoner",
[CLASS_RF] = "Rage Fighter",
}
local function OnPlayerLogin(aIndex)
local player = GetUser(aIndex)
if player == nil then return end
local className = CLASS_NAMES[player.Class] or "Adventurer"
GCNoticeSend(aIndex, 1, "Welcome, " .. className .. " " .. player.Name .. "!")
GCNoticeSend(aIndex, 1, "Your level: " .. player.Level .. " | Resets: " .. player.Reset)
end
BridgeFunctionAttach("OnCharacterEntry", OnPlayerLogin)
Welcome with Gremory Login Reward¶
Warning
Do NOT give Gremory items in OnCharacterEntry — the Gremory data hasn't loaded yet. Use OnGremoryCaseReady instead.
local REWARD_ITEM = GET_ITEM(14, 13) -- Jewel of Bless
local function OnGremoryCaseLoaded(aIndex)
local player = GetUser(aIndex)
if player == nil then return end
-- Give a daily Jewel of Bless to Gremory Case
GremoryGive(aIndex, REWARD_ITEM, 0, 0, 0, 0, 0, 0,
GREMORY_CASE_CHARACTER, GREMORY_REWARD_EVENT, GREMORY_EXPIRE_7_DAYS)
GCNoticeSend(aIndex, 1, "A login reward has been sent to your Gremory Case!")
end
BridgeFunctionAttach("OnGremoryCaseReady", OnGremoryCaseLoaded)