Ejemplo n.º 1
0
        private void ProcessSpecialTileProps(int x, int y, byte tileId, SCTileDef tileDef)
        {
            var poi = new SCPointOfInterest
            {
                Coords  = new SCCoords(x, y),
                TileDef = tileDef,
                TileId  = tileId
            };

            if ((tileDef.OWBitFlags & SCBitFlags.Enter) > 0)
            {
                var overworldTeleport = (OverworldTeleportIndex)(tileDef.TileProp.Byte2 & 0x3F);
                var teleDef           = enter[(int)overworldTeleport];
                var t = new SCTeleport {
                    Coords = poi.Coords, Type = SCPointOfInterestType.OwEntrance, TargetMap = teleDef.Map, TargetCoords = new SCCoords {
                        X = teleDef.X, Y = teleDef.Y
                    }, OverworldTeleport = overworldTeleport
                };
                Exits.Add(t);

                poi.Type     = SCPointOfInterestType.Tele;
                poi.Teleport = t;
                PointsOfInterest.Add(poi);
            }
            else if ((tileDef.OWBitFlags & SCBitFlags.Caravan) > 0)
            {
                poi.Type   = SCPointOfInterestType.Shop;
                poi.ShopId = 69;
                PointsOfInterest.Add(poi);
            }
        }
Ejemplo n.º 2
0
        public static void HandleGossipPoi(Packet packet)
        {
            var protoPoi = packet.Holder.GossipPoi = new();

            ++LastGossipPOIEntry;
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = "@ID+" + LastGossipPOIEntry.ToString();

            gossipPOI.Flags = protoPoi.Flags = (uint)packet.ReadInt32E <UnknownFlags>("Flags");

            Vector2 pos = packet.ReadVector2("Coordinates");

            protoPoi.Coordinates = pos;
            gossipPOI.PositionX  = pos.X;
            gossipPOI.PositionY  = pos.Y;

            gossipPOI.Icon       = packet.ReadUInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = protoPoi.Importance = packet.ReadUInt32("Importance");
            gossipPOI.Name       = protoPoi.Name = packet.ReadCString("Icon Name");
            protoPoi.Icon        = (uint)gossipPOI.Icon;

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);
            CoreParsers.NpcHandler.UpdateTempGossipOptionActionPOI(packet.TimeSpan, gossipPOI.ID);
        }
        //For the Recreational Facilities
        public static Task UpdateRecreationalLocations(List <RecreationFacilitiesDTO> recreationFacilities)
        {
            DataModel db = new DataModel();
            List <PointsOfInterest> pointsOfInterests = db.PointsOfInterest.ToList();

            foreach (var recreationFacility in recreationFacilities)
            {
                PointsOfInterest existingPointsOfInterest =
                    pointsOfInterests.FirstOrDefault(x => x.Name == recreationFacility.ComplexName);

                if (existingPointsOfInterest == null)
                {
                    PointsOfInterest pointsOfInterestModel = new PointsOfInterest();
                    pointsOfInterestModel.Name      = recreationFacility.ComplexName;
                    pointsOfInterestModel.Latitude  = recreationFacility.Latitude.ToString();
                    pointsOfInterestModel.Longitude = recreationFacility.Longitude.ToString();
                    pointsOfInterestModel.Type      = recreationFacility.FacilityType;

                    var latLongLocation = new Loc(Convert.ToDouble(pointsOfInterestModel.Latitude), Convert.ToDouble(pointsOfInterestModel.Longitude));
                    pointsOfInterestModel.Location = QuadrantIdentifier.getLocationInCalgary(latLongLocation);

                    db.PointsOfInterest.Add(pointsOfInterestModel);
                }
            }
            db.SaveChanges();
            return(Task.FromResult(0));
        }
        //For the Fire Station Points
        public static Task UpdateFireStationLocations(List <FireStationServicesDTO> fireStations)
        {
            DataModel db = new DataModel();
            List <PointsOfInterest> pointsOfInterests = db.PointsOfInterest.ToList();

            foreach (var fireStation in fireStations)
            {
                PointsOfInterest existingPointsOfInterest =
                    pointsOfInterests.FirstOrDefault(x => x.Name == fireStation.Name);

                if (existingPointsOfInterest == null)
                {
                    PointsOfInterest pointsOfInterestModel = new PointsOfInterest();
                    pointsOfInterestModel.Name      = fireStation.Name;
                    pointsOfInterestModel.Latitude  = fireStation.Location.Coordinates[1].ToString();
                    pointsOfInterestModel.Longitude = fireStation.Location.Coordinates[0].ToString();
                    pointsOfInterestModel.Type      = "Fire Station";

                    var latLongLocation = new Loc(Convert.ToDouble(pointsOfInterestModel.Latitude), Convert.ToDouble(pointsOfInterestModel.Longitude));
                    pointsOfInterestModel.Location = QuadrantIdentifier.getLocationInCalgary(latLongLocation);

                    db.PointsOfInterest.Add(pointsOfInterestModel);
                }
            }
            db.SaveChanges();
            return(Task.FromResult(0));
        }
        //For the Police Station Locations
        public static Task UpdatePoliceLocations(List <PoliceServiceOfficesDTO> policeStations)
        {
            DataModel db = new DataModel();
            List <PointsOfInterest> pointsOfInterests = db.PointsOfInterest.ToList();

            foreach (var policeStation in policeStations)
            {
                PointsOfInterest existingPointsOfInterest =
                    pointsOfInterests.FirstOrDefault(x => x.Name == policeStation.Name);

                if (existingPointsOfInterest == null)
                {
                    PointsOfInterest pointsOfInterestModel = new PointsOfInterest();
                    pointsOfInterestModel.Name = policeStation.Name;

                    //Police Station api has longitude and latitude wrong so I had to switch them around
                    pointsOfInterestModel.Latitude  = policeStation.Longitude;
                    pointsOfInterestModel.Longitude = policeStation.Latitude.ToString();
                    pointsOfInterestModel.Type      = "Police Station";

                    var latLongLocation = new Loc(Convert.ToDouble(pointsOfInterestModel.Latitude), Convert.ToDouble(pointsOfInterestModel.Longitude));
                    pointsOfInterestModel.Location = QuadrantIdentifier.getLocationInCalgary(latLongLocation);

                    db.PointsOfInterest.Add(pointsOfInterestModel);
                }
            }
            db.SaveChanges();
            return(Task.FromResult(0));
        }
Ejemplo n.º 6
0
        public static void HandleGossipPoi(Packet packet)
        {
            ++LastGossipPOIEntry;
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = "@ID+" + LastGossipPOIEntry.ToString();

            gossipPOI.Flags = (uint)packet.ReadInt32E <UnknownFlags>("Flags");

            Vector2 pos = packet.ReadVector2("Coordinates");

            gossipPOI.PositionX = pos.X;
            gossipPOI.PositionY = pos.Y;

            gossipPOI.Icon       = packet.ReadUInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = packet.ReadUInt32("Data");
            gossipPOI.Name       = packet.ReadCString("Icon Name");

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);
            var lastGossipOption = CoreParsers.NpcHandler.LastGossipOption;

            if (lastGossipOption.HasSelection)
            {
                Storage.GossipMenuOptionActions.Add(new GossipMenuOptionAction {
                    MenuId = lastGossipOption.MenuId, OptionIndex = lastGossipOption.OptionIndex, ActionPoiId = gossipPOI.ID
                }, packet.TimeSpan);
            }
        }
Ejemplo n.º 7
0
        public UWaterlooAPI(string apikey)
        {
            m_apikey             = apikey;
            m_client             = new HttpClient();
            m_client.BaseAddress = new Uri("https://api.uwaterloo.ca");

            FoodServices     = new FoodServices(m_apikey, m_client);
            Feds             = new Feds(m_apikey, m_client);
            Courses          = new Courses(m_apikey, m_client);
            Awards           = new Awards(m_apikey, m_client);
            Events           = new Events(m_apikey, m_client);
            Blogs            = new Blogs(m_apikey, m_client);
            News             = new News(m_apikey, m_client);
            Opportunities    = new Opportunities(m_apikey, m_client);
            Services         = new Services(m_apikey, m_client);
            Weather          = new Weather(m_apikey, m_client);
            Terms            = new Terms(m_apikey, m_client);
            Resources        = new Resources(m_apikey, m_client);
            Codes            = new Codes(m_apikey, m_client);
            Buildings        = new Buildings(m_apikey, m_client);
            PointsOfInterest = new PointsOfInterest(m_apikey, m_client);
            Parking          = new Parking(m_apikey, m_client);
            Transit          = new Transit(m_apikey, m_client);
            Directory        = new Directory(m_apikey, m_client);
            API    = new API(m_apikey, m_client);
            Server = new Server(m_apikey, m_client);
        }
Ejemplo n.º 8
0
        public static void HandleGossipPoi(Packet packet)
        {
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = ++LastGossipPOIEntry;

            gossipPOI.Flags = packet.ReadBits("Flags", 14);
            uint bit84 = packet.ReadBits(6);

            Vector2 pos = packet.ReadVector2("Coordinates");

            gossipPOI.PositionX = pos.X;
            gossipPOI.PositionY = pos.Y;

            gossipPOI.Icon       = packet.ReadUInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = packet.ReadUInt32("Importance");
            gossipPOI.Name       = packet.ReadWoWString("Name", bit84);

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);
            var lastGossipOption = CoreParsers.NpcHandler.LastGossipOption;

            if (lastGossipOption.HasSelection)
            {
                Storage.GossipMenuOptionActions.Add(new GossipMenuOptionAction {
                    MenuId = lastGossipOption.MenuId, OptionIndex = lastGossipOption.OptionIndex, ActionPoiId = gossipPOI.ID
                }, packet.TimeSpan);
            }
        }
Ejemplo n.º 9
0
        public static void HandleGossipPoi(Packet packet)
        {
            var protoPoi = packet.Holder.GossipPoi = new();
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = protoPoi.Id = packet.ReadInt32("ID");

            Vector2 pos = packet.ReadVector2("Coordinates");

            gossipPOI.PositionX  = pos.X;
            gossipPOI.PositionY  = pos.Y;
            protoPoi.Coordinates = pos;

            gossipPOI.Icon       = packet.ReadInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = protoPoi.Importance = (uint)packet.ReadInt32("Importance");
            protoPoi.Icon        = (uint)gossipPOI.Icon;

            packet.ResetBitReader();
            gossipPOI.Flags = protoPoi.Flags = packet.ReadBits("Flags", 14);
            uint bit84 = packet.ReadBits(6);

            gossipPOI.Name = protoPoi.Name = packet.ReadWoWString("Name", bit84);

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);
            CoreParsers.NpcHandler.UpdateTempGossipOptionActionPOI(packet.TimeSpan, gossipPOI.ID);
        }
        public static Task UpdateTransitLRTStations(List <TransitLRTStationsDTO> transitLRTStations)
        {
            DataModel db = new DataModel();
            List <PointsOfInterest> pointsOfInterests = db.PointsOfInterest.ToList();

            foreach (var transitLRTStation in transitLRTStations)
            {
                PointsOfInterest existingPointsOfInterest =
                    pointsOfInterests.FirstOrDefault(x => x.Name == transitLRTStation.Stationnam);

                if (existingPointsOfInterest == null)
                {
                    PointsOfInterest pointsOfInterestModel = new PointsOfInterest();
                    pointsOfInterestModel.Name      = transitLRTStation.Stationnam;
                    pointsOfInterestModel.Latitude  = transitLRTStation.Latitude;
                    pointsOfInterestModel.Longitude = transitLRTStation.Longitude;
                    pointsOfInterestModel.Type      = "CTrain";

                    var latLongLocation = new Loc(Convert.ToDouble(transitLRTStation.Latitude), Convert.ToDouble(transitLRTStation.Longitude));
                    pointsOfInterestModel.Location = QuadrantIdentifier.getLocationInCalgary(latLongLocation);

                    db.PointsOfInterest.Add(pointsOfInterestModel);
                }
            }
            db.SaveChanges();
            return(Task.FromResult(0));
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Options"/> class.
 /// </summary>
 public Options()
 {
     Targets   = new List <string>();
     Points    = new List <PointsOfInterest>();
     Ppoint    = new PointsOfInterest();
     WayPoints = new List <position_t>();
     Zones     = new List <Zones>();
 }
Ejemplo n.º 12
0
        public void AddPoi(PointOfInterest poi)
        {
            var so = new SelectableObject <PointOfInterest>(poi);

            so.ObjectSelectionChanged += So_ObjectSelectionChanged;
            PointsOfInterest.Add(so);
            so.IsSelected = true;
        }
Ejemplo n.º 13
0
        public static void HandleGossipPoi(Packet packet)
        {
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = packet.ReadInt32("ID");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_1_0_39185))
            {
                Vector3 pos = packet.ReadVector3("Coordinates");
                gossipPOI.PositionX = pos.X;
                gossipPOI.PositionY = pos.Y;
                gossipPOI.PositionZ = pos.Z;
            }
            else
            {
                Vector2 pos = packet.ReadVector2("Coordinates");
                gossipPOI.PositionX = pos.X;
                gossipPOI.PositionY = pos.Y;
            }

            gossipPOI.Icon       = packet.ReadInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = (uint)packet.ReadInt32("Importance");

            packet.ResetBitReader();
            gossipPOI.Flags = packet.ReadBits("Flags", 14);
            uint bit84 = packet.ReadBits(6);

            gossipPOI.Name = packet.ReadWoWString("Name", bit84);

            var lastGossipOption    = CoreParsers.NpcHandler.LastGossipOption;
            var tempGossipOptionPOI = CoreParsers.NpcHandler.TempGossipOptionPOI;

            lastGossipOption.ActionPoiId    = gossipPOI.ID;
            tempGossipOptionPOI.ActionPoiId = gossipPOI.ID;

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);

            if (tempGossipOptionPOI.HasSelection)
            {
                if ((packet.TimeSpan - tempGossipOptionPOI.TimeSpan).Duration() <= TimeSpan.FromMilliseconds(2500))
                {
                    if (tempGossipOptionPOI.ActionMenuId != null)
                    {
                        Storage.GossipMenuOptionActions.Add(new GossipMenuOptionAction {
                            MenuId = tempGossipOptionPOI.MenuId, OptionIndex = tempGossipOptionPOI.OptionIndex, ActionMenuId = tempGossipOptionPOI.ActionMenuId, ActionPoiId = gossipPOI.ID
                        }, packet.TimeSpan);
                        //clear temp
                        tempGossipOptionPOI.Reset();
                    }
                }
                else
                {
                    lastGossipOption.Reset();
                    tempGossipOptionPOI.Reset();
                }
            }
        }
