Skip to content

Instantly share code, notes, and snippets.

@Lillecarl
Last active June 15, 2016 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save Lillecarl/4c0c78e0650c6d4f35f9 to your computer and use it in GitHub Desktop.
Save Lillecarl/4c0c78e0650c6d4f35f9 to your computer and use it in GitHub Desktop.
class AccountMounts : public PlayerScript
{
static const bool limitrace = false; // This set to true will only learn mounts from chars on the same team, do what you want.
public:
AccountMounts() : PlayerScript("AccountMounts") { }
void OnLogin(Player* pPlayer)
{
std::vector<uint32> Guids;
QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", pPlayer->GetSession()->GetAccountId());
if (!result1)
return;
do
{
Field* fields = result1->Fetch();
uint32 guid = fields[0].GetUInt32();
uint32 race = fields[1].GetUInt8();
if ((Player::TeamForRace(race) == Player::TeamForRace(pPlayer->getRace())) || !limitrace)
Guids.push_back(result1->Fetch()[0].GetUInt32());
} while (result1->NextRow());
std::vector<uint32> Spells;
for (auto& i : Guids)
{
QueryResult result2 = CharacterDatabase.PQuery("SELECT spell FROM character_spell WHERE guid = %u", i);
if (!result2)
continue;
do
{
Spells.push_back(result2->Fetch()[0].GetUInt32());
} while (result2->NextRow());
}
for (auto& i : Spells)
{
auto sSpell = sSpellStore.LookupEntry(i);
if (sSpell->Effect[0] == SPELL_EFFECT_APPLY_AURA && sSpell->EffectApplyAuraName[0] == SPELL_AURA_MOUNTED)
pPlayer->learnSpell(sSpell->Id, false);
}
}
};
void AddSC_accontmounts()
{
new AccountMounts;
}
@callmephil
Copy link

Issue : Alt that has not yet learned the mount skill can still ride mounts. that result in player level 1 getting mounts from others characters.

@fixcore
Copy link

fixcore commented Jun 15, 2016

Error line: if (sSpell->Effect[0] == SPELL_EFFECT_APPLY_AURA && sSpell->EffectApplyAuraName[0] == SPELL_AURA_MOUNTED)

in Effect and EffectApplyAuraName

Wow Source 4.3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment