Ejemplo n.º 1
0
        private static Vendor FindNearestVendor(Vendor.VendorType vendorType)
        {
            var results = new List <Vendor>();

            WoWPoint loc = StyxWoW.Me.Location;

            using (SQLiteDataReader reader = GetSqliteDataReader(s_sqlCmd_NearestVendor, StyxWoW.Me.MapId, (uint)vendorType.AsNpcFlag(), loc.X, loc.Y, loc.Z))
            {
                while (reader.Read())
                {
                    Vendor result    = GetVendor(reader, vendorType);
                    var    factionId = (uint)reader.GetInt32(reader.GetOrdinal("FactionId"));
                    if (StyxWoW.Me.FactionTemplate.GetReactionTowards(FactionTemplate.FromId(factionId)) >= WoWUnitReaction.Neutral && !s_vendorBlacklist.Contains(result.Entry) &&
                        Navigator.CanNavigateFully(loc, result.Location))
                    {
                        results.Add(result);
                        if (results.Count >= 5)
                        {
                            break;
                        }
                    }
                }
            }
            return(results.Any() ? results.OrderBy(r => r.Location.DistanceSqr(loc)).FirstOrDefault() : null);
        }
Ejemplo n.º 2
0
    public void Setup(Vendor vendor_)
    {
        vendor = vendor_;
        vendorNameText.text = vendor.vendorName;

        // Get products offered string
        string productsOffered         = string.Empty;
        List <Vendor.VendorType> types = vendor.vendorTypes;

        types.Sort(SortABC);
        int listCount = types.Count;

        for (int i = 0; i < listCount; i++)// (Vendor.VendorType vendorType in vendor.vendorTypes)
        {
            int temp = i;
            Vendor.VendorType thisType = types[temp];
            productsOffered += thisType;
            if (i < listCount - 1)
            {
                productsOffered += ", ";
            }
        }

        shippingEstimateCostText.text = "WIP";
        shippingEstimateTimeText.text = "WIP";
    }
Ejemplo n.º 3
0
        private static Vendor GetVendor(IDataReader reader, Vendor.VendorType type)
        {
            int   entry = reader.GetInt32(reader.GetOrdinal("entry"));
            var   name  = reader["name"] as string;
            float x     = Convert.ToSingle(reader["x"].ToString().Replace(',', '.'), CultureInfo.InvariantCulture);
            float y     = Convert.ToSingle(reader["y"].ToString().Replace(',', '.'), CultureInfo.InvariantCulture);
            float z     = Convert.ToSingle(reader["z"].ToString().Replace(',', '.'), CultureInfo.InvariantCulture);

            return(new Vendor(entry, name, type, new WoWPoint(x, y, z)));
        }
Ejemplo n.º 4
0
 private static int SortABC(Vendor.VendorType i1, Vendor.VendorType i2)
 {
     return(i1.CompareTo(i2));
 }