Elin Modding Docs Doc
Loading...
Searching...
No Matches
HomeResourceWorth.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4using UnityEngine;
5
6// Token: 0x02000085 RID: 133
8{
9 // Token: 0x170000B6 RID: 182
10 // (get) Token: 0x060003AD RID: 941 RVA: 0x0001A288 File Offset: 0x00018488
11 public override bool IsAvailable
12 {
13 get
14 {
15 return false;
16 }
17 }
18
19 // Token: 0x060003AE RID: 942 RVA: 0x0001A28C File Offset: 0x0001848C
20 public void UpdateRank()
21 {
22 int rank = EClass.game.spatials.ranks.GetRank(this.branch.owner);
23 if (this.bestRank == 0)
24 {
25 this.bestRank = rank;
26 }
27 if (rank < this.bestRank)
28 {
29 this.bestRank = rank;
30 EClass.Sound.Play((rank <= 50) ? "clap3" : ((rank <= 100) ? "clap2" : "clap1"));
31 Msg.Say("homerank_up", EClass.game.spatials.ranks.GetRankText(this.branch.owner), null, null, null);
32 }
33 }
34
35 // Token: 0x060003AF RID: 943 RVA: 0x0001A32D File Offset: 0x0001852D
36 public override void Refresh()
37 {
38 base.Refresh();
39 this.UpdateRank();
40 }
41
42 // Token: 0x060003B0 RID: 944 RVA: 0x0001A33C File Offset: 0x0001853C
43 public int GetPrice(Thing t, bool top = false)
44 {
45 int num = t.GetPrice(CurrencyType.Money, false, PriceType.Default, null);
46 if (t.noSell)
47 {
48 num /= 50;
49 }
50 if (top && this.branch.policies.IsActive(2821, -1))
51 {
52 num = num * (150 + (int)Mathf.Sqrt((float)this.branch.Evalue(2821)) * 5) / 100;
53 }
54 return num;
55 }
56
57 // Token: 0x060003B1 RID: 945 RVA: 0x0001A3A4 File Offset: 0x000185A4
58 public override int GetDestValue()
59 {
60 List<Thing> list = this.ListHeirloom();
61 int num = 0;
62 foreach (Thing thing in list)
63 {
64 num += this.GetPrice(thing, list[0] == thing);
65 }
66 return num;
67 }
68
69 // Token: 0x060003B2 RID: 946 RVA: 0x0001A40C File Offset: 0x0001860C
70 public List<Thing> ListHeirloom()
71 {
72 List<Thing> list = new List<Thing>();
73 List<Thing> list2 = new List<Thing>();
74 HashSet<string> hashSet = new HashSet<string>();
75 int[] array = new int[EClass._map.SizeXZ];
76 int num = 0;
77 int num2 = this.branch.Evalue(2814);
78 int num3 = this.branch.Evalue(2823);
79 foreach (Thing thing in EClass._map.things)
80 {
81 if (thing.IsInstalled)
82 {
83 if (thing.HasTag(CTAG.tourism))
84 {
85 bool flag = thing.trait is TraitFigure;
86 if (flag)
87 {
88 if (array[thing.pos.index] != 0)
89 {
90 continue;
91 }
92 array[thing.pos.index]++;
93 }
94 int num4 = 1;
95 string item;
96 if (flag)
97 {
98 item = "figure_" + thing.c_idRefCard;
99 num4 = 2;
100 }
101 else
102 {
103 item = thing.id + "_" + thing.idSkin.ToString();
104 }
105 if (!hashSet.Contains(item))
106 {
107 int num5 = this.GetPrice(thing, false) * num4;
108 if (num3 > 0)
109 {
110 num5 = num5 * (110 + (int)Mathf.Sqrt((float)num3) * 4) / 100;
111 }
112 num += num5;
113 hashSet.Add(item);
114 }
115 else if (num2 > 0)
116 {
117 int num6 = this.GetPrice(thing, false) * num4 / Mathf.Max(20, 30 - (int)Mathf.Sqrt((float)num2));
118 if (num6 > 0)
119 {
120 num += num6;
121 }
122 }
123 }
124 if (thing.IsFurniture || thing.trait is TraitToolMusic)
125 {
126 list2.Add(thing);
127 }
128 }
129 }
130 int num7 = this.branch.Evalue(3780) + this.branch.Evalue(3781) + this.branch.Evalue(3782) + this.branch.Evalue(3783) + this.branch.Evalue(3784);
131 this.branch.tourism = (100 + num) * (100 + num7 * 15) / 100;
132 list2.Sort((Thing a, Thing b) => this.GetPrice(b, false) - this.GetPrice(a, false));
133 int num8 = 0;
134 while (num8 < this.branch.NumHeirloom && num8 < list2.Count)
135 {
136 list.Add(list2[num8]);
137 num8++;
138 }
139 return list;
140 }
141
142 // Token: 0x060003B3 RID: 947 RVA: 0x0001A6AC File Offset: 0x000188AC
143 public override void WriteNote(UINote n)
144 {
145 n.Clear();
146 n.AddHeader(base.Name, null);
147 n.AddTopic("TopicLeft", "vCurrent".lang(), this.value.ToFormat() ?? "");
148 n.AddTopic("TopicLeft", "tourism_value".lang(), this.branch.tourism.ToFormat() ?? "");
149 n.Space(0, 1);
150 n.AddHeader("HeaderTopic", "heirloom_list".lang(this.branch.NumHeirloom.ToString() ?? "", null, null, null, null), null);
151 n.Space(1, 1);
152 List<Thing> list = this.ListHeirloom();
153 for (int i = 0; i < list.Count; i++)
154 {
155 Thing thing = list[i];
156 string str = (i + 1).ToString();
157 string str2 = ": ";
158 string name = thing.Name;
159 object obj = EClass.debug.showExtra ? this.GetPrice(thing, i == 0) : "";
160 n.AddText(str + str2 + name + ((obj != null) ? obj.ToString() : null), FontColor.DontChange);
161 }
162 n.Build();
163 }
164
165 // Token: 0x040005A5 RID: 1445
166 [JsonProperty]
167 public int bestRank;
168}
Definition Msg.cs:7
Definition Thing.cs:10