mirror of
https://github.com/azerothcore/mod-account-mounts
synced 2025-11-29 23:44:52 +08:00
feat. Update module to work with the latest emulator version (#8)
This commit is contained in:
@@ -6,32 +6,33 @@
|
||||
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)
|
||||
{
|
||||
if (sConfigMgr->GetBoolDefault("Account.Mounts.Enable", true))
|
||||
if (sConfigMgr->GetOption<bool>("Account.Mounts.Enable", true))
|
||||
{
|
||||
if (sConfigMgr->GetBoolDefault("Account.Mounts.Announce", false))
|
||||
if (sConfigMgr->GetOption<bool>("Account.Mounts.Announce", false))
|
||||
{
|
||||
ChatHandler(pPlayer->GetSession()).SendSysMessage("This server is running the |cff4CFF00AccountMounts |rmodule.");
|
||||
}
|
||||
|
||||
std::vector<uint32> Guids;
|
||||
uint32 playerGUID = pPlayer->GetGUID().GetCounter();
|
||||
QueryResult result1 = CharacterDatabase.PQuery("SELECT guid, race FROM characters WHERE account = %u", playerGUID);
|
||||
QueryResult result1 = CharacterDatabase.Query("SELECT `guid`, `race` FROM `characters` WHERE `account`={};", playerGUID);
|
||||
|
||||
if (!result1)
|
||||
return;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = result1->Fetch();
|
||||
|
||||
//uint32 guid = fields[0].GetUInt32(); //unused variable
|
||||
uint32 race = fields[1].GetUInt8();
|
||||
uint32 race = fields[1].Get<uint8>();
|
||||
|
||||
if ((Player::TeamIdForRace(race) == Player::TeamIdForRace(pPlayer->getRace())) || !limitrace)
|
||||
Guids.push_back(result1->Fetch()[0].GetUInt32());
|
||||
Guids.push_back(result1->Fetch()[0].Get<uint32>());
|
||||
|
||||
} while (result1->NextRow());
|
||||
|
||||
@@ -39,13 +40,13 @@ public:
|
||||
|
||||
for (auto& i : Guids)
|
||||
{
|
||||
QueryResult result2 = CharacterDatabase.PQuery("SELECT spell FROM character_spell WHERE guid = %u", i);
|
||||
QueryResult result2 = CharacterDatabase.Query("SELECT `spell` FROM `character_spell` WHERE `guid`={};", i);
|
||||
if (!result2)
|
||||
continue;
|
||||
|
||||
do
|
||||
{
|
||||
Spells.push_back(result2->Fetch()[0].GetUInt32());
|
||||
Spells.push_back(result2->Fetch()[0].Get<uint32>());
|
||||
} while (result2->NextRow());
|
||||
}
|
||||
|
||||
@@ -53,13 +54,13 @@ public:
|
||||
{
|
||||
auto sSpell = sSpellStore.LookupEntry(i);
|
||||
if (sSpell->Effect[0] == SPELL_EFFECT_APPLY_AURA && sSpell->EffectApplyAuraName[0] == SPELL_AURA_MOUNTED)
|
||||
pPlayer->learnSpell(sSpell->Id);
|
||||
pPlayer->learnSpell(sSpell->Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddAccountMountsScripts()
|
||||
{
|
||||
new AccountMounts;
|
||||
new AccountMounts();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user