Core/Players: Fixed mounts using MOUNT_FLAG_SELF_MOUNT flag (#21558)

This commit is contained in:
DoctorKraft
2018-03-05 19:20:42 +01:00
committed by Shauren
parent f411b7a90e
commit 58930d273f
4 changed files with 22 additions and 14 deletions
@@ -1882,6 +1882,8 @@ struct MountEntry
uint32 ID;
uint32 PlayerConditionId;
int32 UiModelSceneID;
bool IsSelfMount() const { return (Flags & MOUNT_FLAG_SELF_MOUNT) != 0; }
};
struct MountCapabilityEntry
+1
View File
@@ -37,6 +37,7 @@
#define WORLD_TRIGGER 12999
#define ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE 197886
#define SPELL_DH_DOUBLE_JUMP 196055
#define DISPLAYID_HIDDEN_MOUNT 73200
enum SpellModOp : uint8
{
@@ -2543,18 +2543,25 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
{
if (DB2Manager::MountXDisplayContainer const* mountDisplays = sDB2Manager.GetMountDisplays(mountEntry->ID))
{
DB2Manager::MountXDisplayContainer usableDisplays;
std::copy_if(mountDisplays->begin(), mountDisplays->end(), std::back_inserter(usableDisplays), [target](MountXDisplayEntry const* mountDisplay)
if (mountEntry->IsSelfMount())
{
if (Player* playerTarget = target->ToPlayer())
if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(mountDisplay->PlayerConditionID))
return sConditionMgr->IsPlayerMeetingCondition(playerTarget, playerCondition);
displayId = DISPLAYID_HIDDEN_MOUNT;
}
else
{
DB2Manager::MountXDisplayContainer usableDisplays;
std::copy_if(mountDisplays->begin(), mountDisplays->end(), std::back_inserter(usableDisplays), [target](MountXDisplayEntry const* mountDisplay)
{
if (Player* playerTarget = target->ToPlayer())
if (PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(mountDisplay->PlayerConditionID))
return sConditionMgr->IsPlayerMeetingCondition(playerTarget, playerCondition);
return true;
});
return true;
});
if (!usableDisplays.empty())
displayId = Trinity::Containers::SelectRandomContainerElement(usableDisplays)->DisplayID;
if (!usableDisplays.empty())
displayId = Trinity::Containers::SelectRandomContainerElement(usableDisplays)->DisplayID;
}
}
// TODO: CREATE TABLE mount_vehicle (mountId, vehicleCreatureId) for future mounts that are vehicles (new mounts no longer have proper data in MiscValue)
//if (MountVehicle const* mountVehicle = sObjectMgr->GetMountVehicle(mountEntry->Id))
@@ -2565,7 +2572,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo
{
vehicleId = creatureInfo->VehicleId;
if (!displayId || vehicleId)
if (!displayId)
{
displayId = ObjectMgr::ChooseDisplayId(creatureInfo);
sObjectMgr->GetCreatureModelRandomGender(&displayId);
+2 -4
View File
@@ -2892,10 +2892,8 @@ class spell_gen_replenishment : public SpellScriptLoader
}
};
enum RunningWildMountIds
{
RUNNING_WILD_MODEL = 73200,
SPELL_ALTERED_FORM = 97709
};
@@ -2910,7 +2908,7 @@ class spell_gen_running_wild : public SpellScriptLoader
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sCreatureDisplayInfoStore.LookupEntry(RUNNING_WILD_MODEL))
if (!sCreatureDisplayInfoStore.LookupEntry(DISPLAYID_HIDDEN_MOUNT))
return false;
return true;
}
@@ -2920,7 +2918,7 @@ class spell_gen_running_wild : public SpellScriptLoader
Unit* target = GetTarget();
PreventDefaultAction();
target->Mount(RUNNING_WILD_MODEL, 0, 0);
target->Mount(DISPLAYID_HIDDEN_MOUNT, 0, 0);
// cast speed aura
if (MountCapabilityEntry const* mountCapability = sMountCapabilityStore.LookupEntry(aurEff->GetAmount()))