Advertisement
Guest User

retarded goth jerking off while crying

a guest
Dec 19th, 2016
1,105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.24 KB | None | 0 0
  1. local cfg = {
  2.     chance = 8,            -- chance that the player will succeed in getting the ore
  3.     skill = SKILL_AXE,      -- skill required to mine
  4.     skillStr = ' axe',      -- string for skill name | note: add a space before skill name
  5.     stage2Regen = 3 * 1000, -- 3 seconds
  6.     stage3Regen = 2 * 1000, -- 2 seconds
  7.     ores = {
  8.         {effect = CONST_ME_BLOCKHIT, ore = 5880, amount = {1, 3}, skillReq = 10, veins = {
  9.                 {id = 5709, lv = 50},
  10.                 {id = 5708, lv = 75},
  11.                 {id = 5707, lv = 100}
  12.             }
  13.         },
  14.         {effect = CONST_ME_BLOCKHIT, ore = 5880, amount = {1, 3}, skillReq = 10, veins = {
  15.                 {id = 5868, lv = 50},
  16.                 {id = 5866, lv = 75},
  17.                 {id = 5867, lv = 100}
  18.             }
  19.         },
  20.         {effect = CONST_ME_BLOCKHIT, ore = 5880, amount = {1, 3}, skillReq = 10, veins = {
  21.                 {id = 5750, lv = 50},
  22.                 {id = 5751, lv = 75},
  23.                 {id = 5752, lv = 100}
  24.             }
  25.         },
  26.         {effect = CONST_ME_BLOCKHIT, ore = 5880, amount = {1, 3}, skillReq = 10, veins = {
  27.                 {id = 5619, lv = 50},
  28.                 {id = 5620, lv = 75},
  29.                 {id = 5621, lv = 100}
  30.             }
  31.         },
  32.         {effect = CONST_ME_BLOCKHIT, ore = 5880, amount = {1, 3}, skillReq = 10, veins = {
  33.                 {id = 8633, lv = 50},
  34.                 {id = 8637, lv = 75}
  35.             }
  36.         },
  37.         {effect = CONST_ME_BLOCKHIT, ore = 5880, amount = {1, 3}, skillReq = 10, veins = {
  38.                 {id = 8634, lv = 50},
  39.                 {id = 8638, lv = 75}
  40.             }
  41.         },
  42.         {effect = CONST_ME_BLOCKHIT, ore = 5880, amount = {1, 3}, skillReq = 10, veins = {
  43.                 {id = 8635, lv = 50},
  44.                 {id = 8639, lv = 75}
  45.             }
  46.         },
  47.         {effect = CONST_ME_BLOCKHIT, ore = 5880, amount = {1, 3}, skillReq = 10, veins = {
  48.                 {id = 8636, lv = 50},
  49.                 {id = 8640, lv = 75}
  50.             }
  51.         }
  52.     }
  53. }
  54.  
  55. local function isInTable(value)
  56.     for i = 1, #cfg.ores do
  57.         for j = 1, #cfg.ores[i].veins do
  58.             if cfg.ores[i].veins[j].id == value then
  59.                 return i, j -- Return ore row and vein index
  60.             end
  61.         end
  62.     end
  63.     return false
  64. end
  65.  
  66. local regenerating = {}
  67.  
  68. local function regenVein(pos, id, row, index)
  69.     local item = Tile(pos):getItemById(id)
  70.     if not item then
  71.         return false
  72.     end
  73.     local currVein = cfg.ores[row].veins
  74.     local transformId = currVein[index].id
  75.     item:transform(transformId)
  76.     if currVein[index-1] and currVein[index-1].id then
  77.         regenerating[pos] = addEvent(regenVein, cfg.stage3Regen, pos, transformId, row, index-1)
  78.     end
  79. end
  80.  
  81.  
  82. function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  83.     local row, vein = isInTable(target:getId())
  84.     if (row and vein) then
  85.         local playerPos = player:getPosition()
  86.         local currOre = cfg.ores[row]
  87.         local currVein = currOre.veins[vein]
  88.         local skillLevel = player:getSkillLevel(cfg.skill)
  89.  
  90.         -- Check player skill level
  91.         if not (skillLevel >= currOre.skillReq) then
  92.             player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You must have '.. currOre.skillReq .. cfg.skillStr ..' before you may mine.')
  93.             return true
  94.         end
  95.          
  96.         -- Check player level
  97.         if not (player:getLevel() >= currVein.lv) then
  98.             player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You must have '.. cfg.level ..' level before you may mine.')
  99.             return true
  100.         end
  101.  
  102.         -- If the vein is at the last stage, tell the player to wait
  103.         if #currOre.veins == vein then
  104.             player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You must wait for this vein to regen.')
  105.             playerPos:sendMagicEffect(CONST_ME_POFF)
  106.             return true
  107.         end
  108.  
  109.         -- Stop current regeneration process (since the player hit the rock again)
  110.         if regenerating[toPosition] then
  111.             stopEvent(regenerating[toPosition])
  112.         end
  113.  
  114.         -- If chance is correct, add the item to the player and start regeneration process
  115.         if math.random(100) <= (cfg.chance + skillLevel/2) then
  116.             local nextId = currOre.veins[vein+1].id
  117.             local it = player:addItem(currOre.ore, math.random(currOre.amount[1], currOre.amount[2]))
  118.             local count = it:getCount()
  119.             local name = count > 1 and it:getPluralName() or it:getName()
  120.             player:sendTextMessage(MESSAGE_STATUS_SMALL, 'You have mined '.. count .. ' '.. name)
  121.             player:addSkillTries(cfg.skill, math.random(3000, 5000) / skillLevel)
  122.             toPosition:sendMagicEffect(currOre.effect)
  123.             regenerating[toPosition] = addEvent(regenVein, (vein == 2) and cfg.stage2Regen or cfg.stage3Regen, toPosition, nextId, row, vein)
  124.             target:transform(nextId)
  125.         else
  126.             playerPos:sendMagicEffect(CONST_ME_POFF)
  127.         end
  128.  
  129.     end
  130.     return true
  131. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement