public bool AddMount(uint spellId, MountStatusFlags flags, bool factionMount = false, bool learned = false) { Player player = _owner.GetPlayer(); if (!player) { return(false); } MountRecord mount = Global.DB2Mgr.GetMount(spellId); if (mount == null) { return(false); } var value = FactionSpecificMounts.LookupByKey(spellId); if (value != 0 && !factionMount) { AddMount(value, flags, true, learned); } _mounts[spellId] = flags; // Mount condition only applies to using it, should still learn it. if (mount.PlayerConditionID != 0) { PlayerConditionRecord playerCondition = CliDB.PlayerConditionStorage.LookupByKey(mount.PlayerConditionID); if (playerCondition != null && !ConditionManager.IsPlayerMeetingCondition(player, playerCondition)) { return(false); } } if (!learned) { if (!factionMount) { SendSingleMountUpdate(spellId, flags); } if (!player.HasSpell(spellId)) { player.LearnSpell(spellId, true); } } return(true); }
void SendSingleMountUpdate(uint spellId, MountStatusFlags mountStatusFlags) { Player player = _owner.GetPlayer(); if (!player) { return; } AccountMountUpdate mountUpdate = new AccountMountUpdate(); mountUpdate.IsFullUpdate = false; mountUpdate.Mounts.Add(spellId, mountStatusFlags); player.SendPacket(mountUpdate); }
public void LoadAccountMounts(SQLResult result) { if (result.IsEmpty()) { return; } do { uint mountSpellId = result.Read <uint>(0); MountStatusFlags flags = (MountStatusFlags)result.Read <byte>(1); if (Global.DB2Mgr.GetMount(mountSpellId) == null) { continue; } _mounts[mountSpellId] = flags; } while (result.NextRow()); }