public Tile(TileUpdatedMessage.Tile tile, Point3D coord, TileUpdatedMessage message) { this.Coordinate = coord; this.Overlay = tile.overlay; this.ObjectId = tile.object_id; this.LastUpdate = tile.last_updated; this.Health = tile.health; this.HealthTotal = tile.max_health; this.CreatureId = tile.creature_id; this.State = tile.state; this.EventId = tile.event_id; this.CreatureType = tile.creature_type; this.DeathTime = tile.death_time; this.City = new TileCity(tile.city); this.Army = new TileArmy(tile.army); this.RLevel = tile.r_level; this.RAmount = tile.r_amount; this.RCustomExpireTime = tile.r_custom_expire_ts; this.RGatherStartTime = tile.r_gather_start_time; this.RGatherDuration = tile.r_gather_duration; this.RTruceExpireTime = tile.r_truce_expire_ts; this.RTickDuration = tile.r_tick_duration; this.Messages = new List <TileUpdatedMessage>(); this.Messages.Add(message); }
public void Update(TileUpdatedMessage message) { foreach (TileUpdatedMessage.Chunk c in message.chunks) { foreach (TileUpdatedMessage.Tile t in c.tiles) { if (t.last_updated > this.LastUpdate) { Point3D messageCoord = Utilities.ProvinceChunkTile2Point3D(c.p_id, c.c_id, t.tile_id); if (messageCoord.Z == this.Coordinate.Z && messageCoord.X == this.Coordinate.X && messageCoord.Y == this.Coordinate.Y) { this.Overlay = t.overlay; this.ObjectId = t.object_id; this.LastUpdate = t.last_updated; this.Health = t.health; this.HealthTotal = t.max_health; this.CreatureId = t.creature_id; this.State = t.state; this.EventId = t.event_id; this.CreatureType = t.creature_type; this.DeathTime = t.death_time; this.City = new TileCity(t.city); this.Army = new TileArmy(t.army); this.RLevel = t.r_level; this.RAmount = t.r_amount; this.RCustomExpireTime = t.r_custom_expire_ts; this.RGatherStartTime = t.r_gather_start_time; this.RGatherDuration = t.r_gather_duration; this.RTruceExpireTime = t.r_truce_expire_ts; this.RTickDuration = t.r_tick_duration; } } } } this.Messages.Add(message); }