oh yeah woo yeah
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

241 lines
7.7 KiB

using System;
using System.Text;
using Newtonsoft.Json;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace Kehyeedra3.Services.Models
{
public class Farming
{
[Key]
public ulong Id { get; set; } = 0;
public int Tier { get; set; } = 0;
public int EmployeeCount { get; set; } = 0;
public ulong Lvl { get; set; } = 0;
public ulong Xp { get; set; } = 50;
public ulong FXp { get; set; } = 0;
public ulong TXp { get; set; } = 0;
[Column(TypeName = "LONGTEXT")]
public string CropInventory { get; set; } = "{}";
[Column(TypeName = "LONGTEXT")]
public string PlotInventory { get; set; } = "{}";
public Dictionary<FarmCrop, int[]> GetCropInventory()
{
return JsonConvert.DeserializeObject<Dictionary<FarmCrop, int[]>>(CropInventory);
}
public Dictionary<FarmLand, int[]> GetPlotInventory()
{
return JsonConvert.DeserializeObject<Dictionary<FarmLand, int[]>>(PlotInventory);
}
public void SetCropInventory(Dictionary<FarmCrop, int[]> inv)
{
Dictionary<int, int[]> temp = new Dictionary<int, int[]>();
foreach (var entry in inv)
{
temp.Add((int)entry.Key, entry.Value);
}
CropInventory = JsonConvert.SerializeObject(temp);
}
public void SetPlotInventory(Dictionary<FarmLand, int[]> inv)
{
Dictionary<int, int[]> temp = new Dictionary<int, int[]>();
foreach (var entry in inv)
{
temp.Add((int)entry.Key, entry.Value);
}
PlotInventory = JsonConvert.SerializeObject(temp);
}
public static List<FCrop> ListCrops()
{
return new List<FCrop>
{
new FCrop()
{
Id = FarmCrop.Wheat,
Name = "Wheat",
Description = "Common wheat, 'Triticum aestivum' is the most widely grown cereal grain, you should get in on it before we reach peak wheat.",
Type = FarmType.Plant,
Tier = FarmTier.T0,
GrowTime = 10,
Price = 100,
},
new FCrop()
{
Id = FarmCrop.Rye,
Name = "Rye",
Description = "Rye, 'Secale cereale' is a hardy cereal grain, grows slower than wheat, but also tastes better.",
Type = FarmType.Plant,
Tier = FarmTier.T1,
GrowTime = 15,
Price = 150,
},
new FCrop()
{
Id = FarmCrop.Lettuce,
Name = "Lettuce",
Description = "Lettuce, 'Lactuca sativa' is an annual daisy plant first cultivated in ancient Egypt, worshipped as ancient viagra. Incidentally, it can be harvested very often.",
Type = FarmType.Plant,
Tier = FarmTier.T2,
GrowTime = 5,
Price = 200,
},
new FCrop()
{
Id = FarmCrop.Leek,
Name = "Leek",
Description = "Leek, 'Allium ampeloprasum' is an onion, the word leek is derived from the old english word 'leac', it has a medium growth time. I know what you're thinking about doing and I want you to stop right now.",
Type = FarmType.Plant,
Tier = FarmTier.T3,
GrowTime = 13,
Price = 250,
},
new FCrop()
{
Id = FarmCrop.Bookweed,
Name = "Bookweed",
Description = "Bookweed, 'Lactuca liber' is an enchanted variant of lettuce used for special crafting. Eating it by itself is said to give you diarrhea.",
Type = FarmType.Plant,
Tier = FarmTier.T4,
GrowTime = 50,
Price = 0,
},
new FCrop()
{
Id = FarmCrop.LuckyLeek,
Name = "Polkka",
Description = "Polkka, 'Allium dexter' is an enchanted variant of leek used for special crafting. It contains a natural power to spin, and can be used as a green energy source. If you're a huge faggot.",
Type = FarmType.Plant,
Tier = FarmTier.T5,
GrowTime = 50,
Price = 0,
},
};
}
public static List<FLand> ListFarmLand()
{
return new List<FLand>
{
new FLand()
{
Id = FarmLand.Backyard,
Name = "Backyard",
Type = FarmType.Plant,
Tier = FarmTier.T0,
WorkerMax = 1,
Price = 0
},
new FLand()
{
Id = FarmLand.SPlot,
Name = "Small Plot",
Type = FarmType.Plant,
Tier = FarmTier.T1,
WorkerMax = 2,
Price = 600
},
new FLand()
{
Id = FarmLand.MPlot,
Name = "Medium Plot",
Type = FarmType.Plant,
Tier = FarmTier.T3,
WorkerMax = 4,
Price = 1000
},
new FLand()
{
Id = FarmLand.LPlot,
Name = "Large Plot",
Type = FarmType.Plant,
Tier = FarmTier.T5,
WorkerMax = 6,
Price = 1400
},
};
}
}
public enum FarmLand
{
Backyard = 0,
Bathtub = 1,
SPlot = 2,
MPlot = 3,
LPlot = 4,
}
public enum FarmType
{
Plant = 0,
Fish = 1,
}
public enum FarmCrop
{
Wheat = 0,
Rye = 1,
Lettuce = 2,
Leek = 3,
LuckyLeek = 100,
Bookweed = 101,
}
public enum FarmTier
{
T0 = 0,
T1 = 1,
T2 = 2,
T3 = 3,
T4 = 4,
T5 = 5,
}
public class FLand
{
public FarmLand Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public FarmType Type { get; set; }
public FarmTier Tier { get; set; }
public int WorkerMax { get; set; }
public int Price { get; set; }
}
public class FCrop
{
public FarmCrop Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public FarmType Type { get; set; }
public FarmTier Tier { get; set; }
public int GrowTime { get; set; }
public int Price { get; set; }
}
public class PlotObject
{
[Key]
public ulong PlotId { get; set; } = 0;
[Required]
public ulong UserId { get; set; } = 0;
public ulong Planted { get; set; } = 0;
public ulong Grown { get; set; } = 0;
public int FarmType { get; set; } = 0;
public int WorkerAmount { get; set; } = 0;
}
public class FCropSlot
{
public int Id;
public int Seeds;
public int Produce;
}
public class FPlotSlot
{
public int Id;
public int Amount;
}
}