Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
0
        public QuestCache(DataStore ds, int id)
        {
            QuestID                    = ds.GetInt();
            QuestType                  = ds.GetInt();
            QuestPackageID             = ds.GetInt();
            ContentTuningID            = ds.GetInt();
            QuestSortID                = ds.GetInt();
            QuestInfoID                = ds.GetInt();
            SuggestedGroupNum          = ds.GetInt();
            RewardNextQuest            = ds.GetInt();
            RewardXPDifficulty         = ds.GetInt();
            RewardXPMultiplier         = ds.GetFloat();
            RewardMoney                = ds.GetInt();
            RewardMoneyDifficulty      = ds.GetInt();
            RewardMoneyMultiplier      = ds.GetFloat();
            RewardBonusMoney           = ds.GetInt();
            NumRewardDisplaySpells     = ds.GetInt();
            RewardSpell                = ds.GetInt();
            RewardHonorAddition        = ds.GetInt();
            RewardHonorMultiplier      = ds.GetFloat();
            RewardArtifactXPDifficulty = ds.GetInt();
            RewardArtifactXPMultiplier = ds.GetFloat();
            RewardArtifactCategoryID   = ds.GetInt();
            ProvidedItem               = ds.GetInt();
            Flags    = new uint[3];
            Flags[0] = ds.GetUInt();
            Flags[1] = ds.GetUInt();
            Flags[2] = ds.GetUInt();

            RewardFixedItemID          = new int[4];
            RewardFixedItemQuantity    = new int[4];
            RewardFixedItemID[0]       = ds.GetInt();
            RewardFixedItemQuantity[0] = ds.GetInt();
            RewardFixedItemID[1]       = ds.GetInt();
            RewardFixedItemQuantity[1] = ds.GetInt();
            RewardFixedItemID[2]       = ds.GetInt();
            RewardFixedItemQuantity[2] = ds.GetInt();
            RewardFixedItemID[3]       = ds.GetInt();
            RewardFixedItemQuantity[3] = ds.GetInt();

            ItemDropID          = new int[4];
            ItemDropQuantity    = new int[4];
            ItemDropID[0]       = ds.GetInt();
            ItemDropQuantity[0] = ds.GetInt();
            ItemDropID[1]       = ds.GetInt();
            ItemDropQuantity[1] = ds.GetInt();
            ItemDropID[2]       = ds.GetInt();
            ItemDropQuantity[2] = ds.GetInt();
            ItemDropID[3]       = ds.GetInt();
            ItemDropQuantity[3] = ds.GetInt();

            RewardChoiceItemID           = new int[6];
            RewardChoiceItemQuantity     = new int[6];
            RewardChoiceItemDisplayID    = new int[6];
            RewardChoiceItemID[0]        = ds.GetInt();
            RewardChoiceItemQuantity[0]  = ds.GetInt();
            RewardChoiceItemDisplayID[0] = ds.GetInt();
            RewardChoiceItemID[1]        = ds.GetInt();
            RewardChoiceItemQuantity[1]  = ds.GetInt();
            RewardChoiceItemDisplayID[1] = ds.GetInt();
            RewardChoiceItemID[2]        = ds.GetInt();
            RewardChoiceItemQuantity[2]  = ds.GetInt();
            RewardChoiceItemDisplayID[2] = ds.GetInt();
            RewardChoiceItemID[3]        = ds.GetInt();
            RewardChoiceItemQuantity[3]  = ds.GetInt();
            RewardChoiceItemDisplayID[3] = ds.GetInt();
            RewardChoiceItemID[4]        = ds.GetInt();
            RewardChoiceItemQuantity[4]  = ds.GetInt();
            RewardChoiceItemDisplayID[4] = ds.GetInt();
            RewardChoiceItemID[5]        = ds.GetInt();
            RewardChoiceItemQuantity[5]  = ds.GetInt();
            RewardChoiceItemDisplayID[5] = ds.GetInt();

            POIContinent = ds.GetInt();
            POIx         = ds.GetFloat();
            POIy         = ds.GetFloat();
            POIPriority  = ds.GetInt();
            RewardTitle  = ds.GetInt();
            //RewardTalents = ds.GetInt();
            RewardTalents               = -1;
            RewardArenaPoints           = ds.GetInt();
            RewardSkillLineID           = ds.GetInt();
            RewardNumSkillUps           = ds.GetInt();
            PortraitGiverDisplayID      = ds.GetInt();
            PortraitGiverMountDisplayID = ds.GetInt();
            PortraitTurnInDisplayID     = ds.GetInt();
            PortraitModelSceneID        = ds.GetInt();

            RewardFactionID             = new int[5];
            RewardFactionValue          = new int[5];
            RewardFactionOverride       = new int[5];
            RewardFactionGainMaxRank    = new int[5];
            RewardFactionID[0]          = ds.GetInt();
            RewardFactionValue[0]       = ds.GetInt();
            RewardFactionOverride[0]    = ds.GetInt();
            RewardFactionGainMaxRank[0] = ds.GetInt();
            RewardFactionID[1]          = ds.GetInt();
            RewardFactionValue[1]       = ds.GetInt();
            RewardFactionOverride[1]    = ds.GetInt();
            RewardFactionGainMaxRank[1] = ds.GetInt();
            RewardFactionID[2]          = ds.GetInt();
            RewardFactionValue[2]       = ds.GetInt();
            RewardFactionOverride[2]    = ds.GetInt();
            RewardFactionGainMaxRank[2] = ds.GetInt();
            RewardFactionID[3]          = ds.GetInt();
            RewardFactionValue[3]       = ds.GetInt();
            RewardFactionOverride[3]    = ds.GetInt();
            RewardFactionGainMaxRank[3] = ds.GetInt();
            RewardFactionID[4]          = ds.GetInt();
            RewardFactionValue[4]       = ds.GetInt();
            RewardFactionOverride[4]    = ds.GetInt();
            RewardFactionGainMaxRank[4] = ds.GetInt();

            RewardFactionFlags = ds.GetUInt();

            RewardCurrencyID          = new int[4];
            RewardCurrencyQuantity    = new int[4];
            RewardCurrencyID[0]       = ds.GetInt();
            RewardCurrencyQuantity[0] = ds.GetInt();
            RewardCurrencyID[1]       = ds.GetInt();
            RewardCurrencyQuantity[1] = ds.GetInt();
            RewardCurrencyID[2]       = ds.GetInt();
            RewardCurrencyQuantity[2] = ds.GetInt();
            RewardCurrencyID[3]       = ds.GetInt();
            RewardCurrencyQuantity[3] = ds.GetInt();

            AcceptedSoundKitID  = ds.GetInt();
            CompleteSoundKitID  = ds.GetInt();
            AreaGroupID         = ds.GetInt();
            TimeAllowed         = ds.GetInt();
            NumObjectives       = ds.GetInt();
            RaceFlags           = ds.GetUInt64();
            QuestRewardID       = ds.GetUInt();
            ExpansionID         = ds.GetInt();
            ManagedWorldStateID = ds.GetInt();
            QuestSessionBonus   = ds.GetInt();

            Int_44649 = ds.GetInt();
            NumConditionalFullTexts        = ds.GetInt();
            NumConditionalCompletionBlurbs = ds.GetInt();

            RewardDisplaySpells = new List <RewardDisplaySpell>();
            for (var i = 0; i < NumRewardDisplaySpells; ++i)
            {
                RewardDisplaySpell rds = new RewardDisplaySpell();
                rds.RewardDisplaySpellID           = ds.GetInt();
                rds.RewardDisplayPlayerConditionID = ds.GetInt();
                RewardDisplaySpells.Add(rds);
            }

            // String sizes
            var titleLength              = ds.GetIntByBits(9);
            var summaryLength            = ds.GetIntByBits(12);
            var fullTextLength           = ds.GetIntByBits(12);
            var trackerTextLength        = ds.GetIntByBits(9);
            var portraitGiverTextLength  = ds.GetIntByBits(10);
            var portraitGiverNameLength  = ds.GetIntByBits(8);
            var portraitTurnInTextLength = ds.GetIntByBits(10);
            var portraitTurnInNameLength = ds.GetIntByBits(8);
            var completionBlurbLength    = ds.GetIntByBits(11);

            Bool_44649 = ds.GetBool();
            ds.Flush(); // Reset bit position and advance stream position to next byte

            // Populate quest objectives
            Objectives = new List <QuestObjective>();
            for (var i = 0; i < NumObjectives; ++i)
            {
                QuestObjective obj = new QuestObjective();
                obj.QuestID       = QuestID; // Just for convenience
                obj.ID            = ds.GetInt();
                obj.Type          = ds.GetByte();
                obj.StorageIndex  = (sbyte)ds.GetByte();
                obj.AssetID       = ds.GetInt();
                obj.Amount        = ds.GetInt();
                obj.Flags         = new uint[2];
                obj.Flags[0]      = ds.GetUInt();
                obj.Flags[1]      = ds.GetUInt();
                obj.PercentAmount = ds.GetFloat();

                // You may not want to use this visual effects data, since lists aren't very SQL-compatible and we use this information for literally nothing at the moment.
                obj.NumVisualEffects = ds.GetInt();
                obj.VisualEffects    = new List <int>();
                for (var j = 0; j < obj.NumVisualEffects; ++j)
                {
                    obj.VisualEffects.Add(ds.GetInt());
                }

                byte DescriptionLength = ds.GetByte();
                obj.Description = ds.GetString(DescriptionLength);
                Objectives.Add(obj);
            }

            // Strings
            Title              = ds.GetString(titleLength);
            Summary            = ds.GetString(summaryLength);
            FullText           = ds.GetString(fullTextLength);
            TrackerText        = ds.GetString(trackerTextLength);
            PortraitGiverText  = ds.GetString(portraitGiverTextLength);
            PortraitGiverName  = ds.GetString(portraitGiverNameLength);
            PortraitTurnInText = ds.GetString(portraitTurnInTextLength);
            PortraitTurnInName = ds.GetString(portraitTurnInNameLength);
            CompletionBlurb    = ds.GetString(completionBlurbLength);

            // Conditional Text Blocks
            ConditionalFullTexts = new List <ConditionalText>();
            for (var i = 0; i < NumConditionalFullTexts; ++i)
            {
                ConditionalText condText = new ConditionalText();
                condText.PlayerConditionID = ds.GetInt();
                condText.Int_44649         = ds.GetInt();
                var textLength = ds.GetIntByBits(12);
                ds.Flush(); // Reset bit position and advance stream position to next byte
                condText.Text = ds.GetString(textLength);
                ConditionalFullTexts.Add(condText);
            }
            ConditionalCompletionBlurbs = new List <ConditionalText>();
            for (var i = 0; i < NumConditionalCompletionBlurbs; ++i)
            {
                ConditionalText condText = new ConditionalText();
                condText.PlayerConditionID = ds.GetInt();
                condText.Int_44649         = ds.GetInt();
                var textLength = ds.GetIntByBits(12);
                ds.Flush(); // Reset bit position and advance stream position to next byte
                condText.Text = ds.GetString(textLength);
                ConditionalCompletionBlurbs.Add(condText);
            }
        }