Elin Modding Docs Doc
Loading...
Searching...
No Matches
AIWork.cs
1using System;
2using System.Collections.Generic;
3
4// Token: 0x0200020C RID: 524
5public class AIWork : AIAct
6{
7 // Token: 0x170003DA RID: 986
8 // (get) Token: 0x06000EF8 RID: 3832 RVA: 0x0006EA53 File Offset: 0x0006CC53
9 public override string Name
10 {
11 get
12 {
13 return this.sourceWork.name_JP;
14 }
15 }
16
17 // Token: 0x170003DB RID: 987
18 // (get) Token: 0x06000EF9 RID: 3833 RVA: 0x0006EA60 File Offset: 0x0006CC60
19 public virtual int destDist
20 {
21 get
22 {
23 return 0;
24 }
25 }
26
27 // Token: 0x170003DC RID: 988
28 // (get) Token: 0x06000EFA RID: 3834 RVA: 0x0006EA63 File Offset: 0x0006CC63
29 public override int MaxRestart
30 {
31 get
32 {
33 return 3;
34 }
35 }
36
37 // Token: 0x170003DD RID: 989
38 // (get) Token: 0x06000EFB RID: 3835 RVA: 0x0006EA66 File Offset: 0x0006CC66
39 public virtual AIWork.Work_Type WorkType
40 {
41 get
42 {
43 return AIWork.Work_Type.Default;
44 }
45 }
46
47 // Token: 0x06000EFC RID: 3836 RVA: 0x0006EA69 File Offset: 0x0006CC69
48 public override IEnumerable<AIAct.Status> Run()
49 {
50 yield return base.DoIdle(100);
51 AIWork.Work_Type workType = this.WorkType;
52 this.SetDestPos();
53 if (this.destPos != null)
54 {
55 yield return base.DoGoto(this.destPos, this.destDist, false, null);
56 }
57 AIAct work = this.GetWork(this.destPos);
58 if (work != null)
59 {
60 this.owner.Talk("work_" + this.sourceWork.talk, null, null, false);
61 yield return base.Do(work, new Func<AIAct.Status>(base.KeepRunning));
62 }
63 yield return base.Restart();
64 yield break;
65 }
66
67 // Token: 0x06000EFD RID: 3837 RVA: 0x0006EA79 File Offset: 0x0006CC79
68 public virtual AIAct GetWork(Point p)
69 {
70 return new AI_Idle();
71 }
72
73 // Token: 0x06000EFE RID: 3838 RVA: 0x0006EA80 File Offset: 0x0006CC80
74 public bool SetDestination()
75 {
76 if (this.WorkType == AIWork.Work_Type.Explore)
77 {
78 return EClass.world.date.IsExpired(this.owner.GetInt(51, null));
79 }
80 if (!this.sourceWork.workTag.IsEmpty())
81 {
82 if (this.destArea != null)
83 {
84 this.destThing = EClass._map.FindThing(this.sourceWork.workTag, this.destArea, null);
85 }
86 else
87 {
88 this.destThing = EClass._map.FindThing(this.sourceWork.workTag, this.owner);
89 }
90 if (this.destThing != null)
91 {
92 return true;
93 }
94 }
95 if (this.sourceWork.destTrait.IsEmpty())
96 {
97 this.SetDestPos();
98 return this.destPos != null;
99 }
100 if (this.destArea != null)
101 {
102 this.destThing = EClass._map.FindThing(Type.GetType("Trait" + this.sourceWork.destTrait + ", Elin"), this.destArea, null);
103 return this.destThing != null;
104 }
105 this.destThing = EClass._map.FindThing(Type.GetType("Trait" + this.sourceWork.destTrait + ", Elin"), this.owner);
106 return this.destThing != null;
107 }
108
109 // Token: 0x06000EFF RID: 3839 RVA: 0x0006EBD5 File Offset: 0x0006CDD5
110 public virtual void SetDestPos()
111 {
112 if (this.destThing != null && this.destThing.ExistsOnMap)
113 {
114 this.destPos = this.destThing.trait.GetRandomPoint(new Func<Point, bool>(this._FuncWorkPoint));
115 }
116 }
117
118 // Token: 0x06000F00 RID: 3840 RVA: 0x0006EC10 File Offset: 0x0006CE10
119 public bool _FuncWorkPoint(Point p)
120 {
121 Room room = this.destThing.pos.cell.room;
122 return p.cell.room == room && this.FuncWorkPoint(p);
123 }
124
125 // Token: 0x06000F01 RID: 3841 RVA: 0x0006EC4A File Offset: 0x0006CE4A
126 public virtual bool FuncWorkPoint(Point p)
127 {
128 return true;
129 }
130
131 // Token: 0x06000F02 RID: 3842 RVA: 0x0006EC50 File Offset: 0x0006CE50
132 public virtual WorkSession GetSession()
133 {
134 WorkSession workSession = new WorkSession
135 {
136 id = this.sourceWork.id,
137 efficiency = 80
138 };
139 if (this.destThing != null)
140 {
141 workSession.efficiency = this.destThing.GetEfficiency();
142 }
143 else if (this.destArea != null)
144 {
145 workSession.efficiency = this.destArea.type.GetEfficiency();
146 }
147 this.OnGetSession(workSession);
148 return workSession;
149 }
150
151 // Token: 0x06000F03 RID: 3843 RVA: 0x0006ECBD File Offset: 0x0006CEBD
152 public virtual void OnGetSession(WorkSession s)
153 {
154 }
155
156 // Token: 0x06000F04 RID: 3844 RVA: 0x0006ECBF File Offset: 0x0006CEBF
157 public void AddDeliverable(Thing t)
158 {
159 this.owner.GetWorkSummary().AddThing(t);
160 }
161
162 // Token: 0x06000F05 RID: 3845 RVA: 0x0006ECD2 File Offset: 0x0006CED2
163 public virtual void OnPerformWork(bool realtime)
164 {
165 }
166
167 // Token: 0x06000F06 RID: 3846 RVA: 0x0006ECD4 File Offset: 0x0006CED4
168 public void DailyOutcome()
169 {
170 }
171
172 // Token: 0x04000D6F RID: 3439
173 public BaseArea destArea;
174
175 // Token: 0x04000D70 RID: 3440
176 public Point destPos;
177
178 // Token: 0x04000D71 RID: 3441
179 public Thing destThing;
180
181 // Token: 0x04000D72 RID: 3442
182 public SourceHobby.Row sourceWork;
183
184 // Token: 0x02000908 RID: 2312
185 public enum Work_Type
186 {
187 // Token: 0x04002647 RID: 9799
188 Default,
189 // Token: 0x04002648 RID: 9800
190 Explore
191 }
192}
Definition AIAct.cs:7
Definition Point.cs:11
Definition Room.cs:6
Definition Thing.cs:10