What's new

Skrypty & Kody [tibia 7.60] Potiony od danego lvl oraz profesji

Pucek1993

Active User
Joined
Feb 4, 2016
Messages
71
Reaction score
1
Cze??, pr?bowa?em bezskutecznie doda? barier? levelow? oraz wymagan? profesj? do potion?w i niestety nie dzia?a. Pom?g?by mi kto? to ogarn??? :) Tutaj skrypt:

PHP:
local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)

local poison = Condition(CONDITION_POISON)
poison:setParameter(CONDITION_PARAM_DELAYED, true)
poison:setParameter(CONDITION_PARAM_MINVALUE, -50)
poison:setParameter(CONDITION_PARAM_MAXVALUE, -120)
poison:setParameter(CONDITION_PARAM_STARTVALUE, -5)
poison:setParameter(CONDITION_PARAM_TICKINTERVAL, 4000)
poison:setParameter(CONDITION_PARAM_FORCEUPDATE, true)

local fluidMessage = {
	[3] = 'Aah...',
	[4] = 'Urgh!',
	[5] = 'Mmmh.',
	[7] = 'Aaaah...',
	[8] = 'Aaaah...',
	[10] = 'Aaaah...',
	[11] = 'Urgh!',
	[13] = 'Urgh!',
	[15] = 'Aah...',
	[19] = 'Urgh!',
	[43] = 'Aaaah...'
}

local function graveStoneTeleport(cid, fromPosition, toPosition)
	local player = Player(cid)
	if not player then
		return true
	end

	player:teleportTo(toPosition)
	player:say('Muahahahaha..', TALKTYPE_MONSTER_SAY, false, player)
	fromPosition:sendMagicEffect(CONST_ME_DRAWBLOOD)
	toPosition:sendMagicEffect(CONST_ME_MORTAREA)
end

function onUse(player, item, fromPosition, target, toPosition)
	local targetType = ItemType(target.itemid)
	if targetType:isFluidContainer() then
		if target.type == 0 and item.type ~= 0 then
			target:transform(target.itemid, item.type)
			item:transform(item.itemid, 0)
			return true
		elseif target.type ~= 0 and item.type == 0 then
			target:transform(target.itemid, 0)
			item:transform(item.itemid, target.type)
			return true
		end
	end

	if target.itemid == 1 then
		if item.type == 0 then
			player:sendTextMessage(MESSAGE_STATUS_SMALL, 'It is empty.')

		elseif target.uid == player.uid then
			if isInArray({3}, item.type) then
				player:addCondition(drunk)

			elseif item.type == 4 then
				player:addCondition(poison)

			elseif item.type == 7 then
				local mp = math.random(50, 150)
				player:addMana(mp)
				toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
				player:say('+' ..mp, TALKTYPE_MONSTER_SAY)
				item:transform(item.itemid, 0)
				
            elseif item.type == 15 and player:getLevel() >= 65 then
				local smp = math.random(250, 450)
				player:addMana(smp)
				toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
				player:say('+' ..smp, TALKTYPE_MONSTER_SAY)
				item:transform(item.itemid, 0)
				
			 elseif item.type == 43 and player:getLevel() >= 85 and player:getVocation() == 4 or 8 then
				local ghp = math.random(450, 700)
				player:addHealth(ghp)
				toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
				player:say('+' ..ghp, TALKTYPE_MONSTER_SAY)
				item:transform(item.itemid, 0)
				
            elseif item.type == 21 and player:getLevel() >= 65 and player:getVocation() == 4 or 8 then
				local shp = math.random(300, 450)
				player:addHealth(shp)
				toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
				player:say('+' ..shp, TALKTYPE_MONSTER_SAY)
				item:transform(item.itemid, 0)

			elseif item.type == 10 then
				local hp = math.random(80, 180)
				player:addHealth(hp)
				player:say('+' ..hp, TALKTYPE_MONSTER_SAY)
				toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
				item:transform(item.itemid, 0)
			end

		else
			local pool = Game.createItem(2016, item.type, toPosition)
			if pool then
				pool:decay()
			end
			item:transform(item.itemid, 0)
		end

	else

		local fluidSource = targetType:getFluidSource()
		if fluidSource ~= 0 then
			item:transform(item.itemid, fluidSource)

		elseif item.type == 0 then
			player:sendTextMessage(MESSAGE_STATUS_SMALL, 'It is empty.')

		else
			if item.type == 2 and target.actionid == 2023 then
				toPosition.y = toPosition.y + 1
				local creatures, destination = Tile(toPosition):getCreatures(), Position(32791, 32332, 10)
				if #creatures == 0 then
					graveStoneTeleport(player.uid, fromPosition, destination)
				else
					local creature
					for i = 1, #creatures do
						creature = creatures[i]
						if creature and creature:isPlayer() then
							graveStoneTeleport(creature.uid, toPosition, destination)
						end
					end
				end

			else
				if toPosition.x == CONTAINER_POSITION then
					toPosition = player:getPosition()
				end

				local pool = Game.createItem(2016, item.type, toPosition)
				if pool then
					pool:decay()
				end
			end
			item:transform(item.itemid, 0)
		end
	end

	return true
end
 

Candy Boy

Active User
Joined
Jun 27, 2014
Messages
109
Reaction score
2
Odp: [tibia 7.60] Potiony od danego lvl oraz profesji

Sprawdza?e? czy player:getLevel() dobrze zwraca? Podrzu? dokumentacj?, albo plik luascript.cpp z source silnika
 
Top