Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 1.32 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. var quests =
  2.     from quest in db.QuestTemplates
  3.     where q.MinLevel <= wowMain.Me.Level + 2
  4.     where (q.SpecialFlags == 0 || q.SpecialFlags == 4)
  5.     where q.SuggestedPlayers <= 1
  6.     where q.RequiredMaxRepFaction == 0
  7.     where q.RequiredMinRepFaction == 0
  8.     where q.RepObjectiveFaction == 0
  9.     where q.LimitTime == 0
  10.     where q.ReqSourceID1 == 0
  11.     where q.ReqSpellCast1 == 0
  12.  
  13.     let startEntry = db.CreatureQuestRelations.FirstOrDefault(a => a.Quest == quest.Entry)
  14.     let endEntry = db.CreatureQuestRelations.FirstOrDefault(a => a.Quest == quest.Entry)
  15.  
  16.     if (startEntry != null || endEntry != null)
  17.     {
  18.         let start = db.CreatureTemplates.FirstOrDefault(x => x.Entry == startEntry.ID)
  19.         let end = db.CreatureTemplates.FirstOrDefault(x => x.Entry == endEntry.ID)
  20.  
  21.         if (start != null || end != null)
  22.         {
  23.             let creatureStart = db.Creatures.FirstOrDefault(x => x.ID == start.Entry)
  24.             let creatureEnd = db.Creatures.FirstOrDefault(x => x.ID == end.Entry)
  25.  
  26.             if (creatureStart != null &&
  27.                 creatureEnd != null &&
  28.                 creatureStart.Map == wowMain.Me.MapId &&
  29.                 creatureEnd.Map == wowMain.Me.MapId)
  30.             {
  31.                 select new DBQuest(quest, creatureStart, creatureEnd);
  32.             }
  33.         }
  34.     }