local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
end
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
addEvent(valid(doCreatureSay), 500, cid, "Hello, it appears that your character has been locked for name violating rules, what new name would you like to have?", TALKTYPE_PRIVATE_NP, true, cid)
elseif(accountManager == MANAGER_ACCOUNT) then
addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to manage your account. If you would like to start over, type {cancel} anywhere.", TALKTYPE_PRIVATE_NP, true, cid)
else
addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to create an account or {recover} to recover an account.", TALKTYPE_PRIVATE_NP, true, cid)
end
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
local expstorage = 19998
local PlayAc = getPlayerAccess(cid)
local loginsCounterStorage = 12345
local loginsCount = getCreatureStorage(cid, loginsCounterStorage)
if PlayAc <= 1 then
if loginsCount == -1 then
local welcomeText = "Welcome " .. getCreatureName(cid) .. ".\n\nOur community would like to welcome you to Aloria. If you need help with anything, please refer to the Help/World channel.\n\nEnjoy your time!"
local text = "- Welcome to Aloria, here's a list of commands:\n!aol -> Buy an amulet of loss for 12 Crystal Coins.\n!spells -> List of spells available\n!kills -> Check your amount of kills\n!serverinfo -> Check out the rates of the server..\nCtrl+R -> Report bugs to staff\n!- Please visit our webpage for any more information.\n//Aloria Staff"
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, ""..text.."")
broadcastMessage(cid, ""..welcomeText.."", MESSAGE_EVENT_ADVANCE)
setPlayerStorageValue(cid, 19622, 1)
setPlayerStorageValue(cid, 13541, 1)
setPlayerStorageValue(cid, loginsCounterStorage, loginsCount+1)
return true
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You logged " .. (loginsCount + 1) .. " times.")
doPlayerSetStorageValue(cid, loginsCounterStorage, loginsCount+1)
setPlayerStorageValue(cid, 1200, 0)
setPlayerStorageValue(cid, 2200, 0)
setPlayerStorageValue(cid, 3200, 0)
setPlayerStorageValue(cid, 4200, 0)
setPlayerStorageValue(cid, 5200, 0)
setPlayerStorageValue(cid, 5520, 0)
if (os.date('%A') == 'Thursday') then
doPlayerSetRate(cid, SKILL__LEVEL, 2)
doPlayerSetStorageValue(cid, expstorage, 2)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Today is extra experience day")
else
doPlayerSetStorageValue(cid, expstorage, 1)
end
return true
end
else
if (os.date('%A') == 'Thursday') then
doPlayerSetRate(cid, SKILL__LEVEL, 2)
doPlayerSetStorageValue(cid, expstorage, 2)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Today is extra experience day")
else
doPlayerSetStorageValue(cid, expstorage, 1)
end
local itenz = getItemNameById(getPlayerSlotItem(cid, 5).itemid)
local itenzweight = getItemDefense(getPlayerSlotItem(cid, 5))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Weclome Staff of Alora. Please make sure you have the STAFF channel ALWAY OEPNED!")
if itenzweight == nil then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The Function has Nil'ed OUT!.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Shield: "..itenz.." Def: "..itenzweight..".")
end
setPlayerStorageValue(cid, 1200, 0)
setPlayerStorageValue(cid, 2200, 0)
setPlayerStorageValue(cid, 3200, 0)
setPlayerStorageValue(cid, 4200, 0)
setPlayerStorageValue(cid, 5200, 0)
setPlayerStorageValue(cid, 5520, 0)
return true
end
registerCreatureEvent(cid, "AttributeLogin")
registerCreatureEvent(cid, "AttributeAdvance")
registerCreatureEvent(cid, "partyAndGuildProtection")
registerCreatureEvent(cid, "onPrepareDeath")
registerCreatureEvent(cid, "Reward")
registerCreatureEvent(cid, "PointSystem")
registerCreatureEvent(cid, "onLookItenz")
registerCreatureEvent(cid, "Mail")
registerCreatureEvent(cid, "GuildEvents")
registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
registerCreatureEvent(cid, "demonOakDeath")
registerCreatureEvent(cid, "demonOakAttack")
registerCreatureEvent(cid, "demonOakLogout")
registerCreatureEvent(cid, "ctf")
registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, "points")
registerCreatureEvent(cid, "ThankYou")
registerCreatureEvent(cid, "AdvanceSave")
return true
end
function getItemDefense(item)
return getItemAttribute(item.uid, "defense") or getItemInfo(item.itemid).defense
end