1local TABLE_SKILLS = {
2 01, 02, 03, 04, 05, 06, 07, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
3 21, 22, 23, 24, 25, 29, 30, 32, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45,
4 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 58, 59, 60, 61, 63, 65, 66, 68, 70,
5}
6function onModalWindow(player, modalWindowId, buttonId, choiceId)
7 local RANDOM_POS_WARZONE = {
8 [01] = {x=3944, y=1192, z=07};
9 [02] = {x=3948, y=1196, z=07};
10 [03] = {x=3941, y=1199, z=07};
11 [04] = {x=3935, y=1201, z=07};
12 [05] = {x=3953, y=1199, z=07};
13 [06] = {x=3960, y=1200, z=07};
14 [07] = {x=3945, y=1209, z=07};
15 [08] = {x=3938, y=1212, z=07};
16 [09] = {x=3932, y=1219, z=07};
17 [10] = {x=3934, y=1213, z=07};
18 [11] = {x=3956, y=1218, z=07};
19 [12] = {x=3946, y=1221, z=07};
20 [13] = {x=3944, y=1214, z=07};
21 [14] = {x=3938, y=1225, z=07};
22 [15] = {x=3932, y=1234, z=07};
23 [16] = {x=3941, y=1237, z=07};
24 [17] = {x=3948, y=1234, z=07};
25 [18] = {x=3960, y=1220, z=07};
26 }
27 if modalWindowId == 1000 then
28 if buttonId == 100 then
29 if player:getStorageValue(_SYSTEM.INVENTARIO[04].UID_01) > 0 then
30 if doBackpack(player, 00, 04, 00, 01) then
31 -- Removendo o item equipado
32
33
34 doBackpack(player, 00, 04, 00, 01) -- Organizo Backpack
35
36 player:sendCancelMessage("@RemoveItemInventario 04")
37 player:sendCancelMessage("@StarCliente")
38
39 else
40
41 return false
42 end
43 end
44
45 player:setStorageValue(_SYSTEM.WARZONE, 01)
46 player:setTown(Town(15))
47 player:teleportTo({x=4024, y=1193, z=07})
48 player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
49
50 player:setMaxHealth(3000)
51 player:addHealth(player:getMaxHealth())
52 player:sendCancelMessage("@NoTeleport 01")
53 end
54
55 elseif modalWindowId == 1001 then
56 if buttonId == 100 then
57 player:setStorageValue(_SYSTEM.WARZONE, nil)
58 player:setTown(Town(01))
59 player:teleportTo({x=3999, y=991, z=07})
60 player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
61
62 local lvl = player:getLevel()
63 player:setMaxHealth((lvl * 10) + 140)
64 player:addHealth(player:getMaxHealth())
65 player:sendCancelMessage("@NoTeleport 00")
66 end
67
68 elseif modalWindowId == 1002 then
69 local GUN_CATEGORY = {
70 [01] = {4024, 4030}; -- PISTOLAS
71 [02] = {4010, 4014}; -- RIFLES
72 [03] = {4040, 4049}; -- METRALHADORA
73 [04] = {4002, 4004}; -- ESPINGARDA
74 }
75 if buttonId == 100 then
76 local WEAPON_ID = math.random(GUN_CATEGORY[choiceId][01], GUN_CATEGORY[choiceId][02])
77 local WEAPON_RARE = math.random(03, 04)
78 local WEAPON_STAR = math.random(00, 03)
79 local SKILL_01 = 01
80 local SKILL_02 = 02
81 local SKILL_03 = 03
82 local TEMP_SKILLS = {}
83
84 if #TEMP_SKILLS > 0 then
85 for k in pairs (TEMP_SKILLS) do
86 TEMP_SKILLS [k] = nil
87 end
88 end
89 for S = 01, #TABLE_SKILLS do
90 table.insert(TEMP_SKILLS, TABLE_SKILLS[S])
91 end
92
93 local SkillSort1 = math.random(01, #TEMP_SKILLS)
94 SKILL_01 = TEMP_SKILLS[SkillSort1]
95 table.remove(TEMP_SKILLS, SkillSort1)
96
97 SkillSort2 = math.random(01, #TEMP_SKILLS)
98 SKILL_02 = TEMP_SKILLS[SkillSort2]
99 table.remove(TEMP_SKILLS, SkillSort2)
100
101 SkillSort3 = math.random(01, #TEMP_SKILLS)
102 SKILL_03 = TEMP_SKILLS[SkillSort3]
103 table.remove(TEMP_SKILLS, SkillSort3)
104
105 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_01, WEAPON_ID) -- ID
106 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_02, WEAPON_RARE) -- RARIDADE
107 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_03, WEAPON_STAR) -- STAR
108 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_04, SKILL_01) -- SKILL 01
109 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_05, SKILL_02) -- SKILL 02
110 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_06, SKILL_03) -- SKILL 03
111 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_07, math.random(00, 10)) -- LEVEL
112 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_08, 00)
113 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_09, 01) -- UNIQUE ITEM
114 player:setStorageValue(_SYSTEM.INVENTARIO[04].UID_10, 9999) -- AMMO
115 player:setStorageValue(_GLOBAL_RANDOM.WARZONE.LOBBY_TIMER, nil)
116 player:sendCancelMessage("@LootMSG " ..WEAPON_ID.. " " ..WEAPON_RARE.. " " ..WEAPON_STAR.. " 01")
117
118
119 player:setTown(Town(15))
120
121 player:teleportTo(RANDOM_POS_WARZONE[math.random(01, #RANDOM_POS_WARZONE)])
122 player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
123
124 player:sendCancelMessage("@StarCliente")
125 end
126
127 elseif modalWindowId == 1003 then
128 if buttonId == 100 then
129 player:teleportTo({x=3896, y=1769, z=06})
130 player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
131 player:sendCancelMessage("@NoTeleport 00")
132
133
134 player:setStorageValue(_SYSTEM.DANGEROUS[01][01].STORAGE, nil)
135 player:setStorageValue(_SYSTEM.FIRST_DEAD_TUTOR, nil)
136 player:setStorageValue(_SYSTEM.COLISEU[05], nil)
137 player:setStorageValue(_SYSTEM.COLISEU[06], nil)
138 player:setStorageValue(_SYSTEM.COLISEU[07], nil)
139 player:setStorageValue(_SYSTEM.COLISEU[08], nil)
140 local from = _GLOBAL_RANDOM.COLISEUM.ORDER[00][01].ARENA_X_POS
141 local to = _GLOBAL_RANDOM.COLISEUM.ORDER[00][01].ARENA_Y_POS
142 for A = from.x, to.x do
143 for B = from.y, to.y do
144 for C = from.z, to.z do
145 local tile = Tile(A, B, C)
146 local creature = tile:getTopCreature()
147 if creature and creature:isMonster() then
148 doRemoveCreature(creature:getId())
149 end
150 end
151 end
152 end
153 end
154 end
155end
156