-
Notifications
You must be signed in to change notification settings - Fork 9
/
guild-outfit.xml
63 lines (54 loc) · 2.03 KB
/
guild-outfit.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
<?xml version="1.0" encoding="UTF-8"?>
<mod name="guild-outfit" version="1.0" author="slawkens" contact="slawkens@gmail.com" enabled="yes">
<config name="guild-outfit-config"><![CDATA[
exhaust = 30 -- in seconds
storage = 3005 -- storage value used to save exhaustion
]]></config>
<!--
TODO:
- change colors only (configurable)
-->
<talkaction words="!go" event="script"><![CDATA[
domodlib('guild-outfit-config')
local config = {
exhaustion = exhaust,
storage = storage
}
function onSay(cid, words, param, channel)
if(exhaustion.check(cid, config.storage)) then
doPlayerSendCancel(cid, "You can change outfit only 1 time per " .. config.exhaustion .. " seconds.")
return true
end
local playerGuild = getPlayerGuildId(cid)
if(not playerGuild or playerGuild == 0) then
doPlayerSendCancel(cid, "Sorry, you're not in a guild.")
return true
end
if(getPlayerGuildLevel(cid) < GUILDLEVEL_LEADER) then
doPlayerSendCancel(cid, "You have to be Leader of your guild to change outfits!")
return true
end
local outfit, members = getCreatureOutfit(cid), 0
local message = "*Guild* Your outfit has been changed by leader. (" .. getCreatureName(cid) .. ")"
for _, tid in ipairs(getPlayersOnline()) do
if(getPlayerGuildId(tid) == playerGuild and cid ~= tid) then
local newOutfit = outfit
if(not canPlayerWearOutfit(tid, outfit.lookType, outfit.lookAddons)) then
local tmpOutfit = getCreatureOutfit(tid)
newOutfit.lookAddons = 0--tmpOutfit.lookAddons
if(not canPlayerWearOutfit(tid, outfit.lookType, 0)) then
newOutfit.lookType = tmpOutfit.lookType
end
end
doSendMagicEffect(getCreaturePosition(tid), 66)
doCreatureChangeOutfit(tid, newOutfit)
doPlayerSendTextMessage(tid, MESSAGE_INFO_DESCR, message)
members = members + 1
end
end
exhaustion.set(cid, config.storage, config.exhaustion)
doPlayerSendCancel(cid, "Guild members outfit has been changed. (Total: " .. members .. ")")
return true
end
]]></talkaction>
</mod>