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); }
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); }
public bool Remove(ClientThing Thing) { if (Thing == Ground) { Ground = null; return(true); } return(Objects.Remove(Thing)); }
public void Replace(int index, ClientThing NewThing) { if (index == 0) { Ground = (ClientItem)NewThing; } else { Objects[index - 1] = NewThing; } }
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); }