Exemplo n.º 1
0
 public string GenerateQuery(TrinityQuest quest)
 {
     return(SqlQuery.GenerateInsert("quest_template", QuestTemplate(quest)) +
            SqlQuery.GenerateInsert("quest_template_addon", QuestAddon(quest)) +
            SqlQuery.GenerateInsert("creature_queststarter", QuestStarter(quest)) +
            SqlQuery.GenerateInsert("creature_questender", QuestEnder(quest)));
 }
Exemplo n.º 2
0
 public static string GenerateQuery(TrinityQuest quest)
 {
     if (quest.EntryId == 0)
     {
         throw new Exception("Please choose an entry ID.");
     }
     return(SelectedEmulator.GenerateQuery(quest));
 }
Exemplo n.º 3
0
 public string GenerateQuery(TrinityQuest quest)
 {
     return(SqlQuery.GenerateInsert("quest_template", QuestTemplate(quest)) +
            SqlQuery.GenerateInsert("creature_queststarter", QuestStarter(quest)) +
            SqlQuery.GenerateInsert("creature_questender", QuestEnder(quest)) +
            SqlQuery.GenerateInsert("quest_offer_reward", QuestOfferReward(quest)) +
            SqlQuery.GenerateInsert("quest_request_items", QuestRequestItems(quest)));
 }
Exemplo n.º 4
0
 private Dictionary <string, string> QuestEnder(TrinityQuest quest)
 {
     return(new Dictionary <string, string>
     {
         { "id", quest.QuestCompleter.ToString() },
         { "quest", quest.EntryId.ToString() },
     });
 }
Exemplo n.º 5
0
 private Dictionary <string, string> QuestRequestItems(TrinityQuest quest)
 {
     return(new Dictionary <string, string>
     {
         { "ID", quest.EntryId.ToString() },
         // Reward emotes on talking before complete or incomplete
         { "CompletionText", SqlQuery.CleanText(quest.IncompleteText) },
     });
 }
Exemplo n.º 6
0
 private Dictionary <string, string> QuestOfferReward(TrinityQuest quest)
 {
     return(new Dictionary <string, string>
     {
         { "ID", quest.EntryId.ToString() },
         // Reward emotes on complete
         { "RewardText", SqlQuery.CleanText(quest.RewardText) },
     });
 }
Exemplo n.º 7
0
        private Dictionary <string, string> QuestTemplate(TrinityQuest quest)
        {
            var kvplist = new Dictionary <string, string>
            {
                { "entry", quest.EntryId.ToString() },
                { "Method", "2" },
                { "QuestLevel", quest.QuestLevel.ToString() },
                { "MinLevel", quest.MinLevel.ToString() },
                { "ZoneOrSort", quest.PQuestSort.ToString() },
                { "Type", quest.PQuestInfo.Id.ToString() },
                { "RequiredClasses", quest.AllowableClass.BitmaskValue.ToString() },
                { "RequiredRaces", quest.AllowableRace.BitmaskValue.ToString() },
                { "SuggestedPlayers", quest.SuggestedGroupNum.ToString() },
                { "LimitTime", quest.TimeAllowed.ToString() },
                //{"RewardXPDifficulty", quest.RewardXpDifficulty.Id.ToString()},
                { "RewOrReqMoney", quest.RewardMoney.Amount.ToString() },
                { "RewSpellCast", quest.RewardSpell.ToString() },
                //{"RewardHonor", quest.RewardHonor.ToString()},
                //{"RewardTalents", quest.RewardTalents.ToString()},
                { "SrcItemId", quest.StartItem.ToString() },
                { "SrcItemCount", quest.ProvidedItemCount.ToString() },
                { "SrcSpell", quest.SourceSpell.ToString() },
                { "QuestFlags", quest.Flags.BitmaskValue.ToString() },
                { "SpecialFlags", quest.SpecialFlags.BitmaskValue.ToString() },
                { "PrevQuestId", quest.PrevQuest.ToString() },
                { "NextQuestId", quest.NextQuest.ToString() },
                { "NextQuestInChain", quest.QuestCompleter.ToString() }, // completer npc or object
                //{"RewardTitle", quest.RewardTitle.ToString()},
                //{"RequiredPlayerKills", quest.RequiredPlayerKills.ToString()},
                //{"RewardArenaPoints", quest.RewardArenaPoints.ToString()},
                { "PointMapId", quest.PoiCoordinate.MapId.ToString() },
                { "PointX", quest.PoiCoordinate.X.ToString() },
                { "PointY", quest.PoiCoordinate.Y.ToString() },
                { "Title", SqlQuery.CleanText(quest.LogTitle) },
                { "Objectives", SqlQuery.CleanText(quest.LogDescription) },
                { "Details", SqlQuery.CleanText(quest.QuestDescription) },
                //{"AreaDescription", SqlQuery.CleanText(quest.AreaDescription)},
                //{"QuestCompletionLog", SqlQuery.CleanText(quest.QuestCompletionLog)},
                { "OfferRewardText", SqlQuery.CleanText(quest.RewardText) },
                { "RequestItemsText", SqlQuery.CleanText(quest.IncompleteText) },

                // not implemented in creator yet
                //{"RewMailTemplateId", RewardMailTemplateId.ToString()},
                //{"RewMailDelaySecs", RewardMailDelay.ToString()},
                //DetailsEmote1-4, DetailsEmoteDelay1-4, IncompleteEmote, CompleteEmote, OfferRewardEmote1-4, OfferRewardEmoteDelay1-4,StartScript,CompleteScript
            };

            // DDC values
            quest.RewardItems.AddValues(kvplist, "RewItemId", "RewItemCount");
            quest.RewardChoiceItems.AddValues(kvplist, "RewChoiceItemId", "RewChoiceItemCount");
            quest.FactionRewards.AddValues(kvplist, "RewRepFaction", "RewRepValue", 100);
            quest.RequiredNpcOrGos.AddValues(kvplist, "ReqCreatureOrGOId", "ReqCreatureOrGOCount");
            quest.RequiredItems.AddValues(kvplist, "ReqItemId", "ReqItemCount");

            return(kvplist);
        }
Exemplo n.º 8
0
        private Dictionary <string, string> QuestTemplate(TrinityQuest quest)
        {
            throw new NotImplementedException(); // <-- needs work
            var kvplist = new Dictionary <string, string>
            {
                { "entry", quest.EntryId.ToString() },
                { "Method", "2" },
                { "QuestLevel", quest.QuestLevel.ToString() },
                { "MinLevel", quest.MinLevel.ToString() },
                { "ZoneOrSort", quest.PQuestSort.ToString() },
                { "Type", quest.PQuestInfo.Id.ToString() }, //not sure if this is right
                { "SuggestedPlayers", quest.SuggestedGroupNum.ToString() },
                { "LimitTime", quest.TimeAllowed.ToString() },
                { "RequiredRaces", quest.AllowableRace.BitmaskValue.ToString() },
                { "RequiredClasses", quest.AllowableClass.BitmaskValue.ToString() },
                { "RewXPId", quest.RewardXpDifficulty.Id.ToString() },
                { "RewOrReqMoney", quest.RewardMoney.Amount.ToString() },
                { "RewSpell", quest.RewardSpell.ToString() },
                //{"RewardDisplaySpell", quest.RewardSpell.ToString()},
                { "RewHonorAddition", quest.RewardHonor.ToString() },
                //{"RewardTalents", quest.RewardTalents.ToString()}, <-- where's this at?
                { "SrcItemId", quest.StartItem.ToString() },
                { "SrcItemCount", quest.StartItem == 0 ? (0).ToString() : (1).ToString() },
                { "QuestFlags", quest.Flags.BitmaskValue.ToString() },
                //{"RewTitle", quest.RewardTitle.ToString()},
                //{"RequiredPlayerKills", quest.RequiredPlayerKills.ToString()}, <-- again, can't find it
                //{"RewardArenaPoints", quest.RewardArenaPoints.ToString()},
                { "PointMapId", quest.PoiCoordinate.MapId.ToString() },
                { "PointX", quest.PoiCoordinate.X.ToString() },
                { "PointY", quest.PoiCoordinate.Y.ToString() },
                { "Title", SqlQuery.CleanText(quest.LogTitle) },
                { "Objectives", SqlQuery.CleanText(quest.LogDescription) },
                { "Details", SqlQuery.CleanText(quest.QuestDescription) },
                //{"AreaDescription", SqlQuery.CleanText(quest.AreaDescription)},
                { "CompletedText", SqlQuery.CleanText(quest.QuestCompletionLog) },

                //{"MaxLevel", quest.MaxLevel.ToString()},
                { "PrevQuestId", quest.PrevQuest.ToString() },
                { "NextQuestId", quest.NextQuest.ToString() },
                //{"RewardMailTemplateId", quest.RewardMailTemplateId.ToString()},
                //{"RewardMailDelay", RewardMailDelay.ToString()},
                //{"ProvidedItemCount", quest.ProvidedItemCount.ToString()},
                { "SpecialFlags", quest.SpecialFlags.BitmaskValue.ToString() },
                { "SrcSpell", quest.SourceSpell.ToString() },
            };

            // DDC values
            quest.RewardItems.AddValues(kvplist, "RewItem", "RewardAmount");
            quest.RewardChoiceItems.AddValues(kvplist, "RewChoiceItemID", "RewChoiceItemQuantity");
            quest.FactionRewards.AddValues(kvplist, "RewFactionID", "RewFactionOverride", 100);
            quest.RequiredNpcOrGos.AddValues(kvplist, "ReqNpcOrGo", "ReqNpcOrGoCount");
            quest.RequiredItems.AddValues(kvplist, "ReqItemId", "ReqItemCount");

            return(kvplist);
        }
