Services.cpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. VCMI_LIB_NAMESPACE_BEGIN
  23. namespace scripting
  24. {
  25. namespace api
  26. {
  27. VCMI_REGISTER_CORE_SCRIPT_API(ServicesProxy, "Services");
  28. const std::vector<ServicesProxy::CustomRegType> ServicesProxy::REGISTER_CUSTOM =
  29. {
  30. {"artifacts", LuaMethodWrapper<Services, decltype(&Services::artifacts), &Services::artifacts>::invoke, false},
  31. {"creatures", LuaMethodWrapper<Services, decltype(&Services::creatures), &Services::creatures>::invoke, false},
  32. {"factions", LuaMethodWrapper<Services, decltype(&Services::factions), &Services::factions>::invoke, false},
  33. {"heroClasses", LuaMethodWrapper<Services, decltype(&Services::heroClasses), &Services::heroClasses>::invoke, false},
  34. {"heroTypes", LuaMethodWrapper<Services, decltype(&Services::heroTypes), &Services::heroTypes>::invoke, false},
  35. {"spells", LuaMethodWrapper<Services, decltype(&Services::spells), &Services::spells>::invoke, false},
  36. {"skills", LuaMethodWrapper<Services, decltype(&Services::skills), &Services::skills>::invoke, false},
  37. };
  38. VCMI_REGISTER_CORE_SCRIPT_API(ArtifactServiceProxy, "Artifacts");
  39. const std::vector<ArtifactServiceProxy::CustomRegType> ArtifactServiceProxy::REGISTER_CUSTOM =
  40. {
  41. {"getByIndex", LuaMethodWrapper<ArtifactService, decltype(&ArtifactService::getByIndex), &ArtifactService::getByIndex>::invoke, false}
  42. };
  43. VCMI_REGISTER_CORE_SCRIPT_API(CreatureServiceProxy, "Creatures");
  44. const std::vector<CreatureServiceProxy::CustomRegType> CreatureServiceProxy::REGISTER_CUSTOM =
  45. {
  46. {"getByIndex", LuaMethodWrapper<CreatureService, decltype(&CreatureService::getByIndex), &CreatureService::getByIndex>::invoke, false}
  47. };
  48. VCMI_REGISTER_CORE_SCRIPT_API(FactionServiceProxy, "Factions");
  49. const std::vector<FactionServiceProxy::CustomRegType> FactionServiceProxy::REGISTER_CUSTOM =
  50. {
  51. {"getByIndex", LuaMethodWrapper<FactionService, decltype(&FactionService::getByIndex), &FactionService::getByIndex>::invoke, false}
  52. };
  53. VCMI_REGISTER_CORE_SCRIPT_API(HeroClassServiceProxy, "HeroClasses");
  54. const std::vector<HeroClassServiceProxy::CustomRegType> HeroClassServiceProxy::REGISTER_CUSTOM =
  55. {
  56. {"getByIndex", LuaMethodWrapper<HeroClassService, decltype(&HeroClassService::getByIndex), &HeroClassService::getByIndex>::invoke, false}
  57. };
  58. VCMI_REGISTER_CORE_SCRIPT_API(HeroTypeServiceProxy, "HeroTypes");
  59. const std::vector<HeroTypeServiceProxy::CustomRegType> HeroTypeServiceProxy::REGISTER_CUSTOM =
  60. {
  61. {"getByIndex", LuaMethodWrapper<HeroTypeService, decltype(&HeroTypeService::getByIndex), &HeroTypeService::getByIndex>::invoke, false}
  62. };
  63. VCMI_REGISTER_CORE_SCRIPT_API(SkillServiceProxy, "Skills");
  64. const std::vector<SkillServiceProxy::CustomRegType> SkillServiceProxy::REGISTER_CUSTOM =
  65. {
  66. {"getByIndex", LuaMethodWrapper<SkillService, decltype(&SkillService::getByIndex), &SkillService::getByIndex>::invoke, false}
  67. };
  68. VCMI_REGISTER_CORE_SCRIPT_API(SpellServiceProxy, "Spells");
  69. const std::vector<SpellServiceProxy::CustomRegType> SpellServiceProxy::REGISTER_CUSTOM =
  70. {
  71. {"getByIndex", LuaMethodWrapper<spells::Service, decltype(&spells::Service::getByIndex), &spells::Service::getByIndex>::invoke, false}
  72. };
  73. }
  74. }
  75. VCMI_LIB_NAMESPACE_END