Elin Modding Docs Doc
Loading...
Searching...
No Matches
TraitGeneMachine.cs
1using System;
2using UnityEngine;
3
4// Token: 0x020003F8 RID: 1016
6{
7 // Token: 0x17000928 RID: 2344
8 // (get) Token: 0x06001D71 RID: 7537 RVA: 0x000ABACB File Offset: 0x000A9CCB
9 public override bool CanBeOnlyBuiltInHome
10 {
11 get
12 {
13 return true;
14 }
15 }
16
17 // Token: 0x17000929 RID: 2345
18 // (get) Token: 0x06001D72 RID: 7538 RVA: 0x000ABACE File Offset: 0x000A9CCE
19 public override bool IsHomeItem
20 {
21 get
22 {
23 return true;
24 }
25 }
26
27 // Token: 0x06001D73 RID: 7539 RVA: 0x000ABAD4 File Offset: 0x000A9CD4
28 public Chara GetTarget()
29 {
30 foreach (Chara chara in this.owner.pos.Charas)
31 {
32 ConSuspend condition = chara.GetCondition<ConSuspend>();
33 if (condition != null && condition.uidMachine == this.owner.uid)
34 {
35 return chara;
36 }
37 }
38 return null;
39 }
40
41 // Token: 0x06001D74 RID: 7540 RVA: 0x000ABB50 File Offset: 0x000A9D50
42 public bool IsTargetUsingGene()
43 {
44 Chara target = this.GetTarget();
45 return target != null && target.GetCondition<ConSuspend>().HasGene;
46 }
47
48 // Token: 0x06001D75 RID: 7541 RVA: 0x000ABB74 File Offset: 0x000A9D74
49 public float GetProgress()
50 {
51 ConSuspend condition = this.GetTarget().GetCondition<ConSuspend>();
52 if (condition == null || !condition.HasGene)
53 {
54 return 0f;
55 }
56 int remainingHours = EClass.world.date.GetRemainingHours(condition.dateFinish);
57 if (condition.duration == 0 || EClass.debug.enable)
58 {
59 return 1f;
60 }
61 return Mathf.Clamp((float)(condition.duration - remainingHours) / (float)condition.duration, 0f, 1f);
62 }
63
64 // Token: 0x06001D76 RID: 7542 RVA: 0x000ABBF0 File Offset: 0x000A9DF0
65 public string GetProgressText()
66 {
67 ConSuspend condition = this.GetTarget().GetCondition<ConSuspend>();
68 int remainingHours = EClass.world.date.GetRemainingHours(condition.dateFinish);
69 if (remainingHours > 0)
70 {
71 return remainingHours.ToString() + " h";
72 }
73 return "progress_finish".lang();
74 }
75
76 // Token: 0x06001D77 RID: 7543 RVA: 0x000ABC3F File Offset: 0x000A9E3F
77 public override bool CanUse(Chara c)
78 {
79 return this.owner.IsInstalled && this.owner.isOn && (!this.IsTargetUsingGene() || this.GetProgress() >= 1f);
80 }
81
82 // Token: 0x06001D78 RID: 7544 RVA: 0x000ABC78 File Offset: 0x000A9E78
83 public override bool OnUse(Chara c)
84 {
85 Chara target = this.GetTarget();
86 if (target == null)
87 {
88 LayerPeople.CreateSelect("", "", delegate(UIList l)
89 {
90 foreach (Chara chara in EClass.Branch.members)
91 {
92 if (chara.GetCondition<ConSuspend>() == null && chara.host == null && !chara.IsPC && chara.IsAliveInCurrentZone && chara.memberType == FactionMemberType.Default)
93 {
94 l.Add(chara);
95 }
96 }
97 }, delegate(Chara c)
98 {
99 if (c.IsPCParty)
100 {
101 EClass.pc.party.RemoveMember(c);
102 }
103 if (!c.pos.Equals(this.owner.pos))
104 {
105 EClass.pc.Kick(this.owner.pos, false);
106 c.Teleport(this.owner.pos, false, true);
107 }
108 if (EClass.debug.enable)
109 {
110 if (c.c_genes == null)
111 {
112 c.c_genes = new CharaGenes();
113 }
114 c.c_genes.inferior += 20;
115 c.feat += 500;
116 }
117 c.RemoveCondition<ConSleep>();
118 c.PlaySound("ride", 1f, true);
119 (c.AddCondition<ConSuspend>(100, true) as ConSuspend).uidMachine = this.owner.uid;
120 }, (Chara a) => "gene_note".lang(((a.c_genes != null) ? a.c_genes.items.Count : 0).ToString() ?? "", a.MaxGene.ToString() ?? "", a.feat.ToString() ?? "", a.GetTotalFeat().ToString() + " ", null));
121 }
122 else if (this.GetProgress() >= 1f)
123 {
124 ConSuspend condition = target.GetCondition<ConSuspend>();
125 if (condition.gene.GetRootCard() != target)
126 {
127 Msg.SayNothingHappen();
128 }
129 else
130 {
131 target.Say("gene_finish", target, condition.gene, null, null);
132 condition.gene.c_DNA.Apply(target);
133 condition.gene.Destroy();
134 condition.gene = null;
135 }
136 target.RemoveCondition<ConSuspend>();
137 target.MoveNeighborDefinitely();
138 target.PlaySound("ding_potential", 1f, true);
139 target.pos.PlayEffect("mutation");
140 }
141 else
142 {
143 LayerDragGrid.Create(new InvOwnerGene(this.owner, target), false);
144 }
145 return true;
146 }
147}
Definition Chara.cs:12
Definition Msg.cs:7