kusanagy

Account_Mounts

Jan 21st, 2017
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.04 KB | None | 0 0
  1. From 9a7ed7a963743154e90527a1a56d28347006ba70 Mon Sep 17 00:00:00 2001
  2. From: LordPsyan <[email protected]>
  3. Date: Mon, 29 Feb 2016 08:03:34 -0600
  4. Subject: [PATCH] 2016_02_29-Account_Mounts
  5.  
  6. ---
  7. src/server/scripts/Custom/account_mount.cpp        | 53 ++++++++++++++++++++++
  8.  src/server/scripts/Custom/custom_script_loader.cpp |  6 ++-
  9.  2 files changed, 57 insertions(+), 2 deletions(-)
  10.  create mode 100644 src/server/scripts/Custom/account_mount.cpp
  11.  
  12. diff --git a/src/server/scripts/Custom/account_mount.cpp b/src/server/scripts/Custom/account_mount.cpp
  13. new file mode 100644
  14. index 0000000..ebb879b
  15. --- /dev/null
  16. +++ b/src/server/scripts/Custom/account_mount.cpp
  17. @@ -0,0 +1,53 @@
  18. +class AccountMounts : public PlayerScript
  19. +{
  20. +    static const bool limitrace = true; // This set to true will only learn mounts from chars on the same team, do what you want.
  21. +public:
  22. +    AccountMounts() : PlayerScript("AccountMounts") { }
  23. +
  24. +    void OnLogin(Player* player, bool /*firstLogin*/) override
  25. +    {
  26. +        std::vector<uint32> Guids;
  27. +        uint32 playerGUID = player->GetGUID();
  28. +        QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", playerGUID);
  29. +        if (!result1)
  30. +            return;
  31. +
  32. +        do
  33. +        {
  34. +            Field* fields = result1->Fetch();
  35. +
  36. +            uint32 guid = fields[0].GetUInt32();
  37. +            uint32 race = fields[1].GetUInt8();
  38. +
  39. +            if ((Player::TeamForRace(race) == Player::TeamForRace(player->getRace())) || !limitrace)
  40. +                Guids.push_back(result1->Fetch()[0].GetUInt32());
  41. +
  42. +        } while (result1->NextRow());
  43. +
  44. +        std::vector<uint32> Spells;
  45. +
  46. +        for (auto& i : Guids)
  47. +        {
  48. +            QueryResult result2 = CharacterDatabase.PQuery("SELECT spell FROM character_spell WHERE guid = %u", i);
  49. +            if (!result2)
  50. +                continue;
  51. +
  52. +            do
  53. +            {
  54. +                Spells.push_back(result2->Fetch()[0].GetUInt32());
  55. +            } while (result2->NextRow());
  56. +        }
  57. +
  58. +        for (auto& i : Spells)
  59. +        {
  60. +            auto sSpell = sSpellStore.LookupEntry(i);
  61. +            if (sSpell->Effect[0] == SPELL_EFFECT_APPLY_AURA && sSpell->EffectApplyAuraName[0] == SPELL_AURA_MOUNTED)
  62. +                player->LearnSpell(sSpell->Id, false);
  63. +        }
  64. +    }
  65. +};
  66. +
  67. +void AddSC_accontmounts()
  68. +{
  69. +    new AccountMounts;
  70. +}
  71. \ No newline at end of file
  72. diff --git a/src/server/scripts/Custom/custom_script_loader.cpp b/src/server/scripts/Custom/custom_script_loader.cpp
  73. index 0592bb5..f38ff7b 100644
  74. --- a/src/server/scripts/Custom/custom_script_loader.cpp
  75. +++ b/src/server/scripts/Custom/custom_script_loader.cpp
  76. @@ -104,7 +104,8 @@
  77.  // start86
  78.  // start87
  79.  // start88
  80. -// start89
  81. +// Account Mounts
  82. +void AddSC_accontmounts();
  83.  // start90
  84.  // start91
  85.  // start92
  86. @@ -309,7 +310,8 @@ void AddCustomScripts()
  87.  // end86
  88.  // end87
  89.  // end88
  90. -// end89
  91. +// Account Mount
  92. +    AddSC_accontmounts();
  93.  // end90
  94.  // end91
  95.  // end92
  96. --
  97. 2.1.4
Advertisement
Add Comment
Please, Sign In to add comment