-
Notifications
You must be signed in to change notification settings - Fork 9
/
command-monsterinfo.xml
77 lines (66 loc) · 2.2 KB
/
command-monsterinfo.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?xml version="1.0" encoding="UTF-8"?>
<mod name="command-monsterinfo" version="1.0" author="slawkens" contact="[email protected]" enabled="yes">
<talkaction words="!m" event="script"><![CDATA[
function onSay(cid, words, param, channel)
if(errors ~= nil) then errors(false) end
local monster = getMonsterInfo(param)
if(not monster) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Monster with this name does not exist.")
if(errors ~= nil) then errors(true) end
return true
end
if(errors ~= nil) then errors(true) end
local tmp = ""
local header = "Monster info: " .. monster.name .. "\n\n"
local str = header .. "Health: " .. monster.health
if(monster.health ~= monster.healthMax) then
str = str .. "/" .. monster.healthMax
end
str = str .. "\n Experience: " .. getExperienceStage(getPlayerLevel(cid)) * monster.experience
if(monster.manaCost ~= 0) then
str = str .. "\n ManaCost: " .. monster.manaCost
end
if(not monster.attacks) then
monster.attacks = getMonsterAttackSpells(param)
end
local i = 0
tmp = ""
for _, spell in pairs(monster.attacks) do
if(spell.minCombatValue ~= 0) then
tmp = tmp .. "*Min: " .. spell.minCombatValue .. " Max: " .. spell.maxCombatValue .. "\n"
i = i + 1
end
end
if(i > 0) then
str = str .. "\n\nAttack spells:\n" .. tmp
end
if(not monster.summons) then
monster.summons = getMonsterSummonList(param)
end
tmp = ""
i = 0
if #monster.summons > 0 then
for _, summon in pairs(monster.summons) do
tmp = tmp .. summon.name .. " (Max: " .. summon.amount .. ")\n"
i = i + 1
end
end
if(i > 0) then
str = str .. "\n\nSummons:\n" .. tmp
end
if(str:len() > 1000) then
doPlayerPopupFYI(cid, str)
str = ""
end
if(not monster.loot) then
monster.loot = getMonsterLootList(param)
end
str = header .. "Loot:\n"
for _, item in pairs(monster.loot) do
str = str .. getItemNameById(item.id) .. " (Max: " .. (item.countMax and item.countMax or item.count) .. ")\n"
end
doPlayerPopupFYI(cid, str)
return true
end
]]></talkaction>
</mod>