Beispiel #1
0
 /// <summary>Adds a detection range. Ranges are axis aligned bounding boxes (AABB) that define the applicability of a given map.</summary>
 public void addRange(MapPoint p1, MapPoint p2)
 {
     addRange(p1.X, p1.Y, p1.Z, p2.X, p2.Y, p2.Z);
 }
Beispiel #2
0
 public void SetRange(MapPoint p1, MapPoint p2)
 {
     SetRange(p1.X, p1.Y, p1.Z, p2.X, p2.Y, p2.Z);
 }
Beispiel #3
0
 /// <summary>Check the 3D point against the AABB</summary>
 public bool Contains(MapPoint point)
 {
     return Contains(point.X, point.Y, point.Z);
 }
Beispiel #4
0
 /// <summary>Checks the given point against the current map boundaries and expands it as necessary as part of a batch. Use CheckBatchend when finished.</summary>
 public void CheckBatch(MapPoint point) {
    CheckBatch(point.X, point.Y);
 }
Beispiel #5
0
 /// <summary>Gets the currently applicable zone map.</summary>
 public FFXIImageMap GetCurrentMap(MapPoint point)
 {
     foreach (KeyValuePair<int, FFXIImageMap> pair in m_maps)
     {
         if (pair.Value.Contains(point))
             return (pair.Value);
     }
     return null;
 }
Beispiel #6
0
 /// <summary>Translate a MAP coordinate into an IMAGE coordinate.</summary>
 public PointF Translate(MapPoint point)
 {
     return new PointF(
        (m_xOffset + (m_xScale * point.X)),
        (m_yOffset + (m_yScale * point.Y))
     );
 }
Beispiel #7
0
 /// <summary>Gets the currently applicable map.</summary>
 public FFXIImageMap GetCurrentMap(int ZoneID, MapPoint point)
 {
     if (m_zones.ContainsKey(ZoneID))
         return m_zones[ZoneID].GetCurrentMap(point);
     return null;
 }
Beispiel #8
0
 public double calcDist2D(MapPoint point) {
    return calcDist2D(point.X, point.Y);
 }
Beispiel #9
0
 public double calcDist(MapPoint point) {
    return calcDist(point.X, point.Y, point.Z);
 }
Beispiel #10
0
 /// <summary>Copies the vertex information from the given MapPoint.</summary>
 public void Set(MapPoint point) {
    m_x = point.X;
    m_y = point.Y;
    m_z = point.Z;
 }
Beispiel #11
0
 /// <summary>Determines if this vertex is at the same 3D location of another MapPoint.</summary>
 public bool isEqual(MapPoint point) {
    return (m_x == point.X && m_y == point.Y && m_z == point.Z);
 }
Beispiel #12
0
 public MapPoint(MapPoint point) {
    m_x = point.X;
    m_y = point.Y;
    m_z = point.Z;
 }
Beispiel #13
0
 /// <summary>Appends the MapPoint to the end of the line.</summary>
 public void Add(MapPoint point) {
    m_points.Add(new MapPoint(point.X, point.Y, point.Z)); //create a copy
 }
Beispiel #14
0
 public MapLine(Color color, MapPoint start) {
    m_color = color;
    m_points = new List<MapPoint>();
    m_bounds = new Rectangle(0, 0, 0, 0);
    Add(start);
 }
Beispiel #15
0
 /// <summary>Determines whether any of the defined ranges are applicable to the given MAP coordinate.</summary>
 public bool Contains(MapPoint point)
 {
     foreach (FFXIImageMapRange range in ranges)
     {
         if (range.Contains(point))
             return true;
     }
     return false;
 }
Beispiel #16
0
 public float calcDistSquared(MapPoint point) {
    return calcDistSquared(point.X, point.Y, point.Z);
 }
Beispiel #17
0
 public void ResetImageMap()
 {
     engine.MapAlternativeImage = null;
     lastPlayerLocation = null;
     lastMapID = -1;
 }
Beispiel #18
0
 public MapLabel(string caption, MapPoint location, Color color) : this(caption, location.X, location.Y, location.Z, color) { }  //always make a copy of the location
Beispiel #19
0
        public override bool Poll()
        {
            if (Switching)
                return true;
            if (reader == null)
                return false;
            if (reader.HasExited)
                return false;
            if (!Valid)
                throw new InstanceException("FFXI could not be polled becuase the context is invalid.", InstanceExceptionType.InvalidContext);

            try
            {
                //grab the current zone id
                Int32 ZoneID = reader.ReadStruct<Int32>(pZoneID);
                if (ZoneID > 0xFF)
                    ZoneID = ZoneID - 0x1BC;

                //stop all reading while the zone is in flux
                if (ZoneID == 0)
                {
                    lastZone = -1; //make sure the data gets properly reset in case the player zones into the same zone (tractor, warp, etc)
                    lastMapID = -1;
                    return true;
                }

                //If the zone has changed, then clear out any old spawns and load the zone map
                if (ZoneID != lastZone || engine.Data.Empty)
                {
                    //An edit to the map has been made. Inform the user they are about to lose thier changes
                    //  and give them a final opportunity to save them.
                    if (engine.Data.Dirty)
                    {
                        //clone the map data
                        MapData mapcopy = engine.Data.Clone();
                        //pass the closed data to another thread so the current zone can continue processing.
                        DirtyZone(mapcopy);
                    }

                    zoneFinished = false;

                    //get the zone name
                    string shortName = "";
                    if (ZoneID < m_zoneNameShort.Count)
                        shortName = m_zoneNameShort[ZoneID];    //grab the new zone name
                    if (shortName == "")
                        shortName = "Zone" + ZoneID.ToString(); //support unnamed zones, like the mog house

                    //release zone resources consumed by the image map processor
                    if (engine.ShowMapAlternative)
                    {
                        engine.MapAlternativeImage = null;
                        m_imagemaps.ClearCache(lastZone);
                    }

                    //clear the old zone data and load in the new
                    engine.Clear(); //clear both the spawn and map data
                    engine.Data.ZoneName = shortName;
                    engine.Data.LoadZone(shortName); //load the zone map
                    lastZone = ZoneID;
                    lastMapID = -1;
                }

                //read the pointer array in one big lump, and create spawns for any new id's detected
                Int32[] spawnList = reader.ReadStructArray<Int32>(pSpawnStart, listMax); //cant use intptr since its machine dependant
                for (uint i = 0; i < listMax; i++)
                {
                    if (spawnList[i] > 0)
                    {
                        //only add new id's. each spawn is responsible for updating itself.
                        if (!engine.Game.Spawns.ContainsIndex(i))
                        {
                            //create the spawn and add it to the game data
                            FFXISpawn spawn = new FFXISpawn(i, (IntPtr)spawnList[i], this);

                            engine.Game.Spawns.Add(spawn);

                            //spawn.DEBUGHOVER = "pointer: " + spawnList[i].ToString("X") + " index: " + i;

                            //add the spawn to the server lookup table. this is used later to convert the claim id
                            if (spawn.Type == SpawnType.Player)
                            {
                                if (m_ServerIDLookup.ContainsKey(spawn.ServerID))
                                    m_ServerIDLookup[spawn.ServerID] = spawn;
                                else
                                    m_ServerIDLookup.Add(spawn.ServerID, spawn); //add the server id to the lookup table
                            }
                        }
                    }
                }

                //fill in the player and target
                UInt32 myID = reader.ReadStruct<UInt32>(pMyID);
                engine.Game.setPlayer(myID, true);
                UInt32 myTarget = reader.ReadStruct<UInt32>(pMyTarget);
                engine.Game.setTarget(myTarget, true);

                //force each spawn to self update
                engine.Game.Update();

                //determine if the map image alternative requires processing
                if (engine.ShowMapAlternative && (lastPlayerLocation == null || (engine.Game.Player != null && !engine.Game.Player.Location.isEqual(lastPlayerLocation))))
                {
                    //Since the player has moved, determine if the map id has changed
                    lastPlayerLocation = engine.Game.Player.Location.Clone();
                    curMap = m_imagemaps.GetCurrentMap(ZoneID, lastPlayerLocation);

                    //only process if there is a map to display
                    if (curMap != null)
                    {
                        /// IHM EDIT
                        //Send the location in image coordinates to the engine. (I don't like doing it this way.)
                        engine.LocInImage = curMap.Translate(engine.Game.Player.Location);

                        //only process if the map has actually changed
                        if (curMap.MapID != lastMapID)
                        {
                            engine.MapAlternativeImage = curMap.GetImage(); //set the background image
                            RectangleF bounds = curMap.Bounds;                //retrieve the map coodinate boundaries
                            engine.MapAlternativeBounds = bounds;           //set the origin/scale of the background image
                            engine.Data.CheckBounds(bounds);                //expand the map bounds (if necessary) to allow the map to be zoomed all the way out
                            lastMapID = curMap.MapID;                         //set the map id so that the map isnt processed again until a change is made
                            if (MapChanged != null)
                                MapChanged(curMap, new EventArgs());
                        }
                    }
                    else if (engine.MapAlternativeImage != null)
                    {
                        //inform the engine that there is no map to display for the current location
                        engine.MapAlternativeImage = null;
                        lastMapID = -1;
                    }
                }

                if (engine.Game.Spawns.Count > 0 && !zoneFinished)
                {
                    zoneFinished = true;

                    //automatically snap the range into view (if enabled)
                    if (engine.AutoRangeSnap)
                        engine.SnapToRange();
                    if (ZoneChanged != null)
                        ZoneChanged(curMap, new EventArgs());
                }
                return true;
#if DEBUG
         } catch(Exception ex) {
            Debug.WriteLine("Error while polling the process: " + ex.Message);
#else
            }
            catch
            {
#endif
                return false;
            }
        }
Beispiel #20
0
 public MapLabel(string caption, MapPoint location, Color color) : this(caption, location.X, location.Y, location.Z, color) { }  //always make a copy of the location
 public MapLabel(string caption, float x, float y, float z, Color color) {
    m_caption = caption;
    m_location = new MapPoint(x, y, z);
    m_color = color;
 }
 public GameSpawn(uint ID)
 {
     Name = "";
     Heading = 0;
     Distance = 0;
     Speed = 0;
     Type = SpawnType.Hidden;
     HealthPercent = 0;
     Level = 0;
     Dead = false;
     Hidden = true;
     InCombat = false;
     Alert = false;
     Hunt = false;
     Replacement = false;
     RepName = "";
     Icon = null;
     FillColor = Color.Black;
     ClaimID = 0;
     TargetIndex = 0;
     PetIndex = 0;
     GroupMember = false;
     RaidMember = false;
     DEBUG = "";
     DEBUGHOVER = "";
     Attackable = false;
     this.ID = ID;
     Location = new MapPoint();
 }
Beispiel #22
0
 /// <summary>Checks the given point against the current map boundaries and expands it as necessary.</summary>
 public bool CheckPoint(MapPoint point) {
    return CheckPoint(point.X, point.Y);
 }