Elin Modding Docs Doc
Loading...
Searching...
No Matches
QuestCraft.cs
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4
5// Token: 0x020000C5 RID: 197
6public class QuestCraft : Quest
7{
8 // Token: 0x17000147 RID: 327
9 // (get) Token: 0x060005B8 RID: 1464 RVA: 0x00026B9F File Offset: 0x00024D9F
10 public bool ConsumeGoods
11 {
12 get
13 {
14 return false;
15 }
16 }
17
18 // Token: 0x17000148 RID: 328
19 // (get) Token: 0x060005B9 RID: 1465 RVA: 0x00026BA2 File Offset: 0x00024DA2
20 public List<QuestCraft.Req> CurrentReq
21 {
22 get
23 {
24 if (this.progress != 0)
25 {
26 return this.req2;
27 }
28 return this.req1;
29 }
30 }
31
32 // Token: 0x17000149 RID: 329
33 // (get) Token: 0x060005BA RID: 1466 RVA: 0x00026BB9 File Offset: 0x00024DB9
34 public bool hasSecondReq
35 {
36 get
37 {
38 return this.req2.Count > 0;
39 }
40 }
41
42 // Token: 0x060005BB RID: 1467 RVA: 0x00026BCC File Offset: 0x00024DCC
43 public override bool CanDeliverToClient(Chara c)
44 {
45 if (c.quest != this)
46 {
47 return false;
48 }
49 bool result = true;
50 foreach (QuestCraft.Req req in this.CurrentReq)
51 {
52 Thing thing = EClass.pc.things.Find(req.idThing, -1, -1);
53 if (thing == null || thing.Num < req.num)
54 {
55 result = false;
56 break;
57 }
58 }
59 return result;
60 }
61
62 // Token: 0x060005BC RID: 1468 RVA: 0x00026C54 File Offset: 0x00024E54
63 public override bool Deliver(Chara c, Thing t = null)
64 {
65 if (!this.CanDeliverToClient(c))
66 {
67 return false;
68 }
69 bool consumeGoods = this.ConsumeGoods;
70 if (this.progress == 0 && this.hasSecondReq)
71 {
72 base.UpdateJournal();
73 }
74 else
75 {
76 EClass.game.quests.Complete(this);
77 }
78 this.OnProgressComplete();
79 return true;
80 }
81
82 // Token: 0x060005BD RID: 1469 RVA: 0x00026CA4 File Offset: 0x00024EA4
83 public void OnProgressComplete()
84 {
85 if (this.progress == 0)
86 {
87 string id = this.id;
88 if (!(id == "fiama1"))
89 {
90 if (id == "ash1")
91 {
92 EClass._zone.AddCard(ThingGen.Create("string", -1, -1), EClass.pc.pos);
93 }
94 }
95 else
96 {
97 EClass._zone.AddCard(ThingGen.Create("water", -1, -1), EClass.pc.pos);
98 }
99 }
100 this.progress++;
101 }
102
103 // Token: 0x060005BE RID: 1470 RVA: 0x00026D30 File Offset: 0x00024F30
104 public override void OnDropReward()
105 {
106 string id = this.id;
107 if (id == "fiama1")
108 {
109 base.DropReward(ThingGen.Create("crimAle", -1, -1));
110 return;
111 }
112 if (!(id == "ash1"))
113 {
114 return;
115 }
116 base.DropReward(ThingGen.Create("crimAle", -1, -1));
117 }
118
119 // Token: 0x060005BF RID: 1471 RVA: 0x00026D88 File Offset: 0x00024F88
120 public override void OnComplete()
121 {
122 string id = this.id;
123 if (id == "ash1")
124 {
125 QuestCraft questCraft = Quest.Create("ash2", null, null) as QuestCraft;
126 questCraft.SetClient(base.chara, true);
127 questCraft.req1.Add(new QuestCraft.Req("torch_held", 1));
128 return;
129 }
130 if (!(id == "fiama1"))
131 {
132 return;
133 }
134 QuestCraft questCraft2 = Quest.Create("fiama2", null, null) as QuestCraft;
135 questCraft2.SetClient(base.chara, true);
136 questCraft2.req1.Add(new QuestCraft.Req("torch_held", 1));
137 }
138
139 // Token: 0x060005C0 RID: 1472 RVA: 0x00026E20 File Offset: 0x00025020
140 public override string GetTextProgress()
141 {
142 string text = "";
143 foreach (QuestCraft.Req req in this.CurrentReq)
144 {
145 text = text + (text.IsEmpty() ? "" : Environment.NewLine) + "progressShowSupply".lang(EClass.sources.things.map[req.idThing].GetName(req.num), null, null, null, null);
146 }
147 return text;
148 }
149
150 // Token: 0x060005C1 RID: 1473 RVA: 0x00026EC4 File Offset: 0x000250C4
151 public override string GetDetailText(bool onJournal = false)
152 {
153 return base.source.GetDetail().Split('|', StringSplitOptions.None)[this.progress];
154 }
155
156 // Token: 0x060005C2 RID: 1474 RVA: 0x00026EE0 File Offset: 0x000250E0
157 public override string GetTalkProgress()
158 {
159 return this.GetDetailText(false);
160 }
161
162 // Token: 0x060005C3 RID: 1475 RVA: 0x00026EE9 File Offset: 0x000250E9
163 public override string GetTalkComplete()
164 {
165 if (this.progress != 1 || !this.hasSecondReq)
166 {
167 return base.Parse(base.source.GetText("talkComplete", false));
168 }
169 return this.GetDetailText(false);
170 }
171
172 // Token: 0x040006FD RID: 1789
173 [JsonProperty]
174 public List<QuestCraft.Req> req1 = new List<QuestCraft.Req>();
175
176 // Token: 0x040006FE RID: 1790
177 [JsonProperty]
178 public List<QuestCraft.Req> req2 = new List<QuestCraft.Req>();
179
180 // Token: 0x040006FF RID: 1791
181 [JsonProperty]
182 public int progress;
183
184 // Token: 0x0200081B RID: 2075
185 public class Req
186 {
187 // Token: 0x060038D4 RID: 14548 RVA: 0x0012EFC1 File Offset: 0x0012D1C1
188 public Req()
189 {
190 }
191
192 // Token: 0x060038D5 RID: 14549 RVA: 0x0012EFC9 File Offset: 0x0012D1C9
193 public Req(string id, int n)
194 {
195 this.idThing = id;
196 this.num = n;
197 }
198
199 // Token: 0x040022F6 RID: 8950
200 [JsonProperty]
201 public string idThing;
202
203 // Token: 0x040022F7 RID: 8951
204 [JsonProperty]
205 public int num;
206 }
207}
Definition Chara.cs:12
Definition Quest.cs:8
Definition Thing.cs:10