Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Composite GatherQuest_FromObject_DoObjective(int objectiveIndex, int questId)
- {
- var dbConfig = new WoWClassDbConfig();
- dbConfig.SetupConnection("root", "abc123", "127.0.0.1");
- using (var db = new WoWClassicDb(dbConfig.ConnectionString))
- {
- var questIdInt = Convert.ToInt32(questId);
- var questTemplate = db.quest_template.FirstOrDefault(f => f.entry == questIdInt);
- var reqItem1GatherObjLoot =
- db.gameobject_loot_template.FirstOrDefault(f => f.item == questTemplate.ReqItemId1);
- var reqItem1GatherObjInfo =
- db.gameobject_template.FirstOrDefault(f => f.data1 == reqItem1GatherObjLoot.entry);
- var reqItem1GatherObjs = db.gameobjects.Where(f => f.id == reqItem1GatherObjInfo.entry).ToList();
- var reqItem1GatherObjsVectors = reqItem1GatherObjs
- .Select(s => new Vector3(s.position_x, s.position_y, s.position_z, "None")).ToList();
- return new Decorator(ret => Quest.HasQuest(questId) && !Quest.IsObjectiveComplete(objectiveIndex, questId),
- new Sequence(
- new Action(ret =>
- Logging.Write(
- $"I have the quest! - And it's not complete - Name: {questTemplate.Title} ({questId})")
- ),
- new Action(a => Logging.Write("Is Gather Quest")),
- new PrioritySelector(
- new Sequence(
- new Action(a => Logging.Write("Is Gather From Obj")),
- new PrioritySelector(
- new Decorator(
- d => ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry)
- .Any(a => a.GetDistance < 5),
- new Action(a =>
- Interact.InteractGameObjectAutoLoot(ObjectManager
- .GetNearestWoWGameObject(
- ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry),
- ObjectManager.Me.Position).GetBaseAddress))),
- new Decorator(
- d => ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry)
- .Any(a => a.GetDistance > 5),
- MoveTo(ObjectManager
- .GetNearestWoWGameObject(
- ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry),
- ObjectManager.Me.Position).Position)),
- new Decorator(
- d => !ObjectManager.GetWoWGameObjectByyId(reqItem1GatherObjInfo.entry).Any(),
- MoveTo(GetClosestVector(reqItem1GatherObjsVectors)))
- )
- ))
- )
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement