-
Notifications
You must be signed in to change notification settings - Fork 9
/
command-exp.xml
34 lines (28 loc) · 1.45 KB
/
command-exp.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="UTF-8"?>
<mod name="command-exp" version="1.0" author="slawkens" contact="[email protected]" enabled="yes">
<config name="command-exp-config"><![CDATA[
experienceHistory = "no" -- enable only if installed my experience history system
]]></config>
<talkaction words="!exp" event="script"><![CDATA[
domodlib('command-exp-config')
local config = {
experienceHistory = getBooleanFromString(experienceHistory)
}
function onSay(cid, words, param, channel)
param = param:trim()
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need " .. getExperienceForLevel(getPlayerLevel(cid) + 1) - getPlayerExperience(cid) ..
" experience to gain next level." .. (config.experienceHistory and
(" Today you have gained " .. getPlayerTodayExperience(cid) .. " experience points" ..
", and your experience record is " .. getPlayerExperienceRecord(cid) .. " experience points") or "") .. ".")
return true
end
local mid = getCreatureByName(param)
if(isMonster(mid)) then
local playerLevel = getPlayerLevel(cid)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'To gain next level you need to kill '..string.sub((getExperienceForLevel(playerLevel + 1)- getPlayerExperience(cid)) / (getMonsterInfo(param).experience * getExperienceStage(playerLevel)), 1, 4)..' '..param..'\'s')
end
return true
end
]]></talkaction>
</mod>