Файл: include/creature_base.php
Строк: 66
<?php
include_once("table_name.php");
include_once("base.php");
include_once("common_func.php");
/**
base class for creature
*/
class CCreatureBase extends CBase
{
//base characteristics
var $hit;
var $max_hit;
//creature info
var $name;
var $level;
var $sex;
var $level;
/**
Constructor
*/
function CCreatureBase($database,$vnum = 0)
{
global $table_creature;
$this->db = $database;
$this->table_name=$table_creature;
$this->vnum =$vnum;
}
function checkCreatureName($name)
{
$sql = "select vnum from $this->table_name where name='$name' LIMIT 1";
$result = $this->execSQL($sql);
if($result->numRows()==0) return false;
$row = $result->fetchRow();
return $row[0];
}
function getName()
{
return $this->getProperty('name');
}
function getDesc()
{
return $this->getProperty('description');
}
function getHP()
{
$hp=$this->getProperty('hp');
return phpmud_get_d_value($hp);
}
//armor
function getAC()
{
return $this->getProperty("ac");
}
/**
get damage mobs
*/
function getDM()
{
$dm = $this->getProperty("dm");
return phpmud_get_d_value($dm);
}
/**
get damage mobs (average)
*/
function getMaxDM()
{
$dm = $this->getProperty("dm");
return phpmud_get_d_value($dm,1);
}
function getGold()
{
}
//get random thins, if mobs is dead
function getMobThings()
{
//select all things for mob
$row = $this->getProperty("things");
if($row=="") return 0;
$things = explode(",",$row);
//need support many things
return $things[0];
}
}
?>