Services.cpp 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * api/Services.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "Services.h"
  12. #include <vcmi/Artifact.h>
  13. #include <vcmi/Creature.h>
  14. #include <vcmi/Faction.h>
  15. #include <vcmi/HeroClass.h>
  16. #include <vcmi/HeroType.h>
  17. #include <vcmi/Skill.h>
  18. #include <vcmi/spells/Spell.h>
  19. #include "Registry.h"
  20. #include "../LuaStack.h"
  21. #include "../LuaCallWrapper.h"
  22. namespace scripting
  23. {
  24. namespace api
  25. {
  26. VCMI_REGISTER_CORE_SCRIPT_API(ServicesProxy, "Services");
  27. const std::vector<ServicesProxy::CustomRegType> ServicesProxy::REGISTER_CUSTOM =
  28. {
  29. {"artifacts", LuaMethodWrapper<Services, decltype(&Services::artifacts), &Services::artifacts>::invoke, false},
  30. {"creatures", LuaMethodWrapper<Services, decltype(&Services::creatures), &Services::creatures>::invoke, false},
  31. {"factions", LuaMethodWrapper<Services, decltype(&Services::factions), &Services::factions>::invoke, false},
  32. {"heroClasses", LuaMethodWrapper<Services, decltype(&Services::heroClasses), &Services::heroClasses>::invoke, false},
  33. {"heroTypes", LuaMethodWrapper<Services, decltype(&Services::heroTypes), &Services::heroTypes>::invoke, false},
  34. {"spells", LuaMethodWrapper<Services, decltype(&Services::spells), &Services::spells>::invoke, false},
  35. {"skills", LuaMethodWrapper<Services, decltype(&Services::skills), &Services::skills>::invoke, false},
  36. };
  37. VCMI_REGISTER_CORE_SCRIPT_API(ArtifactServiceProxy, "Artifacts");
  38. const std::vector<ArtifactServiceProxy::CustomRegType> ArtifactServiceProxy::REGISTER_CUSTOM =
  39. {
  40. {"getByIndex", LuaMethodWrapper<ArtifactService, decltype(&ArtifactService::getByIndex), &ArtifactService::getByIndex>::invoke, false}
  41. };
  42. VCMI_REGISTER_CORE_SCRIPT_API(CreatureServiceProxy, "Creatures");
  43. const std::vector<CreatureServiceProxy::CustomRegType> CreatureServiceProxy::REGISTER_CUSTOM =
  44. {
  45. {"getByIndex", LuaMethodWrapper<CreatureService, decltype(&CreatureService::getByIndex), &CreatureService::getByIndex>::invoke, false}
  46. };
  47. VCMI_REGISTER_CORE_SCRIPT_API(FactionServiceProxy, "Factions");
  48. const std::vector<FactionServiceProxy::CustomRegType> FactionServiceProxy::REGISTER_CUSTOM =
  49. {
  50. {"getByIndex", LuaMethodWrapper<FactionService, decltype(&FactionService::getByIndex), &FactionService::getByIndex>::invoke, false}
  51. };
  52. VCMI_REGISTER_CORE_SCRIPT_API(HeroClassServiceProxy, "HeroClasses");
  53. const std::vector<HeroClassServiceProxy::CustomRegType> HeroClassServiceProxy::REGISTER_CUSTOM =
  54. {
  55. {"getByIndex", LuaMethodWrapper<HeroClassService, decltype(&HeroClassService::getByIndex), &HeroClassService::getByIndex>::invoke, false}
  56. };
  57. VCMI_REGISTER_CORE_SCRIPT_API(HeroTypeServiceProxy, "HeroTypes");
  58. const std::vector<HeroTypeServiceProxy::CustomRegType> HeroTypeServiceProxy::REGISTER_CUSTOM =
  59. {
  60. {"getByIndex", LuaMethodWrapper<HeroTypeService, decltype(&HeroTypeService::getByIndex), &HeroTypeService::getByIndex>::invoke, false}
  61. };
  62. VCMI_REGISTER_CORE_SCRIPT_API(SkillServiceProxy, "Skills");
  63. const std::vector<SkillServiceProxy::CustomRegType> SkillServiceProxy::REGISTER_CUSTOM =
  64. {
  65. {"getByIndex", LuaMethodWrapper<SkillService, decltype(&SkillService::getByIndex), &SkillService::getByIndex>::invoke, false}
  66. };
  67. VCMI_REGISTER_CORE_SCRIPT_API(SpellServiceProxy, "Spells");
  68. const std::vector<SpellServiceProxy::CustomRegType> SpellServiceProxy::REGISTER_CUSTOM =
  69. {
  70. {"getByIndex", LuaMethodWrapper<spells::Service, decltype(&spells::Service::getByIndex), &spells::Service::getByIndex>::invoke, false}
  71. };
  72. }
  73. }