コード例 #1
0
ファイル: shorten_mw.php プロジェクト: ldanielz/uesp.cslist
<?php 
# deleting:
#  all LAND, PGRD records
#  all CELL-FRMR's based on STAT objects (except for markers '/Marker/')
#  all CELL-FRMR's based on SOUN, LTEX objects
# unlike MW, there are no compressed records; other types of deleted records don't exist in MW
# Morrowind.esm is already openable in emacs, so from that point of view size reduction is just to make it easier for emacs to open it
# secondary purpose is to reduce the processing time when manipulating these files
# deletions selected to focus on the data that is taking up the most space
# also want to be sure that global raw searches (e.g., for a formid)
#   always find the data, even if it's in a record whose purpose is
#   currently unknown... Therefore not just deleting all unknown
#   records
require_once "csdata.inc";
$csread = new MWRead();
$csread->get_data('STAT');
$csread->get_data('SOUN');
$csread->get_data('LTEX');
$cs = $csread->read();
$idraw = array_merge($cs->get_item_ids('STAT'), $cs->get_item_ids('SOUN'), $cs->get_item_ids('LTEX'));
$ids = array();
for ($i = 0; $i < count($idraw); $i++) {
    if (!preg_match('/Marker/', $idraw[$i])) {
        $ids[$idraw[$i]] = 1;
    }
}
$file = "../input/Morrowind.esm";
$fpin = fopen($file, "r");
$fpout = fopen("{$file}.mod", "w");
while (!feof($fpin)) {
    read_rec();
コード例 #2
0
#!/usr/bin/php -q
<?php 
require_once "csdata.inc";
$rectype = "WEAP";
$csread = new MWRead();
$wk = new MWTable($rectype);
//$csread->set_doprint();
$csread->get_data($rectype, CSRead::KEEPOPT_ALL);
$cs = $csread->read();
$styles = $cs->get_item_groups($rectype, 'styles');
foreach ($styles as $style) {
    $set = $cs->get_item_set($rectype, $style);
    print "{$style}\n";
    foreach ($set as $key => $item) {
        print "  {$key} ";
        if (!is_null($item)) {
            print $item->edid() . " " . $item->name() . " " . $item->get('skill');
        }
        print "\n";
    }
    // add check whether all items are same armor class... use cuirass for table section, not just set[0]
    $set = $cs->get_item_set($rectype, $style, 'base');
    $wk->set_columns($rectype, 'style_page');
    $wk->start_table();
    $wk->table_section("{$style} Weapons", $set[0]);
    foreach ($set as $subset) {
        $wk->table_row($subset);
    }
    $wk->end_table();
    print "\n";
    foreach ($set as $subset) {