コード例 #1
0
ファイル: shorten_mw.php プロジェクト: ldanielz/uesp.cslist
#!/usr/bin/php -q
<?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)) {
コード例 #2
0
#!/usr/bin/php -q
<?php 
require_once "csread.inc";
$csread = new MWRead();
//$csread->set_doprint();
$csread->set_filestoread('all');
$csread->request_data('CLOT');
$csread->request_data('ENCH');
$csread->request_data('SPEL');
$csread->request_data('MGEF');
$cs = $csread->read();
//$spells = $cs->list_items_by_type('SPEL');
$spells = array($cs->get_ordid('warywrd ability'), $cs->get_ordid('akaviri danger-sense'), $cs->get_ordid('fay ability'), $cs->get_ordid('elfborn ability'), $cs->get_ordid('wombburn'), $cs->get_ordid('magicka mult bonus_5'), $cs->get_ordid('magicka mult bonus_15'));
foreach ($spells as $spell) {
    $item = $cs->get_item($spell);
    if (!is_object($item)) {
        continue;
    }
    print "'" . $item->get('name') . "' (" . $item->get('edid') . ")\n";
    print $item->get('magic_desc') . "\n";
}
$item = $cs->get_item('mantle of woe');
print "'" . $item->get('name') . "' (" . $item->get('edid') . ")\n";
print $item->get('magic_desc') . "\n";
コード例 #3
0
#!/usr/bin/php -q
<?php 
require_once "csread.inc";
require_once "wikitable.inc";
$rectype = "ARMO";
$csread = new MWRead();
$wk = new MWTable($rectype);
//$csread->set_doprint();
$csread->set_filestoread('all');
$csread->request_data($rectype, CSRead::KEEPOPT_ALL | CSRead::KEEPOPT_ENCH);
$cs = $csread->read();
$styles = $cs->get_item_groups($rectype, 'styles');
$ex_styles = $cs->get_item_groups($rectype, 'styles', 'parentonly');
$stats = $wk->get_columns('summable');
$sumdata = array();
foreach ($styles as $style) {
    $sumdata[$style] = array();
    foreach ($stats as $stat) {
        $sumdata[$style][$stat] = 0;
    }
    $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') . " " . $item->get_index('ENAM');
        }
        print "\n";
    }
    foreach ($set as $key => $item) {
        if (is_null($item)) {
コード例 #4
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) {