Code: Select all
//===========================================================================
//Characters
//Character enums
Sqrat::Enumeration allegiances(*scriptMgr->getVM());
allegiances.Const("Playable", EA_PLAYABLE);
allegiances.Const("Enemy", EA_ENEMY);
allegiances.Const("FriendlyNPC", EA_FRIENDLY_NPC);
Sqrat::ConstTable(*scriptMgr->getVM()).Enum("Allegiance", allegiances);
//Character class
Sqrat::Class<ICharacter> characterClass(*scriptMgr->getVM());
characterClass.Func("GetHealth", &ICharacter::getHealth);
characterClass.Func("IsDead", &ICharacter::isDead);
characterClass.Func("GetAllegiance", &ICharacter::getAllegiance);
characterClass.Func("DrawMeleeWeapon", &ICharacter::drawMeleeWeapon);
characterClass.Func("SheathMeleeWeapon", &ICharacter::sheathMeleeWeapon);
characterClass.Func("SetPosition", &ICharacter::teleport);
Sqrat::RootTable(*scriptMgr->getVM()).Bind("Character", characterClass);
//Get character by name
characterTable.Func("GetCharacterByName", &sqGetCharacterByName);
Sqrat::RootTable(*scriptMgr->getVM()).Bind("Characters", characterTable);
Code: Select all
extern ICharacter* sqGetCharacterByName(Sqrat::string name);