Ejemplo n.º 14
0
        private void ComposeArea()
        {
            PointsOfInterest = Entrances
                               .SelectMany(e => e.PointsOfInterest)
                               .Where(p => p.BitFlagSet.Count > 0)
                               .GroupBy(p => p.Coords, new SCCoordsEqualityComparer())
                               .Select(g => g.First())
                               .ToList();

            Exits = PointsOfInterest.Where(p => p.Type == SCPointOfInterestType.Tele || p.Type == SCPointOfInterestType.Warp || p.Type == SCPointOfInterestType.Exit).Select(p => p.Teleport).ToList();
        }
Ejemplo n.º 15
0
 private void ProcessTeleporters()
 {
     foreach (var t in exit)
     {
         PointsOfInterest.Add(new SCPointOfInterest {
             Coords = new SCCoords {
                 X = t.X, Y = t.Y
             }, Type = SCPointOfInterestType.Exit
         });
     }
 }
Ejemplo n.º 16
0
        public static void HandleGossipPoi(Packet packet)
        {
            var protoPoi = packet.Holder.GossipPoi = new();
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = protoPoi.Id = packet.ReadInt32("ID");

            Vector2 pos = packet.ReadVector2("Coordinates");

            gossipPOI.PositionX  = pos.X;
            gossipPOI.PositionY  = pos.Y;
            protoPoi.Coordinates = pos;

            gossipPOI.Icon       = packet.ReadInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = protoPoi.Importance = (uint)packet.ReadInt32("Importance");
            protoPoi.Icon        = (uint)gossipPOI.Icon;

            packet.ResetBitReader();
            gossipPOI.Flags = protoPoi.Flags = packet.ReadBits("Flags", 14);
            uint bit84 = packet.ReadBits(6);

            gossipPOI.Name = protoPoi.Name = packet.ReadWoWString("Name", bit84);

            var lastGossipOption    = CoreParsers.NpcHandler.LastGossipOption;
            var tempGossipOptionPOI = CoreParsers.NpcHandler.TempGossipOptionPOI;

            lastGossipOption.ActionPoiId    = gossipPOI.ID;
            tempGossipOptionPOI.ActionPoiId = gossipPOI.ID;

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);

            if (tempGossipOptionPOI.HasSelection)
            {
                if ((packet.TimeSpan - tempGossipOptionPOI.TimeSpan).Duration() <= TimeSpan.FromMilliseconds(2500))
                {
                    if (tempGossipOptionPOI.ActionMenuId != null)
                    {
                        Storage.GossipMenuOptionActions.Add(new GossipMenuOptionAction {
                            MenuId = tempGossipOptionPOI.MenuId, OptionIndex = tempGossipOptionPOI.OptionIndex, ActionMenuId = tempGossipOptionPOI.ActionMenuId.GetValueOrDefault(), ActionPoiId = gossipPOI.ID
                        }, packet.TimeSpan);
                        //clear temp
                        tempGossipOptionPOI.Reset();
                    }
                }
                else
                {
                    lastGossipOption.Reset();
                    tempGossipOptionPOI.Reset();
                }
            }
        }
Ejemplo n.º 17
0
 private void ProcessNormalTeleporters()
 {
     foreach (var t in tele)
     {
         if (t.Map == MapId)
         {
             PointsOfInterest.Add(new SCPointOfInterest {
                 Coords = new SCCoords {
                     X = t.X, Y = t.Y
                 }.SmClamp, Type = SCPointOfInterestType.SmEntrance
             });
         }
     }
 }
Ejemplo n.º 18
0
        public bool TryGetPointsOfInterest(WowMapId mapId, PoiType poiType, Vector3 position, float maxRadius, out IEnumerable <Vector3> nodes)
        {
            KeyValuePair <WowMapId, PoiType> KeyValuePair = new(mapId, poiType);

            if (PointsOfInterest.ContainsKey(mapId) &&
                PointsOfInterest[mapId].ContainsKey(poiType))
            {
                nodes = PointsOfInterest[mapId][poiType].Where(e => e.GetDistance(position) < maxRadius);
                return(nodes.Any());
            }

            nodes = null;
            return(false);
        }
Ejemplo n.º 19
0
        void Jump()
        {
            if (!gravityComponent.IsGrounded)
            {
                return;
            }
            Vector2 jumpDir;
            bool    moveToTarget;
            Vector2 target = PointsOfInterest.ClosestPointOfInterest(m_rigidbody.position, out moveToTarget);

            if (moveToTarget)
            {
                bool targetIsOnRight = targetIsOnItsRight(target);

                if (avoidWater != null && avoidWater.enabled)
                {
                    bool waterNear;
                    if (targetIsOnRight)
                    {
                        waterNear = avoidWater.IsWaterNear(1);
                    }
                    else
                    {
                        waterNear = avoidWater.IsWaterNear(-1);
                    }

                    if (waterNear)
                    {
                        return;
                    }
                }

                if (targetIsOnRight)
                {
                    jumpDir = Gravity.GetUpAt(transform.position).Rotate(-_jumpAngle);
                }
                else
                {
                    jumpDir = Gravity.GetUpAt(transform.position).Rotate(_jumpAngle);
                }
            }
            else
            {
                jumpDir = Gravity.GetUpAt(transform.position);
            }

            m_rigidbody.AddForce(jumpDir * _jumpForce, ForceMode2D.Impulse);
        }
Ejemplo n.º 20
0
        public static void HandleGossipPoi(Packet packet)
        {
            ++LastGossipPOIEntry;
            var protoPoi = packet.Holder.GossipPoi = new();
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = "@ID+" + LastGossipPOIEntry.ToString();

            gossipPOI.Flags = protoPoi.Flags = (uint)packet.ReadInt32E <UnknownFlags>("Flags");

            Vector2 pos = packet.ReadVector2("Coordinates");

            protoPoi.Coordinates = pos;
            gossipPOI.PositionX  = pos.X;
            gossipPOI.PositionY  = pos.Y;

            gossipPOI.Icon       = packet.ReadUInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = protoPoi.Importance = packet.ReadUInt32("Data");
            gossipPOI.Name       = protoPoi.Name = packet.ReadCString("Icon Name");
            protoPoi.Icon        = (uint)gossipPOI.Icon;

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);

            var lastGossipOption    = CoreParsers.NpcHandler.LastGossipOption;
            var tempGossipOptionPOI = CoreParsers.NpcHandler.TempGossipOptionPOI;

            if (tempGossipOptionPOI.HasSelection)
            {
                if ((packet.TimeSpan - tempGossipOptionPOI.TimeSpan).Duration() <= TimeSpan.FromMilliseconds(2500))
                {
                    if (tempGossipOptionPOI.ActionMenuId != null)
                    {
                        Storage.GossipMenuOptionActions.Add(new GossipMenuOptionAction {
                            MenuId = tempGossipOptionPOI.MenuId, OptionIndex = tempGossipOptionPOI.OptionIndex, ActionMenuId = tempGossipOptionPOI.ActionMenuId, ActionPoiId = gossipPOI.ID
                        }, packet.TimeSpan);
                        //clear temp
                        tempGossipOptionPOI.Reset();
                    }
                }
                else
                {
                    lastGossipOption.Reset();
                    tempGossipOptionPOI.Reset();
                }
            }
        }
Ejemplo n.º 21
0
 public ToonControl(MainForm mf, Dictionary <string, EliteAPI> chars, EliteAPI api)
 {
     InitializeComponent();
     Character = new Character(mf.Logger, this, chars, api);
     TargetComboBox.SelectedIndex = 0;
     FFxiNAV    = new FFXINAV();
     Waypoints  = new List <position_t>();
     TestWorker = new BackgroundWorker();
     TestWorker.WorkerSupportsCancellation        = true;
     TestWorker.WorkerReportsProgress             = true;
     backgroundWorker1.WorkerSupportsCancellation = true;
     backgroundWorker1.WorkerReportsProgress      = true;
     Ppoint             = new PointsOfInterest();
     TestWorker.DoWork += TestWorker_DoWork;
     Posi = new position_t();
     KeepMovingStartPosi = new position_t();
 }
