Guest User

Untitled

a guest
Oct 21st, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. var questTemplates =
  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. var _startEntry = quest => db.CreatureQuestRelations.FirstOrDefault(a => a.Quest == quest.Entry);
  14. var _endEntry = quest => db.CreatureQuestRelations.FirstOrDefault(a => a.Quest == quest.Entry);
  15.  
  16. var _start = startEntry => db.CreatureTemplates.FirstOrDefault(x => x.Entry == startEntry.ID);
  17. var _end = endEntry => db.CreatureTemplates.FirstOrDefault(x => x.Entry == endEntry.ID);
  18.  
  19. var _creatureStart = start => db.Creatures.FirstOrDefault(x => x.ID == start.Entry);
  20. var _creatureEnd = end => db.Creatures.FirstOrDefault(x => x.ID == end.Entry);
  21.  
  22. var _mapStart = creatureStart => creatureStart.Map == wowMain.Me.MapId;
  23. var _mapEnd = creatureEnd => creatureEnd.Map == wowMain.Me.MapId;
  24.  
  25. var quests =
  26. from quest in questTemplates
  27. let creatureStart = _creatureStart(_start(_startEntry(quest)))
  28. let creatureEnd = _creatureEnd(_end(_endEntry(quest)))
  29. select DBQuest
  30. {
  31. Quest = quest,
  32. CreatureStart = _mapStart(creatureStart) ? creatureStart : null,
  33. CreatureEnd = _mapEnd(creatureEnd) ? creatureEnd : null
  34. }
Add Comment
Please, Sign In to add comment