the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#include "stdafx.h"
2#include "..\..\..\Minecraft.World\net.minecraft.stats.h"
3#include "..\..\LocalPlayer.h"
4#include "..\..\..\Minecraft.World\Entity.h"
5#include "..\..\..\Minecraft.World\Level.h"
6#include "..\..\..\Minecraft.World\net.minecraft.world.entity.player.h"
7#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
8#include "..\..\..\Minecraft.World\net.minecraft.world.level.h"
9#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.h"
10#include "..\..\MinecraftServer.h"
11#include "..\..\Minecraft.h"
12#include "..\..\MultiPlayerLocalPlayer.h"
13#include "..\..\MultiPlayerLevel.h"
14#include "..\..\SurvivalMode.h"
15#include "Tutorial.h"
16#include "TutorialMessage.h"
17#include "TutorialTasks.h"
18#include "TutorialConstraints.h"
19#include "TutorialHints.h"
20
21vector<int> Tutorial::s_completableTasks;
22
23
24int Tutorial::m_iTutorialHintDelayTime = 14000;
25int Tutorial::m_iTutorialDisplayMessageTime = 7000;
26int Tutorial::m_iTutorialMinimumDisplayMessageTime = 2000;
27int Tutorial::m_iTutorialExtraReminderTime = 13000;
28int Tutorial::m_iTutorialReminderTime = m_iTutorialDisplayMessageTime + m_iTutorialExtraReminderTime;
29int Tutorial::m_iTutorialConstraintDelayRemoveTicks = 15;
30int Tutorial::m_iTutorialFreezeTimeValue = 8000;
31
32bool Tutorial::PopupMessageDetails::isSameContent(PopupMessageDetails *other)
33{
34 if(other == NULL) return false;
35
36 bool textTheSame = (m_messageId == other->m_messageId) && (m_messageString.compare(other->m_messageString) == 0);
37 bool titleTheSame = (m_titleId == other->m_titleId) && (m_titleString.compare(other->m_titleString) == 0);
38 bool promptTheSame = (m_promptId == other->m_promptId) && (m_promptString.compare(other->m_promptString) == 0);
39 return textTheSame && titleTheSame && promptTheSame;
40}
41
42void Tutorial::staticCtor()
43{
44 //
45 /*
46 *****
47 *****
48 THE ORDERING OF THESE SHOULD NOT CHANGE - Although the ordering may not be totally logical due to the order tasks were added, these map
49 to bits in the profile data in this order. New tasks/hints should be added at the end.
50 *****
51 *****
52 */
53 s_completableTasks.push_back( e_Tutorial_State_Inventory_Menu );
54 s_completableTasks.push_back( e_Tutorial_State_2x2Crafting_Menu );
55 s_completableTasks.push_back( e_Tutorial_State_3x3Crafting_Menu );
56 s_completableTasks.push_back( e_Tutorial_State_Furnace_Menu );
57
58 s_completableTasks.push_back( e_Tutorial_State_Riding_Minecart );
59 s_completableTasks.push_back( e_Tutorial_State_Riding_Boat );
60 s_completableTasks.push_back( e_Tutorial_State_Fishing );
61 s_completableTasks.push_back( e_Tutorial_State_Bed );
62
63 s_completableTasks.push_back( e_Tutorial_State_Container_Menu );
64 s_completableTasks.push_back( e_Tutorial_State_Trap_Menu );
65 s_completableTasks.push_back( e_Tutorial_State_Redstone_And_Piston );
66 s_completableTasks.push_back( e_Tutorial_State_Portal );
67 s_completableTasks.push_back( e_Tutorial_State_Creative_Inventory_Menu );
68 s_completableTasks.push_back( e_Tutorial_State_Food_Bar );
69 s_completableTasks.push_back( e_Tutorial_State_CreativeMode );
70 s_completableTasks.push_back( e_Tutorial_State_Brewing );
71 s_completableTasks.push_back( e_Tutorial_State_Brewing_Menu );
72 s_completableTasks.push_back( e_Tutorial_State_Enchanting );
73
74 s_completableTasks.push_back( e_Tutorial_Hint_Hold_To_Mine );
75 s_completableTasks.push_back( e_Tutorial_Hint_Tool_Damaged );
76 s_completableTasks.push_back( e_Tutorial_Hint_Swim_Up );
77
78 s_completableTasks.push_back( e_Tutorial_Hint_Unused_2 );
79 s_completableTasks.push_back( e_Tutorial_Hint_Unused_3 );
80 s_completableTasks.push_back( e_Tutorial_Hint_Unused_4 );
81 s_completableTasks.push_back( e_Tutorial_Hint_Unused_5 );
82 s_completableTasks.push_back( e_Tutorial_Hint_Unused_6 );
83 s_completableTasks.push_back( e_Tutorial_Hint_Unused_7 );
84 s_completableTasks.push_back( e_Tutorial_Hint_Unused_8 );
85 s_completableTasks.push_back( e_Tutorial_Hint_Unused_9 );
86 s_completableTasks.push_back( e_Tutorial_Hint_Unused_10 );
87
88 s_completableTasks.push_back( e_Tutorial_Hint_Rock );
89 s_completableTasks.push_back( e_Tutorial_Hint_Stone );
90 s_completableTasks.push_back( e_Tutorial_Hint_Planks );
91 s_completableTasks.push_back( e_Tutorial_Hint_Sapling );
92 s_completableTasks.push_back( e_Tutorial_Hint_Unbreakable );
93 s_completableTasks.push_back( e_Tutorial_Hint_Water );
94 s_completableTasks.push_back( e_Tutorial_Hint_Lava );
95 s_completableTasks.push_back( e_Tutorial_Hint_Sand );
96 s_completableTasks.push_back( e_Tutorial_Hint_Gravel );
97 s_completableTasks.push_back( e_Tutorial_Hint_Gold_Ore );
98 s_completableTasks.push_back( e_Tutorial_Hint_Iron_Ore );
99 s_completableTasks.push_back( e_Tutorial_Hint_Coal_Ore );
100 s_completableTasks.push_back( e_Tutorial_Hint_Tree_Trunk );
101 s_completableTasks.push_back( e_Tutorial_Hint_Glass );
102 s_completableTasks.push_back( e_Tutorial_Hint_Leaves );
103 s_completableTasks.push_back( e_Tutorial_Hint_Lapis_Ore );
104 s_completableTasks.push_back( e_Tutorial_Hint_Lapis_Block );
105 s_completableTasks.push_back( e_Tutorial_Hint_Dispenser );
106 s_completableTasks.push_back( e_Tutorial_Hint_Sandstone );
107 s_completableTasks.push_back( e_Tutorial_Hint_Note_Block );
108 s_completableTasks.push_back( e_Tutorial_Hint_Powered_Rail );
109 s_completableTasks.push_back( e_Tutorial_Hint_Detector_Rail );
110 s_completableTasks.push_back( e_Tutorial_Hint_Tall_Grass );
111 s_completableTasks.push_back( e_Tutorial_Hint_Wool );
112 s_completableTasks.push_back( e_Tutorial_Hint_Flower );
113 s_completableTasks.push_back( e_Tutorial_Hint_Mushroom );
114 s_completableTasks.push_back( e_Tutorial_Hint_Gold_Block );
115 s_completableTasks.push_back( e_Tutorial_Hint_Iron_Block );
116 s_completableTasks.push_back( e_Tutorial_Hint_Stone_Slab );
117 s_completableTasks.push_back( e_Tutorial_Hint_Red_Brick );
118 s_completableTasks.push_back( e_Tutorial_Hint_Tnt );
119 s_completableTasks.push_back( e_Tutorial_Hint_Bookshelf );
120 s_completableTasks.push_back( e_Tutorial_Hint_Moss_Stone );
121 s_completableTasks.push_back( e_Tutorial_Hint_Obsidian );
122 s_completableTasks.push_back( e_Tutorial_Hint_Torch );
123 s_completableTasks.push_back( e_Tutorial_Hint_MobSpawner );
124 s_completableTasks.push_back( e_Tutorial_Hint_Chest );
125 s_completableTasks.push_back( e_Tutorial_Hint_Redstone );
126 s_completableTasks.push_back( e_Tutorial_Hint_Diamond_Ore );
127 s_completableTasks.push_back( e_Tutorial_Hint_Diamond_Block );
128 s_completableTasks.push_back( e_Tutorial_Hint_Crafting_Table );
129 s_completableTasks.push_back( e_Tutorial_Hint_Crops );
130 s_completableTasks.push_back( e_Tutorial_Hint_Farmland );
131 s_completableTasks.push_back( e_Tutorial_Hint_Furnace );
132 s_completableTasks.push_back( e_Tutorial_Hint_Sign );
133 s_completableTasks.push_back( e_Tutorial_Hint_Door_Wood );
134 s_completableTasks.push_back( e_Tutorial_Hint_Ladder );
135 s_completableTasks.push_back( e_Tutorial_Hint_Rail );
136 s_completableTasks.push_back( e_Tutorial_Hint_Stairs_Stone );
137 s_completableTasks.push_back( e_Tutorial_Hint_Lever );
138 s_completableTasks.push_back( e_Tutorial_Hint_PressurePlate );
139 s_completableTasks.push_back( e_Tutorial_Hint_Door_Iron );
140 s_completableTasks.push_back( e_Tutorial_Hint_Redstone_Ore );
141 s_completableTasks.push_back( e_Tutorial_Hint_Redstone_Torch );
142 s_completableTasks.push_back( e_Tutorial_Hint_Button );
143 s_completableTasks.push_back( e_Tutorial_Hint_Snow );
144 s_completableTasks.push_back( e_Tutorial_Hint_Ice );
145 s_completableTasks.push_back( e_Tutorial_Hint_Cactus );
146 s_completableTasks.push_back( e_Tutorial_Hint_Clay );
147 s_completableTasks.push_back( e_Tutorial_Hint_Sugarcane );
148 s_completableTasks.push_back( e_Tutorial_Hint_Record_Player );
149 s_completableTasks.push_back( e_Tutorial_Hint_Pumpkin );
150 s_completableTasks.push_back( e_Tutorial_Hint_Hell_Rock );
151 s_completableTasks.push_back( e_Tutorial_Hint_Hell_Sand );
152 s_completableTasks.push_back( e_Tutorial_Hint_Glowstone );
153 s_completableTasks.push_back( e_Tutorial_Hint_Portal );
154 s_completableTasks.push_back( e_Tutorial_Hint_Pumpkin_Lit );
155 s_completableTasks.push_back( e_Tutorial_Hint_Cake );
156 s_completableTasks.push_back( e_Tutorial_Hint_Redstone_Repeater );
157 s_completableTasks.push_back( e_Tutorial_Hint_Trapdoor );
158 s_completableTasks.push_back( e_Tutorial_Hint_Piston );
159 s_completableTasks.push_back( e_Tutorial_Hint_Sticky_Piston );
160 s_completableTasks.push_back( e_Tutorial_Hint_Monster_Stone_Egg );
161 s_completableTasks.push_back( e_Tutorial_Hint_Stone_Brick_Smooth );
162 s_completableTasks.push_back( e_Tutorial_Hint_Huge_Mushroom );
163 s_completableTasks.push_back( e_Tutorial_Hint_Iron_Fence );
164 s_completableTasks.push_back( e_Tutorial_Hint_Thin_Glass );
165 s_completableTasks.push_back( e_Tutorial_Hint_Melon );
166 s_completableTasks.push_back( e_Tutorial_Hint_Vine );
167 s_completableTasks.push_back( e_Tutorial_Hint_Fence_Gate );
168 s_completableTasks.push_back( e_Tutorial_Hint_Mycel );
169 s_completableTasks.push_back( e_Tutorial_Hint_Water_Lily );
170 s_completableTasks.push_back( e_Tutorial_Hint_Nether_Brick );
171 s_completableTasks.push_back( e_Tutorial_Hint_Nether_Fence );
172 s_completableTasks.push_back( e_Tutorial_Hint_Nether_Stalk );
173 s_completableTasks.push_back( e_Tutorial_Hint_Enchant_Table );
174 s_completableTasks.push_back( e_Tutorial_Hint_Brewing_Stand );
175 s_completableTasks.push_back( e_Tutorial_Hint_Cauldron );
176 s_completableTasks.push_back( e_Tutorial_Hint_End_Portal );
177 s_completableTasks.push_back( e_Tutorial_Hint_End_Portal_Frame );
178
179 s_completableTasks.push_back( e_Tutorial_Hint_Squid );
180 s_completableTasks.push_back( e_Tutorial_Hint_Cow );
181 s_completableTasks.push_back( e_Tutorial_Hint_Sheep );
182 s_completableTasks.push_back( e_Tutorial_Hint_Chicken );
183 s_completableTasks.push_back( e_Tutorial_Hint_Pig );
184 s_completableTasks.push_back( e_Tutorial_Hint_Wolf );
185 s_completableTasks.push_back( e_Tutorial_Hint_Creeper );
186 s_completableTasks.push_back( e_Tutorial_Hint_Skeleton );
187 s_completableTasks.push_back( e_Tutorial_Hint_Spider );
188 s_completableTasks.push_back( e_Tutorial_Hint_Zombie );
189 s_completableTasks.push_back( e_Tutorial_Hint_Pig_Zombie );
190 s_completableTasks.push_back( e_Tutorial_Hint_Ghast );
191 s_completableTasks.push_back( e_Tutorial_Hint_Slime );
192 s_completableTasks.push_back( e_Tutorial_Hint_Enderman );
193 s_completableTasks.push_back( e_Tutorial_Hint_Silverfish );
194 s_completableTasks.push_back( e_Tutorial_Hint_Cave_Spider );
195 s_completableTasks.push_back( e_Tutorial_Hint_MushroomCow );
196 s_completableTasks.push_back( e_Tutorial_Hint_SnowMan );
197 s_completableTasks.push_back( e_Tutorial_Hint_IronGolem );
198 s_completableTasks.push_back( e_Tutorial_Hint_EnderDragon );
199 s_completableTasks.push_back( e_Tutorial_Hint_Blaze );
200 s_completableTasks.push_back( e_Tutorial_Hint_Lava_Slime );
201
202 s_completableTasks.push_back( e_Tutorial_Hint_Ozelot );
203 s_completableTasks.push_back( e_Tutorial_Hint_Villager );
204
205 s_completableTasks.push_back( e_Tutorial_Hint_Item_Shovel );
206 s_completableTasks.push_back( e_Tutorial_Hint_Item_Hatchet );
207 s_completableTasks.push_back( e_Tutorial_Hint_Item_Pickaxe );
208 s_completableTasks.push_back( e_Tutorial_Hint_Item_Flint_And_Steel );
209 s_completableTasks.push_back( e_Tutorial_Hint_Item_Apple );
210 s_completableTasks.push_back( e_Tutorial_Hint_Item_Bow );
211 s_completableTasks.push_back( e_Tutorial_Hint_Item_Arrow );
212 s_completableTasks.push_back( e_Tutorial_Hint_Item_Coal );
213 s_completableTasks.push_back( e_Tutorial_Hint_Item_Diamond );
214 s_completableTasks.push_back( e_Tutorial_Hint_Item_Iron_Ingot );
215 s_completableTasks.push_back( e_Tutorial_Hint_Item_Gold_Ingot );
216 s_completableTasks.push_back( e_Tutorial_Hint_Item_Sword );
217 s_completableTasks.push_back( e_Tutorial_Hint_Item_Stick );
218 s_completableTasks.push_back( e_Tutorial_Hint_Item_Bowl );
219 s_completableTasks.push_back( e_Tutorial_Hint_Item_Mushroom_Stew );
220 s_completableTasks.push_back( e_Tutorial_Hint_Item_String );
221 s_completableTasks.push_back( e_Tutorial_Hint_Item_Feather );
222 s_completableTasks.push_back( e_Tutorial_Hint_Item_Sulphur );
223 s_completableTasks.push_back( e_Tutorial_Hint_Item_Hoe );
224 s_completableTasks.push_back( e_Tutorial_Hint_Item_Seeds );
225 s_completableTasks.push_back( e_Tutorial_Hint_Item_Wheat );
226 s_completableTasks.push_back( e_Tutorial_Hint_Item_Bread );
227 s_completableTasks.push_back( e_Tutorial_Hint_Item_Helmet );
228 s_completableTasks.push_back( e_Tutorial_Hint_Item_Chestplate );
229 s_completableTasks.push_back( e_Tutorial_Hint_Item_Leggings );
230 s_completableTasks.push_back( e_Tutorial_Hint_Item_Boots );
231 s_completableTasks.push_back( e_Tutorial_Hint_Item_Flint );
232 s_completableTasks.push_back( e_Tutorial_Hint_Item_Porkchop_Raw );
233 s_completableTasks.push_back( e_Tutorial_Hint_Item_Porkchop_Cooked );
234 s_completableTasks.push_back( e_Tutorial_Hint_Item_Painting );
235 s_completableTasks.push_back( e_Tutorial_Hint_Item_Apple_Gold );
236 s_completableTasks.push_back( e_Tutorial_Hint_Item_Sign );
237 s_completableTasks.push_back( e_Tutorial_Hint_Item_Door_Wood );
238 s_completableTasks.push_back( e_Tutorial_Hint_Item_Bucket_Empty );
239 s_completableTasks.push_back( e_Tutorial_Hint_Item_Bucket_Water );
240 s_completableTasks.push_back( e_Tutorial_Hint_Item_Bucket_Lava );
241 s_completableTasks.push_back( e_Tutorial_Hint_Item_Minecart );
242 s_completableTasks.push_back( e_Tutorial_Hint_Item_Saddle );
243 s_completableTasks.push_back( e_Tutorial_Hint_Item_Door_Iron );
244 s_completableTasks.push_back( e_Tutorial_Hint_Item_Redstone );
245 s_completableTasks.push_back( e_Tutorial_Hint_Item_Snowball );
246 s_completableTasks.push_back( e_Tutorial_Hint_Item_Boat );
247 s_completableTasks.push_back( e_Tutorial_Hint_Item_Leather );
248 s_completableTasks.push_back( e_Tutorial_Hint_Item_Milk );
249 s_completableTasks.push_back( e_Tutorial_Hint_Item_Brick );
250 s_completableTasks.push_back( e_Tutorial_Hint_Item_Clay );
251 s_completableTasks.push_back( e_Tutorial_Hint_Item_Reeds );
252 s_completableTasks.push_back( e_Tutorial_Hint_Item_Paper );
253 s_completableTasks.push_back( e_Tutorial_Hint_Item_Book );
254 s_completableTasks.push_back( e_Tutorial_Hint_Item_Slimeball );
255 s_completableTasks.push_back( e_Tutorial_Hint_Item_Minecart_Chest );
256 s_completableTasks.push_back( e_Tutorial_Hint_Item_Minecart_Furnace );
257 s_completableTasks.push_back( e_Tutorial_Hint_Item_Egg );
258 s_completableTasks.push_back( e_Tutorial_Hint_Item_Compass );
259 s_completableTasks.push_back( e_Tutorial_Hint_Item_Clock );
260 s_completableTasks.push_back( e_Tutorial_Hint_Item_Yellow_Dust );
261 s_completableTasks.push_back( e_Tutorial_Hint_Item_Fish_Raw );
262 s_completableTasks.push_back( e_Tutorial_Hint_Item_Fish_Cooked );
263 s_completableTasks.push_back( e_Tutorial_Hint_Item_Dye_Powder );
264 s_completableTasks.push_back( e_Tutorial_Hint_Item_Bone );
265 s_completableTasks.push_back( e_Tutorial_Hint_Item_Sugar );
266 s_completableTasks.push_back( e_Tutorial_Hint_Item_Cake );
267 s_completableTasks.push_back( e_Tutorial_Hint_Item_Diode );
268 s_completableTasks.push_back( e_Tutorial_Hint_Item_Cookie );
269 s_completableTasks.push_back( e_Tutorial_Hint_Item_Map );
270 s_completableTasks.push_back( e_Tutorial_Hint_Item_Record );
271
272 s_completableTasks.push_back( e_Tutorial_Hint_White_Stone );
273 s_completableTasks.push_back( e_Tutorial_Hint_Dragon_Egg );
274 s_completableTasks.push_back( e_Tutorial_Hint_RedstoneLamp );
275 s_completableTasks.push_back( e_Tutorial_Hint_Cocoa);
276
277 s_completableTasks.push_back( e_Tutorial_Hint_EmeraldOre );
278 s_completableTasks.push_back( e_Tutorial_Hint_EmeraldBlock );
279 s_completableTasks.push_back( e_Tutorial_Hint_EnderChest );
280 s_completableTasks.push_back( e_Tutorial_Hint_TripwireSource );
281 s_completableTasks.push_back( e_Tutorial_Hint_Tripwire );
282 s_completableTasks.push_back( e_Tutorial_Hint_CobblestoneWall );
283 s_completableTasks.push_back( e_Tutorial_Hint_Flowerpot );
284 s_completableTasks.push_back( e_Tutorial_Hint_Anvil );
285 s_completableTasks.push_back( e_Tutorial_Hint_QuartzOre );
286 s_completableTasks.push_back( e_Tutorial_Hint_QuartzBlock );
287 s_completableTasks.push_back( e_Tutorial_Hint_WoolCarpet );
288
289 s_completableTasks.push_back( e_Tutorial_Hint_Potato );
290 s_completableTasks.push_back( e_Tutorial_Hint_Carrot );
291
292 s_completableTasks.push_back( e_Tutorial_Hint_CommandBlock );
293 s_completableTasks.push_back( e_Tutorial_Hint_Beacon );
294 s_completableTasks.push_back( e_Tutorial_Hint_Activator_Rail );
295
296 s_completableTasks.push_back( eTutorial_Telemetry_TrialStart );
297 s_completableTasks.push_back( eTutorial_Telemetry_Halfway );
298 s_completableTasks.push_back( eTutorial_Telemetry_Complete );
299
300 s_completableTasks.push_back( eTutorial_Telemetry_Unused_1 );
301 s_completableTasks.push_back( eTutorial_Telemetry_Unused_2 );
302 s_completableTasks.push_back( eTutorial_Telemetry_Unused_3 );
303 s_completableTasks.push_back( eTutorial_Telemetry_Unused_4 );
304 s_completableTasks.push_back( eTutorial_Telemetry_Unused_5 );
305 s_completableTasks.push_back( eTutorial_Telemetry_Unused_6 );
306 s_completableTasks.push_back( eTutorial_Telemetry_Unused_7 );
307 s_completableTasks.push_back( eTutorial_Telemetry_Unused_8 );
308 s_completableTasks.push_back( eTutorial_Telemetry_Unused_9 );
309 s_completableTasks.push_back( eTutorial_Telemetry_Unused_10 );
310
311 s_completableTasks.push_back( e_Tutorial_State_Enchanting_Menu );
312 s_completableTasks.push_back( e_Tutorial_State_Farming );
313 s_completableTasks.push_back( e_Tutorial_State_Breeding );
314 s_completableTasks.push_back( e_Tutorial_State_Golem );
315 s_completableTasks.push_back( e_Tutorial_State_Trading );
316 s_completableTasks.push_back( e_Tutorial_State_Trading_Menu );
317 s_completableTasks.push_back( e_Tutorial_State_Anvil );
318 s_completableTasks.push_back( e_Tutorial_State_Anvil_Menu );
319 s_completableTasks.push_back( e_Tutorial_State_Enderchests );
320 s_completableTasks.push_back( e_Tutorial_State_Horse_Menu );
321 s_completableTasks.push_back( e_Tutorial_State_Hopper_Menu );
322
323 s_completableTasks.push_back( e_Tutorial_Hint_Wither );
324 s_completableTasks.push_back( e_Tutorial_Hint_Witch );
325 s_completableTasks.push_back( e_Tutorial_Hint_Bat );
326 s_completableTasks.push_back( e_Tutorial_Hint_Horse );
327
328 s_completableTasks.push_back( e_Tutorial_Hint_RedstoneBlock );
329 s_completableTasks.push_back( e_Tutorial_Hint_DaylightDetector );
330 s_completableTasks.push_back( e_Tutorial_Hint_Dropper );
331 s_completableTasks.push_back( e_Tutorial_Hint_Hopper );
332 s_completableTasks.push_back( e_Tutorial_Hint_Comparator );
333 s_completableTasks.push_back( e_Tutorial_Hint_ChestTrap );
334 s_completableTasks.push_back( e_Tutorial_Hint_HayBlock );
335 s_completableTasks.push_back( e_Tutorial_Hint_ClayHardened );
336 s_completableTasks.push_back( e_Tutorial_Hint_ClayHardenedColored );
337 s_completableTasks.push_back( e_Tutorial_Hint_CoalBlock );
338
339 s_completableTasks.push_back( e_Tutorial_State_Beacon_Menu );
340 s_completableTasks.push_back( e_Tutorial_State_Fireworks_Menu );
341 s_completableTasks.push_back( e_Tutorial_State_Horse );
342 s_completableTasks.push_back( e_Tutorial_State_Hopper );
343 s_completableTasks.push_back( e_Tutorial_State_Beacon );
344 s_completableTasks.push_back( e_Tutorial_State_Fireworks );
345
346 if( s_completableTasks.size() > TUTORIAL_PROFILE_STORAGE_BITS )
347 {
348 app.DebugPrintf("Warning: Too many tutorial completable tasks added, not enough bits allocated to stored them in the profile data");
349 assert(false);
350 }
351}
352
353Tutorial::Tutorial(int iPad, bool isFullTutorial /*= false*/) : m_iPad( iPad )
354{
355 m_isFullTutorial = isFullTutorial;
356 m_fullTutorialComplete = false;
357 m_allTutorialsComplete = false;
358 hasRequestedUI = false;
359 uiTempDisabled = false;
360 m_hintDisplayed = false;
361 m_freezeTime = false;
362 m_timeFrozen = false;
363 m_UIScene = NULL;
364 m_allowShow = true;
365 m_bHasTickedOnce = false;
366 m_firstTickTime = 0;
367
368 m_lastMessage = NULL;
369
370 lastMessageTime = 0;
371 m_iTaskReminders = 0;
372 m_lastMessageState = e_Tutorial_State_Gameplay;
373
374 m_CurrentState = e_Tutorial_State_Gameplay;
375 m_hasStateChanged = false;
376#ifdef _XBOX
377 m_hTutorialScene=NULL;
378#endif
379
380 for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i)
381 {
382 currentTask[i] = NULL;
383 currentFailedConstraint[i] = NULL;
384 }
385
386 // DEFAULT TASKS THAT ALL TUTORIALS SHARE
387 /*
388 *
389 *
390 * GAMEPLAY
391 *
392 */
393
394 if(!isHintCompleted(e_Tutorial_Hint_Hold_To_Mine)) addHint(e_Tutorial_State_Gameplay, new TutorialHint(e_Tutorial_Hint_Hold_To_Mine, this, IDS_TUTORIAL_HINT_HOLD_TO_MINE, TutorialHint::e_Hint_HoldToMine) );
395 if(!isHintCompleted(e_Tutorial_Hint_Tool_Damaged)) addHint(e_Tutorial_State_Gameplay, new TutorialHint(e_Tutorial_Hint_Tool_Damaged, this, IDS_TUTORIAL_HINT_TOOL_DAMAGED, TutorialHint::e_Hint_ToolDamaged) );
396 if(!isHintCompleted(e_Tutorial_Hint_Swim_Up)) addHint(e_Tutorial_State_Gameplay, new TutorialHint(e_Tutorial_Hint_Swim_Up, this, IDS_TUTORIAL_HINT_SWIM_UP, TutorialHint::e_Hint_SwimUp) );
397
398 /*
399 * TILE HINTS
400 */
401 int rockItems[] = {Tile::stone_Id};
402 if(!isHintCompleted(e_Tutorial_Hint_Rock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Rock, this, rockItems, 1 ) );
403
404 int stoneItems[] = {Tile::cobblestone_Id};
405 if(!isHintCompleted(e_Tutorial_Hint_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone, this, stoneItems, 1 ) );
406
407 int plankItems[] = {Tile::wood_Id};
408 if(!isHintCompleted(e_Tutorial_Hint_Planks)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Planks, this, plankItems, 1 ) );
409
410 int saplingItems[] = {Tile::sapling_Id};
411 if(!isHintCompleted(e_Tutorial_Hint_Sapling)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sapling, this, saplingItems, 1 ) );
412
413 int unbreakableItems[] = {Tile::unbreakable_Id};
414 if(!isHintCompleted(e_Tutorial_Hint_Unbreakable)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Unbreakable, this, unbreakableItems, 1 ) );
415
416 int waterItems[] = {Tile::water_Id, Tile::calmWater_Id};
417 if(!isHintCompleted(e_Tutorial_Hint_Water)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Water, this, waterItems, 2 ) );
418
419 int lavaItems[] = {Tile::lava_Id, Tile::calmLava_Id};
420 if(!isHintCompleted(e_Tutorial_Hint_Lava)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Lava, this, lavaItems, 2 ) );
421
422 int sandItems[] = {Tile::sand_Id};
423 if(!isHintCompleted(e_Tutorial_Hint_Sand)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sand, this, sandItems, 1 ) );
424
425 int gravelItems[] = {Tile::gravel_Id};
426 if(!isHintCompleted(e_Tutorial_Hint_Gravel)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Gravel, this, gravelItems, 1 ) );
427
428 int goldOreItems[] = {Tile::goldOre_Id};
429 if(!isHintCompleted(e_Tutorial_Hint_Gold_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Gold_Ore, this, goldOreItems, 1 ) );
430
431 int ironOreItems[] = {Tile::ironOre_Id};
432 if(!isHintCompleted(e_Tutorial_Hint_Iron_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Iron_Ore, this, ironOreItems, 1 ) );
433
434 int coalOreItems[] = {Tile::coalOre_Id};
435 if(!isHintCompleted(e_Tutorial_Hint_Coal_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Coal_Ore, this, coalOreItems, 1 ) );
436
437 int treeTrunkItems[] = {Tile::treeTrunk_Id};
438 if(!isHintCompleted(e_Tutorial_Hint_Tree_Trunk)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tree_Trunk, this, treeTrunkItems, 1 ) );
439
440 int leavesItems[] = {Tile::leaves_Id};
441 if(!isHintCompleted(e_Tutorial_Hint_Leaves)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Leaves, this, leavesItems, 1 ) );
442
443 int glassItems[] = {Tile::glass_Id};
444 if(!isHintCompleted(e_Tutorial_Hint_Glass)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Glass, this, glassItems, 1 ) );
445
446 int lapisOreItems[] = {Tile::lapisOre_Id};
447 if(!isHintCompleted(e_Tutorial_Hint_Lapis_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Lapis_Ore, this, lapisOreItems, 1 ) );
448
449 int lapisBlockItems[] = {Tile::lapisBlock_Id};
450 if(!isHintCompleted(e_Tutorial_Hint_Lapis_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Lapis_Block, this, lapisBlockItems, 1 ) );
451
452 int dispenserItems[] = {Tile::dispenser_Id};
453 if(!isHintCompleted(e_Tutorial_Hint_Dispenser)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Dispenser, this, dispenserItems, 1 ) );
454
455 int sandstoneItems[] = {Tile::sandStone_Id};
456 if(!isHintCompleted(e_Tutorial_Hint_Sandstone))
457 {
458 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, 1, -1, SandStoneTile::TYPE_DEFAULT ) );
459 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, 1, -1, SandStoneTile::TYPE_HEIROGLYPHS ) );
460 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sandstone, this, sandstoneItems, 1, -1, SandStoneTile::TYPE_SMOOTHSIDE ) );
461 }
462
463 int noteBlockItems[] = {Tile::noteblock_Id};
464 if(!isHintCompleted(e_Tutorial_Hint_Note_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Note_Block, this, noteBlockItems, 1 ) );
465
466 int poweredRailItems[] = {Tile::goldenRail_Id};
467 if(!isHintCompleted(e_Tutorial_Hint_Powered_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Powered_Rail, this, poweredRailItems, 1 ) );
468
469 int detectorRailItems[] = {Tile::detectorRail_Id};
470 if(!isHintCompleted(e_Tutorial_Hint_Detector_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Detector_Rail, this, detectorRailItems, 1 ) );
471
472 int tallGrassItems[] = {Tile::tallgrass_Id};
473 if(!isHintCompleted(e_Tutorial_Hint_Tall_Grass))
474 {
475 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::DEAD_SHRUB ) );
476 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::TALL_GRASS ) );
477 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tall_Grass, this, tallGrassItems, 1, -1, TallGrass::FERN ) );
478 }
479
480 int woolItems[] = {Tile::wool_Id};
481 if(!isHintCompleted(e_Tutorial_Hint_Wool)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Wool, this, woolItems, 1 ) );
482
483 int flowerItems[] = {Tile::flower_Id, Tile::rose_Id};
484 if(!isHintCompleted(e_Tutorial_Hint_Flower)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Flower, this, flowerItems, 2 ) );
485
486 int mushroomItems[] = {Tile::mushroom_brown_Id, Tile::mushroom_red_Id};
487 if(!isHintCompleted(e_Tutorial_Hint_Mushroom)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Mushroom, this, mushroomItems, 2 ) );
488
489 int goldBlockItems[] = {Tile::goldBlock_Id};
490 if(!isHintCompleted(e_Tutorial_Hint_Gold_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Gold_Block, this, goldBlockItems, 1 ) );
491
492 int ironBlockItems[] = {Tile::ironBlock_Id};
493 if(!isHintCompleted(e_Tutorial_Hint_Iron_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Iron_Block, this, ironBlockItems, 1 ) );
494
495 int stoneSlabItems[] = {Tile::stoneSlabHalf_Id, Tile::stoneSlab_Id};
496 if(!isHintCompleted(e_Tutorial_Hint_Stone_Slab))
497 {
498 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::STONE_SLAB ) );
499 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::SAND_SLAB ) );
500 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::WOOD_SLAB ) );
501 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::COBBLESTONE_SLAB ) );
502 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::BRICK_SLAB ) );
503 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::SMOOTHBRICK_SLAB ) );
504 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::NETHERBRICK_SLAB ) );
505 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, stoneSlabItems, 2, -1, StoneSlabTile::QUARTZ_SLAB ) );
506 }
507
508 int woodSlabItems[] = {Tile::woodSlabHalf_Id, Tile::woodSlab_Id};
509 if(!isHintCompleted(e_Tutorial_Hint_Stone_Slab))
510 {
511 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::BIRCH_TRUNK ) );
512 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Slab, this, woodSlabItems, 2, -1, TreeTile::DARK_TRUNK ) );
513 }
514
515 int redBrickItems[] = {Tile::redBrick_Id};
516 if(!isHintCompleted(e_Tutorial_Hint_Red_Brick)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Red_Brick, this, redBrickItems, 1 ) );
517
518 int tntItems[] = {Tile::tnt_Id};
519 if(!isHintCompleted(e_Tutorial_Hint_Tnt)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tnt, this, tntItems, 1 ) );
520
521 int bookshelfItems[] = {Tile::bookshelf_Id};
522 if(!isHintCompleted(e_Tutorial_Hint_Bookshelf)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Bookshelf, this, bookshelfItems, 1 ) );
523
524 int mossStoneItems[] = {Tile::mossyCobblestone_Id};
525 if(!isHintCompleted(e_Tutorial_Hint_Moss_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Moss_Stone, this, mossStoneItems, 1 ) );
526
527 int obsidianItems[] = {Tile::obsidian_Id};
528 if(!isHintCompleted(e_Tutorial_Hint_Obsidian)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Obsidian, this, obsidianItems, 1 ) );
529
530 int torchItems[] = {Tile::torch_Id};
531 if(!isHintCompleted(e_Tutorial_Hint_Torch)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Torch, this, torchItems, 1 ) );
532
533 int mobSpawnerItems[] = {Tile::mobSpawner_Id};
534 if(!isHintCompleted(e_Tutorial_Hint_MobSpawner)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_MobSpawner, this, mobSpawnerItems, 1 ) );
535
536 int chestItems[] = {Tile::chest_Id};
537 if(!isHintCompleted(e_Tutorial_Hint_Chest)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Chest, this, chestItems, 1 ) );
538
539 int redstoneItems[] = {Tile::redStoneDust_Id};
540 if(!isHintCompleted(e_Tutorial_Hint_Redstone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone, this, redstoneItems, 1, Item::redStone_Id ) );
541
542 int diamondOreItems[] = {Tile::diamondOre_Id};
543 if(!isHintCompleted(e_Tutorial_Hint_Diamond_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Diamond_Ore, this, diamondOreItems, 1 ) );
544
545 int diamondBlockItems[] = {Tile::diamondBlock_Id};
546 if(!isHintCompleted(e_Tutorial_Hint_Diamond_Block)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Diamond_Block, this, diamondBlockItems, 1 ) );
547
548 int craftingTableItems[] = {Tile::workBench_Id};
549 if(!isHintCompleted(e_Tutorial_Hint_Crafting_Table)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Crafting_Table, this, craftingTableItems, 1 ) );
550
551 int cropsItems[] = {Tile::wheat_Id};
552 if(!isHintCompleted(e_Tutorial_Hint_Crops)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Crops, this, cropsItems, 1, -1, -1, 7 ) );
553
554 int farmlandItems[] = {Tile::farmland_Id};
555 if(!isHintCompleted(e_Tutorial_Hint_Farmland)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Farmland, this, farmlandItems, 1 ) );
556
557 int furnaceItems[] = {Tile::furnace_Id, Tile::furnace_lit_Id};
558 if(!isHintCompleted(e_Tutorial_Hint_Furnace)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Furnace, this, furnaceItems, 2 ) );
559
560 int signItems[] = {Tile::sign_Id, Tile::wallSign_Id};
561 if(!isHintCompleted(e_Tutorial_Hint_Sign)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sign, this, signItems, 2, Item::sign_Id ) );
562
563 int doorWoodItems[] = {Tile::door_wood_Id};
564 if(!isHintCompleted(e_Tutorial_Hint_Door_Wood)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Door_Wood, this, doorWoodItems, 1, Item::door_wood->id ) );
565
566 int ladderItems[] = {Tile::ladder_Id};
567 if(!isHintCompleted(e_Tutorial_Hint_Ladder)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Ladder, this, ladderItems, 1 ) );
568
569 int stairsStoneItems[] = {Tile::stairs_stone_Id,Tile::stairs_bricks_Id,Tile::stairs_stoneBrick_Id,Tile::stairs_wood_Id,Tile::stairs_sprucewood_Id,Tile::stairs_birchwood_Id,Tile::stairs_netherBricks_Id,Tile::stairs_sandstone_Id,Tile::stairs_quartz_Id};
570 if(!isHintCompleted(e_Tutorial_Hint_Stairs_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stairs_Stone, this, stairsStoneItems, 9 ) );
571
572 int railItems[] = {Tile::rail_Id};
573 if(!isHintCompleted(e_Tutorial_Hint_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Rail, this, railItems, 1 ) );
574
575 int leverItems[] = {Tile::lever_Id};
576 if(!isHintCompleted(e_Tutorial_Hint_Lever)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Lever, this, leverItems, 1 ) );
577
578 int pressurePlateItems[] = {Tile::pressurePlate_stone_Id, Tile::pressurePlate_wood_Id};
579 if(!isHintCompleted(e_Tutorial_Hint_PressurePlate)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_PressurePlate, this, pressurePlateItems, 2 ) );
580
581 int doorIronItems[] = {Tile::door_iron_Id};
582 if(!isHintCompleted(e_Tutorial_Hint_Door_Iron)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Door_Iron, this, doorIronItems, 1, Item::door_iron->id ) );
583
584 int redstoneOreItems[] = {Tile::redStoneOre_Id, Tile::redStoneOre_lit_Id};
585 if(!isHintCompleted(e_Tutorial_Hint_Redstone_Ore)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone_Ore, this, redstoneOreItems, 2 ) );
586
587 int redstoneTorchItems[] = {Tile::redstoneTorch_off_Id, Tile::redstoneTorch_on_Id};
588 if(!isHintCompleted(e_Tutorial_Hint_Redstone_Torch)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone_Torch, this, redstoneTorchItems, 2 ) );
589
590 int buttonItems[] = {Tile::button_stone_Id, Tile::button_wood_Id};
591 if(!isHintCompleted(e_Tutorial_Hint_Button)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Button, this, buttonItems, 2 ) );
592
593 int snowItems[] = {Tile::snow_Id};
594 if(!isHintCompleted(e_Tutorial_Hint_Snow)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Snow, this, snowItems, 1 ) );
595
596 int iceItems[] = {Tile::ice_Id};
597 if(!isHintCompleted(e_Tutorial_Hint_Ice)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Ice, this, iceItems, 1 ) );
598
599 int cactusItems[] = {Tile::cactus_Id};
600 if(!isHintCompleted(e_Tutorial_Hint_Cactus)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Cactus, this, cactusItems, 1 ) );
601
602 int clayItems[] = {Tile::clay_Id};
603 if(!isHintCompleted(e_Tutorial_Hint_Clay)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Clay, this, clayItems, 1 ) );
604
605 int sugarCaneItems[] = {Tile::reeds_Id};
606 if(!isHintCompleted(e_Tutorial_Hint_Sugarcane)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sugarcane, this, sugarCaneItems, 1 ) );
607
608 int recordPlayerItems[] = {Tile::jukebox_Id};
609 if(!isHintCompleted(e_Tutorial_Hint_Record_Player)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Record_Player, this, recordPlayerItems, 1 ) );
610
611 int pumpkinItems[] = {Tile::pumpkin_Id};
612 if(!isHintCompleted(e_Tutorial_Hint_Pumpkin)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Pumpkin, this, pumpkinItems, 1, -1, -1, 0 ) );
613
614 int hellRockItems[] = {Tile::netherRack_Id};
615 if(!isHintCompleted(e_Tutorial_Hint_Hell_Rock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Hell_Rock, this, hellRockItems, 1 ) );
616
617 int hellSandItems[] = {Tile::soulsand_Id};
618 if(!isHintCompleted(e_Tutorial_Hint_Hell_Sand)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Hell_Sand, this, hellSandItems, 1 ) );
619
620 int glowstoneItems[] = {Tile::glowstone_Id};
621 if(!isHintCompleted(e_Tutorial_Hint_Glowstone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Glowstone, this, glowstoneItems, 1 ) );
622
623 int portalItems[] = {Tile::portalTile_Id};
624 if(!isHintCompleted(e_Tutorial_Hint_Portal)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Portal, this, portalItems, 1 ) );
625
626 int pumpkinLitItems[] = {Tile::litPumpkin_Id};
627 if(!isHintCompleted(e_Tutorial_Hint_Pumpkin_Lit)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Pumpkin_Lit, this, pumpkinLitItems, 1, -1, -1, 0 ) );
628
629 int cakeItems[] = {Tile::cake_Id};
630 if(!isHintCompleted(e_Tutorial_Hint_Cake)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Cake, this, cakeItems, 1 ) );
631
632 int redstoneRepeaterItems[] = {Tile::diode_on_Id, Tile::diode_off_Id};
633 if(!isHintCompleted(e_Tutorial_Hint_Redstone_Repeater)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Redstone_Repeater, this, redstoneRepeaterItems, 2, Item::repeater_Id ) );
634
635 int trapdoorItems[] = {Tile::trapdoor_Id};
636 if(!isHintCompleted(e_Tutorial_Hint_Trapdoor)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Trapdoor, this, trapdoorItems, 1 ) );
637
638 int pistonItems[] = {Tile::pistonBase_Id};
639 if(!isHintCompleted(e_Tutorial_Hint_Piston)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Piston, this, pistonItems, 1 ) );
640
641 int stickyPistonItems[] = {Tile::pistonStickyBase_Id};
642 if(!isHintCompleted(e_Tutorial_Hint_Sticky_Piston)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Sticky_Piston, this, stickyPistonItems, 1 ) );
643
644 int monsterStoneEggItems[] = {Tile::monsterStoneEgg_Id};
645 if(!isHintCompleted(e_Tutorial_Hint_Monster_Stone_Egg)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Monster_Stone_Egg, this, monsterStoneEggItems, 1 ) );
646
647 int stoneBrickSmoothItems[] = {Tile::stoneBrick_Id};
648 if(!isHintCompleted(e_Tutorial_Hint_Stone_Brick_Smooth)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Stone_Brick_Smooth, this, stoneBrickSmoothItems, 1 ) );
649
650 int hugeMushroomItems[] = {Tile::hugeMushroom_brown_Id,Tile::hugeMushroom_red_Id};
651 if(!isHintCompleted(e_Tutorial_Hint_Huge_Mushroom)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Huge_Mushroom, this, hugeMushroomItems, 2 ) );
652
653 int ironFenceItems[] = {Tile::ironFence_Id};
654 if(!isHintCompleted(e_Tutorial_Hint_Iron_Fence)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Iron_Fence, this, ironFenceItems, 1 ) );
655
656 int thisGlassItems[] = {Tile::thinGlass_Id};
657 if(!isHintCompleted(e_Tutorial_Hint_Thin_Glass)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Thin_Glass, this, thisGlassItems, 1 ) );
658
659 int melonItems[] = {Tile::melon_Id};
660 if(!isHintCompleted(e_Tutorial_Hint_Melon)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Melon, this, melonItems, 1 ) );
661
662 int vineItems[] = {Tile::vine_Id};
663 if(!isHintCompleted(e_Tutorial_Hint_Vine)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Vine, this, vineItems, 1 ) );
664
665 int fenceGateItems[] = {Tile::fenceGate_Id};
666 if(!isHintCompleted(e_Tutorial_Hint_Fence_Gate)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Fence_Gate, this, fenceGateItems, 1 ) );
667
668 int mycelItems[] = {Tile::mycel_Id};
669 if(!isHintCompleted(e_Tutorial_Hint_Mycel)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Mycel, this, mycelItems, 1 ) );
670
671 int waterLilyItems[] = {Tile::waterLily_Id};
672 if(!isHintCompleted(e_Tutorial_Hint_Water_Lily)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Water_Lily, this, waterLilyItems, 1 ) );
673
674 int netherBrickItems[] = {Tile::netherBrick_Id};
675 if(!isHintCompleted(e_Tutorial_Hint_Nether_Brick)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Nether_Brick, this, netherBrickItems, 1 ) );
676
677 int netherFenceItems[] = {Tile::netherFence_Id};
678 if(!isHintCompleted(e_Tutorial_Hint_Nether_Fence)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Nether_Fence, this, netherFenceItems, 1 ) );
679
680 int netherStalkItems[] = {Tile::netherStalk_Id};
681 if(!isHintCompleted(e_Tutorial_Hint_Nether_Stalk)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Nether_Stalk, this, netherStalkItems, 1 ) );
682
683 int enchantTableItems[] = {Tile::enchantTable_Id};
684 if(!isHintCompleted(e_Tutorial_Hint_Enchant_Table)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Enchant_Table, this, enchantTableItems, 1 ) );
685
686 int brewingStandItems[] = {Tile::brewingStand_Id};
687 if(!isHintCompleted(e_Tutorial_Hint_Brewing_Stand)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Brewing_Stand, this, brewingStandItems, 1, Item::brewingStand_Id ) );
688
689 int cauldronItems[] = {Tile::cauldron_Id};
690 if(!isHintCompleted(e_Tutorial_Hint_Cauldron)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Cauldron, this, cauldronItems, 1, Item::cauldron_Id ) );
691
692 int endPortalItems[] = {Tile::endPortalTile_Id};
693 if(!isHintCompleted(e_Tutorial_Hint_End_Portal)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_End_Portal, this, endPortalItems, 1, -2 ) );
694
695 int endPortalFrameItems[] = {Tile::endPortalFrameTile_Id};
696 if(!isHintCompleted(e_Tutorial_Hint_End_Portal_Frame)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_End_Portal_Frame, this, endPortalFrameItems, 1 ) );
697
698 int whiteStoneItems[] = {Tile::endStone_Id};
699 if(!isHintCompleted(e_Tutorial_Hint_White_Stone)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_White_Stone, this, whiteStoneItems, 1 ) );
700
701 int dragonEggItems[] = {Tile::dragonEgg_Id};
702 if(!isHintCompleted(e_Tutorial_Hint_Dragon_Egg)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Dragon_Egg, this, dragonEggItems, 1 ) );
703
704 int redstoneLampItems[] = {Tile::redstoneLight_Id, Tile::redstoneLight_lit_Id};
705 if(!isHintCompleted(e_Tutorial_Hint_RedstoneLamp)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_RedstoneLamp, this, redstoneLampItems, 2 ) );
706
707 int cocoaItems[] = {Tile::cocoa_Id};
708 if(!isHintCompleted(e_Tutorial_Hint_Cocoa)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Cocoa, this, cocoaItems, 1, Item::dye_powder_Id, -1, DyePowderItem::BROWN) );
709
710 int emeraldOreItems[] = {Tile::emeraldOre_Id};
711 if(!isHintCompleted(e_Tutorial_Hint_EmeraldOre)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_EmeraldOre, this, emeraldOreItems, 1 ) );
712
713 int emeraldBlockItems[] = {Tile::emeraldBlock_Id};
714 if(!isHintCompleted(e_Tutorial_Hint_EmeraldBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_EmeraldBlock, this, emeraldBlockItems, 1 ) );
715
716 int enderChestItems[] = {Tile::enderChest_Id};
717 if(!isHintCompleted(e_Tutorial_Hint_EnderChest)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_EnderChest, this, enderChestItems, 1 ) );
718
719 int tripwireSourceItems[] = {Tile::tripWireSource_Id};
720 if(!isHintCompleted(e_Tutorial_Hint_TripwireSource)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_TripwireSource, this, tripwireSourceItems, 1 ) );
721
722 int tripwireItems[] = {Tile::tripWire_Id};
723 if(!isHintCompleted(e_Tutorial_Hint_Tripwire)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Tripwire, this, tripwireItems, 1, Item::string_Id ) );
724
725 int cobblestoneWallItems[] = {Tile::cobbleWall_Id};
726 if(!isHintCompleted(e_Tutorial_Hint_CobblestoneWall))
727 {
728 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CobblestoneWall, this, cobblestoneWallItems, 1, -1, WallTile::TYPE_NORMAL ) );
729 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CobblestoneWall, this, cobblestoneWallItems, 1, -1, WallTile::TYPE_MOSSY ) );
730 }
731
732 int flowerpotItems[] = {Tile::flowerPot_Id};
733 if(!isHintCompleted(e_Tutorial_Hint_Flowerpot)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Flowerpot, this, flowerpotItems, 1, Item::flowerPot_Id ) );
734
735 int anvilItems[] = {Tile::anvil_Id};
736 if(!isHintCompleted(e_Tutorial_Hint_Anvil)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Anvil, this, anvilItems, 1 ) );
737
738 int quartzOreItems[] = {Tile::netherQuartz_Id};
739 if(!isHintCompleted(e_Tutorial_Hint_QuartzOre)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzOre, this, quartzOreItems, 1 ) );
740
741 int quartzBlockItems[] = {Tile::quartzBlock_Id};
742 if(!isHintCompleted(e_Tutorial_Hint_QuartzBlock))
743 {
744 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_DEFAULT ) );
745 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_CHISELED ) );
746 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_LINES_Y ) );
747 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_LINES_X ) );
748 addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_QuartzBlock, this, quartzBlockItems, 1, -1, QuartzBlockTile::TYPE_LINES_Z ) );
749 }
750
751 int carpetItems[] = {Tile::woolCarpet_Id};
752 if(!isHintCompleted(e_Tutorial_Hint_WoolCarpet)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_WoolCarpet, this, carpetItems, 1 ) );
753
754 int potatoItems[] = {Tile::potatoes_Id};
755 if(!isHintCompleted(e_Tutorial_Hint_Potato)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Potato, this, potatoItems, 1, -1, -1, 7 ) );
756
757 int carrotItems[] = {Tile::carrots_Id};
758 if(!isHintCompleted(e_Tutorial_Hint_Carrot)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Carrot, this, carrotItems, 1, -1, -1, 7 ) );
759
760 int commandBlockItems[] = {Tile::commandBlock_Id};
761 if(!isHintCompleted(e_Tutorial_Hint_CommandBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CommandBlock, this, commandBlockItems, 1 ) );
762
763 int beaconItems[] = {Tile::beacon_Id};
764 if(!isHintCompleted(e_Tutorial_Hint_Beacon)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Beacon, this, beaconItems, 1 ) );
765
766 int activatorRailItems[] = {Tile::activatorRail_Id};
767 if(!isHintCompleted(e_Tutorial_Hint_Activator_Rail)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Activator_Rail, this, activatorRailItems, 1 ) );
768
769 int redstoneBlockItems[] = {Tile::redstoneBlock_Id};
770 if(!isHintCompleted(e_Tutorial_Hint_RedstoneBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_RedstoneBlock, this, redstoneBlockItems, 1 ) );
771
772 int daylightDetectorItems[] = {Tile::daylightDetector_Id};
773 if(!isHintCompleted(e_Tutorial_Hint_DaylightDetector)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_DaylightDetector, this, daylightDetectorItems, 1 ) );
774
775 int dropperItems[] = {Tile::dropper_Id};
776 if(!isHintCompleted(e_Tutorial_Hint_Dropper)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Dropper, this, dropperItems, 1 ) );
777
778 int hopperItems[] = {Tile::hopper_Id};
779 if(!isHintCompleted(e_Tutorial_Hint_Hopper)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Hopper, this, hopperItems, 1 ) );
780
781 int comparatorItems[] = {Tile::comparator_off_Id, Tile::comparator_on_Id};
782 if(!isHintCompleted(e_Tutorial_Hint_Comparator)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_Comparator, this, comparatorItems, 2, Item::comparator_Id ) );
783
784 int trappedChestItems[] = {Tile::chest_trap_Id};
785 if(!isHintCompleted(e_Tutorial_Hint_ChestTrap)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ChestTrap, this, trappedChestItems, 1 ) );
786
787 int hayBlockItems[] = {Tile::hayBlock_Id};
788 if(!isHintCompleted(e_Tutorial_Hint_HayBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_HayBlock, this, hayBlockItems, 1 ) );
789
790 int clayHardenedItems[] = {Tile::clayHardened_Id};
791 if(!isHintCompleted(e_Tutorial_Hint_ClayHardened)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ClayHardened, this, clayHardenedItems, 1 ) );
792
793 int clayHardenedColoredItems[] = {Tile::clayHardened_colored_Id};
794 if(!isHintCompleted(e_Tutorial_Hint_ClayHardenedColored)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_ClayHardenedColored, this, clayHardenedColoredItems, 1 ) );
795
796 int coalBlockItems[] = {Tile::coalBlock_Id};
797 if(!isHintCompleted(e_Tutorial_Hint_CoalBlock)) addHint(e_Tutorial_State_Gameplay, new LookAtTileHint(e_Tutorial_Hint_CoalBlock, this, coalBlockItems, 1 ) );
798
799 /*
800 * ENTITY HINTS
801 */
802 if(!isHintCompleted(e_Tutorial_Hint_Squid)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Squid, this, IDS_DESC_SQUID, IDS_SQUID, eTYPE_SQUID ) );
803 if(!isHintCompleted(e_Tutorial_Hint_Cow)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Cow, this, IDS_DESC_COW, IDS_COW, eTYPE_COW ) );
804 if(!isHintCompleted(e_Tutorial_Hint_Sheep)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Sheep, this, IDS_DESC_SHEEP, IDS_SHEEP, eTYPE_SHEEP ) );
805 if(!isHintCompleted(e_Tutorial_Hint_Chicken)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Chicken, this, IDS_DESC_CHICKEN, IDS_CHICKEN, eTYPE_CHICKEN ) );
806 if(!isHintCompleted(e_Tutorial_Hint_Pig)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Pig, this, IDS_DESC_PIG, IDS_PIG, eTYPE_PIG ) );
807 if(!isHintCompleted(e_Tutorial_Hint_Wolf)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Wolf, this, IDS_DESC_WOLF, IDS_WOLF, eTYPE_WOLF ) );
808 if(!isHintCompleted(e_Tutorial_Hint_Creeper)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Creeper, this, IDS_DESC_CREEPER, IDS_CREEPER, eTYPE_CREEPER ) );
809 if(!isHintCompleted(e_Tutorial_Hint_Skeleton)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Skeleton, this, IDS_DESC_SKELETON, IDS_SKELETON, eTYPE_SKELETON ) );
810 if(!isHintCompleted(e_Tutorial_Hint_Spider)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Spider, this, IDS_DESC_SPIDER, IDS_SPIDER, eTYPE_SPIDER ) );
811 if(!isHintCompleted(e_Tutorial_Hint_Zombie)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Zombie, this, IDS_DESC_ZOMBIE, IDS_ZOMBIE, eTYPE_ZOMBIE ) );
812 if(!isHintCompleted(e_Tutorial_Hint_Pig_Zombie)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Pig_Zombie, this, IDS_DESC_PIGZOMBIE, IDS_PIGZOMBIE, eTYPE_PIGZOMBIE ) );
813 if(!isHintCompleted(e_Tutorial_Hint_Ghast)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Ghast, this, IDS_DESC_GHAST, IDS_GHAST, eTYPE_GHAST ) );
814 if(!isHintCompleted(e_Tutorial_Hint_Slime)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Slime, this, IDS_DESC_SLIME, IDS_SLIME, eTYPE_SLIME ) );
815 if(!isHintCompleted(e_Tutorial_Hint_Enderman)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Enderman, this, IDS_DESC_ENDERMAN, IDS_ENDERMAN, eTYPE_ENDERMAN ) );
816 if(!isHintCompleted(e_Tutorial_Hint_Silverfish)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Silverfish, this, IDS_DESC_SILVERFISH, IDS_SILVERFISH, eTYPE_SILVERFISH ) );
817 if(!isHintCompleted(e_Tutorial_Hint_Cave_Spider)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Cave_Spider, this, IDS_DESC_CAVE_SPIDER, IDS_CAVE_SPIDER, eTYPE_CAVESPIDER ) );
818 if(!isHintCompleted(e_Tutorial_Hint_MushroomCow)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_MushroomCow, this, IDS_DESC_MUSHROOM_COW, IDS_MUSHROOM_COW, eTYPE_MUSHROOMCOW) );
819 if(!isHintCompleted(e_Tutorial_Hint_SnowMan)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_SnowMan, this, IDS_DESC_SNOWMAN, IDS_SNOWMAN, eTYPE_SNOWMAN ) );
820 if(!isHintCompleted(e_Tutorial_Hint_IronGolem)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_IronGolem, this, IDS_DESC_IRONGOLEM, IDS_IRONGOLEM, eTYPE_VILLAGERGOLEM ) );
821 if(!isHintCompleted(e_Tutorial_Hint_EnderDragon)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_EnderDragon, this, IDS_DESC_ENDERDRAGON, IDS_ENDERDRAGON, eTYPE_ENDERDRAGON ) );
822 if(!isHintCompleted(e_Tutorial_Hint_Blaze)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Blaze, this, IDS_DESC_BLAZE, IDS_BLAZE, eTYPE_BLAZE ) );
823 if(!isHintCompleted(e_Tutorial_Hint_Lava_Slime)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Lava_Slime, this, IDS_DESC_LAVA_SLIME, IDS_LAVA_SLIME, eTYPE_LAVASLIME ) );
824 if(!isHintCompleted(e_Tutorial_Hint_Ozelot)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Ozelot, this, IDS_DESC_OZELOT, IDS_OZELOT, eTYPE_OCELOT ) );
825 if(!isHintCompleted(e_Tutorial_Hint_Villager)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Villager, this, IDS_DESC_VILLAGER, IDS_VILLAGER, eTYPE_VILLAGER) );
826 if(!isHintCompleted(e_Tutorial_Hint_Wither)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Wither, this, IDS_DESC_WITHER, IDS_WITHER, eTYPE_WITHERBOSS) );
827 if(!isHintCompleted(e_Tutorial_Hint_Witch)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Witch, this, IDS_DESC_WITCH, IDS_WITCH, eTYPE_WITCH) );
828 if(!isHintCompleted(e_Tutorial_Hint_Bat)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Bat, this, IDS_DESC_BAT, IDS_BAT, eTYPE_BAT) );
829 if(!isHintCompleted(e_Tutorial_Hint_Horse)) addHint(e_Tutorial_State_Gameplay, new LookAtEntityHint(e_Tutorial_Hint_Horse, this, IDS_DESC_HORSE, IDS_HORSE, eTYPE_HORSE) );
830
831
832 /*
833 * ITEM HINTS
834 */
835 int shovelItems[] = {Item::shovel_wood->id, Item::shovel_stone->id, Item::shovel_iron->id, Item::shovel_gold->id, Item::shovel_diamond->id};
836 if(!isHintCompleted(e_Tutorial_Hint_Item_Shovel)) addHint(e_Tutorial_State_Gameplay, new DiggerItemHint(e_Tutorial_Hint_Item_Shovel, this, IDS_TUTORIAL_HINT_DIGGER_ITEM_SHOVEL, shovelItems, 5) );
837
838 int hatchetItems[] = {Item::hatchet_wood->id, Item::hatchet_stone->id, Item::hatchet_iron->id, Item::hatchet_gold->id, Item::hatchet_diamond->id};
839 if(!isHintCompleted(e_Tutorial_Hint_Item_Hatchet)) addHint(e_Tutorial_State_Gameplay, new DiggerItemHint(e_Tutorial_Hint_Item_Hatchet, this, IDS_TUTORIAL_HINT_DIGGER_ITEM_HATCHET, hatchetItems, 5 ) );
840
841 int pickaxeItems[] = {Item::pickAxe_wood->id, Item::pickAxe_stone->id, Item::pickAxe_iron->id, Item::pickAxe_gold->id, Item::pickAxe_diamond->id};
842 if(!isHintCompleted(e_Tutorial_Hint_Item_Pickaxe)) addHint(e_Tutorial_State_Gameplay, new DiggerItemHint(e_Tutorial_Hint_Item_Pickaxe, this, IDS_TUTORIAL_HINT_DIGGER_ITEM_PICKAXE, pickaxeItems, 5 ) );
843
844 /*
845 *
846 *
847 * INVENTORY
848 *
849 */
850 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Inventory_Menu) )
851 {
852 ProcedureCompoundTask *inventoryOverviewTask = new ProcedureCompoundTask( this );
853 inventoryOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_INV_OVERVIEW, IDS_TUTORIAL_PROMPT_INV_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_Inventory) );
854 inventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_INV_PICK_UP, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
855 inventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_INV_MOVE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
856 inventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_INV_DROP, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
857 inventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_INV_INFO, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
858 addTask(e_Tutorial_State_Inventory_Menu, inventoryOverviewTask );
859 }
860
861 /*
862 *
863 *
864 * CREATIVE INVENTORY
865 *
866 */
867 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Creative_Inventory_Menu) )
868 {
869 ProcedureCompoundTask *creativeInventoryOverviewTask = new ProcedureCompoundTask( this );
870 creativeInventoryOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_OVERVIEW, IDS_TUTORIAL_PROMPT_CREATIVE_INV_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_CreativeInventory) );
871 creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_PICK_UP, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
872 creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_MOVE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
873 creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_DROP, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
874 creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_NAV, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
875 creativeInventoryOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CREATIVE_INV_INFO, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
876 addTask(e_Tutorial_State_Creative_Inventory_Menu, creativeInventoryOverviewTask );
877 }
878
879 /*
880 *
881 *
882 * CRAFTING
883 *
884 */
885 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_2x2Crafting_Menu ) )
886 {
887 ProcedureCompoundTask *craftingOverviewTask = new ProcedureCompoundTask( this );
888 craftingOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_CRAFT_OVERVIEW, IDS_TUTORIAL_PROMPT_CRAFT_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_Crafting) );
889 craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_NAV, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
890 craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_CREATE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
891 craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_CRAFT_TABLE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
892 craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_INVENTORY, IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_DESCRIPTION, false, ACTION_MENU_X) );
893 craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_DESCRIPTION, IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INGREDIENTS, false, ACTION_MENU_X) );
894 craftingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_CRAFT_INGREDIENTS, IDS_TUTORIAL_PROMPT_PRESS_X_TO_TOGGLE_INVENTORY, false, ACTION_MENU_X) );
895 addTask(e_Tutorial_State_2x2Crafting_Menu, craftingOverviewTask );
896 }
897 // Other tasks can be added in the derived classes
898
899 addHint(e_Tutorial_State_2x2Crafting_Menu, new TutorialHint(e_Tutorial_Hint_Always_On, this, IDS_TUTORIAL_HINT_CRAFT_NO_INGREDIENTS, TutorialHint::e_Hint_NoIngredients) );
900
901 addHint(e_Tutorial_State_3x3Crafting_Menu, new TutorialHint(e_Tutorial_Hint_Always_On, this, IDS_TUTORIAL_HINT_CRAFT_NO_INGREDIENTS, TutorialHint::e_Hint_NoIngredients) );
902
903 /*
904 *
905 *
906 * FURNACE
907 *
908 */
909 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Furnace_Menu ) )
910 {
911 ProcedureCompoundTask *furnaceOverviewTask = new ProcedureCompoundTask( this );
912 furnaceOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_FURNACE_OVERVIEW, IDS_TUTORIAL_PROMPT_FURNACE_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_Furnace) );
913 furnaceOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FURNACE_METHOD, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
914 furnaceOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FURNACE_FUELS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
915 furnaceOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FURNACE_INGREDIENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
916 addTask(e_Tutorial_State_Furnace_Menu, furnaceOverviewTask );
917 }
918 // Other tasks can be added in the derived classes
919
920 /*
921 *
922 *
923 * BREWING MENU
924 *
925 */
926 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Brewing_Menu ) )
927 {
928 ProcedureCompoundTask *brewingOverviewTask = new ProcedureCompoundTask( this );
929 brewingOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_BREWING_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_BrewingMenu) );
930 brewingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_METHOD, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
931 brewingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_BASIC_INGREDIENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
932 brewingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
933 brewingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BREWING_MENU_EXTENDED_INGREDIENTS_2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
934 addTask(e_Tutorial_State_Brewing_Menu, brewingOverviewTask );
935 }
936 // Other tasks can be added in the derived classes
937
938 /*
939 *
940 *
941 * ENCHANTING MENU
942 *
943 */
944 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Enchanting_Menu ) )
945 {
946 ProcedureCompoundTask *enchantingOverviewTask = new ProcedureCompoundTask( this );
947 enchantingOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_ENCHANTING_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_EnchantingMenu) );
948 enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_START, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
949 enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANTMENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
950 enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_COST, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
951 enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_ENCHANT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
952 enchantingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ENCHANTING_MENU_BETTER_ENCHANTMENTS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
953 addTask(e_Tutorial_State_Enchanting_Menu, enchantingOverviewTask );
954 }
955 // Other tasks can be added in the derived classes
956
957 /*
958 *
959 *
960 * ANVIL MENU
961 *
962 */
963 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Anvil_Menu ) )
964 {
965 ProcedureCompoundTask *anvilOverviewTask = new ProcedureCompoundTask( this );
966 anvilOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_ANVIL_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_AnvilMenu) );
967 anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_START, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
968 anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_REPAIR, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
969 anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_SACRIFICE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
970 anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_ENCHANT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
971 anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_COST, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
972 anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_RENAMING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
973 anvilOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_ANVIL_MENU_SMITH, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
974 addTask(e_Tutorial_State_Anvil_Menu, anvilOverviewTask );
975 }
976 // Other tasks can be added in the derived classes
977
978 /*
979 *
980 *
981 * TRADING MENU
982 *
983 */
984 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Trading_Menu ) )
985 {
986 ProcedureCompoundTask *tradingOverviewTask = new ProcedureCompoundTask( this );
987 tradingOverviewTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_TRADING_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_TradingMenu) );
988 tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_START, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
989 tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_UNAVAILABLE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
990 tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_DETAILS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
991 tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_INVENTORY, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
992 tradingOverviewTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_TRADING_MENU_TRADE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
993 addTask(e_Tutorial_State_Trading_Menu, tradingOverviewTask );
994 }
995 // Other tasks can be added in the derived classes
996
997 /*
998 *
999 *
1000 * HORSE ENCOUNTER
1001 *
1002 */
1003 if(isFullTutorial || !isStateCompleted(e_Tutorial_State_Horse) )
1004 {
1005 addTask(e_Tutorial_State_Horse,
1006 new HorseChoiceTask(this, IDS_TUTORIAL_TASK_HORSE_OVERVIEW, IDS_TUTORIAL_TASK_DONKEY_OVERVIEW, IDS_TUTORIAL_TASK_MULE_OVERVIEW, IDS_TUTORIAL_PROMPT_HORSE_OVERVIEW,
1007 true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Horse) );
1008
1009 addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_INTRO, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1010 addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_PURPOSE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1011 addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1012 addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_TAMING2, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1013
1014 // 4J-JEV: Only force the RideEntityTask if we're on the full-tutorial.
1015 if (isFullTutorial) addTask(e_Tutorial_State_Horse, new RideEntityTask(eTYPE_HORSE, this, IDS_TUTORIAL_TASK_HORSE_RIDE, true, NULL, false, false, false) );
1016 else addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_RIDE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1017
1018 addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1019 addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_SADDLEBAGS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1020 addTask(e_Tutorial_State_Horse, new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_BREEDING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1021 }
1022
1023 /*
1024 *
1025 *
1026 * HORSE MENU
1027 *
1028 */
1029 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Horse_Menu ) )
1030 {
1031 ProcedureCompoundTask *horseMenuTask = new ProcedureCompoundTask( this );
1032 horseMenuTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_HORSE_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_HORSE_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_HorseMenu) );
1033 horseMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_MENU_LAYOUT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1034 horseMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_MENU_EQUIPMENT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1035 horseMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_HORSE_MENU_SADDLEBAGS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1036 addTask(e_Tutorial_State_Horse_Menu, horseMenuTask );
1037 }
1038
1039 /*
1040 *
1041 *
1042 * FIREWORKS MENU
1043 *
1044 */
1045 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Fireworks_Menu ) )
1046 {
1047 ProcedureCompoundTask *fireworksMenuTask = new ProcedureCompoundTask( this );
1048 fireworksMenuTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_FIREWORK_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_FireworksMenu) );
1049 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_START, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1050 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_STARS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1051 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_HEIGHT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1052 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_BASIC_CRAFT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1053 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_START, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1054 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_COLOUR, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1055 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_SHAPE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1056 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_EFFECT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1057 fireworksMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_FIREWORK_MENU_ADV_FADE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1058 addTask(e_Tutorial_State_Fireworks_Menu, fireworksMenuTask );
1059 }
1060
1061 /*
1062 *
1063 *
1064 * BEACON MENU
1065 *
1066 */
1067 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Beacon_Menu ) )
1068 {
1069 ProcedureCompoundTask *beaconMenuTask = new ProcedureCompoundTask( this );
1070 beaconMenuTask->AddTask( new ChoiceTask(this, IDS_TUTORIAL_TASK_BEACON_MENU_OVERVIEW, IDS_TUTORIAL_PROMPT_BEACON_MENU_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State, eTelemetryTutorial_BeaconMenu) );
1071 beaconMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BEACON_MENU_PRIMARY_POWERS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1072 beaconMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BEACON_MENU_SECONDARY_POWER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1073 beaconMenuTask->AddTask( new InfoTask(this, IDS_TUTORIAL_TASK_BEACON_MENU_ACTIVATION, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1074 addTask(e_Tutorial_State_Beacon_Menu, beaconMenuTask );
1075 }
1076
1077 /*
1078 *
1079 *
1080 * MINECART
1081 *
1082 */
1083 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Riding_Minecart ) )
1084 {
1085 addTask(e_Tutorial_State_Riding_Minecart, new ChoiceTask(this, IDS_TUTORIAL_TASK_MINECART_OVERVIEW, IDS_TUTORIAL_PROMPT_MINECART_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Minecart) );
1086 addTask(e_Tutorial_State_Riding_Minecart, new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_RAILS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1087 addTask(e_Tutorial_State_Riding_Minecart, new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_POWERED_RAILS, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1088 addTask(e_Tutorial_State_Riding_Minecart, new InfoTask(this, IDS_TUTORIAL_TASK_MINECART_PUSHING, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1089 }
1090
1091 /*
1092 *
1093 *
1094 * BOAT
1095 *
1096 */
1097 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Riding_Boat ) )
1098 {
1099 addTask(e_Tutorial_State_Riding_Boat, new ChoiceTask(this, IDS_TUTORIAL_TASK_BOAT_OVERVIEW, IDS_TUTORIAL_PROMPT_BOAT_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Boat) );
1100 addTask(e_Tutorial_State_Riding_Boat, new InfoTask(this, IDS_TUTORIAL_TASK_BOAT_STEER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1101 }
1102
1103 /*
1104 *
1105 *
1106 * FISHING
1107 *
1108 */
1109 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Fishing ) )
1110 {
1111 addTask(e_Tutorial_State_Fishing, new ChoiceTask(this, IDS_TUTORIAL_TASK_FISHING_OVERVIEW, IDS_TUTORIAL_PROMPT_FISHING_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Fishing) );
1112 addTask(e_Tutorial_State_Fishing, new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_CAST, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1113 addTask(e_Tutorial_State_Fishing, new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_FISH, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1114 addTask(e_Tutorial_State_Fishing, new InfoTask(this, IDS_TUTORIAL_TASK_FISHING_USES, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1115 }
1116
1117 /*
1118 *
1119 *
1120 * BED
1121 *
1122 */
1123 if(isFullTutorial || !isStateCompleted( e_Tutorial_State_Bed ) )
1124 {
1125 addTask(e_Tutorial_State_Bed, new ChoiceTask(this, IDS_TUTORIAL_TASK_BED_OVERVIEW, IDS_TUTORIAL_PROMPT_BED_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_Bed) );
1126 addTask(e_Tutorial_State_Bed, new InfoTask(this, IDS_TUTORIAL_TASK_BED_PLACEMENT, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1127 addTask(e_Tutorial_State_Bed, new InfoTask(this, IDS_TUTORIAL_TASK_BED_MULTIPLAYER, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1128 }
1129
1130 /*
1131 *
1132 *
1133 * FOOD BAR
1134 *
1135 */
1136 if(!isFullTutorial && !isStateCompleted( e_Tutorial_State_Food_Bar ) )
1137 {
1138 addTask(e_Tutorial_State_Food_Bar, new ChoiceTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_OVERVIEW, IDS_TUTORIAL_PROMPT_FOOD_BAR_OVERVIEW, true, ACTION_MENU_A, ACTION_MENU_B, e_Tutorial_Completion_Complete_State_Gameplay_Constraints, eTelemetryTutorial_FoodBar) );
1139 addTask(e_Tutorial_State_Food_Bar, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_DEPLETE, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1140 addTask(e_Tutorial_State_Food_Bar, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_HEAL, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1141 addTask(e_Tutorial_State_Food_Bar, new InfoTask(this, IDS_TUTORIAL_TASK_FOOD_BAR_FEED, IDS_TUTORIAL_PROMPT_PRESS_A_TO_CONTINUE, true, ACTION_MENU_A) );
1142 }
1143}
1144
1145Tutorial::~Tutorial()
1146{
1147 for(AUTO_VAR(it, m_globalConstraints.begin()); it != m_globalConstraints.end(); ++it)
1148 {
1149 delete (*it);
1150 }
1151 for(unordered_map<int, TutorialMessage *>::iterator it = messages.begin(); it != messages.end(); ++it)
1152 {
1153 delete (*it).second;
1154 }
1155 for(unsigned int i = 0; i < e_Tutorial_State_Max; ++i)
1156 {
1157 for(AUTO_VAR(it, activeTasks[i].begin()); it < activeTasks[i].end(); ++it)
1158 {
1159 delete (*it);
1160 }
1161 for(AUTO_VAR(it, hints[i].begin()); it < hints[i].end(); ++it)
1162 {
1163 delete (*it);
1164 }
1165
1166 currentTask[i] = NULL;
1167 currentFailedConstraint[i] = NULL;
1168 }
1169}
1170
1171void Tutorial::debugResetPlayerSavedProgress(int iPad)
1172{
1173#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
1174 GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(iPad);
1175#else
1176 GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(iPad);
1177#endif
1178 ZeroMemory( pGameSettings->ucTutorialCompletion, TUTORIAL_PROFILE_STORAGE_BYTES );
1179 pGameSettings->uiSpecialTutorialBitmask = 0;
1180}
1181
1182void Tutorial::setCompleted( int completableId )
1183{
1184 //if(app.GetGameSettingsDebugMask(m_iPad) && app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_TipsAlwaysOn))
1185 //{
1186 // return;
1187 //}
1188
1189
1190 int completableIndex = -1;
1191 for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it)
1192 {
1193 ++completableIndex;
1194 if( *it == completableId )
1195 {
1196 break;
1197 }
1198 }
1199 if( completableIndex >= 0 && completableIndex < TUTORIAL_PROFILE_STORAGE_BITS )
1200 {
1201 // Set the bit for this position
1202#if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
1203 GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(m_iPad);
1204#else
1205 GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(m_iPad);
1206#endif
1207 int arrayIndex = completableIndex >> 3;
1208 int bitIndex = 7 - (completableIndex % 8);
1209 pGameSettings->ucTutorialCompletion[arrayIndex] |= 1<<bitIndex;
1210 // flag a profile write needed
1211 pGameSettings->bSettingsChanged=true;
1212 }
1213}
1214
1215bool Tutorial::getCompleted( int completableId )
1216{
1217 //if(app.GetGameSettingsDebugMask(m_iPad) && app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_TipsAlwaysOn))
1218 //{
1219 // return false;
1220 //}
1221
1222 int completableIndex = -1;
1223 for( AUTO_VAR(it, s_completableTasks.begin()); it < s_completableTasks.end(); ++it)
1224 {
1225 ++completableIndex;
1226 if( *it == completableId )
1227 {
1228 break;
1229 }
1230 }
1231 if( completableIndex >= 0 && completableIndex < TUTORIAL_PROFILE_STORAGE_BITS )
1232 {
1233 // Read the bit for this position
1234 //Retrieve the data pointer from the profile
1235#if ( defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined __PSVITA__)
1236 GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)StorageManager.GetGameDefinedProfileData(m_iPad);
1237#else
1238 GAME_SETTINGS *pGameSettings = (GAME_SETTINGS *)ProfileManager.GetGameDefinedProfileData(m_iPad);
1239#endif
1240 int arrayIndex = completableIndex >> 3;
1241 int bitIndex = 7 - (completableIndex % 8);
1242 return (pGameSettings->ucTutorialCompletion[arrayIndex] & 1<<bitIndex) == (1<<bitIndex);
1243 }
1244 else
1245 {
1246 return false;
1247 }
1248}
1249
1250bool Tutorial::isStateCompleted( eTutorial_State state )
1251{
1252 return getCompleted(state);
1253}
1254
1255void Tutorial::setStateCompleted( eTutorial_State state )
1256{
1257 setCompleted( state );
1258}
1259
1260bool Tutorial::isHintCompleted( eTutorial_Hint hint )
1261{
1262 return getCompleted(hint);
1263}
1264
1265void Tutorial::setHintCompleted( eTutorial_Hint hint )
1266{
1267 //if(app.GetGameSettingsDebugMask(m_iPad) && app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_TipsAlwaysOn))
1268 //{
1269 // return;
1270 //}
1271
1272 setCompleted( hint );
1273}
1274
1275void Tutorial::setHintCompleted( TutorialHint *hint )
1276{
1277 //if(app.GetGameSettingsDebugMask(m_iPad) && app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_TipsAlwaysOn))
1278 //{
1279 // return;
1280 //}
1281
1282 eTutorial_Hint hintId = hint->getId();
1283
1284 if( hintId != e_Tutorial_Hint_Always_On )
1285 {
1286 setHintCompleted( hint->getId() );
1287 hints[m_CurrentState].erase( find(hints[m_CurrentState].begin(), hints[m_CurrentState].end(), hint) );
1288 delete hint;
1289 }
1290 // else
1291 // {
1292 // find(hints[m_CurrentState].begin(), hints[m_CurrentState].end(), hint);
1293 // }
1294}
1295
1296void Tutorial::tick()
1297{
1298 // Don't do anything for the first 2 seconds so that the loading screen is gone
1299 if(!m_bHasTickedOnce)
1300 {
1301 int time = GetTickCount();
1302 if(m_firstTickTime == 0)
1303 {
1304 m_firstTickTime = time;
1305 }
1306 else if ( time - m_firstTickTime > 1500 )
1307 {
1308 m_bHasTickedOnce = true;
1309 }
1310 }
1311 if(!m_bHasTickedOnce)
1312 {
1313 return;
1314 }
1315
1316 bool constraintChanged = false;
1317 bool taskChanged = false;
1318
1319 for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
1320 {
1321 AUTO_VAR(it, constraintsToRemove[state].begin());
1322 while(it < constraintsToRemove[state].end() )
1323 {
1324 ++(*it).second;
1325 if( (*it).second > m_iTutorialConstraintDelayRemoveTicks )
1326 {
1327 TutorialConstraint *c = (*it).first;
1328 constraints[state].erase( find( constraints[state].begin(), constraints[state].end(), c) );
1329 c->setQueuedForRemoval(false);
1330 it = constraintsToRemove[state].erase( it );
1331
1332 if( c->getDeleteOnDeactivate() )
1333 {
1334 delete c;
1335 }
1336 }
1337 else
1338 {
1339 ++it;
1340 }
1341 }
1342 }
1343
1344 // 4J Stu TODO - Make this a constraint
1345 Minecraft *pMinecraft = Minecraft::GetInstance();
1346 if(m_freezeTime && !m_timeFrozen && !m_fullTutorialComplete )
1347 {
1348 // Need to set the time on both levels to stop the flickering as the local level
1349 // tries to predict the time
1350 MinecraftServer::SetTimeOfDay(m_iTutorialFreezeTimeValue);
1351 pMinecraft->level->setDayTime(m_iTutorialFreezeTimeValue); // Always daytime
1352 app.SetGameHostOption(eGameHostOption_DoDaylightCycle,0);
1353 m_timeFrozen = true;
1354 }
1355 else if(m_freezeTime && m_timeFrozen && m_fullTutorialComplete)
1356 {
1357 MinecraftServer::SetTimeOfDay(m_iTutorialFreezeTimeValue);
1358 pMinecraft->level->setDayTime(m_iTutorialFreezeTimeValue);
1359 app.SetGameHostOption(eGameHostOption_DoDaylightCycle,1);
1360 m_timeFrozen = false;
1361 }
1362
1363 if(!m_allowShow)
1364 {
1365 if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
1366 {
1367 uiTempDisabled = true;
1368 }
1369 ui.SetTutorialVisible( m_iPad, false );
1370 return;
1371 }
1372
1373
1374 if(!hasRequestedUI )
1375 {
1376#ifdef _XBOX
1377 m_bSceneIsSplitscreen=app.GetLocalPlayerCount()>1;
1378 if(m_bSceneIsSplitscreen)
1379 {
1380 app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene);
1381 }
1382 else
1383 {
1384 app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene);
1385 }
1386#else
1387 ui.SetTutorial(m_iPad, this);
1388#endif
1389 hasRequestedUI = true;
1390 }
1391 else
1392 {
1393 // if we've changed mode, we may need to change scene
1394 if(m_bSceneIsSplitscreen!=(app.GetLocalPlayerCount()>1))
1395 {
1396#ifdef _XBOX
1397 app.TutorialSceneNavigateBack(m_iPad);
1398 m_bSceneIsSplitscreen=app.GetLocalPlayerCount()>1;
1399 if(m_bSceneIsSplitscreen)
1400 {
1401 app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene);
1402 }
1403 else
1404 {
1405 app.NavigateToScene(m_iPad, eUIComponent_TutorialPopup,(void *)this, false, false, &m_hTutorialScene);
1406 }
1407#else
1408 ui.SetTutorial(m_iPad, this);
1409#endif
1410 }
1411 }
1412
1413 if(ui.IsPauseMenuDisplayed( m_iPad ) )
1414 {
1415 if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
1416 {
1417 uiTempDisabled = true;
1418 }
1419 ui.SetTutorialVisible( m_iPad, false );
1420 return;
1421 }
1422 if( uiTempDisabled )
1423 {
1424 ui.SetTutorialVisible( m_iPad, true );
1425 lastMessageTime = GetTickCount();
1426 uiTempDisabled = false;
1427 }
1428
1429 // Check constraints
1430 for(AUTO_VAR(it, m_globalConstraints.begin()); it < m_globalConstraints.end(); ++it)
1431 {
1432 TutorialConstraint *constraint = *it;
1433 constraint->tick(m_iPad);
1434 }
1435
1436 // Check hints
1437 int hintNeeded = -1;
1438 if(!m_hintDisplayed)
1439 {
1440 // 4J Stu - TU-1 interim
1441 // Allow turning off all the hints
1442 bool hintsOn = m_isFullTutorial || app.GetGameSettings(m_iPad,eGameSetting_Hints);
1443
1444 if(hintsOn)
1445 {
1446 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
1447 {
1448 TutorialHint *hint = *it;
1449 hintNeeded = hint->tick();
1450 if(hintNeeded >= 0)
1451 {
1452 PopupMessageDetails *message = new PopupMessageDetails();
1453 message->m_messageId = hintNeeded;
1454 message->m_allowFade = hint->allowFade();
1455 message->m_forceDisplay = true;
1456 setMessage( hint, message );
1457 break;
1458 }
1459 }
1460 }
1461 }
1462
1463 // Check constraints
1464 // Only need to update these if we aren't already failing something
1465 if( !m_allTutorialsComplete && (currentFailedConstraint[m_CurrentState] == NULL || currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad)) )
1466 {
1467 if( currentFailedConstraint[m_CurrentState] != NULL && currentFailedConstraint[m_CurrentState]->isConstraintSatisfied(m_iPad) )
1468 {
1469 constraintChanged = true;
1470 currentFailedConstraint[m_CurrentState] = NULL;
1471 }
1472 for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
1473 {
1474 TutorialConstraint *constraint = *it;
1475 if( !constraint->isConstraintSatisfied(m_iPad) && constraint->isConstraintRestrictive(m_iPad) )
1476 {
1477 constraintChanged = true;
1478 currentFailedConstraint[m_CurrentState] = constraint;
1479 }
1480 }
1481 }
1482
1483 if( !m_allTutorialsComplete && currentFailedConstraint[m_CurrentState] == NULL )
1484 {
1485 // Update tasks
1486 bool isCurrentTask = true;
1487 AUTO_VAR(it, activeTasks[m_CurrentState].begin());
1488 while(activeTasks[m_CurrentState].size() > 0 && it < activeTasks[m_CurrentState].end())
1489 {
1490 TutorialTask *task = *it;
1491 if( isCurrentTask || task->isPreCompletionEnabled() )
1492 {
1493 isCurrentTask = false;
1494 if(
1495 ( !task->ShowMinimumTime() || ( task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() ) )
1496 && task->isCompleted()
1497 )
1498 {
1499 eTutorial_CompletionAction compAction = task->getCompletionAction();
1500 it = activeTasks[m_CurrentState].erase( it );
1501 delete task;
1502 task = NULL;
1503
1504 if( activeTasks[m_CurrentState].size() > 0 )
1505 {
1506 switch( compAction )
1507 {
1508 case e_Tutorial_Completion_Complete_State_Gameplay_Constraints:
1509 {
1510 // 4J Stu - Move the delayed constraints to the gameplay state so that they are in
1511 // effect for a bit longer
1512 AUTO_VAR(itCon, constraintsToRemove[m_CurrentState].begin());
1513 while(itCon != constraintsToRemove[m_CurrentState].end() )
1514 {
1515 constraints[e_Tutorial_State_Gameplay].push_back(itCon->first);
1516 constraintsToRemove[e_Tutorial_State_Gameplay].push_back( pair<TutorialConstraint *, unsigned char>(itCon->first, itCon->second) );
1517
1518 constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), itCon->first) );
1519 itCon = constraintsToRemove[m_CurrentState].erase(itCon);
1520 }
1521 }
1522 // Fall through the the normal complete state
1523 case e_Tutorial_Completion_Complete_State:
1524 for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem)
1525 {
1526 delete (*itRem);
1527 }
1528 activeTasks[m_CurrentState].clear();
1529 break;
1530 case e_Tutorial_Completion_Jump_To_Last_Task:
1531 {
1532 TutorialTask *lastTask = activeTasks[m_CurrentState].at( activeTasks[m_CurrentState].size() - 1 );
1533 activeTasks[m_CurrentState].pop_back();
1534 for(AUTO_VAR(itRem, activeTasks[m_CurrentState].begin()); itRem < activeTasks[m_CurrentState].end(); ++itRem)
1535 {
1536 delete (*itRem);
1537 }
1538 activeTasks[m_CurrentState].clear();
1539 activeTasks[m_CurrentState].push_back( lastTask );
1540 it = activeTasks[m_CurrentState].begin();
1541 }
1542 break;
1543 case e_Tutorial_Completion_None:
1544 default:
1545 break;
1546 }
1547 }
1548
1549 if( activeTasks[m_CurrentState].size() > 0 )
1550 {
1551 currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
1552 currentTask[m_CurrentState]->setAsCurrentTask();
1553 }
1554 else
1555 {
1556 setStateCompleted( m_CurrentState );
1557
1558 currentTask[m_CurrentState] = NULL;
1559 }
1560 taskChanged = true;
1561
1562 // If we can complete this early, check if we can complete it right now
1563 if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isPreCompletionEnabled() )
1564 {
1565 isCurrentTask = true;
1566 }
1567 }
1568 else
1569 {
1570 ++it;
1571 }
1572 if( task != NULL && task->ShowMinimumTime() && task->hasBeenActivated() && (lastMessageTime + m_iTutorialMinimumDisplayMessageTime ) < GetTickCount() )
1573 {
1574 task->setShownForMinimumTime();
1575
1576 if( !m_hintDisplayed )
1577 {
1578 PopupMessageDetails *message = new PopupMessageDetails();
1579 message->m_messageId = task->getDescriptionId();
1580 message->m_promptId = task->getPromptId();
1581 message->m_allowFade = task->AllowFade();
1582 message->m_replaceCurrent = true;
1583 setMessage( message );
1584 }
1585 }
1586 }
1587 else
1588 {
1589 ++it;
1590 }
1591 }
1592
1593 if( currentTask[m_CurrentState] == NULL && activeTasks[m_CurrentState].size() > 0 )
1594 {
1595 currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
1596 currentTask[m_CurrentState]->setAsCurrentTask();
1597 taskChanged = true;
1598 }
1599 }
1600
1601 if(!m_allTutorialsComplete && (taskChanged || m_hasStateChanged) )
1602 {
1603 bool allComplete = true;
1604 for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
1605 {
1606 if(activeTasks[state].size() > 0 )
1607 {
1608 allComplete = false;
1609 break;
1610 }
1611 if(state==e_Tutorial_State_Gameplay)
1612 {
1613 m_fullTutorialComplete = true;
1614 Minecraft::GetInstance()->playerLeftTutorial(m_iPad);
1615 }
1616 }
1617 if(allComplete)
1618 m_allTutorialsComplete = true;
1619 }
1620
1621 if( constraintChanged || taskChanged || m_hasStateChanged ||
1622 (currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_lastMessage == NULL || currentTask[m_CurrentState]->getDescriptionId() != m_lastMessage->m_messageId) && !m_hintDisplayed)
1623 )
1624 {
1625 if( currentFailedConstraint[m_CurrentState] != NULL )
1626 {
1627 PopupMessageDetails *message = new PopupMessageDetails();
1628 message->m_messageId = currentFailedConstraint[m_CurrentState]->getDescriptionId();
1629 message->m_allowFade = false;
1630 setMessage( message );
1631 }
1632 else if( currentTask[m_CurrentState] != NULL )
1633 {
1634 PopupMessageDetails *message = new PopupMessageDetails();
1635 message->m_messageId = currentTask[m_CurrentState]->getDescriptionId();
1636 message->m_promptId = currentTask[m_CurrentState]->getPromptId();
1637 message->m_allowFade = currentTask[m_CurrentState]->AllowFade();
1638 setMessage( message );
1639 currentTask[m_CurrentState]->TaskReminders()? m_iTaskReminders = 1 : m_iTaskReminders = 0;
1640 }
1641 else
1642 {
1643 setMessage( NULL );
1644 }
1645 }
1646
1647 if(m_hintDisplayed && (lastMessageTime + m_iTutorialDisplayMessageTime ) < GetTickCount() )
1648 {
1649 m_hintDisplayed = false;
1650 }
1651
1652 if( currentFailedConstraint[m_CurrentState] == NULL && currentTask[m_CurrentState] != NULL && (m_iTaskReminders!=0) && (lastMessageTime + (m_iTaskReminders * m_iTutorialReminderTime) ) < GetTickCount() )
1653 {
1654 // Reminder
1655 PopupMessageDetails *message = new PopupMessageDetails();
1656 message->m_messageId = currentTask[m_CurrentState]->getDescriptionId();
1657 message->m_promptId = currentTask[m_CurrentState]->getPromptId();
1658 message->m_allowFade = currentTask[m_CurrentState]->AllowFade();
1659 message->m_isReminder = true;
1660 setMessage( message );
1661 ++m_iTaskReminders;
1662 if( m_iTaskReminders > 1 )
1663 m_iTaskReminders = 1;
1664 }
1665
1666 m_hasStateChanged = false;
1667
1668 // If we have completed this state, and it is one that occurs during normal gameplay then change back to the gameplay track
1669 if( m_CurrentState != e_Tutorial_State_Gameplay && activeTasks[m_CurrentState].size() == 0 && (isSelectedItemState() || !ui.GetMenuDisplayed(m_iPad) ) )
1670 {
1671 this->changeTutorialState( e_Tutorial_State_Gameplay );
1672 }
1673}
1674
1675bool Tutorial::setMessage(PopupMessageDetails *message)
1676{
1677 if(message != NULL && !message->m_forceDisplay &&
1678 m_lastMessageState == m_CurrentState &&
1679 message->isSameContent(m_lastMessage) &&
1680 ( !message->m_isReminder || ( (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() && message->m_isReminder ) )
1681 )
1682 {
1683 delete message;
1684 return false;
1685 }
1686
1687 if(message != NULL && (message->m_messageId > 0 || !message->m_messageString.empty()) )
1688 {
1689 m_lastMessageState = m_CurrentState;
1690
1691 if(!message->m_replaceCurrent) lastMessageTime = GetTickCount();
1692
1693 wstring text;
1694 if(!message->m_messageString.empty())
1695 {
1696 text = message->m_messageString;
1697 }
1698 else
1699 {
1700 AUTO_VAR(it, messages.find(message->m_messageId));
1701 if( it != messages.end() && it->second != NULL )
1702 {
1703 TutorialMessage *messageString = it->second;
1704 text = wstring( messageString->getMessageForDisplay() );
1705
1706 // 4J Stu - Quick fix for boat tutorial being incorrect
1707 if(message->m_messageId == IDS_TUTORIAL_TASK_BOAT_OVERVIEW)
1708 {
1709 text = replaceAll(text, L"{*CONTROLLER_ACTION_USE*}", L"{*CONTROLLER_ACTION_DISMOUNT*}");
1710 }
1711 }
1712 else
1713 {
1714 text = wstring( app.GetString(message->m_messageId) );
1715
1716 // 4J Stu - Quick fix for boat tutorial being incorrect
1717 if(message->m_messageId == IDS_TUTORIAL_TASK_BOAT_OVERVIEW)
1718 {
1719 text = replaceAll(text, L"{*CONTROLLER_ACTION_USE*}", L"{*CONTROLLER_ACTION_DISMOUNT*}");
1720 }
1721 }
1722 }
1723
1724 if(!message->m_promptString.empty())
1725 {
1726 text.append(message->m_promptString);
1727 }
1728 else if(message->m_promptId >= 0)
1729 {
1730 AUTO_VAR(it, messages.find(message->m_promptId));
1731 if(it != messages.end() && it->second != NULL)
1732 {
1733 TutorialMessage *prompt = it->second;
1734 text.append( prompt->getMessageForDisplay() );
1735 }
1736 }
1737
1738 wstring title;
1739 TutorialPopupInfo popupInfo;
1740 popupInfo.interactScene = m_UIScene;
1741 popupInfo.desc = text.c_str();
1742 popupInfo.icon = message->m_icon;
1743 popupInfo.iAuxVal = message->m_iAuxVal;
1744 popupInfo.allowFade = message->m_allowFade;
1745 popupInfo.isReminder = message->m_isReminder;
1746 popupInfo.tutorial = this;
1747 if( !message->m_titleString.empty() || message->m_titleId > 0 )
1748 {
1749 if(message->m_titleString.empty()) title = wstring( app.GetString(message->m_titleId) );
1750 else title = message->m_titleString;
1751
1752 popupInfo.title = title.c_str();
1753 ui.SetTutorialDescription( m_iPad, &popupInfo );
1754 }
1755 else
1756 {
1757 ui.SetTutorialDescription( m_iPad, &popupInfo );
1758 }
1759 }
1760 else if( (m_lastMessage != NULL && m_lastMessage->m_messageId != -1) ) //&& (lastMessageTime + m_iTutorialReminderTime ) > GetTickCount() )
1761 {
1762 // This should cause the popup to dissappear
1763 TutorialPopupInfo popupInfo;
1764 popupInfo.interactScene = m_UIScene;
1765 popupInfo.tutorial = this;
1766 ui.SetTutorialDescription( m_iPad, &popupInfo );
1767 }
1768
1769 if(m_lastMessage != NULL) delete m_lastMessage;
1770 m_lastMessage = message;
1771
1772 return true;
1773}
1774
1775bool Tutorial::setMessage(TutorialHint *hint, PopupMessageDetails *message)
1776{
1777 // 4J Stu - TU-1 interim
1778 // Allow turning off all the hints
1779 bool hintsOn = m_isFullTutorial || (app.GetGameSettings(m_iPad,eGameSetting_Hints) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD));
1780
1781 bool messageShown = false;
1782 DWORD time = GetTickCount();
1783 if(message != NULL && (message->m_forceDisplay || hintsOn) &&
1784 (!message->m_delay ||
1785 (
1786 (m_hintDisplayed && (time - m_lastHintDisplayedTime) > m_iTutorialHintDelayTime ) ||
1787 (!m_hintDisplayed && (time - lastMessageTime) > m_iTutorialMinimumDisplayMessageTime )
1788 )
1789 )
1790 )
1791 {
1792 messageShown = setMessage( message );
1793
1794 if(messageShown)
1795 {
1796 m_lastHintDisplayedTime = time;
1797 m_hintDisplayed = true;
1798 if(hint!=NULL) setHintCompleted( hint );
1799 }
1800 }
1801 return messageShown;
1802}
1803
1804bool Tutorial::setMessage(const wstring &messageString, int icon, int auxValue)
1805{
1806 PopupMessageDetails *message = new PopupMessageDetails();
1807 message->m_messageString = messageString;
1808 message->m_icon = icon;
1809 message->m_iAuxVal = auxValue;
1810 message->m_forceDisplay = true;
1811
1812 return setMessage(message);
1813}
1814
1815void Tutorial::showTutorialPopup(bool show)
1816{
1817 m_allowShow = show;
1818
1819 if(!show)
1820 {
1821 if( currentTask[m_CurrentState] != NULL && (!currentTask[m_CurrentState]->AllowFade() || (lastMessageTime + m_iTutorialDisplayMessageTime ) > GetTickCount() ) )
1822 {
1823 uiTempDisabled = true;
1824 }
1825 ui.SetTutorialVisible( m_iPad, show );
1826 }
1827}
1828
1829void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
1830{
1831 for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
1832 {
1833 TutorialTask *task = *it;
1834 task->useItemOn(level, item, x, y, z, bTestUseOnly);
1835 }
1836}
1837
1838void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
1839{
1840 for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
1841 {
1842 TutorialTask *task = *it;
1843 task->useItem(item, bTestUseOnly);
1844 }
1845}
1846
1847void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
1848{
1849 for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
1850 {
1851 TutorialTask *task = *it;
1852 task->completeUsingItem(item);
1853 }
1854
1855 // Fix for #46922 - TU5: UI: Player receives a reminder that he is hungry while "hunger bar" is full (triggered in split-screen mode)
1856 if(m_CurrentState != e_Tutorial_State_Gameplay)
1857 {
1858 for(AUTO_VAR(it, activeTasks[e_Tutorial_State_Gameplay].begin()); it < activeTasks[e_Tutorial_State_Gameplay].end(); ++it)
1859 {
1860 TutorialTask *task = *it;
1861 task->completeUsingItem(item);
1862 }
1863 }
1864}
1865
1866void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
1867{
1868 int hintNeeded = -1;
1869 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
1870 {
1871 TutorialHint *hint = *it;
1872 hintNeeded = hint->startDestroyBlock(item, tile);
1873 if(hintNeeded >= 0)
1874 {
1875 PopupMessageDetails *message = new PopupMessageDetails();
1876 message->m_messageId = hintNeeded;
1877 setMessage( hint, message );
1878 break;
1879 }
1880
1881 }
1882}
1883
1884void Tutorial::destroyBlock(Tile *tile)
1885{
1886 int hintNeeded = -1;
1887 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
1888 {
1889 TutorialHint *hint = *it;
1890 hintNeeded = hint->destroyBlock(tile);
1891 if(hintNeeded >= 0)
1892 {
1893 PopupMessageDetails *message = new PopupMessageDetails();
1894 message->m_messageId = hintNeeded;
1895 setMessage( hint, message );
1896 break;
1897 }
1898
1899 }
1900}
1901
1902void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
1903{
1904 int hintNeeded = -1;
1905 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
1906 {
1907 TutorialHint *hint = *it;
1908 hintNeeded = hint->attack(player->inventory->getSelected(), entity);
1909 if(hintNeeded >= 0)
1910 {
1911 PopupMessageDetails *message = new PopupMessageDetails();
1912 message->m_messageId = hintNeeded;
1913 setMessage( hint, message );
1914 break;
1915 }
1916
1917 }
1918}
1919
1920void Tutorial::itemDamaged(shared_ptr<ItemInstance> item)
1921{
1922 int hintNeeded = -1;
1923 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
1924 {
1925 TutorialHint *hint = *it;
1926 hintNeeded = hint->itemDamaged(item);
1927 if(hintNeeded >= 0)
1928 {
1929 PopupMessageDetails *message = new PopupMessageDetails();
1930 message->m_messageId = hintNeeded;
1931 setMessage( hint, message );
1932 break;
1933 }
1934
1935 }
1936}
1937
1938void Tutorial::handleUIInput(int iAction)
1939{
1940 if( m_hintDisplayed ) return;
1941
1942 //for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
1943 //{
1944 // TutorialTask *task = *it;
1945 // task->handleUIInput(iAction);
1946 //}
1947 if(currentTask[m_CurrentState] != NULL)
1948 currentTask[m_CurrentState]->handleUIInput(iAction);
1949}
1950
1951void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
1952{
1953 int hintNeeded = -1;
1954 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
1955 {
1956 TutorialHint *hint = *it;
1957 hintNeeded = hint->createItemSelected(item, canMake);
1958 if(hintNeeded >= 0)
1959 {
1960 PopupMessageDetails *message = new PopupMessageDetails();
1961 message->m_messageId = hintNeeded;
1962 setMessage( hint, message );
1963 break;
1964 }
1965
1966 }
1967}
1968
1969void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
1970{
1971 for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
1972 {
1973 for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it)
1974 {
1975 TutorialTask *task = *it;
1976 task->onCrafted(item);
1977 }
1978 }
1979}
1980
1981void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
1982{
1983 if( !m_hintDisplayed )
1984 {
1985 bool hintNeeded = false;
1986 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
1987 {
1988 TutorialHint *hint = *it;
1989 hintNeeded = hint->onTake(item);
1990 if(hintNeeded)
1991 {
1992 break;
1993 }
1994
1995 }
1996 }
1997
1998 for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
1999 {
2000 for(AUTO_VAR(it, activeTasks[state].begin()); it < activeTasks[state].end(); ++it)
2001 {
2002 TutorialTask *task = *it;
2003 task->onTake(item, invItemCountAnyAux, invItemCountThisAux);
2004 }
2005 }
2006}
2007
2008void Tutorial::onSelectedItemChanged(shared_ptr<ItemInstance> item)
2009{
2010 // We only handle this if we are in a state that allows changing based on the selected item
2011 // Menus and states like riding in a minecart will NOT allow this
2012 if( isSelectedItemState() )
2013 {
2014 if(item != NULL)
2015 {
2016 switch(item->id)
2017 {
2018 case Item::fishingRod_Id:
2019 changeTutorialState(e_Tutorial_State_Fishing);
2020 break;
2021 default:
2022 changeTutorialState(e_Tutorial_State_Gameplay);
2023 break;
2024 }
2025 }
2026 else
2027 {
2028 changeTutorialState(e_Tutorial_State_Gameplay);
2029 }
2030 }
2031}
2032
2033void Tutorial::onLookAt(int id, int iData)
2034{
2035 if( m_hintDisplayed ) return;
2036
2037 bool hintNeeded = false;
2038 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
2039 {
2040 TutorialHint *hint = *it;
2041 hintNeeded = hint->onLookAt(id, iData);
2042 if(hintNeeded)
2043 {
2044 break;
2045 }
2046 }
2047
2048 if( m_CurrentState == e_Tutorial_State_Gameplay )
2049 {
2050 if(id > 0)
2051 {
2052 switch(id)
2053 {
2054 case Tile::bed_Id:
2055 changeTutorialState(e_Tutorial_State_Bed);
2056 break;
2057 default:
2058 break;
2059 }
2060 }
2061 }
2062}
2063
2064void Tutorial::onLookAtEntity(shared_ptr<Entity> entity)
2065{
2066 if( m_hintDisplayed ) return;
2067
2068 bool hintNeeded = false;
2069 for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
2070 {
2071 TutorialHint *hint = *it;
2072 hintNeeded = hint->onLookAtEntity(entity->GetType());
2073 if(hintNeeded)
2074 {
2075 break;
2076 }
2077 }
2078
2079 if ( (m_CurrentState == e_Tutorial_State_Gameplay) && entity->instanceof(eTYPE_HORSE) )
2080 {
2081 changeTutorialState(e_Tutorial_State_Horse);
2082 }
2083
2084 for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it != activeTasks[m_CurrentState].end(); ++it)
2085 {
2086 (*it)->onLookAtEntity(entity);
2087 }
2088}
2089
2090void Tutorial::onRideEntity(shared_ptr<Entity> entity)
2091{
2092 if(m_CurrentState == e_Tutorial_State_Gameplay)
2093 {
2094 switch (entity->GetType())
2095 {
2096 case eTYPE_MINECART: changeTutorialState(e_Tutorial_State_Riding_Minecart); break;
2097 case eTYPE_BOAT: changeTutorialState(e_Tutorial_State_Riding_Boat); break;
2098 }
2099 }
2100
2101 for (AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it != activeTasks[m_CurrentState].end(); ++it)
2102 {
2103 (*it)->onRideEntity(entity);
2104 }
2105}
2106
2107void Tutorial::onEffectChanged(MobEffect *effect, bool bRemoved)
2108{
2109 for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
2110 {
2111 TutorialTask *task = *it;
2112 task->onEffectChanged(effect,bRemoved);
2113 }
2114}
2115
2116bool Tutorial::canMoveToPosition(double xo, double yo, double zo, double xt, double yt, double zt)
2117{
2118 bool allowed = true;
2119 for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
2120 {
2121 TutorialConstraint *constraint = *it;
2122 if( !constraint->isConstraintSatisfied(m_iPad) && !constraint->canMoveToPosition(xo,yo,zo,xt,yt,zt) )
2123 {
2124 allowed = false;
2125 break;
2126 }
2127 }
2128 return allowed;
2129}
2130
2131bool Tutorial::isInputAllowed(int mapping)
2132{
2133 if( m_hintDisplayed ) return true;
2134
2135 // If the player is under water then allow all keypresses so they can jump out
2136 if( Minecraft::GetInstance()->localplayers[m_iPad]->isUnderLiquid(Material::water) ) return true;
2137
2138 bool allowed = true;
2139 for(AUTO_VAR(it, constraints[m_CurrentState].begin()); it < constraints[m_CurrentState].end(); ++it)
2140 {
2141 TutorialConstraint *constraint = *it;
2142 if( constraint->isMappingConstrained( m_iPad, mapping ) )
2143 {
2144 allowed = false;
2145 break;
2146 }
2147 }
2148 return allowed;
2149}
2150
2151vector<TutorialTask *> *Tutorial::getTasks()
2152{
2153 return &tasks;
2154}
2155
2156unsigned int Tutorial::getCurrentTaskIndex()
2157{
2158 unsigned int index = 0;
2159 for(AUTO_VAR(it, tasks.begin()); it < tasks.end(); ++it)
2160 {
2161 if(*it == currentTask[e_Tutorial_State_Gameplay])
2162 break;
2163
2164 ++index;
2165 }
2166 return index;
2167}
2168
2169void Tutorial::AddGlobalConstraint(TutorialConstraint *c)
2170{
2171 m_globalConstraints.push_back(c);
2172}
2173
2174void Tutorial::AddConstraint(TutorialConstraint *c)
2175{
2176 constraints[m_CurrentState].push_back(c);
2177}
2178
2179void Tutorial::RemoveConstraint(TutorialConstraint *c, bool delayedRemove /*= false*/)
2180{
2181 if( currentFailedConstraint[m_CurrentState] == c )
2182 currentFailedConstraint[m_CurrentState] = NULL;
2183
2184 if( c->getQueuedForRemoval() )
2185 {
2186 // If it is already queued for removal, remove it on the next tick
2187 /*for(AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it)
2188 {
2189 if( it->first == c )
2190 {
2191 it->second = m_iTutorialConstraintDelayRemoveTicks;
2192 break;
2193 }
2194 }*/
2195 }
2196 else if(delayedRemove)
2197 {
2198 c->setQueuedForRemoval(true);
2199 constraintsToRemove[m_CurrentState].push_back( pair<TutorialConstraint *, unsigned char>(c, 0) );
2200 }
2201 else
2202 {
2203 for( AUTO_VAR(it, constraintsToRemove[m_CurrentState].begin()); it < constraintsToRemove[m_CurrentState].end(); ++it)
2204 {
2205 if( it->first == c )
2206 {
2207 constraintsToRemove[m_CurrentState].erase( it );
2208 break;
2209 }
2210 }
2211
2212 AUTO_VAR(it, find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c));
2213 if( it != constraints[m_CurrentState].end() ) constraints[m_CurrentState].erase( find( constraints[m_CurrentState].begin(), constraints[m_CurrentState].end(), c) );
2214
2215 // It may be in the gameplay list, so remove it from there if it is
2216 it = find( constraints[e_Tutorial_State_Gameplay].begin(), constraints[e_Tutorial_State_Gameplay].end(), c);
2217 if( it != constraints[e_Tutorial_State_Gameplay].end() ) constraints[e_Tutorial_State_Gameplay].erase( find( constraints[e_Tutorial_State_Gameplay].begin(), constraints[e_Tutorial_State_Gameplay].end(), c) );
2218 }
2219}
2220
2221void Tutorial::addTask(eTutorial_State state, TutorialTask *t)
2222{
2223 if( state == e_Tutorial_State_Gameplay )
2224 {
2225 tasks.push_back(t);
2226 }
2227 activeTasks[state].push_back(t);
2228}
2229
2230void Tutorial::addHint(eTutorial_State state, TutorialHint *h)
2231{
2232 hints[state].push_back(h);
2233}
2234
2235void Tutorial::addMessage(int messageId, bool limitRepeats /*= false*/, unsigned char numRepeats /*= TUTORIAL_MESSAGE_DEFAULT_SHOW*/)
2236{
2237 if(messageId >= 0 && messages.find(messageId)==messages.end())
2238 messages[messageId] = new TutorialMessage(messageId, limitRepeats, numRepeats);
2239}
2240
2241#ifdef _XBOX
2242void Tutorial::changeTutorialState(eTutorial_State newState, CXuiScene *scene /*= NULL*/)
2243#else
2244void Tutorial::changeTutorialState(eTutorial_State newState, UIScene *scene /*= NULL*/)
2245#endif
2246{
2247 if(newState == m_CurrentState)
2248 {
2249 // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed
2250#ifndef _XBOX
2251 if( scene == NULL )
2252 {
2253 ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
2254 }
2255#endif
2256 m_UIScene = scene;
2257 return;
2258 }
2259 // 4J Stu - TU-1 interim
2260 // Allow turning off all the hints
2261 bool hintsOn = m_isFullTutorial || app.GetGameSettings(m_iPad,eGameSetting_Hints);
2262
2263 if(hintsOn)
2264 {
2265 // If we have completed this state, and it is one that occurs during normal gameplay then change back to the gameplay track
2266 if( newState != e_Tutorial_State_Gameplay && activeTasks[newState].size() == 0 && !ui.GetMenuDisplayed(m_iPad) )
2267 {
2268 return;
2269 }
2270
2271 // The action that caused the change of state may also have completed the current task
2272 if( currentTask[m_CurrentState] != NULL && currentTask[m_CurrentState]->isCompleted() )
2273 {
2274 activeTasks[m_CurrentState].erase( find( activeTasks[m_CurrentState].begin(), activeTasks[m_CurrentState].end(), currentTask[m_CurrentState]) );
2275
2276 if( activeTasks[m_CurrentState].size() > 0 )
2277 {
2278 currentTask[m_CurrentState] = activeTasks[m_CurrentState][0];
2279 currentTask[m_CurrentState]->setAsCurrentTask();
2280 }
2281 else
2282 {
2283 currentTask[m_CurrentState] = NULL;
2284 }
2285 }
2286
2287 if( currentTask[m_CurrentState] != NULL )
2288 {
2289 currentTask[m_CurrentState]->onStateChange(newState);
2290 }
2291
2292 // Make sure that the current message is cleared
2293 setMessage( NULL );
2294
2295 // If clearing the scene, make sure that the tutorial popup has its reference to this scene removed
2296#ifndef _XBOX
2297 if( scene == NULL )
2298 {
2299 ui.RemoveInteractSceneReference(m_iPad, m_UIScene);
2300 }
2301#endif
2302 m_UIScene = scene;
2303
2304
2305 if( m_CurrentState != newState )
2306 {
2307 for(AUTO_VAR(it, activeTasks[newState].begin()); it < activeTasks[newState].end(); ++it)
2308 {
2309 TutorialTask *task = *it;
2310 task->onStateChange(newState);
2311 }
2312 m_CurrentState = newState;
2313 m_hasStateChanged = true;
2314 m_hintDisplayed = false;
2315 }
2316 }
2317}
2318
2319bool Tutorial::isSelectedItemState()
2320{
2321 bool isSelectedItemState = false;
2322 switch(m_CurrentState)
2323 {
2324 case e_Tutorial_State_Gameplay:
2325 case e_Tutorial_State_Fishing:
2326 isSelectedItemState = true;
2327 break;
2328 default:
2329 break;
2330 }
2331 return isSelectedItemState;
2332}