Exemplo n.º 9
0
        private Dictionary <string, string> QuestTemplate(TrinityQuest quest)
        {
            var kvplist = new Dictionary <string, string>
            {
                { "ID", quest.EntryId.ToString() },
                { "Method", "2" },
                { "Level", quest.QuestLevel.ToString() },
                { "MinLevel", quest.MinLevel.ToString() },
                { "MaxLevel", quest.MaxLevel.ToString() },
                { "ZoneOrSort", quest.PQuestSort.ToString() },
                { "Type", quest.PQuestInfo.Id.ToString() },
                { "SuggestedPlayers", quest.SuggestedGroupNum.ToString() },
                { "LimitTime", quest.TimeAllowed.ToString() },
                { "RequiredClasses", quest.AllowableClass.BitmaskValue.ToString() },
                { "RequiredRaces", quest.AllowableRace.BitmaskValue.ToString() },
                { "PrevQuestId", quest.PrevQuest.ToString() },
                { "NextQuestId", quest.NextQuest.ToString() },
                { "NextQuestIdChain", quest.QuestCompleter.ToString() },
                { "RewardXPId", quest.RewardXpDifficulty.Id.ToString() },
                { "RewardOrRequiredMoney", quest.RewardMoney.Amount.ToString() },
                { "RewardSpellCast", quest.RewardSpell.ToString() },
                { "RewardHonor", quest.RewardHonor.ToString() },
                { "RewardHonorMultiplier", quest.RewardHonor == 0 ? "0" : "1" },
                //{"RewardMailTemplateId", RewardMailTemplateId.ToString()},
                //{"RewardMailDelay", RewardMailDelay.ToString()},
                { "SourceItemId", quest.StartItem.ToString() },
                { "SourceItemCount", quest.ProvidedItemCount.ToString() },
                { "SourceSpellId", quest.SourceSpell.ToString() },
                { "Flags", quest.Flags.BitmaskValue.ToString() },
                { "SpecialFlags", quest.SpecialFlags.BitmaskValue.ToString() },
                { "RewardTitleId", quest.RewardTitle.ToString() },
                { "RequiredPlayerKills", quest.RequiredPlayerKills.ToString() },
                { "RewardTalents", quest.RewardTalents.ToString() },
                { "RewardArenaPoints", quest.RewardArenaPoints.ToString() },
                { "PointMapId", quest.PoiCoordinate.MapId.ToString() },
                { "PointX", quest.PoiCoordinate.X.ToString() },
                { "PointY", quest.PoiCoordinate.Y.ToString() },
                { "Title", SqlQuery.CleanText(quest.LogTitle) },
                { "Objectives", SqlQuery.CleanText(quest.LogDescription) },
                { "Details", SqlQuery.CleanText(quest.QuestDescription) },
                { "OfferRewardText", SqlQuery.CleanText(quest.RewardText) },
                { "RequestItemsText", SqlQuery.CleanText(quest.QuestCompletionLog) },
                { "CompletionText", SqlQuery.CleanText(quest.IncompleteText) },
                //{"AreaDescription", SqlQuery.CleanText(quest.AreaDescription)},
            };

            // DDC values
            quest.RewardItems.AddValues(kvplist, "RewardItemId", "RewardItemCount");
            quest.RewardChoiceItems.AddValues(kvplist, "RewardChoiceItemId", "RewardChoiceItemCount");
            quest.FactionRewards.AddValues(kvplist, "RewardFactionId", "RewardFactionValueIdOverride", 100);
            quest.RequiredNpcOrGos.AddValues(kvplist, "RequiredNpcOrGo", "RequiredNpcOrGoCount");
            quest.RequiredItems.AddValues(kvplist, "RequiredItemId", "RequiredItemCount");

            return(kvplist);
        }
