Ir para conteúdo

Featured Replies

Postado

Queria ajudar para passar esse script a baixo pra 0.4

 

 

 

if not Spoof then
	Spoof = { 
		players = { }
	}
end

Spoof.trainerTeleportPosition = Position(997, 1004, 7)
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}

local randomTimes = {
	["levelAdvance"] = {storage = 54839827, minMinutes = 20, maxMinutes = 30, maxLevel = 300, afterMaxMinPorcentage = 1},
	["exchangeOutfit"]  = {storage = 54839828, minMinutes = 240, maxMinutes = 380, chanceToGainAddon = 3},
	["fragAndDeath"] = {storage = 54839829, minMinutes = 480, maxMinutes = 1020, chance = 3},
	["newItem"] = {storage = 54839830, minMinutes = 86400, maxMinutes = 86400 * 2},
	["newQuest"] = {storage = 54839831, minMinutes = 6 * 3600, maxMinutes = 12 * 3600},
	["skillAdvance"] = {storage = 54839832, minMinutes = 30, maxMinutes = 80, maxSkill = 80, afterMaxMinPorcentage = 1}
}

local itensTable = {
	[1] = { -- MS
		[{100, 120}] = {8820, 8819, 7730, 2643, 2190, 2175, 2175},
		[{121, 181}] = {2323, 8871, 7730, 2195, 2187, 2175, 2175},
		[{181, 220}] = {2323, 8871, 7730, 2195, 2187, 2514, 2175},
		[{221, 300}] = {9778, 12643, 7730, 6132, 36101, 2514, 2175},
		[{301, 999}] = {9778, 12643, 18400, 6132, 36101, 8918, 2175},
	},
	[2] = { -- ED
		[{100, 120}] = {8820, 8819, 7730, 2643, 2182, 2175, 8266},
		[{121, 181}] = {2323, 8871, 7730, 2195, 2183, 2175, 8266},
		[{181, 220}] = {2323, 8871, 7730, 2195, 2183, 2514, 8266},
		[{221, 300}] = {9778, 12643, 7730, 6132, 36101, 2514, 8266},
		[{301, 999}] = {9778, 12643, 18400, 6132, 36101, 8918, 8266},
	},
	[3] = { -- RP
		[{100, 120}] = {2480, 2660, 2478, 2195, 7368, 2525},
		[{121, 181}] = {2480, 2660, 2478, 2195, 7368, 2525, 8266},
		[{181, 220}] = {2493, 2660, 9777, 2514, 7368, 2514, 8266},
		[{221, 999}] = {12645, 18404, 9777, 6132, 7368, 2514, 8266},
	},
	[4] = { -- EK
		[{100, 120}] = {2460, 2465, 2478, 2195, 2525},
		[{121, 181}] = {2460, 2465, 2478, 2195, 2525, 8266},
		[{181, 220}] = {2493, 2465, 2478, 2195, 2514, 8266},
		[{221, 999}] = {2493, 12642, 2478, 2195, 18410, 8266},
	},
}

local randomAddons = {
	[1] = {male = 128, female = 136, name = 'Citizen Outfit'}, -- citizen
	[2] = {male = 129, female = 137, name = 'Hunter addon'}, -- hunter
	[3] = {male = 132, female = 140, name = 'Nobleman addon'}, -- Noblewoman
	[4] = {male = 133, female = 138, name = 'Summoner addon'}, -- Summoner
	[5] = {male = 134, female = 142, name = 'Warrior addon'}, -- Warrior
	[6] = {male = 143, female = 147, name = 'Barbarian addon'}, -- Barbarian
	[7] = {male = 144, female = 148, name = 'Druid addon'}, -- Druid
	[8] = {male = 145, female = 149, name = 'Wizard addon'}, -- Wizard
	[9] = {male = 146, female = 150, name = 'Oriental addon'}, -- Oriental
	[10] = {male = 151, female = 155, name = 'Pirate addon'}, -- Pirate
	[11] = {male = 153, female = 157, name = 'Beggar addon'}, -- Beggar
	[12] = {male = 154, female = 158, name = 'Shaman addon'}, -- Shaman
	[13] = {male = 251, female = 252, name = 'Norsewoman addon'}, -- Norsewoman
	[14] = {male = 152, female = 156, name = 'Assassin addon'}, -- Assassin
	[15] = {male = 335, female = 336, name = 'Warmaster addon'}, -- Warmaster
	[16] = {male = 367, female = 366, name = 'Wayfarer addon'}, -- Wayfarer
	[17] = {male = 463, female = 464, name = 'Deepling addon'}, -- Deepling
	[18] = {male = 131, female = 139, name = 'Knight addon'} -- Knight Outfit
}

