Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
HomeResourceWorth Class Reference
Inheritance diagram for HomeResourceWorth:
HomeResourceRate BaseHomeResource EClass

Public Member Functions

void UpdateRank ()
 
override void Refresh ()
 
int GetPrice (Thing t, bool top=false)
 
override int GetDestValue ()
 
List< ThingListHeirloom ()
 
override void WriteNote (UINote n)
 
- Public Member Functions inherited from HomeResourceRate
override void Refresh ()
 
override void OnAdvanceDay ()
 
virtual int GetDestValue ()
 
- Public Member Functions inherited from BaseHomeResource
virtual T Create< T > (HomeResourceType _type, int _value)
 
virtual void Mod (int a, bool popText=true)
 
virtual void Refresh ()
 
void OnRefreshEffect ()
 
virtual void OnAdvanceHour ()
 
virtual void OnAdvanceDay ()
 
virtual void WriteNote (UINote n)
 

Public Attributes

int bestRank
 
- Public Attributes inherited from BaseHomeResource
HomeResourceType type
 
int value
 
int lastValue
 
FactionBranch branch
 

Properties

override bool IsAvailable [get]
 
- Properties inherited from HomeResourceRate
override bool IsAvailable [get]
 
override ResourceGroup Group [get]
 
- Properties inherited from BaseHomeResource
SourceHomeResource.Row source [get]
 
virtual int Min [get]
 
virtual int Max [get]
 
bool IsCurrency [get]
 
bool IsRate [get]
 
bool IsSkill [get]
 
virtual bool IsAvailable [get]
 
virtual float ExpRatio [get]
 
virtual ResourceGroup Group [get]
 
string Name [get]
 
Sprite Sprite [get]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Additional Inherited Members

- Public Types inherited from BaseHomeResource
enum  ResourceGroup { Currency , Skill , Rate , None }
 
- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 6 of file HomeResourceWorth.cs.

Member Function Documentation

◆ GetDestValue()

override int HomeResourceWorth.GetDestValue ( )
inlinevirtual

Reimplemented from HomeResourceRate.

Definition at line 48 of file HomeResourceWorth.cs.

49 {
50 List<Thing> list = ListHeirloom();
51 int num = 0;
52 foreach (Thing item in list)
53 {
54 num += GetPrice(item, list[0] == item);
55 }
56 return num;
57 }
List< Thing > ListHeirloom()
int GetPrice(Thing t, bool top=false)
Definition: Thing.cs:8

References GetPrice(), item, and ListHeirloom().

◆ GetPrice()

int HomeResourceWorth.GetPrice ( Thing  t,
bool  top = false 
)
inline

Definition at line 34 of file HomeResourceWorth.cs.

35 {
36 int num = t.GetPrice(CurrencyType.Money, sell: false, PriceType.Tourism);
37 if (t.noSell)
38 {
39 num /= 50;
40 }
41 if (top && branch.policies.IsActive(2821))
42 {
43 num = (int)((long)num * (long)(150 + (int)Mathf.Sqrt(branch.Evalue(2821)) * 5) / 100);
44 }
45 return num;
46 }
CurrencyType
Definition: CurrencyType.cs:2
PriceType
Definition: PriceType.cs:2
FactionBranch branch
bool noSell
Definition: Card.cs:802
virtual int GetPrice(CurrencyType currency=CurrencyType.Money, bool sell=false, PriceType priceType=PriceType.Default, Chara c=null)
Definition: Card.cs:6449
int Evalue(int ele)
PolicyManager policies
bool IsActive(int id, int days=-1)

References BaseHomeResource.branch, FactionBranch.Evalue(), Card.GetPrice(), PolicyManager.IsActive(), Card.noSell, and FactionBranch.policies.

Referenced by GetDestValue(), ListHeirloom(), and WriteNote().

◆ ListHeirloom()

List< Thing > HomeResourceWorth.ListHeirloom ( )
inline

Definition at line 59 of file HomeResourceWorth.cs.

