Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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());
        }