terraria-cpp2il-methodrecon v1.4.4.9
Terraria mobile dump, with reconstructed method body. Dump with CallAnalysis: https://infinitynichto.github.io/terraria-cpp2il
Loading...
Searching...
No Matches
AchievementManager.cs
Go to the documentation of this file.
1using System;
4using System.Text;
8
10{
11 // Token: 0x02000695 RID: 1685
12 public class AchievementManager
13 {
14 // Token: 0x14000043 RID: 67
15 // (add) Token: 0x06003846 RID: 14406 RVA: 0x00225620 File Offset: 0x00223820
16 // (remove) Token: 0x06003847 RID: 14407 RVA: 0x00225644 File Offset: 0x00223844
18 {
20 add
21 {
22 if (Delegate.Combine(this.OnAchievementCompleted, value) != null)
23 {
24 }
25 }
27 remove
28 {
29 if (Delegate.Remove(this.OnAchievementCompleted, value) != null)
30 {
31 }
32 }
33 }
34
35 // Token: 0x06003848 RID: 14408 RVA: 0x00225668 File Offset: 0x00223868
37 {
38 this.User = user;
39 if (this != null)
40 {
41 this._savePath = this;
42 this._isCloudSave = true;
43 return;
44 }
45 string text2;
46 string text = Main.SavePath + text2 + "achievements.dat";
50 }
51
52 // Token: 0x06003849 RID: 14409 RVA: 0x002256C0 File Offset: 0x002238C0
53 public void Save()
54 {
55 string savePath = this._savePath;
56 bool isCloudSave = this._isCloudSave;
57 this.Save(savePath, isCloudSave);
58 LocalUser user = this.User;
59 if (user != null)
60 {
61 user.SavePersistantData();
62 return;
63 }
64 }
65
66 // Token: 0x0600384A RID: 14410 RVA: 0x002256F4 File Offset: 0x002238F4
67 private void Save(string path, bool cloud)
68 {
69 if (!true)
70 {
71 }
72 byte[] cryptoKey = this._cryptoKey;
75 }
76
77 // Token: 0x0600384B RID: 14411 RVA: 0x002257EC File Offset: 0x002239EC
79 {
80 /*
81An exception occurred when decompiling this method (0600384B)
82
83ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Collections.Generic.List`1<Terraria.Achievements.Achievement> Terraria.Achievements.AchievementManager::CreateAchievementsList()
84
85 ---> System.Exception: Basic block has to end with unconditional control flow.
86{
87 Block_0:
88 stloc:class [mscorlib]System.Collections.Generic.Dictionary`2<string, class Terraria.Achievements.Achievement>(var_0_06, ldfld:class [mscorlib]System.Collections.Generic.Dictionary`2<string, class Terraria.Achievements.Achievement>(AchievementManager::_achievements, ldloc:AchievementManager(this)))
89}
90
91 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
92 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
93 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
94 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
95 --- End of inner exception stack trace ---
96 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
97 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1683
98*/;
99 }
100
101 // Token: 0x0600384C RID: 14412 RVA: 0x00225800 File Offset: 0x00223A00
102 public void Load()
103 {
104 string savePath = this._savePath;
105 bool isCloudSave = this._isCloudSave;
106 this.Load(savePath, isCloudSave);
107 LocalUser user = this.User;
108 if (user != null)
109 {
110 user.LoadPersistantData();
111 return;
112 }
113 }
114
115 // Token: 0x0600384D RID: 14413 RVA: 0x00225834 File Offset: 0x00223A34
116 private void Load(string path, bool cloud)
117 {
118 int num = 1;
119 if (num == 0)
120 {
121 }
122 if (num == 0)
123 {
124 }
125 byte[] cryptoKey = this._cryptoKey;
127 }
128
129 // Token: 0x0600384E RID: 14414 RVA: 0x002259CC File Offset: 0x00223BCC
134
135 // Token: 0x0600384F RID: 14415 RVA: 0x002259FC File Offset: 0x00223BFC
140
141 // Token: 0x06003850 RID: 14416 RVA: 0x00225A24 File Offset: 0x00223C24
143 {
144 this.Save();
146 if (onAchievementCompleted != null)
147 {
148 IntPtr invoke_impl = onAchievementCompleted.invoke_impl;
149 IntPtr method_code = onAchievementCompleted.method_code;
150 IntPtr method = onAchievementCompleted.method;
151 return;
152 }
153 }
154
155 // Token: 0x06003851 RID: 14417 RVA: 0x000021DB File Offset: 0x000003DB
157 {
158 throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
159 }
160
161 // Token: 0x06003852 RID: 14418 RVA: 0x00225A58 File Offset: 0x00223C58
166
167 // Token: 0x06003853 RID: 14419 RVA: 0x00225A6C File Offset: 0x00223C6C
169 {
170 this._achievements._version = (int)category;
171 }
172
173 // Token: 0x06003854 RID: 14420 RVA: 0x00225A88 File Offset: 0x00223C88
175 {
176 /*
177An exception occurred when decompiling this method (06003854)
178
179ICSharpCode.Decompiler.DecompilerException: Error decompiling Terraria.Achievements.Achievement Terraria.Achievements.AchievementManager::GetAchievement(System.String)
180
181 ---> System.Exception: Basic block has to end with unconditional control flow.
182{
183 Block_0:
184 stloc:class [mscorlib]System.Collections.Generic.Dictionary`2<string, class Terraria.Achievements.Achievement>(var_0_06, ldfld:class [mscorlib]System.Collections.Generic.Dictionary`2<string, class Terraria.Achievements.Achievement>(AchievementManager::_achievements, ldloc:AchievementManager(this)))
185}
186
187 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
188 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
189 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
190 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
191 --- End of inner exception stack trace ---
192 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
193 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1683
194*/;
195 }
196
197 // Token: 0x06003855 RID: 14421 RVA: 0x00225A9C File Offset: 0x00223C9C
199 {
200 AchievementCondition condition;
201 do
202 {
203 condition = this.GetCondition(achievementName, conditionName);
204 if (condition == null)
205 {
206 return;
207 }
208 }
209 while (condition != null);
210 throw new InvalidCastException();
211 }
212
213 // Token: 0x06003856 RID: 14422 RVA: 0x00225AC0 File Offset: 0x00223CC0
220
221 // Token: 0x06003857 RID: 14423 RVA: 0x00225AD8 File Offset: 0x00223CD8
222 public int GetIconIndex(string achievementName)
223 {
224 /*
225An exception occurred when decompiling this method (06003857)
226
227ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 Terraria.Achievements.AchievementManager::GetIconIndex(System.String)
228
229 ---> System.Exception: Basic block has to end with unconditional control flow.
230{
231 Block_0:
232 stloc:class [mscorlib]System.Collections.Generic.Dictionary`2<string, int32>(var_0_06, ldfld:class [mscorlib]System.Collections.Generic.Dictionary`2<string, int32>(AchievementManager::_achievementIconIndexes, ldloc:AchievementManager(this)))
233}
234
235 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
236 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
237 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
238 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
239 --- End of inner exception stack trace ---
240 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
241 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1683
242*/;
243 }
244
245 // Token: 0x06003858 RID: 14424 RVA: 0x00225AEC File Offset: 0x00223CEC
246 // Note: this type is marked as 'beforefieldinit'.
248 {
249 }
250
251 // Token: 0x04007925 RID: 31013
252 private string _savePath;
253
254 // Token: 0x04007926 RID: 31014
255 private bool _isCloudSave;
256
257 // Token: 0x04007927 RID: 31015
259
260 // Token: 0x04007928 RID: 31016
263
264 // Token: 0x04007929 RID: 31017
266
267 // Token: 0x0400792A RID: 31018
269
270 // Token: 0x0400792B RID: 31019
271 private byte[] _cryptoKey;
272
273 // Token: 0x0400792C RID: 31020
275
276 // Token: 0x0400792D RID: 31021
277 private static object _ioLock;
278
279 // Token: 0x02000696 RID: 1686
280 private class StoredAchievement
281 {
282 // Token: 0x06003859 RID: 14425 RVA: 0x00225AFC File Offset: 0x00223CFC
284 {
285 }
286
287 // Token: 0x0400792E RID: 31022
288 [JsonProperty]
290 }
291 }
292}
class f__AnonymousType0<< Count > j__TPar
void SavePersistantData()
Definition LocalUser.cs:85
void LoadPersistantData()
Definition LocalUser.cs:80
static JsonSerializer Create()
static Delegate Combine(Delegate a, Delegate b)
Definition Delegate.cs:255
static Delegate Remove(Delegate source, Delegate value)
Definition Delegate.cs:278
static Encoding ASCII
Definition Encoding.cs:348
void RegisterIconIndex(string achievementName, int iconIndex)
Dictionary< string, int > _achievementIconIndexes
Achievement GetAchievement(string achievementName)
Dictionary< string, Achievement > _achievements
readonly JsonSerializerSettings _serializerSettings
Achievement.AchievementCompleted OnAchievementCompleted
AchievementCondition GetCondition(string achievementName, string conditionName)
void AchievementCompleted(Achievement achievement)
T GetCondition< T >(string achievementName, string conditionName)
void RegisterAchievementCategory(string achievementName, AchievementCategory category)