60 {
61 List<Thing> list = new List<Thing>();
62 List<Thing> list2 = new List<Thing>();
63 HashSet<string> hashSet = new HashSet<string>();
64 int[] array = new int[EClass._map.SizeXZ];
65 long num = 0L;
66 int num2 = branch.Evalue(2814);
67 int num3 = branch.Evalue(2823);
68 List<Thing> list3 = EClass._map.things.Where((Thing t) => t.IsInstalled && t.HasTag(CTAG.tourism)).ToList();
69 foreach (Thing item in list3)
70 {
71 item.sortVal = GetPrice(item);
72 }
73 list3.Sort((Thing a, Thing b) => b.sortVal - a.sortVal);
74 foreach (Thing item2 in list3)
75 {
76 bool flag = item2.trait is TraitFigure;
77 if (flag)
78 {
79 if (array[item2.pos.index] != 0)
80 {
81 continue;
82 }
83 array[item2.pos.index]++;
84 }
85 string text = "";
86 int num4 = 1;
87 if (flag)
88 {
89 text = "figure_" + item2.c_idRefCard;
90 num4 = 2;
91 }
92 else
93 {
94 text = item2.id + "_" + item2.idSkin;
95 }
96 if (!hashSet.Contains(text))
97 {
98 int num5 = item2.sortVal * num4;
99 if (num3 > 0)
100 {
101 num5 = num5 * (110 + (int)Mathf.Sqrt(num3) * 4) / 100;
102 }
103 num += num5;
104 hashSet.Add(text);
105 }
106 else if (num2 > 0)
107 {
108 int num6 = item2.sortVal * num4 / Mathf.Max(20, 30 - (int)Mathf.Sqrt(num2));
109 if (num6 > 0)
110 {
111 num += num6;
112 }
113 }
114 }
115 foreach (Thing thing in EClass._map.things)
116 {
117 if (thing.IsInstalled && (thing.IsFurniture || thing.trait is TraitToolMusic))
118 {
119 list2.Add(thing);
120 }
121 }
122 int num7 = branch.Evalue(3780) + branch.Evalue(3781) + branch.Evalue(3782) + branch.Evalue(3783) + branch.Evalue(3784);
123 num = (100 + num) * (100 + num7 * 15) / 100;
124 branch.tourism = (int)num;
125 list2.Sort((Thing a, Thing b) => GetPrice(b) - GetPrice(a));
126 for (int i = 0; i < branch.NumHeirloom && i < list2.Count; i++)
127 {
128 list.Add(list2[i]);
129 }
130 return list;
131 }
CTAG
Definition: CTAG.cs:2
bool IsFurniture
Definition: Card.cs:2111
bool HasTag(CTAG tag)
Definition: Card.cs:2455
Point pos
Definition: Card.cs:55
int sortVal
Definition: Card.cs:97
Trait trait
Definition: Card.cs:49
bool IsInstalled
Definition: Card.cs:2241
int idSkin
Definition: Card.cs:346
string c_idRefCard
Definition: Card.cs:1637
Definition: EClass.cs:5
static Map _map
Definition: EClass.cs:18
int SizeXZ
Definition: Map.cs:133
List< Thing > things
Definition: Map.cs:49
int index
Definition: Point.cs:49

References EClass._map, BaseHomeResource.branch, Card.c_idRefCard, FactionBranch.Evalue(), GetPrice(), Card.HasTag(), Card.idSkin, Point.index, Card.IsFurniture, Card.IsInstalled, item, Card.pos, Map.SizeXZ, Card.sortVal, Map.things, and Card.trait.

Referenced by GetDestValue(), and WriteNote().

◆ Refresh()

override void HomeResourceWorth.Refresh ( )
inlinevirtual

Reimplemented from HomeResourceRate.

Definition at line 28 of file HomeResourceWorth.cs.

29 {
30 base.Refresh();
31 UpdateRank();
32 }

References UpdateRank().

◆ UpdateRank()

void HomeResourceWorth.UpdateRank ( )
inline

Definition at line 13 of file HomeResourceWorth.cs.

14 {
16 if (bestRank == 0)
17 {
18 bestRank = rank;
19 }
20 if (rank < bestRank)
21 {
22 bestRank = rank;
23 EClass.Sound.Play((rank <= 50) ? "clap3" : ((rank <= 100) ? "clap2" : "clap1"));
25 }
26 }
static Game game
Definition: EClass.cs:8
static SoundManager Sound
Definition: EClass.cs:46
SpatialManager spatials
Definition: Game.cs:152
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
string GetRankText(Zone z)
RankedZoneManager ranks

References bestRank, BaseHomeResource.branch, EClass.game, RankedZoneManager.GetRank(), RankedZoneManager.GetRankText(), FactionBranch.owner, SpatialManager.ranks, Msg.Say(), EClass.Sound, and Game.spatials.

Referenced by Refresh().

◆ WriteNote()

override void HomeResourceWorth.WriteNote ( UINote  n)
inlinevirtual

Reimplemented from BaseHomeResource.

Definition at line 133 of file HomeResourceWorth.cs.

134 {
135 n.Clear();
136 n.AddHeader(base.Name);
137 n.AddTopic("TopicLeft", "vCurrent".lang(), value.ToFormat() ?? "");
138 n.AddTopic("TopicLeft", "tourism_value".lang(), branch.tourism.ToFormat() ?? "");
139 n.Space();
140 n.AddHeader("HeaderTopic", "heirloom_list".lang(branch.NumHeirloom.ToString() ?? ""));
141 n.Space(1);
142 List<Thing> list = ListHeirloom();
143 for (int i = 0; i < list.Count; i++)
144 {
145 Thing thing = list[i];
146 n.AddText(i + 1 + ": " + thing.Name + (EClass.debug.showExtra ? ((object)GetPrice(thing, i == 0)) : ""));
147 }
148 n.Build();
149 }
string Name
Definition: Card.cs:2013
bool showExtra
Definition: CoreDebug.cs:167
static CoreDebug debug
Definition: EClass.cs:48
void Clear()
Definition: UINote.cs:35
UIItem AddHeader(string text, Sprite sprite=null)
Definition: UINote.cs:79
UIItem AddTopic(string id, string text, string value=null)
Definition: UINote.cs:144
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
void Build()
Definition: UINote.cs:49

References UINote.AddHeader(), UINote.AddText(), UINote.AddTopic(), BaseHomeResource.branch, UINote.Build(), UINote.Clear(), EClass.debug, GetPrice(), ListHeirloom(), Card.Name, FactionBranch.NumHeirloom, CoreDebug.showExtra, UINote.Space(), FactionBranch.tourism, and BaseHomeResource.value.

Referenced by UIHomeInfo.RefreshInfo().

Member Data Documentation

◆ bestRank

int HomeResourceWorth.bestRank

Definition at line 9 of file HomeResourceWorth.cs.

Referenced by TraitCoreZone.TrySetAct(), and UpdateRank().

Property Documentation

◆ IsAvailable

override bool HomeResourceWorth.IsAvailable
get

Definition at line 11 of file HomeResourceWorth.cs.


The documentation for this class was generated from the following file: