Elin Modding Docs Doc
Loading...
Searching...
No Matches
QuestDeliver.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4using UnityEngine;
5
6// Token: 0x020000E7 RID: 231
8{
9 // Token: 0x1700016B RID: 363
10 // (get) Token: 0x0600063D RID: 1597 RVA: 0x00028B41 File Offset: 0x00026D41
11 public virtual bool ConsumeGoods
12 {
13 get
14 {
15 return true;
16 }
17 }
18
19 // Token: 0x1700016C RID: 364
20 // (get) Token: 0x0600063E RID: 1598 RVA: 0x00028B44 File Offset: 0x00026D44
21 public SourceThing.Row sourceThing
22 {
23 get
24 {
25 return EClass.sources.things.map[this.idThing.IsEmpty("generator_snowman")];
26 }
27 }
28
29 // Token: 0x1700016D RID: 365
30 // (get) Token: 0x0600063F RID: 1599 RVA: 0x00028B6A File Offset: 0x00026D6A
31 public override string NameDeliver
32 {
33 get
34 {
35 return this.sourceThing.GetName();
36 }
37 }
38
39 // Token: 0x1700016E RID: 366
40 // (get) Token: 0x06000640 RID: 1600 RVA: 0x00028B77 File Offset: 0x00026D77
41 public override string RefDrama2
42 {
43 get
44 {
45 return this.NameDeliver;
46 }
47 }
48
49 // Token: 0x1700016F RID: 367
50 // (get) Token: 0x06000641 RID: 1601 RVA: 0x00028B7F File Offset: 0x00026D7F
51 public override int KarmaOnFail
52 {
53 get
54 {
55 if (!this.IsDeliver)
56 {
57 return base.KarmaOnFail;
58 }
59 return -15;
60 }
61 }
62
63 // Token: 0x17000170 RID: 368
64 // (get) Token: 0x06000642 RID: 1602 RVA: 0x00028B92 File Offset: 0x00026D92
65 public override Quest.DifficultyType difficultyType
66 {
67 get
68 {
69 return Quest.DifficultyType.Deliver;
70 }
71 }
72
73 // Token: 0x17000171 RID: 369
74 // (get) Token: 0x06000643 RID: 1603 RVA: 0x00028B95 File Offset: 0x00026D95
75 public override bool ForbidTeleport
76 {
77 get
78 {
79 return true;
80 }
81 }
82
83 // Token: 0x06000644 RID: 1604 RVA: 0x00028B98 File Offset: 0x00026D98
84 public override int GetExtraMoney()
85 {
86 if (base.DestZone == null)
87 {
88 return 0;
89 }
90 return base.DestZone.Dist(base.ClientZone) * 6;
91 }
92
93 // Token: 0x06000645 RID: 1605 RVA: 0x00028BB7 File Offset: 0x00026DB7
94 public override void OnInit()
95 {
96 this.num = this.GetDestNum();
97 this.SetIdThing();
98 }
99
100 // Token: 0x06000646 RID: 1606 RVA: 0x00028BCB File Offset: 0x00026DCB
101 public virtual int GetDestNum()
102 {
103 return 1;
104 }
105
106 // Token: 0x06000647 RID: 1607 RVA: 0x00028BD0 File Offset: 0x00026DD0
107 public virtual void SetIdThing()
108 {
109 CardRow cardRow;
110 do
111 {
112 SourceCategory.Row r = this.GetDeliverCat();
113 cardRow = SpawnListThing.Get("cat_" + r.id, (SourceThing.Row s) => EClass.sources.categories.map[s.category].IsChildOf(r.id)).Select(-1, -1);
114 }
115 while (cardRow == null);
116 this.idThing = cardRow.id;
117 }
118
119 // Token: 0x06000648 RID: 1608 RVA: 0x00028C2C File Offset: 0x00026E2C
120 private SourceCategory.Row GetDeliverCat()
121 {
122 if (QuestDeliver._listDeliver.Count == 0)
123 {
124 foreach (SourceCategory.Row row in EClass.sources.categories.rows)
125 {
126 if (row.deliver > 0)
127 {
128 QuestDeliver._listDeliver.Add(row);
129 }
130 }
131 }
132 return QuestDeliver._listDeliver.RandomItem<SourceCategory.Row>();
133 }
134
135 // Token: 0x06000649 RID: 1609 RVA: 0x00028CAC File Offset: 0x00026EAC
136 public override void OnStart()
137 {
138 if (this.IsDeliver)
139 {
140 Thing thing = ThingGen.Create(this.idThing, -1, -1);
141 thing.Identify(false, IDTSource.SuperiorIdentify);
142 Msg.Say("get_quest_item");
143 EClass.pc.Pick(thing, true, true);
144 }
145 }
146
147 // Token: 0x0600064A RID: 1610 RVA: 0x00028CF4 File Offset: 0x00026EF4
148 public virtual bool IsDestThing(Thing t)
149 {
150 if (!t.c_isImportant && t.Num >= this.num && t.IsIdentified && t.things.Count == 0 && !t.isEquipped)
151 {
152 if (t.id == this.idThing)
153 {
154 return true;
155 }
156 if (t.c_altName.IsEmpty())
157 {
158 string name = this.sourceThing.GetName();
159 if (t.source.GetName() == name || t.GetName(NameStyle.Simple, 1) == name)
160 {
161 return true;
162 }
163 }
164 }
165 return false;
166 }
167
168 // Token: 0x0600064B RID: 1611 RVA: 0x00028D88 File Offset: 0x00026F88
169 public List<Thing> ListDestThing()
170 {
171 return EClass.pc.things.List((Thing t) => this.IsDestThing(t), false);
172 }
173
174 // Token: 0x0600064C RID: 1612 RVA: 0x00028DA6 File Offset: 0x00026FA6
175 public override Thing GetDestThing()
176 {
177 return EClass.pc.things.Find((Thing t) => this.IsDestThing(t), true);
178 }
179
180 // Token: 0x0600064D RID: 1613 RVA: 0x00028DC4 File Offset: 0x00026FC4
181 public override bool IsDeliverTarget(Chara c)
182 {
183 if (this.IsDeliver)
184 {
185 return EClass._zone == base.DestZone && c.uid == this.uidTarget;
186 }
187 return c.quest != null && c.quest.uid == this.uid;
188 }
189
190 // Token: 0x0600064E RID: 1614 RVA: 0x00028E14 File Offset: 0x00027014
191 public override bool CanDeliverToClient(Chara c)
192 {
193 if (this.GetDestThing() == null && !EClass.debug.autoAdvanceQuest)
194 {
195 return false;
196 }
197 if (this.IsDeliver)
198 {
199 return EClass._zone == base.DestZone && c.uid == this.uidTarget;
200 }
201 Chara chara = this.person.chara;
202 int? num = (chara != null) ? new int?(chara.uid) : null;
203 int uid = c.uid;
204 return (num.GetValueOrDefault() == uid & num != null) || (c.quest != null && c.quest.uid == this.uid);
205 }
206
207 // Token: 0x0600064F RID: 1615 RVA: 0x00028EBC File Offset: 0x000270BC
208 public override bool CanDeliverToBox(Thing t)
209 {
210 return false;
211 }
212
213 // Token: 0x06000650 RID: 1616 RVA: 0x00028EC0 File Offset: 0x000270C0
214 public override bool Deliver(Chara c, Thing t = null)
215 {
216 if (t == null)
217 {
218 t = this.GetDestThing();
219 if (t == null && EClass.debug.autoAdvanceQuest)
220 {
221 Debug.Log("[error] creating " + this.idThing);
222 t = ThingGen.Create(this.idThing, -1, -1);
223 }
224 }
225 if (t != null)
226 {
227 Thing thing = t.Split(this.num);
228 this.bonusMoney += this.GetBonus(thing);
229 Msg.Say("deliverItem", thing, null, null, null);
230 if (this.ConsumeGoods)
231 {
232 thing.Destroy();
233 }
234 else
235 {
236 c.Pick(thing, true, true);
237 }
238 EClass.game.quests.Complete(this);
239 c.quest = null;
240 return true;
241 }
242 return false;
243 }
244
245 // Token: 0x06000651 RID: 1617 RVA: 0x00028F72 File Offset: 0x00027172
246 public virtual int GetBonus(Thing t)
247 {
248 return 0;
249 }
250
251 // Token: 0x06000652 RID: 1618 RVA: 0x00028F78 File Offset: 0x00027178
252 public override string GetTextProgress()
253 {
254 string text = (this.GetDestThing() != null) ? "supplyInInv".lang().TagColor(FontColor.Good, null) : "supplyNotInInv".lang();
255 if (this.IsDeliver)
256 {
257 string @ref = (base.DestZone.dictCitizen.TryGetValue(this.uidTarget, null) ?? "???") + " (" + base.DestZone.Name + ")";
258 return "progressDeliver".lang(this.sourceThing.GetName(this.num), @ref, text, null, null);
259 }
260 return "progressSupply".lang(this.sourceThing.GetName(this.num), text, null, null, null);
261 }
262
263 // Token: 0x04000718 RID: 1816
264 [JsonProperty]
265 public string idThing;
266
267 // Token: 0x04000719 RID: 1817
268 [JsonProperty]
269 public int num;
270
271 // Token: 0x0400071A RID: 1818
272 private static List<SourceCategory.Row> _listDeliver = new List<SourceCategory.Row>();
273}
Definition Chara.cs:12
Definition Msg.cs:7
Definition Quest.cs:8
Definition Thing.cs:10