Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.17 KB | None | 0 0
  1. private static Composite GatherQuest_FromObject_DoObjective(int objectiveIndex, int questId)
  2.     {
  3.         var dbConfig = new WoWClassDbConfig();
  4.         dbConfig.SetupConnection("root", "abc123", "127.0.0.1");
  5.         using (var db = new WoWClassicDb(dbConfig.ConnectionString))
  6.         {
  7.             var questIdInt = Convert.ToInt32(questId);
  8.             var questTemplate = db.quest_template.FirstOrDefault(f => f.entry == questIdInt);
  9.  
  10.             var reqItem1GatherObjLoot =
  11.                 db.gameobject_loot_template.FirstOrDefault(f => f.item == questTemplate.ReqItemId1);
  12.  
  13.             var reqItem1GatherObjInfo =
  14.                 db.gameobject_template.FirstOrDefault(f => f.data1 == reqItem1GatherObjLoot.entry);
  15.  
  16.             var reqItem1GatherObjs = db.gameobjects.Where(f => f.id == reqItem1GatherObjInfo.entry).ToList();
  17.  
  18.             var reqItem1GatherObjsVectors = reqItem1GatherObjs
  19.                 .Select(s => new Vector3(s.position_x, s.position_y, s.position_z, "None")).ToList();
  20.  
  21.             return new Decorator(ret => Quest.HasQuest(questId) && !Quest.IsObjectiveComplete(objectiveIndex, questId),
  22.                 new Sequence(
  23.                     new Action(ret =>
  24.                         Logging.Write(
  25.                             $"I have the quest! - And it's not complete - Name: {questTemplate.Title} ({questId})")
  26.                     ),
  27.                     new Action(a => Logging.Write("Is Gather Quest")),
  28.                     new PrioritySelector(
  29.                         new Sequence(
  30.                             new Action(a => Logging.Write("Is Gather From Obj")),
  31.                             new PrioritySelector(
  32.                                 new Decorator(
  33.                                     d => ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry)
  34.                                         .Any(a => a.GetDistance < 5),
  35.                                     new Action(a =>
  36.                                         Interact.InteractGameObjectAutoLoot(ObjectManager
  37.                                             .GetNearestWoWGameObject(
  38.                                                 ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry),
  39.                                                 ObjectManager.Me.Position).GetBaseAddress))),
  40.                                 new Decorator(
  41.                                     d => ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry)
  42.                                         .Any(a => a.GetDistance > 5),
  43.                                     MoveTo(ObjectManager
  44.                                         .GetNearestWoWGameObject(
  45.                                             ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry),
  46.                                             ObjectManager.Me.Position).Position)),
  47.                                 new Decorator(
  48.                                     d => !ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry).Any(),
  49.                                     MoveTo(GetClosestVector(reqItem1GatherObjsVectors)))
  50.                             )
  51.                         ))
  52.                 )
  53.             );
  54.         }
  55.  
  56.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement