Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 fluidType = {3, 4, 5, 7, 10, 11, 13, 15, 19}
- local fluidMessage = {"Aah...", "Urgh!", "Mmmh.", "Aaaah...", "Aaaah...", "Urgh!", "Urgh!", "Aah...", "Urgh!"}
- local specialFluids = {36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110}
- local specialMessages = {"Ugh.", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah...", "Aah..."}
- function onUse(player, item, fromPosition, target, toPosition, isHotkey)
- local targetItemType = ItemType(target.itemid)
- if targetItemType and targetItemType:isFluidContainer() then
- if target.type == 0 and item.type ~= 0 then
- for i = 0, #specialFluids do
- if item.type == specialFluids[i] then
- target:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, item:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION))
- item:removeAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
- end
- end
- target:transform(target:getId(), item.type)
- item:transform(item:getId(), 0)
- return true
- elseif target.type ~= 0 and item.type == 0 then
- for i = 0, #specialFluids do
- if target.type == specialFluids[i] then
- item:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, target:getAttribute(ITEM_ATTRIBUTE_DESCRIPTION))
- target:removeAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
- end
- end
- item:transform(item:getId(), target.type)
- target:transform(target:getId(), 0)
- return true
- end
- end
- if target:isCreature() then
- if item.type == 0 then
- player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
- elseif target == player then
- if item.type == 3 or item.type == 15 then
- player:addCondition(drunk)
- elseif item.type == 4 then
- player:addCondition(poison)
- elseif item.type == 7 then
- player:addMana(math.random(50, 150))
- fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
- elseif item.type == 10 then
- player:addHealth(60)
- fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
- end
- for i = 0, #fluidType do
- if item.type == fluidType[i] then
- player:say(fluidMessage[i], TALKTYPE_MONSTER_SAY)
- item:transform(item:getId(), 0)
- return true
- end
- end
- for i = 0, #specialFluids do
- if item.type == specialFluids[i] then
- local effects = item:getEffects(item)
- usePotion(player, effects)
- player:say(specialMessages[i], TALKTYPE_MONSTER_SAY)
- item:transform(item:getId(), 0)
- item:removeAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
- return true
- end
- end
- item:transform(item:getId(), 0)
- player:say("Gulp.", TALKTYPE_MONSTER_SAY)
- else
- Game.createItem(2016, item.type, toPosition):decay()
- item:transform(item:getId(), 0)
- end
- else
- local fluidSource = targetItemType and targetItemType:getFluidSource() or 0
- if fluidSource ~= 0 then
- item:transform(item:getId(), fluidSource)
- elseif item.type == 0 then
- if item:getId() == 2006 and target:getId() == 12289 then
- player:sendAlchemyWindow()
- else
- player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
- end
- else
- if toPosition.x == CONTAINER_POSITION then
- toPosition = player:getPosition()
- end
- for i = 0, #specialFluids do
- if item.type == specialFluids[i] then
- item:removeAttribute(ITEM_ATTRIBUTE_DESCRIPTION)
- end
- end
- Game.createItem(2016, item.type, toPosition):decay()
- item:transform(item:getId(), 0)
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement