Beispiel #1
0
        public bool LoadFromDB(SQLFields fields)
        {
            Id          = fields.Read <uint>(0);
            auctioneer  = fields.Read <ulong>(1);
            itemGUIDLow = fields.Read <ulong>(2);
            itemEntry   = fields.Read <uint>(3);
            itemCount   = fields.Read <uint>(4);
            owner       = fields.Read <ulong>(5);
            buyout      = fields.Read <ulong>(6);
            expire_time = fields.Read <uint>(7);
            bidder      = fields.Read <ulong>(8);
            bid         = fields.Read <ulong>(9);
            startbid    = fields.Read <ulong>(10);
            deposit     = fields.Read <ulong>(11);

            CreatureData auctioneerData = Global.ObjectMgr.GetCreatureData(auctioneer);

            if (auctioneerData == null)
            {
                Log.outError(LogFilter.Server, "Auction {0} has not a existing auctioneer (GUID : {1})", Id, auctioneer);
                return(false);
            }

            CreatureTemplate auctioneerInfo = Global.ObjectMgr.GetCreatureTemplate(auctioneerData.id);

            if (auctioneerInfo == null)
            {
                Log.outError(LogFilter.Server, "Auction {0} has not a existing auctioneer (GUID : {1} Entry: {2})", Id, auctioneer, auctioneerData.id);
                return(false);
            }

            factionTemplateId = auctioneerInfo.Faction;
            auctionHouseEntry = Global.AuctionMgr.GetAuctionHouseEntry(factionTemplateId, ref houseId);
            if (auctionHouseEntry == null)
            {
                Log.outError(LogFilter.Server, "Auction {0} has auctioneer (GUID : {1} Entry: {2}) with wrong faction {3}", Id, auctioneer, auctioneerData.id, factionTemplateId);
                return(false);
            }

            // check if sold item exists for guid
            // and itemEntry in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr.LoadAuctionItems)
            if (!Global.AuctionMgr.GetAItem(itemGUIDLow))
            {
                Log.outError(LogFilter.Server, "Auction {0} has not a existing item : {1}", Id, itemGUIDLow);
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        public override void LoadFromDB(SQLFields fields)
        {
            byte idx = 0;

            _id                  = fields.Read <uint>(idx);
            _playerGuid          = ObjectGuid.Create(HighGuid.Player, fields.Read <ulong>(++idx));
            _note                = fields.Read <string>(++idx);
            _createTime          = fields.Read <ulong>(++idx);
            _mapId               = fields.Read <ushort>(++idx);
            _pos                 = new Vector3(fields.Read <float>(++idx), fields.Read <float>(++idx), fields.Read <float>(++idx));
            _facing              = fields.Read <float>(++idx);
            _targetCharacterGuid = ObjectGuid.Create(HighGuid.Player, fields.Read <ulong>(++idx));
            _complaintType       = (GMSupportComplaintType)fields.Read <byte>(++idx);
            int reportLineIndex = fields.Read <int>(++idx);

            if (reportLineIndex != -1)
            {
                _chatLog.ReportLineIndex.Set((uint)reportLineIndex);
            }

            long closedBy = fields.Read <long>(++idx);

            if (closedBy == 0)
            {
                _closedBy = ObjectGuid.Empty;
            }
            else if (closedBy < 0)
            {
                _closedBy.SetRawValue(0, (ulong)closedBy);
            }
            else
            {
                _closedBy = ObjectGuid.Create(HighGuid.Player, (ulong)closedBy);
            }

            ulong assignedTo = fields.Read <ulong>(++idx);

            if (assignedTo == 0)
            {
                _assignedTo = ObjectGuid.Empty;
            }
            else
            {
                _assignedTo = ObjectGuid.Create(HighGuid.Player, assignedTo);
            }

            _comment = fields.Read <string>(++idx);
        }
Beispiel #3
0
        public bool LoadCorpseFromDB(ulong guid, SQLFields field)
        {
            //        0     1     2     3            4      5          6          7       8       9      10        11    12          13          14
            // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ? AND instanceId = ?

            float  posX  = field.Read <float>(0);
            float  posY  = field.Read <float>(1);
            float  posZ  = field.Read <float>(2);
            float  o     = field.Read <float>(3);
            ushort mapId = field.Read <ushort>(4);

            _Create(ObjectGuid.Create(HighGuid.Corpse, mapId, 0, guid));

            SetObjectScale(1.0f);
            SetUInt32Value(CorpseFields.DisplayId, field.Read <uint>(5));
            _LoadIntoDataField(field.Read <string>(6), (int)CorpseFields.Item, EquipmentSlot.End);
            SetUInt32Value(CorpseFields.Bytes1, field.Read <uint>(7));
            SetUInt32Value(CorpseFields.Bytes2, field.Read <uint>(8));
            SetUInt32Value(CorpseFields.Flags, field.Read <byte>(9));
            SetUInt32Value(CorpseFields.DynamicFlags, field.Read <byte>(10));
            SetGuidValue(CorpseFields.Owner, ObjectGuid.Create(HighGuid.Player, field.Read <ulong>(14)));
            CharacterInfo characterInfo = Global.WorldMgr.GetCharacterInfo(GetGuidValue(CorpseFields.Owner));

            if (characterInfo != null)
            {
                SetUInt32Value(CorpseFields.FactionTemplate, CliDB.ChrRacesStorage.LookupByKey(characterInfo.RaceID).FactionID);
            }

            m_time = field.Read <uint>(11);

            uint instanceId = field.Read <uint>(13);

            // place
            SetLocationInstanceId(instanceId);
            SetMapId(mapId);
            Relocate(posX, posY, posZ, o);

            if (!IsPositionValid())
            {
                Log.outError(LogFilter.Player, "Corpse ({0}, owner: {1}) is not created, given coordinates are not valid (X: {2}, Y: {3}, Z: {4})",
                             GetGUID().ToString(), GetOwnerGUID().ToString(), posX, posY, posZ);
                return(false);
            }

            _cellCoord = GridDefines.ComputeCellCoord(GetPositionX(), GetPositionY());
            return(true);
        }
Beispiel #4
0
        public void LoadQuestObjective(SQLFields fields)
        {
            QuestObjective obj = new QuestObjective();

            obj.ID                = fields.Read <uint>(0);
            obj.QuestID           = fields.Read <uint>(1);
            obj.Type              = (QuestObjectiveType)fields.Read <byte>(2);
            obj.StorageIndex      = fields.Read <sbyte>(3);
            obj.ObjectID          = fields.Read <int>(4);
            obj.Amount            = fields.Read <int>(5);
            obj.Flags             = (QuestObjectiveFlags)fields.Read <uint>(6);
            obj.Flags2            = fields.Read <uint>(7);
            obj.ProgressBarWeight = fields.Read <float>(8);
            obj.Description       = fields.Read <string>(9);

            Objectives.Add(obj);
        }
Beispiel #5
0
        public bool LoadFromFieldList(SQLFields fields)
        {
            // Loads an AuctionEntry item from a field list. Unlike "LoadFromDB()", this one
            //  does not require the AuctionEntryMap to have been loaded with items. It simply
            //  acts as a wrapper to fill out an AuctionEntry struct from a field list

            Id          = fields.Read <uint>(0);
            auctioneer  = fields.Read <uint>(1);
            itemGUIDLow = fields.Read <uint>(2);
            itemEntry   = fields.Read <uint>(3);
            itemCount   = fields.Read <uint>(4);
            owner       = fields.Read <uint>(5);
            buyout      = fields.Read <uint>(6);
            expire_time = fields.Read <uint>(7);
            bidder      = fields.Read <uint>(8);
            bid         = fields.Read <uint>(9);
            startbid    = fields.Read <uint>(10);
            deposit     = fields.Read <uint>(11);

            CreatureData auctioneerData = Global.ObjectMgr.GetCreatureData(auctioneer);

            if (auctioneerData == null)
            {
                Log.outError(LogFilter.Server, "AuctionEntry:LoadFromFieldList() - Auction {0} has not a existing auctioneer (GUID : {1})", Id, auctioneer);
                return(false);
            }

            CreatureTemplate auctioneerInfo = Global.ObjectMgr.GetCreatureTemplate(auctioneerData.id);

            if (auctioneerInfo == null)
            {
                Log.outError(LogFilter.Server, "AuctionEntry:LoadFromFieldList() - Auction {0} has not a existing auctioneer (GUID : {1} Entry: {2})", Id, auctioneer, auctioneerData.id);
                return(false);
            }

            factionTemplateId = auctioneerInfo.Faction;
            auctionHouseEntry = Global.AuctionMgr.GetAuctionHouseEntry(factionTemplateId);

            if (auctionHouseEntry == null)
            {
                Log.outError(LogFilter.Server, "AuctionEntry:LoadFromFieldList() - Auction {0} has auctioneer (GUID : {1} Entry: {2}) with wrong faction {3}", Id, auctioneer, auctioneerData.id, factionTemplateId);
                return(false);
            }

            return(true);
        }
Beispiel #6
0
        public bool LoadFromDB(SQLFields fields)
        {
            MarketID    = fields.Read <uint>(0);
            SellerNPC   = fields.Read <uint>(1);
            Item        = new ItemInstance();
            Item.ItemID = fields.Read <uint>(2);
            Quantity    = fields.Read <uint>(3);
            MinBid      = fields.Read <ulong>(4);
            Duration    = fields.Read <uint>(5);
            Chance      = fields.Read <float>(6);

            var         bonusListIDsTok = new StringArray(fields.Read <string>(7), ' ');
            List <uint> bonusListIDs    = new();

            if (!bonusListIDsTok.IsEmpty())
            {
                foreach (string token in bonusListIDsTok)
                {
                    if (uint.TryParse(token, out uint id))
                    {
                        bonusListIDs.Add(id);
                    }
                }
            }

            if (!bonusListIDs.Empty())
            {
                Item.ItemBonus.HasValue           = true;
                Item.ItemBonus.Value.BonusListIDs = bonusListIDs;
            }

            if (Global.ObjectMgr.GetCreatureTemplate(SellerNPC) == null)
            {
                Log.outError(LogFilter.Misc, "Black market template {0} does not have a valid seller. (Entry: {1})", MarketID, SellerNPC);
                return(false);
            }

            if (Global.ObjectMgr.GetItemTemplate(Item.ItemID) == null)
            {
                Log.outError(LogFilter.Misc, "Black market template {0} does not have a valid item. (Entry: {1})", MarketID, Item.ItemID);
                return(false);
            }

            return(true);
        }
Beispiel #7
0
        public override bool LoadFromDB(ulong guid, ObjectGuid owner_guid, SQLFields fields, uint entry)
        {
            if (!base.LoadFromDB(guid, owner_guid, fields, entry))
            {
                return(false);
            }

            ItemTemplate itemProto = GetTemplate(); // checked in Item.LoadFromDB

            SetBagSize(itemProto.GetContainerSlots());
            // cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
            for (byte i = 0; i < ItemConst.MaxBagSize; ++i)
            {
                SetSlot(i, ObjectGuid.Empty);
                m_bagslot[i] = null;
            }
            return(true);
        }
Beispiel #8
0
        public void LoadQuestDetails(SQLFields fields)
        {
            for (int i = 0; i < SharedConst.QuestEmoteCount; ++i)
            {
                ushort emoteId = fields.Read <ushort>(1 + i);
                if (!CliDB.EmotesStorage.ContainsKey(emoteId))
                {
                    Log.outError(LogFilter.Sql, "Table `quest_details` has non-existing Emote{0} ({1}) set for quest {2}. Skipped.", 1 + i, emoteId, fields.Read <uint>(0));
                    continue;
                }
                DetailsEmote[i] = emoteId;
            }

            for (int i = 0; i < SharedConst.QuestEmoteCount; ++i)
            {
                DetailsEmoteDelay[i] = fields.Read <uint>(5 + i);
            }
        }
Beispiel #9
0
        public void LoadRewardDisplaySpell(SQLFields fields)
        {
            uint spellId           = fields.Read <uint>(1);
            uint playerConditionId = fields.Read <uint>(2);

            if (!Global.SpellMgr.HasSpellInfo(spellId, Difficulty.None))
            {
                Log.outError(LogFilter.Sql, $"Table `quest_reward_display_spell` has non-existing Spell ({spellId}) set for quest {Id}. Skipped.");
                return;
            }

            if (playerConditionId != 0 && !CliDB.PlayerConditionStorage.ContainsKey(playerConditionId))
            {
                Log.outError(LogFilter.Sql, $"Table `quest_reward_display_spell` has non-existing PlayerCondition ({spellId}) set for quest {Id}. Set to 0.");
                playerConditionId = 0;
            }

            RewardDisplaySpell.Add(new QuestRewardDisplaySpell(spellId, playerConditionId));
        }
Beispiel #10
0
        public void LoadQuestRequestItems(SQLFields fields)
        {
            EmoteOnComplete   = fields.Read <ushort>(1);
            EmoteOnIncomplete = fields.Read <ushort>(2);

            if (!CliDB.EmotesStorage.ContainsKey(EmoteOnComplete))
            {
                Log.outError(LogFilter.Sql, "Table `quest_request_items` has non-existing EmoteOnComplete ({0}) set for quest {1}.", EmoteOnComplete, fields.Read <uint>(0));
            }

            if (!CliDB.EmotesStorage.ContainsKey(EmoteOnIncomplete))
            {
                Log.outError(LogFilter.Sql, "Table `quest_request_items` has non-existing EmoteOnIncomplete ({0}) set for quest {1}.", EmoteOnIncomplete, fields.Read <uint>(0));
            }

            EmoteOnCompleteDelay   = fields.Read <uint>(3);
            EmoteOnIncompleteDelay = fields.Read <uint>(4);
            RequestItemsText       = fields.Read <string>(5);
        }
Beispiel #11
0
        public void LoadResult(SQLFields fields, int startColumn)
        {
            Id                   = fields.Read <uint>(startColumn + 0);
            Name                 = fields.Read <string>(startColumn + 1);
            IsBanned             = fields.Read <ulong>(startColumn + 2) != 0;
            IsPermanenetlyBanned = fields.Read <ulong>(startColumn + 3) != 0;
            SecurityLevel        = (AccountTypes)fields.Read <byte>(startColumn + 4);

            int hashPos = Name.IndexOf('#');

            if (hashPos != -1)
            {
                DisplayName = "WoW" + Name.Substring(hashPos + 1);
            }
            else
            {
                DisplayName = Name;
            }
        }
Beispiel #12
0
        public override void LoadFromDB(SQLFields fields)
        {
            byte idx = 0;

            _id         = fields.Read <uint>(idx);
            _playerGuid = ObjectGuid.Create(HighGuid.Player, fields.Read <ulong>(++idx));
            _note       = fields.Read <string>(++idx);
            _createTime = fields.Read <ulong>(++idx);
            _mapId      = fields.Read <ushort>(++idx);
            _pos        = new Vector3(fields.Read <float>(++idx), fields.Read <float>(++idx), fields.Read <float>(++idx));
            _facing     = fields.Read <float>(++idx);

            long closedBy = fields.Read <long>(++idx);

            if (closedBy == 0)
            {
                _closedBy = ObjectGuid.Empty;
            }
            else if (closedBy < 0)
            {
                _closedBy.SetRawValue(0, (ulong)closedBy);
            }
            else
            {
                _closedBy = ObjectGuid.Create(HighGuid.Player, (ulong)closedBy);
            }

            ulong assignedTo = fields.Read <ulong>(++idx);

            if (assignedTo == 0)
            {
                _assignedTo = ObjectGuid.Empty;
            }
            else
            {
                _assignedTo = ObjectGuid.Create(HighGuid.Player, assignedTo);
            }

            _comment = fields.Read <string>(++idx);
        }
Beispiel #13
0
        public GameAccountInfo(SQLFields fields, int startColumn)
        {
            Id                   = fields.Read <uint>(startColumn + 0);
            Name                 = fields.Read <string>(startColumn + 1);
            UnbanDate            = fields.Read <uint>(startColumn + 2);
            IsPermanenetlyBanned = fields.Read <uint>(startColumn + 3) != 0;
            IsBanned             = IsPermanenetlyBanned || UnbanDate > Time.UnixTime;
            SecurityLevel        = (AccountTypes)fields.Read <byte>(startColumn + 4);

            int hashPos = Name.IndexOf('#');

            if (hashPos != -1)
            {
                DisplayName = "WoW" + Name.Substring(hashPos + 1);
            }
            else
            {
                DisplayName = Name;
            }

            CharacterCounts      = new Dictionary <uint, byte>();
            LastPlayedCharacters = new Dictionary <string, LastPlayedCharacterInfo>();
        }
Beispiel #14
0
        public AccountInfo(SQLFields fields)
        {
            //         0             1           2          3                4            5           6          7            8      9     10          11
            // SELECT a.id, a.sessionkey, ba.last_ip, ba.locked, ba.lock_country, a.expansion, a.mutetime, ba.locale, a.recruiter, a.os, ba.id, aa.gmLevel,
            //                                                              12                                                            13    14
            // bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, r.id
            // FROM account a LEFT JOIN battlenet_accounts ba ON a.battlenet_account = ba.id LEFT JOIN account_access aa ON a.id = aa.id AND aa.RealmID IN (-1, ?)
            // LEFT JOIN battlenet_account_bans bab ON ba.id = bab.id LEFT JOIN account_banned ab ON a.id = ab.id LEFT JOIN account r ON a.id = r.recruiter
            // WHERE a.username = ? ORDER BY aa.RealmID DESC LIMIT 1
            game.Id                = fields.Read <uint>(0);
            game.SessionKey        = fields.Read <string>(1).ToByteArray();
            battleNet.LastIP       = fields.Read <string>(2);
            battleNet.IsLockedToIP = fields.Read <bool>(3);
            battleNet.LockCountry  = fields.Read <string>(4);
            game.Expansion         = fields.Read <byte>(5);
            game.MuteTime          = fields.Read <long>(6);
            battleNet.Locale       = (LocaleConstant)fields.Read <byte>(7);
            game.Recruiter         = fields.Read <uint>(8);
            game.OS                = fields.Read <string>(9);
            battleNet.Id           = fields.Read <uint>(10);
            game.Security          = (AccountTypes)fields.Read <byte>(11);
            battleNet.IsBanned     = fields.Read <ulong>(12) != 0;
            game.IsBanned          = fields.Read <ulong>(13) != 0;
            game.IsRectuiter       = fields.Read <uint>(14) != 0;

            uint world_expansion = WorldConfig.GetUIntValue(WorldCfg.Expansion);

            if (game.Expansion > world_expansion)
            {
                game.Expansion = (byte)world_expansion;
            }

            if (battleNet.Locale >= LocaleConstant.Total)
            {
                battleNet.Locale = LocaleConstant.enUS;
            }
        }
Beispiel #15
0
        public void LoadQuestObjectiveVisualEffect(SQLFields fields)
        {
            uint objID = fields.Read <uint>(1);

            foreach (QuestObjective obj in Objectives)
            {
                if (obj.ID == objID)
                {
                    byte effectIndex = fields.Read <byte>(3);
                    if (obj.VisualEffects == null)
                    {
                        obj.VisualEffects = new int[effectIndex + 1];
                    }

                    if (effectIndex >= obj.VisualEffects.Length)
                    {
                        Array.Resize(ref obj.VisualEffects, effectIndex + 1);
                    }

                    obj.VisualEffects[effectIndex] = fields.Read <int>(4);
                    break;
                }
            }
        }
            public CharacterInfo(SQLFields fields)
            {
                //         0                1                2                3                 4                  5                6                7
                // "SELECT characters.guid, characters.name, characters.race, characters.class, characters.gender, characters.skin, characters.face, characters.hairStyle, "
                //  8                     9                       10                         11                         12                         13
                // "characters.hairColor, characters.facialStyle, characters.customDisplay1, characters.customDisplay2, characters.customDisplay3, characters.level, "
                //  14               15              16                     17                     18
                // "characters.zone, characters.map, characters.position_x, characters.position_y, characters.position_z, "
                //  19                    20                      21                   22                   23                     24                   25
                // "guild_member.guildid, characters.playerFlags, characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.equipmentCache, "
                //  26                     27               28                      29                            30                         31
                // "character_banned.guid, characters.slot, characters.logout_time, characters.activeTalentGroup, characters.lastLoginBuild, character_declinedname.genitive"

                Guid             = ObjectGuid.Create(HighGuid.Player, fields.Read <ulong>(0));
                Name             = fields.Read <string>(1);
                RaceId           = fields.Read <byte>(2);
                ClassId          = (Class)fields.Read <byte>(3);
                SexId            = fields.Read <byte>(4);
                SkinId           = fields.Read <byte>(5);
                FaceId           = fields.Read <byte>(6);
                HairStyle        = fields.Read <byte>(7);
                HairColor        = fields.Read <byte>(8);
                FacialHair       = fields.Read <byte>(9);
                CustomDisplay[0] = fields.Read <byte>(10);
                CustomDisplay[1] = fields.Read <byte>(11);
                CustomDisplay[2] = fields.Read <byte>(12);
                ExperienceLevel  = fields.Read <byte>(13);
                ZoneId           = fields.Read <uint>(14);
                MapId            = fields.Read <uint>(15);
                PreloadPos       = new Vector3(fields.Read <float>(16), fields.Read <float>(17), fields.Read <float>(18));

                ulong guildId = fields.Read <ulong>(19);

                if (guildId != 0)
                {
                    GuildGuid = ObjectGuid.Create(HighGuid.Guild, guildId);
                }

                PlayerFlags  playerFlags  = (PlayerFlags)fields.Read <uint>(20);
                AtLoginFlags atLoginFlags = (AtLoginFlags)fields.Read <ushort>(21);

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Resurrect))
                {
                    playerFlags &= ~PlayerFlags.Ghost;
                }

                if (playerFlags.HasAnyFlag(PlayerFlags.Ghost))
                {
                    Flags |= CharacterFlags.Ghost;
                }

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Rename))
                {
                    Flags |= CharacterFlags.Rename;
                }

                if (fields.Read <uint>(26) != 0)
                {
                    Flags |= CharacterFlags.LockedByBilling;
                }

                if (WorldConfig.GetBoolValue(WorldCfg.DeclinedNamesUsed) && !string.IsNullOrEmpty(fields.Read <string>(31)))
                {
                    Flags |= CharacterFlags.Declined;
                }

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Customize))
                {
                    Flags2 = CharacterCustomizeFlags.Customize;
                }
                else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeFaction))
                {
                    Flags2 = CharacterCustomizeFlags.Faction;
                }
                else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeRace))
                {
                    Flags2 = CharacterCustomizeFlags.Race;
                }

                Flags3     = 0;
                Flags4     = 0;
                FirstLogin = atLoginFlags.HasAnyFlag(AtLoginFlags.FirstLogin);

                // show pet at selection character in character list only for non-ghost character
                if (!playerFlags.HasAnyFlag(PlayerFlags.Ghost) && (ClassId == Class.Warlock || ClassId == Class.Hunter || ClassId == Class.Deathknight))
                {
                    CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(fields.Read <uint>(22));
                    if (creatureInfo != null)
                    {
                        PetCreatureDisplayId = fields.Read <uint>(23);
                        PetExperienceLevel   = fields.Read <ushort>(24);
                        PetCreatureFamilyId  = (uint)creatureInfo.Family;
                    }
                }

                BoostInProgress  = false;
                ProfessionIds[0] = 0;
                ProfessionIds[1] = 0;

                StringArguments equipment = new StringArguments(fields.Read <string>(25));

                ListPosition   = fields.Read <byte>(27);
                LastPlayedTime = fields.Read <uint>(28);

                var spec = Global.DB2Mgr.GetChrSpecializationByIndex(ClassId, fields.Read <byte>(29));

                if (spec != null)
                {
                    SpecID = (ushort)spec.Id;
                }

                LastLoginVersion = fields.Read <uint>(30);

                for (byte slot = 0; slot < InventorySlots.BagEnd; ++slot)
                {
                    VisualItems[slot].InvType          = (byte)equipment.NextUInt32();
                    VisualItems[slot].DisplayId        = equipment.NextUInt32();
                    VisualItems[slot].DisplayEnchantId = equipment.NextUInt32();
                    VisualItems[slot].Subclass         = (byte)equipment.NextUInt32();
                }
            }
