package games.mapacman.common;
import games.mapacman.client.GameScreen;
import games.mapacman.client.Sprite;
import games.mapacman.server.MaPacmanZone;
import marauroa.common.game.RPClass;
import marauroa.common.game.RPObject;
public class ZoneChangePoint {
private RPObject zoneChange;
private int x,y;
public ZoneChangePoint(RPObject object) {
zoneChange=object;
x=zoneChange.getInt("x");
y=zoneChange.getInt("y");
}
public ZoneChangePoint(MaPacmanZone zone, String newzone, int xpos, int ypos) {
this.x = xpos;
this.y = ypos;
zoneChange = new RPObject(RPObject.INVALID_ID);
zoneChange.put("type",consts.TYPE_ZONECHANGE);
zoneChange.put("newzone",newzone);
zoneChange.put("zoneid",zone.getName());
zoneChange.put("x",x);
zoneChange.put("y",y);
}
public static void initRPClass()
{
RPClass zonechange = new RPClass(consts.TYPE_ZONECHANGE);
zonechange.isA("position");
zonechange.add("newzone",RPClass.STRING);
}
public boolean isPlacedAt(int newX, int newY) {
return (newX==x && newY==y);
}
public String getZoneName() {
return zoneChange.get("newzone");
}
public void draw(GameScreen screen, Sprite sprite_zonechange) {
screen.repaintArea(x,y,0);
screen.draw(sprite_zonechange,x,y);
}
public RPObject getRPObject() {
return zoneChange;
}
}