finish barbarian quest and add mead to fluids

This commit is contained in:
ErikasKontenis
2022-06-25 13:51:35 +03:00
parent c62f7b93e2
commit a44efd508f
12 changed files with 254 additions and 75 deletions

View File

@@ -0,0 +1,45 @@
local function sendSleepEffect(position)
position:sendMagicEffect(CONST_ME_SLEEP)
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if target.actionid == 3110 and item.itemid == 7140 then
player:say('You fill your horn with ale.', TALKTYPE_MONSTER_SAY)
item:transform(7141)
toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
elseif target.itemid == 7174 and item.itemid == 7141 then
player:say('The bear is now unconcious.', TALKTYPE_MONSTER_SAY)
item:transform(7140)
target:transform(7175)
toPosition:sendMagicEffect(CONST_ME_STUN)
elseif item.itemid == 7175 then
if player:getStorageValue(12190) == 4 then
player:say('You hug the unconcious bear.', TALKTYPE_MONSTER_SAY)
player:setStorageValue(12190, 5)
player:setStorageValue(12192, 2) -- Questlog Barbarian Test Quest Barbarian Test 2: The Bear Hugging
item:transform(7174)
toPosition:sendMagicEffect(CONST_ME_SLEEP)
else
player:say('You don\'t feel like hugging an unconcious bear.', TALKTYPE_MONSTER_SAY)
end
elseif item.itemid == 7174 then
player:say('Grr.', TALKTYPE_MONSTER_SAY)
player:say('The bear is not amused by the disturbance.', TALKTYPE_MONSTER_SAY)
doAreaCombatHealth(player, COMBAT_PHYSICALDAMAGE, player:getPosition(), 0, -10, -30, CONST_ME_POFF)
elseif item.itemid == 7176 then
if player:getStorageValue(12190) == 6 then
if player:getCondition(CONDITION_DRUNK) then
player:say('You hustle the mammoth. What a fun. *hicks*.', TALKTYPE_MONSTER_SAY)
player:setStorageValue(12190, 7)
player:setStorageValue(12193, 2) -- Questlog Barbarian Test Quest Barbarian Test 3: The Mammoth Pushing
item:transform(7177)
item:decay()
addEvent(sendSleepEffect, 60 * 1000, toPosition)
toPosition:sendMagicEffect(CONST_ME_SLEEP)
else
player:say('You are not drunk enough to hustle a mammoth.', TALKTYPE_MONSTER_SAY)
end
end
end
return true
end

View File

@@ -0,0 +1,25 @@
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(12190) == 2 and player:getStorageValue(12194) <= 20 then
if math.random(5) > 1 then
player:say('The world seems to spin but you manage to stay on your feet.', TALKTYPE_MONSTER_SAY)
player:setStorageValue(12195, player:getStorageValue(12195) + 1)
if player:getStorageValue(12195) == 9 then -- 9 sips here cause local player at start
player:say('10 sips in a row. Yeah!', TALKTYPE_MONSTER_SAY)
player:setStorageValue(12190, 3)
player:setStorageValue(12191, 3) -- Questlog Barbarian Test Quest Barbarian Test 1: Barbarian Booze
return true
end
else
player:say('The mead was too strong. You passed out for a moment.', TALKTYPE_MONSTER_SAY)
player:setStorageValue(12195, 0)
end
player:setStorageValue(12194, player:getStorageValue(12194) + 1)
elseif player:getStorageValue(12194) > 20 then
player:say('Ask Sven for another round.', TALKTYPE_MONSTER_SAY)
player:setStorageValue(12190, 1)
player:setStorageValue(12191, 1) -- Questlog Barbarian Test Quest Barbarian Test 1: Barbarian Booze
elseif player:getStorageValue(12190) >= 3 then
player:say('You already passed the test, no need to torture yourself anymore.', TALKTYPE_MONSTER_SAY)
end
return true
end

View File

@@ -19,7 +19,8 @@ local messages = {
[FLUID_LEMONADE] = "Mmmh.",
[FLUID_RUM] = "Aah...",
[FLUID_COCONUTMILK] = "Mmmh.",
[FLUID_FRUITJUICE] = "Mmmh."
[FLUID_FRUITJUICE] = "Mmmh.",
[FLUID_MEAD] = "Aah...",
}
function onUse(player, item, fromPosition, target, toPosition)
@@ -35,24 +36,12 @@ function onUse(player, item, fromPosition, target, toPosition)
end
end
if (configManager.getBoolean(configKeys.UH_TRAP)) then
local tile = Tile(toPosition)
local creature = tile:getBottomCreature()
if creature and creature:isPlayer() then
target = creature
end
else
-- monsters do not use mana also I do not know if you can use life fluid on monsters
-- if you can just want to use life fluids on monster then change isPlayer to isCreature
target = target:isPlayer() and target
end
if target:isCreature() and target:getPlayer() ~= nil then
if item:getFluidType() == FLUID_NONE then
player:sendCancelMessage("It is empty.")
else
local self = target == player
if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE or item:getFluidType() == FLUID_RUM then
if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE or item:getFluidType() == FLUID_RUM or item:getFluidType() == FLUID_MEAD then
player:addCondition(drunk)
elseif self and item:getFluidType() == FLUID_SLIME then
player:addCondition(poison)