Beispiel #17
0
        public Quest(SQLFields fields)
        {
            Id                    = fields.Read <uint>(0);
            Type                  = (QuestType)fields.Read <byte>(1);
            Level                 = fields.Read <int>(2);
            PackageID             = fields.Read <uint>(3);
            MinLevel              = fields.Read <int>(4);
            QuestSortID           = fields.Read <short>(5);
            QuestInfoID           = fields.Read <ushort>(6);
            SuggestedPlayers      = fields.Read <uint>(7);
            NextQuestInChain      = fields.Read <uint>(8);
            RewardXPDifficulty    = fields.Read <uint>(9);
            RewardXPMultiplier    = fields.Read <float>(10);
            RewardMoney           = fields.Read <int>(11);
            RewardMoneyDifficulty = fields.Read <uint>(12);
            RewardMoneyMultiplier = fields.Read <float>(13);
            RewardBonusMoney      = fields.Read <uint>(14);

            for (int i = 0; i < SharedConst.QuestRewardDisplaySpellCount; ++i)
            {
                RewardDisplaySpell[i] = fields.Read <uint>(15 + i);
            }

            RewardSpell                = fields.Read <uint>(18);
            RewardHonor                = fields.Read <uint>(19);
            RewardKillHonor            = fields.Read <uint>(20);
            SourceItemId               = fields.Read <uint>(21);
            RewardArtifactXPDifficulty = fields.Read <uint>(22);
            RewardArtifactXPMultiplier = fields.Read <float>(23);
            RewardArtifactCategoryID   = fields.Read <uint>(24);
            Flags   = (QuestFlags)fields.Read <uint>(25);
            FlagsEx = (QuestFlagsEx)fields.Read <uint>(26);

            for (int i = 0; i < SharedConst.QuestItemDropCount; ++i)
            {
                RewardItemId[i]     = fields.Read <uint>(27 + i * 4);
                RewardItemCount[i]  = fields.Read <uint>(28 + i * 4);
                ItemDrop[i]         = fields.Read <uint>(29 + i * 4);
                ItemDropQuantity[i] = fields.Read <uint>(30 + i * 4);

                if (RewardItemId[i] != 0)
                {
                    ++_rewItemsCount;
                }
            }

            for (int i = 0; i < SharedConst.QuestRewardChoicesCount; ++i)
            {
                RewardChoiceItemId[i]        = fields.Read <uint>(43 + i * 3);
                RewardChoiceItemCount[i]     = fields.Read <uint>(44 + i * 3);
                RewardChoiceItemDisplayId[i] = fields.Read <uint>(45 + i * 3);

                if (RewardChoiceItemId[i] != 0)
                {
                    ++_rewChoiceItemsCount;
                }
            }

            POIContinent = fields.Read <uint>(61);
            POIx         = fields.Read <float>(62);
            POIy         = fields.Read <float>(63);
            POIPriority  = fields.Read <uint>(64);

            RewardTitleId     = fields.Read <uint>(65);
            RewardArenaPoints = fields.Read <int>(66);
            RewardSkillId     = fields.Read <uint>(67);
            RewardSkillPoints = fields.Read <uint>(68);

            QuestGiverPortrait  = fields.Read <uint>(69);
            QuestTurnInPortrait = fields.Read <uint>(70);

            for (int i = 0; i < SharedConst.QuestRewardReputationsCount; ++i)
            {
                RewardFactionId[i]       = fields.Read <uint>(71 + i * 4);
                RewardFactionValue[i]    = fields.Read <int>(72 + i * 4);
                RewardFactionOverride[i] = fields.Read <int>(73 + i * 4);
                RewardFactionCapIn[i]    = fields.Read <uint>(74 + i * 4);
            }

            RewardReputationMask = fields.Read <uint>(91);

            for (int i = 0; i < SharedConst.QuestRewardCurrencyCount; ++i)
            {
                RewardCurrencyId[i]    = fields.Read <uint>(92 + i * 2);
                RewardCurrencyCount[i] = fields.Read <uint>(93 + i * 2);

                if (RewardCurrencyId[i] != 0)
                {
                    ++_rewCurrencyCount;
                }
            }

            SoundAccept    = fields.Read <uint>(100);
            SoundTurnIn    = fields.Read <uint>(101);
            AreaGroupID    = fields.Read <uint>(102);
            LimitTime      = fields.Read <uint>(103);
            AllowableRaces = fields.Read <int>(104);
            QuestRewardID  = fields.Read <uint>(105);
            Expansion      = fields.Read <int>(106);

            LogTitle           = fields.Read <string>(107);
            LogDescription     = fields.Read <string>(108);
            QuestDescription   = fields.Read <string>(109);
            AreaDescription    = fields.Read <string>(110);
            PortraitGiverText  = fields.Read <string>(111);
            PortraitGiverName  = fields.Read <string>(112);
            PortraitTurnInText = fields.Read <string>(113);
            PortraitTurnInName = fields.Read <string>(114);
            QuestCompletionLog = fields.Read <string>(115);
        }
            public CharacterInfo(SQLFields fields)
            {
                Guid            = ObjectGuid.Create(HighGuid.Player, fields.Read <ulong>(0));
                Name            = fields.Read <string>(1);
                RaceId          = fields.Read <byte>(2);
                ClassId         = (Class)fields.Read <byte>(3);
                SexId           = fields.Read <byte>(4);
                ExperienceLevel = fields.Read <byte>(5);
                ZoneId          = fields.Read <uint>(6);
                MapId           = fields.Read <uint>(7);
                PreloadPos      = new Vector3(fields.Read <float>(8), fields.Read <float>(9), fields.Read <float>(10));

                ulong guildId = fields.Read <ulong>(11);

                if (guildId != 0)
                {
                    GuildGuid = ObjectGuid.Create(HighGuid.Guild, guildId);
                }

                PlayerFlags  playerFlags  = (PlayerFlags)fields.Read <uint>(12);
                AtLoginFlags atLoginFlags = (AtLoginFlags)fields.Read <ushort>(13);

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Resurrect))
                {
                    playerFlags &= ~PlayerFlags.Ghost;
                }

                if (playerFlags.HasAnyFlag(PlayerFlags.Ghost))
                {
                    Flags |= CharacterFlags.Ghost;
                }

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Rename))
                {
                    Flags |= CharacterFlags.Rename;
                }

                if (fields.Read <uint>(18) != 0)
                {
                    Flags |= CharacterFlags.LockedByBilling;
                }

                if (WorldConfig.GetBoolValue(WorldCfg.DeclinedNamesUsed) && !string.IsNullOrEmpty(fields.Read <string>(23)))
                {
                    Flags |= CharacterFlags.Declined;
                }

                if (atLoginFlags.HasAnyFlag(AtLoginFlags.Customize))
                {
                    Flags2 = CharacterCustomizeFlags.Customize;
                }
                else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeFaction))
                {
                    Flags2 = CharacterCustomizeFlags.Faction;
                }
                else if (atLoginFlags.HasAnyFlag(AtLoginFlags.ChangeRace))
                {
                    Flags2 = CharacterCustomizeFlags.Race;
                }

                Flags3     = 0;
                Flags4     = 0;
                FirstLogin = atLoginFlags.HasAnyFlag(AtLoginFlags.FirstLogin);

                // show pet at selection character in character list only for non-ghost character
                if (!playerFlags.HasAnyFlag(PlayerFlags.Ghost) && (ClassId == Class.Warlock || ClassId == Class.Hunter || ClassId == Class.Deathknight))
                {
                    CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(fields.Read <uint>(14));
                    if (creatureInfo != null)
                    {
                        PetCreatureDisplayId = fields.Read <uint>(15);
                        PetExperienceLevel   = fields.Read <ushort>(16);
                        PetCreatureFamilyId  = (uint)creatureInfo.Family;
                    }
                }

                BoostInProgress  = false;
                ProfessionIds[0] = 0;
                ProfessionIds[1] = 0;

                StringArguments equipment = new(fields.Read <string>(17));

                ListPosition   = fields.Read <byte>(19);
                LastPlayedTime = fields.Read <long>(20);

                var spec = Global.DB2Mgr.GetChrSpecializationByIndex(ClassId, fields.Read <byte>(21));

                if (spec != null)
                {
                    SpecID = (ushort)spec.Id;
                }

                LastLoginVersion = fields.Read <uint>(22);

                for (byte slot = 0; slot < InventorySlots.BagEnd; ++slot)
                {
                    VisualItems[slot].InvType          = (byte)equipment.NextUInt32();
                    VisualItems[slot].DisplayId        = equipment.NextUInt32();
                    VisualItems[slot].DisplayEnchantId = equipment.NextUInt32();
                    VisualItems[slot].Subclass         = (byte)equipment.NextUInt32();
                }
            }
Beispiel #19
0
 public virtual void LoadFromDB(SQLFields fields)
 {
 }
Beispiel #20
0
 public void LoadChatLineFromDB(SQLFields fields)
 {
     _chatLog.Lines.Add(new SupportTicketSubmitComplaint.SupportTicketChatLine(fields.Read <long>(0), fields.Read <string>(1)));
 }
Beispiel #21
0
 public void LoadQuestMailSender(SQLFields fields)
 {
     RewardMailSenderEntry = fields.Read <uint>(1);
 }