function Spoof.onLoad(self)
	local resultId = db.storeQuery("SELECT `name` FROM `players` WHERE `spoof` = 1")
	if resultId then
		repeat
			local playerName = result.getString(resultId, "name")
			if not self.players[playerName] then 
				self.players[playerName] = 0
			end 
		until not result.next(resultId)
		result.free(resultId)
	end
end

function Spoof.isASpoofer(self, name)
	return self.players[name]
end

function Spoof.onLogin(self, player)
	local playerName = player:getName()
	if not self:isASpoofer(playerName) then
		return
	end

	player:teleportTo(self.trainerTeleportPosition)
	self.players[playerName] = addEvent(function(self, playerId) self:executeAction(playerId) end, 60 * 1000, self, player:getId())
end

function Spoof.getRandomOutfit(self, sex)
	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))
	local t = { lookType = 0, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0 }
	if resultId then
		local lookType = result.getNumber(resultId, "looktype")
		local lookHead = result.getNumber(resultId, "lookhead")
		local lookBody = result.getNumber(resultId, "lookbody")
		local lookLegs = result.getNumber(resultId, "looklegs")
		local lookFeet = result.getNumber(resultId, "lookfeet")
		result.free(resultId)

		t.lookType = lookType
		t.lookHead = lookHead
		t.lookBody = lookBody
		t.lookLegs = lookLegs
		t.lookFeet = lookFeet
	end

	if isInArray(self.blockedLookTypes, t.lookType) then
		local look = (sex == 0) and math.random(136, 142) or math.random(128, 134)

		t.lookType = look
		if math.random(10) <= 6 then
			local equalColor = math.random(100)
			t.lookHead = equalColor
			t.lookBody = equalColor
			t.lookLegs = equalColor
			t.lookFeet = equalColor
		else 
			t.lookHead = math.random(100)
			t.lookBody = math.random(100)
			t.lookLegs = math.random(100)
			t.lookFeet = math.random(100)
		end 
	end

	return t
end

