<commit_before>--I_165_blaue_flasche
-- new effects for reworked alchemy system
-- support potions: the effect other potions (stocks or essencebrews) or the effect of potion
-- e.g. change a potion's quality, remove cooldown of  potion

require("base.common")
require("alchemy.base.alchemy")

module("alchemy.item.id_165_blue_bottle", package.seeall)

-- UPDATE common SET com_script='alchemy.item.id_165_blue_bottle' WHERE com_itemid = 165;

function DrinkPotion(User,SourceItem)
    -- no effecs yet
	 base.common.InformNLS(User, "Du hast nicht das Gefhl, dass etwas passiert.", 
		"You don't have the feeling that something happens.")
end

function UseItem(User,SourceItem,TargetItem,Counter,Param,ltstate)
	
	if not ((SourceItem:getData("filledWith")=="potion") or (SourceItem:getData("filledWith") =="essenceBrew")) then
		return -- no potion, no essencebrew, something else
	end
	
	local cauldron = alchemy.base.alchemy.GetCauldronInfront(User)
	if cauldron then -- infront of a cauldron?
	
	   -- is the char an alchemist?
	    local anAlchemist = alchemy.base.alchemy.CheckIfAlchemist(User,"Nur jene, die in die Kunst der Alchemie eingefhrt worden sind, knnen hier ihr Werk vollrichten.","Only those who have been introduced to the art of alchemy are able to work here.")
		if not anAlchemist then
			return
		end
	   
	   if ( ltstate == Action.abort ) then
	        base.common.InformNLS(User, "Du brichst deine Arbeit ab.", "You abort your work.")
	       return
		end
		
		if ( ltstate == Action.none ) then
            if (SourceItem:getData("filledWith") =="essenceBrew") and (cauldron:getData("filledWith") == "stock") then
		        actionDuration = 80 -- when we combine a stock and an essence brew, it takes longer
            else
                actionDuration = 20
            end				
			User:startAction( actionDuration, 21, 5, 10, 45)
			return
		end	
	
	    if (SourceItem:getData("filledWith")=="potion") then -- potion should be filled into the cauldron
		    -- water leads to a failure
			if cauldron:getData("cauldronFilledWith") == "water" then
			    world:gfx(1,cauldron.pos)
		    
			elseif cauldron:getData("filledWith") == "essenceBrew" then 
			    SupportEssenceBrew(User,SourceItem,cauldron)
			
			elseif cauldron:getData("filledWith") == "potion" then
			    SupportPotion(User,SourceItem,cauldron)
			    
			elseif cauldron:getData("filledWith") == "stock" then
				SupportStock(User,SourceItem,cauldron)
			
			else
			    alchemy.base.alchemy.FillFromTo(SourceItem,cauldron)
				EmptyBottle(User,SourceItem)
			end    <commit_msg>call right path<commit_after>--I_165_blaue_flasche
-- new effects for reworked alchemy system
-- support potions: the effect other potions (stocks or essencebrews) or the effect of potion
-- e.g. change a potion's quality, remove cooldown of  potion

require("base.common")
require("alchemy.base.alchemy")

module("alchemy.item.id_165_blue_bottle", package.seeall)

-- UPDATE common SET com_script='alchemy.item.id_165_blue_bottle' WHERE com_itemid = 165;

function DrinkPotion(User,SourceItem)
    -- no effecs yet
	 base.common.InformNLS(User, "Du hast nicht das Gefhl, dass etwas passiert.", 
		"You don't have the feeling that something happens.")
end

function UseItem(User,SourceItem,TargetItem,Counter,Param,ltstate)
	
	if not ((SourceItem:getData("filledWith")=="potion") or (SourceItem:getData("filledWith") =="essenceBrew")) then
		return -- no potion, no essencebrew, something else
	end
	
	local cauldron = alchemy.base.alchemy.GetCauldronInfront(User)
	if cauldron then -- infront of a cauldron?
	
	   -- is the char an alchemist?
	    local anAlchemist = alchemy.base.alchemy.CheckIfAlchemist(User,"Nur jene, die in die Kunst der Alchemie eingefhrt worden sind, knnen hier ihr Werk vollrichten.","Only those who have been introduced to the art of alchemy are able to work here.")
		if not anAlchemist then
			return
		end
	   
	   if ( ltstate == Action.abort ) then
	        base.common.InformNLS(User, "Du brichst deine Arbeit ab.", "You abort your work.")
	       return
		end
		
		if ( ltstate == Action.none ) then
            if (SourceItem:getData("filledWith") =="essenceBrew") and (cauldron:getData("filledWith") == "stock") then
		        actionDuration = 80 -- when we combine a stock and an essence brew, it takes longer
            else
                actionDuration = 20
            end				
			User:startAction( actionDuration, 21, 5, 10, 45)
			return
		end	
	
	    if (SourceItem:getData("filledWith")=="potion") then -- potion should be filled into the cauldron
		    -- water leads to a failure
			if cauldron:getData("cauldronFilledWith") == "water" then
			    world:gfx(1,cauldron.pos)
		    
			elseif cauldron:getData("filledWith") == "essenceBrew" then 
			    SupportEssenceBrew(User,SourceItem,cauldron)
			
			elseif cauldron:getData("filledWith") == "potion" then
			    SupportPotion(User,SourceItem,cauldron)
			    
			elseif cauldron:getData("filledWith") == "stock" then
				SupportStock(User,SourceItem,cauldron)
			
			else
			    alchemy.base.alchemy.FillFromTo(SourceItem,cauldron)
				alchemy.base.alchemy.EmptyBottle(User,SourceItem)
			end    
{'fraction_non_alphanumeric': 0.10148849797023005, 'fraction_numerical': 0.009278948385849604, 'mean_word_length': 3.6362007168458783, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1361914', 'n_tokens_mistral': 1879, 'n_tokens_neox': 1652, 'n_words': 456}