Example #1
0
        public void Add(ClientThing Thing, bool Push = false)
        {
            if (Thing is ClientItem)
            {
                if (((ClientItem)Thing).Type.IsGround)
                {
                    Ground = (ClientItem)Thing;
                    return;
                }
            }

            if (Objects.Count >= 10)
            {
                Objects.Remove(GetByIndex(9));
            }

            int index = 0;

            for (index = 0; index < Objects.Count; ++index)
            {
                if (Push)
                {
                    if (Objects[index].Order >= Thing.Order)
                    {
                        break;
                    }
                }
                else if (Objects[index].Order > Thing.Order)
                {
                    break;
                }
            }
            Objects.Insert(index, Thing);
        }
Example #2
0
        public void Add(ClientThing Thing, bool Push = false)
        {
            if (Thing is ClientItem)
            {
                if (((ClientItem)Thing).Type.IsGround)
                {
                    Ground = (ClientItem)Thing;
                    return;
                }
            }

            if (Objects.Count >= 10)
                Objects.Remove(GetByIndex(9));

            int index = 0;
            for (index = 0; index < Objects.Count; ++index)
            {
                if (Push)
                {
                    if (Objects[index].Order >= Thing.Order)
                        break;
                }
                else if (Objects[index].Order > Thing.Order)
                    break;
            }
            Objects.Insert(index, Thing);
        }
Example #3
0
        private void OnAddThing(Packet props)
        {
            MapPosition Position = (MapPosition)props["Position"];
            ClientThing Thing    = (ClientThing)props["Thing"];
            Boolean     Push     = (Boolean)props["Push"];

            Map[Position].Add(Thing, Push);
        }
Example #4
0
 public bool Remove(ClientThing Thing)
 {
     if (Thing == Ground)
     {
         Ground = null;
         return(true);
     }
     return(Objects.Remove(Thing));
 }
Example #5
0
 public void Replace(int index, ClientThing NewThing)
 {
     if (index == 0)
     {
         Ground = (ClientItem)NewThing;
     }
     else
     {
         Objects[index - 1] = NewThing;
     }
 }
Example #6
0
        private void OnTransformThing(Packet props)
        {
            MapPosition Position   = (MapPosition)props["Position"];
            int         StackIndex = (int)props["StackIndex"];
            ClientThing Thing      = (ClientThing)props["Thing"];

            if (props.Has("Direction"))
            {
                if (Thing is ClientCreature)
                {
                    ((ClientCreature)Thing).Direction = (Direction)props["Direction"];
                }
            }

            Map[Position].Replace(StackIndex, Thing);
        }
Example #7
0
 public void Replace(int index, ClientThing NewThing)
 {
     if (index == 0)
         Ground = (ClientItem)NewThing;
     else
         Objects[index - 1] = NewThing;
 }
Example #8
0
 public bool Remove(ClientThing Thing)
 {
     if (Thing == Ground)
     {
         Ground = null;
         return true;
     }
     return Objects.Remove(Thing);
 }