function getobject($type, $key, $level = 0)
{
    global $theater;
    // Get object from theater. This has a case insensitive failsafe, since theater keys sometimes aren't the same case.
    if (isset($theater[$type][$key])) {
        $object = $theater[$type][$key];
    } else {
        foreach ($theater[$type] as $ikey => $item) {
            if (strtolower($key) == strtolower($ikey)) {
                $object = $item;
                break;
            }
        }
    }
    // Merge in imports
    if (isset($object['import'])) {
        echo "Importing {$object['import']}\n";
        // Merge using replacement of like items, which will not merge sub-array values like damagehitgroups or ammo_clip if the object also defines the section. This appears to be the way the game processes these sections.
        $import = getobject($type, $object['import'], $level + 1);
        unset($import['IsBase']);
        //		var_dump("type",$type,"key",$key,"import_key",$object['import']);
        $object = merge_theaters($import, $object);
    }
    return $object;
}
function DisplayWikiView()
{
    $itemtype = $_REQUEST['itemtype'];
    $itemname = $_REQUEST['itemname'];
    $item = getobject($itemtype, $itemname);
}
function getobject($type, $key, $recurse = 0)
{
    global $theater;
    // Get object from theater. This has a case insensitive failsafe, since theater keys sometimes aren't the same case.
    if (isset($theater[$type][$key])) {
        $object = $theater[$type][$key];
    } else {
        foreach ($theater[$type] as $ikey => $item) {
            if (strtolower($key) == strtolower($ikey)) {
                $object = $item;
                break;
            }
        }
    }
    // Merge in imports
    if (isset($object["import"])) {
        // Merge using replacement of like items, which will not merge sub-array values like damagehitgroups or ammo_clip if the object also defines the section. This appears to be the way the game processes these sections.
        $import = getobject($type, $object["import"], $recurse);
        unset($import['IsBase']);
        $object = theater_array_replace($import, $object);
    }
    if (isset($object)) {
        return $object;
    }
}