<?php
class saimod_mojotrollz_db_creature extends \SYSTEM\SAI\SaiModule {    
    public static function sai_mod_saimod_mojotrollz_db_creature(){
        $con = new \SYSTEM\DB\Connection(new \DBD\mangos_world());
        $res = $con->query('SELECT * FROM creature_template LIMIT 100;');
               
        $result =   '<table><tr>
                        <th>entry</th>
                        <th>modelid_1</th>
                        <th>modelid_2</th>
                        <th>name</th>
                        <th>subname</th>                        
                        <th>minlevel</th>
                        <th>maxlevel</th>                        
                        <th>faction_A</th>
                        <th>faction_H</th>
                        <th>npcflag</th>                        
                        <th>rank</th>                        
                        <th>unit_class</th>
                        <th>unit_flags</th>
                        <th>dynamicflags</th>
                        <th>family</th>
                        <th>trainer_type</th>
                        <th>trainer_spell</th>
                        <th>trainer_class</th>
                        <th>trainer_race</th>                        
                        <th>type</th>
                        <th>type_flags</th>                                                                                                                        
                        <th>AIName</th>
                        <th>MovementType</th>
                        <th>InhabitType</th>
                        <th>Civilian</th>
                        <th>RacialLeader</th>                        
                        <th>equipment_id</th>
                        <th>trainer_id</th>
                        <th>vendor_id</th>                        
                        <th>flags_extra</th>
                        <th>ScriptName</th>
                    </tr>';
        while($row = $res->next()){
            $result .= '<tr>
                        <td>'.$row['entry'].'</td>                        
                        <td>'.$row['modelid_1'].'</td>
                        <td>'.$row['modelid_2'].'</td>
                        <td>'.$row['name'].'</td>
                        <td>'.$row['subname'].'</td>                        
                        <td>'.$row['minlevel'].'</td>
                        <td>'.$row['maxlevel'].'</td>                                                
                        <td>'.$row['faction_A'].'</td>
                        <td>'.$row['faction_H'].'</td>
                        <td>'.$row['npcflag'].'</td>                                                
                        <td>'.$row['rank'].'</td>                        
                        <td>'.$row['unit_class'].'</td>
                        <td>'.$row['unit_flags'].'</td>
                        <td>'.$row['dynamicflags'].'</td>
                        <td>'.$row['family'].'</td>
                        <td>'.$row['trainer_type'].'</td>
                        <td>'.$row['trainer_spell'].'</td>
                        <td>'.$row['trainer_class'].'</td>
                        <td>'.$row['trainer_race'].'</td>                        
                        <td>'.$row['type'].'</td>
                        <td>'.$row['type_flags'].'</td>                                                                        
                        <td>'.$row['AIName'].'</td>
                        <td>'.$row['MovementType'].'</td>
                        <td>'.$row['InhabitType'].'</td>
                        <td>'.$row['Civilian'].'</td>
                        <td>'.$row['RacialLeader'].'</td>                        
                        <td>'.$row['equipment_id'].'</td>
                        <td>'.$row['trainer_id'].'</td>
                        <td>'.$row['vendor_id'].'</td>
                        <td>'.$row['mechanic_immune_mask'].'</td>
                        <td>'.$row['flags_extra'].'</td>
                        <td>'.$row['ScriptName'].'</td>
                    </tr>';
        }
        $result .= '</table>';
        return $result;}           
    public static function html_li_menu(){return '<li><a href="#" saimenu="saimod_mojotrollz_db_creature">DB:Creatures</a></li><li class="divider"></li>';}
    public static function right_public(){return false;}    
    public static function right_right(){return \SYSTEM\SECURITY\Security::check(\SYSTEM\SECURITY\RIGHTS::SYS_SAI);}
    public static function sai_mod_saimod_mojotrollz_db_creature_flag_js(){return \SYSTEM\LOG\JsonResult::toString(array());}        
    public static function sai_mod_saimod_mojotrollz_db_creature_flag_css(){}

}