local firstItems = {
hobbit = {items = {1987, 2195, 49275, 2650, 2050, 18559, 2600, 2160, 31447}}, -- Additional item for hobbit
human = {items = {1987, 2195, 49275, 2650, 2050, 18559, 2600, 2160, 31447}}, -- Additional item for human
dwarf = {items = {1987, 2195, 49275, 2650, 2050, 18559, 2600, 2160, 31447}}, -- Additional item for dwarf
elf = {items = {1987, 2195, 49275, 2650, 2050, 18559, 2600, 2160, 31447}}, -- Additional item for elf
}
local townIds = {
elf = 3,
human = 1,
hobbit = 2,
dwarf = 12,
}
local townNames = {
[3] = "Rivendell",
[1] = "Bree",
[2] = "Hobbiton",
[12] = "Nogrod",
}
local outfits = {
elf = {1137, 1136}, -- Elf female/male
hobbit = {368, 368}, -- Hobbit female/male
human = {1246, 1245}, -- Human female/male
dwarf = {160, 370}, -- Dwarf female/male
}
function onLogin(player)
if player:getLastLoginSaved() == 0 then
local vocation = player:getVocation():getName():lower()
if vocation == "no vocation" then
player:addItem(2148, 50)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have received 50 gold coins.") -- Admin First Login
return true
end
local items = firstItems[vocation].items
local storage = firstItems[vocation].storage
for i = 1, #items do
player:addItem(items[i], 1)
end
-- Set race-specific storages and teleport to specific location
if vocation == "hobbit" then
player:teleportTo(Position(2032, 1892, 7)) -- Tutorial Location
player:setStorageValue(1500, 0) -- LORD OF THE RINGS START (devremovebeta)
player:setStorageValue(900, 0) -- Race Quest Start
elseif vocation == "human" then
player:teleportTo(Position(3004, 1824, 7)) -- Tutorial Location
player:setStorageValue(1500, 0) -- LORD OF THE RINGS START (devremovebeta)
player:setStorageValue(920, 0) -- Race Quest Start
elseif vocation == "dwarf" then
player:teleportTo(Position(1708, 2238, 7)) -- Tutorial Location
player:setStorageValue(1500, 0) -- LORD OF THE RINGS START (devremovebeta)
player:setStorageValue(940, 0) -- Race Quest Start
elseif vocation == "elf" then
player:teleportTo(Position(4214, 1746, 6)) -- Tutorial Location
player:setStorageValue(1500, 0) -- LORD OF THE RINGS START (devremovebeta)
player:setStorageValue(960, 0) -- Race Quest Start
end
-- Set the town based on vocation
local townId = townIds[vocation]
local town = Town(townId)
if not town then
return false
end
player:setTown(town)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your tales start in " .. townNames[townId] .. ". \nYour quest log has been updated.")
player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA)
local outfit = outfits[vocation]
player:addOutfit(outfit[1]) -- Assuming outfit[1] is the female outfit
player:addOutfit(outfit[2]) -- Assuming outfit[2] is the male outfit
local currentOutfit = player:getOutfit()
currentOutfit.lookType = player:getSex() == 0 and outfit[1] or outfit[2]
player:setOutfit(currentOutfit)
end
return true
end