Elin Modding Docs Doc
Loading...
Searching...
No Matches
TaskDig.cs
1using System;
2
3// Token: 0x02000257 RID: 599
4public class TaskDig : BaseTaskHarvest
5{
6 // Token: 0x17000478 RID: 1144
7 // (get) Token: 0x060010BC RID: 4284 RVA: 0x00074654 File Offset: 0x00072854
8 public override BaseTaskHarvest.HarvestType harvestType
9 {
10 get
11 {
12 return BaseTaskHarvest.HarvestType.Floor;
13 }
14 }
15
16 // Token: 0x17000479 RID: 1145
17 // (get) Token: 0x060010BD RID: 4285 RVA: 0x00074657 File Offset: 0x00072857
18 public override int RightHand
19 {
20 get
21 {
22 return 1101;
23 }
24 }
25
26 // Token: 0x1700047A RID: 1146
27 // (get) Token: 0x060010BE RID: 4286 RVA: 0x0007465E File Offset: 0x0007285E
28 public override bool IsHostileAct
29 {
30 get
31 {
32 return true;
33 }
34 }
35
36 // Token: 0x1700047B RID: 1147
37 // (get) Token: 0x060010BF RID: 4287 RVA: 0x00074661 File Offset: 0x00072861
38 public override bool LocalAct
39 {
40 get
41 {
42 return false;
43 }
44 }
45
46 // Token: 0x1700047C RID: 1148
47 // (get) Token: 0x060010C0 RID: 4288 RVA: 0x00074664 File Offset: 0x00072864
48 public override int destDist
49 {
50 get
51 {
52 if (EClass._zone.IsSkyLevel)
53 {
54 return 1;
55 }
56 if (!EClass._zone.IsRegion)
57 {
58 return 1;
59 }
60 return 0;
61 }
62 }
63
64 // Token: 0x1700047D RID: 1149
65 // (get) Token: 0x060010C1 RID: 4289 RVA: 0x00074683 File Offset: 0x00072883
66 public override bool destIgnoreConnection
67 {
68 get
69 {
70 return true;
71 }
72 }
73
74 // Token: 0x1700047E RID: 1150
75 // (get) Token: 0x060010C2 RID: 4290 RVA: 0x00074686 File Offset: 0x00072886
76 public override CursorInfo CursorIcon
77 {
78 get
79 {
80 return CursorSystem.Dig;
81 }
82 }
83
84 // Token: 0x060010C3 RID: 4291 RVA: 0x0007468D File Offset: 0x0007288D
85 public override string GetTextSmall(Card c)
86 {
87 if (!this.pos.cell.HasBridge)
88 {
89 return this.pos.cell.GetFloorName();
90 }
91 return this.pos.cell.GetBridgeName();
92 }
93
94 // Token: 0x060010C4 RID: 4292 RVA: 0x000746C4 File Offset: 0x000728C4
95 public override void OnCreateProgress(Progress_Custom p)
96 {
97 base.SetTarget(this.owner, null);
98 p.textHint = this.pos.cell.GetFloorName();
99 p.maxProgress = this.maxProgress;
100 p.onProgressBegin = delegate()
101 {
102 if (this.IsTooHard)
103 {
104 this.owner.Say("tooHardToDig", this.owner, this.pos.cell.HasBridge ? this.pos.cell.GetBridgeName() : this.pos.cell.GetFloorName(), null);
105 p.Cancel();
106 return;
107 }
108 if (this.owner.Tool != null)
109 {
110 this.owner.Say("dig_start", this.owner, this.owner.Tool, null, null);
111 }
112 };
113 p.onProgress = delegate(Progress_Custom _p)
114 {
115 SourceMaterial.Row row = this.pos.cell.HasBridge ? this.pos.cell.matBridge : this.pos.cell.matFloor;
116 this.owner.PlaySound(row.GetSoundImpact(null), 1f, true);
117 row.PlayHitEffect(this.pos);
118 row.AddBlood(this.pos, 1);
119 this.owner.elements.ModExp(230, 5, false);
120 this.owner.renderer.NextFrame();
121 if (EClass._zone.IsCrime(this.owner, this))
122 {
123 this.owner.pos.TryWitnessCrime(this.owner, null, 4, null);
124 }
125 };
126 }
127
128 // Token: 0x060010C5 RID: 4293 RVA: 0x0007474C File Offset: 0x0007294C
129 public override HitResult GetHitResult()
130 {
131 if (EClass._zone.IsRegion && this.GetTreasureMap() != null)
132 {
133 return HitResult.Valid;
134 }
135 if (this.mode == TaskDig.Mode.RemoveFloor)
136 {
137 if (EClass._zone.IsRegion)
138 {
139 if (this.pos.matFloor.category == "soil")
140 {
141 return HitResult.Valid;
142 }
143 return HitResult.Default;
144 }
145 else
146 {
147 if (EClass._zone.IsSkyLevel && (this.pos.Installed != null || this.pos.Charas.Count >= 2 || (this.pos.HasChara && this.pos.FirstChara != EClass.pc)))
148 {
149 return HitResult.Invalid;
150 }
151 if (this.pos.IsWater || this.pos.HasObj || (!EClass._zone.IsPCFaction && this.pos.HasBlock))
152 {
153 return HitResult.Invalid;
154 }
155 if (!this.pos.HasBridge && this.pos.sourceFloor.id == 40)
156 {
157 return HitResult.Invalid;
158 }
159 return HitResult.Valid;
160 }
161 }
162 else
163 {
164 if (!this.pos.HasBridge)
165 {
166 return HitResult.Default;
167 }
168 if (this.pos.HasObj)
169 {
170 return HitResult.Warning;
171 }
172 return HitResult.Valid;
173 }
174 }
175
176 // Token: 0x060010C6 RID: 4294 RVA: 0x00074870 File Offset: 0x00072A70
177 public Thing GetTreasureMap()
178 {
179 foreach (Thing thing in EClass.pc.things.List((Thing t) => t.trait is TraitScrollMapTreasure, false))
180 {
181 TraitScrollMapTreasure traitScrollMapTreasure = thing.trait as TraitScrollMapTreasure;
182 if (this.pos.Equals(traitScrollMapTreasure.GetDest(true)))
183 {
184 return thing;
185 }
186 }
187 return null;
188 }
189
190 // Token: 0x060010C7 RID: 4295 RVA: 0x0007490C File Offset: 0x00072B0C
191 public override void OnProgressComplete()
192 {
193 string idRecipe = this.pos.HasBridge ? this.pos.sourceBridge.RecipeID : this.pos.sourceFloor.RecipeID;
194 if (EClass._zone.IsRegion)
195 {
196 Thing map = this.GetTreasureMap();
197 if (map != null || EClass.debug.enable)
198 {
199 if (map == null)
200 {
201 map = ThingGen.Create("map_treasure", -1, EClass.pc.LV);
202 }
203 SE.Play("ding_skill");
204 Msg.Say("digTreasure");
205 Rand.UseSeed(map.refVal, delegate
206 {
207 Thing thing = ThingGen.CreateTreasure("chest_treasure", map.LV, TreasureType.Map);
208 EClass._zone.AddCard(thing, EClass.pc.pos);
209 ThingGen.TryLickChest(thing);
210 });
211 map.Destroy();
212 EClass.player.willAutoSave = true;
213 return;
214 }
215 }
216 switch (this.mode)
217 {
218 case TaskDig.Mode.Default:
219 EClass._map.SetBridge(this.pos.x, this.pos.z, 0, 0, 0, 0);
220 break;
221 case TaskDig.Mode.Ramp:
222 EClass._map.MineFloor(this.pos, this.owner, false, true);
223 break;
224 case TaskDig.Mode.RemoveFloor:
225 EClass._map.MineFloor(this.pos, this.owner, false, true);
226 this.pos.Animate(AnimeID.Dig, true);
227 this.owner.elements.ModExp(230, 30, false);
228 break;
229 }
230 if (EClass._zone.IsCrime(this.owner, this))
231 {
232 EClass.player.ModKarma(-1);
233 }
234 if (EClass.rnd(2) == 0)
235 {
236 this.owner.stamina.Mod(-1);
237 }
238 if (this.owner == null)
239 {
240 return;
241 }
242 if (this.owner.IsPC)
243 {
244 EClass.player.recipes.ComeUpWithRecipe(idRecipe, 30);
245 }
246 if (this.owner.IsPC && this.owner.IsAliveInCurrentZone && EClass._zone.IsSkyLevel && this.owner.pos.IsSky)
247 {
248 EClass.pc.FallFromZone();
249 }
250 }
251
252 // Token: 0x04000DCB RID: 3531
253 public TaskDig.Mode mode;
254
255 // Token: 0x04000DCC RID: 3532
256 public int ramp = 3;
257
258 // Token: 0x02000931 RID: 2353
259 public enum Mode
260 {
261 // Token: 0x040026DA RID: 9946
262 Default,
263 // Token: 0x040026DB RID: 9947
264 Ramp,
265 // Token: 0x040026DC RID: 9948
266 RemoveFloor
267 }
268}
Definition Card.cs:13
Definition Msg.cs:7
Definition Thing.cs:10