internal static async Task <bool> Vendoring()
        {
            if (IsVendoring)
            {
                var items = GetVendorItems;
                if (items.Count == 0)
                {
                    if (await Common.CloseFrames())
                    {
                        return(true);
                    }
                    ResetVendoring();
                    return(true);
                }

                if (_vendorobject == null)
                {
                    var vendors = GetVendors;
                    if (vendors.Count > 0)
                    {
                        _vendorobject = vendors[0];
                        GarrisonBase.Debug("Vendor Behavior Using {0} as Vendor Npc!", _vendorobject.Name);
                    }
                }


                if (_vendorMovement == null || _vendorMovement.CurrentMovementQueue.Count == 0)
                {
                    //Check for any vendors in cache..
                    //  -If none than goto safety inside garrison.
                    if (_vendorobject == null)
                    {
                        var vendorWoWPoint = MovementCache.SellRepairNpcLocation;
                        if (vendorWoWPoint == WoWPoint.Zero)
                        {
                            vendorWoWPoint = StyxWoW.Me.IsAlliance
                                ? MovementCache.AllianceSellRepairNpc
                                : MovementCache.HordeSellRepairNpc;
                        }

                        _vendorMovement = new Movement(new[] { vendorWoWPoint }, 20f, "Garrison Vendor");
                    }
                    else
                    {
                        _vendorMovement = new Movement(_vendorobject, _vendorobject.InteractRange - 0.25f, "Vendor Movement");
                    }
                }

                if (_vendorobject != null)
                {
                    if (_vendorobject.WithinInteractRange)
                    {
                        //Do Vendoring..
                        bool vendoring = await VendorInteraction(_vendorobject, items);

                        if (!vendoring)
                        {
                            ResetVendoring();
                            return(true);
                        }

                        return(true);
                    }
                }

                if (_vendorMovement != null)
                {
                    bool movement = await VendorMovement();

                    if (!movement)
                    {
                        //Failed to move?
                        GarrisonBase.Debug("Failed to move to vendor location!");
                        return(false);
                    }
                }

                return(true);
            }

            return(false);
        }
        internal static async Task <bool> Mailing()
        {
            if (IsMailing)
            {
                var items = GetMailItems;
                if (items.Count == 0)
                {
                    if (await Common.CloseFrames())
                    {
                        return(true);
                    }
                    ResetMailing();
                    return(true);
                }

                if (_mailobject == null)
                {
                    var mailboxes = GetMailBoxes;
                    if (mailboxes.Count > 0)
                    {
                        _mailobject = mailboxes[0];
                        GarrisonBase.Debug("Mail Behavior found mailbox object at {0}", _mailobject.Location);
                    }
                }

                if (_mailingMovement == null || _mailingMovement.CurrentMovementQueue.Count == 0)
                {
                    if (_mailobject == null)
                    {
                        var mailboxWoWPoint = MovementCache.GarrisonEntrance;
                        if (mailboxWoWPoint == WoWPoint.Zero)
                        {
                            mailboxWoWPoint = StyxWoW.Me.IsAlliance
                                ? MovementCache.AllianceGarrisonEntrance
                                : MovementCache.HordeGarrisonEntrance;
                        }

                        _mailingMovement = new Movement(new[] { mailboxWoWPoint }, 20f, "Garrison Entrance");
                    }
                    else
                    {
                        _mailingMovement = new Movement(_mailobject, _mailobject.InteractRange - 0.25f, "Mailbox Movement");
                    }
                }


                if (_mailobject != null)
                {
                    if (_mailobject.WithinInteractRange)
                    {
                        bool mailing = await MailboxInteraction(_mailobject, items);

                        if (!mailing)
                        {
                            ResetMailing();
                            return(true);
                        }

                        return(true);
                    }
                }

                if (_mailingMovement != null)
                {
                    bool movement = await MailMovement();

                    if (!movement)
                    {
                        //Failed to move?
                        GarrisonBase.Debug("Failed to move to mailbox location!");
                        return(false);
                    }
                }

                return(true);
            }

            return(false);
        }
Beispiel #3
0
        internal static async Task <bool> Disenchanting()
        {
            if (IsDisenchanting)
            {
                if (!_checkedDisenchantingSkill)
                {
                    _checkedDisenchantingSkill = true;
                    _usingDisenchantingSkill   =
                        Player.Professions.ProfessionSkills.ContainsKey(SkillLine.Enchanting) &&
                        GetDisenchantingItems.Count > 0;
                }

                if (_usingDisenchantingSkill)
                {
                    var items = GetDisenchantingItems;
                    if (items.Count == 0)
                    {
                        if (await Common.CloseFrames())
                        {
                            return(true);
                        }
                        ResetDisenchanting();
                        return(true);
                    }

                    await DisenchantInteraction(items);

                    return(true);
                }

                #region Garrison Disenchanting

                var forgeItems = GetDisenchantForgeItems;
                if (forgeItems.Count == 0)
                {
                    if (await Common.CloseFrames())
                    {
                        return(true);
                    }
                    ResetDisenchanting();
                    return(true);
                }

                if (_disenchantobject == null)
                {
                    var disenchantObjects = DisenchantingForgeObjects;
                    if (disenchantObjects.Count > 0)
                    {
                        _disenchantobject = disenchantObjects[0];
                        GarrisonBase.Debug("Disenchant Behavior found object at {0}", _disenchantobject.Location);
                    }
                }

                if (_disenchantMovement == null || _disenchantMovement.CurrentMovementQueue.Count == 0)
                {
                    if (_disenchantobject == null)
                    {
                        var mailboxWoWPoint = GarrisonManager.Buildings[BuildingType.EnchantersStudy].EntranceMovementPoint;
                        _disenchantMovement = new Movement(new[] { mailboxWoWPoint }, 20f, "Enchanters Study Entrance");
                    }
                    else
                    {
                        _disenchantMovement = new Movement(_disenchantobject, _disenchantobject.InteractRange - 0.25f, "Disenchant Object Movement");
                    }
                }


                if (_disenchantobject != null)
                {
                    if (_disenchantobject.WithinInteractRange)
                    {
                        bool disenchanting = await DisenchantForgeInteraction(_disenchantobject, forgeItems);

                        if (!disenchanting)
                        {
                            ResetDisenchanting();
                            return(true);
                        }

                        return(true);
                    }
                }

                if (_disenchantMovement != null)
                {
                    bool movement = await DisenchantMovement();

                    if (!movement)
                    {
                        //Failed to move?
                        GarrisonBase.Debug("Failed to move to disenchant location!");
                        return(false);
                    }
                }

                return(true);

                #endregion
            }

            return(false);
        }