1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (C) 2004-2011 by The Allacrost Project
3 // Copyright (C) 2012-2016 by Bertram (Valyria Tear)
4 // All Rights Reserved
5 //
6 // This code is licensed under the GNU GPL version 2. It is free software
7 // and you may modify it and/or redistribute it under the terms of this license.
8 // See https://www.gnu.org/copyleft/gpl.html for details.
9 ///////////////////////////////////////////////////////////////////////////////
10
11 /** ***************************************************************************
12 *** \file common_bindings.cpp
13 *** \author Daniel Steuernol, steu@allacrost.org
14 *** \author Yohann Ferreira, yohann ferreira orange fr
15 *** \brief Lua bindings for common game code
16 ***
17 *** All bindings for the common code is contained within this file.
18 *** Therefore, everything that you see bound within this file will be made
19 *** available in Lua. This file also binds some of the utility code
20 *** found in src/utils.h.
21 ***
22 *** \note To most C++ programmers, the syntax of the binding code found in this
23 *** file may be very unfamiliar and obtuse. Refer to the Luabind documentation
24 *** as necessary to gain an understanding of this code style.
25 *** **************************************************************************/
26
27 #include "common.h"
28 #include "dialogue.h"
29
30 #include "common/global/actors/global_attack_point.h"
31 #include "common/global/global.h"
32 #include "common/global/status_effects/global_effects.h"
33 #include "common/global/objects/global_weapon.h"
34 #include "common/global/objects/global_armor.h"
35 #include "common/global/global_skills.h"
36 #include "common/global/actors/global_character.h"
37 #include "common/global/actors/global_enemy.h"
38 #include "modes/battle/battle_target.h"
39
40 #include "utils/utils_random.h"
41
42 namespace vt_defs
43 {
44
BindCommonCode()45 void BindCommonCode()
46 {
47 // ---------- Bind Utils Functions
48 {
49 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_utils")
50 [
51 luabind::class_<vt_utils::ustring>("ustring")
52 .def(luabind::constructor<uint16_t *>())
53 .def(luabind::constructor<>())
54 ];
55
56 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_utils")
57 [
58 luabind::def("RandomFloat", (float( *)(void)) &vt_utils::RandomFloat),
59 luabind::def("RandomBoundedInteger", &vt_utils::RandomBoundedInteger),
60 luabind::def("MakeUnicodeString", &vt_utils::MakeUnicodeString),
61 luabind::def("MakeStandardString", &vt_utils::MakeStandardString)
62 ];
63 }
64
65 // ---------- Bind Common Components
66 {
67 using namespace vt_common;
68
69 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_common")
70 [
71 luabind::class_<Dialogue>("Dialogue")
72 .def("AddLine", (void(Dialogue:: *)(const std::string&, const std::string&))&Dialogue::AddLine)
73 .def("AddLine", (void(Dialogue:: *)(const std::string &, const std::string&, int32_t))&Dialogue::AddLine)
74 .def("AddLineTimed", (void(Dialogue:: *)(const std::string &, const std::string&, uint32_t))&Dialogue::AddLineTimed)
75 .def("AddLineTimed", (void(Dialogue:: *)(const std::string &, const std::string&, int32_t, uint32_t))&Dialogue::AddLineTimed)
76 .def("AddOption", (void(Dialogue:: *)(const std::string &))&Dialogue::AddOption)
77 .def("AddOption", (void(Dialogue:: *)(const std::string &, int32_t))&Dialogue::AddOption)
78 .def("Validate", &Dialogue::Validate)
79 .scope
80 [ // Used for static members and nested classes.
81 luabind::def("Create", &Dialogue::Create)
82 ]
83 ];
84
85 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_common")
86 [
87 luabind::class_<DialogueSupervisor>("DialogueSupervisor")
88 .def("AddSpeaker", &DialogueSupervisor::AddSpeaker)
89 .def("ChangeSpeakerName", &DialogueSupervisor::ChangeSpeakerName)
90 .def("ChangeSpeakerPortrait", &DialogueSupervisor::ChangeSpeakerPortrait)
91 .def("StartDialogue", &DialogueSupervisor::StartDialogue)
92 .def("EndDialogue", &DialogueSupervisor::EndDialogue)
93 .def("ForceNextLine", &DialogueSupervisor::ForceNextLine)
94 .def("IsDialogueActive", &DialogueSupervisor::IsDialogueActive)
95 .def("GetCurrentDialogue", &DialogueSupervisor::GetCurrentDialogue)
96 .def("GetLineCounter", &DialogueSupervisor::GetLineCounter)
97 .def("SetDialoguePosition", &DialogueSupervisor::SetDialoguePosition)
98 ];
99
100 } // End using common namespace
101
102
103 // ---------- Bind Global Components
104 {
105 using namespace vt_global;
106
107 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
108 [
109 luabind::class_<GameGlobal>("GameGlobal")
110 .def("GetCharacterHandler", &GameGlobal::GetCharacterHandler)
111 .def("GetInventoryHandler", &GameGlobal::GetInventoryHandler)
112 .def("GetGameEvents", &GameGlobal::GetGameEvents)
113 .def("GetGameQuests", &GameGlobal::GetGameQuests)
114 .def("GetMapData", &GameGlobal::GetMapData)
115 .def("GetWorldMapData", &GameGlobal::GetWorldMapData)
116 .def("GetDrunes", &GameGlobal::GetDrunes)
117 .def("SetDrunes", &GameGlobal::SetDrunes)
118 .def("AddDrunes", &GameGlobal::AddDrunes)
119 .def("SubtractDrunes", &GameGlobal::SubtractDrunes)
120 .def("GetMaxExperienceLevel", &GameGlobal::GetMaxExperienceLevel)
121 .def("SetMaxExperienceLevel", &GameGlobal::SetMaxExperienceLevel)
122 .def("GetBattleMedia", &GameGlobal::GetBattleMedia)
123
124 // Namespace constants
125 .enum_("constants") [
126 // Object types
127 luabind::value("GLOBAL_OBJECT_INVALID", GLOBAL_OBJECT_INVALID),
128 luabind::value("GLOBAL_OBJECT_ITEM", GLOBAL_OBJECT_ITEM),
129 luabind::value("GLOBAL_OBJECT_WEAPON", GLOBAL_OBJECT_WEAPON),
130 luabind::value("GLOBAL_OBJECT_HEAD_ARMOR", GLOBAL_OBJECT_HEAD_ARMOR),
131 luabind::value("GLOBAL_OBJECT_TORSO_ARMOR", GLOBAL_OBJECT_TORSO_ARMOR),
132 luabind::value("GLOBAL_OBJECT_ARM_ARMOR", GLOBAL_OBJECT_ARM_ARMOR),
133 luabind::value("GLOBAL_OBJECT_LEG_ARMOR", GLOBAL_OBJECT_LEG_ARMOR),
134 luabind::value("GLOBAL_OBJECT_SPIRIT", GLOBAL_OBJECT_SPIRIT),
135 // Item and skill alignment constants
136 luabind::value("GLOBAL_POSITION_HEAD", GLOBAL_POSITION_HEAD),
137 luabind::value("GLOBAL_POSITION_TORSO", GLOBAL_POSITION_TORSO),
138 luabind::value("GLOBAL_POSITION_ARMS", GLOBAL_POSITION_ARMS),
139 luabind::value("GLOBAL_POSITION_LEGS", GLOBAL_POSITION_LEGS),
140 // Skill types
141 luabind::value("GLOBAL_SKILL_INVALID", GLOBAL_SKILL_INVALID),
142 luabind::value("GLOBAL_SKILL_WEAPON", GLOBAL_SKILL_WEAPON),
143 luabind::value("GLOBAL_SKILL_MAGIC", GLOBAL_SKILL_MAGIC),
144 luabind::value("GLOBAL_SKILL_SPECIAL", GLOBAL_SKILL_SPECIAL),
145 luabind::value("GLOBAL_SKILL_BARE_HANDS", GLOBAL_SKILL_BARE_HANDS),
146 // Elemental type constants
147 luabind::value("GLOBAL_ELEMENTAL_FIRE", GLOBAL_ELEMENTAL_FIRE),
148 luabind::value("GLOBAL_ELEMENTAL_WATER", GLOBAL_ELEMENTAL_WATER),
149 luabind::value("GLOBAL_ELEMENTAL_VOLT", GLOBAL_ELEMENTAL_VOLT),
150 luabind::value("GLOBAL_ELEMENTAL_EARTH", GLOBAL_ELEMENTAL_EARTH),
151 luabind::value("GLOBAL_ELEMENTAL_LIFE", GLOBAL_ELEMENTAL_LIFE),
152 luabind::value("GLOBAL_ELEMENTAL_DEATH", GLOBAL_ELEMENTAL_DEATH),
153 luabind::value("GLOBAL_ELEMENTAL_NEUTRAL", GLOBAL_ELEMENTAL_NEUTRAL),
154 // Status type constants
155 luabind::value("GLOBAL_STATUS_INVALID", GLOBAL_STATUS_INVALID),
156 luabind::value("GLOBAL_STATUS_PHYS_ATK", GLOBAL_STATUS_PHYS_ATK),
157 luabind::value("GLOBAL_STATUS_MAG_ATK", GLOBAL_STATUS_MAG_ATK),
158 luabind::value("GLOBAL_STATUS_PHYS_DEF", GLOBAL_STATUS_PHYS_DEF),
159 luabind::value("GLOBAL_STATUS_MAG_DEF", GLOBAL_STATUS_MAG_DEF),
160 luabind::value("GLOBAL_STATUS_STAMINA", GLOBAL_STATUS_STAMINA),
161 luabind::value("GLOBAL_STATUS_EVADE", GLOBAL_STATUS_EVADE),
162 luabind::value("GLOBAL_STATUS_HP", GLOBAL_STATUS_HP),
163 luabind::value("GLOBAL_STATUS_SP", GLOBAL_STATUS_SP),
164 luabind::value("GLOBAL_STATUS_PARALYSIS", GLOBAL_STATUS_PARALYSIS),
165 luabind::value("GLOBAL_STATUS_FIRE", GLOBAL_STATUS_FIRE),
166 luabind::value("GLOBAL_STATUS_WATER", GLOBAL_STATUS_WATER),
167 luabind::value("GLOBAL_STATUS_VOLT", GLOBAL_STATUS_VOLT),
168 luabind::value("GLOBAL_STATUS_EARTH", GLOBAL_STATUS_EARTH),
169 luabind::value("GLOBAL_STATUS_LIFE", GLOBAL_STATUS_LIFE),
170 luabind::value("GLOBAL_STATUS_DEATH", GLOBAL_STATUS_DEATH),
171 luabind::value("GLOBAL_STATUS_NEUTRAL", GLOBAL_STATUS_NEUTRAL),
172 // Intensity type constants
173 luabind::value("GLOBAL_INTENSITY_NEG_EXTREME", GLOBAL_INTENSITY_NEG_EXTREME),
174 luabind::value("GLOBAL_INTENSITY_NEG_GREATER", GLOBAL_INTENSITY_NEG_GREATER),
175 luabind::value("GLOBAL_INTENSITY_NEG_MODERATE", GLOBAL_INTENSITY_NEG_MODERATE),
176 luabind::value("GLOBAL_INTENSITY_NEG_LESSER", GLOBAL_INTENSITY_NEG_LESSER),
177 luabind::value("GLOBAL_INTENSITY_NEUTRAL", GLOBAL_INTENSITY_NEUTRAL),
178 luabind::value("GLOBAL_INTENSITY_POS_LESSER", GLOBAL_INTENSITY_POS_LESSER),
179 luabind::value("GLOBAL_INTENSITY_POS_MODERATE", GLOBAL_INTENSITY_POS_MODERATE),
180 luabind::value("GLOBAL_INTENSITY_POS_GREATER", GLOBAL_INTENSITY_POS_GREATER),
181 luabind::value("GLOBAL_INTENSITY_POS_EXTREME", GLOBAL_INTENSITY_POS_EXTREME),
182 // Target constants
183 luabind::value("GLOBAL_TARGET_INVALID", GLOBAL_TARGET_INVALID),
184 luabind::value("GLOBAL_TARGET_SELF_POINT", GLOBAL_TARGET_SELF_POINT),
185 luabind::value("GLOBAL_TARGET_ALLY_POINT", GLOBAL_TARGET_ALLY_POINT),
186 luabind::value("GLOBAL_TARGET_FOE_POINT", GLOBAL_TARGET_FOE_POINT),
187 luabind::value("GLOBAL_TARGET_SELF", GLOBAL_TARGET_SELF),
188 luabind::value("GLOBAL_TARGET_ALLY", GLOBAL_TARGET_ALLY),
189 luabind::value("GLOBAL_TARGET_ALLY_EVEN_DEAD", GLOBAL_TARGET_ALLY_EVEN_DEAD),
190 luabind::value("GLOBAL_TARGET_DEAD_ALLY_ONLY", GLOBAL_TARGET_DEAD_ALLY_ONLY),
191 luabind::value("GLOBAL_TARGET_FOE", GLOBAL_TARGET_FOE),
192 luabind::value("GLOBAL_TARGET_ALL_ALLIES", GLOBAL_TARGET_ALL_ALLIES),
193 luabind::value("GLOBAL_TARGET_ALL_FOES", GLOBAL_TARGET_ALL_FOES),
194 // Enemies hurt levels
195 luabind::value("GLOBAL_ENEMY_HURT_NONE", GLOBAL_ENEMY_HURT_NONE),
196 luabind::value("GLOBAL_ENEMY_HURT_SLIGHTLY", GLOBAL_ENEMY_HURT_SLIGHTLY),
197 luabind::value("GLOBAL_ENEMY_HURT_MEDIUM", GLOBAL_ENEMY_HURT_MEDIUM),
198 luabind::value("GLOBAL_ENEMY_HURT_HEAVILY", GLOBAL_ENEMY_HURT_HEAVILY)
199 ]
200 ];
201
202 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
203 [
204 luabind::class_<CharacterHandler>("CharacterHandler")
205 .def("AddCharacter", (void(CharacterHandler:: *)(uint32_t)) &CharacterHandler::AddCharacter)
206 .def("RemoveCharacter", (void(CharacterHandler:: *)(uint32_t, bool)) &CharacterHandler::RemoveCharacter)
207 .def("GetCharacter", &CharacterHandler::GetCharacter)
208 .def("GetActiveParty", &CharacterHandler::GetActiveParty)
209 ];
210
211 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
212 [
213 luabind::class_<GlobalParty>("GlobalParty")
214 .def("AddHitPoints", &GlobalParty::AddHitPoints)
215 .def("AddSkillPoints", &GlobalParty::AddSkillPoints)
216 .def("GetPartyPosition", &GlobalParty::GetPartyPosition)
217 ];
218
219 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
220 [
221 luabind::class_<GlobalAttackPoint>("GlobalAttackPoint")
222 .def("GetName", &GlobalAttackPoint::GetName)
223 .def("GetXPosition", &GlobalAttackPoint::GetXPosition)
224 .def("GetYPosition", &GlobalAttackPoint::GetYPosition)
225 .def("GetPhysDefModifier", &GlobalAttackPoint::GetPhysDefModifier)
226 .def("GetMagDefModifier", &GlobalAttackPoint::GetMagDefModifier)
227 .def("GetEvadeModifier", &GlobalAttackPoint::GetEvadeModifier)
228 .def("GetActorOwner", &GlobalAttackPoint::GetActorOwner)
229 .def("GetTotalPhysicalDefense", &GlobalAttackPoint::GetTotalPhysicalDefense)
230 .def("GetTotalMagicalDefense", &GlobalAttackPoint::GetTotalMagicalDefense)
231 .def("GetTotalEvadeRating", &GlobalAttackPoint::GetTotalEvadeRating)
232 ];
233
234 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
235 [
236 luabind::class_<GlobalActor>("GlobalActor")
237 .def("GetID", &GlobalActor::GetID)
238 .def("GetName", &GlobalActor::GetName)
239
240 .def("GetHitPoints", &GlobalActor::GetHitPoints)
241 .def("GetMaxHitPoints", &GlobalActor::GetMaxHitPoints)
242 .def("GetSkillPoints", &GlobalActor::GetSkillPoints)
243 .def("GetMaxSkillPoints", &GlobalActor::GetMaxSkillPoints)
244 .def("GetPhysAtk", &GlobalActor::GetPhysAtk)
245 .def("GetMagAtk", &GlobalActor::GetMagAtk)
246 .def("GetPhysDef", &GlobalActor::GetPhysDef)
247 .def("GetMagDef", &GlobalActor::GetMagDef)
248 .def("GetStamina", &GlobalActor::GetStamina)
249 .def("GetEvade", &GlobalActor::GetEvade)
250
251 .def("GetTotalPhysicalAttack", &GlobalActor::GetTotalPhysicalAttack)
252 .def("GetTotalMagicalAttack", &GlobalActor::GetTotalMagicalAttack)
253 .def("GetAverageDefense", &GlobalActor::GetAverageDefense)
254 .def("GetAverageMagicalDefense", &GlobalActor::GetAverageMagicalDefense)
255 .def("GetAverageEvadeRating", &GlobalActor::GetAverageEvadeRating)
256 .def("GetAttackPoint", &GlobalActor::GetAttackPoint)
257
258 .def("SetHitPoints", &GlobalActor::SetHitPoints)
259 .def("SetSkillPoints", &GlobalActor::SetSkillPoints)
260 .def("SetMaxHitPoints", &GlobalActor::SetMaxHitPoints)
261 .def("SetMaxSkillPoints", &GlobalActor::SetMaxSkillPoints)
262 .def("SetPhysAtk", &GlobalActor::SetPhysAtk)
263 .def("SetMagAtk", &GlobalActor::SetMagAtk)
264 .def("SetPhysDef", &GlobalActor::SetPhysDef)
265 .def("SetMagDef", &GlobalActor::SetMagDef)
266 .def("SetStamina", &GlobalActor::SetStamina)
267 .def("SetEvade", &GlobalActor::SetEvade)
268 .def("SetPhysAtkModifier", &GlobalActor::SetPhysAtkModifier)
269 .def("SetMagAtkModifier", &GlobalActor::SetMagAtkModifier)
270 .def("SetPhysDefModifier", &GlobalActor::SetPhysDefModifier)
271 .def("SetMagDefModifier", &GlobalActor::SetMagDefModifier)
272 .def("SetStaminaModifier", &GlobalActor::SetStaminaModifier)
273 .def("SetEvadeModifier", &GlobalActor::SetEvadeModifier)
274 .def("SetElementalModifier", &GlobalActor::SetElementalModifier)
275
276 .def("AddHitPoints", &GlobalActor::AddHitPoints)
277 .def("SubtractHitPoints", &GlobalActor::SubtractHitPoints)
278 .def("AddMaxHitPoints", &GlobalActor::AddMaxHitPoints)
279 .def("SubtractMaxHitPoints", &GlobalActor::SubtractMaxHitPoints)
280 .def("AddSkillPoints", &GlobalActor::AddSkillPoints)
281 .def("SubtractSkillPoints", &GlobalActor::SubtractSkillPoints)
282 .def("AddMaxSkillPoints", &GlobalActor::AddMaxSkillPoints)
283 .def("SubtractMaxSkillPoints", &GlobalActor::SubtractMaxSkillPoints)
284 .def("AddPhysAtk", &GlobalActor::AddPhysAtk)
285 .def("SubtractPhysAtk", &GlobalActor::SubtractPhysAtk)
286 .def("AddMagAtk", &GlobalActor::AddMagAtk)
287 .def("SubtractMagAtk", &GlobalActor::SubtractMagAtk)
288 .def("AddPhysDef", &GlobalActor::AddPhysDef)
289 .def("SubtractPhysDef", &GlobalActor::SubtractPhysDef)
290 .def("AddMagDef", &GlobalActor::AddMagDef)
291 .def("SubtractMagDef", &GlobalActor::SubtractMagDef)
292 .def("AddStamina", &GlobalActor::AddStamina)
293 .def("SubtractStamina", &GlobalActor::SubtractStamina)
294 .def("AddEvade", &GlobalActor::AddEvade)
295 .def("SubtractEvade", &GlobalActor::SubtractEvade)
296
297 .def("IsAlive", &GlobalActor::IsAlive)
298 ];
299
300 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
301 [
302 luabind::class_<GlobalCharacter, GlobalActor>("GlobalCharacter")
303 .def("GetExperienceLevel", &GlobalCharacter::GetExperienceLevel)
304 .def("SetExperienceLevel", &GlobalCharacter::SetExperienceLevel)
305 .def("AddExperienceForNextLevel", &GlobalCharacter::AddExperienceForNextLevel)
306 .def("AddSkill", (bool(GlobalCharacter:: *)(uint32_t)) &GlobalCharacter::AddSkill)
307 .def("ApplyActiveStatusEffect", &GlobalCharacter::ApplyActiveStatusEffect)
308 .def("RemoveActiveStatusEffect", &GlobalCharacter::RemoveActiveStatusEffect)
309 .def("GetActiveStatusEffectIntensity", &GlobalCharacter::GetActiveStatusEffectIntensity)
310 ];
311
312 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
313 [
314 luabind::class_<GlobalEnemy, GlobalActor>("GlobalEnemy")
315 ];
316
317 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
318 [
319 luabind::class_<InventoryHandler>("InventoryHandler")
320 .def("AddToInventory", (void (InventoryHandler:: *)(uint32_t, uint32_t)) &InventoryHandler::AddToInventory)
321 .def("RemoveFromInventory", (void (InventoryHandler:: *)(uint32_t)) &InventoryHandler::RemoveFromInventory)
322 .def("IsItemInInventory", &InventoryHandler::IsItemInInventory)
323 .def("IncrementItemCount", &InventoryHandler::IncrementItemCount)
324 .def("DecrementItemCount", &InventoryHandler::DecrementItemCount)
325 ];
326
327 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
328 [
329 luabind::class_<GlobalObject>("GlobalObject")
330 .def("GetID", &GlobalObject::GetID)
331 .def("GetName", &GlobalObject::GetName)
332 .def("GetType", &GlobalObject::GetObjectType)
333 .def("GetCount", &GlobalObject::GetCount)
334 .def("IncrementCount", &GlobalObject::IncrementCount)
335 .def("DecrementCount", &GlobalObject::DecrementCount)
336 ];
337
338 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
339 [
340 luabind::class_<GlobalItem, GlobalObject>("GlobalItem")
341 ];
342
343 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
344 [
345 luabind::class_<GlobalWeapon, GlobalObject>("GlobalWeapon")
346 .def("GetUsableBy", &GlobalWeapon::GetUsableBy)
347 ];
348
349 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
350 [
351 luabind::class_<GlobalArmor, GlobalObject>("GlobalArmor")
352 .def("GetUsableBy", &GlobalArmor::GetUsableBy)
353 ];
354
355 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
356 [
357 luabind::class_<GlobalStatusEffect>("GlobalStatusEffect")
358 .def("GetType", &GlobalStatusEffect::GetType)
359 .def("GetIntensity", &GlobalStatusEffect::GetIntensity)
360 ];
361
362 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
363 [
364 luabind::class_<GlobalSkill>("GlobalSkill")
365 .def("GetID", &GlobalSkill::GetID)
366 .def("GetSPRequired", &GlobalSkill::GetSPRequired)
367 .def("ExecuteBattleWarmupFunction", &GlobalSkill::ExecuteBattleWarmupFunction)
368 .def("ExecuteBattleFunction", &GlobalSkill::ExecuteBattleFunction)
369 ];
370
371 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
372 [
373 luabind::class_<GameEvents>("GameEvents")
374 .def("DoesEventExist", &GameEvents::DoesEventExist)
375 .def("GetEventValue", &GameEvents::GetEventValue)
376 .def("SetEventValue", &GameEvents::SetEventValue)
377 ];
378
379 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
380 [
381 luabind::class_<GameQuests>("GameQuests")
382 .def("AddQuestLog", &GameQuests::AddQuestLog)
383 ];
384
385 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
386 [
387 luabind::class_<MapDataHandler>("MapDataHandler")
388 .def("SetMap", &MapDataHandler::SetMap)
389 .def("GetSaveLocationX", &MapDataHandler::GetSaveLocationX)
390 .def("GetSaveLocationY", &MapDataHandler::GetSaveLocationY)
391 .def("GetPreviousLocation", &MapDataHandler::GetPreviousLocation)
392 ];
393
394 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
395 [
396 luabind::class_<WorldMapHandler>("WorldMapHandler")
397 .def("SetWorldMapImage", &WorldMapHandler::SetWorldMapImage)
398 .def("ShowWorldLocation", &WorldMapHandler::ShowWorldLocation)
399 .def("HideWorldLocation", &WorldMapHandler::HideWorldLocation)
400 .def("SetCurrentLocationId", &WorldMapHandler::SetCurrentLocationId)
401 ];
402
403 luabind::module(vt_script::ScriptManager->GetGlobalState(), "vt_global")
404 [
405 luabind::class_<BattleMedia>("BattleMedia")
406 .def("SetBackgroundImage", &BattleMedia::SetBackgroundImage)
407 .def("SetBattleMusic", &BattleMedia::SetBattleMusic)
408 ];
409
410 } // End using global namespaces
411
412 // Bind the GlobalManager object to Lua
413 luabind::object global_table = luabind::globals(vt_script::ScriptManager->GetGlobalState());
414 global_table["GlobalManager"] = vt_global::GlobalManager;
415 } // void BindCommonCode()
416
417 } // namespace vt_defs
418