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 PlayerConditionId;
public byte UiModelSceneID;
}
public bool IsSelfMount() { return (Flags & (ushort)MountFlags.SelfMount) != 0; }
}
public sealed class MountCapabilityRecord
{
+19 -12
View File
@@ -2177,21 +2177,28 @@ namespace Game.Spells
var mountDisplays = Global.DB2Mgr.GetMountDisplays(mountEntry.Id);
if (mountDisplays != null)
{
List<MountXDisplayRecord> usableDisplays = mountDisplays.Where(mountDisplay =>
if (mountEntry.IsSelfMount())
{
Player playerTarget = target.ToPlayer();
if (playerTarget)
displayId = 73200; //DisplayId: HiddenMount
}
else
{
List<MountXDisplayRecord> usableDisplays = mountDisplays.Where(mountDisplay =>
{
PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(mountDisplay.PlayerConditionID);
if (playerCondition != null)
return ConditionManager.IsPlayerMeetingCondition(playerTarget, playerCondition);
}
Player playerTarget = target.ToPlayer();
if (playerTarget)
{
PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(mountDisplay.PlayerConditionID);
if (playerCondition != null)
return ConditionManager.IsPlayerMeetingCondition(playerTarget, playerCondition);
}
return true;
}).ToList();
return true;
}).ToList();
if (!usableDisplays.Empty())
displayId = usableDisplays.SelectRandom().DisplayID;
if (!usableDisplays.Empty())
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)
//if (MountVehicle const* mountVehicle = sObjectMgr->GetMountVehicle(mountEntry->Id))
@@ -2203,7 +2210,7 @@ namespace Game.Spells
{
vehicleId = creatureInfo.VehicleId;
if (displayId == 0 || vehicleId != 0)
if (displayId == 0)
{
displayId = ObjectManager.ChooseDisplayId(creatureInfo);
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 GoblinFemale = 31003;
//RunningWild
public const uint RunningWild = 73200;
public const uint HiddenMount = 73200;
}
struct TextIds
@@ -2246,7 +2245,7 @@ namespace Scripts.Spells.Generic
{
public override bool Validate(SpellInfo spellInfo)
{
if (!CliDB.CreatureDisplayInfoStorage.ContainsKey(ModelIds.RunningWild))
if (!CliDB.CreatureDisplayInfoStorage.ContainsKey(ModelIds.HiddenMount))
return false;
return true;
}
@@ -2256,7 +2255,7 @@ namespace Scripts.Spells.Generic
Unit target = GetTarget();
PreventDefaultAction();
target.Mount(ModelIds.RunningWild, 0, 0);
target.Mount(ModelIds.HiddenMount, 0, 0);
// cast speed aura
MountCapabilityRecord mountCapability = CliDB.MountCapabilityStorage.LookupByKey(aurEff.GetAmount());