Elin Modding Docs Doc
Loading...
Searching...
No Matches
TraitBrewery.cs
1using System;
2using System.Collections.Generic;
3
4// Token: 0x020003A2 RID: 930
6{
7 // Token: 0x17000852 RID: 2130
8 // (get) Token: 0x06001BDC RID: 7132 RVA: 0x000A87E4 File Offset: 0x000A69E4
9 public override int DecaySpeedChild
10 {
11 get
12 {
13 return 500;
14 }
15 }
16
17 // Token: 0x17000853 RID: 2131
18 // (get) Token: 0x06001BDD RID: 7133 RVA: 0x000A87EB File Offset: 0x000A69EB
19 public virtual string idMsg
20 {
21 get
22 {
23 return "brew";
24 }
25 }
26
27 // Token: 0x17000854 RID: 2132
28 // (get) Token: 0x06001BDE RID: 7134 RVA: 0x000A87F2 File Offset: 0x000A69F2
29 public virtual TraitBrewery.Type type
30 {
31 get
32 {
33 return TraitBrewery.Type.Drink;
34 }
35 }
36
37 // Token: 0x17000855 RID: 2133
38 // (get) Token: 0x06001BDF RID: 7135 RVA: 0x000A87F5 File Offset: 0x000A69F5
39 public virtual bool IsFood
40 {
41 get
42 {
43 return false;
44 }
45 }
46
47 // Token: 0x06001BE0 RID: 7136 RVA: 0x000A87F8 File Offset: 0x000A69F8
48 public override bool CanChildDecay(Card c)
49 {
50 string id = c.id;
51 return !(id == "48") && !(id == "cheese") && !(id == "jerky") && (c.trait is TraitDrinkMilk || c.material.id == 94);
52 }
53
54 // Token: 0x06001BE1 RID: 7137 RVA: 0x000A8854 File Offset: 0x000A6A54
55 public override bool OnChildDecay(Card c)
56 {
57 TraitBrewery.Type type = this.type;
58 if (type > TraitBrewery.Type.Drink)
59 {
60 if (type != TraitBrewery.Type.Fertilizer)
61 {
62 }
63 }
64 else
65 {
66 if (!c.IsFood && !(c.trait is TraitDrinkMilk))
67 {
68 return true;
69 }
70 if (c.category.IsChildOf("meal"))
71 {
72 return true;
73 }
74 }
75 string productID = this.GetProductID(c);
76 if (productID == null)
77 {
78 return true;
79 }
80 Thing thing = c.Duplicate(c.Num);
81 c.Destroy();
82 if (this.type == TraitBrewery.Type.Food)
83 {
84 c = CraftUtil.MixIngredients(productID, new List<Thing>
85 {
86 c.Thing
87 }, CraftUtil.MixType.Food, 0).SetNum(thing.Num);
88 }
89 else
90 {
91 c = ThingGen.Create(productID, -1, -1).SetNum(thing.Num);
92 }
93 if (this.type != TraitBrewery.Type.Fertilizer)
94 {
95 c.MakeFoodRef(thing, null);
96 }
97 if (this.type == TraitBrewery.Type.Drink)
98 {
99 c.c_priceAdd = thing.GetValue(false) * 125 / 100;
100 }
101 this.OnProduce(c);
102 this.owner.AddThing(c.Thing, false, -1, -1);
103 this.owner.GetRootCard().Say(this.idMsg, thing, c, null, null);
104 return false;
105 }
106
107 // Token: 0x06001BE2 RID: 7138 RVA: 0x000A8968 File Offset: 0x000A6B68
108 public virtual string GetProductID(Card c)
109 {
110 string id = c.id;
111 if (id == "crim" || id == "drug_crim")
112 {
113 return "crimAle";
114 }
115 if (c.category.IsChildOf("mushroom") || c.category.IsChildOf("nuts"))
116 {
117 return "54";
118 }
119 return "48";
120 }
121
122 // Token: 0x06001BE3 RID: 7139 RVA: 0x000A89CB File Offset: 0x000A6BCB
123 public virtual void OnProduce(Card c)
124 {
125 }
126
127 // Token: 0x020009A6 RID: 2470
128 public enum Type
129 {
130 // Token: 0x04002833 RID: 10291
131 Food,
132 // Token: 0x04002834 RID: 10292
133 Drink,
134 // Token: 0x04002835 RID: 10293
135 Fertilizer
136 }
137}
Definition Card.cs:13
Definition Thing.cs:10