summaryrefslogtreecommitdiff
path: root/doc/quest_variables.md
blob: 2f8922c410336fa112049a77297ca099af610bcf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# Quest Variables

<!--
## Copyright
> This file is part of Hercules.
> http://herc.ws - http://github.com/HerculesWS/Hercules
> 
> Copyright (C) 2012-2018 Hercules Dev Team
> Copyright (C) Athena Dev Teams
> 
> Hercules is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
> 
> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
> See the GNU General Public License for more details.
>
> You should have received a copy of the GNU General Public License along with this program.  
> If not, see <http://www.gnu.org/licenses/>.
-->

## Description
This file should help to understand and manage bit-wise quest variables. 
You can store up to 31 boolean value into a single variable.

## Sample Variable: `MISC_QUEST`

Quest # No    | Sample Quest
:-------------| :------------
Description   | How to assign a bit-wise value and check it.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| X;```
Check Value   | ```if (MISC_QUEST & X) { ...  }```

- Where `X` refer to the bit-wise value that could be used to represent the state/progress of a quest.

--------------------------------------------------------------

## Example

Quest # 1     | Juice Maker Quest
:-------------| :------------
Description   | How to make juices. This bit keeps final state of the quest.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 1;```
Check Value   | ```if (MISC_QUEST & 1) { ...  }```

Quest # 2     | Tempestra Quest
:-------------| :------------
Description   | Determines if player has given a potion to Tempestra.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 2;```
Check Value   | ```if (MISC_QUEST & 2) { ...  }```

Quest # 3     | Morgenstein Quest
:-------------| :------------
Description   | How to make Mixture & Counteragent. This bit keeps final state of the quest.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 4;```
Check Value   | ```if (MISC_QUEST & 4) { ...  }```

Quest # 4     | Prontera Culvert Quest
:-------------| :------------
Description   | Determines if player can enter Prontera Culverts.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 8;```
Check Value   | ```if (MISC_QUEST & 8) { ...  }```

Quest # 5     | Edgar's Offer
:-------------| :------------
Description   | Cheap ticket from Izlude to Alberta. This bit keeps final state of the quest.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 16;```
Check Value   | ```if (MISC_QUEST & 16) { ...  }```

Quest # 6     | Piano Quest
:-------------| :------------
Description   | The only way from Niflheim to Umbala.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 32;```
Check Value   | ```if (MISC_QUEST & 32) { ...  }```

Quest # 7     | Bio Ethics Quest
:-------------| :------------
Description   | Quest for homunculus skill for alchemists. This bit keeps final state of the quest.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 64;```
Check Value   | ```if (MISC_QUEST & 64) { ...  }```

Quest # 8     | DTS Warper
:-------------| :------------
Description   | Determines if player has already voted.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 128;```
Check Value   | ```if (MISC_QUEST & 128) { ...  }```

Quest # 9     | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 256;```
Check Value   | ```if (MISC_QUEST & 256) { ...  }```

Quest # 10    | Cube Room
:-------------| :------------
Description   | Lighthalzen Cube Room quest (to enter Bio-Lab)
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 512;```
Check Value   | ```if (MISC_QUEST & 512) { ...  }```

Quest # 11    | Reset Skills Event
:-------------| :------------
Description   | Yuno, Hypnotist Teacher
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 1024;```
Check Value   | ```if (MISC_QUEST & 1024) { ...  }```

Quest # 12    | Slotted Arm Guard Quest
:-------------| :------------
Description   | Ninja Job Room, Boshuu
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 2048;```
Check Value   | ```if (MISC_QUEST & 2048) { ...  }```

Quest # 13    | Improved Arm Guard Quest
:-------------| :------------
Description   | Ninja Job Room, Basshu
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 4096;```
Check Value   | ```if (MISC_QUEST & 4096) { ...  }```

Quest # 14    | Rachel Sanctuary Quest
:-------------| :------------
Description   | Determines if player can access Rachel Santuary.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 8192;```
Check Value   | ```if (MISC_QUEST & 8192) { ...  }```

Quest # 15    | Message Delivery Quest
:-------------| :------------
Description   | Send a message to Elly, in Niflheim from Erious.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 16384;```
Check Value   | ```if (MISC_QUEST & 16384) { ...  }```

Quest # 16    | Umbala Domestic Dispute?
:-------------| :------------
Description   | Reward: 1 Yggdrasil Leaf.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 32768;```
Check Value   | ```if (MISC_QUEST & 32768) { ...  }```

Quest # 17    | Access to the Turtle Island
:-------------| :------------
Description   | Reward: ~1 Old Card Album , Old Violet Box, GB.
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 65536;```
Check Value   | ```if (MISC_QUEST & 65536) { ...  }```

Quest # 18    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 131072;```
Check Value   | ```if (MISC_QUEST & 131072) { ...  }```

Quest # 19    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 262144;```
Check Value   | ```if (MISC_QUEST & 262144) { ...  }```

Quest # 20    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 524288;```
Check Value   | ```if (MISC_QUEST & 524288) { ...  }```

Quest # 21    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 1048576;```
Check Value   | ```if (MISC_QUEST & 1048576) { ...  }```

Quest # 22    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 2097152;```
Check Value   | ```if (MISC_QUEST & 2097152) { ...  }```

Quest # 23    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 4194304;```
Check Value   | ```if (MISC_QUEST & 4194304) { ...  }```

Quest # 24    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 8388608;```
Check Value   | ```if (MISC_QUEST & 8388608) { ...  }```

Quest # 25    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 16777216;```
Check Value   | ```if (MISC_QUEST & 16777216) { ...  }```

Quest # 26    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 33554432;```
Check Value   | ```if (MISC_QUEST & 33554432) { ...  }```

Quest # 27    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 67108864;```
Check Value   | ```if (MISC_QUEST & 67108864) { ...  }```

Quest # 28    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 134217728;```
Check Value   | ```if (MISC_QUEST & 134217728) { ...  }```

Quest # 29    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 268435456;```
Check Value   | ```if (MISC_QUEST & 268435456) { ...  }```

Quest # 30    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 536870912;```
Check Value   | ```if (MISC_QUEST & 536870912) { ...  }```

Quest # 31    | -
:-------------| :------------
Description   | -
Assign Value  | ```MISC_QUEST = MISC_QUEST \| 1073741824;```
Check Value   | ```if (MISC_QUEST & 1073741824) { ...  }```

### Quest#32 and onwards
You had to use a new variable to store it.
The existing variable `MISC_QUEST`'s value may overflow as it already reaching the max value.
Basically the cycle repeat every 32th quests, unless the limit has been lifted in the future.

 No | Formulae    | Bits Value | Accumulate
:--:|:-----------:|-----------:|-------------: 
  1 |   2 ^  0    |          1 |           1
  2 |   2 ^  1    |          2 |           3
  3 |   2 ^  2    |          4 |           7
  4 |   2 ^  3    |          8 |          15
  5 |   2 ^  4    |         16 |          31
  6 |   2 ^  5    |         32 |          63
  7 |   2 ^  6    |         64 |         127
  8 |   2 ^  7    |        128 |         255
  9 |   2 ^  8    |        256 |         511
 10 |   2 ^  9    |        512 |        1023
 11 |   2 ^ 10    |       1024 |        2047
 12 |   2 ^ 11    |       2048 |        4095
 13 |   2 ^ 12    |       4096 |        8191
 14 |   2 ^ 13    |       8192 |       16383
 15 |   2 ^ 14    |      16384 |       32767
 16 |   2 ^ 15    |      32768 |       65535
 17 |   2 ^ 16    |      65536 |      131071
 18 |   2 ^ 17    |     131072 |      262143
 19 |   2 ^ 18    |     262144 |      524287
 20 |   2 ^ 19    |     524288 |     1048575
 21 |   2 ^ 20    |    1048576 |     2097151
 22 |   2 ^ 21    |    2097152 |     4194303
 23 |   2 ^ 22    |    4194304 |     8388607
 24 |   2 ^ 23    |    8388608 |    16777215
 25 |   2 ^ 24    |   16777216 |    33554431
 26 |   2 ^ 25    |   33554432 |    67108863
 27 |   2 ^ 26    |   67108864 |   134217727
 28 |   2 ^ 27    |  134217728 |   268435455
 29 |   2 ^ 28    |  268435456 |   536870911
 30 |   2 ^ 29    |  536870912 |  1073741823
 31 |   2 ^ 30    | 1073741824 |  2147483647