Advertisement
Guest User

Untitled

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