Advertisement
slp13at420

Grumboz VIP Engine Eluna Methods

Feb 29th, 2016
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 11.75 KB | None | 0 0
  1. diff --git a/GlobalMethods.h b/GlobalMethods.h
  2. index d9e91d6..21e96d2 100644
  3. --- a/GlobalMethods.h
  4. +++ b/GlobalMethods.h
  5. @@ -8,13 +8,65 @@
  6.  #define GLOBALMETHODS_H
  7.  
  8.  #include "BindingMap.h"
  9. +#include "Grumboz_VIP_Core.h"
  10.  
  11.  /***
  12.   * These functions can be used anywhere at any time, including at start-up.
  13.   */
  14.  namespace LuaGlobalFunctions
  15.  {
  16. -    /**
  17. +   // Grumboz VIP Engine player methods
  18. +   int GetVIPMAX(Eluna* /*E*/, lua_State* L)
  19. +   {
  20. +       Eluna::Push(L, VIP::GetVIPMAX());
  21. +       return 1;
  22. +   }
  23. +   int GetVIPVOTE_ENABLE(Eluna* /*E*/, lua_State* L)
  24. +   {
  25. +       Eluna::Push(L, VIP::GetVIPVOTE_ENABLE());
  26. +       return 1;
  27. +   }
  28. +   int GetVIPVOTECOUNT(Eluna* /*E*/, lua_State* L)
  29. +   {
  30. +       Eluna::Push(L, VIP::GetVIPVOTECOUNT());
  31. +       return 1;
  32. +   }
  33. +   int GetVIPCOINID(Eluna* /*E*/, lua_State* L)
  34. +   {
  35. +       Eluna::Push(L, VIP::GetVIPCOINID());
  36. +       return 1;
  37. +   }
  38. +   int GetVIPSTONEID(Eluna* /*E*/, lua_State* L)
  39. +   {
  40. +       Eluna::Push(L, VIP::GetVIPSTONEID());
  41. +       return 1;
  42. +   }
  43. +   int GetVIPMGID(Eluna* /*E*/, lua_State* L)
  44. +   {
  45. +       Eluna::Push(L, VIP::GetVIPMGID());
  46. +       return 1;
  47. +   }
  48. +   int GetVIPOFFSET(Eluna* /*E*/, lua_State* L)
  49. +   {
  50. +       Eluna::Push(L, VIP::GetVIPOFFSET());
  51. +       return 1;
  52. +   }
  53. +   int GetTALENTBONUS(Eluna* /*E*/, lua_State* L)
  54. +   {
  55. +       Eluna::Push(L, VIP::GetTALENTBONUS());
  56. +       return 1;
  57. +   }
  58. +   int GetLEVELBONUS_ENABLE(Eluna* /*E*/, lua_State* L)
  59. +   {
  60. +       Eluna::Push(L, VIP::GetLEVELBONUS_ENABLE());
  61. +       return 1;
  62. +   }
  63. +   int GetLEVELBONUS(Eluna* /*E*/, lua_State* L)
  64. +   {
  65. +       Eluna::Push(L, VIP::GetLEVELBONUS());
  66. +       return 1;
  67. +   }
  68. +   /**
  69.       * Returns Lua engine's name.
  70.       *
  71.       * Always returns "ElunaEngine" on Eluna.
  72. diff --git a/ItemMethods.h b/ItemMethods.h
  73. index 14e244e..538dcc8 100644
  74. --- a/ItemMethods.h
  75. +++ b/ItemMethods.h
  76. @@ -7,12 +7,28 @@
  77.  #ifndef ITEMMETHODS_H
  78.  #define ITEMMETHODS_H
  79.  
  80. +#include "Grumboz_VIP_Core.h"
  81. +
  82.  /***
  83.   * Inherits all methods from: [Object]
  84.   */
  85.  namespace LuaItem
  86.  {
  87. -    /**
  88. +   // Grumboz VIP Engine item methods
  89. +   int GetItemVIP(Eluna* /*E*/, lua_State* L, Item* item)
  90. +   {
  91. +       uint32 item_id = item->GetEntry();
  92. +       Eluna::Push(L, VIP::GetItemVIP(item_id));
  93. +       return 1;
  94. +   }
  95. +   int SetItemVIP(Eluna* /*E*/, lua_State* L, Item* item)
  96. +   {
  97. +       uint32 item_id = item->GetEntry();
  98. +       uint8 vip = Eluna::CHECKVAL<uint8>(L, 2);
  99. +       VIP::SetItemVIP(item_id, vip);
  100. +       return 1;
  101. +   }
  102. +   /**
  103.       * Returns 'true' if the [Item] is soulbound, 'false' otherwise
  104.       *
  105.       * @return bool isSoulBound
  106. diff --git a/LuaFunctions.cpp b/LuaFunctions.cpp
  107. index a2dc53b..0662733 100644
  108. --- a/LuaFunctions.cpp
  109. +++ b/LuaFunctions.cpp
  110. @@ -24,6 +24,7 @@ extern "C"
  111.  #include "PlayerMethods.h"
  112.  #include "CreatureMethods.h"
  113.  #include "GroupMethods.h"
  114. +#include "Grumboz_VIP_Core.h"
  115.  #include "GuildMethods.h"
  116.  #include "GameObjectMethods.h"
  117.  #include "ElunaQueryMethods.h"
  118. @@ -75,7 +76,16 @@ ElunaGlobal::ElunaRegister GlobalMethods[] =
  119.      { "ClearInstanceEvents", &LuaGlobalFunctions::ClearInstanceEvents },
  120.  
  121.      // Getters
  122. -    { "GetLuaEngine", &LuaGlobalFunctions::GetLuaEngine },
  123. +   // Grumboz VIP Engine global methods
  124. +   { "GetVIPMAX", &LuaGlobalFunctions::GetVIPMAX },            // GetVIPMAX(); returns maximum VIP rank.
  125. +   { "GetVIPVOTECOUNT", &LuaGlobalFunctions::GetVIPVOTECOUNT },// GetVIPVOTECOUNT(); returns how many votes to rank up VIP +1 rank.
  126. +   { "GetVIPCOINID", &LuaGlobalFunctions::GetVIPCOINID },      // GetVIPCOINID(); returns item id.
  127. +   { "GetVIPSTONEID", &LuaGlobalFunctions::GetVIPSTONEID },    // GetVIPSTONEID(); returns item id.
  128. +   { "GetVIPMGID", &LuaGlobalFunctions::GetVIPMGID },          // GetVIPMGID(); returns item id.
  129. +   { "GetVIPOFFSET", &LuaGlobalFunctions::GetVIPOFFSET },      // GetVIPOFFSET(); returns float offset value.
  130. +   { "GetTALENTBONUS", &LuaGlobalFunctions::GetTALENTBONUS },  // GetTALENTBONUS(); returns how many extra tp per VIP rank.
  131. +   { "GetLEVELBONUS", &LuaGlobalFunctions::GetLEVELBONUS },    // GetLEVELBONUS(); returns how many extra levels per VIP rank.
  132. +   { "GetLuaEngine", &LuaGlobalFunctions::GetLuaEngine },
  133.      { "GetCoreName", &LuaGlobalFunctions::GetCoreName },
  134.      { "GetCoreVersion", &LuaGlobalFunctions::GetCoreVersion },
  135.      { "GetCoreExpansion", &LuaGlobalFunctions::GetCoreExpansion },
  136. @@ -111,7 +121,10 @@ ElunaGlobal::ElunaRegister GlobalMethods[] =
  137.      { "PrintDebug", &LuaGlobalFunctions::PrintDebug },
  138.  
  139.      // Boolean
  140. -    { "IsInventoryPos", &LuaGlobalFunctions::IsInventoryPos },
  141. +   // Grumboz VIP Engine global methods
  142. +   { "GetVIPVOTE_ENABLE", &LuaGlobalFunctions::GetVIPVOTE_ENABLE },            // GetVIPVOTE_ENABLE(); returns bool value. ?Do Votes increase VIP ranks?
  143. +   { "GetLEVELBONUS_ENABLE", &LuaGlobalFunctions::GetLEVELBONUS_ENABLE },      // GetLEVELBONUS_ENABLE(); returns bool value. do players get extra levels per VIP rank.
  144. +   { "IsInventoryPos", &LuaGlobalFunctions::IsInventoryPos },
  145.      { "IsEquipmentPos", &LuaGlobalFunctions::IsEquipmentPos },
  146.      { "IsBankPos", &LuaGlobalFunctions::IsBankPos },
  147.      { "IsBagPos", &LuaGlobalFunctions::IsBagPos },
  148. @@ -428,7 +441,11 @@ ElunaRegister<Unit> UnitMethods[] =
  149.  ElunaRegister<Player> PlayerMethods[] =
  150.  {
  151.      // Getters
  152. -    { "GetSelection", &LuaPlayer::GetSelection },
  153. +   // Grumboz VIP Engine player getter methods
  154. +   { "GetPlayerVIP", &LuaPlayer::GetPlayerVIP },               // player:GetPlayerVIP(); returns uint8 value of a players VIP rank.
  155. +   { "GetPlayerMG", &LuaPlayer::GetPlayerMG },                 // player:GetPlayerMG(); returns uint32 value of players total mg stored.(NOT IN INVENTORY)
  156. +   { "GetPlayerVOTES", &LuaPlayer::GetPlayerVOTES },           // player:GetPlayerVOTES(); returns uint32 value of players total voting count.
  157. +   { "GetSelection", &LuaPlayer::GetSelection },
  158.      { "GetGMRank", &LuaPlayer::GetGMRank },
  159.      { "GetGuildId", &LuaPlayer::GetGuildId },
  160.      { "GetCoinage", &LuaPlayer::GetCoinage },
  161. @@ -512,7 +529,11 @@ ElunaRegister<Player> PlayerMethods[] =
  162.  #endif
  163.  
  164.      // Setters
  165. -    { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax },
  166. +   // Grumboz VIP Engine player setter methods
  167. +   { "SetPlayerVIP", &LuaPlayer::SetPlayerVIP },
  168. +   { "SetPlayerMG", &LuaPlayer::SetPlayerMG },
  169. +   { "SetPlayerVOTES", &LuaPlayer::SetPlayerVOTES },
  170. +   { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax },
  171.      { "AdvanceSkill", &LuaPlayer::AdvanceSkill },
  172.      { "AdvanceAllSkills", &LuaPlayer::AdvanceAllSkills },
  173.      { "AddLifetimeKills", &LuaPlayer::AddLifetimeKills },
  174. @@ -750,7 +771,10 @@ ElunaRegister<Player> PlayerMethods[] =
  175.  ElunaRegister<Creature> CreatureMethods[] =
  176.  {
  177.      // Getters
  178. -    { "GetAITarget", &LuaCreature::GetAITarget },
  179. +   // Grumboz VIP Engine creature getter methods
  180. +   { "GetCreatureVIP", &LuaCreature::GetCreatureVIP },             // creature:GetCreatureVIP(uint32 creature_id); returns uint8 value of a creatures VIP rank.
  181. +   { "GetCreatureMG", &LuaCreature::GetCreatureMG },               // creature:GetCreatureMG(uint32 creature_id); returns uint32 value of creature mg .
  182. +   { "GetAITarget", &LuaCreature::GetAITarget },
  183.      { "GetAITargets", &LuaCreature::GetAITargets },
  184.      { "GetAITargetsCount", &LuaCreature::GetAITargetsCount },
  185.      { "GetHomePosition", &LuaCreature::GetHomePosition },
  186. @@ -778,7 +802,10 @@ ElunaRegister<Creature> CreatureMethods[] =
  187.      { "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow },
  188.  
  189.      // Setters
  190. -    { "SetHover", &LuaCreature::SetHover },
  191. +   // Grumboz VIP Engine creature setter methods
  192. +   { "SetCreatureVIP", &LuaCreature::SetCreatureVIP },             // creature:SetCreatureVIP(uint32 creature_id); sets  uint8 value of a creatures VIP rank.
  193. +   { "SetCreatureMG", &LuaCreature::SetCreatureMG },               // creature:SetCreatureMG(uint32 creature_id); sets uint32 value of creature mg .
  194. +   { "SetHover", &LuaCreature::SetHover },
  195.      { "SetDisableGravity", &LuaCreature::SetDisableGravity },
  196.      { "SetAggroEnabled", &LuaCreature::SetAggroEnabled },
  197.      { "SetNoCallAssistance", &LuaCreature::SetNoCallAssistance },
  198. @@ -887,7 +914,9 @@ ElunaRegister<GameObject> GameObjectMethods[] =
  199.  ElunaRegister<Item> ItemMethods[] =
  200.  {
  201.      // Getters
  202. -    { "GetOwnerGUID", &LuaItem::GetOwnerGUID },
  203. +   // Grumboz VIP Engine item getter methods
  204. +   { "GetItemVIP", &LuaItem::GetItemVIP },
  205. +   { "GetOwnerGUID", &LuaItem::GetOwnerGUID },
  206.      { "GetOwner", &LuaItem::GetOwner },
  207.      { "GetCount", &LuaItem::GetCount },
  208.      { "GetMaxStackCount", &LuaItem::GetMaxStackCount },
  209. @@ -921,7 +950,9 @@ ElunaRegister<Item> ItemMethods[] =
  210.      { "GetBagSize", &LuaItem::GetBagSize },
  211.  
  212.      // Setters
  213. -    { "SetOwner", &LuaItem::SetOwner },
  214. +   // Grumboz VIP Engine item Setter methods
  215. +   { "SetItemVIP", &LuaItem::SetItemVIP },
  216. +   { "SetOwner", &LuaItem::SetOwner },
  217.      { "SetBinding", &LuaItem::SetBinding },
  218.      { "SetCount", &LuaItem::SetCount },
  219. diff --git a/PlayerMethods.h b/PlayerMethods.h
  220. index 8e0d9ae..66fd665 100644
  221. --- a/PlayerMethods.h
  222. +++ b/PlayerMethods.h
  223. @@ -7,13 +7,55 @@
  224.  #ifndef PLAYERMETHODS_H
  225.  #define PLAYERMETHODS_H
  226.  
  227. +#include "Grumboz_VIP_Core.h"
  228. +
  229.  /***
  230.   * Inherits all methods from: [Object], [WorldObject], [Unit]
  231.   */
  232.  namespace LuaPlayer
  233.  {
  234. +   // Grumboz VIP Engine player methods
  235. +   int GetPlayerVIP(Eluna* /*E*/, lua_State* L, Player* player)
  236. +   {
  237. +       uint32 acctId = player->GetSession()->GetAccountId();
  238. +       Eluna::Push(L, VIP::GetPlayerVIP(acctId));
  239. +       return 1;
  240. +   }
  241. +   int GetPlayerMG(Eluna* /*E*/, lua_State* L, Player* player)
  242. +   {
  243. +       uint32 acctId = player->GetSession()->GetAccountId();
  244. +       Eluna::Push(L, VIP::GetPlayerMG(acctId));
  245. +       return 1;
  246. +   }
  247. +   int GetPlayerVOTES(Eluna* /*E*/, lua_State* L, Player* player)
  248. +   {
  249. +       uint32 acctId = player->GetSession()->GetAccountId();
  250. +       Eluna::Push(L, VIP::GetPlayerVOTES(acctId));
  251. +       return 1;
  252. +   }
  253. +   int SetPlayerVIP(Eluna* /*E*/, lua_State* L, Player* player)
  254. +   {
  255. +       uint32 acctId = player->GetSession()->GetAccountId();
  256. +       uint8 vip = Eluna::CHECKVAL<uint8>(L, 2);
  257. +       VIP::SetPlayerVIP(acctId, vip);
  258. +       return 0;
  259. +   }
  260. +   int SetPlayerMG(Eluna* /*E*/, lua_State* L, Player* player)
  261. +   {
  262. +       uint32 acctId = player->GetSession()->GetAccountId();
  263. +       uint32 mg = Eluna::CHECKVAL<uint32>(L, 2);
  264. +       VIP::SetPlayerMG(acctId, mg);
  265. +       return 0;
  266. +   }
  267. +   int SetPlayerVOTES(Eluna* /*E*/, lua_State* L, Player* player)
  268. +   {
  269. +       uint32 acctId = player->GetSession()->GetAccountId();
  270. +       uint32 votes = Eluna::CHECKVAL<uint32>(L, 2);
  271. +       VIP::SetPlayerVOTES(acctId, votes);
  272. +       return 0;
  273. +   }
  274.  #if (!defined(TBC) && !defined(CLASSIC))
  275. -    /**
  276. +   /**
  277.       * Returns 'true' if the [Player] can Titan Grip, 'false' otherwise.
  278.       *
  279.       * @return bool canTitanGrip
  280. diff --git a/CreatureMethods.h b/CreatureMethods.h
  281. index d3bf10a..8684ad6 100644
  282. --- a/CreatureMethods.h
  283. +++ b/CreatureMethods.h
  284. @@ -7,6 +7,8 @@
  285.  #ifndef CREATUREMETHODS_H
  286.  #define CREATUREMETHODS_H
  287.  
  288. +#include "Grumboz_VIP_Core.h"
  289. +
  290.  /***
  291.   * Non-[Player] controlled [Unit]s (i.e. NPCs).
  292.   *
  293. @@ -14,7 +16,38 @@
  294.   */
  295.  namespace LuaCreature
  296.  {
  297. -    /**
  298. +   // Grumboz VIP Engine creature methods
  299. +   int GetCreatureVIP(Eluna* /*E*/, lua_State* L, Creature* creature)
  300. +   {
  301. +       uint32 creature_id = creature->GetEntry();
  302. +
  303. +       Eluna::Push(L, VIP::GetCreatureVIP(creature_id));
  304. +       return 1;
  305. +   }
  306. +   int GetCreatureMG(Eluna* /*E*/, lua_State* L, Creature* creature)
  307. +   {
  308. +       uint32 creature_id = creature->GetEntry();
  309. +
  310. +       Eluna::Push(L, VIP::GetCreatureMG(creature_id));
  311. +       return 1;
  312. +   }
  313. +   int SetCreatureVIP(Eluna* /*E*/, lua_State* L, Creature* creature)
  314. +   {
  315. +       uint32 creature_id = creature->GetEntry();
  316. +       uint8 vip = Eluna::CHECKVAL<uint8>(L, 2);
  317. +
  318. +       VIP::SetCreatureVIP(creature_id, vip);
  319. +       return 0;
  320. +   }
  321. +   int SetCreatureMG(Eluna* /*E*/, lua_State* L, Creature* creature)
  322. +   {
  323. +       uint32 creature_id = creature->GetEntry();
  324. +       uint32 mg = Eluna::CHECKVAL<uint32>(L, 2);
  325. +
  326. +       VIP::SetCreatureMG(creature_id, mg);
  327. +       return 0;
  328. +   }
  329. +   /**
  330.       * Returns `true` if the [Creature] is set to not give reputation when killed,
  331.       *   and returns `false` otherwise.
  332.       *
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement