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/creaturescripts/scripts/quest_level.lua +190-0 View file
@@ -0,0 +1,190 @@
1+local QUEST_STORAGE = {
2+ [002] = {10870}; -- VIDA DE NOVATO
3+ [003] = {11040}; -- CAMINHO TORTUOSO
4+ [004] = {10818}; -- SPIDER CAVE QUEST
5+ [005] = {11041}; -- INFESTA��O
6+ [006] = {10966}; -- ESP�LIOS DE CA�A - III
7+ [008] = {10960}; -- PATAS DE MEL
8+ [012] = {10817}; -- WASP CAVE QUEST
9+ [014] = {10813}; -- DEAD TREE QUEST
10+ [016] = {10816}; -- BEAR CAVE QUEST
11+ [018] = {10814}; -- FIRE CHEST QUEST
12+ [020] = {10819}; -- WINTER WOLF QUEST
13+ [021] = {10812}; -- FIRST HERO QUEST
14+ [022] = {10961}; -- DEDO DURO
15+ [024] = {10970}; -- ESP�LIOS DE CA�A - VI
16+ [026] = {10821}; -- MOSS SHIP QUEST
17+ [028] = {10854}; -- SHOTGUN QUEST
18+ [030] = {10969}; -- ESP�LIOS DE CA�A - V
19+ [032] = {10947}; -- CASA FANTASMA
20+ [034] = {10820}; -- GIANT POWER QUEST
21+ [036] = {10822}; -- TORTOISE QUEST
22+ [038] = {10824}; -- TERRAMITE QUEST
23+ [040] = {10955}; -- CALDAS DO DRAG�O
24+ [042] = {10951}; -- PARASITAS
25+ [044] = {10967}; -- ESP�LIOS DE CA�A - IV
26+ [045] = {11042}; -- FURIA DA SORTE
27+ [046] = {10835}; -- TESOURO IMPERIAL I
28+ [048] = {10825}; -- UNDEAD SWAMP QUEST
29+ [050] = {10990}; -- WARZONE
30+ [051] = {10962}; -- PRESAS DA MEIA NOITE
31+ [052] = {10823}; -- JACK REAPER QUEST
32+ [054] = {10954}; -- ASAS DE PEDRA
33+ [055] = {10977}; -- DEDETIZADOR - PARTE I
34+ [056] = {10826}; -- FROZEN FURY QUEST
35+ [058] = {10827}; -- LEAF FORTRESS QUEST
36+ [059] = {10965}; -- ESP�LIOS DE CA�A - II
37+ [060] = {10865}; -- HAWKEYE QUEST
38+ [062] = {10963}; -- MENTE MORTA
39+ [064] = {10815}; -- SEAGULL ISLAND QUEST
40+ [066] = {10959}; -- PRESAS DE SANGUE
41+ [070] = {10964}; -- ESP�LIOS DE CA�A - I
42+ [072] = {10849}; -- LEATHER QUEST
43+ [074] = {10871}; -- ESCONDERIJO SECRETO
44+ [076] = {10836}; -- TESOURO IMPERIAL II
45+ [078] = {10949}; -- TEMPLO DAS CORES
46+ [080] = {10983}; -- MAESTRIA
47+ [081] = {10866}; -- REMINGTON QUEST
48+ [082] = {10841}; -- PRESENT QUEST
49+ [084] = {10950}; -- ESCAMA DOS ELDERS
50+ [086] = {10868}; -- NINHO DO DRAG�O
51+ [088] = {10952}; -- NINHO DE CROCODILO
52+ [090] = {10872}; -- OSSOS PARASITA
53+ [092] = {10850}; -- WEALTH AMULET QUEST
54+ [094] = {10968}; -- ESS�NCIAS DE UM PESADELO
55+ [096] = {10956}; -- RETALHOS
56+ [098] = {10862}; -- SEM SAIDA
57+ [100] = {10991}; -- INTRODU��O AOS SAQUEADORES
58+ [101] = {10973}; -- ESP�LIOS DE CA�A - VII
59+ [102] = {10851}; -- NOBLE QUEST
60+ [103] = {10948}; -- MEMORIAS
61+ [104] = {10837}; -- TESOURO IMPERIAL III
62+ [106] = {10867}; -- QUARENTENA
63+ [108] = {10971}; -- DEVORADOR DE PEDRAS
64+ [110] = {10856}; -- PLATE HELMET QUEST
65+ [112] = {10863}; -- A ULTIMA CA�ADA
66+ [114] = {10857}; -- ESPIRITUAL QUEST
67+ [116] = {10974}; -- ESP�LIOS DE CA�A - VIII
68+ [118] = {10869}; -- NA TOCA DO ESCARAVELHO
69+ [120] = {10858}; -- TESOURO DAS PROFUNDEZAS - I
70+ [122] = {10842}; -- LIZARD TOWER QUEST
71+ [124] = {10838}; -- TESOURO IMPERIAL IV
72+ [126] = {10875}; -- NO TOPO DA MONTANHA
73+ [128] = {10859}; -- TESOURO DAS PROFUNDEZAS - II
74+ [130] = {10840}; -- MYSTIC QUEST
75+ [132] = {10860}; -- TESOURO DAS PROFUNDEZAS - III
76+ [134] = {10972}; -- TESOURO ESPECTRAL
77+ [135] = {10852}; -- DEMON QUEST
78+ [136] = {10874}; -- NIGMA QUEST
79+ [138] = {10839}; -- TESOURO IMPERIAL V
80+ [140] = {10861}; -- TESOURO DAS PROFUNDEZAS - IV
81+ [144] = {10864}; -- FALCON QUEST
82+ [146] = {10844}; -- O DRAG�O DA PROFECIA
83+ [148] = {10957}; -- BESTA ENJAULADA
84+ [150] = {10984}; -- O ESPECIALISTA - PARTE I
85+ [151] = {10855}; -- ANCIENT QUEST
86+ [152] = {10843}; -- MONSTER CATACLYSM QUEST
87+ [154] = {10873}; -- INFERNUS
88+ [155] = {11043}; -- SAL�O ROYAL
89+ [156] = {10846}; -- MAGIC TOWER QUEST
90+ [158] = {10958}; -- ENIGMA DA SERPENTE
91+ [200] = {11039}; -- O COLISEU
92+}
93+function onAdvance(player, skill, oldLevel, newLevel)
94+ if skill ~= SKILL_LEVEL or newLevel <= oldLevel then
95+ if skill == SKILL_CLUB then
96+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You advanced in machine-gun combat.")
97+ elseif skill == SKILL_SWORD then
98+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You advanced in rifle combat.")
99+ elseif skill == SKILL_AXE then
100+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You advanced in pistol combat.")
101+ elseif skill == SKILL_FIST then
102+ player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You advanced in shotgun combat.")
103+ end
104+
105+ -- DESAFIO
106+ if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then
107+ onPlayerDesafios(player, 31, 01)
108+ end
109+ return true
110+ end
111+ if QUEST_STORAGE[newLevel] then
112+ if newLevel >= oldLevel then
113+ for QS = 01, #QUEST_STORAGE[newLevel] do
114+ if player:getStorageValue(QUEST_STORAGE[newLevel][QS]) < 02 then
115+ player:setStorageValue(QUEST_STORAGE[newLevel][QS], 01)
116+ player:sendCancelMessage("@QuestBlock 01")
117+ player:sendCancelMessage("@LoadQuestMap")
118+ end
119+ end
120+ for X = 01, #_QUESTLOG do
121+ if _QUESTLOG[X].Type == "NORMAL" then
122+ player:sendCancelMessage("@QuestAbertas " .._QUESTLOG[X].Type.. " " ..X.. " " ..player:getStorageValue(_QUESTLOG[X].UID_01))
123+ elseif _QUESTLOG[X].Type == "HUNT" then
124+ player:sendCancelMessage("@QuestAbertas " .._QUESTLOG[X].Type.. " " ..X.. " " ..player:getStorageValue(_QUESTLOG[X].UID_01).. " " ..player:getStorageValue(_QUESTLOG[X].Value[01]).. " " .._QUESTLOG[X].Value[02])
125+ else
126+ player:sendCancelMessage("@QuestAbertas " .._QUESTLOG[X].Type.. " " ..X.. " " ..player:getStorageValue(_QUESTLOG[X].UID_01).. " " ..onGetBackpackItem(player, _QUESTLOG[X].Value[01]).. " " .._QUESTLOG[X].Value[02])
127+ end
128+ end
129+ end
130+ end
131+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) == 06 then
132+ if player:getLevel() >= 100 then
133+ local players = Game.getPlayers()
134+ for _, targetPlayer in ipairs(players) do
135+ if targetPlayer:getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[06].POINTS) < 00 then
136+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[06].POINTS, 01)
137+ else
138+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[06].POINTS, (targetPlayer:getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[06].POINTS) + 01))
139+ end
140+
141+ targetPlayer:sendCancelMessage("@ReloadEvents 06 " ..targetPlayer:getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[06].POINTS))
142+ targetPlayer:sendTextMessage(MESSAGE_EVENT_ORANGE, "[EVENTO] Voc� obteve x01 Ponto de Evento.")
143+ end
144+ end
145+ end
146+ local CriptMount = 01
147+ if player:getLevel() < 100 then
148+ CriptMount = 01
149+ elseif player:getLevel() < 200 then
150+ CriptMount = 02
151+ elseif player:getLevel() < 300 then
152+ CriptMount = 03
153+ elseif player:getLevel() < 400 then
154+ CriptMount = 04
155+ elseif player:getLevel() < 500 then
156+ CriptMount = 05
157+ elseif player:getLevel() < 600 then
158+ CriptMount = 06
159+ elseif player:getLevel() < 700 then
160+ CriptMount = 07
161+ elseif player:getLevel() < 800 then
162+ CriptMount = 08
163+ elseif player:getLevel() < 900 then
164+ CriptMount = 09
165+ elseif player:getLevel() < 999 then
166+ CriptMount = 10
167+ elseif player:getLevel() > 999 then
168+ CriptMount = 11
169+ end
170+ if player:getStorageValue(_SYSTEM.CRIPTOMOEDA) < 00 then
171+ player:setStorageValue(_SYSTEM.CRIPTOMOEDA, ((player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + CriptMount) + 01))
172+ else
173+ player:setStorageValue(_SYSTEM.CRIPTOMOEDA, (player:getStorageValue(_SYSTEM.CRIPTOMOEDA) + CriptMount))
174+ end
175+ if player:getStorageValue(_SYSTEM.POINTS_ATR[07]) < 00 then
176+ player:setStorageValue(_SYSTEM.POINTS_ATR[07], 01)
177+ else
178+ player:setStorageValue(_SYSTEM.POINTS_ATR[07], (player:getStorageValue(_SYSTEM.POINTS_ATR[07]) + 01))
179+ end
180+
181+ -- DESAFIO
182+ if player:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then
183+ onPlayerDesafios(player, 80, 01)
184+ end
185+ player:sendCancelMessage("@LootMSG 3297 4 3 " ..CriptMount)
186+ player:sendTextMessage(MESSAGE_EVENT_ORANGE, "[LEVEL] Voc� obteve x1 Ponto de Passiva e x" ..CriptMount.. " Criptomoeda.")
187+ player:getPosition():sendMagicEffect(math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
188+ player:say('LEVEL UP!', TALKTYPE_MONSTER_SAY)
189+ return true
190+end
A data/creaturescripts/scripts/sentinel.lua +41-0 View file
@@ -0,0 +1,41 @@
1+function onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
2+ if creature:isMonster() and creature:getName() == "Kanigher"
3+ or creature:isMonster() and creature:getName() == "Ross"
4+ or creature:isMonster() and creature:getName() == "Towncryer"
5+ or creature:isMonster() and creature:getName() == "Villauba" then
6+
7+ local player = creature:getMaster()
8+ if player then
9+ if player:getStorageValue(_QUESTLOG[166].UID_01) == 02 then
10+ player:setStorageValue(10993, nil)
11+ player:setStorageValue(_QUESTLOG[166].UID_01, 01)
12+ player:sendTextMessage(MESSAGE_STATUS_WARNING, "[ MISS�O FRACASSADA ]\nVoc� deixou seu companheiro de equipe morrer.")
13+
14+ player:teleportTo({x=3651, y=1707, z=07})
15+ player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
16+ elseif player:getStorageValue(_QUESTLOG[167].UID_01) == 03 then
17+ player:setStorageValue(_QUESTLOG[167].UID_01, 02)
18+ player:sendTextMessage(MESSAGE_STATUS_WARNING, "[ MISS�O FRACASSADA ]\nVoc� deixou seu companheiro de equipe morrer.")
19+
20+ player:teleportTo({x=3562, y=953, z=07})
21+ player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
22+ elseif player:getStorageValue(_QUESTLOG[169].UID_01) > 01 and player:getStorageValue(_QUESTLOG[169].UID_01) < 100 then
23+ player:setStorageValue(_QUESTLOG[169].UID_01, 01)
24+ player:sendTextMessage(MESSAGE_STATUS_WARNING, "[ MISS�O FRACASSADA ]\nVoc� deixou seu companheiro de equipe morrer.")
25+
26+ player:teleportTo({x=3651, y=1707, z=07})
27+ player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
28+ elseif player:getStorageValue(_QUESTLOG[198].UID_01) == 02 then
29+ player:setStorageValue(_QUESTLOG[198].UID_01, 01)
30+ player:sendTextMessage(MESSAGE_STATUS_WARNING, "[ MISS�O FRACASSADA ]\nVoc� deixou Towncryer morrer em combate.")
31+
32+ player:teleportTo({x=3862, y=1762, z=06})
33+ player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
34+ end
35+
36+ doBackpack(player, 12)
37+ player:sendCancelMessage("@LoadQuestWindows")
38+ end
39+ end
40+ return true
41+end
A data/creaturescripts/scripts/think.lua +450-0 View file
@@ -0,0 +1,450 @@
1+local EnableHigh = true
2+local idleTable = {}
3+local TABLE_SKILLS = {
4+ 01, 02, 03, 04, 05, 06, 07, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
5+ 21, 22, 23, 24, 25, 29, 30, 32, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45,
6+ 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 58, 59, 60, 61, 63, 65, 66, 68, 70,
7+}
8+local function onExhaustHigh(timer)
9+ if timer > 00 then
10+ timer = timer - 01
11+ addEvent(onExhaustHigh, 1000, timer)
12+ else
13+ EnableHigh = true
14+ end
15+end
16+local function addOnlinePoint(cid)
17+ local player = Player(cid)
18+ if player then
19+ local OnlineInsert = 01
20+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) == 02 then
21+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_1) >= 5000 then
22+ OnlineInsert = OnlineInsert + 01
23+ end
24+ end
25+ if EnableHigh then
26+ if #_HIGHSCORE > 00 then
27+ for k in pairs (_HIGHSCORE) do
28+ _HIGHSCORE [k] = nil
29+ end
30+ end
31+ local TopDez = db.storeQuery('SELECT name FROM `players` WHERE group_id < 2 ORDER BY level DESC LIMIT 10;')
32+ if TopDez then
33+ local i = 1
34+ repeat
35+ table.insert(_HIGHSCORE, result.getDataString(TopDez, "name"))
36+ i = i + 1
37+ until not result.next(TopDez)
38+ result.free()
39+ end
40+
41+ EnableHigh = false
42+ onExhaustHigh(10)
43+ end
44+ if isInArray(_HIGHSCORE, player:getName()) then
45+ OnlineInsert = OnlineInsert + 01
46+ player:sendCancelMessage("@LootMSG 3160 0 0 " ..OnlineInsert)
47+ player:setStorageValue(_SYSTEM.ONLINE_COIN, (player:getStorageValue(_SYSTEM.ONLINE_COIN) + OnlineInsert))
48+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Voc� obteve " ..OnlineInsert.. " Online Points (Ponto Adicional por estar no Top 10). Seu saldo atual �: [ " ..player:getStorageValue(_SYSTEM.ONLINE_COIN).. " ].")
49+ else
50+ player:sendCancelMessage("@LootMSG 3160 0 0 " ..OnlineInsert)
51+ player:setStorageValue(_SYSTEM.ONLINE_COIN, (player:getStorageValue(_SYSTEM.ONLINE_COIN) + OnlineInsert))
52+ player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Voc� obteve " ..OnlineInsert.. " Online Points. Seu saldo atual �: [ " ..player:getStorageValue(_SYSTEM.ONLINE_COIN).. " ].")
53+ end
54+
55+ player:sendCancelMessage("@LoadOnlineCoin " ..player:getStorageValue(_SYSTEM.ONLINE_COIN))
56+ return true
57+ end
58+end
59+function onThink(creature, interval)
60+ if creature:isPlayer() then
61+ if #creature:getSummons() > 0 then
62+ local SummPos = creature:getSummons()
63+ -- REMOVER SUMMON AO ENTRAR EM PZ
64+ if Tile(creature:getPosition()):hasFlag(TILESTATE_PROTECTIONZONE) then
65+ for i = 1, #SummPos do
66+ SummPos[i]:getPosition():sendMagicEffect(CONST_ME_POFF)
67+ doRemoveCreature(SummPos[i]:getId())
68+ end
69+ end
70+ -- TELEPORT SUMMON AO SE DISTANCIAR
71+ local maxDistance = 5
72+ if creature:getStorageValue(_QUESTLOG[198].UID_01) == 02 then
73+ maxDistance = 50
74+ end
75+ if creature:getPosition().z ~= SummPos[01]:getPosition().z or creature:getPosition():getDistance(SummPos[01]:getPosition()) > maxDistance then
76+ for X = 01, #creature:getSummons() do
77+ if SummPos[X]:teleportTo(creature:getPosition()) then
78+ SummPos[X]:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
79+ end
80+ end
81+ end
82+ end
83+ if creature:getStorageValue(_PLAYER_INFO.FREE_RUN) > 00 then -- ATRIBUTOS DE REMOVER PARALYZE EM EQUIP
84+ creature:removeCondition(CONDITION_PARALYZE)
85+ end
86+ if creature:getStorageValue(_SYSTEM.MAESTRIA[04]) > 0 then -- MAESTRIA TIMER
87+ creature:setStorageValue(_SYSTEM.MAESTRIA[04], (creature:getStorageValue(_SYSTEM.MAESTRIA[04]) - 1))
88+ end
89+ if creature:getStorageValue(_SYSTEM.MAESTRIA[03]) > 0 then -- MAESTRIA TIMER
90+ creature:setStorageValue(_SYSTEM.MAESTRIA[03], (creature:getStorageValue(_SYSTEM.MAESTRIA[03]) - 1))
91+ end
92+ if creature:getStorageValue(_SYSTEM.AMULET_VALUES[00][01]) > 0 then -- EFEITOS DE AMULETOS
93+ if creature:getStorageValue(_SYSTEM.AMULET_VALUES[00][02]) == 03 then
94+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[01].STORAGE) <= 00 then
95+ local percentHP = 02 * creature:getBaseMaxHealth() / 100
96+
97+ doTargetCombat(0, creature, COMBAT_HEALING, percentHP, percentHP)
98+ end
99+ end
100+ if creature:getStorageValue(_SYSTEM.AMULET_VALUES[00][01]) == 1 then
101+ creature:getPosition():sendMagicEffect(14)
102+ if creature:getStorageValue(_SYSTEM.AMULET_VALUES[00][02]) == 01 then
103+ creature:setStorageValue(_SYSTEM.CRITICAL_VALUES[02], (creature:getStorageValue(_SYSTEM.CRITICAL_VALUES[02]) - 15))
104+ end
105+ if creature:getStorageValue(_SYSTEM.AMULET_VALUES[00][02]) == 04 then
106+ creature:setStorageValue(_SYSTEM.CRITICAL_VALUES[01], (creature:getStorageValue(_SYSTEM.CRITICAL_VALUES[01]) - 50))
107+ end
108+
109+ creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][02], 00)
110+ creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][03], 00)
111+ else
112+ creature:getPosition():sendMagicEffect(178)
113+ end
114+ creature:setStorageValue(_SYSTEM.AMULET_VALUES[00][01], (creature:getStorageValue(_SYSTEM.AMULET_VALUES[00][01]) - 1))
115+ end
116+ if creature:getStorageValue(_SYSTEM.TOOLS[01]) < 7201 then -- DURA��O DA LOJA REMOTA TEMPOR�RIA
117+ if creature:getStorageValue(_SYSTEM.TOOLS[01]) > 0 then
118+ if creature:getStorageValue(_SYSTEM.TOOLS[01]) == 01 then
119+ creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Acabou o tempo de sua Loja Remota.")
120+ creature:getPosition():sendMagicEffect(14)
121+
122+ creature:sendCancelMessage("@ToolsLoad 0 " ..creature:getStorageValue(_SYSTEM.TOOLS[02]))
123+ end
124+ creature:setStorageValue(_SYSTEM.TOOLS[01], (creature:getStorageValue(_SYSTEM.TOOLS[01]) - 1))
125+ end
126+ end
127+ if creature:getStorageValue(_SYSTEM.TOOLS[02]) < 7201 then -- DURA��O DO NEXUS REMOTO TEMPOR�RIO
128+ if creature:getStorageValue(_SYSTEM.TOOLS[02]) > 0 then
129+ if creature:getStorageValue(_SYSTEM.TOOLS[02]) == 01 then
130+ creature:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Acabou o tempo de seu Nexus Remoto.")
131+ creature:getPosition():sendMagicEffect(14)
132+
133+ creature:sendCancelMessage("@ToolsLoad " ..creature:getStorageValue(_SYSTEM.TOOLS[01]).. " 0")
134+ end
135+ creature:setStorageValue(_SYSTEM.TOOLS[02], (creature:getStorageValue(_SYSTEM.TOOLS[02]) - 1))
136+ end
137+ end
138+ if creature:getStorageValue(_SYSTEM.WARZONE_TIMER) > 0 then -- DURA��O DOS B�NUS DA WARZONE
139+ if creature:getStorageValue(_SYSTEM.WARZONE_TIMER) == 01 then
140+ creature:setStorageValue(_SYSTEM.SHOP_WARZONE, nil)
141+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu b�nus da Warzone foi encerrado.")
142+ creature:getPosition():sendMagicEffect(14)
143+ end
144+ creature:setStorageValue(_SYSTEM.WARZONE_TIMER, (creature:getStorageValue(_SYSTEM.WARZONE_TIMER) - 1))
145+ end
146+ if Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_START_WARZONE) == 01 then -- PLACAR DA WARZONE
147+ if creature:getLevel() >= _GLOBAL_RANDOM.WARZONE.LEVEL then
148+ if creature:getStorageValue(_SYSTEM.WARZONE) > 00 then
149+ creature:sendCancelMessage("@ShowPlacar 01 " .._GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01].. " " .._GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02].. " " ..Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_BLUE_TEAM).. " " ..Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_RED_TEAM))
150+
151+ if creature:getStorageValue(_GLOBAL_RANDOM.WARZONE.LOBBY_TIMER) > 0 then -- WARZONE LOBBY TIMER
152+ if creature:getStorageValue(_GLOBAL_RANDOM.WARZONE.LOBBY_TIMER) == 01 then -- WARZONE LOBBY TIMER
153+ local RANDOM_POS_WARZONE = {
154+ [01] = {x=3944, y=1192, z=07};
155+ [02] = {x=3948, y=1196, z=07};
156+ [03] = {x=3941, y=1199, z=07};
157+ [04] = {x=3935, y=1201, z=07};
158+ [05] = {x=3953, y=1199, z=07};
159+ [06] = {x=3960, y=1200, z=07};
160+ [07] = {x=3945, y=1209, z=07};
161+ [08] = {x=3938, y=1212, z=07};
162+ [09] = {x=3932, y=1219, z=07};
163+ [10] = {x=3934, y=1213, z=07};
164+ [11] = {x=3956, y=1218, z=07};
165+ [12] = {x=3946, y=1221, z=07};
166+ [13] = {x=3944, y=1214, z=07};
167+ [14] = {x=3938, y=1225, z=07};
168+ [15] = {x=3932, y=1234, z=07};
169+ [16] = {x=3941, y=1237, z=07};
170+ [17] = {x=3948, y=1234, z=07};
171+ [18] = {x=3960, y=1220, z=07};
172+ }
173+ local GUN_CATEGORY = {
174+ [01] = {4024, 4030}; -- PISTOLAS
175+ [02] = {4010, 4014}; -- RIFLES
176+ [03] = {4040, 4049}; -- METRALHADORA
177+ [04] = {4002, 4004}; -- ESPINGARDA
178+ }
179+ local choiceId = math.random(01, 04)
180+ local WEAPON_ID = math.random(GUN_CATEGORY[choiceId][01], GUN_CATEGORY[choiceId][02])
181+ local WEAPON_RARE = math.random(03, 04)
182+ local WEAPON_STAR = math.random(00, 03)
183+ local SKILL_01 = 01
184+ local SKILL_02 = 02
185+ local SKILL_03 = 03
186+ local TEMP_SKILLS = {}
187+
188+ if #TEMP_SKILLS > 0 then
189+ for k in pairs (TEMP_SKILLS) do
190+ TEMP_SKILLS [k] = nil
191+ end
192+ end
193+ for S = 01, #TABLE_SKILLS do
194+ table.insert(TEMP_SKILLS, TABLE_SKILLS[S])
195+ end
196+
197+ local SkillSort1 = math.random(01, #TEMP_SKILLS)
198+ SKILL_01 = TEMP_SKILLS[SkillSort1]
199+ table.remove(TEMP_SKILLS, SkillSort1)
200+
201+ SkillSort2 = math.random(01, #TEMP_SKILLS)
202+ SKILL_02 = TEMP_SKILLS[SkillSort2]
203+ table.remove(TEMP_SKILLS, SkillSort2)
204+
205+ SkillSort3 = math.random(01, #TEMP_SKILLS)
206+ SKILL_03 = TEMP_SKILLS[SkillSort3]
207+ table.remove(TEMP_SKILLS, SkillSort3)
208+
209+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_01, WEAPON_ID) -- ID
210+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_02, WEAPON_RARE) -- RARIDADE
211+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_03, WEAPON_STAR) -- STAR
212+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_04, SKILL_01) -- SKILL 01
213+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_05, SKILL_02) -- SKILL 02
214+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_06, SKILL_03) -- SKILL 03
215+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_07, math.random(00, 10)) -- LEVEL
216+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_08, 00)
217+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_09, 01) -- UNIQUE ITEM
218+ creature:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, 9999) -- AMMO
219+ creature:setStorageValue(_GLOBAL_RANDOM.WARZONE.LOBBY_TIMER, nil)
220+ creature:sendCancelMessage("@LootMSG " ..WEAPON_ID.. " " ..WEAPON_RARE.. " " ..WEAPON_STAR.. " 01")
221+
222+ doInventario(creature, 00, 04, 00) -- Organizo Invent�rio
223+ creature:setTown(Town(15))
224+
225+ creature:teleportTo(RANDOM_POS_WARZONE[math.random(01, #RANDOM_POS_WARZONE)])
226+ creature:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
227+
228+ creature:sendCancelMessage("@StarCliente")
229+ else
230+ creature:setStorageValue(_GLOBAL_RANDOM.WARZONE.LOBBY_TIMER, (creature:getStorageValue(_GLOBAL_RANDOM.WARZONE.LOBBY_TIMER) - 01))
231+ end
232+ end
233+ end
234+ end
235+ end
236+ if creature:getStorageValue(_SYSTEM.PASSIVA[01]) > 00 then -- CONTAGEM DE PASSIVA [ESQ]
237+ if creature:getStorageValue(_SYSTEM.PASSIVA[01]) == 01 then
238+ creature:getPosition():sendMagicEffect(14)
239+ creature:sendCancelMessage("@IndividualStatus 01 00")
240+ end
241+ creature:setStorageValue(_SYSTEM.PASSIVA[01], (creature:getStorageValue(_SYSTEM.PASSIVA[01]) - 01))
242+ end
243+ if creature:getStorageValue(_SYSTEM.PASSIVA[02]) > 00 then -- CONTAGEM DE PASSIVA [DEF]
244+ if creature:getStorageValue(_SYSTEM.PASSIVA[02]) == 01 then
245+ creature:getPosition():sendMagicEffect(14)
246+ creature:sendCancelMessage("@IndividualStatus 02 00")
247+ end
248+ creature:setStorageValue(_SYSTEM.PASSIVA[02], (creature:getStorageValue(_SYSTEM.PASSIVA[02]) - 01))
249+ end
250+ if creature:getStorageValue(_SYSTEM.COUNT_ONLINE_COIN) > 00 then -- CONTAGEM DE TEMPO ONLINE
251+ if creature:getStorageValue(_SYSTEM.COUNT_ONLINE_COIN) == 01 then
252+ if _NEW_RULES_ONLINE then
253+ local tile = Tile(creature:getPosition().x, creature:getPosition().y, creature:getPosition().z)
254+ local ground = tile:getGround()
255+ if ground:getId() == 11062 or ground:getId() == 11063 then
256+ creature:setStorageValue(_SYSTEM.COUNT_ONLINE_COIN, 10800)
257+ creature:sendCancelMessage("@onTimers 10800")
258+ else
259+ creature:setStorageValue(_SYSTEM.COUNT_ONLINE_COIN, 3600)
260+ creature:sendCancelMessage("@onTimers 3600")
261+ end
262+ else
263+ creature:setStorageValue(_SYSTEM.COUNT_ONLINE_COIN, 3600)
264+ creature:sendCancelMessage("@onTimers 3600")
265+ end
266+ addOnlinePoint(creature:getId())
267+ else
268+ creature:setStorageValue(_SYSTEM.COUNT_ONLINE_COIN, (creature:getStorageValue(_SYSTEM.COUNT_ONLINE_COIN) - 01))
269+ creature:sendCancelMessage("@onTimers " ..creature:getStorageValue(_SYSTEM.COUNT_ONLINE_COIN))
270+ end
271+ end
272+ if creature:getStorageValue(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].DELAY[01]) > 00 then -- DELAY FENDA DIMENISONAL
273+ creature:setStorageValue(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].DELAY[01], (creature:getStorageValue(_GLOBAL_RANDOM.FENDAS_DIMENSIONAIS[00].DELAY[01]) - 01))
274+ end
275+ if creature:getStorageValue(_PLAYER_INFO.DELAY) > 0 then -- DELAY STATUS DEF
276+ creature:setStorageValue(_PLAYER_INFO.DELAY, (creature:getStorageValue(_PLAYER_INFO.DELAY) - 01))
277+ end
278+ if creature:getStorageValue(_PLAYER_INFO.GUN_DELAY) > 0 then -- DELAY GUN
279+ creature:setStorageValue(_PLAYER_INFO.GUN_DELAY, (creature:getStorageValue(_PLAYER_INFO.GUN_DELAY) - 01))
280+ end
281+ if creature:getStorageValue(_PLAYER_INFO.LOGOUT_DELAY) > 0 then -- DELAY LOGOUT
282+ creature:setStorageValue(_PLAYER_INFO.LOGOUT_DELAY, (creature:getStorageValue(_PLAYER_INFO.LOGOUT_DELAY) - 01))
283+ end
284+
285+ -- IdleTimer
286+ if _NEW_RULES_ONLINE then
287+ if not Tile(creature:getPosition()):hasFlag(TILESTATE_NOPVPZONE) then
288+ if not Tile(creature:getPosition()):hasFlag(TILESTATE_PVPZONE) then
289+ if not Tile(creature:getPosition()):hasFlag(TILESTATE_NOLOGOUT) then
290+ local cid = creature:getId()
291+ if not idleTable[cid] then
292+ idleTable[cid] = creature:getPosition()
293+ else
294+ if creature:getPosition() ~= idleTable[cid] then
295+ idleTable[cid] = creature:getPosition()
296+ creature:setStorageValue(_SYSTEM.IDLE_COUNT, 00)
297+ else
298+ creature:setStorageValue(_SYSTEM.IDLE_COUNT, (creature:getStorageValue(_SYSTEM.IDLE_COUNT) + 01))
299+ if creature:getStorageValue(_SYSTEM.IDLE_COUNT) == 1740 then
300+ creature:sendTextMessage(MESSAGE_STATUS_WARNING, "Voc� ser� deslogado em 01 minuto por inatividade.")
301+ elseif creature:getStorageValue(_SYSTEM.IDLE_COUNT) == 1800 then
302+ print("[" ..creature:getName().. "] Deslogado por inatividade")
303+ creature:remove()
304+ return true
305+ end
306+ end
307+ end
308+ end
309+ end
310+ end
311+ end
312+
313+ local BUFF = 01 -- BUFFS CONTAGEM DO TEMPO
314+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
315+ local percentHP = 02 * creature:getBaseMaxHealth() / 100
316+ doTargetCombat(0, creature, COMBAT_HEALING, percentHP, percentHP)
317+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
318+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
319+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
320+ creature:getPosition():sendMagicEffect(14)
321+
322+ doInventario(creature, 05)
323+ else
324+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
325+ end
326+ end
327+ BUFF = 02
328+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
329+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
330+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
331+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
332+ creature:getPosition():sendMagicEffect(14)
333+
334+ doInventario(creature, 05)
335+ else
336+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
337+ end
338+ end
339+ BUFF = 03
340+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
341+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
342+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
343+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
344+ creature:getPosition():sendMagicEffect(14)
345+
346+ doInventario(creature, 05)
347+ else
348+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
349+ end
350+ end
351+ BUFF = 04
352+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
353+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
354+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
355+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
356+ creature:getPosition():sendMagicEffect(14)
357+
358+ doInventario(creature, 05)
359+ else
360+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
361+ end
362+ end
363+ BUFF = 05
364+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
365+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
366+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
367+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
368+ creature:getPosition():sendMagicEffect(14)
369+
370+ doInventario(creature, 05)
371+ else
372+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
373+ end
374+ end
375+ BUFF = 06
376+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
377+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
378+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
379+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
380+ creature:getPosition():sendMagicEffect(14)
381+
382+ doInventario(creature, 05)
383+ else
384+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
385+ end
386+ end
387+ BUFF = 07
388+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
389+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
390+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
391+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
392+ creature:getPosition():sendMagicEffect(14)
393+
394+ doInventario(creature, 05)
395+ else
396+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
397+ end
398+ end
399+ BUFF = 08
400+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
401+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
402+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
403+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
404+ creature:getPosition():sendMagicEffect(14)
405+
406+ doInventario(creature, 05)
407+ else
408+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
409+ end
410+ end
411+ BUFF = 09
412+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
413+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
414+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
415+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
416+ creature:getPosition():sendMagicEffect(14)
417+
418+ doInventario(creature, 05)
419+ else
420+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
421+ end
422+ end
423+ BUFF = 10
424+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
425+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
426+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
427+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
428+ creature:getPosition():sendMagicEffect(14)
429+
430+ doInventario(creature, 05)
431+ else
432+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
433+ end
434+ end
435+ BUFF = 11
436+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) > 00 then
437+ if creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) == 01 then
438+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, nil)
439+ creature:setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[04].BUFF_ELE, nil)
440+ creature:sendTextMessage(MESSAGE_INFO_DESCR, "Seu buff [ " .._GLOBAL_RANDOM.BUFFS[BUFF].BUFF.. "] acabou.")
441+ creature:getPosition():sendMagicEffect(14)
442+
443+ doInventario(creature, 05)
444+ else
445+ creature:setStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE, (creature:getStorageValue(_GLOBAL_RANDOM.BUFFS[BUFF].STORAGE) - 1))
446+ end
447+ end
448+
449+ end
450+end
A data/events/events.xml +48-0 View file
@@ -0,0 +1,48 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<events>
3+ <!-- Creature methods -->
4+ <event class="Creature" method="onChangeOutfit" enabled="0" />
5+ <event class="Creature" method="onAreaCombat" enabled="1" />
6+ <event class="Creature" method="onTargetCombat" enabled="1" />
7+ <event class="Creature" method="onHear" enabled="0" />
8+
9+ <!-- Party methods -->
10+ <event class="Party" method="onJoin" enabled="1" />
11+ <event class="Party" method="onLeave" enabled="1" />
12+ <event class="Party" method="onDisband" enabled="1" />
13+ <event class="Party" method="onShareExperience" enabled="1" />
14+
15+ <!-- Player methods -->
16+ <event class="Player" method="onBrowseField" enabled="0" />
17+ <event class="Player" method="onLook" enabled="1" />
18+ <event class="Player" method="onLookInBattleList" enabled="1" />
19+ <event class="Player" method="onLookInTrade" enabled="0" />
20+ <event class="Player" method="onLookInShop" enabled="0" />
21+ <event class="Player" method="onMoveItem" enabled="1" />
22+ <event class="Player" method="onItemMoved" enabled="0" />
23+ <event class="Player" method="onMoveCreature" enabled="1" />
24+ <event class="Player" method="onReportBug" enabled="1" />
25+ <event class="Player" method="onReportRuleViolation" enabled="1" />
26+ <event class="Player" method="onTurn" enabled="0" />
27+ <event class="Player" method="onTradeRequest" enabled="0" />
28+ <event class="Player" method="onTradeAccept" enabled="0" />
29+ <event class="Player" method="onTradeCompleted" enabled="0" />
30+ <event class="Player" method="onGainExperience" enabled="1" />
31+ <event class="Player" method="onLoseExperience" enabled="0" />
32+ <event class="Player" method="onGainSkillTries" enabled="1" />
33+ <event class="Player" method="onWrapItem" enabled="1" />
34+
35+ <!-- Monster methods -->
36+ <event class="Monster" method="onDropLoot" enabled="0" />
37+ <event class="Monster" method="onSpawn" enabled="0" />
38+
39+ <!-- Dungeon Methods --
40+ <event class="Dungeon" method="onQueue" enabled="1" />
41+ <event class="Dungeon" method="onPrepare" enabled="1" />
42+ <event class="Dungeon" method="onStart" enabled="1" />
43+ <event class="Dungeon" method="onSuccess" enabled="1" />
44+ <event class="Dungeon" method="onFail" enabled="1" />
45+ <event class="Dungeon" method="onPlayerLeft" enabled="1" />
46+ <event class="Dungeon" method="onMonstersCount" enabled="1" /-->
47+
48+</events>
A data/events/scripts/creature.lua +112-0 View file
@@ -0,0 +1,112 @@
1+local minDist = 3
2+local c = {
3+ skulls = {SKULL_NONE, SKULL_GREEN}, -- tipos de skull em que o modo seguro funcionara
4+ ignorePVPE = true, -- modo seguro funcionara mesmo em PVP-Enforced? (true / false)
5+ ignoreArena = false -- modo seguro funcionara mesmo em arenas? (true / false)
6+}
7+function Creature:onChangeOutfit(outfit)
8+ return true
9+end
10+function Creature:onAreaCombat(tile, isAggressive)
11+ return RETURNVALUE_NOERROR
12+end
13+function getDistanceBetween(fromPosition, toPosition)
14+ local x, y = math.abs(fromPosition.x - toPosition.x), math.abs(fromPosition.y - toPosition.y)
15+ local diff = math.max(x, y)
16+ if(fromPosition.z ~= toPosition.z) then
17+ diff = diff + 9 + 6
18+ end
19+ return diff
20+end
21+function Creature:onHear(speaker, words, type)
22+end
23+function Creature:onTargetCombat(target)
24+ if not self then return true end
25+ if self:isPlayer() and target:isPlayer() then
26+ if self:hasSecureMode()== true then
27+ return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
28+ end
29+ end
30+ if self:isPlayer() and target:isPlayer() then
31+ if self:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 then
32+ if self:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) == 01 or self:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) == 02 or self:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) == 03 or self:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) == 05 then
33+ if target:getStorageValue(_PVP_ROOM[00].PVP_SALA_ID) > 00 then
34+ if self:getStorageValue(_PVP_ROOM[00].TIME_ID) == target:getStorageValue(_PVP_ROOM[00].TIME_ID) then
35+ return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
36+ end
37+ end
38+ end
39+ end
40+ if Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_START_WARZONE) == 01 then
41+ if self:getStorageValue(_SYSTEM.WARZONE) == 01 and target:getStorageValue(_SYSTEM.WARZONE) == 01 then
42+ return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
43+ end
44+ if self:getStorageValue(_SYSTEM.WARZONE) == 02 and target:getStorageValue(_SYSTEM.WARZONE) == 02 then
45+ return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
46+ end
47+ end
48+ end
49+ if self:isPlayer() and target:isMonster() then
50+ local master = target:getMaster()
51+ if master and master:isPlayer() then
52+ return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
53+ end
54+ end
55+ if self:isPlayer() then
56+ local slotItem = self:getSlotItem(CONST_SLOT_LEFT)
57+ if slotItem == nil then
58+ self:addItem(7366)
59+ if slotItem == nil then
60+ return RETURNVALUE_YOUMAYNOTATTACKTHISPLAYER
61+ end
62+ end
63+ end
64+ if (self:isPlayer() and target:isNpc()) then
65+ local distance = getDistanceBetween(self:getPosition(), target:getPosition())
66+ if (distance > minDist) then
67+ return RETURNVALUE_NOTPOSSIBLE
68+ else
69+ if _NPCS_MISSION[target:getName()] then
70+ local getMission = 0 local getTalk = 0
71+ for X = 01, #_NPCS_MISSION[target:getName()] do
72+ if self:getStorageValue(_NPCS_MISSION[target:getName()][X][01]) == _NPCS_MISSION[target:getName()][X][02] then
73+ if _NPCS_MISSION[target:getName()][X][04] == "NORMAL" then
74+ getMission = 1 getTalk = _NPCS_MISSION[target:getName()][X][03]
75+ break
76+ else
77+ local itemID = _NPCS_MISSION[target:getName()][X][05]
78+ local SlotID = _ITEMS[itemID].SLOT_EQUIP
79+
80+ if SlotID > 9 or SlotID == 0 then SlotID = 3 end
81+
82+ local QntNeed = _NPCS_MISSION[target:getName()][X][06]
83+ local ext = 0
84+ doBackpack(self, 03, SlotID, ext, 01, itemID) -- Procurar
85+ local QntBag = doBackpack(self, 04)
86+
87+ if QntBag >= QntNeed then
88+ getMission = 1 getTalk = _NPCS_MISSION[target:getName()][X][03]
89+ break
90+ end
91+ end
92+ end
93+ end
94+
95+ if getMission == 1 then
96+ self:say("hi", TALKTYPE_PRIVATE_PN, false, target)
97+ self:sendCancelMessage("@NPC " ..target:getName().. " TRUE " ..getTalk)
98+ else
99+ self:say("hi", TALKTYPE_PRIVATE_PN, false, target)
100+ self:sendCancelMessage("@NPC " ..target:getName().. " FALSE")
101+ end
102+ else
103+ self:say("hi", TALKTYPE_PRIVATE_PN, false, target)
104+ self:sendCancelMessage("@NPC " ..target:getName().. " FALSE")
105+ end
106+
107+ return RETURNVALUE_NOTPOSSIBLE
108+ end
109+ end
110+
111+ return RETURNVALUE_NOERROR
112+end
A data/events/scripts/monster.lua +39-0 View file
@@ -0,0 +1,39 @@
1+function Monster:onDropLoot(corpse)
2+ --[[if configManager.getNumber(configKeys.RATE_LOOT) == 0 then
3+ return
4+ end
5+
6+ local player = Player(corpse:getCorpseOwner())
7+ local mType = self:getType()
8+ if not player or player:getStamina() > 840 then
9+ local monsterLoot = mType:getLoot()
10+ for i = 1, #monsterLoot do
11+ local item = corpse:createLootItem(monsterLoot[i])
12+ if not item then
13+ print('[Warning] DropLoot:', 'Could not add loot item to corpse.')
14+ end
15+ end
16+
17+ if player then
18+ local text = ("Loot of %s: %s"):format(mType:getNameDescription(), corpse:getContentDescription())
19+ local party = player:getParty()
20+ if party then
21+ party:broadcastPartyLoot(text)
22+ else
23+ player:sendTextMessage(MESSAGE_LOOT, text)
24+ end
25+ end
26+ else
27+ local text = ("Loot of %s: nothing (due to low stamina)"):format(mType:getNameDescription())
28+ local party = player:getParty()
29+ if party then
30+ party:broadcastPartyLoot(text)
31+ else
32+ player:sendTextMessage(MESSAGE_LOOT, text)
33+ end
34+ end]]
35+end
36+
37+function Monster:onSpawn(position, startup, artificial)
38+ return true
39+end
A data/events/scripts/party.lua +56-0 View file
@@ -0,0 +1,56 @@
1+function Party:onJoin(player)
2+ onDungeonPartyJoin(self, player)
3+ if hasEventCallback(EVENT_CALLBACK_ONJOIN) then
4+ return EventCallback(EVENT_CALLBACK_ONJOIN, self, player)
5+ else
6+ return true
7+ end
8+end
9+
10+function Party:onLeave(player)
11+ onDungeonPartyLeave(self, player)
12+ if hasEventCallback(EVENT_CALLBACK_ONLEAVE) then
13+ return EventCallback(EVENT_CALLBACK_ONLEAVE, self, player)
14+ else
15+ return true
16+ end
17+end
18+
19+function Party:onDisband()
20+ onDungeonPartyDisband(self)
21+ if hasEventCallback(EVENT_CALLBACK_ONDISBAND) then
22+ return EventCallback(EVENT_CALLBACK_ONDISBAND, self)
23+ else
24+ return true
25+ end
26+end
27+
28+function Party:onLeaderPass(oldLeader, newLeader)
29+ onDungeonPartyLeaderPass(self, oldLeader, newLeader)
30+end
31+
32+function Party:onShareExperience(exp)
33+ local sharedExperienceMultiplier = 1.20 --20%
34+ local vocationsIds = {}
35+ local rawExp = exp
36+
37+ local vocationId = self:getLeader():getVocation():getBase():getId()
38+ if vocationId ~= VOCATION_NONE then
39+ table.insert(vocationsIds, vocationId)
40+ end
41+
42+ for _, member in ipairs(self:getMembers()) do
43+ vocationId = member:getVocation():getBase():getId()
44+ if not table.contains(vocationsIds, vocationId) and vocationId ~= VOCATION_NONE then
45+ table.insert(vocationsIds, vocationId)
46+ end
47+ end
48+
49+ local size = #vocationsIds
50+ if size > 1 then
51+ sharedExperienceMultiplier = 1.0 + ((size * (5 * (size - 1) + 10)) / 100)
52+ end
53+
54+ exp = math.ceil((exp * sharedExperienceMultiplier) / (#self:getMembers() + 1))
55+ return hasEventCallback(EVENT_CALLBACK_ONSHAREEXPERIENCE) and EventCallback(EVENT_CALLBACK_ONSHAREEXPERIENCE, self, exp, rawExp) or exp
56+end
A data/events/scripts/player.lua +444-0 View file
@@ -0,0 +1,444 @@
1+function Player:onBrowseField(position)
2+ return true
3+end
4+
5+function Player:onLook(thing, position, distance)
6+ if thing:isMonster() then
7+ if _MONSTER_LOOT[thing:getName()] then
8+ local description = "You see " .. thing:getDescription(distance)
9+
10+ description = description.. "\nClasse: [ " .._MONSTER_LOOT[thing:getName()][00].Type.. " ]."
11+ self:sendTextMessage(MESSAGE_INFO_DESCR, description)
12+ return true
13+ end
14+ end
15+ local description = "You see " .. thing:getDescription(distance)
16+ if self:getGroup():getAccess() then
17+ if thing:isItem() then
18+ description = string.format("%s\nItem ID: %d", description, thing:getId())
19+
20+ local actionId = thing:getActionId()
21+ if actionId ~= 0 then
22+ description = string.format("%s, Action ID: %d", description, actionId)
23+ end
24+
25+ local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
26+ if uniqueId > 0 and uniqueId < 65536 then
27+ description = string.format("%s, Unique ID: %d", description, uniqueId)
28+ end
29+
30+ local itemType = thing:getType()
31+
32+ local transformEquipId = itemType:getTransformEquipId()
33+ local transformDeEquipId = itemType:getTransformDeEquipId()
34+ if transformEquipId ~= 0 then
35+ description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
36+ elseif transformDeEquipId ~= 0 then
37+ description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
38+ end
39+
40+ local decayId = itemType:getDecayId()
41+ if decayId ~= -1 then
42+ description = string.format("%s\nDecays to: %d", description, decayId)
43+ end
44+ elseif thing:isCreature() then
45+ local str = "%s\nHealth: %d / %d"
46+ if thing:isPlayer() and thing:getMaxMana() > 0 then
47+ str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
48+ end
49+ description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
50+ end
51+
52+ local position = thing:getPosition()
53+ description = string.format(
54+ "%s\nPosition: %d, %d, %d",
55+ description, position.x, position.y, position.z
56+ )
57+
58+ if thing:isCreature() then
59+ if thing:isPlayer() then
60+ local client = thing:getClient()
61+ --description = string.format("%s\nIP: %s PING: %i FPS: %i.", description, Game.convertIpToString(thing:getIp()), client.ping, client.fps)
62+ end
63+ end
64+ end
65+ self:sendTextMessage(MESSAGE_INFO_DESCR, description)
66+end
67+
68+function Player:onLookInBattleList(creature, distance)
69+ local description = "You see " .. creature:getDescription(distance)
70+ if self:getGroup():getAccess() then
71+ local str = "%s\nHealth: %d / %d"
72+ if creature:isPlayer() and creature:getMaxMana() > 0 then
73+ str = string.format("%s, Mana: %d / %d", str, creature:getMana(), creature:getMaxMana())
74+ end
75+ description = string.format(str, description, creature:getHealth(), creature:getMaxHealth()) .. "."
76+
77+ local position = creature:getPosition()
78+ description = string.format(
79+ "%s\nPosition: %d, %d, %d",
80+ description, position.x, position.y, position.z
81+ )
82+
83+ if creature:isPlayer() then
84+ local client = thing:getClient()
85+ --description = string.format("%s\nIP: %s PING: %i FPS: %i.", description, Game.convertIpToString(thing:getIp()), client.ping, client.fps)
86+ end
87+ end
88+ self:sendTextMessage(MESSAGE_INFO_DESCR, description)
89+end
90+
91+function Player:onLookInTrade(partner, item, distance)
92+ self:sendTextMessage(MESSAGE_INFO_DESCR, "You see " .. item:getDescription(distance))
93+end
94+
95+function Player:onLookInShop(itemType, count)
96+ return true
97+end
98+
99+function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
100+ if item.uid > 0 then
101+ self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
102+ return false
103+ end
104+
105+ if item:getAttribute("wrapid") ~= 0 then
106+ local tile = Tile(toPosition)
107+ if (fromPosition.x ~= CONTAINER_POSITION and toPosition.x ~= CONTAINER_POSITION) or tile and not tile:getHouse() then
108+ if tile and not tile:getHouse() then
109+ self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
110+ return false
111+ end
112+ end
113+ end
114+
115+ if toPosition.x ~= CONTAINER_POSITION then
116+ return true
117+ end
118+
119+ if item:getTopParent() == self and bit.band(toPosition.y, 0x40) == 0 then
120+ local itemType, moveItem = ItemType(item:getId())
121+ if bit.band(itemType:getSlotPosition(), SLOTP_TWO_HAND) ~= 0 and toPosition.y == CONST_SLOT_LEFT then
122+ moveItem = self:getSlotItem(CONST_SLOT_RIGHT)
123+ elseif itemType:getWeaponType() == WEAPON_SHIELD and toPosition.y == CONST_SLOT_RIGHT then
124+ moveItem = self:getSlotItem(CONST_SLOT_LEFT)
125+ if moveItem and bit.band(ItemType(moveItem:getId()):getSlotPosition(), SLOTP_TWO_HAND) == 0 then
126+ return true
127+ end
128+ end
129+
130+ if moveItem then
131+ local parent = item:getParent()
132+ if parent:isContainer() and parent:getSize() == parent:getCapacity() then
133+ self:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_CONTAINERNOTENOUGHROOM))
134+ return false
135+ else
136+ return moveItem:moveTo(parent)
137+ end
138+ end
139+ end
140+
141+ return true
142+end
143+
144+function Player:onItemMoved(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
145+end
146+
147+function Player:onMoveCreature(creature, fromPosition, toPosition)
148+ if creature:isNpc() then
149+ self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
150+ return false
151+ end
152+ return true
153+end
154+
155+local function hasPendingReport(name, targetName, reportType)
156+ local f = io.open(string.format("data/reports/players/%s-%s-%d.txt", name, targetName, reportType), "r")
157+ if f then
158+ io.close(f)
159+ return true
160+ else
161+ return false
162+ end
163+end
164+
165+function Player:onReportRuleViolation(targetName, reportType, reportReason, comment, translation)
166+ local name = self:getName()
167+ if hasPendingReport(name, targetName, reportType) then
168+ self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Report est� sendo analisado.")
169+ return
170+ end
171+
172+ local file = io.open(string.format("data/reports/players/%s-%s-%d.txt", name, targetName, reportType), "a")
173+ if not file then
174+ self:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Houve um erro em seu processo de report. Por favor, contate o administrador.")
175+ return
176+ end
177+
178+ io.output(file)
179+ io.write("------------------------------\n")
180+ io.write("Reportado por: " .. name .. "\n")
181+ io.write("Alvo: " .. targetName .. "\n")
182+ io.write("Tipo: " .. reportType .. "\n")
183+ io.write("Razao: " .. reportReason .. "\n")
184+ io.write("Comentario: " .. comment .. "\n")
185+ if reportType ~= REPORT_TYPE_BOT then
186+ io.write("Translation: " .. translation .. "\n")
187+ end
188+ io.write("------------------------------\n")
189+ io.close(file)
190+ self:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("Obrigado por reportar. Seu report ser� analisado o mais breve poss�vel.", targetName, configManager.getString(configKeys.SERVER_NAME)))
191+ return
192+end
193+
194+function Player:onReportBug(message, position, category)
195+ local DIAS_SEMANA = {
196+ ["Monday"] = "Segunda";
197+ ["Tuesday"] = "Ter�a";
198+ ["Wednesday"] = "Quarta";
199+ ["Thursday"] = "Quinta";
200+ ["Friday"] = "Sexta";
201+ ["Saturday"] = "S�bado";
202+ ["Sunday"] = "Domingo";
203+ }
204+ local MES_NAME = {
205+ [01] = "Janeiro";
206+ [02] = "Fevereiro";
207+ [03] = "Mar�o";
208+ [04] = "Abril";
209+ [05] = "Maio";
210+ [06] = "Junho";
211+ [07] = "Julho";
212+ [08] = "Agosto";
213+ [09] = "Setembro";
214+ [10] = "Outubro";
215+ [11] = "Novembro";
216+ [12] = "Dezembro";
217+ }
218+
219+ local name = self:getName()
220+ local Mes = tonumber(os.date("%m", os.time()))
221+ local Dia = tonumber(os.date("%d", os.time()))
222+ local Horas = tonumber(os.date("%H", os.time()))
223+ local Minutos = tonumber(os.date("%M", os.time()))
224+ local HourMinutes = Horas .. ':' .. Minutos
225+ local Semana = os.date('%A')
226+ local file = io.open("data/reports/bugs/bugs.txt", "a")
227+
228+ if not file then
229+ self:sendTextMessage(MESSAGE_EVENT_DEFAULT, "Houve um erro em seu processo de report. Por favor, contate o administrador.")
230+ return true
231+ end
232+
233+ io.output(file)
234+ io.write("Name: " .. name)
235+ io.write("\n" ..DIAS_SEMANA[Semana].. ", " ..Dia.. " de " ..MES_NAME[Mes].. ", as " ..HourMinutes)
236+ if category == BUG_CATEGORY_MAP then
237+ io.write("\nMap Position: [" .. position.x .. ", " .. position.y .. ", " .. position.z .. "]")
238+ end
239+ local playerPosition = self:getPosition()
240+ io.write("\nPosition: [" .. playerPosition.x .. ", " .. playerPosition.y .. ", " .. playerPosition.z .. "]\n\n")
241+ io.write(message .. "\n")
242+ io.write("------------------------------------------------\n\n")
243+ io.close(file)
244+
245+ return true
246+end
247+
248+function Player:onTurn(direction)
249+ return true
250+end
251+
252+function Player:onTradeRequest(target, item)
253+ return true
254+end
255+
256+function Player:onTradeAccept(target, item, targetItem)
257+ return true
258+end
259+
260+function Player:onTradeCompleted(target, item, targetItem, isSuccess)
261+ return
262+end
263+
264+local soulCondition = Condition(CONDITION_SOUL, CONDITIONID_DEFAULT)
265+soulCondition:setTicks(4 * 60 * 1000)
266+soulCondition:setParameter(CONDITION_PARAM_SOULGAIN, 1)
267+
268+local function useStamina(player)
269+ local staminaMinutes = player:getStamina()
270+ if staminaMinutes == 0 then
271+ return
272+ end
273+
274+ local playerId = player:getId()
275+ local currentTime = os.time()
276+ local timePassed = currentTime - nextUseStaminaTime[playerId]
277+ if timePassed <= 0 then
278+ return
279+ end
280+
281+ if timePassed > 60 then
282+ if staminaMinutes > 2 then
283+ staminaMinutes = staminaMinutes - 2
284+ else
285+ staminaMinutes = 0
286+ end
287+ nextUseStaminaTime[playerId] = currentTime + 120
288+ else
289+ staminaMinutes = staminaMinutes - 1
290+ nextUseStaminaTime[playerId] = currentTime + 60
291+ end
292+ player:setStamina(staminaMinutes)
293+end
294+
295+function Player:onGainExperience(source, exp, rawExp)
296+ if self:getStorageValue(_SYSTEM.FENDAS_DIMENSIONAL[01]) > 00 then
297+ return true
298+ end
299+ if not source or source:isPlayer() then
300+ return exp
301+ end
302+
303+ -- Soul regeneration
304+ local vocation = self:getVocation()
305+ if self:getSoul() < vocation:getMaxSoul() and exp >= self:getLevel() then
306+ soulCondition:setParameter(CONDITION_PARAM_SOULTICKS, vocation:getSoulGainTicks() * 1000)
307+ self:addCondition(soulCondition)
308+ end
309+
310+ -- Apply experience stage multiplier
311+ exp = exp * Game.getExperienceStage(self:getLevel())
312+
313+ -- Stamina modifier
314+ if configManager.getBoolean(configKeys.STAMINA_SYSTEM) then
315+ useStamina(self)
316+
317+ local staminaMinutes = self:getStamina()
318+ if staminaMinutes > 2400 and self:isPremium() then
319+ exp = exp * 1.5
320+ elseif staminaMinutes <= 840 then
321+ exp = exp * 0.5
322+ end
323+ end
324+
325+ -- Warzone EXP
326+ if self:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) > 0 then
327+ if self:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) == 01 then
328+ exp = exp * 1.05
329+ elseif self:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) == 02 then
330+ exp = exp * 1.10
331+ elseif self:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) == 03 then
332+ exp = exp * 1.15
333+ elseif self:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) == 04 then
334+ exp = exp * 1.20
335+ elseif self:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) == 05 then
336+ exp = exp * 1.25
337+ elseif self:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) == 06 then
338+ exp = exp * 1.30
339+ elseif self:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) == 07 then
340+ exp = exp * 1.35
341+ end
342+ end
343+
344+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) == 07 then
345+ if self:getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[07].EXP_BONUS) > 0 then
346+ local EXP_BONUS = self:getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[07].EXP_BONUS) / 100
347+ local NEW_EXP = exp * EXP_BONUS
348+ exp = exp + NEW_EXP
349+ end
350+ end
351+
352+ if self:isPlayer() then
353+ if self:getStorageValue(_SYSTEM.PENALIDADES[01]) > 0 then
354+ if exp > self:getStorageValue(_SYSTEM.PENALIDADES[01]) then
355+ local temp = exp - self:getStorageValue(_SYSTEM.PENALIDADES[01])
356+ self:setStorageValue(_SYSTEM.PENALIDADES[01], nil)
357+ self:sendCancelMessage("@Penalidade 0")
358+ return temp
359+ elseif exp == self:getStorageValue(_SYSTEM.PENALIDADES[01]) then
360+ self:setStorageValue(_SYSTEM.PENALIDADES[01], nil)
361+ self:sendCancelMessage("@Penalidade 0")
362+ return 0
363+ else
364+ self:setStorageValue(_SYSTEM.PENALIDADES[01], (self:getStorageValue(_SYSTEM.PENALIDADES[01]) - exp))
365+ self:sendCancelMessage("@Penalidade " ..self:getStorageValue(_SYSTEM.PENALIDADES[01]))
366+ return 0
367+ end
368+ end
369+ end
370+
371+ if self:getStorageValue(_SYSTEM.SHOP_WARZONE) == 04 then
372+ exp = exp * 2
373+ end
374+
375+ -- DESAFIO
376+ if self:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then
377+ onPlayerDesafios(self, 05, exp)
378+ end
379+ self:sendCancelMessage("@Analyser#01#" ..exp)
380+ return exp
381+end
382+
383+function Player:onLoseExperience(exp)
384+ return exp
385+end
386+
387+function Player:onGainSkillTries(skill, tries)
388+ if APPLY_SKILL_MULTIPLIER == false then
389+ return tries
390+ end
391+ if skill == SKILL_MAGLEVEL then
392+ return false
393+ end
394+
395+ return tries * configManager.getNumber(configKeys.RATE_SKILL)
396+end
397+
398+function Player:onWrapItem(item, position)
399+ local topCylinder = item:getTopParent()
400+ if not topCylinder then
401+ return
402+ end
403+
404+ local tile = Tile(topCylinder:getPosition())
405+ if not tile then
406+ return
407+ end
408+
409+ local house = tile:getHouse()
410+ if not house then
411+ self:sendCancelMessage("You can only wrap and unwrap this item inside a house.")
412+ return
413+ end
414+
415+ if house ~= self:getHouse() and not string.find(house:getAccessList(SUBOWNER_LIST):lower(), "%f[%a]" .. self:getName():lower() .. "%f[%A]") then
416+ self:sendCancelMessage("You cannot wrap or unwrap items from a house, which you are only guest to.")
417+ return
418+ end
419+
420+ local wrapId = item:getAttribute("wrapid")
421+ if wrapId == 0 then
422+ return
423+ end
424+
425+ local oldId = item:getId()
426+ item:remove(1)
427+ local item = tile:addItem(wrapId)
428+ if item then
429+ item:setAttribute("wrapid", oldId)
430+ end
431+end
432+
433+function Player:onQueueLeave(queue)
434+ self:sendExtendedOpcode(ExtendedOPCodes.CODE_DUNGEONS, json.encode({action = "queue", data = {joined = false}}))
435+ local dungeon = queue:getDungeon()
436+ local players = Game.getPlayers()
437+ local inQueue = queue:getPlayersNumber()
438+ for _, player in ipairs(players) do
439+ player:sendExtendedOpcode(
440+ ExtendedOPCodes.CODE_DUNGEONS,
441+ json.encode({action = "queueUpdate", data = {id = dungeon:getId(), queue = inQueue, estimated = dungeon:getEstimatedQueueTime(player)}})
442+ )
443+ end
444+end
A data/global.lua +238-0 View file
@@ -0,0 +1,238 @@
1+math.randomseed(os.time())
2+dofile('data/lib/lib.lua')
3+
4+ropeSpots = {384, 418, 8278, 8592, 13189, 14435, 14436, 14857, 15635, 19518, 24621, 24622, 24623, 24624, 26019}
5+
6+doors = {[1209] = 1211, [1210] = 1211, [1212] = 1214, [1213] = 1214, [1219] = 1220, [1221] = 1222, [1231] = 1233, [1232] = 1233, [1234] = 1236, [1235] = 1236, [1237] = 1238, [1239] = 1240, [1249] = 1251, [1250] = 1251, [1252] = 1254, [1253] = 1254, [1539] = 1540, [1541] = 1542, [3535] = 3537, [3536] = 3537, [3538] = 3539, [3544] = 3546, [3545] = 3546, [3547] = 3548, [4913] = 4915, [4914] = 4915, [4916] = 4918, [4917] = 4918, [5082] = 5083, [5084] = 5085, [5098] = 5100, [5099] = 5100, [5101] = 5102, [5107] = 5109, [5108] = 5109, [5110] = 5111, [5116] = 5118, [5117] = 5118, [5119] = 5120, [5125] = 5127, [5126] = 5127, [5128] = 5129, [5134] = 5136, [5135] = 5136, [5137] = 5139, [5138] = 5139, [5140] = 5142, [5141] = 5142, [5143] = 5145, [5144] = 5145, [5278] = 5280, [5279] = 5280, [5281] = 5283, [5282] = 5283, [5284] = 5285, [5286] = 5287, [5515] = 5516, [5517] = 5518, [5732] = 5734, [5733] = 5734, [5735] = 5737, [5736] = 5737, [6192] = 6194, [6193] = 6194, [6195] = 6197, [6196] = 6197, [6198] = 6199, [6200] = 6201, [6249] = 6251, [6250] = 6251, [6252] = 6254, [6253] = 6254, [6255] = 6256, [6257] = 6258, [6795] = 6796, [6797] = 6798, [6799] = 6800, [6801] = 6802, [6891] = 6893, [6892] = 6893, [6894] = 6895, [6900] = 6902, [6901] = 6902, [6903] = 6904, [7033] = 7035, [7034] = 7035, [7036] = 7037, [7042] = 7044, [7043] = 7044, [7045] = 7046, [7054] = 7055, [7056] = 7057, [8541] = 8543, [8542] = 8543, [8544] = 8546, [8545] = 8546, [8547] = 8548, [8549] = 8550, [9165] = 9167, [9166] = 9167, [9168] = 9170, [9169] = 9170, [9171] = 9172, [9173] = 9174, [9267] = 9269, [9268] = 9269, [9270] = 9272, [9271] = 9272, [9273] = 9274, [9275] = 9276, [10276] = 10277, [10274] = 10275, [10268] = 10270, [10269] = 10270, [10271] = 10273, [10272] = 10273, [10471] = 10472, [10480] = 10481, [10477] = 10479, [10478] = 10479, [10468] = 10470, [10469] = 10470, [10775] = 10777, [10776] = 10777, [12092] = 12094, [12093] = 12094, [12188] = 12190, [12189] = 12190, [19840] = 19842, [19841] = 19842, [19843] = 19844, [19980] = 19982, [19981] = 19982, [19983] = 19984, [20273] = 20275, [20274] = 20275, [20276] = 20277, [17235] = 17236, [18208] = 18209, [13022] = 13023, [10784] = 10786, [10785] = 10786, [12099] = 12101, [12100] = 12101, [12197] = 12199, [12198] = 12199, [19849] = 19851, [19850] = 19851, [19852] = 19853, [19989] = 19991, [19990] = 19991, [19992] = 19993, [20282] = 20284, [20283] = 20284, [20285] = 20286, [17237] = 17238, [13020] = 13021, [10780] = 10781, [12095] = 12096, [12195] = 12196, [19845] = 19846, [19985] = 19986, [20278] = 20279, [10789] = 10790, [12102] = 12103, [12204] = 12205, [19854] = 19855, [19994] = 19995, [20287] = 20288, [10782] = 10783, [12097] = 12098, [12193] = 12194, [19847] = 19848, [19987] = 19988, [20280] = 20281, [10791] = 10792, [12104] = 12105, [12202] = 12203, [19856] = 19857, [19996] = 19997, [20289] = 20290, [25158] = 25159, [25160] = 25161}
7+verticalOpenDoors = {1211, 1220, 1224, 1228, 1233, 1238, 1242, 1246, 1251, 1256, 1260, 1540, 3546, 3548, 3550, 3552, 4915, 5083, 5109, 5111, 5113, 5115, 5127, 5129, 5131, 5133, 5142, 5145, 5283, 5285, 5289, 5293, 5516, 5737, 5749, 6194, 6199, 6203, 6207, 6251, 6256, 6260, 6264, 6798, 6802, 6902, 6904, 6906, 6908, 7044, 7046, 7048, 7050, 7055, 8543, 8548, 8552, 8556, 9167, 9172, 9269, 9274, 9274, 9269, 9278, 9282, 10270, 10275, 10279, 10283, 10479, 10481, 10485, 10483, 10786, 12101, 12199, 19851, 19853, 19991, 19993, 20284, 20286, 17238, 13021, 10790, 12103, 12205, 19855, 19995, 20288, 10792, 12105, 12203, 19857, 19997, 20290}
8+horizontalOpenDoors = {1214, 1222, 1226, 1230, 1236, 1240, 1244, 1248, 1254, 1258, 1262, 1542, 3537, 3539, 3541, 3543, 4918, 5085, 5100, 5102, 5104, 5106, 5118, 5120, 5122, 5124, 5136, 5139, 5280, 5287, 5291, 5295, 5518, 5734, 5746, 6197, 6201, 6205, 6209, 6254, 6258, 6262, 6266, 6796, 6800, 6893, 6895, 6897, 6899, 7035, 7037, 7039, 7041, 7057, 8546, 8550, 8554, 8558, 9170, 9174, 9272, 9276, 9280, 9284, 10273, 10277, 10281, 10285, 10470, 10472, 10476, 10474, 10777, 12094, 12190, 19842, 19844, 19982, 19984, 20275, 20277, 17236, 18209, 13023, 10781, 12096, 12196, 19846, 19986, 20279, 10783, 12098, 12194, 19848, 19988, 20281}
9+openSpecialDoors = {1224, 1226, 1228, 1230, 1242, 1244, 1246, 1248, 1256, 1258, 1260, 1262, 3541, 3543, 3550, 3552, 5104, 5106, 5113, 5115, 5122, 5124, 5131, 5133, 5289, 5291, 5293, 5295, 6203, 6205, 6207, 6209, 6260, 6262, 6264, 6266, 6897, 6899, 6906, 6908, 7039, 7041, 7048, 7050, 8552, 8554, 8556, 8558, 9176, 9178, 9180, 9182, 9278, 9280, 9282, 9284, 10279, 10281, 10283, 10285, 10474, 10476, 10483, 10485, 10781, 12096, 12196, 19846, 19986, 20279, 10783, 12098, 12194, 19848, 19988, 20281, 10790, 12103, 12205, 19855, 19995, 20288, 10792, 12105, 12203, 19857, 19997, 20290, 25163, 25165}
10+questDoors = {1223, 1225, 1241, 1243, 1255, 1257, 3542, 3551, 5105, 5114, 5123, 5132, 5288, 5290, 5745, 5748, 6202, 6204, 6259, 6261, 6898, 6907, 7040, 7049, 8551, 8553, 9175, 9177, 9277, 9279, 10278, 10280, 10475, 10484, 10782, 10791, 12097, 12104, 12193, 12202, 19847, 19856, 19987, 19996, 20280, 20289, 25162, 25164}
11+levelDoors = {1227, 1229, 1245, 1247, 1259, 1261, 3540, 3549, 5103, 5112, 5121, 5130, 5292, 5294, 6206, 6208, 6263, 6265, 6896, 6905, 7038, 7047, 8555, 8557, 9179, 9181, 9281, 9283, 10282, 10284, 10473, 10482, 10780, 10789, 10780, 12095, 12102, 12204, 12195, 19845, 19854, 19985, 19994, 20278, 20287}
12+keys = {2086, 2087, 2088, 2089, 2090, 2091, 2092, 10032}
13+
14+MONSTER_STORAGE = MONSTER_STORAGE or {}
15+
16+function Monster.setStorageValue(self, key, value)
17+ local cid = self:getId()
18+ local storageMap = MONSTER_STORAGE[cid]
19+ if not storageMap then
20+ MONSTER_STORAGE[cid] = {[key] = value}
21+ else
22+ storageMap[key] = value
23+ end
24+end
25+
26+function Monster.getStorageValue(self, key)
27+ local storageMap = MONSTER_STORAGE[self:getId()]
28+ if storageMap then
29+ return storageMap[key] or -1
30+ end
31+ return -1
32+end
33+
34+function getDistanceBetween(firstPosition, secondPosition)
35+ local xDif = math.abs(firstPosition.x - secondPosition.x)
36+ local yDif = math.abs(firstPosition.y - secondPosition.y)
37+ local posDif = math.max(xDif, yDif)
38+ if firstPosition.z ~= secondPosition.z then
39+ posDif = posDif + 15
40+ end
41+ return posDif
42+end
43+
44+function getFormattedWorldTime()
45+ local worldTime = getWorldTime()
46+ local hours = math.floor(worldTime / 60)
47+
48+ local minutes = worldTime % 60
49+ if minutes < 10 then
50+ minutes = '0' .. minutes
51+ end
52+ return hours .. ':' .. minutes
53+end
54+
55+function getLootRandom()
56+ return math.random(0, MAX_LOOTCHANCE) / configManager.getNumber(configKeys.RATE_LOOT)
57+end
58+
59+table.contains = function(array, value)
60+ for _, targetColumn in pairs(array) do
61+ if targetColumn == value then
62+ return true
63+ end
64+ end
65+ return false
66+end
67+
68+string.split = function(str, sep)
69+ local res = {}
70+ for v in str:gmatch("([^" .. sep .. "]+)") do
71+ res[#res + 1] = v
72+ end
73+ return res
74+end
75+
76+string.splitTrimmed = function(str, sep)
77+ local res = {}
78+ for v in str:gmatch("([^" .. sep .. "]+)") do
79+ res[#res + 1] = v:trim()
80+ end
81+ return res
82+end
83+
84+string.trim = function(str)
85+ return str:match'^()%s*$' and '' or str:match'^%s*(.*%S)'
86+end
87+
88+if not nextUseStaminaTime then
89+ nextUseStaminaTime = {}
90+end
91+
92+function getPlayerDatabaseInfo(name_or_guid)
93+ local sql_where = ""
94+
95+ if type(name_or_guid) == 'string' then
96+ sql_where = "WHERE `p`.`name`=" .. db.escapeString(name_or_guid) .. ""
97+ elseif type(name_or_guid) == 'number' then
98+ sql_where = "WHERE `p`.`id`='" .. name_or_guid .. "'"
99+ else
100+ return false
101+ end
102+
103+ local sql_query = [[
104+ SELECT
105+ `p`.`id` as `guid`,
106+ `p`.`name`,
107+ CASE WHEN `po`.`player_id` IS NULL
108+ THEN 0
109+ ELSE 1
110+ END AS `online`,
111+ `p`.`group_id`,
112+ `p`.`level`,
113+ `p`.`experience`,
114+ `p`.`vocation`,
115+ `p`.`maglevel`,
116+ `p`.`skill_fist`,
117+ `p`.`skill_club`,
118+ `p`.`skill_sword`,
119+ `p`.`skill_axe`,
120+ `p`.`skill_dist`,
121+ `p`.`skill_shielding`,
122+ `p`.`skill_fishing`,
123+ `p`.`town_id`,
124+ `p`.`balance`,
125+ `gm`.`guild_id`,
126+ `gm`.`nick`,
127+ `g`.`name` AS `guild_name`,
128+ CASE WHEN `p`.`id` = `g`.`ownerid`
129+ THEN 1
130+ ELSE 0
131+ END AS `is_leader`,
132+ `gr`.`name` AS `rank_name`,
133+ `gr`.`level` AS `rank_level`,
134+ `h`.`id` AS `house_id`,
135+ `h`.`name` AS `house_name`,
136+ `h`.`town_id` AS `house_town`
137+ FROM `players` AS `p`
138+ LEFT JOIN `players_online` AS `po`
139+ ON `p`.`id` = `po`.`player_id`
140+ LEFT JOIN `guild_membership` AS `gm`
141+ ON `p`.`id` = `gm`.`player_id`
142+ LEFT JOIN `guilds` AS `g`
143+ ON `gm`.`guild_id` = `g`.`id`
144+ LEFT JOIN `guild_ranks` AS `gr`
145+ ON `gm`.`rank_id` = `gr`.`id`
146+ LEFT JOIN `houses` AS `h`
147+ ON `p`.`id` = `h`.`owner`
148+ ]] .. sql_where
149+
150+ local query = db.storeQuery(sql_query)
151+ if not query then
152+ return false
153+ end
154+
155+ local info = {
156+ ["guid"] = result.getNumber(query, "guid"),
157+ ["name"] = result.getString(query, "name"),
158+ ["online"] = result.getNumber(query, "online"),
159+ ["group_id"] = result.getNumber(query, "group_id"),
160+ ["level"] = result.getNumber(query, "level"),
161+ ["experience"] = result.getNumber(query, "experience"),
162+ ["vocation"] = result.getNumber(query, "vocation"),
163+ ["maglevel"] = result.getNumber(query, "maglevel"),
164+ ["skill_fist"] = result.getNumber(query, "skill_fist"),
165+ ["skill_club"] = result.getNumber(query, "skill_club"),
166+ ["skill_sword"] = result.getNumber(query, "skill_sword"),
167+ ["skill_axe"] = result.getNumber(query, "skill_axe"),
168+ ["skill_dist"] = result.getNumber(query, "skill_dist"),
169+ ["skill_shielding"] = result.getNumber(query, "skill_shielding"),
170+ ["skill_fishing"] = result.getNumber(query, "skill_fishing"),
171+ ["town_id"] = result.getNumber(query, "town_id"),
172+ ["balance"] = result.getNumber(query, "balance"),
173+ ["guild_id"] = result.getNumber(query, "guild_id"),
174+ ["nick"] = result.getString(query, "nick"),
175+ ["guild_name"] = result.getString(query, "guild_name"),
176+ ["is_leader"] = result.getNumber(query, "is_leader"),
177+ ["rank_name"] = result.getString(query, "rank_name"),
178+ ["rank_level"] = result.getNumber(query, "rank_level"),
179+ ["house_id"] = result.getNumber(query, "house_id"),
180+ ["house_name"] = result.getString(query, "house_name"),
181+ ["house_town"] = result.getNumber(query, "house_town")
182+ }
183+
184+ result.free(query)
185+ return info
186+end
187+
188+local function allowMovementEvent(cid, allow, oldPosition)
189+ local creature = Creature(cid)
190+ if not creature then
191+ return false
192+ end
193+
194+ if allow then
195+ return stopEvent(event)
196+ else
197+ stopEvent(event)
198+ end
199+
200+ creature:teleportTo(oldPosition, true)
201+
202+ event = addEvent(allowMovementEvent, 100, cid, allow, oldPosition)
203+end
204+
205+function Creature.allowMovement(self, allow)
206+ allowMovementEvent(self:getId(), allow, self:getPosition())
207+end
208+
209+local CODE = 107
210+
211+function sendSoundToPlayer(player, soundFile)
212+ local json_data = json.encode({action = "play", data = soundFile})
213+ player:sendExtendedOpcode(CODE, json_data)
214+end
215+
216+
217+
218+function playSound(creature, soundFile)
219+ local spectators = Game.getSpectators(creature:getPosition(), false, true, 7, 7, 7, 7)
220+ for _, spectator in ipairs(spectators) do
221+ if spectator:isPlayer() then
222+ sendSoundToPlayer(spectator, soundFile)
223+ end
224+ end
225+end
226+
227+local CODE = 108
228+
229+function sendSoundToPlayer(player, soundFile)
230+ local json_data = json.encode({action = "play", data = soundFile})
231+ player:sendExtendedOpcode(CODE, json_data)
232+end
233+
234+function playSoundPlayer(player, soundFile)
235+ if player:isPlayer() then
236+ sendSoundToPlayer(player, soundFile)
237+ end
238+end
A data/globalevents/globalevents.xml +25-0 View file
@@ -0,0 +1,25 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+<globalevents>
3+ <globalevent type="startup" name="ServerStartup" script="startup.lua" />
4+ <globalevent type="record" name="PlayerRecord" script="record.lua" />
5+ <globalevent name="effect" interval="2999" script="text_effect.lua"/>
6+ <globalevent name="events" interval="3600000" script="events.lua"/>
7+ <!--<globalevent name="unofficial" interval="600000" script="unofficial_client.lua"/>-->
8+
9+ <globalevent name="delstorage" time="06:50:00" script="delstorage.lua" />
10+ <globalevent name="savemanha" time="06:55:00" script="serversave.lua" /> <!-- 07:00 -->
11+ <globalevent name="delstorage1" time="11:50:00" script="delstorage.lua" />
12+ <globalevent name="savemeiodia" time="11:55:00" script="serversave.lua" /> <!-- 12:00 -->
13+ <globalevent name="delstorage2" time="17:50:00" script="delstorage.lua" />
14+ <globalevent name="savenoite" time="17:55:00" script="serversave.lua" /> <!-- 18:00 -->
15+
16+ <globalevent name="delstorage3" time="19:50:00" script="delstorage.lua" />
17+ <globalevent name="savemadru" time="19:55:00" script="serversave.lua" /> <!-- 20:00 -->
18+ <globalevent name="Warzone" time="20:05:00" script="warzone.lua" />
19+
20+ <globalevent name="delstorage4" time="23:50:00" script="delstorage.lua" />
21+ <globalevent name="serversavenoite" time="23:55:00" script="serversave_off.lua" /> <!-- 00:00 -->
22+
23+ <globalevent name="delstorage5" time="03:50:00" script="delstorage.lua" />
24+ <globalevent name="savemadrug" time="03:55:00" script="serversave.lua" /> <!-- 03:00 -->
25+</globalevents>
A data/globalevents/lib/globalevents.lua +1-0 View file
@@ -0,0 +1,1 @@
1+-- empty file --
A data/globalevents/scripts/delstorage.lua +4-0 View file
@@ -0,0 +1,4 @@
1+function onTime(interval)
2+ db.query("DELETE FROM `player_storage` WHERE `player_storage`.`value` = 0;")
3+ return true
4+end
A data/globalevents/scripts/events.lua +147-0 View file
@@ -0,0 +1,147 @@
1+local JOKER_EVENT = {
2+ [01] = { -- DRAGONS [BONEBROOK]
3+ [00] = {
4+ POS_X = {x=3499, y=1100, z=7},
5+ POS_Y = {x=3583, y=1162, z=7},
6+ TITLE = "Solo Negro de Bonebrook",
7+ },
8+ [01] = {POS = {x=3518, y=1126, z=7}},
9+ [02] = {POS = {x=3522, y=1138, z=7}},
10+ [03] = {POS = {x=3516, y=1147, z=7}},
11+ [04] = {POS = {x=3528, y=1120, z=7}},
12+ [05] = {POS = {x=3527, y=1126, z=7}},
13+ [06] = {POS = {x=3529, y=1133, z=7}},
14+ [07] = {POS = {x=3530, y=1139, z=7}},
15+ [08] = {POS = {x=3528, y=1146, z=7}},
16+ [09] = {POS = {x=3533, y=1125, z=7}},
17+ [10] = {POS = {x=3536, y=1131, z=7}},
18+ [11] = {POS = {x=3537, y=1142, z=7}},
19+ [12] = {POS = {x=3541, y=1118, z=7}},
20+ [13] = {POS = {x=3543, y=1127, z=7}},
21+ [14] = {POS = {x=3544, y=1134, z=7}},
22+ [15] = {POS = {x=3544, y=1146, z=7}},
23+ [16] = {POS = {x=3546, y=1143, z=7}},
24+ [17] = {POS = {x=3552, y=1138, z=7}},
25+ [18] = {POS = {x=3550, y=1132, z=7}},
26+ [19] = {POS = {x=3549, y=1125, z=7}},
27+ [20] = {POS = {x=3550, y=1119, z=7}},
28+ [21] = {POS = {x=3555, y=1129, z=7}},
29+ [22] = {POS = {x=3561, y=1121, z=7}},
30+ [23] = {POS = {x=3560, y=1125, z=7}},
31+ [24] = {POS = {x=3559, y=1133, z=7}},
32+ [25] = {POS = {x=3565, y=1134, z=7}},
33+ },
34+ [02] = { -- DESERTO [RIVERMINE]
35+ [00] = {
36+ POS_X = {x=3691, y=1183, z=7},
37+ POS_Y = {x=3790, y=1253, z=7},
38+ TITLE = "Deserto Escaldante de Rivermine",
39+ },
40+ [01] = {POS = {x=3706, y=1208, z=7}},
41+ [02] = {POS = {x=3707, y=1222, z=7}},
42+ [03] = {POS = {x=3718, y=1202, z=7}},
43+ [04] = {POS = {x=3717, y=1208, z=7}},
44+ [05] = {POS = {x=3714, y=1215, z=7}},
45+ [06] = {POS = {x=3718, y=1226, z=7}},
46+ [07] = {POS = {x=3718, y=1231, z=7}},
47+ [08] = {POS = {x=3724, y=1196, z=7}},
48+ [09] = {POS = {x=3723, y=1216, z=7}},
49+ [10] = {POS = {x=3727, y=1230, z=7}},
50+ [11] = {POS = {x=3730, y=1223, z=7}},
51+ [12] = {POS = {x=3729, y=1206, z=7}},
52+ [13] = {POS = {x=3729, y=1195, z=7}},
53+ [14] = {POS = {x=3734, y=1200, z=7}},
54+ [15] = {POS = {x=3737, y=1193, z=7}},
55+ [16] = {POS = {x=3738, y=1204, z=7}},
56+ [17] = {POS = {x=3739, y=1212, z=7}},
57+ [18] = {POS = {x=3738, y=1225, z=7}},
58+ [19] = {POS = {x=3738, y=1232, z=7}},
59+ [20] = {POS = {x=3744, y=1205, z=7}},
60+ [21] = {POS = {x=3746, y=1219, z=7}},
61+ [22] = {POS = {x=3749, y=1200, z=7}},
62+ [23] = {POS = {x=3749, y=1211, z=7}},
63+ [24] = {POS = {x=3751, y=1230, z=7}},
64+ [25] = {POS = {x=3753, y=1221, z=7}},
65+ },
66+ [03] = { -- CAMPOS VERDES [BASE PREMIUM]
67+ [00] = {
68+ POS_X = {x=3682, y=1572, z=7},
69+ POS_Y = {x=3762, y=1630, z=7},
70+ TITLE = "Campos Verdejantes da Base Premium",
71+ },
72+ [01] = {POS = {x=3697, y=1595, z=7}},
73+ [02] = {POS = {x=3699, y=1601, z=7}},
74+ [03] = {POS = {x=3700, y=1613, z=7}},
75+ [04] = {POS = {x=3703, y=1588, z=7}},
76+ [05] = {POS = {x=3704, y=1609, z=7}},
77+ [06] = {POS = {x=3705, y=1582, z=7}},
78+ [07] = {POS = {x=3707, y=1599, z=7}},
79+ [08] = {POS = {x=3709, y=1591, z=7}},
80+ [09] = {POS = {x=3709, y=1615, z=7}},
81+ [10] = {POS = {x=3713, y=1584, z=7}},
82+ [11] = {POS = {x=3714, y=1592, z=7}},
83+ [12] = {POS = {x=3714, y=1606, z=7}},
84+ [13] = {POS = {x=3717, y=1583, z=7}},
85+ [14] = {POS = {x=3717, y=1596, z=7}},
86+ [15] = {POS = {x=3720, y=1587, z=7}},
87+ [16] = {POS = {x=3720, y=1610, z=7}},
88+ [17] = {POS = {x=3721, y=1605, z=7}},
89+ [18] = {POS = {x=3724, y=1592, z=7}},
90+ [19] = {POS = {x=3727, y=1586, z=7}},
91+ [20] = {POS = {x=3727, y=1606, z=7}},
92+ [21] = {POS = {x=3729, y=1613, z=7}},
93+ [22] = {POS = {x=3731, y=1596, z=7}},
94+ [23] = {POS = {x=3732, y=1591, z=7}},
95+ [24] = {POS = {x=3734, y=1601, z=7}},
96+ [25] = {POS = {x=3734, y=1609, z=7}},
97+ },
98+}
99+
100+local function onRemoveMonsterEvent()
101+ for X = 01, #JOKER_EVENT do
102+ local from = JOKER_EVENT[X][00].POS_X
103+ local to = JOKER_EVENT[X][00].POS_Y
104+ for A = from.x, to.x do
105+ for B = from.y, to.y do
106+ for C = from.z, to.z do
107+ local tile = Tile(A, B, C)
108+ local creature = tile:getTopCreature()
109+ if creature and creature:isMonster() and creature:getName() == "Joker" then
110+ doRemoveCreature(creature:getId())
111+ end
112+ end
113+ end
114+ end
115+ end
116+end
117+function onThink(interval)
118+ if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 01 then -- JOKER
119+ local onPlaceRaids = math.random(01, #JOKER_EVENT)
120+ onRemoveMonsterEvent()
121+
122+ for X = 01, #JOKER_EVENT[onPlaceRaids] do
123+ Game.createMonster("Joker", JOKER_EVENT[onPlaceRaids][X].POS)
124+ end
125+ Game.broadcastMessage("Invas�es de Joker em [ " ..JOKER_EVENT[onPlaceRaids][00].TITLE.. " ].")
126+ end
127+ if Game.getStorageValue(_GLOBAL_RANDOM.DAILY_EVENTS.STORAGE) == 03 then -- BUFFS DE DEVOVORGA
128+ local from = {x=3545, y=1530, z=7}
129+ local to = {x=3627, y=1601, z=7}
130+ for A = from.x, to.x do
131+ for B = from.y, to.y do
132+ for C = from.z, to.z do
133+ local tile = Tile(A, B, C)
134+ local creature = tile:getTopCreature()
135+ if creature and creature:isMonster() and creature:getName() == "Devovorga" then
136+ doRemoveCreature(creature:getId())
137+ break
138+ end
139+ end
140+ end
141+ end
142+
143+ Game.createMonster("Devovorga", {x=3585, y=1572, z=7})
144+ Game.broadcastMessage("Devovorga surgiu no mapa.")
145+ end
146+ return true
147+end
A data/globalevents/scripts/record.lua +4-0 View file
@@ -0,0 +1,4 @@
1+function onRecord(current, old)
2+ addEvent(broadcastMessage, 150, "New record: " .. current .. " players are logged in.", MESSAGE_STATUS_DEFAULT)
3+ return true
4+end
A data/globalevents/scripts/serversave.lua +114-0 View file
@@ -0,0 +1,114 @@
1+local function ServerSave()
2+ -- NINHOS [RANDOM]
3+ Game.setStorageValue(_GLOBAL_RANDOM.NINHOS["SYSTEM"].NINHO_1, math.random(01, #_GLOBAL_RANDOM.NINHOS["FACIL"]))
4+ Game.setStorageValue(_GLOBAL_RANDOM.NINHOS["SYSTEM"].NINHO_2, math.random(01, #_GLOBAL_RANDOM.NINHOS["MEDIO"]))
5+ Game.setStorageValue(_GLOBAL_RANDOM.NINHOS["SYSTEM"].NINHO_3, math.random(01, #_GLOBAL_RANDOM.NINHOS["DIFICIL"]))
6+ Game.setStorageValue(_GLOBAL_RANDOM.NINHOS["SYSTEM"].NINHO_4, math.random(01, #_GLOBAL_RANDOM.NINHOS["IMPOSSIVEL"]))
7+ -- BOOSTER CREATURE
8+ for X = 01, #_SYSTEM.TASK.MONSTER do
9+ local mathRandom = math.random(01, #_SYSTEM.TASK.MONSTER[X])
10+ if X ~= 07 then
11+ Game.setStorageValue(_SYSTEM.TASK.MONSTER[X][00].BOOSTER, _SYSTEM.TASK.MONSTER[X][mathRandom].IMG_ID)
12+ end
13+ end
14+ -- EVENTOS
15+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) > 0 then
16+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) == 03 then -- CRYPTBLOOD
17+ Game.setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_1, 00)
18+ end
19+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) == 11 then -- PILARES DA FORTUNA
20+ for X = 01, 05 do
21+ local POS_PILLAR = Tile(_GLOBAL_RANDOM.EVENTOS_TABLE[11].PILLAR_POS[X].TILE[01], _GLOBAL_RANDOM.EVENTOS_TABLE[11].PILLAR_POS[X].TILE[02], _GLOBAL_RANDOM.EVENTOS_TABLE[11].PILLAR_POS[X].TILE[03])
22+ local CHECK_PILLAR = POS_PILLAR:getTopCreature()
23+ if CHECK_PILLAR then
24+ doRemoveCreature(CHECK_PILLAR:getId())
25+ end
26+
27+ Game.createMonster('Pillar of Fortune', _GLOBAL_RANDOM.EVENTOS_TABLE[11].PILLAR_POS[X].POS[01])
28+ end
29+
30+ local players = Game.getPlayers()
31+ for _, targetPlayer in ipairs(players) do
32+ targetPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, "[EVENTO]\nOs Pilares da Fortuna foram adicionadas ao mapa.")
33+ end
34+ Game.setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[11].PILLAR_STEP, 01)
35+ end
36+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) == 12 then -- OS ESCOLHIDOS
37+ local ClassMonster = {01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11}
38+ local ClassUm = math.random(01, #ClassMonster)
39+ Game.setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_1, ClassMonster[ClassUm])
40+ table.remove(ClassMonster, ClassUm)
41+
42+ local ClassDois = math.random(01, #ClassMonster)
43+ Game.setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_2, ClassMonster[ClassDois])
44+ table.remove(ClassMonster, ClassDois)
45+
46+ local ClassTres = math.random(01, #ClassMonster)
47+ Game.setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_3, ClassMonster[ClassTres])
48+ table.remove(ClassMonster, ClassTres)
49+
50+ Game.setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_4, 00)
51+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_5) == 01 then
52+ Game.setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_5, 02)
53+ else
54+ Game.setStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_UID_5, 01)
55+ end
56+ end
57+ end
58+ -- SAQUEADORES [RANDOM]
59+ for SAQUE_RANK = 01, 05 do
60+ local Saquear = {}
61+ for i = 01, #_GLOBAL_RANDOM.SAQUEADORES[SAQUE_RANK] do
62+ table.insert(Saquear, i)
63+ end
64+
65+ local R_1 = math.random(01, #Saquear)
66+ Game.setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][SAQUE_RANK][01], Saquear[R_1])
67+ table.remove(Saquear, R_1)
68+ table.sort(Saquear)
69+
70+ local R_2 = math.random(01, #Saquear)
71+ Game.setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][SAQUE_RANK][02], Saquear[R_2])
72+ table.remove(Saquear, R_2)
73+ table.sort(Saquear)
74+
75+ local R_3 = math.random(01, #Saquear)
76+ Game.setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][SAQUE_RANK][03], Saquear[R_3])
77+ table.remove(Saquear, R_3)
78+ table.sort(Saquear)
79+
80+ local R_4 = math.random(01, #Saquear)
81+ Game.setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][SAQUE_RANK][04], Saquear[R_4])
82+ table.remove(Saquear, R_4)
83+ table.sort(Saquear)
84+
85+ local R_5 = math.random(01, #Saquear)
86+ Game.setStorageValue(_GLOBAL_RANDOM.SAQUEADORES[00][01][SAQUE_RANK][05], Saquear[R_5])
87+ table.remove(Saquear, R_5)
88+ table.sort(Saquear)
89+ end
90+
91+ saveServer()
92+ --db.query("DELETE FROM `player_storage` WHERE `player_storage`.`value` = 0;")
93+ --db.query("DELETE FROM `player_storage` WHERE `player_storage`.`value` = 0 OR `player_storage`.`value` = 100;")
94+ Game.broadcastMessage("Todo o servidor foi salvo.")
95+end
96+
97+local function ServerSaveWarning(time)
98+ local remaningTime = tonumber(time) - 60000
99+ Game.broadcastMessage("Todo o servidor ser� salvo em " .. (remaningTime/60000) .." minuto(s). Mantenha-se em um local seguro.", MESSAGE_STATUS_WARNING)
100+
101+ if remaningTime > 60000 then
102+ addEvent(ServerSaveWarning, 60000, remaningTime)
103+ else
104+ Game.broadcastMessage("Todo o servidor ser� salvo em menos de 1 minuto.")
105+ addEvent(ServerSave, 60000)
106+ end
107+end
108+function onTime(interval)
109+ local remaningTime = configManager.getNumber(configKeys.SERVER_SAVE_NOTIFY_DURATION) * 60000
110+ Game.broadcastMessage("Todo o servidor ser� salvo em " .. (remaningTime/60000) .." minuto(s). Mantenha-se em um local seguro.", MESSAGE_STATUS_WARNING)
111+
112+ addEvent(ServerSaveWarning, 60000, remaningTime)
113+ return not configManager.getBoolean(configKeys.SERVER_SAVE_SHUTDOWN)
114+end
A data/globalevents/scripts/serversave_off.lua +29-0 View file
@@ -0,0 +1,29 @@
1+local function ServerSave()
2+ local players = Game.getPlayers()
3+ local waitTime = 00
4+ for _, targetPlayer in ipairs(players) do
5+ waitTime = waitTime + 02
6+ targetPlayer:sendCancelMessage("@timeLogin " ..waitTime)
7+ end
8+ saveServer()
9+ Game.setGameState(GAME_STATE_SHUTDOWN)
10+end
11+
12+local function ServerSaveWarning(time)
13+ local remaningTime = tonumber(time) - 60000
14+ Game.broadcastMessage("Todo o servidor ser� desligado para salvamento em " .. (remaningTime/60000) .." minuto(s). Mantenha-se em um local seguro.", MESSAGE_STATUS_WARNING)
15+
16+ if remaningTime > 60000 then
17+ addEvent(ServerSaveWarning, 60000, remaningTime)
18+ else
19+ Game.broadcastMessage("O servidor ser� desligado para salvamento em menos de 1 minuto.")
20+ addEvent(ServerSave, 60000)
21+ end
22+end
23+function onTime(interval)
24+ local remaningTime = configManager.getNumber(configKeys.SERVER_SAVE_NOTIFY_DURATION) * 60000
25+ Game.broadcastMessage("Todo o servidor ser� desligado para salvamento em " .. (remaningTime/60000) .." minuto(s). Mantenha-se em um local seguro.", MESSAGE_STATUS_WARNING)
26+
27+ addEvent(ServerSaveWarning, 60000, remaningTime)
28+ return not configManager.getBoolean(configKeys.SERVER_SAVE_SHUTDOWN)
29+end
A data/globalevents/scripts/startup.lua +45-0 View file
@@ -0,0 +1,45 @@
1+function onStartup()
2+
3+ db.query("TRUNCATE TABLE `players_online`")
4+ db.asyncQuery("DELETE FROM `guild_wars` WHERE `status` = 0")
5+ db.asyncQuery("DELETE FROM `players` WHERE `deletion` != 0 AND `deletion` < " .. os.time())
6+ db.asyncQuery("DELETE FROM `ip_bans` WHERE `expires_at` != 0 AND `expires_at` <= " .. os.time())
7+ db.asyncQuery("DELETE FROM `market_history` WHERE `inserted` <= " .. (os.time() - configManager.getNumber(configKeys.MARKET_OFFER_DURATION)))
8+
9+ -- Move expired bans to ban history
10+ local resultId = db.storeQuery("SELECT * FROM `account_bans` WHERE `expires_at` != 0 AND `expires_at` <= " .. os.time())
11+ if resultId ~= false then
12+ repeat
13+ local accountId = result.getNumber(resultId, "account_id")
14+ db.asyncQuery("INSERT INTO `account_ban_history` (`account_id`, `reason`, `banned_at`, `expired_at`, `banned_by`) VALUES (" .. accountId .. ", " .. db.escapeString(result.getString(resultId, "reason")) .. ", " .. result.getNumber(resultId, "banned_at") .. ", " .. result.getNumber(resultId, "expires_at") .. ", " .. result.getNumber(resultId, "banned_by") .. ")")
15+ db.asyncQuery("DELETE FROM `account_bans` WHERE `account_id` = " .. accountId)
16+ until not result.next(resultId)
17+ result.free(resultId)
18+ end
19+
20+ -- Check house auctions
21+ local resultId = db.storeQuery("SELECT `id`, `highest_bidder`, `last_bid`, (SELECT `balance` FROM `players` WHERE `players`.`id` = `highest_bidder`) AS `balance` FROM `houses` WHERE `owner` = 0 AND `bid_end` != 0 AND `bid_end` < " .. os.time())
22+ if resultId ~= false then
23+ repeat
24+ local house = House(result.getNumber(resultId, "id"))
25+ if house then
26+ local highestBidder = result.getNumber(resultId, "highest_bidder")
27+ local balance = result.getNumber(resultId, "balance")
28+ local lastBid = result.getNumber(resultId, "last_bid")
29+ if balance >= lastBid then
30+ db.query("UPDATE `players` SET `balance` = " .. (balance - lastBid) .. " WHERE `id` = " .. highestBidder)
31+ house:setOwnerGuid(highestBidder)
32+ end
33+ db.asyncQuery("UPDATE `houses` SET `last_bid` = 0, `bid_end` = 0, `highest_bidder` = 0, `bid` = 0 WHERE `id` = " .. house:getId())
34+ end
35+ until not result.next(resultId)
36+ result.free(resultId)
37+ end
38+
39+ -- store towns in database
40+ db.query("TRUNCATE TABLE `towns`")
41+ for i, town in ipairs(Game.getTowns()) do
42+ local position = town:getTemplePosition()
43+ db.query("INSERT INTO `towns` (`id`, `name`, `posx`, `posy`, `posz`) VALUES (" .. town:getId() .. ", " .. db.escapeString(town:getName()) .. ", " .. position.x .. ", " .. position.y .. ", " .. position.z .. ")")
44+ end
45+end
A data/globalevents/scripts/text_effect.lua +69-0 View file
@@ -0,0 +1,69 @@
1+local config = {
2+ texts = {
3+ { pos = Position(4018, 1193, 7), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
4+ { pos = Position(3939, 1188, 7), text = "Entrar", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
5+ { pos = Position(3959, 1224, 7), text = "Entrar", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
6+ { pos = Position(3435, 1330, 7), text = "Sunset", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
7+ { pos = Position(3437, 1331, 7), text = "Kimbolton", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
8+ { pos = Position(3433, 1337, 7), text = "Base", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
9+ { pos = Position(3437, 1336, 7), text = "Rivermine", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
10+ { pos = Position(3556, 959, 7), text = "Huampali", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
11+ { pos = Position(3700, 1079, 7), text = "Huampali", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
12+ { pos = Position(3976, 968, 7), text = "Huampali", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
13+ { pos = Position(3611, 1226, 7), text = "Huampali", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
14+ { pos = Position(3851, 1040, 7), text = "Huampali", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
15+ { pos = Position(3439, 1334, 7), text = "Kazemir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
16+ { pos = Position(3738, 1406, 8), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
17+ { pos = Position(3541, 1758, 9), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
18+ { pos = Position(3271, 1959, 14), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
19+ { pos = Position(3930, 1738, 05), text = "Finalizar", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
20+ -- NINHOS
21+ { pos = Position(3298, 1015, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
22+ { pos = Position(3427, 1015, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
23+ { pos = Position(3492, 1020, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
24+ { pos = Position(3575, 0972, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
25+ { pos = Position(3675, 0991, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
26+ { pos = Position(3676, 1101, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
27+ { pos = Position(3530, 1047, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
28+ { pos = Position(3452, 1051, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
29+ { pos = Position(3294, 1047, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
30+ { pos = Position(3328, 1191, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
31+ { pos = Position(3388, 1155, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
32+ { pos = Position(3488, 1133, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
33+ { pos = Position(3592, 1139, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
34+ { pos = Position(3655, 1131, 15), text = "Desistir", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
35+
36+ { pos = Position(3744, 970, 15), text = "Versus", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
37+ { pos = Position(3791, 970, 15), text = "Arena", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
38+ { pos = Position(3744, 1017, 15), text = "Castle War", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
39+ { pos = Position(3791, 1017, 15), text = "Battleroyal", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
40+ { pos = Position(3744, 1064, 15), text = "Warzone", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
41+
42+ { pos = Position(4073, 1227, 05), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
43+ { pos = Position(4073, 1227, 06), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
44+ { pos = Position(4073, 1227, 07), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
45+ { pos = Position(3744, 963, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
46+ { pos = Position(3744, 977, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
47+ { pos = Position(3791, 963, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
48+ { pos = Position(3791, 977, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
49+ { pos = Position(3744, 1010, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
50+ { pos = Position(3744, 1024, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
51+ { pos = Position(3791, 1010, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
52+ { pos = Position(3791, 1024, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
53+ { pos = Position(3744, 1057, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
54+ { pos = Position(3744, 1071, 15), text = "Sair", effects = { CONST_ME_MAGIC_GREEN, CONST_ME_MAGIC_GREEN } },
55+ }
56+}
57+
58+function onThink(interval)
59+ local player = Game.getPlayers()[1]
60+ if not player then
61+ return true
62+ end
63+
64+ for k, info in pairs(config.texts) do
65+ player:say(info.text, TALKTYPE_MONSTER_SAY, false, nil, info.pos)
66+ info.pos:sendMagicEffect(info.effects[math.random(1, #info.effects)])
67+ end
68+ return true
69+end
A data/globalevents/scripts/warzone.lua +326-0 View file
@@ -0,0 +1,326 @@
1+local condition = Condition(CONDITION_OUTFIT)
2+local SPEED_MOUNT = 150
3+local function onCronometroTime()
4+ if Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_START_WARZONE) == 01 then
5+ if _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] == 0 and _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] == 0 then
6+ local WINNER_ID = 0
7+ local players = Game.getPlayers()
8+
9+ if Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_BLUE_TEAM) > Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_RED_TEAM) then
10+ Game.broadcastMessage("[ WARZONE ]\nVIT�RIA DO TIME AZUL (" ..Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_BLUE_TEAM).. " vs " ..Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_RED_TEAM).. ").")
11+ WINNER_ID = 01
12+ elseif Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_RED_TEAM) > Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_BLUE_TEAM) then
13+ Game.broadcastMessage("[ WARZONE ]\nVIT�RIA DO TIME VERMELHO (" ..Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_RED_TEAM).. " vs " ..Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_BLUE_TEAM).. ").")
14+ WINNER_ID = 02
15+ else
16+ Game.broadcastMessage("[ WARZONE ]\nEMPATE T�CNICO.")
17+ WINNER_ID = 03
18+ end
19+
20+ db.query("DELETE FROM `player_storage` WHERE `player_storage`.`key` = " .._GLOBAL_RANDOM.WARZONE.EXP_STORAGE.. ";")
21+ for _, targetPlayer in ipairs(players) do
22+ if targetPlayer:getStorageValue(_SYSTEM.WARZONE) > 00 then
23+ local DELIVERY_POINTS = 0
24+ -- DESAFIO
25+ if targetPlayer:getStorageValue(_DESAFIOS[00].DESAFIO_ID) > 00 then
26+ onPlayerDesafios(targetPlayer, 74, 01)
27+ end
28+ if WINNER_ID == 03 then
29+ DELIVERY_POINTS = _GLOBAL_RANDOM.WARZONE.EMPATE_POINTS
30+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) == 09 then
31+ DELIVERY_POINTS = _GLOBAL_RANDOM.WARZONE.EMPATE_POINTS * 02
32+ end
33+ if targetPlayer:getStorageValue(_SYSTEM.PVP_POINTS) < 00 then
34+ targetPlayer:setStorageValue(_SYSTEM.PVP_POINTS, ((targetPlayer:getStorageValue(_SYSTEM.PVP_POINTS) + DELIVERY_POINTS) + 01))
35+ else
36+ targetPlayer:setStorageValue(_SYSTEM.PVP_POINTS, (targetPlayer:getStorageValue(_SYSTEM.PVP_POINTS) + DELIVERY_POINTS))
37+ end
38+
39+ targetPlayer:sendTextMessage(MESSAGE_EVENT_ORANGE, "Voc� recebeu " ..DELIVERY_POINTS.. " por sua participa��o na Warzone.")
40+ targetPlayer:sendCancelMessage("@LootMSG 3219 05 00 " ..DELIVERY_POINTS)
41+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_01, nil)
42+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_02, nil)
43+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_03, nil)
44+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_04, nil)
45+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_05, nil)
46+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_06, nil)
47+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_07, nil)
48+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_08, nil)
49+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_09, nil)
50+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, nil)
51+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE, nil)
52+
53+ doInventario(targetPlayer, 00, 04, 00)
54+ doBackpack(targetPlayer, 11)
55+ targetPlayer:sendCancelMessage("@StarCliente")
56+ else
57+ if targetPlayer:getStorageValue(_SYSTEM.WARZONE) == WINNER_ID then
58+ DELIVERY_POINTS = _GLOBAL_RANDOM.WARZONE.WINNER_POINTS
59+ if Game.getStorageValue(_GLOBAL_RANDOM.EVENTOS_TABLE[00].EVENT_ID) == 09 then
60+ DELIVERY_POINTS = _GLOBAL_RANDOM.WARZONE.WINNER_POINTS * 02
61+ end
62+ if targetPlayer:getStorageValue(_SYSTEM.PVP_POINTS) < 00 then
63+ targetPlayer:setStorageValue(_SYSTEM.PVP_POINTS, ((targetPlayer:getStorageValue(_SYSTEM.PVP_POINTS) + DELIVERY_POINTS) + 01))
64+ else
65+ targetPlayer:setStorageValue(_SYSTEM.PVP_POINTS, (targetPlayer:getStorageValue(_SYSTEM.PVP_POINTS) + DELIVERY_POINTS))
66+ end
67+
68+ targetPlayer:sendCancelMessage("@LootMSG 3219 05 00 " ..DELIVERY_POINTS)
69+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_01, nil)
70+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_02, nil)
71+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_03, nil)
72+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_04, nil)
73+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_05, nil)
74+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_06, nil)
75+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_07, nil)
76+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_08, nil)
77+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_09, nil)
78+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, nil)
79+
80+ if targetPlayer:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) < 00 then
81+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE, 01)
82+ else
83+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE, (targetPlayer:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) + 01))
84+ end
85+
86+ targetPlayer:sendTextMessage(MESSAGE_EVENT_ORANGE, "Voc� recebeu " ..DELIVERY_POINTS.. " de PVP Points por sua participa��o na Warzone.")
87+ targetPlayer:sendTextMessage(MESSAGE_STATUS_WARNING, "Seu b�nus de EXP total da Warzone �: [ " ..(targetPlayer:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) * 05).. "% ].")
88+ doInventario(targetPlayer, 00, 04, 00)
89+ doBackpack(targetPlayer, 11)
90+ targetPlayer:sendCancelMessage("@StarCliente")
91+ else
92+ targetPlayer:sendTextMessage(MESSAGE_EVENT_ORANGE, "Seu time perdeu na Warzone. N�o h� recompensa.")
93+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_01, nil)
94+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_02, nil)
95+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_03, nil)
96+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_04, nil)
97+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_05, nil)
98+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_06, nil)
99+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_07, nil)
100+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_08, nil)
101+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_09, nil)
102+ targetPlayer:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, nil)
103+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE, nil)
104+
105+ doInventario(targetPlayer, 00, 04, 00)
106+ targetPlayer:sendCancelMessage("@StarCliente")
107+ end
108+ end
109+
110+ addEvent(function()
111+ if targetPlayer:getStorageValue(_QUESTLOG[163].UID_01) == 01 then
112+ targetPlayer:setStorageValue(_QUESTLOG[163].UID_01, 100)
113+
114+ PlayerGoldCoins(targetPlayer, 02, 3500)
115+ targetPlayer:addExperience(35000, true, true)
116+ targetPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Seu Quest Log foi atualizado.")
117+ end
118+ targetPlayer:sendCancelMessage("@TutorShow 44")
119+ end, 3000)
120+ targetPlayer:sendCancelMessage("@TutorShow 44")
121+ targetPlayer:setTown(Town(01))
122+ targetPlayer:removeCondition(CONDITION_OUTFIT)
123+ targetPlayer:changeSpeed(targetPlayer:getBaseSpeed())
124+ targetPlayer:setMaxHealth((targetPlayer:getLevel() * 10) + 140)
125+ targetPlayer:sendCancelMessage("@NoTeleport 00")
126+ targetPlayer:setStorageValue(_SYSTEM.WARZONE, nil)
127+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.WARZONE.LOBBY_TIMER, nil)
128+ targetPlayer:teleportTo({x=3999, y=991, z=7})
129+ targetPlayer:getPosition():sendMagicEffect(11)
130+ else
131+ if targetPlayer:getStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE) > 00 then
132+ targetPlayer:sendTextMessage(MESSAGE_STATUS_WARNING, "Seu b�nus de EXP da Warzone foi encerrado por n�o ter participado do evento.")
133+ end
134+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.WARZONE.EXP_STORAGE, nil)
135+ end
136+
137+ targetPlayer:sendCancelMessage("@EndAlert 01")
138+ end
139+
140+ Game.broadcastMessage("A Warzone foi finalizada.")
141+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_START_WARZONE, nil)
142+ return false
143+ elseif _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] > 0 and _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] > 0 then
144+ _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] = _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] - 1
145+ elseif _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] > 0 and _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] == 0 then
146+ _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] = 59
147+ _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] = _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] - 1
148+ elseif _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] == 0 and _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] > 0 then
149+ _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] = _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] - 1
150+ end
151+
152+ if _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] == 20 and _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] == 59 then
153+ local players = Game.getPlayers()
154+ for _, targetPlayer in ipairs(players) do
155+ if targetPlayer:getLevel() >= _GLOBAL_RANDOM.WARZONE.LEVEL then
156+ if targetPlayer:getStorageValue(_SYSTEM.WARZONE) < 01 then
157+ targetPlayer:sendCancelMessage("@EndAlert 02")
158+ end
159+ if targetPlayer:getStorageValue(_SYSTEM.WARZONE) > 00 then
160+ targetPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A Warzone come�ar� em 01 minuto.\n� necess�rio ter 04 jogadores ou mais para iniciar o evento.")
161+ end
162+ end
163+ end
164+ end
165+ if _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] == 19 and _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] == 59 then
166+ if Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_COUNT_PLAYER) < 04 then
167+ local players = Game.getPlayers()
168+ for _, targetPlayer in ipairs(players) do
169+ if targetPlayer:getLevel() >= _GLOBAL_RANDOM.WARZONE.LEVEL then
170+ if targetPlayer:getStorageValue(_SYSTEM.WARZONE) > 00 then
171+ targetPlayer:setTown(Town(01))
172+ targetPlayer:removeCondition(CONDITION_OUTFIT)
173+ targetPlayer:changeSpeed(targetPlayer:getBaseSpeed())
174+ targetPlayer:setMaxHealth((targetPlayer:getLevel() * 10) + 140)
175+ targetPlayer:sendCancelMessage("@NoTeleport 00")
176+ targetPlayer:setStorageValue(_SYSTEM.WARZONE, nil)
177+ targetPlayer:setStorageValue(_GLOBAL_RANDOM.WARZONE.LOBBY_TIMER, nil)
178+ targetPlayer:teleportTo({x=3999, y=991, z=7})
179+ targetPlayer:getPosition():sendMagicEffect(11)
180+ targetPlayer:sendCancelMessage("@EndAlert 01")
181+ targetPlayer:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A Warzone foi cancelada por falta de jogadores.")
182+ end
183+ end
184+ end
185+
186+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_START_WARZONE, nil)
187+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_COUNT_PLAYER, 00)
188+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_BLUE_TEAM, 00)
189+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_RED_TEAM, 00)
190+ _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] = _GLOBAL_RANDOM.WARZONE.TIMER[01]
191+ _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] = _GLOBAL_RANDOM.WARZONE.TIMER[02]
192+ return true
193+ else
194+ local players = Game.getPlayers()
195+ local lobPlayers = {}
196+ for _, targetPlayer in ipairs(players) do
197+ if targetPlayer:getLevel() >= _GLOBAL_RANDOM.WARZONE.LEVEL then
198+ if targetPlayer:getStorageValue(_SYSTEM.WARZONE) > 00 then
199+ table.insert(lobPlayers, targetPlayer:getLevel())
200+ end
201+ end
202+ end
203+
204+ table.sort(lobPlayers, function(a, b) return a > b end)
205+ if #lobPlayers > 01 then
206+ for X = 01, #lobPlayers do
207+ for _, tid in ipairs(players) do
208+ if tid:getLevel() >= _GLOBAL_RANDOM.WARZONE.LEVEL then
209+ if tid:getStorageValue(_SYSTEM.WARZONE) > 00 then
210+ if tid:getLevel() == lobPlayers[X] then
211+ local BLUE_PARTY = Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_BLUE_PLAYER)
212+ local RED_PARTY = Game.getStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_RED_PLAYER)
213+ if BLUE_PARTY == nil or BLUE_PARTY < 00 then
214+ BLUE_PARTY = 00
215+ end
216+ if RED_PARTY == nil or RED_PARTY < 00 then
217+ RED_PARTY = 00
218+ end
219+ if RED_PARTY > BLUE_PARTY then
220+ print("[" ..tid:getLevel().. "] NAME: " ..tid:getName().. " (BLUE)")
221+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_BLUE_PLAYER, (BLUE_PARTY + 01))
222+ tid:teleportTo(_GLOBAL_RANDOM.WARZONE.POS_BLUE_TIME)
223+ tid:getPosition():sendMagicEffect(11)
224+ tid:setStorageValue(_SYSTEM.WARZONE, 01)
225+ tid:setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_BLUE_PLAYER, 01)
226+ tid:changeSpeed(SPEED_MOUNT)
227+ _GLOBAL_RANDOM.WARZONE.TIME_SIDE = 01
228+
229+ condition:setOutfit({lookType = tid:getOutfit().lookType, lookHead = 86, lookBody = 86, lookLegs = 86, lookFeet = 86, lookTypeEx = 0, lookAddons = tid:getOutfit().lookAddons})
230+ condition:setTicks(-1)
231+ tid:addCondition(condition)
232+
233+ elseif BLUE_PARTY > RED_PARTY then
234+ print("[" ..tid:getLevel().. "] NAME: " ..tid:getName().. " (RED)")
235+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_RED_PLAYER, (RED_PARTY + 01))
236+ tid:teleportTo(_GLOBAL_RANDOM.WARZONE.POS_RED_TIME)
237+ tid:getPosition():sendMagicEffect(11)
238+ tid:setStorageValue(_SYSTEM.WARZONE, 02)
239+ tid:setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_RED_PLAYER, 01)
240+ tid:changeSpeed(SPEED_MOUNT)
241+ _GLOBAL_RANDOM.WARZONE.TIME_SIDE = 02
242+
243+ condition:setOutfit({lookType = tid:getOutfit().lookType, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = tid:getOutfit().lookAddons})
244+ condition:setTicks(-1)
245+ tid:addCondition(condition)
246+ else
247+ if _GLOBAL_RANDOM.WARZONE.TIME_SIDE == 01 then
248+ print("[" ..tid:getLevel().. "] NAME: " ..tid:getName().. " (BLUE)")
249+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_BLUE_PLAYER, (BLUE_PARTY + 01))
250+ tid:teleportTo(_GLOBAL_RANDOM.WARZONE.POS_BLUE_TIME)
251+ tid:getPosition():sendMagicEffect(11)
252+ tid:setStorageValue(_SYSTEM.WARZONE, 01)
253+ tid:setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_BLUE_PLAYER, 01)
254+ tid:changeSpeed(SPEED_MOUNT)
255+ _GLOBAL_RANDOM.WARZONE.TIME_SIDE = 02
256+
257+ condition:setOutfit({lookType = tid:getOutfit().lookType, lookHead = 86, lookBody = 86, lookLegs = 86, lookFeet = 86, lookTypeEx = 0, lookAddons = tid:getOutfit().lookAddons})
258+ condition:setTicks(-1)
259+ tid:addCondition(condition)
260+ else
261+ print("[" ..tid:getLevel().. "] NAME: " ..tid:getName().. " (RED)")
262+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_RED_PLAYER, (RED_PARTY + 01))
263+ tid:teleportTo(_GLOBAL_RANDOM.WARZONE.POS_RED_TIME)
264+ tid:getPosition():sendMagicEffect(11)
265+ tid:setStorageValue(_SYSTEM.WARZONE, 02)
266+ tid:setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_RED_PLAYER, 01)
267+ tid:changeSpeed(SPEED_MOUNT)
268+ _GLOBAL_RANDOM.WARZONE.TIME_SIDE = 01
269+
270+ condition:setOutfit({lookType = tid:getOutfit().lookType, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94, lookTypeEx = 0, lookAddons = tid:getOutfit().lookAddons})
271+ condition:setTicks(-1)
272+ tid:addCondition(condition)
273+ end
274+ end
275+ end
276+ end
277+ end
278+ end
279+ end
280+ else
281+ print("Fim da Warzone")
282+ return true
283+ end
284+ end
285+ end
286+ addEvent(onCronometroTime, 1000)
287+ end
288+end
289+local function StartedWarzone()
290+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_START_WARZONE, 01)
291+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.STORAGE_COUNT_PLAYER, 00)
292+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_BLUE_TEAM, 00)
293+ Game.setStorageValue(_GLOBAL_RANDOM.WARZONE.PLACAR_RED_TEAM, 00)
294+ _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[01] = _GLOBAL_RANDOM.WARZONE.TIMER[01]
295+ _GLOBAL_RANDOM.WARZONE.LEFT_TIMER[02] = _GLOBAL_RANDOM.WARZONE.TIMER[02]
296+
297+ local players = Game.getPlayers()
298+ for _, targetPlayer in ipairs(players) do
299+ if targetPlayer:getLevel() >= _GLOBAL_RANDOM.WARZONE.LEVEL then
300+ targetPlayer:sendCancelMessage("@WarzoneStart 00")
301+ end
302+ end
303+
304+ addEvent(onCronometroTime, 1000)
305+ return false
306+end
307+local function WarzoneWarning(time)
308+ local remaningTime = tonumber(time) - 60000
309+ Game.broadcastMessage("A Warzone come�ar� em 0" .. (remaningTime/60000) .." minutos", MESSAGE_STATUS_WARNING)
310+
311+ if remaningTime > 60000 then
312+ addEvent(WarzoneWarning, 60000, remaningTime)
313+ else
314+ Game.broadcastMessage("A Warzone come�ar� em menos de 01 minuto.")
315+ addEvent(StartedWarzone, 60000)
316+ end
317+end
318+function onTime(interval)
319+ local remaningTime = configManager.getNumber(configKeys.SERVER_SAVE_NOTIFY_DURATION) * 60000
320+ if configManager.getBoolean(configKeys.SERVER_SAVE_NOTIFY_MESSAGE) then
321+ Game.broadcastMessage("A Warzone come�ar� em 0" .. (remaningTime/60000) .." minutos.", MESSAGE_STATUS_WARNING)
322+ end
323+
324+ addEvent(WarzoneWarning, 60000, remaningTime)
325+ return true
326+end
A data/items/items.otb +0-0 View file
Binary file not shown.
Top