Exemplo n.º 10
0
        private Dictionary <string, string> QuestTemplate(TrinityQuest quest)
        {
            var kvplist = new Dictionary <string, string>
            {
                { "ID", quest.EntryId.ToString() },
                { "QuestType", "2" },
                { "QuestLevel", quest.QuestLevel.ToString() },
                { "MinLevel", quest.MinLevel.ToString() },
                { "QuestSortID", quest.PQuestSort.ToString() },
                { "QuestInfoID", quest.PQuestInfo.Id.ToString() },
                { "SuggestedGroupNum", quest.SuggestedGroupNum.ToString() },
                { "TimeAllowed", quest.TimeAllowed.ToString() },
                { "AllowableRaces", quest.AllowableRace.BitmaskValue.ToString() },
                { "RewardXPDifficulty", quest.RewardXpDifficulty.Id.ToString() },
                { "RewardMoney", quest.RewardMoney.Amount.ToString() },
                { "RewardSpell", quest.RewardSpell.ToString() },
                { "RewardDisplaySpell", quest.RewardSpell.ToString() },
                { "RewardHonor", quest.RewardHonor.ToString() },
                { "RewardTalents", quest.RewardTalents.ToString() },
                { "StartItem", quest.StartItem.ToString() },
                { "Flags", quest.Flags.BitmaskValue.ToString() },
                { "RewardTitle", quest.RewardTitle.ToString() },
                { "RequiredPlayerKills", quest.RequiredPlayerKills.ToString() },
                { "RewardArenaPoints", quest.RewardArenaPoints.ToString() },
                { "POIContinent", quest.PoiCoordinate.MapId.ToString() },
                { "POIx", quest.PoiCoordinate.X.ToString() },
                { "POIy", quest.PoiCoordinate.Y.ToString() },
                { "LogTitle", SqlQuery.CleanText(quest.LogTitle) },
                { "LogDescription", SqlQuery.CleanText(quest.LogDescription) },
                { "QuestDescription", SqlQuery.CleanText(quest.QuestDescription) },
                { "AreaDescription", SqlQuery.CleanText(quest.AreaDescription) },
                { "QuestCompletionLog", SqlQuery.CleanText(quest.QuestCompletionLog) },

                //{"OfferRewardText", SqlQuery.CleanText(quest.RewardText)}, // <- was removed?
                //{"IncompleteText", SqlQuery.CleanText(quest.IncompleteText)},  I don't know where this goes
            };

            // DDC values
            quest.RewardItems.AddValues(kvplist, "RewardItem", "RewardAmount");
            quest.RewardChoiceItems.AddValues(kvplist, "RewardChoiceItemID", "RewardChoiceItemQuantity");
            quest.FactionRewards.AddValues(kvplist, "RewardFactionID", "RewardFactionOverride", 100);
            quest.RequiredNpcOrGos.AddValues(kvplist, "RequiredNpcOrGo", "RequiredNpcOrGoCount");
            quest.RequiredItems.AddValues(kvplist, "RequiredItemId", "RequiredItemCount");

            return(kvplist);
        }
