function worldmapen_install()
{
    if (!is_module_installed("cities")) {
        output("`b`^***** This module requires the Multiple Cities module to be installed. *****`b`7");
        return false;
    } else {
        module_addhook("village");
        module_addhook("villagenav");
        module_addhook("mundanenav");
        module_addhook("superuser");
        module_addhook("pvpcount");
        module_addhook("footer-gypsy");
        module_addhook("count-travels");
        module_addhook("changesetting");
        module_addhook("boughtmount");
        module_addhook("newday");
        module_addhook("items-returnlinks");
    }
    if (is_module_installed("staminasystem")) {
        require_once 'modules/staminasystem/lib/lib.php';
        install_action("Travelling - Plains", array("maxcost" => 5000, "mincost" => 2500, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 25, "class" => "Travelling"));
        install_action("Travelling - Jungle", array("maxcost" => 10000, "mincost" => 4000, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 60, "class" => "Travelling"));
        install_action("Travelling - River", array("maxcost" => 15000, "mincost" => 5000, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 100, "class" => "Travelling"));
        install_action("Travelling - Ocean", array("maxcost" => 25000, "mincost" => 7500, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 175, "class" => "Travelling"));
        install_action("Travelling - Mountains", array("maxcost" => 20000, "mincost" => 6000, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 140, "class" => "Travelling"));
        install_action("Travelling - Snow", array("maxcost" => 25000, "mincost" => 7500, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 175, "class" => "Travelling"));
        install_action("Travelling - Beach", array("maxcost" => 5000, "mincost" => 2500, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 25, "class" => "Travelling"));
        install_action("Travelling - Swamp", array("maxcost" => 12500, "mincost" => 5000, "firstlvlexp" => 500, "expincrement" => 1.1, "costreduction" => 75, "class" => "Travelling"));
    }
    return true;
}
function staminatest_run()
{
    global $session;
    page_header("Stamina Testing");
    switch (httpget("op")) {
        case "start":
            output("Testing Testing!");
            break;
        case "add":
            output("Attempting to install an action called Sexins, with these parameters:`n`nStarting and Maximum costs: 500`nMinimum cost: 200`nReps for a Reduction: 20`nReduction: 10`n");
            install_action("Sexins", array("maxcost" => 25000, "mincost" => 10000, "expperrep" => 100, "expforlvl" => 1000, "costreduction" => 10, "dkpct" => 2.5));
            break;
        case "process":
            output("Processing the Sexins action");
            process_action("Sexins");
            break;
        case "newday":
            output("Processing a New Day");
            stamina_process_newday();
            break;
        case "buff":
            output("Applying a stamina buff to Sexins for the current user, for 20 rounds, reducing action cost to half.");
            apply_stamina_buff('ultra-sexy-buff-for-sexins', array("name" => "Ultra Sexy Buff for Sexins", "action" => "Sexins", "costmod" => 0.5, "expmod" => 0.8, "rounds" => 5, "roundmsg" => "Round Message!", "wearoffmsg" => "Wearoff Message!"));
            output("Also applying a Stamina Class buff to all Hunting actions, reducing their cost to half for twenty rounds.");
            apply_stamina_buff('huntclasstest', array("name" => "Hunting Class test buff", "class" => "Hunting", "costmod" => 0.5, "expmod" => 0.8, "rounds" => 20, "roundmsg" => "Round Message!", "wearoffmsg" => "Wearoff Message!"));
            break;
        case "get":
            $thingtodebug = get_player_action("Sexins");
            debug($thingtodebug);
            break;
        case "uninstall":
            output("Uninstalling the Sexins action, deleting all actions entries and associated buffs");
            uninstall_action("Sexins");
            break;
        case "dragonkill":
            output("Processing a Dragon Kill");
            stamina_process_dragonkill();
            break;
        case "calcbuffs":
            output("Calculating Buffs");
            stamina_calculate_buffed_cost("Sexins");
            break;
        case "calcexp":
            output("Calculating Buffed EXP");
            stamina_calculate_buffed_exp("Sexins");
            break;
    }
    addnav("Install an action called Sexins", "runmodule.php?module=staminatest&op=add");
    addnav("Uninstall", "runmodule.php?module=staminatest&op=uninstall");
    addnav("Process the Sexins Action for the current user", "runmodule.php?module=staminatest&op=process");
    addnav("Process newday", "runmodule.php?module=staminatest&op=newday");
    addnav("Add a buff", "runmodule.php?module=staminatest&op=buff");
    addnav("Get Stamina", "runmodule.php?module=staminatest&op=get");
    addnav("Process a Dragon Kill", "runmodule.php?module=staminatest&op=dragonkill");
    addnav("Calculate Buffed Cost", "runmodule.php?module=staminatest&op=calcbuffs");
    addnav("Calculate Buffed exp", "runmodule.php?module=staminatest&op=calcexp");
    addnav("Back to the Grotto", "superuser.php");
    page_footer();
    return true;
}
function items_world_map_gathering_install()
{
    module_addhook("worldnav");
    require_once "modules/staminasystem/lib/lib.php";
    install_action("Logging", array("maxcost" => 50000, "mincost" => 20000, "firstlvlexp" => 500, "expincrement" => 1.05, "costreduction" => 300, "class" => "Building"));
    install_action("Stonecutting", array("maxcost" => 50000, "mincost" => 20000, "firstlvlexp" => 500, "expincrement" => 1.05, "costreduction" => 300, "class" => "Building"));
    return true;
}
function creaturetargets_install()
{
    module_addhook("buffbadguy");
    module_addhook("fightnav-specialties");
    module_addhook("apply-specialties");
    module_addhook("battle");
    require_once "modules/staminasystem/lib/lib.php";
    install_action("Fighting - Targeted", array("maxcost" => 1000, "mincost" => 500, "firstlvlexp" => 2000, "expincrement" => 1.12, "costreduction" => 5, "class" => "Combat"));
    return true;
}
function insults_install()
{
    module_addhook("fightnav-specialties");
    module_addhook("apply-specialties");
    require_once "modules/staminasystem/lib/lib.php";
    install_action("Insults - Coarse", array("maxcost" => 2000, "mincost" => 1500, "firstlvlexp" => 2500, "expincrement" => 1.02, "costreduction" => 5, "class" => "Insults"));
    install_action("Insults - Confusing", array("maxcost" => 2000, "mincost" => 1500, "firstlvlexp" => 2500, "expincrement" => 1.025, "costreduction" => 5, "class" => "Insults"));
    install_action("Insults - Classy", array("maxcost" => 2000, "mincost" => 1500, "firstlvlexp" => 2500, "expincrement" => 1.03, "costreduction" => 5, "class" => "Insults"));
    return true;
}
function meatsystem_install()
{
    module_addhook("battle-victory");
    module_addhook("creatureencounter");
    module_addhook("forest");
    module_addhook("worldnav");
    module_addhook("newday");
    require_once "modules/staminasystem/lib/lib.php";
    install_action("Cleaning the Carcass", array("maxcost" => 15000, "mincost" => 2000, "firstlvlexp" => 500, "expincrement" => 1.07, "costreduction" => 130, "class" => "Meat"));
    install_action("Cooking", array("maxcost" => 8000, "mincost" => 1000, "firstlvlexp" => 500, "expincrement" => 1.05, "costreduction" => 70, "class" => "Meat"));
    return true;
}
function onslaught_install()
{
    module_addhook("village");
    module_addhook("newday");
    module_addhook("newday-runonce");
    module_addhook("battle-victory");
    module_addhook("alternativeresurrect");
    module_addhook("worldnav");
    require_once "modules/staminasystem/lib/lib.php";
    install_action("Reinforcement", array("maxcost" => 5000, "mincost" => 2000, "firstlvlexp" => 500, "expincrement" => 1.05, "costreduction" => 30, "class" => "Building"));
    return true;
}
function improbablehousing_install()
{
    module_addhook("worldnav");
    module_addhook("village");
    module_addhook("newday");
    module_addhook("stamina-newday");
    require_once "lib/tabledescriptor.php";
    $housing = array('id' => array('name' => 'id', 'type' => 'int(11) unsigned', 'extra' => 'auto_increment'), 'ownedby' => array('name' => 'ownedby', 'type' => 'int(11) unsigned'), 'location' => array('name' => 'location', 'type' => 'text'), 'data' => array('name' => 'data', 'type' => 'mediumtext'), 'key-PRIMARY' => array('name' => 'PRIMARY', 'type' => 'primary key', 'unique' => '1', 'columns' => 'id'));
    synctable(db_prefix('improbabledwellings'), $housing, true);
    $buildings = array('hid' => array('name' => 'hid', 'type' => 'int(11) unsigned', 'extra' => 'auto_increment'), 'ownedby' => array('name' => 'ownedby', 'type' => 'int(11) unsigned'), 'location' => array('name' => 'location', 'type' => 'text'), 'key-PRIMARY' => array('name' => 'PRIMARY', 'type' => 'primary key', 'unique' => '1', 'columns' => 'hid'));
    $building_prefs = array('hid' => array('name' => 'hid', 'type' => 'int(11) unsigned'), 'pref' => array('name' => 'pref', 'type' => 'varchar(50)'), 'value' => array('name' => 'value', 'type' => 'text'), 'key-PRIMARY' => array('name' => 'PRIMARY', 'type' => 'primary key', 'unique' => '1', 'columns' => 'hid,pref'));
    $rooms = array('hid' => array('name' => 'hid', 'type' => 'int(11) unsigned'), 'rid' => array('name' => 'rid', 'type' => 'int(11) unsigned'), 'key-PRIMARY' => array('name' => 'PRIMARY', 'type' => 'primary key', 'unique' => '1', 'columns' => 'hid,rid'));
    $room_prefs = array('hid' => array('name' => 'hid', 'type' => 'int(11) unsigned'), 'rid' => array('name' => 'rid', 'type' => 'int(11) unsigned'), 'pref' => array('name' => 'pref', 'type' => 'varchar(50)'), 'value' => array('name' => 'value', 'type' => 'text'), 'key-PRIMARY' => array('name' => 'PRIMARY', 'type' => 'primary key', 'unique' => '1', 'columns' => 'hid,rid,pref'));
    synctable(db_prefix('buildings'), $buildings, true);
    synctable(db_prefix('building_prefs'), $building_prefs, true);
    synctable(db_prefix('rooms'), $rooms, true);
    synctable(db_prefix('room_prefs'), $room_prefs, true);
    // 'module_userprefs'=>array(
    // 'modulename'=>array(
    // 'name'=>'modulename', 'type'=>'varchar(50)'
    // ),
    // 'setting'=>array(
    // 'name'=>'setting', 'type'=>'varchar(50)'
    // ),
    // 'userid'=>array(
    // 'name'=>'userid', 'type'=>'int(11) unsigned', 'default'=>'0'
    // ),
    // 'value'=>array(
    // 'name'=>'value', 'type'=>'text', 'null'=>'1'
    // ),
    // 'key-PRIMARY'=>array(
    // 'name'=>'PRIMARY',
    // 'type'=>'primary key',
    // 'unique'=>'1',
    // 'columns'=>'modulename,setting,userid'
    // ),
    // 'key-modulename'=>array(
    // 'name'=>'modulename', 'type'=>'key', 'columns'=>'modulename,userid'
    // ),
    // 'key-userid'=>array( // Speed up char deletion, takes a lot of space, though
    // 'name'=>'userid', 'type'=>'key', 'columns'=>'userid'
    // ),
    // ),
    //synctable(db_prefix('improbabledwellings'), $housing, true);
    require_once "modules/staminasystem/lib/lib.php";
    install_action("Masonry", array("maxcost" => 50000, "mincost" => 20000, "firstlvlexp" => 500, "expincrement" => 1.05, "costreduction" => 300, "class" => "Building"));
    install_action("Carpentry", array("maxcost" => 50000, "mincost" => 20000, "firstlvlexp" => 500, "expincrement" => 1.05, "costreduction" => 300, "class" => "Building"));
    install_action("Decorating", array("maxcost" => 50000, "mincost" => 20000, "firstlvlexp" => 500, "expincrement" => 1.05, "costreduction" => 300, "class" => "Building"));
    return true;
}
function scrapbots_install()
{
    $scrapbots = array('id' => array('name' => 'id', 'type' => 'int(11) unsigned', 'extra' => 'auto_increment'), 'owner' => array('name' => 'owner', 'type' => 'int(11) unsigned'), 'name' => array('name' => 'name', 'type' => 'text'), 'activated' => array('name' => 'activated', 'type' => 'int(11) unsigned'), 'hitpoints' => array('name' => 'hitpoints', 'type' => 'int(11) unsigned'), 'brains' => array('name' => 'brains', 'type' => 'int(11) unsigned'), 'brawn' => array('name' => 'brawn', 'type' => 'int(11) unsigned'), 'briskness' => array('name' => 'briskness', 'type' => 'int(11) unsigned'), 'junglefighter' => array('name' => 'junglefighter', 'type' => 'int(11) unsigned'), 'retreathp' => array('name' => 'retreathp', 'type' => 'int(11) unsigned'), 'key-PRIMARY' => array('name' => 'PRIMARY', 'type' => 'primary key', 'unique' => '1', 'columns' => 'id'));
    require_once "lib/tabledescriptor.php";
    synctable(db_prefix('scrapbots'), $scrapbots, true);
    module_addhook("village");
    module_addhook("newday");
    require_once "modules/staminasystem/lib/lib.php";
    install_action("Scavenging for Scrap", array("maxcost" => 10000, "mincost" => 2500, "firstlvlexp" => 1500, "expincrement" => 1.1, "costreduction" => 75, "class" => "ScrapBots"));
    install_action("Metalworking", array("maxcost" => 10000, "mincost" => 3000, "firstlvlexp" => 1500, "expincrement" => 1.1, "costreduction" => 60, "class" => "ScrapBots"));
    install_action("Soldering", array("maxcost" => 10000, "mincost" => 3000, "firstlvlexp" => 1500, "expincrement" => 1.1, "costreduction" => 60, "class" => "ScrapBots"));
    install_action("Programming", array("maxcost" => 10000, "mincost" => 3000, "firstlvlexp" => 1500, "expincrement" => 1.1, "costreduction" => 60, "class" => "ScrapBots"));
    return true;
}
function staminacorecombat_install()
{
    module_addhook_priority("forest", 0);
    module_addhook("startofround");
    module_addhook("endofround");
    module_addhook_priority("battle", 0);
    install_action("Hunting - Normal", array("maxcost" => 25000, "mincost" => 10000, "firstlvlexp" => 1000, "expincrement" => 1.08, "costreduction" => 150, "class" => "Hunting"));
    install_action("Hunting - Big Trouble", array("maxcost" => 30000, "mincost" => 10000, "firstlvlexp" => 1000, "expincrement" => 1.08, "costreduction" => 200, "class" => "Hunting"));
    install_action("Hunting - Easy Fights", array("maxcost" => 20000, "mincost" => 10000, "firstlvlexp" => 1000, "expincrement" => 1.08, "costreduction" => 100, "class" => "Hunting"));
    install_action("Hunting - Suicidal", array("maxcost" => 35000, "mincost" => 10000, "firstlvlexp" => 1000, "expincrement" => 1.08, "costreduction" => 250, "class" => "Hunting"));
    install_action("Fighting - Standard", array("maxcost" => 2000, "mincost" => 500, "firstlvlexp" => 2000, "expincrement" => 1.1, "costreduction" => 15, "class" => "Combat"));
    install_action("Running Away", array("maxcost" => 1000, "mincost" => 200, "firstlvlexp" => 500, "expincrement" => 1.05, "costreduction" => 8, "class" => "Combat"));
    //triggers when a player loses more than 10% of his total hitpoints in a single round
    install_action("Taking It on the Chin", array("maxcost" => 2000, "mincost" => 200, "firstlvlexp" => 5000, "expincrement" => 1.1, "costreduction" => 15, "class" => "Combat"));
    return true;
}