Elin Modding Docs Doc
Loading...
Searching...
No Matches
FactionManager.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4using UnityEngine;
5
6// Token: 0x02000065 RID: 101
7public class FactionManager : EClass
8{
9 // Token: 0x06000298 RID: 664 RVA: 0x0001413C File Offset: 0x0001233C
10 public void AssignUID(Faction s)
11 {
12 Faction faction = this.dictAll.TryGetValue(s.id, null);
13 if (faction != null)
14 {
15 Debug.LogError("exception: Faction id already exists:" + faction.id);
16 }
17 s.uid = s.id;
18 this.dictAll.Add(s.uid, s);
19 }
20
21 // Token: 0x06000299 RID: 665 RVA: 0x00014194 File Offset: 0x00012394
22 public void OnCreateGame()
23 {
24 foreach (SourceFaction.Row r in EClass.sources.factions.rows)
25 {
26 Faction.Create(r);
27 }
28 this.Home = this.Find("home");
29 this.Home.relation.type = FactionRelation.RelationType.Owner;
30 this.Wilds = this.Find("wilds");
31 this.Fighter = this.Find<GuildFighter>("guild_fighter");
32 this.Mage = this.Find<GuildMage>("guild_mage");
33 this.Thief = this.Find<GuildThief>("guild_thief");
34 this.Merchant = this.Find<GuildMerchant>("guild_merchant");
35 }
36
37 // Token: 0x0600029A RID: 666 RVA: 0x00014268 File Offset: 0x00012468
38 public void OnLoad()
39 {
40 foreach (Faction faction in this.dictAll.Values)
41 {
42 faction.OnLoad();
43 }
44 }
45
46 // Token: 0x0600029B RID: 667 RVA: 0x000142C0 File Offset: 0x000124C0
47 public T Find<T>(string id) where T : Faction
48 {
49 return this.Find(id) as T;
50 }
51
52 // Token: 0x0600029C RID: 668 RVA: 0x000142D4 File Offset: 0x000124D4
53 public Faction Find(string id)
54 {
55 foreach (Faction faction in this.dictAll.Values)
56 {
57 if (faction.id == id)
58 {
59 return faction;
60 }
61 }
62 return null;
63 }
64
65 // Token: 0x04000527 RID: 1319
66 [JsonProperty]
67 public Dictionary<string, Faction> dictAll = new Dictionary<string, Faction>();
68
69 // Token: 0x04000528 RID: 1320
70 [JsonProperty]
71 public new Faction Home;
72
73 // Token: 0x04000529 RID: 1321
74 [JsonProperty]
75 public new Faction Wilds;
76
77 // Token: 0x0400052A RID: 1322
78 [JsonProperty]
79 public GuildFighter Fighter;
80
81 // Token: 0x0400052B RID: 1323
82 [JsonProperty]
83 public GuildMage Mage;
84
85 // Token: 0x0400052C RID: 1324
86 [JsonProperty]
87 public GuildThief Thief;
88
89 // Token: 0x0400052D RID: 1325
90 [JsonProperty]
91 public GuildMerchant Merchant;
92}