Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
RankedZoneManager.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3
5{
6 public int GetIncome(Zone z)
7 {
8 List<FactionBranch> children = EClass.pc.faction.GetChildren();
9 children.Sort((FactionBranch a, FactionBranch b) => GetRank(a.owner) - GetRank(b.owner));
10 int num = children.IndexOf(z.branch);
11 return CalcIncome(z) * 100 / (100 + num * 40);
12 int CalcIncome(Zone _z)
13 {
14 int rank = GetRank(_z);
15 if (rank > 125)
16 {
17 return 0;
18 }
19 return (126 - rank) * 100;
20 }
21 }
22
23 public string GetRankText(Zone z)
24 {
25 int rank = GetRank(z);
26 string[] list = Lang.GetList("num_rank");
27 int num = rank % 10;
28 if (num >= list.Length)
29 {
30 num = 0;
31 }
32 return rank + list[num];
33 }
34
35 public int GetRank(Zone z)
36 {
37 foreach (RankedZone item in GetList())
38 {
39 if (item.z == z)
40 {
41 return item.rank;
42 }
43 }
44 return 1;
45 }
46
47 public List<RankedZone> GetList()
48 {
49 List<RankedZone> list = new List<RankedZone>();
50 foreach (Spatial z in EClass.game.spatials.map.Values)
51 {
52 if ((z.source.value <= 0 || z.lv != 0) && !z.IsPlayerFaction)
53 {
54 continue;
55 }
56 int v = 0;
57 if (z.IsPlayerFaction)
58 {
59 v = (z as Zone).branch.Worth;
60 }
61 else
62 {
63 v = z.source.value;
64 Rand.UseSeed(z.uid, delegate
65 {
66 v = z.source.value + EClass.rnd(z.source.value / 10);
67 });
68 }
69 list.Add(new RankedZone
70 {
71 z = (z as Zone),
72 value = v
73 });
74 }
75 list.Sort((RankedZone a, RankedZone b) => b.Value - a.Value);
76 int num = 0;
77 int num2 = 0;
78 foreach (RankedZone item in list)
79 {
80 int num3 = num2 - item.value;
81 int num4 = 1000;
82 num4 = ((item.value < 100000000) ? ((item.value < 10000000) ? ((item.value < 5000000) ? ((item.value < 1000000) ? ((item.value < 500000) ? ((item.value < 100000) ? ((item.value < 50000) ? ((item.value < 10000) ? 1000 : 2000) : 5000) : 10000) : 50000) : 500000) : 1000000) : 5000000) : 100000000);
83 num = (item.rank = num + Mathf.Max(num3 / num4, 1));
84 num2 = item.Value;
85 }
86 return list;
87 }
88}
Faction faction
Definition: Chara.cs:412
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static int rnd(int a)
Definition: EClass.cs:50
static Chara pc
Definition: EClass.cs:14
List< FactionBranch > GetChildren()
Definition: FACTION.cs:200
SpatialManager spatials
Definition: Game.cs:152
Definition: Lang.cs:6
static string[] GetList(string id)
Definition: Lang.cs:114
Definition: Rand.cs:4
static void UseSeed(int seed, Action action)
Definition: Rand.cs:22
string GetRankText(Zone z)
int GetIncome(Zone z)
List< RankedZone > GetList()
GlobalSpatialList map
int lv
Definition: Spatial.cs:142
int uid
Definition: Spatial.cs:70
bool IsPlayerFaction
Definition: Spatial.cs:443
SourceZone.Row source
Definition: Spatial.cs:441
Definition: Zone.cs:12
FactionBranch branch
Definition: Zone.cs:34