Ejemplo n.º 22
0
        public static void HandleGossipPoi(Packet packet)
        {
            var protoPoi = packet.Holder.GossipPoi = new();
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = protoPoi.Id = packet.ReadInt32("ID");

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_1_0_39185))
            {
                Vector3 pos = packet.ReadVector3("Coordinates");
                gossipPOI.PositionX  = pos.X;
                gossipPOI.PositionY  = pos.Y;
                gossipPOI.PositionZ  = pos.Z;
                protoPoi.Coordinates = new Vec2()
                {
                    X = pos.X, Y = pos.Y
                };
                protoPoi.Height = pos.Z;
            }
            else
            {
                Vector2 pos = packet.ReadVector2("Coordinates");
                gossipPOI.PositionX  = pos.X;
                gossipPOI.PositionY  = pos.Y;
                protoPoi.Coordinates = pos;
            }

            gossipPOI.Icon       = packet.ReadInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = protoPoi.Importance = (uint)packet.ReadInt32("Importance");
            protoPoi.Icon        = (uint)gossipPOI.Icon;

            if (ClientVersion.AddedInVersion(ClientVersionBuild.V9_0_5_37503))
            {
                gossipPOI.Unknown905 = packet.ReadInt32("Unknown905");
            }

            packet.ResetBitReader();
            gossipPOI.Flags = gossipPOI.Flags = packet.ReadBits("Flags", 14);
            uint bit84 = packet.ReadBits(6);

            gossipPOI.Name = protoPoi.Name = packet.ReadWoWString("Name", bit84);

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);
            CoreParsers.NpcHandler.UpdateTempGossipOptionActionPOI(packet.TimeSpan, gossipPOI.ID);
        }
Ejemplo n.º 23
0
        private void ProcessQuestNpc(ref NPC npc)
        {
            var routine   = npcdata.GetRoutine(npc.ObjectId);
            var talkArray = npcdata.GetTalkArray(npc.ObjectId);

            var poi = new SCPointOfInterest
            {
                Coords      = new SCCoords(npc.Coord.x, npc.Coord.y),
                Type        = SCPointOfInterestType.QuestNpc,
                Npc         = npc,
                TalkRoutine = routine,
                TalkArray   = talkArray
            };

            PointsOfInterest.Add(poi);

            //if (blocked) Tiles[poi.Coords.X, poi.Coords.Y].Tile |= SCBitFlags.Blocked;
        }
Ejemplo n.º 24
0
        public static void HandleGossipPoi(Packet packet)
        {
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = packet.ReadInt32("ID");

            Vector2 pos = packet.ReadVector2("Coordinates");

            gossipPOI.PositionX = pos.X;
            gossipPOI.PositionY = pos.Y;

            gossipPOI.Icon       = packet.ReadInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = (uint)packet.ReadInt32("Importance");

            packet.ResetBitReader();
            gossipPOI.Flags = packet.ReadBits("Flags", 14);
            uint bit84 = packet.ReadBits(6);

            gossipPOI.Name = packet.ReadWoWString("Name", bit84);

            var lastGossipOption    = CoreParsers.NpcHandler.LastGossipOption;
            var tempGossipOptionPOI = CoreParsers.NpcHandler.TempGossipOptionPOI;

            lastGossipOption.ActionPoiId    = gossipPOI.ID;
            tempGossipOptionPOI.ActionPoiId = gossipPOI.ID;

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);

            if (tempGossipOptionPOI.HasSelection)
            {
                if (tempGossipOptionPOI.ActionMenuId != null)
                {
                    Storage.GossipMenuOptionActions.Add(new GossipMenuOptionAction {
                        MenuId = tempGossipOptionPOI.MenuId, OptionIndex = tempGossipOptionPOI.OptionIndex, ActionMenuId = tempGossipOptionPOI.ActionMenuId, ActionPoiId = gossipPOI.ID
                    }, packet.TimeSpan);
                    //clear temp
                    tempGossipOptionPOI.Guid         = null;
                    tempGossipOptionPOI.MenuId       = null;
                    tempGossipOptionPOI.OptionIndex  = null;
                    tempGossipOptionPOI.ActionMenuId = null;
                    tempGossipOptionPOI.ActionPoiId  = null;
                }
            }
        }
Ejemplo n.º 25
0
        public static void HandleGossipPoi(Packet packet)
        {
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = ++LastGossipPOIEntry;

            gossipPOI.Flags = (uint)packet.ReadInt32E <UnknownFlags>("Flags");

            Vector2 pos = packet.ReadVector2("Coordinates");

            gossipPOI.PositionX = pos.X;
            gossipPOI.PositionY = pos.Y;

            gossipPOI.Icon       = packet.ReadUInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = packet.ReadUInt32("Data");
            gossipPOI.Name       = packet.ReadCString("Icon Name");

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);
        }
Ejemplo n.º 26
0
        public static void HandleGossipPoi(Packet packet)
        {
            PointsOfInterest gossipPOI = new PointsOfInterest();

            gossipPOI.ID = ++LastGossipPOIEntry;

            gossipPOI.Flags = packet.ReadBits("Flags", 14);
            uint bit84 = packet.ReadBits(6);

            Vector2 pos = packet.ReadVector2("Coordinates");

            gossipPOI.PositionX = pos.X;
            gossipPOI.PositionY = pos.Y;

            gossipPOI.Icon       = packet.ReadUInt32E <GossipPOIIcon>("Icon");
            gossipPOI.Importance = packet.ReadUInt32("Importance");
            gossipPOI.Name       = packet.ReadWoWString("Name", bit84);

            Storage.GossipPOIs.Add(gossipPOI, packet.TimeSpan);
        }
Ejemplo n.º 27
0
        private void ProcessPointsOfInterest()
        {
            if (PointsOfInterest.Count > 250)
            {
                throw new NoYouDon_LowerCaseT_Exception(MapId, "Excess PointsOfInterest found.");
            }

            var conflicts = PointsOfInterest.Where(p => p.Type < SCPointOfInterestType.OwEntrance).GroupBy(p => p.Coords, new SCCoordsEqualityComparer()).Where(g => g.Count() > 1);

            if (conflicts.Any())
            {
                throw new NopeException(MapId, "There is a PointOfInterest conflict.");
            }

            PointsOfInterest = PointsOfInterest.Distinct(new SCPointOfInterestEqualityComparer()).ToList();

            Entrances = PointsOfInterest
                        .Where(p => p.Type == SCPointOfInterestType.SmEntrance || p.Type == SCPointOfInterestType.OwEntrance)
                        .Select(p => p.Coords)
                        .Distinct()
                        .Select(c => new SCEntrance(this, c)).ToList();
        }
Ejemplo n.º 28
0
 public void CachePoi(WowMapId mapId, PoiType poiType, Vector3 position)
 {
     if (!PointsOfInterest.ContainsKey(mapId))
     {
         PointsOfInterest.TryAdd(mapId, new Dictionary <PoiType, List <Vector3> >()
         {
             { poiType, new List <Vector3>()
               {
                   position
               } }
         });
     }
     else if (!PointsOfInterest[mapId].ContainsKey(poiType))
     {
         PointsOfInterest[mapId].Add(poiType, new List <Vector3>()
         {
             position
         });
     }
     else if (!PointsOfInterest[mapId][poiType].Any(e => e == position))
     {
         PointsOfInterest[mapId][poiType].Add(position);
     }
 }
 public void DeletePointOfInterest(PointsOfInterest pointOfInterest)
 {
     _cityInfoContext.PointOfInterest.Remove(pointOfInterest);
 }
        public void AddPointOfInterestForCity(int cityId, PointsOfInterest pointsOfInterest)
        {
            var city = GetCity(cityId, false);

            city.PointsOfInterest.Add(pointsOfInterest);
        }