From: Hendrik B. <nh...@us...> - 2010-04-29 23:37:38
|
Update of /cvsroot/arianne/stendhal_website/scripts In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv27354/scripts Modified Files: monsters.php Log Message: display susceptibilities of creatures Index: monsters.php =================================================================== RCS file: /cvsroot/arianne/stendhal_website/scripts/monsters.php,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** monsters.php 19 Apr 2010 22:43:17 -0000 1.31 --- monsters.php 29 Apr 2010 23:37:30 -0000 1.32 *************** *** 60,63 **** --- 60,65 ---- /* Attributes of the monster as an array attribute=>value */ public $attributes; + /* susceptibilities and resistances */ + public $susceptibilities; /* Stuff this creature drops as an array (item, quantity, probability) */ public $drops; *************** *** 65,69 **** public $locations; ! function __construct($name, $description, $class, $gfx, $level, $xp, $respawn, $attributes, $drops) { $this->name=$name; $this->description=$description; --- 67,71 ---- public $locations; ! function __construct($name, $description, $class, $gfx, $level, $xp, $respawn, $attributes, $susceptibilities, $drops) { $this->name=$name; $this->description=$description; *************** *** 76,79 **** --- 78,84 ---- $this->attributes=$attributes; $this->drops=$drops; + $this->susceptibilities=$susceptibilities; + echo $name; + var_dump($susceptibilities); } *************** *** 271,274 **** --- 276,288 ---- $respawn=$creatures[$i]['respawn']['0 attr']['value']; + $susceptibilities=array(); + if (isset($creatures[$i]['abilities'][0]['susceptibility'])) { + foreach($creatures[$i]['abilities'][0]['susceptibility'] as $susceptibility) { + if ($susceptibility['type'] != "") { + $susceptibilities[$susceptibility['type']]=round(100 / $susceptibility['value']); + } + } + } + $drops=array(); foreach($creatures[$i]['drops'][0]['item'] as $drop) { *************** *** 278,282 **** } ! $list[]=new Monster($name, $description, $class, $gfx, $level, $xp, $respawn, $attributes, $drops); } } --- 292,296 ---- } ! $list[]=new Monster($name, $description, $class, $gfx, $level, $xp, $respawn, $attributes, $susceptibilities, $drops); } } |