Location: PHPKode > projects > PhpBlock > A9.8/modules/dungeon/javascript/phptojavascript.php
<?php
include_once "../../../site.class.php";
include_once $PATH_TO_CODE."/modules/dungeon/objectmanager.class.php";
?>
function PhpToJavascript() {
	this.getMentalStateStr=function(parState) {
		switch(parState) {
		case <?php echo RealObject::$UNIT_IS_DEAD?>:
			return "dead";
			break;
		case <?php echo RealObject::$UNIT_IS_LOBOTOMIZE?>:
			return "recruiting";
			break;
		case <?php echo RealObject::$UNIT_IS_NOT_LOBOTOMIZE?>:
			return "normal";
			break;
		default:
			return "unknown";
		}
	}
	this.isDead =function (parState) {
		return <?php echo RealObject::$UNIT_IS_DEAD?> == parState;
	}	
	this.isLobotomize =function (parState) {
		return <?php echo RealObject::$UNIT_IS_LOBOTOMIZE?> == parState;
	}
	this.getObjectTypeName=function(parObjectType) {
		switch(parObjectType) {
			case <?php echo DungeonConstante::$REAL_OBJECT_TYPE_SKELETON?>:
				return "<?php echo Skeleton::staticGetName()?>";
				break;
			case <?php echo DungeonConstante::$REAL_OBJECT_TYPE_SPECTRE?>:
				return "<?php echo Spectre::staticGetName()?>";
				break;
			case <?php echo DungeonConstante::$REAL_OBJECT_TYPE_DEADWORM?>:
				return "<?php echo DeadWorm::staticGetName()?>";
				break;
			case <?php echo DungeonConstante::$REAL_OBJECT_TYPE_GRUNT?>:
				return "<?php echo Grunt::staticGetName()?>";
				break;
			case <?php echo DungeonConstante::$REAL_OBJECT_TYPE_WAR_GRUNT?>:
				return "<?php echo WarOrk::staticGetName()?>";
				break;
			case <?php echo DungeonConstante::$REAL_OBJECT_TYPE_MINER_GRUNT?>:
				return "<?php echo MinerOrk::staticGetName()?>";
				break;
			case <?php echo  DungeonConstante::$REAL_OBJECT_TYPE_SOLDIER?>:
				return "<?php echo Soldier::staticGetName()?>";
				break;
			case <?php echo  DungeonConstante::$REAL_OBJECT_TYPE_KNIGHT?>:
				return "<?php echo Knight::staticGetName()?>";
				break;
			case <?php echo  DungeonConstante::$REAL_OBJECT_TYPE_MINER?>:
				return "<?php echo Miner::staticGetName()?>";
				break;
			case <?php echo DungeonConstante::$REAL_OBJECT_TYPE_TRAP?>:
				return "<?php echo Trap::staticGetName()?>";
				break;
			case <?php echo DungeonConstante::$REAL_OBJECT_TYPE_RALLY_POINT?>:
				return "<?php echo RallyPoint::staticGetName()?>";
				break;
			default:
				return "unknown"+parObjectType;
		}
	}
	this.getActionStop =function() {
		return <?php echo Constante::$ACTION_STOP_OBJECT;?>;
	}
}
var gloP2J = new PhpToJavascript();
Return current item: PhpBlock