Elin Modding Docs Doc
Loading...
Searching...
No Matches
GameLang.cs
1using System;
2using System.Text;
3
4// Token: 0x020000AD RID: 173
5public class GameLang : EClass
6{
7 // Token: 0x060004AA RID: 1194 RVA: 0x0001FC24 File Offset: 0x0001DE24
8 public static string ConvertDrama(string text, Chara c = null)
9 {
10 if (!EClass.core.IsGameStarted)
11 {
12 return text;
13 }
14 StringBuilder stringBuilder = new StringBuilder();
15 string newValue = "";
16 string newValue2 = "";
17 string name = EClass.game.religions.GetRandomReligion(false, false).Name;
18 string @ref = "-";
19 if (c != null)
20 {
21 newValue = c.NameBraced;
22 newValue2 = (c.IsMale ? "his" : "her").lang();
23 name = c.faith.Name;
24 @ref = (CalcGold.Hire(c).ToString() ?? "");
25 }
26 bool flag = false;
27 string text2 = "";
28 for (int i = 0; i < text.Length; i++)
29 {
30 if (flag)
31 {
32 if (text[i] == ']')
33 {
34 flag = false;
35 if (text2 == "qFriend" && EClass._zone.IsPCFaction)
36 {
37 text2 = "qFriendHome";
38 }
39 string[] list = Lang.GetList(text2);
40 if (list != null)
41 {
42 stringBuilder.Append(list.RandomItem<string>());
43 }
44 else
45 {
46 stringBuilder.Append(text2);
47 }
48 }
49 else
50 {
51 text2 += text[i].ToString();
52 }
53 }
54 else if (text[i] == '[')
55 {
56 text2 = "";
57 flag = true;
58 }
59 else
60 {
61 stringBuilder.Append(text[i]);
62 }
63 }
64 if (DramaManager.TG != null)
65 {
66 stringBuilder.Replace("#tg", DramaManager.TG.Name);
67 }
68 if (DramaChoice.lastChoice != null)
69 {
70 stringBuilder.Replace("#last_choice", DramaChoice.lastChoice.text);
71 }
72 stringBuilder.Replace("#newline", Environment.NewLine);
73 stringBuilder.Replace("#costHire", "costHire".lang(@ref, null, null, null, null));
74 stringBuilder.Replace("#self", newValue);
75 stringBuilder.Replace("#his", newValue2);
76 stringBuilder.Replace("#me", newValue);
77 stringBuilder.Replace("#1", GameLang.refDrama1);
78 stringBuilder.Replace("#2", GameLang.refDrama2);
79 stringBuilder.Replace("#3", GameLang.refDrama3);
80 stringBuilder.Replace("#4", GameLang.refDrama4);
81 stringBuilder.Replace("#god", name);
82 stringBuilder.Replace("#player", EClass.player.title);
83 stringBuilder.Replace("#title", EClass.player.title);
84 stringBuilder.Replace("#zone", EClass._zone.Name);
85 stringBuilder.Replace("#guild_title", Guild.Current.relation.TextTitle);
86 stringBuilder.Replace("#guild", Guild.Current.Name);
87 stringBuilder.Replace("#pc", EClass.pc.NameSimple);
88 stringBuilder.Replace("#aka", EClass.pc.Aka);
89 stringBuilder.Replace("#bigdaddy", "bigdaddy".lang());
90 stringBuilder.Replace("#festival", EClass._zone.IsFestival ? (EClass._zone.id + "_festival").lang() : "_festival".lang());
91 stringBuilder.Replace("#brother2", (EClass.pc.IsMale ? "brother" : "sister").lang());
92 stringBuilder.Replace("#brother", Lang.GetList(EClass.pc.IsMale ? "bro" : "sis").RandomItem<string>());
93 stringBuilder.Replace("#onii", Lang.GetList(EClass.pc.IsMale ? "onii" : "onee").RandomItem<string>());
94 stringBuilder.Replace("#gender", Lang.GetList("gendersDrama")[EClass.pc.bio.gender]);
95 stringBuilder.Replace("#he", ((EClass.pc.bio.gender == 2) ? "he" : "she").lang());
96 stringBuilder.Replace("#He", ((EClass.pc.bio.gender == 2) ? "he" : "she").lang().ToTitleCase(false));
97 return GameLang.Convert(stringBuilder);
98 }
99
100 // Token: 0x060004AB RID: 1195 RVA: 0x00020063 File Offset: 0x0001E263
101 public static string Convert(string text)
102 {
103 StringBuilder stringBuilder = new StringBuilder();
104 stringBuilder.Append(text);
105 return GameLang.Convert(stringBuilder);
106 }
107
108 // Token: 0x060004AC RID: 1196 RVA: 0x00020078 File Offset: 0x0001E278
109 public static string Convert(StringBuilder sb)
110 {
111 sb.Replace("#player", EClass.player.title);
112 sb.Replace("#pc_him", EClass.pc.IsMale ? "him".lang() : "her".lang());
113 sb.Replace("#pc_his", EClass.pc.IsMale ? "his".lang() : "her".lang());
114 sb.Replace("#pc_race", EClass.pc.race.GetName());
115 sb.Replace("#pc", EClass.pc.NameSimple);
116 return sb.ToString();
117 }
118
119 // Token: 0x060004AD RID: 1197 RVA: 0x00020130 File Offset: 0x0001E330
120 public static string Parse(string text, bool thirdPerson, string val1, string val2 = null, string val3 = null, string val4 = null)
121 {
122 StringBuilder stringBuilder = new StringBuilder(text);
123 if (val1 != null)
124 {
125 if (Lang.articlesToRemove.Count > 0)
126 {
127 string text2 = val1;
128 foreach (char[] trimChars in Lang.articlesToRemove)
129 {
130 text2 = text2.TrimStart(trimChars);
131 }
132 stringBuilder.Replace("-#1", text2);
133 }
134 stringBuilder.Replace("#1", val1 ?? "");
135 }
136 if (val2 != null)
137 {
138 if (Lang.articlesToRemove.Count > 0)
139 {
140 string text3 = val2;
141 foreach (char[] trimChars2 in Lang.articlesToRemove)
142 {
143 text3 = text3.TrimStart(trimChars2);
144 }
145 stringBuilder.Replace("-#2", text3);
146 }
147 stringBuilder.Replace("#2", val2);
148 }
149 if (val3 != null)
150 {
151 stringBuilder.Replace("#3", val3);
152 }
153 if (val4 != null)
154 {
155 stringBuilder.Replace("#4", val4);
156 }
157 int num;
158 if (int.TryParse(val1, out num))
159 {
160 stringBuilder.Replace("#(s)", (num <= 1) ? "" : "_s".lang());
161 }
162 if (Msg.thirdPerson2.active)
163 {
164 stringBuilder.Replace("#your2", Msg.thirdPerson2.your);
165 stringBuilder.Replace("#himself2", Msg.thirdPerson2.himself);
166 stringBuilder.Replace("#him2", Msg.thirdPerson2.him);
167 stringBuilder.Replace("#his2", Msg.thirdPerson2.his);
168 stringBuilder.Replace("#he2", Msg.thirdPerson2.he);
169 stringBuilder.Replace("(s2)", Msg.thirdPerson2.thirdperson ? "s" : "");
170 }
171 if (Msg.thirdPerson1.active)
172 {
173 stringBuilder.Replace("#your", Msg.thirdPerson1.your);
174 stringBuilder.Replace("#himself", Msg.thirdPerson1.himself);
175 stringBuilder.Replace("#him", Msg.thirdPerson1.him);
176 stringBuilder.Replace("#his", Msg.thirdPerson1.his);
177 stringBuilder.Replace("#he", Msg.thirdPerson1.he);
178 }
179 if (Lang.setting.thirdperson)
180 {
181 return GameLang.ConvertThirdPerson(stringBuilder.ToString(), thirdPerson);
182 }
183 return GameLang.Convert(stringBuilder);
184 }
185
186 // Token: 0x060004AE RID: 1198 RVA: 0x000203C0 File Offset: 0x0001E5C0
187 public static string ConvertThirdPerson(string text, bool thirdPerson)
188 {
189 string[] array = text.Split(' ', StringSplitOptions.None);
190 StringBuilder stringBuilder = new StringBuilder();
191 bool flag = true;
192 foreach (string text2 in array)
193 {
194 if (flag)
195 {
196 flag = false;
197 }
198 else
199 {
200 stringBuilder.Append(' ');
201 }
202 if (text2.Contains('/') && !text2.Contains('<'))
203 {
204 string[] array3 = text2.Split('/', StringSplitOptions.None);
205 stringBuilder.Append(thirdPerson ? array3[1] : array3[0]);
206 }
207 else
208 {
209 stringBuilder.Append(text2);
210 }
211 }
212 stringBuilder.Replace("(s)", thirdPerson ? "s" : "");
213 stringBuilder.Replace("(es)", thirdPerson ? "es" : "");
214 return GameLang.Convert(stringBuilder);
215 }
216
217 // Token: 0x04000637 RID: 1591
218 public static string refDrama1;
219
220 // Token: 0x04000638 RID: 1592
221 public static string refDrama2;
222
223 // Token: 0x04000639 RID: 1593
224 public static string refDrama3;
225
226 // Token: 0x0400063A RID: 1594
227 public static string refDrama4;
228}
Definition Chara.cs:12
Definition Guild.cs:5
Definition Msg.cs:7