@@ -36,7 +36,7 @@ local function gatherFromHolyVine(user)
3636end
3737
3838-- GrowCycles define how fast the plants regrow in the 4 seasons. 1 cycle takes 3 minutes
39- local function CreateHarvestProduct (ProductId , GroundType , GrowCycles , NextItemId , amount , originId )
39+ local function CreateHarvestProduct (ProductId , GroundType , GrowCycles , NextItemId , amount , originId , timeMultiplier )
4040 local retValue = {}
4141 retValue .productId = ProductId
4242 retValue .groundType = GroundType
@@ -52,24 +52,24 @@ local function CreateHarvestProduct(ProductId, GroundType, GrowCycles, NextItemI
5252
5353 retValue .origin = originId
5454
55+ retValue .timeMultiplier = timeMultiplier -- Allows us to scale the default harvest time to be longer for the more expensive fruits
56+
5557 return retValue
5658end
5759
5860local HarvestItems = {}
59- table.insert (HarvestItems , CreateHarvestProduct (Item .apple , nil , nil , 11 , 20 , 14 )) -- apple tree
60- table.insert (HarvestItems , CreateHarvestProduct (Item .cherries , nil , nil , 299 , 20 , 300 ))-- cherry tree
61- table.insert (HarvestItems , CreateHarvestProduct (Item .orange , nil , nil , 1193 , 5 , 1195 )) -- orange tree
62- table.insert (HarvestItems , CreateHarvestProduct (Item .grapes , nil , nil , 386 , 5 , 387 ))-- bush
63- table.insert (HarvestItems , CreateHarvestProduct (Item .tangerine ,nil , nil , 3612 , 20 , 3613 )) -- tangerine
64- table.insert (HarvestItems , CreateHarvestProduct (Item .berries ,nil , nil , 3742 , 10 , 3743 )) -- berries
65- table.insert (HarvestItems , CreateHarvestProduct (Item .banana , nil , nil , 3866 , 20 , 3867 )) -- banana tree
66- table.insert (HarvestItems , CreateHarvestProduct (Item .blackberry , nil , nil , 3893 , 10 , 3892 )) -- blackberry bush
67- table.insert (HarvestItems , CreateHarvestProduct (Item .pear , nil , nil , 4254 , 20 , 4253 )) -- pear tree
68- table.insert (HarvestItems , CreateHarvestProduct (Item .plum , nil , nil , 4342 , 10 , 4341 )) -- plum tree
69- table.insert (HarvestItems , CreateHarvestProduct (Item .pineapple ,nil , nil , 4244 , 5 ,4245 )) -- pineapple plant
70- table.insert (HarvestItems , CreateHarvestProduct (Item .peach ,nil , nil , 4239 , 20 , 4238 )) -- peach tree
71- table.insert (HarvestItems , CreateHarvestProduct (Item .mango ,nil , nil , 4256 , 10 , 4255 )) -- mango tree
72- table.insert (HarvestItems , CreateHarvestProduct (Item .nuts , nil , nil , 1809 , 10 , 4246 )) -- nut tree
61+ table.insert (HarvestItems , CreateHarvestProduct (Item .apple , nil , nil , 11 , 20 , 14 , 1 )) -- apple tree
62+ table.insert (HarvestItems , CreateHarvestProduct (Item .cherries , nil , nil , 299 , 20 , 300 , 1 ))-- cherry tree
63+ table.insert (HarvestItems , CreateHarvestProduct (Item .orange , nil , nil , 1193 , 5 , 1195 , 4 )) -- orange tree
64+ table.insert (HarvestItems , CreateHarvestProduct (Item .grapes , nil , nil , 386 , 5 , 387 , 4 ))-- bush
65+ table.insert (HarvestItems , CreateHarvestProduct (Item .tangerine ,nil , nil , 3612 , 20 , 3613 , 1 )) -- tangerine
66+ table.insert (HarvestItems , CreateHarvestProduct (Item .banana , nil , nil , 3866 , 20 , 3867 , 1 )) -- banana tree
67+ table.insert (HarvestItems , CreateHarvestProduct (Item .pear , nil , nil , 4254 , 20 , 4253 , 1 )) -- pear tree
68+ table.insert (HarvestItems , CreateHarvestProduct (Item .plum , nil , nil , 4342 , 10 , 4341 , 2 )) -- plum tree
69+ table.insert (HarvestItems , CreateHarvestProduct (Item .pineapple ,nil , nil , 4244 , 5 ,4245 , 4 )) -- pineapple plant
70+ table.insert (HarvestItems , CreateHarvestProduct (Item .peach ,nil , nil , 4239 , 20 , 4238 , 1 )) -- peach tree
71+ table.insert (HarvestItems , CreateHarvestProduct (Item .mango ,nil , nil , 4256 , 10 , 4255 , 2 )) -- mango tree
72+ table.insert (HarvestItems , CreateHarvestProduct (Item .nuts , nil , nil , 1809 , 10 , 4246 , 2 )) -- nut tree
7373
7474M .HarvestItems = HarvestItems
7575
@@ -93,7 +93,6 @@ function M.StartGathering(User, SourceItem, ltstate)
9393
9494 common .ResetInterruption ( User , ltstate )
9595 if ( ltstate == Action .abort ) then -- work interrupted
96- User :talk (Character .say , " #me unterbricht " .. common .GetGenderText (User , " seine" , " ihre" ).. " Arbeit." , " #me interrupts " .. common .GetGenderText (User , " his" , " her" ).. " work." )
9796 return
9897 end
9998
@@ -173,7 +172,7 @@ function M.StartGathering(User, SourceItem, ltstate)
173172 -- since we're here, there is something we can harvest
174173
175174 if ( ltstate == Action .none ) then -- currently not working -> let's go
176- fruitgathering .SavedWorkTime [User .id ] = fruitgathering :GenWorkTime (User )
175+ fruitgathering .SavedWorkTime [User .id ] = fruitgathering :GenWorkTime (User ) * harvestProduct . timeMultiplier
177176 User :startAction ( fruitgathering .SavedWorkTime [User .id ], 21 , fruitgathering .SavedWorkTime [User .id ], 0 , 0 )
178177 return
179178 end
@@ -198,7 +197,7 @@ function M.StartGathering(User, SourceItem, ltstate)
198197 local created = common .CreateItem (User , harvestProduct .productId , productAmount , 333 , data ) -- create the new produced items
199198 if created then -- character can still carry something
200199 if (amount > 0 ) then -- there are still fruits we can gather
201- fruitgathering .SavedWorkTime [User .id ] = fruitgathering :GenWorkTime (User )
200+ fruitgathering .SavedWorkTime [User .id ] = fruitgathering :GenWorkTime (User ) * harvestProduct . timeMultiplier
202201 User :startAction ( fruitgathering .SavedWorkTime [User .id ], 21 , fruitgathering .SavedWorkTime [User .id ], 0 , 0 )
203202 end
204203 end
@@ -218,6 +217,7 @@ function M.StartGathering(User, SourceItem, ltstate)
218217 else
219218 amount = harvestProduct .amount
220219 end
220+
221221 SourceItem :setData (" amount" ," " .. amount )
222222 world :changeItem (SourceItem )
223223 -- change item id
0 commit comments