var Player = require('./player'),
	cardmanager = require('./cardmanager');

var CardManager = new cardmanager()

var World = function() {
	CardManager.jsonLoad()
	this.Turn // id
  	this.Players = {};
  	this.FPS = 30;
};

World.prototype = {
	login: function(id) {
		var player = new Player(id);
		this.Turn = id
		player.getDeck(CardManager.cards)
   		this.Players[id] = player;
		console.log(this.Players[id].Name, "Has joined the server.");
    	return player;
  	},
  	logout: function(id) {
		console.log(this.Players[id].Name, "Has left the server.");
    	delete this.Players[id];
  	},
	isTurn: function(id) {
		if(id == this.Turn) { return true; } else { return false; }
	},
	changeTurn: function() {
		for(var player in this.Players) {
			if(this.Turn != player) { // todo fix turn, always returns false
				this.Turn = player;
				return
			}
		}
	},
  	start: function(callback) {
    	var self = this;
    	setInterval(function() {
			var data = []
			for(var player in self.Players) {
				var object = self.Players[player];
				data.push({Name:object.Name, id:object.id, cardData:CardManager.cards, Field:object.Field, Hand:object.Hand.length, Deck:object.Deck.length-1, Grave:object.Grave, handData:object.Hand});
			}
			callback(data)
    	}, 1000/this.FPS);
	}
};

module.exports = World;

fs.watchFile('./cards.json', function (curr, prev) {
	if(curr.mtime != prev.mtime) {
  		console.log('File change in cards.json, ' + curr.mtime);
		console.log('Reloading card database.');
		CardManager.jsonLoad()
  		//console.log('the previous mtime was: ' + prev.mtime);
	}
});
fs.watchFile('./GameRule.txt', function (curr, prev) {
	if(curr.mtime != prev.mtime) {
  		console.log('File change in GameRule.txt, ' + curr.mtime);
  		//console.log('the previous mtime was: ' + prev.mtime);
	}
});
@@ -773,47 +773,8 @@
 r) %7B
- // todo fix turn, always returns false
 %0A%09%09%09
@@ -1741,28 +1741,29 @@
 was: ' + prev.mtime);%0A%09%7D%0A%7D);
+%0A

Update world.js