-
Notifications
You must be signed in to change notification settings - Fork 2
/
fishvendorhotloader.cs
49 lines (37 loc) · 1.29 KB
/
fishvendorhotloader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Text;
using XRL.Language;
using XRL.Rules;
using XRL.UI;
namespace XRL.World.Parts
{
[Serializable]
[WantLoadBlueprint]
[HasGameBasedStaticCache]
public class acegiak_fishvendorhotloader: IPart
{
static bool popped = false;
public acegiak_fishvendorhotloader(){}
[GameBasedCacheInit]
public static void HotLoad(){
if(!popped){
AddToPopTable("Ingredients_MidTiers", new PopulationTable { Name = "FishIngredients", Weight = 10, Number="1" });
AddToPopTable("Tier1Wares", new PopulationObject { Blueprint = "FishingRod", Number="1", Chance="30" });
popped = true;
}
}
public static bool AddToPopTable(string table, params PopulationItem[] items) {
PopulationInfo info;
if (!PopulationManager.Populations.TryGetValue(table, out info))
return false;
// If this is a single group population, add to that group.
if (info.Items.Count == 1 && info.Items[0] is PopulationGroup) {
var group = info.Items[0] as PopulationGroup;
group.Items.AddRange(items);
return true;
}
info.Items.AddRange(items);
return true;
}
}
}