Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
FactionRelation.cs
Go to the documentation of this file.
1using Newtonsoft.Json;
2using UnityEngine;
3
4public class FactionRelation : EClass
5{
6 public enum RelationType
7 {
9 Owner,
10 Member
11 }
12
13 [JsonProperty]
14 public int affinity;
15
16 [JsonProperty]
17 public int exp;
18
19 [JsonProperty]
20 public int rank;
21
22 [JsonProperty]
24
26
27 public int ExpToNext => 100 + rank * rank * 100;
28
29 public int MaxRank => 5;
30
31 public string TextTitle => Lang.GetList("guild_title")[Mathf.Min(rank / 2, 5)];
32
33 public int GetSalary()
34 {
35 if (type != RelationType.Member)
36 {
37 return 0;
38 }
39 return rank * 100;
40 }
41
42 public string GetTextRelation()
43 {
44 return ("faction_" + type).lang();
45 }
46
47 public void SetTextHostility(UIText text)
48 {
49 if (IsMember() || affinity > 100)
50 {
51 text.SetText("reFriend".lang(), FontColor.Good);
52 }
53 else if (affinity < -100)
54 {
55 text.SetText("reEnemy".lang(), FontColor.Bad);
56 }
57 else
58 {
59 text.SetText("reNeutral".lang(), FontColor.Passive);
60 }
61 }
62
63 public bool IsMember()
64 {
65 if (type != RelationType.Member)
66 {
67 return type == RelationType.Owner;
68 }
69 return true;
70 }
71
72 public void Promote()
73 {
74 exp -= ExpToNext;
75 rank++;
76 Msg.Say("faction_promote");
77 SE.Play("questComplete");
78 }
79}
FontColor
Definition: FontColor.cs:2
Definition: EClass.cs:5
void SetTextHostility(UIText text)
string GetTextRelation()
RelationType type
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
Definition: UIText.cs:6
void SetText(string s)
Definition: UIText.cs:159