diff --git a/pathfinding.dll b/pathfinding.dll new file mode 100644 index 0000000..58faf79 Binary files /dev/null and b/pathfinding.dll differ diff --git a/src/Backend.cs b/src/Backend.cs index c0618de..c6847be 100644 --- a/src/Backend.cs +++ b/src/Backend.cs @@ -79,11 +79,21 @@ namespace WorldOfPeacecraft return Players[playerId]; } + public Dictionary getPlayerList() + { + return Players; + } + public Dragon getDragon (int dragonId) { return Dragons[dragonId]; } + public Dictionary getDragonList() + { + return Dragons; + } + public Map getMapObject () { return Map; diff --git a/src/Parser.cs b/src/Parser.cs index be27981..1af8761 100644 --- a/src/Parser.cs +++ b/src/Parser.cs @@ -300,11 +300,22 @@ namespace WorldOfPeacecraft private void ProcessPlayer (Block playerBlock) { - lock (Backend) { - Backend.SetPlayer (MapPlayer (playerBlock)); - } - Backend.RefreshGui (); + int id = MapPlayer(playerBlock).GetId(); + if (Backend.getPlayer(id) == null) + { + lock (Backend) + { + Backend.SetPlayer(MapPlayer(playerBlock)); + } + Backend.RefreshGui(); + } + else + { + MapPlayerUPD(playerBlock); + } } + + private void ProcessMapcell (Block mapcellBlock) { @@ -405,6 +416,21 @@ namespace WorldOfPeacecraft int y = playerBlock.GetIntValue (ValueY); return new Player (id, x, y, desc, busy, score); } + + private void MapPlayerUPD(Block playerBlock) + { + int id = playerBlock.GetIntValue(ValueId); + int score = playerBlock.GetIntValue(ValuePoints); + bool busy = playerBlock.GetBoolValue(ValueBusy); + string desc = playerBlock.GetStringValue(ValueDescription); + int x = playerBlock.GetIntValue(ValueX); + int y = playerBlock.GetIntValue(ValueY); + + Backend.getPlayer(id).SetScore(score); + Backend.getPlayer(id).SetDesc(desc); + Backend.getPlayer(id).SetX(x); + Backend.getPlayer(id).SetY(y); + } private Tile MapMapcell (Block cellBlock) {