function Spoof.executeAction(self, playerId)
	-- Spoof:executeAction(player:getId())
	local player = Player(playerId)
	if not player then
		return
	end

	local action = randomTimes
	local playerSex = player:getSex()
	local playerGuid = player:getGuid()
	local playerName = player:getName()

	-- Verifica se est? nos Trainers
	if player:isInTrainers() then
		-- Pega o tempo do Spoof para uma acao
		
		-- Dar Frags & mortes
		local fragAndDeath = action["fragAndDeath"]
		if (math.random(10) <= fragAndDeath.chance and player:getStorageValue(fragAndDeath.storage) > math.random(fragAndDeath.minMinutes, fragAndDeath.maxMinutes) * 60) and player:getLevel() > 250 then
			if math.random(10) <= 4 then -- 40% de chance de ser para player a morte
				-- Player
				local allSpoofLoggeds = { }
				for tmpName, _ in pairs(self.players) do
					if tmpName ~= playerName then
						allSpoofLoggeds[#allSpoofLoggeds + 1] = tmpName
					end 
				end

				if next(allSpoofLoggeds) ~= nil then
					local randomAmount = math.random(2, 10)
					local participantsTable = { }
					for i = 1, randomAmount do
						local randomParticipant = allSpoofLoggeds[math.random(#allSpoofLoggeds)]
						if randomParticipant then
							participantsTable[#participantsTable + 1] = randomParticipant
						end
					end

					local mostDamage = ''
					local killerName = ''
					local participants = ''

					for index, participantName in ipairs(participantsTable) do
						-- O primeiro participante ter? dado o dano maior e n?o ser? inserido na database como participantes
						if index == 1 then
							mostDamage = participantName
						else
							-- O Index 2 vai dar o participante como o matador
							if index == 2 then
								killerName = participantName
							end

							local participantGuid = getPlayerGUIDByName(participantName)
							participants = string.format('%s%d', participants == '' and '' or participants .. ',', participantGuid)
							db.query(string.format('UPDATE `players` SET `frags` = `frags` + 1 WHERE `name` = %s', db.escapeString(participantName)))
						end
					end

					db.query(string.format('UPDATE `players` SET `deaths` = `deaths` + 1 WHERE `name` = %s', db.escapeString(playerName)))

					-- Se por acaso nao tenha um killerName e mostDamage tiver com nome de um player, vamos pegar ele.
					if killerName == '' and mostDamage ~= '' then
						killerName = mostDamage
					end

					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)))

					local removeExperience = #participantsTable * 100000
					player:removeExperience(removeExperience)
				end
			else -- 60% de chance de ser para monstro normal
				-- Monstro
				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))
				if resultId then
					local killedBy = result.getString(resultId, "killed_by")
					local mostDamage = result.getString(resultId, "mostdamage_by")
					result.free(resultId)

					-- Verifica se ? VIP o monstro, se for, ent?o vai dar VIP para o Spoofer
					if (isInArray(VIP_MONSTERS, killedBy) or isInArray(VIP_MONSTERS, mostDamage)) and not player:isVip() then
						player:loadVipData()
						player:addVipDays(3)
						player:updateVipTime()
					end

					local participants = ''
					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)))

					local removeExperience = (math.random(5, 10)) * 100000
					player:removeExperience(removeExperience)
				end

				player:setStorageValue(fragAndDeath.storage, 0)
			end
		end 

		-- Melhorar o Set
		local newItem = action["newItem"]
		if (player:getStorageValue(newItem.storage) > math.random(newItem.minMinutes, newItem.maxMinutes) * 60) then
			if math.random(10) <= 3 then
				local itemListVocation = itensTable[player:getVocation():getBase():getId()]
				if itemListVocation then
					local itemList = nil
					for v, k in pairs(itemListVocation) do
						if 301 >= v[1] and 301 <= v[2] then	
							itemList = k
							break
						end
					end

					if itemList then
						local itemId = nil
						local slotItem = nil
						for i = 1, 100 do
							local randomItem = itemList[math.random(#itemList)]
							local itemType = ItemType(randomItem)
							if itemType then
								local slot = itemType:getSlotPosition()

								local tmpSlotItem = SLOTS_CONST[slot]
								local itemPlayerSlot = player:getSlotItem(tmpSlotItem)
								if itemPlayerSlot then
									if randomItem ~= itemPlayerSlot:getId() then
										itemPlayerSlot:remove()
										slotItem = tmpSlotItem
										itemId = randomItem
										break
									end
								else
									slotItem = tmpSlotItem
									itemId = itemType:getId()
									break
								end
							end
						end

						-- Search for Weapons Avaliable
						if not player:getSlotItem(CONST_SLOT_LEFT) then
							for i = 1, 100 do
								local randomItem = itemList[math.random(#itemList)]
								local itemType = ItemType(randomItem)
								if itemType then
									local slot = itemType:getSlotPosition()
									local tmpSlotItem = SLOTS_CONST[slot]
									if slot == 48 and itemType:getWeaponType() ~= 4 then
										player:addItem(randomItem, 1)
										break
									end
								end
							end
						end

						if itemId then
							local itemType = ItemType(itemId)
							if itemType then
								player:addItem(itemId, 1, false, -1, slotItem)
							end
						end
					end
				end

				-- Repara Soft Boots
				local feetSloot = player:getSlotItem(CONST_SLOT_FEET)
				if feetSloot then
					if feetSloot:getId() == 10021 then
						feetSloot:transform(2640)
					end
				end

				player:save()
			end 
		end

		local newQuest = action["newQuest"] -- TODO

		-- Avan?ar level
		local advanceLevel = action["levelAdvance"]
		if (player:getStorageValue(advanceLevel.storage) > math.random(advanceLevel.minMinutes, advanceLevel.maxMinutes) * 60) then
			local experience = nil
			if player:getLevel() >= advanceLevel.maxLevel then
				local randomChance = math.random(1, 2)
				
				randomChance =  randomChance * 0.1
				experience = getExpForLevel(player:getLevel()) * randomChance
				print(experience)
				--player:addExperience(experience, false)
			else
				experience = getExpForLevel(player:getLevel() + math.random(5)) - player:getExperience()
				player:addExperience(experience, false)
			end

			ExperienceOnline_time:increaseExperience(player:getId(), experience)
			player:setStorageValue(advanceLevel.storage, 0)
		end

		-- Mudar Outfit
		local exchangeOutfit = action["exchangeOutfit"]
		if (player:getStorageValue(exchangeOutfit.storage) > math.random(exchangeOutfit.minMinutes, exchangeOutfit.maxMinutes) * 60) then
			local getRandomOutfit = self:getRandomOutfit(playerSex)

			player:setOutfit({lookType = getRandomOutfit.lookType, lookHead = getRandomOutfit.lookHead, lookBody = getRandomOutfit.lookBody, lookLegs = getRandomOutfit.lookLegs, lookFeet = getRandomOutfit.lookFeet})

			if math.random(10) <= exchangeOutfit.chanceToGainAddon then
				local randomAddon = nil
				for i = 1, 100 do
					local randomOutfit = randomAddons[math.random(#randomAddons)]
					if randomOutfit then 
						if not player:hasOutfit(playerSex == PLAYERSEX_FEMALE and randomOutfit.female or randomOutfit.male, 3) then
							randomAddon = randomOutfit
							break
						end
					end
				end

				if randomAddon then
					player:addOutfitAddon(randomAddon.female, 3)
					player:addOutfitAddon(randomAddon.male, 3)
					player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_BLUE)
					local outfit = player:getOutfit()
					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})
				end
			end

			player:setStorageValue(exchangeOutfit.storage, 0)
		end

		-- Aumentar Skill
		local skillAdvance = action["skillAdvance"]
		if (player:getStorageValue(skillAdvance.storage) > math.random(skillAdvance.minMinutes, skillAdvance.maxMinutes) * 60) then
			if player:isKnight() or player:isPaladin() then
				local highestSkill = player:getHigherSkill(player)
				local getSkill = player:getSkillLevel(highestSkill)
				if getSkill >= skillAdvance.maxSkill then
					player:addSkillTries(highestSkill, player:getSkillLevel(highestSkill) + 1 * 0.1)
				else
					player:addSkillTries(highestSkill, player:getVocation():getRequiredSkillTries(highestSkill, player:getSkillLevel(highestSkill) + 1) - player:getSkillTries(highestSkill))
				end

				-- Avan?o de Magic Level para Knights & Paladin
				local magicLevel = player:getMagicLevel()
				if player:isKnight() then
					local formula = math.random(2500, 5000) * (player:getVocation():getManaGainAmount() / player:getVocation():getManaGainTicks())
					if magicLevel >= 10 then
						formula = formula * (math.random(3) * 0.1)
					end

					player:addManaSpent(formula)
				else
					local formula = math.random(3600, 10000) * (player:getVocation():getManaGainAmount() / player:getVocation():getManaGainTicks())
					if magicLevel >= 30 then
						formula = formula * (math.random(5) * 0.1)
					end

					player:addManaSpent(formula)
				end
			elseif player:isMage() then
				local playerGetSkill = player:getMagicLevel()
				if playerGetSkill >= skillAdvance.maxSkill then
					player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel()) + 1 * 0.1)
				else
					player:addManaSpent(player:getVocation():getRequiredManaSpent(player:getBaseMagicLevel()) + 1)
				end
			end

			player:setStorageValue(skillAdvance.storage, 0)
			
			-- Treinar Shielding
			player:addOfflineTrainingTries(SKILL_SHIELD, math.random(500, 1000) / 4)
		end

		-- Definir de vez enquanto o personagem para hidden no Site
		if (player:getStorageValue(54839836) > 86300) then
			local value = player:isHidden() and 0 or 1
			db.query(string.format('UPDATE `players` SET `hidden` = %d WHERE `id` = %d', value, player:getGuid()))
			player:setStorageValue(54839832, 0)
		end

		for _, infoSpoof in pairs(action) do
			local storage = infoSpoof.storage

			player:setStorageValue(storage, math.max(0, player:getStorageValue(storage)) + 60)
		end
		player:setStorageValue(54839832, math.max(0, player:getStorageValue(54839832)) + 60)
	end

	self.players[player:getName()] = addEvent(function(self, playerId) self:executeAction(playerId) end, 60 * 1000, self, playerId)
end

 

 

Editado por Farathor (veja o histórico de edições)

[progress=green]50[/progress]

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo