Exemple #1
0
        public bool CanGatherElement(int id, int distance)
        {
            if (distance <= 1 && distance >= 0)
            {
                return(true);
            }
            if (m_Account.Inventory.HasFishingRod)
            {
                MapPoint characterPoint = new MapPoint(Character.CellId);
                //Elements.StatedElement element = (Elements.StatedElement)StatedElements.GetValueOrNull(id);
                Elements.StatedElement element = null;
                if (StatedElements.ContainsKey(id))
                {
                    element = StatedElements[id];
                }

                if (element != null)
                {
                    //StatedElement selectedStatedElement = findValue(StatedElements, id);
                    //if (selectedStatedElement != null)
                    //    element = (Elements.StatedElement)selectedStatedElement;
                    MapPoint        elementPoint   = new MapPoint((int)element.CellId);
                    List <MapPoint> goodPointsList = GetListPointAtGoodDistance(characterPoint, elementPoint, 1); //m_Account.Inventory.WeaponRange);
                    var             selectedPoint  = goodPointsList.FirstOrDefault((point) => point.CellId == characterPoint.CellId);
                    if (selectedPoint != null)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemple #2
0
        /// <summary>
        /// Returns the cellId from the contextualId.
        /// </summary>
        public int GetCellFromContextId(int contextId)
        {
            GameRolePlayCharacterInformations pl = Players.Find(p => p.contextualId == contextId);

            if (pl != null)
            {
                return((int)pl.disposition.cellId);
            }
            Elements.StatedElement st = StatedElements.Find(s => s.Id == contextId);
            if (st != null)
            {
                return((int)st.CellId);
            }
            GameRolePlayNpcInformations npc = Npcs.Find(s => s.contextualId == contextId);

            if (npc != null)
            {
                return((int)npc.disposition.cellId);
            }
            GameRolePlayActorInformations other = Others.Find(s => s.contextualId == contextId);

            if (other != null)
            {
                return((int)other.disposition.cellId);
            }
            return(0);
        }
Exemple #3
0
 /// <summary>
 /// Return whether or not we can gather an element at the specified distance.
 /// </summary>
 public bool CanGatherElement(int id, int distance)
 {
     if (distance <= 1 && distance >= 0)
     {
         return(true);
     }
     if (m_Account.Inventory.HasFishingRod)
     {
         MapPoint characterPoint        = new MapPoint(Character.disposition.cellId);
         Elements.StatedElement element = StatedElements.Find(s => s.Id == id);
         if (element != null)
         {
             MapPoint        elementPoint   = new MapPoint((int)element.CellId);
             List <MapPoint> goodPointsList = GetListPointAtGoodDistance(characterPoint, elementPoint, m_Account.Inventory.WeaponRange);
             foreach (MapPoint mp in goodPointsList)
             {
                 m_Account.Log(new DebugTextInformation("[CanGatherElement] GoodPoints -> " + mp.CellId), 0);
             }
             m_Account.Log(new DebugTextInformation("[CanGatherElement] Player CellId ? " + characterPoint.CellId), 0);
             var selectedPoint = goodPointsList.FirstOrDefault((point) => point.CellId == characterPoint.CellId);
             if (selectedPoint != null)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #4
0
 /// <summary>
 /// Update the state of an Stated element.
 /// </summary>
 public void UpdateStatedElement(BlueSheep.Common.Protocol.Types.StatedElement element)
 {
     Elements.StatedElement Selement = new Elements.StatedElement((uint)element.elementCellId, (uint)element.elementId, (uint)element.elementState);
     if (StatedElements.Find(s => s.Id == Selement.Id) != null)
     {
         StatedElements.Find(s => s.Id == Selement.Id).State = Selement.State;
     }
     else
     {
         StatedElements.Add(Selement);
     }
 }
Exemple #5
0
 public bool MoveToElement(int id, int maxDistance)
 {
     Elements.StatedElement element = m_Account.MapData.StatedElements.Find(s => s.Id == id);
     if (element != null)
     {
         return(MoveToCellWithDistance((int)element.CellId, maxDistance, false));
     }
     else
     {
         return(false);
     }
 }
Exemple #6
0
 public bool MoveToSecureElement(int id)
 {
     Elements.StatedElement element = m_Account.MapData.StatedElements.Find(s => s.Id == id);
     m_elemId = id;
     if (element != null)
     {
         return(MoveToCellWithDistance((int)element.CellId, 1, true));
     }
     else
     {
         return(false);
     }
 }
Exemple #7
0
 public bool MoveToElement(int id, int maxDistance)
 {
     Elements.StatedElement element = null;
     if (StatedElements.ContainsKey(id))
     {
         element = StatedElements[id];
     }
     if (element != null)
     {
         return(MoveToCellWithDistance((int)element.CellId, maxDistance, false));
     }
     else
     {
         return(false);
     }
 }
Exemple #8
0
 public bool MoveToSecureElement(int id)
 {
     Elements.StatedElement element = null;
     if (StatedElements.ContainsKey(id))
     {
         element = StatedElements[id];
     }
     if (element != null)
     {
         return(MoveToCellWithDistance((int)element.CellId, 1, true));
     }
     else
     {
         //m_Account.Log(new ErrorTextInformation("Element introuvable"), 0);
         return(false);
     }
 }