Core/Players: Fixed mounts using MOUNT_FLAG_SELF_MOUNT flag

This commit is contained in:
hondacrx
2018-03-06 11:17:30 -05:00
parent c842332393
commit a596b3f1ea
3 changed files with 25 additions and 17 deletions
+3 -1
View File
@@ -137,7 +137,9 @@ namespace Game.DataStorage
public uint Id; public uint Id;
public uint PlayerConditionId; public uint PlayerConditionId;
public byte UiModelSceneID; public byte UiModelSceneID;
}
public bool IsSelfMount() { return (Flags & (ushort)MountFlags.SelfMount) != 0; }
}
public sealed class MountCapabilityRecord public sealed class MountCapabilityRecord
{ {
+19 -12
View File
@@ -2177,21 +2177,28 @@ namespace Game.Spells
var mountDisplays = Global.DB2Mgr.GetMountDisplays(mountEntry.Id); var mountDisplays = Global.DB2Mgr.GetMountDisplays(mountEntry.Id);
if (mountDisplays != null) if (mountDisplays != null)
{ {
List<MountXDisplayRecord> usableDisplays = mountDisplays.Where(mountDisplay => if (mountEntry.IsSelfMount())
{ {
Player playerTarget = target.ToPlayer(); displayId = 73200; //DisplayId: HiddenMount
if (playerTarget) }
else
{
List<MountXDisplayRecord> usableDisplays = mountDisplays.Where(mountDisplay =>
{ {
PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(mountDisplay.PlayerConditionID); Player playerTarget = target.ToPlayer();
if (playerCondition != null) if (playerTarget)
return ConditionManager.IsPlayerMeetingCondition(playerTarget, playerCondition); {
} PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(mountDisplay.PlayerConditionID);
if (playerCondition != null)
return ConditionManager.IsPlayerMeetingCondition(playerTarget, playerCondition);
}
return true; return true;
}).ToList(); }).ToList();
if (!usableDisplays.Empty()) if (!usableDisplays.Empty())
displayId = usableDisplays.SelectRandom().DisplayID; displayId = usableDisplays.SelectRandom().DisplayID;
}
} }
// TODO: CREATE TABLE mount_vehicle (mountId, vehicleCreatureId) for future mounts that are vehicles (new mounts no longer have proper data in MiscValue) // 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)) //if (MountVehicle const* mountVehicle = sObjectMgr->GetMountVehicle(mountEntry->Id))
@@ -2203,7 +2210,7 @@ namespace Game.Spells
{ {
vehicleId = creatureInfo.VehicleId; vehicleId = creatureInfo.VehicleId;
if (displayId == 0 || vehicleId != 0) if (displayId == 0)
{ {
displayId = ObjectManager.ChooseDisplayId(creatureInfo); displayId = ObjectManager.ChooseDisplayId(creatureInfo);
Global.ObjectMgr.GetCreatureModelRandomGender(ref displayId); Global.ObjectMgr.GetCreatureModelRandomGender(ref displayId);
+3 -4
View File
@@ -306,8 +306,7 @@ namespace Scripts.Spells.Generic
public const uint GoblinMale = 31002; public const uint GoblinMale = 31002;
public const uint GoblinFemale = 31003; public const uint GoblinFemale = 31003;
//RunningWild public const uint HiddenMount = 73200;
public const uint RunningWild = 73200;
} }
struct TextIds struct TextIds
@@ -2246,7 +2245,7 @@ namespace Scripts.Spells.Generic
{ {
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
if (!CliDB.CreatureDisplayInfoStorage.ContainsKey(ModelIds.RunningWild)) if (!CliDB.CreatureDisplayInfoStorage.ContainsKey(ModelIds.HiddenMount))
return false; return false;
return true; return true;
} }
@@ -2256,7 +2255,7 @@ namespace Scripts.Spells.Generic
Unit target = GetTarget(); Unit target = GetTarget();
PreventDefaultAction(); PreventDefaultAction();
target.Mount(ModelIds.RunningWild, 0, 0); target.Mount(ModelIds.HiddenMount, 0, 0);
// cast speed aura // cast speed aura
MountCapabilityRecord mountCapability = CliDB.MountCapabilityStorage.LookupByKey(aurEff.GetAmount()); MountCapabilityRecord mountCapability = CliDB.MountCapabilityStorage.LookupByKey(aurEff.GetAmount());