Beispiel #1
0
        private static CodeBlock GetCodeBlock(string code)
        {
            CodeBlock cb;

            code = code.RemoveRedundantWhitespace();

            if (code.StartsWith("@"))
            {
                cb = new Directive(code.Substring(1));
            }
            else if (code.Contains("AppendParagraph") || code.Contains("AppendRow"))
            {
                // TODO: match whole words only.
                cb = new Appender(code);
            }
            else if (code.Replace(" ", String.Empty).StartsWith("if(") &&
                     code.GetCurlyBracketLevelIncrement() > 0)
            {
                cb = new ConditionalText(code);
            }
            else
            {
                cb = new CodeBlock(code);
            }

            return(cb);
        }
Beispiel #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);
            }
        }
        public override void parseBlocks(string input)
        {
            DelimiterText   = getInternalBlockText(DELIMITER, input);
            ParameterText   = getInternalBlockText(PARAMETERS, input);
            ConditionalText = getInternalBlockText(CONDITIONALS, input);
            CreationText    = getInternalBlockText(TEXT, input);

            //Parse Delimiter
            Delimiter = new String[] { ProgramNode.loadString(DelimiterText) };
            //Parse Parameter Text
            VarList = ParameterText.Split(ProgramNode.NEWLINE, StringSplitOptions.RemoveEmptyEntries).Select(x => ProgramNode.loadString(x)).ToList();

            var cSplit = ConditionalText.Split(ProgramNode.NEWLINE, StringSplitOptions.RemoveEmptyEntries).Select(x => ProgramNode.loadString(x)).ToList();

            Conditionals = new List <Conditional>();

            Conditional workingConditional = new Conditional();

            foreach (String line in cSplit)
            {
                if (workingConditional.varName.Length == 0)
                {
                    //Set the varname to the first line
                    workingConditional.varName = line;
                    continue;
                }
                else if (line.Contains(NEXT))
                {
                    //This is a NEXT Statement, to advance the variable
                    Conditionals.Add(workingConditional);
                    workingConditional = new Conditional();
                    continue;
                }
                else
                {
                    //The format of the line:
                    //VAR_LOOKUP | CONDITION | VAR_VALUE
                    String[] cLineSplit = line.Split(ProgramNode.BAR, StringSplitOptions.RemoveEmptyEntries);
                    if (cLineSplit.Length >= 2)
                    {
                        //Size 2 is allowed, because text can be blank
                        if (VarList.Contains(cLineSplit[0]))
                        {
                            workingConditional.varLookups.Add(VarList.IndexOf(cLineSplit[0]));
                        }
                        else
                        {
                            //Attempt to parse this as an integer
                            workingConditional.varLookups.Add(ProgramNode.loadInt(cLineSplit[0]));
                        }

                        //Attept to load condition

                        Condition c = Condition.loadCondition(cLineSplit[1]);
                        workingConditional.conditions.Add(c);

                        String result = "";
                        if (cLineSplit.Length >= 3)
                        {
                            result = ProgramNode.loadString(cLineSplit[2]);
                        }
                        workingConditional.values.Add(result);
                    }
                }
            }
        }