Advertisement
Kaiquegabriel

Untitled

Jul 15th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.37 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <mod name="Arena Svargrond"
  3.  
  4. version="1.0" author="Tommy" contact="tommycrusher@gmail.com" enabled="yes">
  5.  
  6. <config name="arenaFunctions"><![CDATA[
  7. KickPosition = {x=32312, y=31148, z=7} --if the player leave the arena or time is over, where he go.
  8. RewardsRoom = {x=32312, y=31134, z=6} --rewards room position.
  9. arenaRoomMaxTime = 240 --max time for each room 240 = 4 min.
  10. OpenDoorsID = 5125 --if you change doors item ids, change me =D
  11.  
  12.  
  13. TimeStor = 42350 --here will be saved the time.
  14. myArenaLevel = 45450 --here will be saved the arena level.
  15. talkNPC = 45451 --Storage to check if the player have paid to the npc and can enter to the arena.
  16. RewardsStor = {42361, 42371, 42381} --Storage for greenshore, scrapper, warlord.
  17. isIN = 42352 --to check if the player is in the arena.
  18. myRoom = 46000 --here will be saved the current room.
  19. MonStor = 47000 --here will be saved the monster uid.
  20.  
  21.  
  22. DoorsActID = 42357 --Doors near the npc.
  23. LeavePortals = 42321 --The action id of the portal to leave the rooms (south portals).
  24. GobletTiles = {42360, 42370, 42380} --Action ids of the tiles for Bronze, Silver and Gold Goblets.
  25.  
  26. Cancel = {
  27. --message when use door and have not paid to the npc.
  28. [1] = "You have not paid NPC yet.",
  29. --message when leave arena.
  30. [2] = "You have been kicked!",
  31. --message when the player can't get the reward.
  32. [3] = "You can\'t get this item",
  33. --message when already got any reward.
  34. [4] = "It is empty.",
  35. --when try to open a reward door and haven't completed the level.
  36. [5] = "You have not finished this arena level.",
  37. --NPC answer if the player completed all arena levels.
  38. [6] = "You already did all the arena levels.",
  39. --message when time is over
  40. [7] = "The time is over.",
  41. --message when you can go to the next room, LoL >_> this is not a cancel btw.
  42. [8] = "You can go to the next room.",
  43. --when try to go to the next room and not killed the monster yet.
  44. [9] = "Kill the monster first",
  45. --when try to go to the next room but there is a player yet...this text will be PLAYERNAME + this text
  46. [10] = "is in the room yet."
  47. }
  48.  
  49. Completed = {
  50. [1] = "Congatulations! you have completed the arena in",
  51. --HERE WILL BE THE ARENA NAME.
  52. [2] = "difficulty! Now go and take your reward."}
  53. --then the message will be "Congatulations! you have completed the arena in greenshore/scrapper/warlord difficulty! Now go and take your reward."
  54.  
  55.  
  56. Arena = {
  57. --greenshore
  58. [0] = {
  59. Cost = 10000,
  60. LevelName = 'greenshore',
  61. LevelNeeded = 30,
  62. Goblet = 5807
  63. },
  64. --scrapper
  65. [1] = {
  66. Cost = 50000,
  67. LevelName = 'scrapper',
  68. LevelNeeded = 50,
  69. Goblet = 5806
  70. },
  71. --warlord
  72. [2] = {
  73. Cost = 100000,
  74. LevelName = 'warlord',
  75. LevelNeeded = 80,
  76. Goblet = 5805
  77. }
  78. }
  79.  
  80.  
  81. Rewards = {
  82. --greenshore
  83. --present with items.
  84. [42361] = {
  85. Stor = RewardsStor[1],
  86. Cont = 1990,
  87. items = {7372, 6569, 6574, 2114},
  88. count = {1, 10, 1, 1}
  89. },
  90. --blacksteel sword.
  91. [42362] = {
  92. Stor = RewardsStor[1],
  93. Cont = nil,
  94. item = 7406
  95. },
  96. --headchopper.
  97. [42363] = {
  98. Stor = RewardsStor[1],
  99. Cont = nil,
  100. item = 7380
  101. },
  102. --orcish maul.
  103. [42364] = {
  104. Stor = RewardsStor[1],
  105. Cont = nil,
  106. item = 7392
  107. },
  108. --backpack with items.
  109. [42365] = {
  110. Stor = RewardsStor[1],
  111. Cont = 7342,
  112. items = {7365, 7364},
  113. count = {100, 100}
  114. },
  115. --scrapper
  116. --present with items.
  117. [42371] = {
  118. Stor = RewardsStor[2],
  119. Cont = 1990,
  120. items = {7372, 6569, 6574, 7183},
  121. count = {1, 10, 1, 1}
  122. },
  123. --mystic blade.
  124. [42372] = {
  125. Stor = RewardsStor[2],
  126. Cont = nil,
  127. item = 7384
  128. },
  129. --heroic axe.
  130. [42373] = {
  131. Stor = RewardsStor[2],
  132. Cont = nil,
  133. item = 7389
  134. },
  135. --cranial basher
  136. [42374] = {
  137. Stor = RewardsStor[2],
  138. Cont = nil,
  139. item = 7415
  140. },
  141. --backpack with items.
  142. [42375] = {
  143. Stor = RewardsStor[2],
  144. Cont = 7342,
  145. items = {7365, 2547, 2547, 2311, 2304},
  146. count = {100, 100, 100, 50, 50}
  147. },
  148. --warlord
  149. --present with items.
  150. [42381] = {
  151. Stor = RewardsStor[3],
  152. Cont = 1990,
  153. items = {7372, 6569, 6574, 6568},
  154. count = {1, 10, 1, 1}
  155. },
  156. --justice seeker
  157. [42382] = {
  158. Stor = RewardsStor[3],
  159. Cont = nil,
  160. item = 7390
  161. },
  162. --royal axe.
  163. [42383] = {
  164. Stor = RewardsStor[3],
  165. Cont = nil,
  166. item = 7434
  167. },
  168. --blessed sceptre.
  169. [42384] = {
  170. Stor = RewardsStor[3],
  171. Cont = nil,
  172. item = 7429
  173. },
  174. --backpack with items.
  175. [42385] = {
  176. Stor = RewardsStor[3],
  177. Cont = 7342,
  178. items = {2273, 2268, 7443, 7440, 6529},
  179. count = {50, 50, 1, 1, 100}
  180. }
  181. }
  182.  
  183. arena_monsters = {
  184. --greenshore -scrapper --warlord
  185. [45300] = "Frostfur", [45310] = "Avalanche", [45320] = "Webster",
  186. [45301] = "Bloodpaw", [45311] = "Kreebosh the Exile", [45321] = "Darakan the Executioner",
  187. [45302] = "Bovinus", [45312] = "The Dark Dancer", [45322] = "Norgle Glacierbeard",
  188. [45303] = "Achad", [45313] = "The Hag", [45323] = "The Pit Lord",
  189. [45304] = "Colerian The Barbarian", [45314] = "Slim", [45324] = "Svoren the Mad",
  190. [45305] = "The Hairy One", [45315] = "Grimgor Guteater", [45325] = "The Masked Marauder",
  191. [45306] = "Axeitus Headbanger", [45316] = "Drasilla", [45326] = "Gnorre Chyllson",
  192. [45307] = "Rocky", [45317] = "Spirit of Earth", [45327] = "Fallen Mooh'tah Master Ghar",
  193. [45308] = "Cursed Gladiator", [45318] = "Spirit of Water", [45328] = "Deathbringer",
  194. [45309] = "Orcus the Cruel", [45319] = "Spirit of Fire", [45329] = "The Obliverator"}
  195.  
  196. Checking = false
  197.  
  198. RoomsACT = {42301, 42302, 42303, 42304, 42305, 42306, 42307, 42308, 42309}
  199.  
  200. Goblets = {
  201. [42360] = {Id=Arena[0].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[0].LevelName.." difficulty."},
  202. [42370] = {Id=Arena[1].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[1].LevelName.." difficulty."},
  203. [42380] = {Id=Arena[2].Goblet, txt="It is given to the courageous victor of the barbarian arena "..Arena[2].LevelName.." difficulty."}}
  204.  
  205. RewardsDoors = {[42366] = 1, [42376] = 2, [42386] = 3}
  206.  
  207. ArenaAdding = {[0] = 3000, [1] = 3010, [2] = 3020}
  208.  
  209. function myArenaLevelIs(cid)
  210. Stor = getPlayerStorageValue(cid, myArenaLevel)
  211. if Stor == -1 then
  212. setPlayerStorageValue(cid, myArenaLevel, 0)
  213. Stor = 0
  214. elseif Stor == 3 then Stor = 2
  215. end
  216. return {
  217. RC = Arena[Stor].Cost,
  218. LN = Arena[Stor].LevelName,
  219. RLV = Arena[Stor].LevelNeeded,
  220. LV = getPlayerStorageValue(cid, myArenaLevel)
  221. }
  222. end
  223.  
  224. function getDirectionMove(cid, itempos)
  225. --function by Nahruto
  226. p = getCreaturePosition(cid)
  227. i = itempos
  228. if p.x > i.x then
  229. if p.y > i.y then
  230. ret = NORTHWEST
  231. elseif p.y < i.y then
  232. ret = SOUTHWEST
  233. else
  234. ret = WEST
  235. end
  236. elseif p.x < i.x then
  237. if p.y > i.y then
  238. ret = NORTHEAST
  239. elseif p.y < i.y then
  240. ret = SOUTHEAST
  241. else
  242. ret = EAST
  243. end
  244. else
  245. if p.y > i.y then
  246. ret = NORTH
  247. elseif p.y < i.y then
  248. ret = SOUTH
  249. else
  250. ret = nil
  251. end
  252. end
  253. return ret
  254. end
  255.  
  256. function LeaveArena(cid)
  257. for i = 45300, 45329 do
  258. setPlayerStorageValue(cid, i, 0)
  259. end
  260. if isCreature(getPlayerStorageValue(cid, MonStor)) == TRUE then
  261. doRemoveCreature(getPlayerStorageValue(cid, MonStor))
  262. end
  263. setGlobalStorageValue(getPlayerStorageValue(cid, myRoom), 0)
  264. doPlayerSendTextMessage(cid, 22, Cancel[2])
  265. doTeleportThing(cid, KickPosition, FALSE)
  266. setPlayerStorageValue(cid, TimeStor, 0)
  267. setPlayerStorageValue(cid, isIN, 0)
  268. end
  269.  
  270. function CheckRooms()
  271. addEvent(CheckRooms, 1000)
  272. for i = 42300, 42309 do
  273. local Player = getGlobalStorageValue(i)
  274. if isPlayer(Player) == TRUE then
  275. local PlayerTime = getPlayerStorageValue(Player, TimeStor)
  276. if PlayerTime <= os.time() then
  277. doTeleportThing(Player, KickPosition, FALSE)
  278. setPlayerStorageValue(Player, TimeStor, 0)
  279. setGlobalStorageValue(i, 0)
  280. doPlayerSendTextMessage(Player,21, Cancel[7])
  281. if isCreature(getPlayerStorageValue(Player, MonStor)) == TRUE then
  282. doRemoveCreature(getPlayerStorageValue(Player, MonStor))
  283. end
  284. elseif PlayerTime - 10 <= os.time() then
  285. doPlayerSendTextMessage(Player, MESSAGE_EVENT_DEFAULT, "you have "..PlayerTime - os.time().." seconds left.!")
  286. end
  287. else
  288. setGlobalStorageValue(i, 0)
  289. end
  290. end
  291. end
  292.  
  293. function getArenaMonsterIdByName(name)
  294. for i = 45300, 45329 do
  295. if tostring(arena_monsters[i]) == string.lower(tostring(name)) then
  296. return i
  297. end
  298. end
  299. return false
  300. end]]></config>
  301. <event type="login" name="arenaRegister" event="script"><![CDATA[
  302. domodlib('arenaFunctions')
  303. function onLogin(cid)
  304. registerCreatureEvent(cid, "PlayerArena")
  305. registerCreatureEvent(cid, "ArenaKill")
  306. return true
  307. end]]></event>
  308.  
  309. <event type="death" name="PlayerArena" event="script"><![CDATA[
  310. domodlib('arenaFunctions')
  311. function onDeath(cid, corpse, deathList)
  312. if getPlayerStorageValue(cid, isIN) == 1 then
  313. I = 0
  314. for i = 45300, 45329 do
  315. if getPlayerStorageValue(cid, i) == 1 then
  316. I = i
  317. end
  318. end
  319. GlobalStor = I - ArenaAdding[myArenaLevelIs(cid).LV]
  320. setGlobalStorageValue(GlobalStor, 0)
  321. setPlayerStorageValue(cid, isIN, 0)
  322. if isCreature(getPlayerStorageValue(cid, MonStor)) then
  323. doRemoveCreature(getPlayerStorageValue(cid, MonStor))
  324. end
  325. end
  326. return true
  327. end
  328. ]]></event>
  329.  
  330. <event type="kill" name="ArenaKill" event="script"><![CDATA[
  331. domodlib('arenaFunctions')
  332. function onKill(cid, target, lastHit)
  333. if getPlayerStorageValue(cid, isIN) == 1 then
  334. local Room = getArenaMonsterIdByName(getCreatureName(target))
  335. if Room ~= 0 then
  336. setPlayerStorageValue(cid, Room, 1)
  337. doPlayerSendTextMessage(cid, 22, Cancel[8])
  338. end
  339. end
  340. return true
  341. end]]></event>
  342.  
  343. <action fromaid="42357" toaid="42386" event="script"><![CDATA[
  344. domodlib('arenaFunctions')
  345. function onUse(cid, item, fromPosition, itemEx, toPosition)
  346. local myMove = getDirectionMove(cid, fromPosition)
  347.  
  348. if myMove == nil then
  349.  
  350. return FALSE
  351.  
  352. end
  353.  
  354. local Reward = Rewards[item.actionid]
  355.  
  356. if Reward then
  357.  
  358. if getPlayerStorageValue(cid, Reward.Stor) ~= 1 then
  359.  
  360. local reward = nil
  361.  
  362. if Reward.Cont ~= nil then
  363.  
  364. reward = doCreateItemEx(Reward.Cont, 1)
  365.  
  366. for i = 1, #Reward.items do
  367.  
  368. doAddContainerItem(reward, Reward.items[i], Reward.count[i])
  369.  
  370. end
  371.  
  372. else
  373.  
  374. reward = doCreateItemEx(Reward.item, 1)
  375.  
  376. end
  377.  
  378. if reward ~= nil then
  379.  
  380. if doPlayerAddItemEx(cid, reward, FALSE) == RETURNVALUE_NOERROR then
  381.  
  382. doPlayerSendTextMessage(cid, 22,'You have found a '..getItemNameById(getThing(reward).itemid)..'.')
  383.  
  384. setPlayerStorageValue(cid, Reward.Stor, 1)
  385.  
  386. else
  387.  
  388. doPlayerSendTextMessage(cid, 22, Cancel[3])
  389.  
  390. end
  391.  
  392. end
  393.  
  394. else
  395.  
  396. doPlayerSendTextMessage(cid, 22, Cancel[4])
  397.  
  398. end
  399.  
  400. elseif RewardsDoors[item.actionid] then
  401.  
  402. if myArenaLevelIs(cid).LV >= RewardsDoors[item.actionid] then
  403.  
  404. doTransformItem(item.uid, OpenDoorsID)
  405.  
  406. doMoveCreature(cid, myMove)
  407.  
  408. else
  409.  
  410. doPlayerSendTextMessage(cid, 22, Cancel[5])
  411.  
  412. end
  413.  
  414. elseif item.actionid == DoorsActID and getPlayerStorageValue(cid, talkNPC) == 1 then
  415.  
  416. doTransformItem(item.uid, OpenDoorsID)
  417.  
  418. doMoveCreature(cid, myMove)
  419.  
  420. else
  421.  
  422. doPlayerSendTextMessage(cid, 22, Cancel[1])
  423. end
  424.  
  425. return TRUE
  426.  
  427. end]]></action>
  428.  
  429. <movevent type="StepIn" fromaid="42300" toaid="42380" event="script"><![CDATA[
  430. domodlib('arenaFunctions')
  431. function onStepIn(cid, item, position, fromPosition)
  432. local ArenaRoom = item.actionid
  433.  
  434. if item.actionid == LeavePortals then
  435.  
  436. LeaveArena(cid)
  437.  
  438. elseif isInArray(GobletTiles, item.actionid) == TRUE then
  439.  
  440. local gobletPos = getThingPos(item.uid)
  441.  
  442. if getPlayerStorageValue(cid, item.actionid) ~= 1 then
  443.  
  444. setPlayerStorageValue(cid, item.actionid, 1)
  445.  
  446. local Goblet = doCreateItemEx(Goblets[item.actionid].Id, 1)
  447.  
  448. doItemSetAttribute(Goblet, "description", ""..Goblets[item.actionid].txt.."\nAwarded to "..getCreatureName(cid)..".")
  449.  
  450. gobletPos.y = gobletPos.y - 1
  451.  
  452. doTileAddItemEx(gobletPos, Goblet)
  453.  
  454. end
  455.  
  456. doTransformItem(item.uid, item.itemid - 1)
  457.  
  458. elseif isInArray(RoomsACT, ArenaRoom) == TRUE or ArenaRoom == 42300 then
  459.  
  460. if Checking == FALSE then Checking = TRUE CheckRooms() end
  461.  
  462. local myLevelArena = myArenaLevelIs(cid).LV
  463.  
  464. if ArenaAdding[myLevelArena] then
  465.  
  466. Mons = ArenaRoom + ArenaAdding[myLevelArena]
  467.  
  468. end
  469.  
  470. if getGlobalStorageValue(ArenaRoom) == 0 then
  471.  
  472. if isCreature(getPlayerStorageValue(cid, MonStor)) == FALSE then
  473.  
  474. if ArenaRoom == 42300 and getPlayerStorageValue(cid, talkNPC) == 1 then
  475.  
  476. setPlayerStorageValue(cid, talkNPC, 0)
  477.  
  478. setPlayerStorageValue(cid, isIN, 1)
  479.  
  480. P = 1
  481.  
  482. elseif ArenaRoom ~= 42300 and getPlayerStorageValue(cid, isIN) == 1 then
  483.  
  484. P = 1
  485.  
  486. else
  487.  
  488. P = nil
  489.  
  490. end
  491.  
  492. if P ~= nil then
  493.  
  494. local SpawnPos = getThingPos(ArenaRoom)
  495.  
  496. doTeleportThing(cid, SpawnPos, FALSE)
  497.  
  498. SpawnPos.x = SpawnPos.x - 1
  499.  
  500. SpawnPos.y = SpawnPos.y - 1
  501.  
  502. local Monster = doSummonCreature(arena_monsters[Mons], SpawnPos)
  503.  
  504. setGlobalStorageValue(ArenaRoom, cid)
  505.  
  506. setGlobalStorageValue(ArenaRoom - 1, 0)
  507.  
  508. setPlayerStorageValue(cid, TimeStor, os.time()+arenaRoomMaxTime)
  509.  
  510. setPlayerStorageValue(cid, MonStor, Monster)
  511.  
  512. setPlayerStorageValue(cid, myRoom, ArenaRoom)
  513.  
  514. else
  515.  
  516. LeaveArena(cid)
  517.  
  518. end
  519.  
  520. else
  521.  
  522. doTeleportThing(cid, fromPosition, TRUE)
  523.  
  524. doPlayerSendTextMessage(cid, 22, Cancel[9])
  525.  
  526. end
  527.  
  528. else
  529.  
  530. doTeleportThing(cid, fromPosition, TRUE)
  531.  
  532. doPlayerSendTextMessage(cid, 22, ""..getCreatureName(getGlobalStorageValue(cid, ArenaRoom)).." "..Cancel[10].."")
  533.  
  534. end
  535.  
  536. elseif ArenaRoom == 42310 then
  537.  
  538. if isCreature(getPlayerStorageValue(cid, MonStor)) == FALSE then
  539.  
  540. doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,""..Completed[1].." "..myArenaLevelIs(cid).LN.." "..Completed[2].."")
  541.  
  542. setPlayerStorageValue(cid, myArenaLevel, getPlayerStorageValue(cid, myArenaLevel) + 1)
  543.  
  544. setGlobalStorageValue(ArenaRoom - 1, 0)
  545.  
  546. setPlayerStorageValue(cid, TimeStor, 0)
  547.  
  548. setPlayerStorageValue(cid, isIN, 0)
  549.  
  550. doTeleportThing(cid, RewardsRoom, TRUE)
  551.  
  552. else
  553.  
  554. doTeleportThing(cid, fromPosition, TRUE)
  555.  
  556. doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_ORANGE,'Najpierw zabij potwora!')
  557.  
  558. end
  559.  
  560. end
  561.  
  562. return TRUE
  563.  
  564. end]]></movevent>
  565.  
  566. <movevent type="StepOut" fromaid="42357" toaid="42387" event="script"><![CDATA[
  567. domodlib('arenaFunctions')
  568. function onStepOut(cid, item, position, fromPosition)
  569.  
  570. if item.actionid == DoorsActID or RewardsDoors[item.actionid] then
  571.  
  572. doTransformItem(item.uid, item.itemid + 1)
  573.  
  574. elseif isInArray(GobletTiles, item.actionid) == TRUE then
  575.  
  576. doTransformItem(item.uid, item.itemid + 1)
  577. end
  578.  
  579. return TRUE
  580.  
  581. end]]></movevent>
  582.  
  583. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement