Server upload

RD Core / Commit #2

Commit Server upload

Alex Alex committed 18/10/2026 23:38 main Patch
1,106 files +223,404 -0
A data/actions/scripts/other/snowheap.lua +4-0 View file
@@ -0,0 +1,4 @@
1+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2+ Game.createItem(2111, 1, item:getPosition())
3+ return true
4+end
A data/actions/scripts/other/surprisebag.lua +27-0 View file
@@ -0,0 +1,27 @@
1+local presents = {
2+ [6570] = { -- blue present
3+ {2687, 10}, {6394, 3}, 6280, 6574, 6578, 6575, 6577, 6569, 6576, 6572, 2114
4+ },
5+ [6571] = { -- red present
6+ {2152, 10}, {2152, 10}, {2152, 10}, 2153, 5944, 2112, 6568, 6566, 2492, 2520, 2195, 2114, 2114, 2114, 6394, 6394, 6576, 6576, 6578, 6578, 6574, 6574
7+ }
8+}
9+
10+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
11+ local count = 1
12+ local targetItem = presents[item.itemid]
13+ if not targetItem then
14+ return true
15+ end
16+
17+ local gift = targetItem[math.random(#targetItem)]
18+ if type(gift) == "table" then
19+ gift = gift[1]
20+ count = gift[2]
21+ end
22+
23+ player:addItem(gift, count)
24+ item:remove(1)
25+ fromPosition:sendMagicEffect(CONST_ME_GIFT_WRAPS)
26+ return true
27+end
A data/actions/scripts/other/teleport.lua +21-0 View file
@@ -0,0 +1,21 @@
1+local upFloorIds = {1386, 3678, 5543, 22845, 22846}
2+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
3+ if table.contains(upFloorIds, item.itemid) then
4+ fromPosition:moveUpstairs()
5+ else
6+ fromPosition.z = fromPosition.z + 1
7+ end
8+
9+ if player:isPzLocked() and Tile(fromPosition):hasFlag(TILESTATE_PROTECTIONZONE) then
10+ player:sendCancelMessage(RETURNVALUE_PLAYERISPZLOCKED)
11+ return true
12+ end
13+ if item.itemid == 1369 then
14+ if item.actionid < 01 then
15+ return true
16+ end
17+ end
18+
19+ player:teleportTo(fromPosition, false)
20+ return true
21+end
A data/actions/scripts/other/transforms.lua +13-0 View file
@@ -0,0 +1,13 @@
1+local transformItems = {
2+ [3743] = 4404, [4404] = 3743
3+}
4+
5+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
6+ local transformIds = transformItems[item:getId()]
7+ if not transformIds then
8+ return false
9+ end
10+
11+ item:transform(transformIds)
12+ return true
13+end
A data/actions/scripts/other/trap.lua +5-0 View file
@@ -0,0 +1,5 @@
1+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2+ item:transform(item:getId() - 1)
3+ fromPosition:sendMagicEffect(CONST_ME_POFF)
4+ return true
5+end
A data/actions/scripts/other/wallmirror.lua +24-0 View file
@@ -0,0 +1,24 @@
1+local messages = {
2+ "You could win a beauty contest today!",
3+ "You rarely looked better.",
4+ "Well, you can't look good every day.",
5+ "You should think about a makeover.",
6+ "Is that the indication of a potbelly looming under your clothes?",
7+ "You look irresistible.",
8+ "You look tired.",
9+ "You look awesome!",
10+ "You nearly don't recognize yourself.",
11+ "You look fabulous.",
12+ "Surprise, surprise, you don't see yourself."
13+}
14+
15+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
16+ if player:getStorageValue(PlayerStorageKeys.delayWallMirror) <= os.time() then
17+ player:say(messages[math.random(1, #messages)], TALKTYPE_MONSTER_SAY)
18+ player:setStorageValue(PlayerStorageKeys.delayWallMirror, os.time() + 20 * 60 * 60)
19+ player:addAchievementProgress("Vanity", 300)
20+ else
21+ player:say("Don't be so vain about your appearance.", TALKTYPE_MONSTER_SAY)
22+ end
23+ return true
24+end
A data/actions/scripts/other/watch.lua +4-0 View file
@@ -0,0 +1,4 @@
1+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2+ player:sendTextMessage(MESSAGE_INFO_DESCR, "The time is " .. getFormattedWorldTime() .. ".")
3+ return true
4+end
A data/actions/scripts/other/waterpipe.lua +8-0 View file
@@ -0,0 +1,8 @@
1+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2+ if math.random(3) == 1 then
3+ item:getPosition():sendMagicEffect(CONST_ME_POFF)
4+ else
5+ player:getPosition():sendMagicEffect(CONST_ME_POFF)
6+ end
7+ return true
8+end
A data/actions/scripts/other/windows.lua +52-0 View file
@@ -0,0 +1,52 @@
1+local windows = {
2+ [5303] = 6448, [5304] = 6449, [6438] = 6436, [6436] = 6438,
3+ [6439] = 6437, [6437] = 6439, [6442] = 6440, [6440] = 6442,
4+ [6443] = 6441, [6441] = 6443, [6446] = 6444, [6444] = 6446,
5+ [6447] = 6445, [6445] = 6447, [6448] = 5303, [6449] = 5304,
6+ [6452] = 6450, [6450] = 6452, [6453] = 6451, [6451] = 6453,
7+ [6456] = 6454, [6454] = 6456, [6457] = 6455, [6455] = 6457,
8+ [6460] = 6458, [6458] = 6460, [6461] = 6459, [6459] = 6461,
9+ [6464] = 6462, [6462] = 6464, [6465] = 6463, [6463] = 6465,
10+ [6468] = 6466, [6466] = 6468, [6469] = 6467, [6467] = 6469,
11+ [6472] = 6470, [6470] = 6472, [6473] = 6471, [6471] = 6473,
12+ [6790] = 6788, [6788] = 6790, [6791] = 6789, [6789] = 6791,
13+ [7027] = 7025, [7025] = 7027, [7028] = 7026, [7026] = 7028,
14+ [7031] = 7029, [7029] = 7031, [7032] = 7030, [7030] = 7032,
15+ [10264] = 10266, [10266] = 10264, [10265] = 10267, [10267] = 10265,
16+ [10488] = 10490, [10490] = 10488, [10489] = 10491, [10491] = 10489,
17+ [19427] = 19447, [19428] = 19448, [19441] = 19450, [19440] = 19449,
18+ [19443] = 20180, [19444] = 20181, [19445] = 20183, [19446] = 20184,
19+ [19447] = 19427, [19448] = 19428, [19449] = 19440, [19450] = 19441,
20+ [19974] = 20182, [19975] = 20185, [20180] = 19443, [20181] = 19444,
21+ [20182] = 19974, [20183] = 19445, [20184] = 19446, [20185] = 19975
22+}
23+
24+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
25+ local window = windows[item:getId()]
26+ if not window then
27+ return false
28+ end
29+
30+ local tile = Tile(fromPosition)
31+ local house = tile and tile:getHouse()
32+ if not house then
33+ fromPosition.y = fromPosition.y - 1
34+ tile = Tile(fromPosition)
35+ house = tile and tile:getHouse()
36+ if not house then
37+ fromPosition.y = fromPosition.y + 1
38+ fromPosition.x = fromPosition.x - 1
39+ tile = Tile(fromPosition)
40+ house = tile and tile:getHouse()
41+ end
42+ end
43+
44+ if house and player:getTile():getHouse() ~= house and player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then
45+ return false
46+ end
47+
48+ player:addAchievementProgress("Do Not Disturb", 100)
49+ player:addAchievementProgress("Let the Sunshine In", 100)
50+ item:transform(window)
51+ return true
52+end
A data/actions/scripts/Prophecy_Quest.lua +82-0 View file
@@ -0,0 +1,82 @@
1+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2+ if item.actionid == 10155 then
3+ if player:getStorageValue(_QUESTLOG[42].Value[01]) < 01 then
4+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.")
5+ player:setStorageValue(_QUESTLOG[42].Value[01], 01)
6+ player:setStorageValue(_QUESTLOG[42].UID_01, 02)
7+ player:getPosition():sendMagicEffect(14)
8+ else
9+ player:getPosition():sendMagicEffect(03)
10+ end
11+ elseif item.actionid == 10156 then
12+ if player:getStorageValue(_QUESTLOG[42].Value[01]) == 01 then
13+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado. Procure por mais.")
14+ player:setStorageValue(_QUESTLOG[42].Value[01], 02)
15+ player:getPosition():sendMagicEffect(14)
16+ else
17+ if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then
18+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.")
19+ player:getPosition():sendMagicEffect(03)
20+ else
21+ player:getPosition():sendMagicEffect(03)
22+ end
23+ end
24+ elseif item.actionid == 10157 then
25+ if player:getStorageValue(_QUESTLOG[42].Value[01]) == 02 then
26+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado. Procure por mais.")
27+ player:setStorageValue(_QUESTLOG[42].Value[01], 03)
28+ player:getPosition():sendMagicEffect(14)
29+ else
30+ if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then
31+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.")
32+ player:getPosition():sendMagicEffect(03)
33+ else
34+ player:getPosition():sendMagicEffect(03)
35+ end
36+ end
37+ elseif item.actionid == 10158 then
38+ if player:getStorageValue(_QUESTLOG[42].Value[01]) == 03 then
39+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado. Procure por mais.")
40+ player:setStorageValue(_QUESTLOG[42].Value[01], 04)
41+ player:getPosition():sendMagicEffect(14)
42+ else
43+ if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then
44+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.")
45+ player:getPosition():sendMagicEffect(03)
46+ else
47+ player:getPosition():sendMagicEffect(03)
48+ end
49+ end
50+ elseif item.actionid == 10159 then
51+ if player:getStorageValue(_QUESTLOG[42].Value[01]) == 04 then
52+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado. Procure por mais.")
53+ player:setStorageValue(_QUESTLOG[42].Value[01], 05)
54+ player:getPosition():sendMagicEffect(14)
55+ else
56+ if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then
57+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.")
58+ player:getPosition():sendMagicEffect(03)
59+ else
60+ player:getPosition():sendMagicEffect(03)
61+ end
62+ end
63+ elseif item.actionid == 10160 then
64+ if player:getStorageValue(_QUESTLOG[42].Value[01]) == 05 then
65+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o da profecia encontrado.\nAcesso ao portal liberado.")
66+ player:setStorageValue(_QUESTLOG[42].Value[01], 06)
67+ player:setStorageValue(_QUESTLOG[42].UID_01, 03)
68+ player:getPosition():sendMagicEffect(14)
69+
70+ doBackpack(player, 12)
71+ player:sendCancelMessage("@RemoveMarkMap")
72+ else
73+ if player:getStorageValue(_QUESTLOG[42].Value[01]) < 05 then
74+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Drag�o fora da ordem.")
75+ player:getPosition():sendMagicEffect(03)
76+ else
77+ player:getPosition():sendMagicEffect(03)
78+ end
79+ end
80+ end
81+ return true
82+end
A data/actions/scripts/Saqueadores.lua +199-0 View file
@@ -0,0 +1,199 @@
1+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2+
3+ local LEVEL_NEED = 100
4+ local GLOBAL_RANK = 00
5+ local PLAYER_RANK = player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01])
6+ if player:getLevel() >= LEVEL_NEED then
7+ if item.actionid >= 3001 and item.actionid <= 3020 then
8+ GLOBAL_RANK = 01
9+ elseif item.actionid >= 3021 and item.actionid <= 3040 then
10+ if PLAYER_RANK >= 02 then
11+ GLOBAL_RANK = 02
12+ end
13+ elseif item.actionid >= 3041 and item.actionid <= 3060 then
14+ if PLAYER_RANK >= 03 then
15+ GLOBAL_RANK = 03
16+ end
17+ elseif item.actionid >= 3061 and item.actionid <= 3080 then
18+ if PLAYER_RANK >= 04 then
19+ GLOBAL_RANK = 04
20+ end
21+ elseif item.actionid >= 3081 and item.actionid <= 3099 then
22+ if PLAYER_RANK >= 05 then
23+ GLOBAL_RANK = 05
24+ end
25+ end
26+ else
27+ player:getPosition():sendMagicEffect(03)
28+ return false
29+ end
30+
31+ if GLOBAL_RANK > 00 then
32+ local CHEST_ID = (item.actionid - 3000)
33+ local GLOBAL_POSITION = 00
34+
35+ if GLOBAL_RANK == 02 then
36+ CHEST_ID = (item.actionid - 3020)
37+ elseif GLOBAL_RANK == 03 then
38+ CHEST_ID = (item.actionid - 3040)
39+ elseif GLOBAL_RANK == 04 then
40+ CHEST_ID = (item.actionid - 3060)
41+ elseif GLOBAL_RANK == 05 then
42+ CHEST_ID = (item.actionid - 3080)
43+ end
44+
45+ if CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][01]) then
46+ GLOBAL_POSITION = 01
47+ elseif CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][02]) then
48+ GLOBAL_POSITION = 02
49+ elseif CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][03]) then
50+ GLOBAL_POSITION = 03
51+ elseif CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][04]) then
52+ GLOBAL_POSITION = 04
53+ elseif CHEST_ID == Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][05]) then
54+ GLOBAL_POSITION = 05
55+ end
56+
57+ if GLOBAL_POSITION > 00 then
58+ local CHEST_ID = Game.getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][GLOBAL_RANK][GLOBAL_POSITION])
59+ if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][02][GLOBAL_RANK][GLOBAL_POSITION]) ~= CHEST_ID then
60+ local X = _GLOBAL_RANDOM.SAQUEADORES[GLOBAL_RANK][CHEST_ID]
61+ if X.REC[01][01] == 0002 then
62+ player:sendCancelMessage("@PassChest 01 " ..X.REC[01][02].. " " ..GLOBAL_POSITION.. " " ..CHEST_ID)
63+ return false
64+ end
65+ for REWARD = 01, #X.REC do
66+ if X.REC[REWARD][01] == 0000 then -- EXP
67+ player:addExperience(X.REC[REWARD][02], true, true)
68+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - EXP: " ..X.REC[REWARD][02])
69+ if _DEBUG_MODE then
70+ print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: EXP [ " ..X.REC[REWARD][02].. " ]")
71+ end
72+ elseif X.REC[REWARD][01] == 0001 then -- GOLD
73+ PlayerGoldCoins(player, 02, X.REC[REWARD][02])
74+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Gold Coin: " ..X.REC[REWARD][02])
75+ if _DEBUG_MODE then
76+ print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Gold [ " ..X.REC[REWARD][02].. " ]")
77+ end
78+ elseif X.REC[REWARD][01] == 0003 then -- TASK POINTS (BRANCOS)
79+ PlayerTokenCoins(player, 01, X.REC[REWARD][02], 01)
80+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Pontos Brancos: " ..X.REC[REWARD][02])
81+ if _DEBUG_MODE then
82+ print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: White Task [ " ..X.REC[REWARD][02].. " ]")
83+ end
84+ elseif X.REC[REWARD][01] == 0004 then -- TASK POINTS (AMARELOS)
85+ PlayerTokenCoins(player, 02, X.REC[REWARD][02], 01)
86+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Pontos Amarelos: " ..X.REC[REWARD][02])
87+ if _DEBUG_MODE then
88+ print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Yellow Task [ " ..X.REC[REWARD][02].. " ]")
89+ end
90+ elseif X.REC[REWARD][01] == 0005 then -- TASK POINTS (AZUIS)
91+ PlayerTokenCoins(player, 03, X.REC[REWARD][02], 01)
92+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Pontos Azuis: " ..X.REC[REWARD][02])
93+ if _DEBUG_MODE then
94+ print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Blue Task [ " ..X.REC[REWARD][02].. " ]")
95+ end
96+ elseif X.REC[REWARD][01] == 0006 then -- CRIPTOMOEDAS
97+ if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) < 00 then
98+ player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (X.REC[REWARD][02] + 01))
99+ else
100+ player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + X.REC[REWARD][02]))
101+ end
102+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - Criptomoedas: " ..X.REC[REWARD][02])
103+ if _DEBUG_MODE then
104+ print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Criptomoedas [ " ..X.REC[REWARD][02].. " ]")
105+ end
106+ else -- ITEMS
107+ if doBackpack(player, 00, 03, 00, 01) then
108+ local itemid = X.REC[REWARD][01]
109+ local slot = 03
110+ local ext = 00
111+ local rare = _ITEMS[itemid].RARE
112+ local star = _ITEMS[itemid].STAR
113+ local qnt = X.REC[REWARD][02]
114+ doBackpack(player, 03, slot, ext, 01, itemid) -- Procurar
115+ if doBackpack(player, 01, slot, ext, 00, itemid, rare, star, qnt) then
116+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Recompensa - " .._ITEMS[itemid].NAME.. ", x" ..X.REC[REWARD][02])
117+ if _DEBUG_MODE then
118+ print("[ACTION - SAQUEADORES] " ..player:getName().. " - Recompensa Saqueadores: Item [ " .._ITEMS[itemid].NAME.. ", x" ..X.REC[REWARD][02].. " ]")
119+ end
120+ player:getPosition():sendMagicEffect(14)
121+ end
122+ else
123+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sua Backpack esta cheia.\nObtenha espaco para finalizar a Quest.")
124+ player:getPosition():sendMagicEffect(03)
125+ return false
126+ end
127+ end
128+
129+ local PLAYER_VALUE = player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02])
130+ if PLAYER_RANK < 01 then PLAYER_RANK = 01 end
131+ if PLAYER_VALUE < 00 then PLAYER_VALUE = 00 end
132+
133+ if PLAYER_RANK == GLOBAL_RANK then
134+ if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02]) < 00 then
135+ player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02], 01)
136+ else
137+ player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02], (player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02]) + 01))
138+ local MAX_RANK = _GLOBAL_RANDOM.SAQUEADORES[00][00][PLAYER_RANK]
139+ if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01]) < 05 then
140+ if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][02]) == MAX_RANK then
141+ if player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01]) < 01 then
142+ player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01], 02)
143+ else
144+ player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01], (player:getStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][03][01]) + 01))
145+ end
146+
147+ if _DEBUG_MODE then
148+ print("[ACTION - SAQUEADORES] " ..player:getName().. " - Avan�ou de Rank")
149+ end
150+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "[SAQUEADOR] Voc� avan�ou de RANK.")
151+ end
152+ end
153+ end
154+ end
155+
156+ -- DESAFIO
157+ if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then
158+ onPlayerDesafios(player, 75, 01)
159+ end
160+ if player:getStorageValue(_QUESTLOG[178].UID_01) == 01 then
161+ if player:getStorageValue(11009) == 04 then
162+ player:setStorageValue(_QUESTLOG[178].UID_01, 100)
163+ player:setStorageValue(11009, nil)
164+
165+ doBackpack(player, 12)
166+ player:sendCancelMessage("@LoadQuestWindows")
167+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.")
168+ else
169+ player:setStorageValue(11009, (player:getStorageValue(11009) + 01))
170+ doBackpack(player, 12)
171+ end
172+ end
173+ player:sendCancelMessage("@RemoveMarkMap")
174+ player:setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][02][GLOBAL_RANK][GLOBAL_POSITION], CHEST_ID)
175+ player:getPosition():sendMagicEffect(14)
176+ return false
177+ end
178+ else
179+ player:getPosition():sendMagicEffect(03)
180+ end
181+ else
182+ player:getPosition():sendMagicEffect(03)
183+ end
184+ else
185+ player:getPosition():sendMagicEffect(03)
186+ end
187+ return true
188+end
189+
190+
191+
192+
193+
194+
195+
196+
197+
198+
199+
A data/actions/scripts/Statues.lua +11-0 View file
@@ -0,0 +1,11 @@
1+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
2+ if item.itemid == 1453 then
3+ item:transform(1454)
4+ elseif item.itemid == 1454 then
5+ item:transform(1452)
6+ elseif item.itemid == 1452 then
7+ item:transform(1455)
8+ elseif item.itemid == 1455 then
9+ item:transform(1453)
10+ end
11+end
A data/actions/scripts/TesouroImperialIV.lua +146-0 View file
@@ -0,0 +1,146 @@
1+ local Timer_01 = 00
2+ local Timer_02 = 00
3+ local Timer_03 = 00
4+ local Timer_04 = 00
5+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
6+ local Player_01 = Tile(3617, 1264, 8)
7+ local Player_02 = Tile(3620, 1267, 8)
8+ local Player_03 = Tile(3617, 1270, 8)
9+ local Player_04 = Tile(3614, 1267, 8)
10+
11+ local Player_One = Player_01:getTopCreature()
12+ local Player_Two = Player_02:getTopCreature()
13+ local Player_Tre = Player_03:getTopCreature()
14+ local Player_Fou = Player_04:getTopCreature()
15+
16+ if item.itemid == 1946 then
17+ item:transform(1945)
18+ return true
19+ end
20+ if Player_One and Player_One:isPlayer() and Player_Two and Player_Two:isPlayer() and Player_Tre and Player_Tre:isPlayer() and Player_Fou and Player_Fou:isPlayer() then
21+ item:transform(1946)
22+ Player_One:teleportTo({x=3619, y=1296, z=08})
23+ Player_One:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
24+ Timer_01 = 59
25+ addEvent(onTesouroUm, 1000)
26+
27+ Player_Two:teleportTo({x=3619, y=1310, z=08})
28+ Player_Two:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
29+ Timer_02 = 59
30+ addEvent(onTesouroDois, 1000)
31+
32+ Player_Tre:teleportTo({x=3619, y=1324, z=08})
33+ Player_Tre:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
34+ Timer_03 = 59
35+ addEvent(onTesouroTres, 1000)
36+
37+ Player_Fou:teleportTo({x=3619, y=1338, z=08})
38+ Player_Fou:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
39+ Timer_04 = 59
40+ addEvent(onTesouroQuatro, 1000)
41+ else
42+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Todos precisam ficar em suas posi�es.")
43+ player:getPosition():sendMagicEffect(03)
44+ end
45+ return true
46+end
47+function onTesouroUm()
48+ local from = {x=3616, y=1293, z=08}
49+ local to = {x=3622, y=1299, z=08}
50+ for A = from.x, to.x do
51+ for B = from.y, to.y do
52+ for C = from.z, to.z do
53+ local tile = Tile(A, B, C)
54+ if tile ~= nil then
55+ local creature = tile:getTopCreature()
56+ if creature and creature:isPlayer() then
57+ if Timer_01 == 00 then
58+ creature:teleportTo({x=3602, y=1261, z=08})
59+ creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
60+ break
61+ else
62+ Timer_01 = Timer_01 - 01
63+ addEvent(onTesouroUm, 1000)
64+ break
65+ end
66+ end
67+ end
68+ end
69+ end
70+ end
71+end
72+function onTesouroDois()
73+ local from = {x=3616, y=1307, z=08}
74+ local to = {x=3622, y=1313, z=08}
75+ for A = from.x, to.x do
76+ for B = from.y, to.y do
77+ for C = from.z, to.z do
78+ local tile = Tile(A, B, C)
79+ if tile ~= nil then
80+ local creature = tile:getTopCreature()
81+ if creature and creature:isPlayer() then
82+ if Timer_02 == 00 then
83+ creature:teleportTo({x=3602, y=1261, z=08})
84+ creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
85+ break
86+ else
87+ Timer_02 = Timer_02 - 01
88+ addEvent(onTesouroDois, 1000)
89+ break
90+ end
91+ end
92+ end
93+ end
94+ end
95+ end
96+end
97+function onTesouroTres()
98+ local from = {x=3616, y=1321, z=08}
99+ local to = {x=3622, y=1327, z=08}
100+ for A = from.x, to.x do
101+ for B = from.y, to.y do
102+ for C = from.z, to.z do
103+ local tile = Tile(A, B, C)
104+ if tile ~= nil then
105+ local creature = tile:getTopCreature()
106+ if creature and creature:isPlayer() then
107+ if Timer_03 == 00 then
108+ creature:teleportTo({x=3602, y=1261, z=08})
109+ creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
110+ break
111+ else
112+ Timer_03 = Timer_03 - 01
113+ addEvent(onTesouroTres, 1000)
114+ break
115+ end
116+ end
117+ end
118+ end
119+ end
120+ end
121+end
122+function onTesouroQuatro()
123+ local from = {x=3616, y=1335, z=08}
124+ local to = {x=3622, y=1341, z=08}
125+ for A = from.x, to.x do
126+ for B = from.y, to.y do
127+ for C = from.z, to.z do
128+ local tile = Tile(A, B, C)
129+ if tile ~= nil then
130+ local creature = tile:getTopCreature()
131+ if creature and creature:isPlayer() then
132+ if Timer_04 == 00 then
133+ creature:teleportTo({x=3602, y=1261, z=08})
134+ creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
135+ break
136+ else
137+ Timer_04 = Timer_04 - 01
138+ addEvent(onTesouroQuatro, 1000)
139+ break
140+ end
141+ end
142+ end
143+ end
144+ end
145+ end
146+end
A data/actions/scripts/Teste.lua +167-0 View file
@@ -0,0 +1,167 @@
1+local M = 0
2+local S = 0
3+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
4+ local id = {
5+ [1] = { 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
6+ 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019,
7+ 1020, 1021, 1022, 1023, 1024, 1025, 1026 },
8+
9+ [2] = { 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
10+ 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
11+ 2020, 2021, 2022, 2023, 2024 },
12+
13+ [3] = { 10500, 10501, 10502, 10503, 10504, 10505, 10506, 10507, 10508,
14+ 10509, 10510, 10511, 10512, 10513, 10514, 10515, 10516, 10517,
15+ 10518, 10519, 10520, 10521, 10522, 10523, 10524, 10525, 10526 },
16+ --[[[3] = { 11001, 11002, 11003, 11004, 11005, 11006, 11007, 11008, 11009,
17+ 11010, 11011, 11012, 11013, 11014, 11015, 11016, 11017, 11018,
18+ 11019, 11020, 11021, 11022, 11023, 11024, 11025, 11026, 11027 },]]
19+
20+ [4] = { 4000, 4001, 4002, 4003, 4004, 4005, 4006, 4007, 4008, 4009,
21+ 4010, 4011, 4012, 4013, 4014, 4015, 4016, 4017, 4018, 4019,
22+ 4020, 4021, 4022, 4023, 4024, 4025, 4026, 4027, 4028, 4029,
23+ 4030, 4031, 4032, 4033, 4034, 4035, 4036, 4037, 4038, 4039,
24+ 4040, 4041, 4042, 4043, 4044, 4045, 4046, 4047, 4048, 4049 },
25+
26+ [5] = { 5000, 5001, 5002, 5003, 5004, 5005, 5006, 5007, 5008, 5009,
27+ 5010, 5011, 5012, 5013, 5014, 5015, 5016, 5017, 5018, 5019,
28+ 5020, 5021, 5022, 5023, 5024, 5025, 5026, 5027, 5028, 5029,
29+ 5030, 5031, 5032, 5033, 5034, 5035, 5036, 5037, 5038, 5039,
30+ 5040, 5041, 5042, 5043, 5044, 5045, 5046, 5047, 5048 },
31+
32+ [6] = { 6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009,
33+ 6010, 6011, 6012, 6013, 6014, 6015, 6016, 6017, 6018, 6019,
34+ 6020, 6021, 6022, 6023 },
35+
36+ [7] = { 7000, 7001, 7002, 7003, 7004, 7005, 7006, 7007, 7008, 7009, 7010 },
37+
38+ [8] = { 8000, 8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009,
39+ 8010, 8011, 8012, 8013, 8014, 8015, 8016, 8017, 8018, 8019,
40+ 8020, 8021, 8022, 8023, 8024 },
41+
42+ [9] = { 9000, 9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009,
43+ 9010, 9011, 9012, 9013, 9014, 9015, 9016, 9017, 9018, 9019,
44+ 9020 },
45+ }
46+
47+ local type = 0
48+ local slot = math.random(1, 1)
49+ local itemid = 1002 --id[slot][math.random(01, #id[slot])]
50+ local rare = 02 --math.random(00, 04)
51+ local star = 01 --math.random(00, 02)
52+ local qnt = 01 --math.random(01, 05)
53+ local ext = 0
54+
55+ if type == 0 then
56+ if _ITEMS[itemid] then
57+ if doBackpack(player, 00, slot, ext, 01) then
58+ if slot == 3 then
59+ doBackpack(player, 03, slot, ext, 01, itemid) -- Procurar
60+ if doBackpack(player, 01, slot, ext, 0, itemid, rare, star, qnt) then
61+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o item [ " .._ITEMS[itemid].NAME.. ", x" ..qnt.." ].")
62+ player:getPosition():sendMagicEffect(14)
63+ end
64+ else
65+ if doBackpack(player, 01, slot, ext, 0, itemid, rare, star) then
66+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o item [ " .._ITEMS[itemid].NAME.. " ].")
67+ player:getPosition():sendMagicEffect(14)
68+ end
69+ end
70+ else
71+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Sua Backpack esta cheia.")
72+ player:getPosition():sendMagicEffect(03)
73+ end
74+ else
75+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Tente novamente.")
76+ player:getPosition():sendMagicEffect(03)
77+ end
78+ elseif type == 1 then
79+ local sumid = math.random(1000, 1156)
80+ local star = _SUMMON[sumid].STAR
81+ if doSummon(player, 02, star, sumid) == 0 then
82+ doSummon(player, 00, star)
83+ doSummon(player, 01, star, sumid)
84+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Voce recebeu o summon \n[ " .._SUMMON[sumid].NAME.. " ]\nEstrelas [ " ..star.. " ].")
85+ player:getPosition():sendMagicEffect(14)
86+ doSummon(player, 00, 00)
87+ else
88+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Você já possui o summon [ " .._SUMMON[sumid].NAME.. " ].\nTente novamente")
89+ player:getPosition():sendMagicEffect(03)
90+ end
91+ elseif type == 2 then
92+ M = 00
93+ S = 15
94+ local party = player:getParty()
95+ if not party then
96+ player:sendCancelMessage("@DGTime 01")
97+ else
98+ local members = party:getMembers()
99+ members[#members + 1] = party:getLeader()
100+ for _, member in ipairs(members) do
101+ member:sendCancelMessage("@DGTime 01")
102+ end
103+ end
104+
105+ addEvent(onCountTimer, 1000, player.uid)
106+ else
107+ player:sendCancelMessage("@TaskMSG")
108+ end
109+end
110+
111+function onCountTimer(cid)
112+ local player = Player(cid)
113+ if player then
114+ if M == 0 and S == 0 then
115+ local party = player:getParty()
116+ if not party then
117+ player:sendCancelMessage("@DGTime 00")
118+ else
119+ local members = party:getMembers()
120+ members[#members + 1] = party:getLeader()
121+ for _, member in ipairs(members) do
122+ member:sendCancelMessage("@DGTime 00")
123+ end
124+ end
125+ else
126+ local M1 = 0 local S1 = 0
127+ local M2 = 0 local S2 = 0
128+
129+ if M > 0 and S > 0 then
130+ S = S - 1
131+ elseif M > 0 and S == 0 then
132+ S = 59
133+ M = M - 1
134+ elseif M == 0 and S > 0 then
135+ S = S - 1
136+ end
137+
138+ if string.len(M) == 2 then
139+ M1 = string.sub(M, 1, 1)
140+ M2 = string.sub(M, 2, 2)
141+ else
142+ M1 = 0
143+ M2 = string.sub(M, 1, 1)
144+ end
145+ if string.len(S) == 2 then
146+ S1 = string.sub(S, 1, 1)
147+ S2 = string.sub(S, 2, 2)
148+ else
149+ S1 = 0
150+ S2 = string.sub(S, 1, 1)
151+ end
152+
153+ local party = player:getParty()
154+ if not party then
155+ player:sendCancelMessage("@CountTempo " ..M1.. " " ..M2.." " ..S1.. " " ..S2)
156+ else
157+ local members = party:getMembers()
158+ members[#members + 1] = party:getLeader()
159+ for _, member in ipairs(members) do
160+ member:sendCancelMessage("@CountTempo " ..M1.. " " ..M2.." " ..S1.. " " ..S2)
161+ end
162+ end
163+
164+ addEvent(onCountTimer, 1000, player.uid)
165+ end
166+ end
167+end
A data/actions/scripts/Warzone.lua +87-0 View file
@@ -0,0 +1,87 @@
1+local exhaust = {}
2+local timeExhaust = 05 * 1000
3+
4+function onUse(player, item, fromPosition, target, toPosition, isHotkey)
5+
6+ if player:getLevel() < _GLOBAL_RANDOM.WARZONE.LEVEL then
7+ player:sendCancelMessage("Somente jogadores de Nv. " .._GLOBAL_RANDOM.WARZONE.LEVEL.. " ou superior podem batalhar.")
8+ player:getPosition():sendMagicEffect(03)
9+ return false
10+ end
11+ if player:getVocation():getBase():getId() < 01 then
12+ player:sendCancelMessage("Jogadores sem Vocation n�o pode entrar.")
13+ player:getPosition():sendMagicEffect(03)
14+ return false
15+ end
16+
17+ if player:getStorageValue(_SYSTEM.PLAYER_EXHAUST) < 01 then
18+ if item.actionid == 2053 then
19+ local QntPlayers = 0
20+ local from = {x=3893, y=1122, z=07}
21+ local to = {x=4047, y=1258, z=07}
22+ for A = from.x, to.x do
23+ for B = from.y, to.y do
24+ for C = from.z, to.z do
25+ local tile = Tile(A, B, C)
26+ if tile then
27+ local creature = tile:getTopCreature()
28+ if creature and creature:isPlayer() then
29+ QntPlayers = QntPlayers + 01
30+ end
31+ end
32+ end
33+ end
34+ end
35+
36+ local title = "Entrada para a Warzone"
37+ local message = "Atualmente h� " ..QntPlayers.. " jogador(es) na Warzone.\nDeseja entrar e batalhar?"
38+ local startOracle = ModalWindow(1000, title, message)
39+ startOracle:addButton(100, "Yes")
40+ startOracle:addButton(101, "No")
41+ startOracle:setDefaultEnterButton(100)
42+ startOracle:setDefaultEscapeButton(101)
43+ startOracle:sendToPlayer(player)
44+
45+ player:setStorageValue(_SYSTEM.PLAYER_EXHAUST, 01)
46+ local cid = player:getId()
47+ if not exhaust[cid] then
48+ exhaust[cid] = addEvent(onPlayerExhaust, timeExhaust, cid)
49+ end
50+
51+ elseif item.actionid == 2054 then
52+ local title = "Saida da Warzone"
53+ local message = "Deseja sair da Warzone?"
54+ local startOracle = ModalWindow(1001, title, message)
55+ startOracle:addButton(100, "Yes")
56+ startOracle:addButton(101, "No")
57+ startOracle:setDefaultEnterButton(100)
58+ startOracle:setDefaultEscapeButton(101)
59+ startOracle:sendToPlayer(player)
60+
61+ elseif item.actionid == 2055 then
62+ local title = "Arme-se para batalhar"
63+ local message = "Qual categoria de arma deseja usar?\nA arma ser� escolhida aleat�riamente.\n\n"
64+ local startOracle = ModalWindow(1002, title, message)
65+ startOracle:addChoice(1, "Pistola")
66+ startOracle:addChoice(2, "Rifle")
67+ startOracle:addChoice(3, "Metralhadora")
68+ startOracle:addChoice(4, "Espingarda")
69+
70+ startOracle:addButton(100, "Escolher")
71+ startOracle:addButton(101, "Cancelar")
72+ startOracle:setDefaultEnterButton(100)
73+ startOracle:setDefaultEscapeButton(101)
74+ startOracle:sendToPlayer(player)
75+ end
76+ else
77+ player:sendCancelMessage("Aguarde alguns segundos para usar novamente.")
78+ player:getPosition():sendMagicEffect(03)
79+ end
80+
81+ return true
82+end
83+function onPlayerExhaust(cid)
84+ local player = Player(cid)
85+ player:setStorageValue(_SYSTEM.PLAYER_EXHAUST, nil)
86+ exhaust[cid] = nil
87+end
A data/chatchannels/chatchannels.xml +7-0 View file
@@ -0,0 +1,7 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<channels>
3+ <channel id="2" name="Tutor" script="tutor.lua" />
4+ <channel id="3" name="Global Chat" public="1" script="worldchat.lua" />
5+ <channel id="4" name="Help" public="1" script="help.lua" />
6+ <channel id="7" name="Lua_advanced" public="1" script="execute.lua" />
7+</channels>
A data/chatchannels/scripts/execute.lua +56-0 View file
@@ -0,0 +1,56 @@
1+function canJoin(player)
2+ if player:getGroup():getAccess() then
3+ return true
4+ end
5+
6+ return false
7+end
8+
9+local function cleanGlobalVariables()
10+ _G["cid"] = nil
11+ _G["player"] = nil
12+ _G["creature"] = nil
13+ _G["pos"] = nil
14+ _G["tile"] = nil
15+ _G["container"] = nil
16+ _G["group"] = nil
17+ _G["vocation"] = nil
18+ _G["town"] = nil
19+ _G["house"] = nil
20+ _G["party"] = nil
21+end
22+
23+function onSpeak(player, type, message)
24+ local pos = Position(player:getPosition())
25+ local tile = Tile(pos)
26+
27+ _G["cid"] = player:getId()
28+ _G["player"] = player
29+ _G["creature"] = Creature(player:getId())
30+ _G["pos"] = pos
31+ _G["tile"] = tile
32+ _G["container"] = player:getSlotItem(CONST_SLOT_BACKPACK)
33+ _G["group"] = player:getGroup()
34+ _G["vocation"] = player:getVocation()
35+ _G["town"] = player:getTown()
36+ _G["house"] = tile:getHouse()
37+ _G["party"] = player:getParty()
38+
39+ local res, err = loadstring(message)
40+ if res then
41+ local ret, err = pcall(res)
42+ if not ret then
43+ player:sendChannelMessage(player:getName(), "Lua Script Error: " .. err .. ".", TALKTYPE_CHANNEL_O, 7)
44+ cleanGlobalVariables()
45+ return false
46+ end
47+ else
48+ player:sendChannelMessage(player:getName(), "Lua Script Error: " .. err .. ".", TALKTYPE_CHANNEL_O, 7)
49+ cleanGlobalVariables()
50+ return false
51+ end
52+
53+ player:sendChannelMessage("", player:getName() .. ">> " .. message, TALKTYPE_CHANNEL_Y, 7)
54+ cleanGlobalVariables()
55+ return false
56+end
A data/chatchannels/scripts/help.lua +77-0 View file
@@ -0,0 +1,77 @@
1+local CHANNEL_HELP = 7
2+
3+local muted = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT)
4+muted:setParameter(CONDITION_PARAM_SUBID, CHANNEL_HELP)
5+muted:setParameter(CONDITION_PARAM_TICKS, 3600000)
6+
7+function onSpeak(player, type, message)
8+ local playerAccountType = player:getAccountType()
9+ if player:getLevel() == 1 and playerAccountType == ACCOUNT_TYPE_NORMAL then
10+ player:sendCancelMessage("Voc� n�o pode falar em canais enquanto estiver no n�vel 1.")
11+ return false
12+ end
13+
14+ if player:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
15+ player:sendCancelMessage("Voc� foi silenciado no canal de Ajuda por us�-lo de forma inadequada.")
16+ return false
17+ end
18+
19+ if playerAccountType >= ACCOUNT_TYPE_TUTOR then
20+ if string.sub(message, 1, 6) == "!mute " then
21+ local targetName = string.sub(message, 7)
22+ local target = Player(targetName)
23+ if target then
24+ if playerAccountType > target:getAccountType() then
25+ if not target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
26+ target:addCondition(muted)
27+ sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " foi silenciado por " .. player:getName() .. " por usar o Canal de Ajuda de forma inadequada.")
28+ else
29+ player:sendCancelMessage("Esse jogador j� est� silenciado.")
30+ end
31+ else
32+ player:sendCancelMessage("Voc� n�o est� autorizado a silenciar esse jogador.")
33+ end
34+ else
35+ player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
36+ end
37+ return false
38+ elseif string.sub(message, 1, 8) == "!unmute " then
39+ local targetName = string.sub(message, 9)
40+ local target = Player(targetName)
41+ if target then
42+ if playerAccountType > target:getAccountType() then
43+ if target:getCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) then
44+ target:removeCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP)
45+ sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been unmuted by " .. player:getName() .. ".")
46+ else
47+ player:sendCancelMessage("Esse jogador n�o est� mudo.")
48+ end
49+ else
50+ player:sendCancelMessage("Voc� n�o est� autorizado a ativar o som desse player.")
51+ end
52+ else
53+ player:sendCancelMessage(RETURNVALUE_PLAYERWITHTHISNAMEISNOTONLINE)
54+ end
55+ return false
56+ end
57+ end
58+
59+ if type == TALKTYPE_CHANNEL_Y then
60+ if playerAccountType >= ACCOUNT_TYPE_TUTOR or player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then
61+ type = TALKTYPE_CHANNEL_O
62+ end
63+ elseif type == TALKTYPE_CHANNEL_O then
64+ if playerAccountType < ACCOUNT_TYPE_TUTOR and not player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then
65+ type = TALKTYPE_CHANNEL_Y
66+ end
67+ elseif type == TALKTYPE_CHANNEL_R1 then
68+ if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not player:hasFlag(PlayerFlag_CanTalkRedChannel) then
69+ if playerAccountType >= ACCOUNT_TYPE_TUTOR or player:hasFlag(PlayerFlag_TalkOrangeHelpChannel) then
70+ type = TALKTYPE_CHANNEL_O
71+ else
72+ type = TALKTYPE_CHANNEL_Y
73+ end
74+ end
75+ end
76+ return type
77+end
A data/chatchannels/scripts/tutor.lua +21-0 View file
@@ -0,0 +1,21 @@
1+function canJoin(player)
2+ return player:getAccountType() >= ACCOUNT_TYPE_TUTOR
3+end
4+
5+function onSpeak(player, type, message)
6+ local playerAccountType = player:getAccountType()
7+ if type == TALKTYPE_CHANNEL_Y then
8+ if playerAccountType >= ACCOUNT_TYPE_SENIORTUTOR then
9+ type = TALKTYPE_CHANNEL_O
10+ end
11+ elseif type == TALKTYPE_CHANNEL_O then
12+ if playerAccountType < ACCOUNT_TYPE_SENIORTUTOR then
13+ type = TALKTYPE_CHANNEL_Y
14+ end
15+ elseif type == TALKTYPE_CHANNEL_R1 then
16+ if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not player:hasFlag(PlayerFlag_CanTalkRedChannel) then
17+ type = TALKTYPE_CHANNEL_Y
18+ end
19+ end
20+ return type
21+end
A data/chatchannels/scripts/worldchat.lua +22-0 View file
@@ -0,0 +1,22 @@
1+function onSpeak(player, type, message)
2+ local playerAccountType = player:getAccountType()
3+ if player:getLevel() == 1 and playerAccountType < ACCOUNT_TYPE_GAMEMASTER then
4+ player:sendCancelMessage("You may not speak into channels as long as you are on level 1.")
5+ return false
6+ end
7+
8+ if type == TALKTYPE_CHANNEL_Y then
9+ if playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then
10+ type = TALKTYPE_CHANNEL_O
11+ end
12+ elseif type == TALKTYPE_CHANNEL_O then
13+ if playerAccountType < ACCOUNT_TYPE_GAMEMASTER then
14+ type = TALKTYPE_CHANNEL_Y
15+ end
16+ elseif type == TALKTYPE_CHANNEL_R1 then
17+ if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not player:hasFlag(PlayerFlag_CanTalkRedChannel) then
18+ type = TALKTYPE_CHANNEL_Y
19+ end
20+ end
21+ return type
22+end
A data/creaturescripts/creaturescripts.xml +20-0 View file
@@ -0,0 +1,20 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<creaturescripts>
3+ <event type="healthchange" name="Defense" script="defense.lua" />
4+ <event type="kill" name="onDGKill" script="dg_kill.lua"/>
5+ <!--<event type="death" name="DropLoot" script="droploot.lua" /> -->
6+ <event type="modalwindow" name="DungeonSystem_Modal" script="dungeon_mod.lua"/>
7+ <event type="modalwindow" name="DungeonSystemType_Modal" script="dungeon_mod2.lua"/>
8+ <event type="modalwindow" name="DungeonSystemDetails_Modal" script="dungeon_mod2.lua"/>
9+ <event type="extendedopcode" name="ExtendedOpcode" script="extendedopcode.lua" />
10+ <event type="login" name="PlayerLogin" script="login.lua" />
11+ <event type="logout" name="PlayerLogout" script="logout.lua" />
12+ <event type="ModalWindow" name="ModalWindow_TGun" script="modalWindow.lua"/>
13+ <event type="kill" name="onLoot" script="monster_loot.lua"/>
14+ <!--<event type="death" name="PlayerDeath" script="playerdeath.lua" /> -->
15+ <event type="preparedeath" name="PVPZoneDeath" script="preparedeath.lua" />
16+ <event type="advance" name="QuestLevel" script="quest_level.lua"/>
17+ <event type="death" name="Sentinelas" script="sentinel.lua" />
18+ <event type="think" name="Think" script="think.lua" />
19+ <event type="think" name="partyUpdate" interval="3000" script="partyUpdate.lua" />
20+</creaturescripts>
A data/creaturescripts/lib/creaturescripts.lua +1-0 View file
@@ -0,0 +1,1 @@
1+-- empty file --
A data/creaturescripts/scripts/dg_kill.lua +57-0 View file
@@ -0,0 +1,57 @@
1+function onKill(player, target)
2+ local DG_MONSTER = {
3+ ["Massive Fire Elemental+"] = 01;
4+ ["Shaburak Prince+"] = 01;
5+ ["Yielothax+"] = 01;
6+ ["Nightmare+"] = 01;
7+ ["Eternal Guardian+"] = 01;
8+ }
9+ if not target:isMonster() then
10+ return true
11+ end
12+
13+ local Name = target:getName()
14+ if DG_MONSTER[Name] then
15+ doRemoveCreature(target:getId())
16+ local killer = Creature(player)
17+ if killer and killer:isPlayer() and target:isMonster() then
18+ local party = player:getParty()
19+ local STORAGE_BONE_DOIS = _SYSTEM.DANGEROUS[08][01].STORAGE
20+ if not party then
21+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monstros Skull [ 0" ..player:getStorageValue(STORAGE_BONE_DOIS).. "/05 ].")
22+ if player:getStorageValue(STORAGE_BONE_DOIS) < 00 then
23+ player:setStorageValue(STORAGE_BONE_DOIS, (player:getStorageValue(STORAGE_BONE_DOIS) + 2))
24+ player:getPosition():sendMagicEffect(13)
25+ else
26+ player:setStorageValue(STORAGE_BONE_DOIS, (player:getStorageValue(STORAGE_BONE_DOIS) + 1))
27+ player:getPosition():sendMagicEffect(13)
28+ end
29+
30+ if player:getStorageValue(STORAGE_BONE_DOIS) == 06 then
31+ player:setStorageValue(_SYSTEM.DANGEROUS[08][01].RECOMPENSA[01], _SYSTEM.DANGEROUS[08][01].RECOMPENSA[02])
32+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Todos os Monstros Skull foram eliminados.")
33+ end
34+ else
35+ local members = party:getMembers()
36+ members[#members + 1] = party:getLeader()
37+ for _, member in ipairs(members) do
38+ member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Monstros Skull [ 0" ..member:getStorageValue(STORAGE_BONE_DOIS).. "/05 ].")
39+ if member:getStorageValue(STORAGE_BONE_DOIS) < 00 then
40+ member:setStorageValue(STORAGE_BONE_DOIS, (member:getStorageValue(STORAGE_BONE_DOIS) + 2))
41+ member:getPosition():sendMagicEffect(13)
42+ else
43+ member:setStorageValue(STORAGE_BONE_DOIS, (member:getStorageValue(STORAGE_BONE_DOIS) + 1))
44+ member:getPosition():sendMagicEffect(13)
45+ end
46+
47+ if member:getStorageValue(STORAGE_BONE_DOIS) == 06 then
48+ member:setStorageValue(_SYSTEM.DANGEROUS[08][01].RECOMPENSA[01], _SYSTEM.DANGEROUS[08][01].RECOMPENSA[02])
49+ member:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Todos os Monstros Skull foram eliminados.")
50+ end
51+ end
52+ end
53+ end
54+ end
55+
56+ return true
57+end
A data/creaturescripts/scripts/dungeon_mod.lua +291-0 View file
@@ -0,0 +1,291 @@
1+function onModalWindow(player, modalWindowId, buttonId, choiceId)
2+
3+ player:unregisterEvent("DungeonSystem_Modal")
4+
5+ local dg = DUNGEON_SYSTEM.Dungeons
6+ local msg = DUNGEON_SYSTEM.Messages
7+ local modal = DUNGEON_SYSTEM.Modal
8+ local sto = DUNGEON_SYSTEM.Storages
9+
10+ if (modalWindowId == DUNGEON_SYSTEM.Modal.ID) then
11+
12+ if buttonId == 200 then
13+
14+ local players = {}
15+ for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
16+ for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
17+ for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
18+ local tile = Tile(x, y, z)
19+ local creature = tile:getTopCreature()
20+ if creature and creature:isPlayer() then
21+ players[#players+1] = creature
22+ end
23+ end
24+ end
25+ end
26+
27+ if #players > 0 then
28+ player:getPosition():sendMagicEffect(CONST_ME_POFF)
29+ return player:sendTextMessage(MESSAGE_STATUS_SMALL, msg.PlayerInside)
30+ end
31+
32+ if (dg[choiceId].NeedLevel) then
33+ if (player:getLevel() < dg[choiceId].Level) then
34+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.MsgNeedLevel, dg[choiceId].Level))
35+ return false
36+ end
37+ end
38+
39+ local pt = player:getParty()
40+ local partyMembers
41+
42+ local party = {}
43+ party = partyMembers
44+
45+ local fromPosPlayer = player:getPosition()
46+
47+ if (dg[choiceId].NeedParty) then
48+
49+ if not pt then
50+
51+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgUniqueNeedParty)
52+ return false
53+
54+ else
55+
56+ partyMembers = pt:getMembers()
57+ local party = player:getParty():getMemberCount()
58+
59+ if not (pt:getLeader():getName() == player:getName()) then
60+
61+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgLeaderParty)
62+ return false
63+
64+ else
65+
66+ local partyMaisUm = party+1
67+
68+ if not (partyMaisUm == dg[choiceId].AmountParty) then
69+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.MsgNeedParty, dg[choiceId].AmountParty))
70+ return false
71+ end
72+
73+ local names = {}
74+ local posOfPlayer = {}
75+
76+ for i = 1, party do
77+
78+ local ppt = partyMembers[i]
79+ local fromPosPpt = ppt:getPosition()
80+
81+ if DUNGEON_SYSTEM.PzToEntry then
82+ if not getTileInfo(fromPosPpt).protection then
83+ player:getPosition():sendMagicEffect(CONST_ME_POFF)
84+ return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzMsg)
85+ elseif not getTileInfo(fromPosPlayer).protection then
86+ player:getPosition():sendMagicEffect(CONST_ME_POFF)
87+ return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzSoloMsg)
88+ end
89+ end
90+
91+ -- SE TEM COOLDOWN
92+ if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 or ppt:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
93+ if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
94+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.ToCooldown, string.format(player:getStorageValue(sto.TimerCooldown)-os.time())))
95+ player:getPosition():sendMagicEffect(CONST_ME_POFF)
96+ ppt:getPosition():sendMagicEffect(CONST_ME_POFF)
97+ else
98+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.WaitFriendsCooldown, string.format(ppt:getStorageValue(sto.TimerCooldown)-os.time())))
99+ player:getPosition():sendMagicEffect(CONST_ME_POFF)
100+ ppt:getPosition():sendMagicEffect(CONST_ME_POFF)
101+ end
102+ return false
103+ end
104+
105+ names[i] = ppt:getName()
106+
107+ end
108+
109+ local positionPlayer = player:getPosition()
110+ local distance = DUNGEON_SYSTEM.SQMsDistanceOfLeader
111+
112+ for x = positionPlayer.x - distance, positionPlayer.x + distance do
113+ for y = positionPlayer.y - distance, positionPlayer.y + distance do
114+ for z = positionPlayer.z, positionPlayer.z do
115+ local tileP = Tile(x, y, z)
116+ local creatureP = tileP:getTopCreature()
117+ if creatureP and creatureP:isPlayer() then
118+ for xx = 1, #names do
119+ if creatureP:getName() == names[xx] then
120+ posOfPlayer[#posOfPlayer+1] = creatureP
121+ end
122+ end
123+ end
124+ end
125+ end
126+ end
127+
128+ if #posOfPlayer+1 ~= dg[choiceId].AmountParty then
129+ return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.MsgDistanceLeader)
130+ end
131+
132+ if dg[choiceId].SpawnMonsters then
133+ for m, l in pairs(dg[choiceId].Monsters) do
134+ Game.createMonster(m, l)
135+ end
136+ end
137+
138+ player:teleportTo(dg[choiceId].DungeonPos)
139+ player:getPosition():sendMagicEffect(40)
140+ player:say(msg.ToEntry, TALKTYPE_MONSTER_SAY)
141+
142+ addEvent(function()
143+ player:teleportTo(fromPosPlayer)
144+ player:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
145+ player:getPosition():sendMagicEffect(40)
146+ player:popupFYI(msg.ToFail)
147+
148+ -- Remove All monsters
149+ local monsterPos = {}
150+ for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
151+ for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
152+ for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
153+ local tile = Tile(x, y, z)
154+ local monster = tile:getTopCreature()
155+ if monster and monster:isMonster() then
156+ monster:remove()
157+ end
158+ end
159+ end
160+ end
161+
162+ end, dg[choiceId].DungeonTime*1000)
163+
164+ for mx = 1, party do
165+
166+ local ppt = partyMembers[mx]
167+ local fromPosPpt = ppt:getPosition()
168+
169+ ppt:teleportTo(dg[choiceId].DungeonPos)
170+ ppt:getPosition():sendMagicEffect(40)
171+
172+ addEvent(function()
173+ ppt:teleportTo(fromPosPpt)
174+ ppt:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
175+ ppt:getPosition():sendMagicEffect(40)
176+ ppt:popupFYI(msg.ToFail)
177+ end, dg[choiceId].DungeonTime*1000)
178+
179+ end
180+
181+ end
182+
183+ end
184+
185+ else
186+
187+ if DUNGEON_SYSTEM.PzToEntry then
188+ if not getTileInfo(fromPosPlayer).protection then
189+ player:getPosition():sendMagicEffect(CONST_ME_POFF)
190+ return player:sendTextMessage(MESSAGE_EVENT_ADVANCE, msg.NeedPzSoloMsg)
191+ end
192+ end
193+
194+ if player:getStorageValue(sto.TimerCooldown) - os.time() > 0 then
195+ player:getPosition():sendMagicEffect(CONST_ME_POFF)
196+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format(msg.ToCooldown, string.format(player:getStorageValue(sto.TimerCooldown)-os.time())))
197+ return false
198+ end
199+
200+ if dg[choiceId].SpawnMonsters then
201+ for m, l in pairs(dg[choiceId].Monsters) do
202+ Game.createMonster(m, l)
203+ end
204+ end
205+
206+ -- To Dungeon
207+ player:teleportTo(dg[choiceId].DungeonPos)
208+ player:getPosition():sendMagicEffect(40)
209+ player:say(msg.ToEntry, TALKTYPE_MONSTER_SAY)
210+ player:setStorageValue(sto.TimerDungeon, os.time() + dg[choiceId].DungeonTime)
211+
212+ -- Back Dungeon
213+ addEvent(function()
214+ player:teleportTo(fromPosPlayer)
215+ player:setStorageValue(sto.TimerCooldown, os.time() + DUNGEON_SYSTEM.CooldownTime)
216+ player:getPosition():sendMagicEffect(40)
217+ player:popupFYI(msg.ToFail)
218+
219+ -- Remove All monsters
220+ local monsterPos = {}
221+ for x = dg[choiceId].FromPos.x, dg[choiceId].ToPos.x do
222+ for y = dg[choiceId].FromPos.y, dg[choiceId].ToPos.y do
223+ for z = dg[choiceId].FromPos.z, dg[choiceId].ToPos.z do
224+ local tile = Tile(x, y, z)
225+ local monster = tile:getTopCreature()
226+ if monster and monster:isMonster() then
227+ monster:remove()
228+ end
229+ end
230+ end
231+ end
232+
233+ end, dg[choiceId].DungeonTime*1000)
234+
235+ end
236+
237+
238+ elseif buttonId == 201 then
239+
240+ player:registerEvent("DungeonSystemDetails_Modal")
241+
242+ local needPartyMsg, needLevelMsg = "", ""
243+
244+ if (dg[choiceId].NeedParty) then
245+ needPartyMsg = string.format("Party: %s players", dg[choiceId].AmountParty)
246+ else
247+ needPartyMsg = "Party: 1 players"
248+ end
249+
250+ if (dg[choiceId].NeedLevel) then
251+ needLevelMsg = string.format("Level: %s+", dg[choiceId].Level)
252+ else
253+ needLevelMsg = "Don't need Level"
254+ end
255+
256+ local currentTime = os.time()
257+ local endTime = dg[choiceId].DungeonTime + currentTime -- Calculate the end time
258+
259+ -- Check if the dungeon time has already passed
260+ if endTime < currentTime then
261+ endTime = currentTime -- Set it to the current time to avoid negative values
262+ end
263+
264+ local timeDiff = endTime - currentTime
265+
266+ -- Calculate hours, minutes, and seconds as before
267+ local hours = math.floor(timeDiff / 3600)
268+ local minutes = math.floor((timeDiff % 3600) / 60)
269+ local seconds = timeDiff % 60
270+
271+ -- Format the time difference as a string
272+ local timeDiffStr = string.format("%02d:%02d:%02d", hours, minutes, seconds)
273+
274+
275+ local detailsModal = ModalWindow(modal.IDDetails, modal.TitleDetails, string.format(" Dungeon %s \n\n%s\n%s\nTime to make Dungeon: %s", dg[choiceId].Name, needPartyMsg, needLevelMsg, timeDiffStr))
276+
277+
278+ detailsModal:addButton(100, "Back")
279+
280+ detailsModal:setDefaultEnterButton(100)
281+ detailsModal:setDefaultEscapeButton(100)
282+
283+ detailsModal:sendToPlayer(player)
284+
285+ -- player:popupFYI(string.format(">> Dungeon %s <<\n\n" .. needPartyMsg .. "\n" .. needLevelMsg .."\n\nTime to Dungeon: %s", dg[choiceId].Name, string.format(dg[choiceId].DungeonTime)))
286+
287+ end
288+
289+ end
290+
291+end
Top