Exemplo n.º 11
0
        private Dictionary <string, string> QuestAddon(TrinityQuest quest)
        {
            var kvplist = new Dictionary <string, string>
            {
                { "ID", quest.EntryId.ToString() },
                { "MaxLevel", quest.MaxLevel.ToString() },
                { "AllowableClasses", quest.AllowableClass.BitmaskValue.ToString() },
                { "PrevQuestId", quest.PrevQuest.ToString() },
                { "NextQuestId", quest.NextQuest.ToString() },
                //{"RewardMailTemplateId", RewardMailTemplateId.ToString()},
                //{"RewardMailDelay", RewardMailDelay.ToString()},
                { "ProvidedItemCount", quest.ProvidedItemCount.ToString() },
                { "SpecialFlags", quest.SpecialFlags.BitmaskValue.ToString() },
                { "SourceSpellID", quest.SourceSpell.ToString() },
            };

            return(kvplist);
        }
Exemplo n.º 12
0
        public static string Quest(TrinityQuest quest)
        {
            Logger.Log($"Export: Called Quest with profile: '{Profile.Active.Name}' - Revision {Profile.Active.Revision}");
            var data = new List <ExpKvp>()
            {
                new ExpKvp("EntryId", quest.EntryId, C.Quest),
                new ExpKvp("QuestSort", quest.PQuestSort, C.Quest),
                new ExpKvp("QuestInfo", quest.PQuestInfo.Id, C.Quest),
                new ExpKvp("SuggestedGroupNum", quest.SuggestedGroupNum, C.Quest),
                new ExpKvp("Flags", quest.Flags.BitmaskValue, C.Quest),
                new ExpKvp("SpecialFlags", quest.SpecialFlags.BitmaskValue, C.Quest),
                new ExpKvp("LogTitle", quest.LogTitle, C.Quest),
                new ExpKvp("LogDescription", quest.LogDescription, C.Quest),
                new ExpKvp("QuestDescription", quest.QuestDescription, C.Quest),
                new ExpKvp("AreaDescription", quest.AreaDescription, C.Quest),
                new ExpKvp("QuestCompletionLog", quest.QuestCompletionLog, C.Quest),
                new ExpKvp("RewardText", quest.RewardText, C.Quest),
                new ExpKvp("IncompleteText", quest.IncompleteText, C.Quest),
                new ExpKvp("PrevQuest", quest.PrevQuest, C.Quest),
                new ExpKvp("NextQuest", quest.NextQuest, C.Quest),
                //new ExpKvp("ExclusiveGroup", quest.ExclusiveGroup.???, C.Quest),
                new ExpKvp("Questgiver", quest.Questgiver, C.Quest, quest.QuestgiverType),
                new ExpKvp("QuestCompleter", quest.QuestCompleter, C.Quest, quest.QuestCompleterType),
                new ExpKvp("QuestLevel", quest.QuestLevel, C.Quest),
                new ExpKvp("MinLevel", quest.MinLevel, C.Quest),
                new ExpKvp("MaxLevel", quest.MaxLevel, C.Quest),
                new ExpKvp("AllowableClass", quest.AllowableClass.BitmaskValue, C.Quest),
                new ExpKvp("AllowableRace", quest.AllowableRace.BitmaskValue, C.Quest),
                new ExpKvp("StartItem", quest.StartItem, C.Quest),
                new ExpKvp("ProvidedItemCount", quest.ProvidedItemCount, C.Quest),
                new ExpKvp("SourceSpell", quest.SourceSpell, C.Quest),
                new ExpKvp("PoiCoordinateX", quest.PoiCoordinate.X, C.Quest),
                new ExpKvp("PoiCoordinateY", quest.PoiCoordinate.Y, C.Quest),
                new ExpKvp("PoiCoordinateZ", quest.PoiCoordinate.Z, C.Quest),
                new ExpKvp("PoiCoordinateMap", quest.PoiCoordinate.MapId, C.Quest),
                new ExpKvp("TimeAllowed", quest.TimeAllowed, C.Quest),
                new ExpKvp("RequiredPlayerKills", quest.RequiredPlayerKills, C.Quest),
                new ExpKvp("RewardXpDifficulty", quest.RewardXpDifficulty.Id, C.Quest),
                new ExpKvp("RewardXpRaw", quest.RewardXpRaw, C.Quest),
                new ExpKvp("RewardMoney", quest.RewardMoney.Amount, C.Quest),
                new ExpKvp("RewardSpell", quest.RewardSpell, C.Quest),
                new ExpKvp("RewardHonor", quest.RewardHonor, C.Quest),
                //new ExpKvp("RewardMailTemplateId", quest.RewardMailTemplateId.???, C.Quest),
                //new ExpKvp("RewardMailDelay", quest.RewardMailDelay, C.Quest),
                new ExpKvp("RewardTitle", quest.RewardTitle, C.Quest),
                new ExpKvp("RewardArenaPoints", quest.RewardArenaPoints, C.Quest),
                new ExpKvp("RewardTalents", quest.RewardTalents, C.Quest),
            };

            try // RequiredItem & RequiredItemCount (max 6)
            {
                // Translates to two columns: RequiredItem1, RequiredItemCount1, RequiredItem2...
                var requiredItemData = new Dictionary <string, string>();
                quest.RequiredItems.AddValues(requiredItemData, "RequiredItem", "RequiredItemCount");
                foreach (var reqItemCol in requiredItemData)
                {
                    data.Add(new ExpKvp(reqItemCol.Key, int.Parse(reqItemCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing RequiredItem data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            try // RequiredNpcOrGo & RequiredNpcOrGoCount (max 6)
            {
                // Translates to two columns: RequiredNpcOrGo1, RequiredNpcOrGoCount1, RequiredNpcOrGoItem2...
                var requiredNpcOrGoData = new Dictionary <string, string>();
                quest.RequiredNpcOrGos.AddValues(requiredNpcOrGoData, "RequiredNpcOrGo", "RequiredNpcOrGoCount");
                foreach (var reqNpcOrGoCol in requiredNpcOrGoData)
                {
                    data.Add(new ExpKvp(reqNpcOrGoCol.Key, int.Parse(reqNpcOrGoCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing RequiredNpcOrGo data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            try // RewardItem & RewardItemAmount (max 4)
            {
                // Translates to two columns: RewardItem1, RewardItemAmount1, RewardItemItem2...
                var rewardItemData = new Dictionary <string, string>();
                quest.RewardItems.AddValues(rewardItemData, "RewardItem", "RewardItemAmount");
                foreach (var rewardItemCol in rewardItemData)
                {
                    data.Add(new ExpKvp(rewardItemCol.Key, int.Parse(rewardItemCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing RewardItem data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            try // RewardChoiceItemID & RewardChoiceItemAmount (max 6)
            {
                // Translates to two columns: RewardChoiceItemID1, RewardChoiceItemAmount1, RewardChoiceItemID2...
                var rewardItemChoiceData = new Dictionary <string, string>();
                quest.RewardChoiceItems.AddValues(rewardItemChoiceData, "RewardChoiceItemID", "RewardChoiceItemAmount");
                foreach (var rewardItemChoiceCol in rewardItemChoiceData)
                {
                    data.Add(new ExpKvp(rewardItemChoiceCol.Key, int.Parse(rewardItemChoiceCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing RewardChoiceItem data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            try // UNUSUAL!! - RewardFactionID & RewardFactionOverride (max 4)
            {
                // Translates to two columns: RewardFactionID1, RewardFactionOverride1, RewardFactionID2...
                var factionRewardData = new Dictionary <string, string>();
                int multiplier        = 1;
                try
                {
                    multiplier = int.Parse(ProfileHelper.GetDefinitionValue("RewardFactionOverrideModifier"));
                }
                catch
                {
                    Logger.Log("Invalid Definition: RewardFactionOverrideModifier. This definition is not set or is invalid, which may cause reward reputation to be incorrect." +
                               Environment.NewLine + "Please update this profile.", Logger.Status.Warning, true);
                }
                quest.FactionRewards.AddValues(factionRewardData, "RewardFactionID", "RewardFactionOverride", multiplier);
                foreach (var factionRewardDataCol in factionRewardData)
                {
                    data.Add(new ExpKvp(factionRewardDataCol.Key, int.Parse(factionRewardDataCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing FactionReward data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            IncludeCustomFields(ref data, C.Quest, quest);
            return(GenerateSql(data));
        }
Exemplo n.º 13
0
        public static string Quest(TrinityQuest quest)
        {
            var data = new List <ExpKvp>()
            {
                new ExpKvp("EntryId", quest.EntryId, C.Quest),
                new ExpKvp("QuestSort", quest.PQuestSort, C.Quest),
                new ExpKvp("QuestInfo", quest.PQuestInfo.Id, C.Quest),
                new ExpKvp("SuggestedGroupNum", quest.SuggestedGroupNum, C.Quest),
                new ExpKvp("Flags", quest.Flags.BitmaskValue, C.Quest),
                new ExpKvp("SpecialFlags", quest.SpecialFlags.BitmaskValue, C.Quest),
                new ExpKvp("LogTitle", quest.LogTitle, C.Quest),
                new ExpKvp("LogDescription", quest.LogDescription, C.Quest),
                new ExpKvp("QuestDescription", quest.QuestDescription, C.Quest),
                new ExpKvp("AreaDescription", quest.AreaDescription, C.Quest),
                new ExpKvp("QuestCompletionLog", quest.QuestCompletionLog, C.Quest),
                new ExpKvp("RewardText", quest.RewardText, C.Quest),
                new ExpKvp("IncompleteText", quest.IncompleteText, C.Quest),
                new ExpKvp("PrevQuest", quest.PrevQuest, C.Quest),
                new ExpKvp("NextQuest", quest.NextQuest, C.Quest),
                //new ExpKvp("ExclusiveGroup", quest.ExclusiveGroup.???, C.Quest),
                new ExpKvp("Questgiver", quest.Questgiver, C.Quest),
                new ExpKvp("QuestCompleter", quest.QuestCompleter, C.Quest),
                new ExpKvp("QuestLevel", quest.QuestLevel, C.Quest),
                new ExpKvp("MinLevel", quest.MinLevel, C.Quest),
                new ExpKvp("MaxLevel", quest.MaxLevel, C.Quest),
                new ExpKvp("AllowableClass", quest.AllowableClass.BitmaskValue, C.Quest),
                new ExpKvp("AllowableRace", quest.AllowableRace.BitmaskValue, C.Quest),
                new ExpKvp("StartItem", quest.StartItem, C.Quest),
                new ExpKvp("ProvidedItemCount", quest.ProvidedItemCount, C.Quest),
                new ExpKvp("SourceSpell", quest.SourceSpell, C.Quest),
                new ExpKvp("PoiCoordinateX", quest.PoiCoordinate.X, C.Quest),
                new ExpKvp("PoiCoordinateY", quest.PoiCoordinate.Y, C.Quest),
                new ExpKvp("PoiCoordinateZ", quest.PoiCoordinate.Z, C.Quest),
                new ExpKvp("PoiCoordinateMap", quest.PoiCoordinate.MapId, C.Quest),
                new ExpKvp("TimeAllowed", quest.TimeAllowed, C.Quest),
                new ExpKvp("RequiredPlayerKills", quest.RequiredPlayerKills, C.Quest),
                new ExpKvp("RewardXpDifficulty", quest.RewardXpDifficulty.Id, C.Quest), // Emulator support? See issue #72
                new ExpKvp("RewardMoney", quest.RewardMoney.Amount, C.Quest),
                new ExpKvp("RewardSpell", quest.RewardSpell, C.Quest),
                new ExpKvp("RewardHonor", quest.RewardHonor, C.Quest),
                //new ExpKvp("RewardMailTemplateId", quest.RewardMailTemplateId.???, C.Quest),
                //new ExpKvp("RewardMailDelay", quest.RewardMailDelay, C.Quest),
                new ExpKvp("RewardTitle", quest.RewardTitle, C.Quest),
                new ExpKvp("RewardArenaPoints", quest.RewardArenaPoints, C.Quest),
                new ExpKvp("RewardTalents", quest.RewardTalents, C.Quest),
            };

            try // RequiredItem & RequiredItemCount (max 6)
            {
                // Translates to two columns: RequiredItem1, RequiredItemCount1, RequiredItem2...
                var requiredItemData = new Dictionary <string, string>();
                quest.RequiredItems.AddValues(requiredItemData, "RequiredItem", "RequiredItemCount");
                foreach (var reqItemCol in requiredItemData)
                {
                    data.Add(new ExpKvp(reqItemCol.Key, int.Parse(reqItemCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing RequiredItem data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            try // RequiredNpcOrGo & RequiredNpcOrGoCount (max 6)
            {
                // Translates to two columns: RequiredNpcOrGo1, RequiredNpcOrGoCount1, RequiredNpcOrGoItem2...
                var requiredNpcOrGoData = new Dictionary <string, string>();
                quest.RequiredNpcOrGos.AddValues(requiredNpcOrGoData, "RequiredNpcOrGo", "RequiredNpcOrGoCount");
                foreach (var reqNpcOrGoCol in requiredNpcOrGoData)
                {
                    data.Add(new ExpKvp(reqNpcOrGoCol.Key, int.Parse(reqNpcOrGoCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing RequiredNpcOrGo data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            try // RewardItem & RewardItemAmount (max 4)
            {
                // Translates to two columns: RewardItem1, RewardItemAmount1, RewardItemItem2...
                var rewardItemData = new Dictionary <string, string>();
                quest.RewardItems.AddValues(rewardItemData, "RewardItem", "RewardItemAmount");
                foreach (var rewardItemCol in rewardItemData)
                {
                    data.Add(new ExpKvp(rewardItemCol.Key, int.Parse(rewardItemCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing RewardItem data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            try // RewardChoiceItemID & RewardChoiceItemAmount (max 6)
            {
                // Translates to two columns: RewardChoiceItemID1, RewardChoiceItemAmount1, RewardChoiceItemID2...
                var rewardItemChoiceData = new Dictionary <string, string>();
                quest.RewardChoiceItems.AddValues(rewardItemChoiceData, "RewardChoiceItemID", "RewardChoiceItemAmount");
                foreach (var rewardItemChoiceCol in rewardItemChoiceData)
                {
                    data.Add(new ExpKvp(rewardItemChoiceCol.Key, int.Parse(rewardItemChoiceCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing RewardChoiceItem data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            try // UNUSUAL!! - RewardFactionID & RewardFactionOverride (max 4)
            {
                // Translates to two columns: RewardFactionID1, RewardFactionOverride1, RewardFactionID2...
                var factionRewardData = new Dictionary <string, string>();
                // Value output is *100 (TrinityCore support)! see issue #72
                quest.FactionRewards.AddValues(factionRewardData, "RewardFactionID", "RewardFactionOverride", 100);
                foreach (var factionRewardDataCol in factionRewardData)
                {
                    data.Add(new ExpKvp(factionRewardDataCol.Key, int.Parse(factionRewardDataCol.Value), C.Quest));
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
                Logger.Log("Something went wrong parsing FactionReward data. Query was not saved.", Logger.Status.Error, true);
                return(String.Empty);
            }

            IncludeCustomFields(ref data, C.Quest, quest);
            return(GenerateSql(data));
        }
Exemplo n.º 14
0
 public string GenerateQuery(TrinityQuest quest)
 {
     return(SqlQuery.GenerateInsert("quest_template", QuestTemplate(quest)));
 }