Exemplo n.º 1
0
function SkillList($field, $term)
{
    $dataFromFile = GetListing("Data/SkillsList.data", $field, $term);
    $evenoddcounter = 1;
    $contentstring = "<div style=\"float:left; margin: 1em 1em 2em 0; \">";
    $contentstring .= "<table class=\"last-row\" style=\"float:left;\" width=\"300px\">";
    $contentstring .= "<th>Skill</th><th class=\"center\">Ability</th><th class=\"center\">Trained<br />Only?</th>";
    foreach ($dataFromFile as $individualListing) {
        list($name, $ability, $trained, $interaction, $specialization, $tools, $description, $check, $challenge, $tryagain, $action, $special) = $individualListing;
        $contentstring .= "<tr";
        if (1 & $evenoddcounter) {
            $contentstring .= " class=\"odd-row\"";
        }
        $contentstring .= "><td><a href=\"Skills.php?Name=" . urlencode($name) . "\">{$name}</td>";
        $contentstring .= "<td class=\"center\">{$ability}</td>";
        $contentstring .= "<td class=\"center\">{$trained}</td></tr>";
        if (count($dataFromFile) > 6) {
            if ($evenoddcounter == ceil(count($dataFromFile) / 2)) {
                $contentstring .= "</table><table class=\"last-row\" style=\"float:left;margin-left:2em;\" width=\"300px\">";
                $contentstring .= "<th>Skill</th><th class=\"center\">Ability</th><th class=\"center\">Trained<br />Only?</th>";
                if (1 & $evenoddcounter) {
                    $evenoddcounter++;
                }
            }
        }
        $evenoddcounter++;
    }
    $contentstring .= "</table></div>";
    print $contentstring;
}
Exemplo n.º 2
0
function MenuList($type, $sourcefile, $scriptfile, $field = "Name", $term = "All")
{
    // this function creates a drop-down list of Names based on the file
    // specified in $sourcefile
    // it will also create drop-downs of subsets based on the search criteria
    // specified in $field and $term if any.
    $dataFromFile = GetListing($sourcefile, $field, $term);
    foreach ($dataFromFile as $entry) {
        if ($entry[0] != "Name") {
            $namearray[] = $entry[0];
        }
    }
    $vowels = array("A", "a", "E", "e", "I", "i", "O", "o", "U", "u");
    $article = "a";
    if ($type[0] == in_array($type[0], $vowels)) {
        $article = "an";
    }
    // create the drop-down list. This uses the "Jumpto" function
    // defined in JumpMenu.js
    print "<div class=\"dropdown\">";
    print "<form name=\"Menu\">";
    print "<select name=\"jumpmenu\" onChange=\"jumpto(document.Menu.jumpmenu.options[document.Menu.jumpmenu.options.selectedIndex].value)\">";
    print "<option>Select {$article} {$type}</option>";
    while (list($key, $value) = each($namearray)) {
        echo "<option value=\"{$scriptfile}?Name={$value}\" name=\"{$value}\">{$value}</option>";
    }
    print "</select></form></div>";
}
Exemplo n.º 3
0
function FeatList($field, $term)
{
    $dataFromFile = GetListing("Data/FeatsList.data", $field, $term);
    $evenoddcounter = 1;
    $contentstring .= "<table class=\"last-row\" style=\"float:left\" width=\"250px\">";
    foreach ($dataFromFile as $individualListing) {
        list($name, $type, $prerequisite, $benefit, $summary) = $individualListing;
        $contentstring .= "<tr";
        if (1 & $evenoddcounter) {
            $contentstring .= " class=\"odd-row\"";
        }
        $contentstring .= "><td><p style=\"font-size:80%;margin:0.1em 0 0 0;\"><a href=\"Feats.php?Name=" . urlencode($name) . "\"><b>{$name}</b></a></p><p style=\"font-size:50%;margin:0 0 0 0;\">{$summary}</p></td>";
        if ($evenoddcounter == ceil(count($dataFromFile) / 3)) {
            $contentstring .= "</table><table class=\"last-row\" style=\"float:left;margin-left:1em\" width=\"250px\">";
            if (1 & $evenoddcounter) {
                $evenoddcounter++;
            }
        }
        if ($evenoddcounter == ceil(2 * (count($dataFromFile) / 3))) {
            $contentstring .= "</table><table class=\"last-row\" style=\"float:left;margin-left:1em\" width=\"250px\">";
            if (1 & $evenoddcounter) {
                $evenoddcounter++;
            }
        }
        $evenoddcounter++;
    }
    $contentstring .= "</table>";
    print $contentstring;
}
Exemplo n.º 4
0
function PowersTable($field, $term)
{
    $dataFromFile = GetListing("Data/PowersList.data", $field, $term);
    $evenoddcounter = 1;
    $contentstring = "<div style=\"float:left; margin-right:1em; margin-top: 1em; \">";
    $contentstring .= "<table class=\"last-row\" width=\"300px\" style=\"float:left;\">";
    $contentstring .= "<th>Power</th><th class=\"center\">Fatiguing?</th><th class=\"center\">Mental<br />Contact?</th>";
    foreach ($dataFromFile as $individualListing) {
        list($name, $fatiguing, $concentration, $maintenance, $mentalcontact, $prerequisites, $description, $tryagain, $action) = $individualListing;
        $contentstring .= "<tr";
        if (1 & $evenoddcounter) {
            $contentstring .= " class=\"odd-row\"";
        }
        $contentstring .= "><td><a href=\"Powers.php?Name=" . urlencode($name) . "\">{$name}</td><td class=\"center\">";
        if ($fatiguing != "") {
            $contentstring .= "Yes";
        }
        $contentstring .= "</td><td class=\"center\">";
        if ($mentalcontact != "") {
            $contentstring .= "Yes";
        }
        $contentstring .= "</td></tr>";
        if ($evenoddcounter == ceil(count($dataFromFile) / 2)) {
            $contentstring .= "</table><table class=\"last-row\" width=\"300px\" style=\"float:left;margin-left:1em\">";
            $contentstring .= "<th>Power</th><th class=\"center\">Fatiguing?</th><th class=\"center\">Mental<br />Contact?</th>";
        }
        $evenoddcounter++;
    }
    $contentstring .= "</table></div>";
    print $contentstring;
}
function CreaturesTypeNames()
{
    $dataFromFile = GetListing("Data/CreaturesTypesList.data", "Name", "All");
    foreach ($dataFromFile as $individualListing) {
        $CreatureName = $individualListing[0];
        $CreatureNameList .= "<h5><a href=\"CreaturesTypes.php?Name=" . urlencode($CreatureName) . "\">{$CreatureName}</a></h5>";
        $CreatureDescription = $individualListing[1];
        $CreatureNameList .= "<p>{$CreatureDescription}</p>";
    }
    print $CreatureNameList;
}
function TraitsList($field, $term)
{
    // first we retrieve a set of arrays using the GetListing function in ListScript.php
    $dataFromFile = GetListing("Data/CreaturesTraitsList.data", $field, $term);
    // then we cycle through each array in the set and divide its elements into the
    // specific stats for each entry
    foreach ($dataFromFile as $individualListing) {
        list($name, $description) = $individualListing;
        // for each entry we create a formatted string using the stats
        $traitstring = "<h5>{$name}</h5>";
        $traitstring .= "<p>{$description}</p>";
        //  finally we print each entry and repeat for as many arrays as there are in the set
        print $traitstring;
    }
}
function ActionTitleList($field, $term)
{
    $dataFromFile = GetListing("Data/ActionsList.data", $field, $term);
    $i = 1;
    foreach ($dataFromFile as $individualListing) {
        $i++;
        list($name, $time, $type, $description) = $individualListing;
        $liststring = " <a href=\"CombatActions.php?Name=";
        $liststring .= urlencode($name);
        $liststring .= "\">{$name}</a>";
        if ($i <= count($dataFromFile)) {
            $liststring .= ", ";
        }
        print $liststring;
    }
}
function ModifierTitleList($field, $term)
{
    $dataFromFile = GetListing("Data/ModifiersList.data", $field, $term);
    $evenoddcounter = 1;
    foreach ($dataFromFile as $individualListing) {
        list($name, $description) = $individualListing;
        $liststring .= "<tr";
        if (1 & $evenoddcounter) {
            $liststring .= " class=\"odd-row\"";
        }
        $liststring .= "><td><a href=\"CombatModifiers.php?Name=";
        $liststring .= urlencode($name);
        $liststring .= "\">{$name}</a></td></tr>";
        $evenoddcounter++;
    }
    print $liststring;
}
Exemplo n.º 9
0
function WeaponDetail($field, $term)
{
    $dataFromFile = GetListing("Data/MeleeWeaponsList.data", $field, $term);
    $dataFromRangedFile = GetListing("Data/RangedWeaponsList.data", $field, $term);
    if ($dataFromRangedFile != "") {
        $dataFromFile = $dataFromRangedFile;
    }
    foreach ($dataFromFile as $individualListing) {
        list($name, $damage, $criticalnumber, $criticaldamage, $damagetype, $range, $size, $cost, $weight, $type, $description) = $individualListing;
        $contentstring .= "<h2>{$name}</h2><table width=\"100%\"><th>Damage</th><th>Critical</th><th>Damage Descriptor</th><th>Range Increment</th><th>Cost</th><th>Type</th>";
        $contentstring .= "<tr class=\"odd-row\"><td>{$damage}</td>";
        $contentstring .= "<td>{$criticalnumber}/{$criticaldamage}</td>";
        $contentstring .= "<td>{$damagetype}</td>";
        $contentstring .= "<td>{$range}</td>";
        $contentstring .= "<td>{$cost}</td>";
        $contentstring .= "<td>{$type}</td></tr></table>";
        $contentstring .= "<p>{$description}</p>";
    }
    print $contentstring;
}
function CreaturesTemplatesTable($field, $term)
{
    // first we retrieve a set of arrays using the GetListing function in ListScript.php
    $dataFromFile = GetListing("Data/CreaturesTemplatesList.data", $field, $term);
    // then we cycle through each array in the set and divide its elements into the
    // specific stats for each entry
    $evenoddcounter = 1;
    foreach ($dataFromFile as $individualListing) {
        list($name, $level, $type) = $individualListing;
        // for each entry we create a formatted string using the stats
        $contentstring .= "<tr";
        if (1 & $evenoddcounter) {
            $contentstring .= " class=\"odd-row\"";
        }
        $contentstring .= "><td class=\"center\"><a href=\"CreaturesTemplates.php?Name=" . urlencode($name) . "\">{$name}</a></td>";
        //$contentstring .= "<td>$level Level <a href=\"CreaturesTypes.php?Name=$type\">$type</a></td></tr>";
        //  finally we print each entry and repeat for as many arrays as there are in the set
        $evenoddcounter++;
    }
    $contentstring .= "</table>";
    print $contentstring;
}
Exemplo n.º 11
0
function CreaturesJSON($field, $term)
{
    $dataFromFile = GetListing("Data/CreaturesList.data", $field, $term);
    foreach ($dataFromFile as $individualListing) {
        list($name, $Level, $Type, $SubType, $Size, $Spd, $Abilities, $Skills, $Feats, $Traits, $Combat, $ST, $Desc, $Details) = $individualListing;
        $Label = $Type . " " . $SubType;
        $creatureJSON = "{ \"role_name\": \"" . $Label . "\", ";
        $creatureJSON .= "\"npc_name\": \"" . $name . "\", ";
        $creatureJSON .= "\"description\": \"" . addslashes($Desc) . "\", ";
        $creatureJSON .= "\"details\": \"<p>" . addslashes($Details) . "\", ";
        $creatureJSON .= "\"fields\": { ";
        $creatureJSON .= "\"level\": " . rtrim($Level, 'rndsth') . ", ";
        $CombatArray = explode(";", $Combat);
        if ($CombatArray[0] == '<a href="CreaturesSubTypes.php?Name=Swarm">Swarm!') {
            $swarm_link = addslashes("<a href=\"CreaturesSubTypes.php?Name=Swarm\">Swarm");
            $creatureJSON .= "\"primary_attack\": \"" . $swarm_link . "\", ";
        } else {
            $creatureJSON .= "\"primary_attack\": " . substr($CombatArray[0], 0, strpos($CombatArray[0], "!")) . ", ";
        }
        $SecondaryAttack = explode("and", $CombatArray[0]);
        if ($SecondaryAttack[1]) {
            $sbstart = strpos($SecondaryAttack[1], "+");
            $sbend = strpos($SecondaryAttack[1], "</b>");
            $SecondaryAttackBonus = substr($SecondaryAttack[1], $sbstart, $sbend - $sbstart);
            $creatureJSON .= "\"secondary_attack\": " . $SecondaryAttackBonus . ", ";
        }
        $Damage = explode("!", $CombatArray[1]);
        $creatureJSON .= "\"full_damage\": " . $Damage[0] . ", ";
        $SecondaryDamage = explode("and", $Damage[1]);
        if ($SecondaryDamage[1]) {
            $sdstart = strpos($SecondaryDamage[1], "+");
            $sdend = strpos($SecondaryDamage[1], "</b>");
            $SecondaryDamageBonus = substr($SecondaryDamage[1], $sdstart, $sdend - $sdstart);
            $creatureJSON .= "\"secondary_damage\": " . $SecondaryDamageBonus . ", ";
        }
        $DefenseArray = explode("!", $CombatArray[2]);
        $DodgeParry = explode("/", $DefenseArray[0]);
        $creatureJSON .= "\"dodge\": " . $DodgeParry[0] . ", ";
        if ($DodgeParry[1] == "--") {
            $DodgeParry[1] = "\"--\"";
        }
        $creatureJSON .= "\"parry\": " . $DodgeParry[1] . ", ";
        $creatureJSON .= "\"skills\": \"";
        $SkillsArray = explode(";", $Skills);
        foreach ($SkillsArray as $Skill) {
            $SkillDetail = explode("!", $Skill);
            $SkillTag = "<a href=\"Skills.php?Name=" . urlencode($SkillDetail[0]) . "\">{$SkillDetail['0']}</a>";
            $creatureJSON .= addslashes($SkillTag) . " ";
            $creatureJSON .= $SkillDetail[1] . ", ";
        }
        $creatureJSON = rtrim($creatureJSON, ", ");
        $creatureJSON .= "\", ";
        $creatureJSON .= "\"abilities\": \"";
        if ($Feats) {
            $FeatsArray = explode(";", $Feats);
            foreach ($FeatsArray as $Feat) {
                $FeatLinkArray = explode("!", $Feat);
                if (substr($FeatLinkArray[0], 0, 6) == "Power:") {
                    $FeatLinkArray[0] = substr($FeatLinkArray[0], 6, strlen($FeatLinkArray[0]));
                    $FeatLink = "<a href=\"Powers.php?Name=" . urlencode($FeatLinkArray[0]) . "\">{$FeatLinkArray['0']}</a> ";
                } else {
                    $FeatLink = "<a href=\"Feats.php?Name=" . urlencode($FeatLinkArray[0]) . "\">{$FeatLinkArray['0']}</a>";
                }
                $creatureJSON .= addslashes($FeatLink);
                $creatureJSON .= addslashes($FeatLinkArray[1]) . " ";
            }
            $creatureJSON = rtrim($creatureJSON, " ");
            if ($Traits) {
                $creatureJSON .= ", ";
            }
        }
        if ($Traits) {
            $creatureJSON .= addslashes($Traits);
        }
        $creatureJSON .= "\", ";
        $rawSavesArray = explode(";", $ST);
        $SavesArray = array();
        foreach ($rawSavesArray as $Save) {
            if ($Save == "--") {
                $SavesArray[] = "\"--\"";
            } else {
                $SavesArray[] = substr($Save, 0, strpos($Save, "!"));
            }
        }
        $creatureJSON .= "\"toughness\": " . $SavesArray[0] . ", ";
        $creatureJSON .= "\"fortitude\": " . $SavesArray[1] . ", ";
        $creatureJSON .= "\"reflex\": " . $SavesArray[2] . ", ";
        $creatureJSON .= "\"will\": " . $SavesArray[3] . ", ";
        $AbilitiesArray = explode(",", $Abilities);
        $AbilitiesValues = array();
        foreach ($AbilitiesArray as $Ability) {
            $rawAbility = substr($Ability, -2, strlen($Ability));
            if ($rawAbility == "--") {
                $rawAbility = "\"--\"";
            }
            $AbilitiesValues[] = $rawAbility;
        }
        $creatureJSON .= "\"strength\": " . $AbilitiesValues[0] . ", ";
        $creatureJSON .= "\"dexterity\": " . $AbilitiesValues[1] . ", ";
        $creatureJSON .= "\"constitution\": " . $AbilitiesValues[2] . ", ";
        $creatureJSON .= "\"intelligence\": " . $AbilitiesValues[3] . ", ";
        $creatureJSON .= "\"wisdom\": " . $AbilitiesValues[4] . ", ";
        $creatureJSON .= "\"charisma\": " . $AbilitiesValues[5] . ", ";
        $mb = substr($CombatArray[0], 0, strpos($CombatArray[0], "!"));
        $dex = substr($AbilitiesArray[1], -2);
        $strength = substr($AbilitiesArray[0], -2);
        $mb = $mb - $dex + $strength;
        $creatureJSON .= "\"mb\": " . $mb . ", ";
        $BaseDefense = $DodgeParry[0] - $dex;
        $creatureJSON .= "\"base_defense\": " . $BaseDefense . ", ";
        $creatureJSON .= "\"reputation\": \"--\" ";
        $creatureJSON .= " }}";
    }
    print $creatureJSON;
}