Guest User

Untitled

a guest
May 6th, 2020
661
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.81 KB | None | 0 0
  1. if not Spoof then
  2.     Spoof = {
  3.         players = { }
  4.     }
  5. end
  6.  
  7. Spoof.trainerTeleportPosition = Position(997, 1004, 7)
  8. Spoof.blockedLookTypes = {159,160,226,194,253,254,255,264,874,900,909,929,956,1024,963,969,965,967,971,973,975,1297,1336,1392,1261,1295,1183,1217,1227,1258,1020,1050,1070,1103,1128,1147,1162,1174,1152,1256,1285,1415,1408,1400,1402,1404,873,899,908,931,955,957,1023,962,968,964,966,970,972,974,1021,1051,1094,1069,1102,1127,1146,1161,1173,1416,1407,1399,1401,1403}
  9.  
  10. local randomTimes = {
  11.     ["levelAdvance"] = {storage = 54839827, minMinutes = 20, maxMinutes = 30, maxLevel = 300, afterMaxMinPorcentage = 1},
  12.     ["exchangeOutfit"]  = {storage = 54839828, minMinutes = 240, maxMinutes = 380, chanceToGainAddon = 3},
  13.     ["fragAndDeath"] = {storage = 54839829, minMinutes = 480, maxMinutes = 1020, chance = 3},
  14.     ["newItem"] = {storage = 54839830, minMinutes = 86400, maxMinutes = 86400 * 2},
  15.     ["newQuest"] = {storage = 54839831, minMinutes = 6 * 3600, maxMinutes = 12 * 3600},
  16.     ["skillAdvance"] = {storage = 54839832, minMinutes = 30, maxMinutes = 80, maxSkill = 80, afterMaxMinPorcentage = 1}
  17. }
  18.  
  19. local itensTable = {
  20.     [1] = { -- MS
  21.         [{100, 120}] = {8820, 8819, 7730, 2643, 2190, 2175, 2175},
  22.         [{121, 181}] = {2323, 8871, 7730, 2195, 2187, 2175, 2175},
  23.         [{181, 220}] = {2323, 8871, 7730, 2195, 2187, 2514, 2175},
  24.         [{221, 300}] = {9778, 12643, 7730, 6132, 36101, 2514, 2175},
  25.         [{301, 999}] = {9778, 12643, 18400, 6132, 36101, 8918, 2175},
  26.     },
  27.     [2] = { -- ED
  28.         [{100, 120}] = {8820, 8819, 7730, 2643, 2182, 2175, 8266},
  29.         [{121, 181}] = {2323, 8871, 7730, 2195, 2183, 2175, 8266},
  30.         [{181, 220}] = {2323, 8871, 7730, 2195, 2183, 2514, 8266},
  31.         [{221, 300}] = {9778, 12643, 7730, 6132, 36101, 2514, 8266},
  32.         [{301, 999}] = {9778, 12643, 18400, 6132, 36101, 8918, 8266},
  33.     },
  34.     [3] = { -- RP
  35.         [{100, 120}] = {2480, 2660, 2478, 2195, 7368, 2525},
  36.         [{121, 181}] = {2480, 2660, 2478, 2195, 7368, 2525, 8266},
  37.         [{181, 220}] = {2493, 2660, 9777, 2514, 7368, 2514, 8266},
  38.         [{221, 999}] = {12645, 18404, 9777, 6132, 7368, 2514, 8266},
  39.     },
  40.     [4] = { -- EK
  41.         [{100, 120}] = {2460, 2465, 2478, 2195, 2525},
  42.         [{121, 181}] = {2460, 2465, 2478, 2195, 2525, 8266},
  43.         [{181, 220}] = {2493, 2465, 2478, 2195, 2514, 8266},
  44.         [{221, 999}] = {2493, 12642, 2478, 2195, 18410, 8266},
  45.     },
  46. }
  47.  
  48. local randomAddons = {
  49.     [1] = {male = 128, female = 136, name = 'Citizen Outfit'}, -- citizen
  50.     [2] = {male = 129, female = 137, name = 'Hunter addon'}, -- hunter
  51.     [3] = {male = 132, female = 140, name = 'Nobleman addon'}, -- Noblewoman
  52.     [4] = {male = 133, female = 138, name = 'Summoner addon'}, -- Summoner
  53.     [5] = {male = 134, female = 142, name = 'Warrior addon'}, -- Warrior
  54.     [6] = {male = 143, female = 147, name = 'Barbarian addon'}, -- Barbarian
  55.     [7] = {male = 144, female = 148, name = 'Druid addon'}, -- Druid
  56.     [8] = {male = 145, female = 149, name = 'Wizard addon'}, -- Wizard
  57.     [9] = {male = 146, female = 150, name = 'Oriental addon'}, -- Oriental
  58.     [10] = {male = 151, female = 155, name = 'Pirate addon'}, -- Pirate
  59.     [11] = {male = 153, female = 157, name = 'Beggar addon'}, -- Beggar
  60.     [12] = {male = 154, female = 158, name = 'Shaman addon'}, -- Shaman
  61.     [13] = {male = 251, female = 252, name = 'Norsewoman addon'}, -- Norsewoman
  62.     [14] = {male = 152, female = 156, name = 'Assassin addon'}, -- Assassin
  63.     [15] = {male = 335, female = 336, name = 'Warmaster addon'}, -- Warmaster
  64.     [16] = {male = 367, female = 366, name = 'Wayfarer addon'}, -- Wayfarer
  65.     [17] = {male = 463, female = 464, name = 'Deepling addon'}, -- Deepling
  66.     [18] = {male = 131, female = 139, name = 'Knight addon'} -- Knight Outfit
  67. }
  68.  
  69. function Spoof.onLoad(self)
  70.     local resultId = db.storeQuery("SELECT `name` FROM `players` WHERE `spoof` = 1")
  71.     if resultId then
  72.         repeat
  73.             local playerName = result.getString(resultId, "name")
  74.             if not self.players[playerName] then
  75.                 self.players[playerName] = 0
  76.             end
  77.         until not result.next(resultId)
  78.         result.free(resultId)
  79.     end
  80. end
  81.  
  82. function Spoof.isASpoofer(self, name)
  83.     return self.players[name]
  84. end
  85.  
  86. function Spoof.onLogin(self, player)
  87.     local playerName = player:getName()
  88.     if not self:isASpoofer(playerName) then
  89.         return
  90.     end
  91.  
  92.     player:teleportTo(self.trainerTeleportPosition)
  93.     self.players[playerName] = addEvent(function(self, playerId) self:executeAction(playerId) end, 60 * 1000, self, player:getId())
  94. end
  95.  
  96. function Spoof.getRandomOutfit(self, sex)
  97.     local resultId = db.storeQuery(string.format("SELECT `looktype`, `lookhead`, `lookbody`, `looklegs`, `lookfeet` FROM `players` WHERE `level` >= 200 AND `sex` = %d ORDER BY rand() LIMIT 1", sex))
  98.     local t = { lookType = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0 }
  99.     if resultId then
  100.         local lookType = result.getNumber(resultId, "looktype")
  101.         local lookHead = result.getNumber(resultId, "lookhead")
  102.         local lookBody = result.getNumber(resultId, "lookbody")
  103.         local lookLegs = result.getNumber(resultId, "looklegs")
  104.         local lookFeet = result.getNumber(resultId, "lookfeet")
  105.         result.free(resultId)
  106.  
  107.         t.lookType = lookType
  108.         t.lookHead = lookHead
  109.         t.lookBody = lookBody
  110.         t.lookLegs = lookLegs
  111.         t.lookFeet = lookFeet
  112.     end
  113.  
  114.     if isInArray(self.blockedLookTypes, t.lookType) then
  115.         local look = (sex == 0) and math.random(136, 142) or math.random(128, 134)
  116.  
  117.         t.lookType = look
  118.         if math.random(10) <= 6 then
  119.             local equalColor = math.random(100)
  120.             t.lookHead = equalColor
  121.             t.lookBody = equalColor
  122.             t.lookLegs = equalColor
  123.             t.lookFeet = equalColor
  124.         else
  125.             t.lookHead = math.random(100)
  126.             t.lookBody = math.random(100)
  127.             t.lookLegs = math.random(100)
  128.             t.lookFeet = math.random(100)
  129.         end
  130.     end
  131.  
  132.     return t
  133. end
  134.  
  135. function Spoof.executeAction(self, playerId)
  136.     -- Spoof:executeAction(player:getId())
  137.     local player = Player(playerId)
  138.     if not player then
  139.         return
  140.     end
  141.  
  142.     local action = randomTimes
  143.     local playerSex = player:getSex()
  144.     local playerGuid = player:getGuid()
  145.     local playerName = player:getName()
  146.  
  147.     -- Verifica se est� nos Trainers
  148.     if player:isInTrainers() then
  149.         -- Pega o tempo do Spoof para uma acao
  150.        
  151.         -- Dar Frags & mortes
  152.         local fragAndDeath = action["fragAndDeath"]
  153.         if (math.random(10) <= fragAndDeath.chance and player:getStorageValue(fragAndDeath.storage) > math.random(fragAndDeath.minMinutes, fragAndDeath.maxMinutes) * 60) and player:getLevel() > 250 then
  154.             if math.random(10) <= 4 then -- 40% de chance de ser para player a morte
  155.                 -- Player
  156.                 local allSpoofLoggeds = { }
  157.                 for tmpName, _ in pairs(self.players) do
  158.                     if tmpName ~= playerName then
  159.                         allSpoofLoggeds[#allSpoofLoggeds + 1] = tmpName
  160.                     end
  161.                 end
  162.  
  163.                 if next(allSpoofLoggeds) ~= nil then
  164.                     local randomAmount = math.random(2, 10)
  165.                     local participantsTable = { }
  166.                     for i = 1, randomAmount do
  167.                         local randomParticipant = allSpoofLoggeds[math.random(#allSpoofLoggeds)]
  168.                         if randomParticipant then
  169.                             participantsTable[#participantsTable + 1] = randomParticipant
  170.                         end
  171.                     end
  172.  
  173.                     local mostDamage = ''
  174.                     local killerName = ''
  175.                     local participants = ''
  176.  
  177.                     for index, participantName in ipairs(participantsTable) do
  178.                         -- O primeiro participante ter� dado o dano maior e n�o ser� inserido na database como participantes
  179.                         if index == 1 then
  180.                             mostDamage = participantName
  181.                         else
  182.                             -- O Index 2 vai dar o participante como o matador
  183.                             if index == 2 then
  184.                                 killerName = participantName
  185.                             end
  186.  
  187.                             local participantGuid = getPlayerGUIDByName(participantName)
  188.                             participants = string.format('%s%d', participants == '' and '' or participants .. ',', participantGuid)
  189.                             db.query(string.format('UPDATE `players` SET `frags` = `frags` + 1 WHERE `name` = %s', db.escapeString(participantName)))
  190.                         end
  191.                     end
  192.  
  193.                     db.query(string.format('UPDATE `players` SET `deaths` = `deaths` + 1 WHERE `name` = %s', db.escapeString(playerName)))
  194.  
  195.                     -- Se por acaso nao tenha um killerName e mostDamage tiver com nome de um player, vamos pegar ele.
  196.                     if killerName == '' and mostDamage ~= '' then
  197.                         killerName = mostDamage
  198.                     end
  199.  
  200.                     db.query(string.format('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `participants`) VALUES (%d, %d, %d, %s, %d, %s, %d, %d, %d, %s)', playerGuid, os.time(), player:getLevel(), db.escapeString(killerName), 1, db.escapeString(mostDamage), 1, 1, 1, db.escapeString(participants)))
  201.  
  202.                     local removeExperience = #participantsTable * 100000
  203.                     player:removeExperience(removeExperience)
  204.                 end
  205.             else -- 60% de chance de ser para monstro normal
  206.                 -- Monstro
  207.                 local resultId = db.storeQuery(string.format("SELECT `killed_by`, `mostdamage_by` FROM `player_deaths` WHERE `mostdamage_is_player` = 0 AND `player_id` != %d ORDER BY RAND() DESC LIMIT 1", playerGuid))
  208.                 if resultId then
  209.                     local killedBy = result.getString(resultId, "killed_by")
  210.                     local mostDamage = result.getString(resultId, "mostdamage_by")
  211.                     result.free(resultId)
  212.  
  213.                     -- Verifica se � VIP o monstro, se for, ent�o vai dar VIP para o Spoofer
  214.                     if (isInArray(VIP_MONSTERS, killedBy) or isInArray(VIP_MONSTERS, mostDamage)) and not player:isVip() then
  215.                         player:loadVipData()
  216.                         player:addVipDays(3)
  217.                         player:updateVipTime()
  218.                     end
  219.  
  220.                     local participants = ''
  221.                     db.query(string.format('INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `is_player`, `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`, `participants`) VALUES (%d, %d, %d, %s, %d, %s, %d, %d, %d, %s)', playerGuid, os.time(), player:getLevel(), db.escapeString(killedBy), 0, db.escapeString(mostDamage), 0, 0, 0, db.escapeString(participants)))
  222.  
  223.                     local removeExperience = (math.random(5, 10)) * 100000
  224.                     player:removeExperience(removeExperience)
  225.                 end
  226.  
  227.                 player:setStorageValue(fragAndDeath.storage, 0)
  228.             end
  229.         end
  230.  
  231.         -- Melhorar o Set
  232.         local newItem = action["newItem"]
  233.         if (player:getStorageValue(newItem.storage) > math.random(newItem.minMinutes, newItem.maxMinutes) * 60) then
  234.             if math.random(10) <= 3 then
  235.                 local itemListVocation = itensTable[player:getVocation():getBase():getId()]
  236.                 if itemListVocation then
  237.                     local itemList = nil
  238.                     for v, k in pairs(itemListVocation) do
  239.                         if 301 >= v[1] and 301 <= v[2] then
  240.                             itemList = k
  241.                             break
  242.                         end
  243.                     end
  244.  
  245.                     if itemList then
  246.                         local itemId = nil
  247.                         local slotItem = nil
  248.                         for i = 1, 100 do
  249.                             local randomItem = itemList[math.random(#itemList)]
  250.                             local itemType = ItemType(randomItem)
  251.                             if itemType then
  252.                                 local slot = itemType:getSlotPosition()
  253.  
  254.                                 local tmpSlotItem = SLOTS_CONST[slot]
  255.                                 local itemPlayerSlot = player:getSlotItem(tmpSlotItem)
  256.                                 if itemPlayerSlot then
  257.                                     if randomItem ~= itemPlayerSlot:getId() then
  258.                                         itemPlayerSlot:remove()
  259.                                         slotItem = tmpSlotItem
  260.                                         itemId = randomItem
  261.                                         break
  262.                                     end
  263.                                 else
  264.                                     slotItem = tmpSlotItem
  265.                                     itemId = itemType:getId()
  266.                                     break
  267.                                 end
  268.                             end
  269.                         end
  270.  
  271.                         -- Search for Weapons Avaliable
  272.                         if not player:getSlotItem(CONST_SLOT_LEFT) then
  273.                             for i = 1, 100 do
  274.                                 local randomItem = itemList[math.random(#itemList)]
  275.                                 local itemType = ItemType(randomItem)
  276.                                 if itemType then
  277.                                     local slot = itemType:getSlotPosition()
  278.                                     local tmpSlotItem = SLOTS_CONST[slot]
  279.                                     if slot == 48 and itemType:getWeaponType() ~= 4 then
  280.                                         player:addItem(randomItem, 1)
  281.                                         break
  282.                                     end
  283.                                 end
  284.                             end
  285.                         end
  286.  
  287.                         if itemId then
  288.                             local itemType = ItemType(itemId)
  289.                             if itemType then
  290.                                 player:addItem(itemId, 1, false, -1, slotItem)
  291.                             end
  292.                         end
  293.                     end
  294.                 end
  295.  
  296.                 -- Repara Soft Boots
  297.                 local feetSloot = player:getSlotItem(CONST_SLOT_FEET)
  298.                 if feetSloot then
  299.                     if feetSloot:getId() == 10021 then
  300.                         feetSloot:transform(2640)
  301.                     end
  302.                 end
  303.  
  304.                 player:save()
  305.             end
  306.         end
  307.  
  308.         local newQuest = action["newQuest"] -- TODO
  309.  
  310.         -- Avan�ar level
  311.         local advanceLevel = action["levelAdvance"]
  312.         if (player:getStorageValue(advanceLevel.storage) > math.random(advanceLevel.minMinutes, advanceLevel.maxMinutes) * 60) then
  313.             local experience = nil
  314.             if player:getLevel() >= advanceLevel.maxLevel then
  315.                 local randomChance = math.random(1, 2)
  316.                
  317.                 randomChance =  randomChance * 0.1
  318.                 experience = getExpForLevel(player:getLevel()) * randomChance
  319.                 print(experience)
  320.                 --player:addExperience(experience, false)
  321.             else
  322.                 experience = getExpForLevel(player:getLevel() + math.random(5)) - player:getExperience()
  323.                 player:addExperience(experience, false)
  324.             end
  325.  
  326.             ExperienceOnline_time:increaseExperience(player:getId(), experience)
  327.             player:setStorageValue(advanceLevel.storage, 0)
  328.         end
  329.  
  330.         -- Mudar Outfit
  331.         local exchangeOutfit = action["exchangeOutfit"]
  332.         if (player:getStorageValue(exchangeOutfit.storage) > math.random(exchangeOutfit.minMinutes, exchangeOutfit.maxMinutes) * 60) then
  333.             local getRandomOutfit = self:getRandomOutfit(playerSex)
  334.  
  335.             player:setOutfit({lookType = getRandomOutfit.lookType, lookHead = getRandomOutfit.lookHead, lookBody = getRandomOutfit.lookBody, lookLegs = getRandomOutfit.lookLegs, lookFeet = getRandomOutfit.lookFeet})
  336.  
  337.             if math.random(10) <= exchangeOutfit.chanceToGainAddon then
  338.                 local randomAddon = nil
  339.                 for i = 1, 100 do
  340.                     local randomOutfit = randomAddons[math.random(#randomAddons)]
  341.                     if randomOutfit then
  342.                         if not player:hasOutfit(playerSex == PLAYERSEX_FEMALE and randomOutfit.female or randomOutfit.male, 3) then
  343.                             randomAddon = randomOutfit
  344.                             break
  345.                         end
  346.                     end
  347.                 end
  348.  
  349.                 if randomAddon then
  350.                     player:addOutfitAddon(randomAddon.female, 3)
  351.                     player:addOutfitAddon(randomAddon.male, 3)
  352.                     player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
  353.                     local outfit = player:getOutfit()
  354.                     player:setOutfit({lookType = playerSex == PLAYERSEX_FEMALE and randomAddon.female or randomAddon.male, lookHead = outfit.lookHead, lookBody = outfit.lookBody, lookLegs = outfit.lookLegs, lookFeet = outfit.lookFeet, lookAddons = 3})
  355.                 end
  356.             end
  357.  
  358.             player:setStorageValue(exchangeOutfit.storage, 0)
  359.         end
  360.  
  361.         -- Aumentar Skill
  362.         local skillAdvance = action["skillAdvance"]
  363.         if (player:getStorageValue(skillAdvance.storage) > math.random(skillAdvance.minMinutes, skillAdvance.maxMinutes) * 60) then
  364.             if player:isKnight() or player:isPaladin() then
  365.                 local highestSkill = player:getHigherSkill(player)
  366.                 local getSkill = player:getSkillLevel(highestSkill)
  367.                 if getSkill >= skillAdvance.maxSkill then
  368.                     player:addSkillTries(highestSkill, player:getSkillLevel(highestSkill) + 1 * 0.1)
  369.                 else
  370.                     player:addSkillTries(highestSkill, player:getVocation():getRequiredSkillTries(highestSkill, player:getSkillLevel(highestSkill) + 1) - player:getSkillTries(highestSkill))
  371.                 end
  372.  
  373.                 -- Avan�o de Magic Level para Knights & Paladin
  374.                 local magicLevel = player:getMagicLevel()
  375.                 if player:isKnight() then
  376.                     local formula = math.random(2500, 5000) * (player:getVocation():getManaGainAmount() / player:getVocation():getManaGainTicks())
  377.                     if magicLevel >= 10 then
  378.                         formula = formula * (math.random(3) * 0.1)
  379.                     end
  380.  
  381.                     player:addManaSpent(formula)
  382.                 else
  383.                     local formula = math.random(3600, 10000) * (player:getVocation():getManaGainAmount() / player:getVocation():getManaGainTicks())
  384.                     if magicLevel >= 30 then
  385.                         formula = formula * (math.random(5) * 0.1)
  386.                     end
  387.  
  388.                     player:addManaSpent(formula)
  389.                 end
  390.             elseif player:isMage() then
  391.                 local playerGetSkill = player:getMagicLevel()
  392.                 if playerGetSkill >= skillAdvance.maxSkill then
  393.                     player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel()) + 1 * 0.1)
  394.                 else
  395.                     player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel()) + 1)
  396.                 end
  397.             end
  398.  
  399.             player:setStorageValue(skillAdvance.storage, 0)
  400.            
  401.             -- Treinar Shielding
  402.             player:addOfflineTrainingTries(SKILL_SHIELD, math.random(500, 1000) / 4)
  403.         end
  404.  
  405.         -- Definir de vez enquanto o personagem para hidden no Site
  406.         if (player:getStorageValue(54839836) > 86300) then
  407.             local value = player:isHidden() and 0 or 1
  408.             db.query(string.format('UPDATE `players` SET `hidden` = %d WHERE `id` = %d', value, player:getGuid()))
  409.             player:setStorageValue(54839832, 0)
  410.         end
  411.  
  412.         for _, infoSpoof in pairs(action) do
  413.             local storage = infoSpoof.storage
  414.  
  415.             player:setStorageValue(storage, math.max(0, player:getStorageValue(storage)) + 60)
  416.         end
  417.         player:setStorageValue(54839832, math.max(0, player:getStorageValue(54839832)) + 60)
  418.     end
  419.  
  420.     self.players[player:getName()] = addEvent(function(self, playerId) self:executeAction(playerId) end, 60 * 1000, self, playerId)
  421. end
Add Comment
Please, Sign In to add comment