
--Randomize findings for Gathering Flora.
function HCFloraGather(items, result, player)
    skill = player:getPerkLevel(Perks.PlantScavenging);

    floraLvl0 = 1024+(18.6*skill);
    floraLvl1 = 512+(18.6*skill);
    floraLvl2 = 256+(18.6*skill);
    floraLvl3 = 128+(18.6*skill);
    floraLvl4 = 64+(18.6*skill);
    floraLvl5 = 32+(18.6*skill);
    floraLvl6 = 16+(18.6*skill);
    floraLvl7 = 8+(18.6*skill);
    floraLvl8 = 4+(18.6*skill);
    floraLvl9 = 2+(18.6*skill);
    floraLvl10 = 1+(18.6*skill);
    nothing = 2048-(204.8*skill);
    if (getGameTime():getMonth() + 1) >= 11 or (getGameTime():getMonth() + 1) <= 2 then
        floraLvl0 = floraLvl0/2;
        floraLvl1 = floraLvl1/2;
        floraLvl2 = floraLvl2/2;
        floraLvl3 = floraLvl3/2;
        floraLvl4 = floraLvl4/2;
        floraLvl5 = floraLvl5/2;
        floraLvl6 = floraLvl6/2;
        floraLvl7 = floraLvl7/2;
        floraLvl8 = floraLvl8/2;
        floraLvl9 = floraLvl9/2;
        floraLvl10 = floraLvl10/2;
        nothing = nothing+(floraLvl0)+(floraLvl1)+(floraLvl2)+(floraLvl3)+(floraLvl4)+(floraLvl5)+(floraLvl6)+(floraLvl7)+(floraLvl8)+(floraLvl9)+(floraLvl10);
    end
    chance = ZombRand(4096);
    secondChance = 0;
    if chance <= floraLvl10 then
		secondChance = ZombRand(4);
		if secondChance == 0 then
			player:getInventory():AddItem("Base.Apple");
		elseif secondChance == 1 then
			player:getInventory():AddItem("Base.Grapes");
		elseif secondChance == 2 then
			player:getInventory():AddItem("Base.Lemon");
		elseif secondChance == 3 then
			player:getInventory():AddItem("Base.Orange");
		end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl9+floraLvl10 then
        secondChance = ZombRand(2);
        if secondChance == 0 then
            player:getInventory():AddItem("Base.Corn");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Base.Tomato");
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(4);
        if secondChance == 0 then
            player:getInventory():AddItem("Base.Cabbage");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Base.Carrots");
		elseif secondChance == 2 then
            player:getInventory():AddItem("Base.Potato");
		elseif secondChance == 3 then
            player:getInventory():AddItem("Base.RedRadish");
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl7+floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(3);
        if secondChance == 0 then
            player:getInventory():AddItem("Hydrocraft.HCTeaseeds");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Hydrocraft.HCHempseeds");
		elseif secondChance == 2 then
            player:getInventory():AddItem("Hydrocraft.HCJuteseeds");	
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl6+floraLvl7+floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(3);
        if secondChance == 0 then
            player:getInventory():AddItem("Base.MushroomGeneric3");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Base.MushroomGeneric5");
        elseif secondChance == 2 then
            player:getInventory():AddItem("Base.Log");
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl5+floraLvl6+floraLvl7+floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(2)
        if secondChance == 0 then
            player:getInventory():AddItem("Hydrocraft.MushroomGeneric7");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Hydrocraft.MushroomGeneric6");
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl4+floraLvl5+floraLvl6+floraLvl7+floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(4);
        if secondChance == 0 then
            player:getInventory():AddItem("Base.MushroomGeneric1");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Base.MushroomGeneric2");
        elseif secondChance == 2 then
            player:getInventory():AddItem("Base.MushroomGeneric4");
        elseif secondChance == 3 then
            player:getInventory():AddItem("Base.Rosehips");
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl3+floraLvl4+floraLvl5+floraLvl6+floraLvl7+floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(6);
        if secondChance == 0 then
            player:getInventory():AddItem("Hydrocraft.HCCandleberry");	
        elseif secondChance == 1 then
            player:getInventory():AddItem("Hydrocraft.HCMulberry");
        elseif secondChance == 2 then
            player:getInventory():AddItem("Hydrocraft.HCMulberryleaf");
        elseif secondChance == 3 then
            player:getInventory():AddItem("Hydrocraft.HCValerian");	
        elseif secondChance == 4 then
            player:getInventory():AddItem("Hydrocraft.HCHuckleberry");		
        elseif secondChance == 5 then
            player:getInventory():AddItem("Hydrocraft.HCCranberry");					
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl2+floraLvl3+floraLvl4+floraLvl5+floraLvl6+floraLvl7+floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(10);
        if secondChance == 0 then
            player:getInventory():AddItem("Base.BerryBlack");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Base.BerryBlue");
        elseif secondChance == 2 then
            player:getInventory():AddItem("Base.BerryPoisonIvy");
        elseif secondChance == 3 then
            player:getInventory():AddItem("Base.BerryGeneric2");
        elseif secondChance == 4 then
            player:getInventory():AddItem("Base.BerryGeneric5");
		elseif secondChance == 5 then
            player:getInventory():AddItem("Base.GrapeLeaves");
        elseif secondChance == 6 then
            player:getInventory():AddItem("Hydrocraft.HCFircone");	
        elseif secondChance == 7 then
            player:getInventory():AddItem("Hydrocraft.HCAcorn");
        elseif secondChance == 8 then
            player:getInventory():AddItem("Hydrocraft.HCHickorynuts");
        elseif secondChance == 9 then
            player:getInventory():AddItem("Hydrocraft.HCReeds");				
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl1+floraLvl2+floraLvl3+floraLvl4+floraLvl5+floraLvl6+floraLvl7+floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(5);
        if secondChance == 0 then
            player:getInventory():AddItem("Hydrocraft.HCHickoryleaves");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Hydrocraft.HCOakleaves");	
        elseif secondChance == 2 then
            player:getInventory():AddItem("Hydrocraft.HCWillowbranch");	
        elseif secondChance == 3 then
            player:getInventory():AddItem("Hydrocraft.HCPinebough");
        elseif secondChance == 4 then
            player:getInventory():AddItem("Hydrocraft.HCFirbough");				
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= floraLvl0+floraLvl1+floraLvl2+floraLvl3+floraLvl4+floraLvl5+floraLvl6+floraLvl7+floraLvl8+floraLvl9+floraLvl10 then
        secondChance = ZombRand(11);
        if secondChance == 0 then
            player:getInventory():AddItem("Base.BerryGeneric1");
        elseif secondChance == 1 then
            player:getInventory():AddItem("Base.BerryGeneric3");
        elseif secondChance == 2 then
            player:getInventory():AddItem("Base.BerryGeneric4");
		elseif secondChance == 3 then
            player:getInventory():AddItem("Base.Violets");
        elseif secondChance == 4 then
            player:getInventory():AddItem("Base.TreeBranch");
        elseif secondChance == 5 then
            player:getInventory():AddItem("Base.Twigs");
        elseif secondChance == 6 then
            player:getInventory():AddItem("Hydrocraft.HCGrass");
        elseif secondChance == 7 then
            player:getInventory():AddItem("Hydrocraft.HCStraw");	
        elseif secondChance == 8 then
            player:getInventory():AddItem("Hydrocraft.HCBark");	
        elseif secondChance == 9 then
            player:getInventory():AddItem("Hydrocraft.HCBirchbark");
        elseif secondChance == 10 then
            player:getInventory():AddItem("Hydrocraft.HCWillowbark");			
        end
		player:getXp():AddXP(Perks.PlantScavenging, 10);
    elseif chance <= nothing+floraLvl0+floraLvl1+floraLvl2+floraLvl3+floraLvl4+floraLvl5+floraLvl6+floraLvl7+floraLvl8+floraLvl9+floraLvl10 and nothing > 0 then
        player:Say("I found nothing!");
    end
end


