function commentaryicons_customrace_install()
{
    module_addhook_priority("postcomment", 100);
    module_addhook("lodge");
    module_addhook("pointsdesc");
    return true;
}
function marriage_install()
{
    if (!is_module_active('marriage')) {
        output_notl("`n`c`b`QMarriage Module - Installed`0`b`c");
    } else {
        output_notl("`n`c`b`QMarriage Module - Updated`0`b`c");
    }
    module_addhook("drinks-text");
    module_addhook("drinks-check");
    module_addhook("moderate");
    module_addhook("newday");
    module_addhook("changesetting");
    module_addhook_priority("footer-inn", 1);
    module_addhook("village");
    module_addhook("footer-hof");
    module_addhook("superuser");
    module_addhook("footer-oldchurch");
    module_addhook("footer-gardens");
    module_addhook("delete_character");
    //module_addhook("charstats");
    module_addhook("faq-toc");
    module_addhook("biostat");
    module_addhook("allprefs");
    module_addhook("allprefnavs");
    if ($SCRIPT_NAME == "modules.php") {
        $module = httpget("module");
        if ($module == "marriage") {
            require_once "modules/marriage/lovedrinks.php";
            marriage_lovedrinks();
        }
    }
    return true;
}
function iitems_edibles_install()
{
    module_addhook_priority("iitems-use-item", 1);
    module_addhook("iitems-inventory");
    module_addhook("iitems-superuser");
    module_addhook("iitems-use-item-after");
    return true;
}
function tynan_install()
{
    module_addhook("village");
    module_addhook_priority("newday", 10);
    module_addhook("changesetting");
    module_addhook("pvpadjust");
    module_addhook("adjuststats");
    return true;
}
function uniqueforests_install()
{
    module_addhook_priority("village", 20);
    module_addhook("header-forest");
    module_addhook("footer-forest");
    module_addhook("forest-desc");
    module_addhook("collect-events");
    return true;
}
function avatar_install()
{
    module_addhook("lodge");
    module_addhook("pointsdesc");
    module_addhook("superuser");
    module_addhook("header-superuser");
    // Let's get our hook at the top.
    module_addhook_priority("biotop", 5);
    //for normal display
    module_addhook_priority("bioinfo", 50);
    return true;
}
function pvpimmunity_install()
{
    module_addhook_priority("pvpwarning", 20);
    module_addhook_priority("pvpmodifytargets", 100);
    module_addhook("heidi-end");
    module_addhook("dragonkill");
    module_addhook("village");
    module_addhook("checkuserpref");
    module_addhook("process-create");
    module_addhook("notifyuserprefchange");
    module_addhook("header-inn");
    return true;
}
function clanbuffs_install()
{
    include_once "modules/clanbuffs/clanbuffs_func.php";
    remake_costs();
    module_addhook("footer-hof");
    module_addhook("footer-clan");
    module_addhook_priority("village", 49);
    module_addhook_priority("forest", 49);
    module_addhook_priority("clanhall", 49);
    module_addhook("newday");
    module_addhook("changesetting");
    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;
}
function strangerintro_install()
{
    module_addhook("forest");
    module_addhook_priority("prerender", 100);
    return true;
}
<?php

if (!is_array(unserialize(get_module_setting("actionsarray")))) {
    set_module_setting("actionsarray", serialize(array()), "staminasystem");
}
module_addhook_priority("charstats", 99);
module_addhook("superuser");
module_addhook_priority("newday", 99);
module_addhook("dragonkill");
function clanmembercap_install()
{
    module_addhook_priority("header-clan", 100);
    module_addhook("footer-clan");
    return true;
}
function extrarandom_install()
{
    module_addhook_priority("choosebadguy", 10);
    return true;
}
function commentaryicons_donation_install()
{
    module_addhook_priority("postcomment", 20);
    module_addhook("commentbuffer");
    return true;
}
function hunterslodge_customrace_install()
{
    module_addhook_priority("postcomment", 100);
    return true;
}
function petitionfixnavs_install()
{
    module_addhook_priority("footer-viewpetition");
    return true;
}
function timeandweather_outposts_install()
{
    module_addhook_priority("villagetext", 100);
    return true;
}
    if ($session['user']['superuser'] & ~SU_DOESNT_GIVE_GROTTO) {
        output_notl("`4Updating dwellings Module: dwitems.`n");
    }
}
/*
 * TYPE
 * 0 = charm
 * 1 = gold
 * 2 = gem
 * 3 = hp
 * 4 = maxhp
 * 5 = favor
 * 6 = turn
 * 7 = script
 */
$dwitems = array('itemid' => array('name' => 'itemid', 'type' => 'int unsigned'), 'name' => array('name' => 'name', 'type' => 'varchar(50)'), 'type' => array('name' => 'type', 'type' => 'int unsigned'), 'amount' => array('name' => 'amount', 'type' => 'int'), 'chance' => array('name' => 'chance', 'type' => 'int unsigned'), 'goldcost' => array('name' => 'goldcost', 'type' => 'int unsigned'), 'gemcost' => array('name' => 'gemcost', 'type' => 'int unsigned'), 'mindk' => array('name' => 'mindk', 'type' => 'varchar(50)'), 'newdaytext' => array('name' => 'newdaytext', 'type' => 'varchar(200)', 'null' => '1'), 'dwellingtext' => array('name' => 'dwellingtext', 'type' => 'varchar(200)', 'null' => '1'), 'dwellingtextplural' => array('name' => 'dwellingtextplural', 'type' => 'varchar(200)', 'null' => '1'), 'key-PRIMARY' => array('name' => 'PRIMARY', 'type' => 'primary key', 'unique' => '1', 'columns' => 'itemID'));
$dwellingsitems = array('itemid' => array('name' => 'itemid', 'type' => 'int unsigned'), 'dwid' => array('name' => 'dwid', 'type' => 'int unsigned'), 'quantity' => array('quantity' => 'dwid', 'type' => 'int unsigned'));
synctable(db_prefix('dwitems'), $dwitems, true);
synctable(db_prefix('dwellingsitems'), $dwellingsitems, true);
$sql = "SELECT itemid FROM " . db_prefix("dwitems");
$result = db_query($sql);
if (db_num_rows($result) == 0) {
    $sql = "INSERT INTO " . db_prefix("dwitems") . " VALUES (0, 'ming vase', 0, 1, 10, 200, 2, 1, '`3Violet comes for a visit and sees your ming vase. She is impressed by your taste in foreign art.`n', '`2A ming vase is standing in the corner.`0`n', '`2Nicely arranged across the room are %s ming vases.`0`n')";
    db_query($sql);
    $sql = "INSERT INTO " . db_prefix("dwitems") . " VALUES (1, 'pillow', 3, 5, 10, 50, 0, 0, '`4Your pillow felt very fluffy last night. You feel well rested.`n', '`2On the bed lies a small pillow.`0`n', '`2The bed is cushioned with %s pillows`0`n')";
    db_query($sql);
}
module_addhook("village");
module_addhook_priority("newday", 10);
module_addhook("dwellings-inside");
module_addhook("superuser");
function nicecomments_install()
{
    module_addhook_priority("commentary", 25);
    return true;
}
function commentarycommands_flavour_install()
{
    module_addhook_priority("commentarycommand", 100);
    return true;
}
function commentaryicons_physdesc_install()
{
    module_addhook_priority("postcomment", 50);
    module_addhook("commentbuffer");
    return true;
}
function reqmultiplier_install()
{
    module_addhook("creatureencounter");
    module_addhook_priority("newday", 0);
    return true;
}
function viewcommentaryargs_install()
{
    module_addhook('blockcommentarea');
    module_addhook_priority('viewcommentary', '1');
    return true;
}
function commentaryicons_avatar_install()
{
    module_addhook_priority("postcomment", 25);
    return true;
}
/**
 * Called by modules to register themselves for a game module hook point, with default priority.
 * Modules with identical priorities will execute alphabetically.  Modules can only have one hook on a given hook name,
 * even if they call this function multiple times, unless they specify different values for the functioncall argument.
 *
 * @param string $hookname The hook to receive a notification for
 * @param string $functioncall The function that should be called, if not specified, use {modulename}_dohook() as the function
 * @param string $whenactive An expression that should be evaluated before triggering the event, if not specified, none.
 */
function module_addhook($hookname, $functioncall = false, $whenactive = false)
{
    module_addhook_priority($hookname, 50, $functioncall, $whenactive);
}
		'statdrinksprofit'=>array('name'=>'statdrinksprofit', 'type'=>'int unsigned', 'default'=>'0'),
		'statrooms'=>array('name'=>'statrooms', 'type'=>'int unsigned', 'default'=>'0'),
		'statmeals'=>array('name'=>'statmeals', 'type'=>'int unsigned', 'default'=>'0'),
		'statdrinks'=>array('name'=>'statdrinks', 'type'=>'int unsigned', 'default'=>'0'),
		'statmealsbought'=>array('name'=>'statmealsbought', 'type'=>'int unsigned', 'default'=>'0'),
		'statticks'=>array('name'=>'statticks', 'type'=>'int unsigned', 'default'=>'0'),
		'key-PRIMARY'=>array('name'=>'PRIMARY', 'type'=>'primary key',	'unique'=>'1', 'columns'=>'dwid'),
		'index-dwid'=>array('name'=>'dwid', 'type'=>'index', 'columns'=>'dwid')
	);
	
	synctable(db_prefix('dwinns'), $dwinns, true);
	
	module_addhook("village");
	module_addhook("newday");
	module_addhook("newday-runonce");
	module_addhook_priority("dwellings",100);
	module_addhook("dwellings-inside");
	module_addhook("dwellings-manage");
	module_addhook("dwellings-list-type");
	module_addhook("dwellings-list-interact");
	module_addhook("dragonkill");
	module_addhook("dwellings-addsleepers");
	
	if (!is_module_active('dwinns')){
		$sql="SELECT module FROM ".db_prefix("dwellingtypes")." WHERE module='dwinns'";
		$res=db_query($sql);
		if(db_num_rows($res)==0){
			$sql = "INSERT INTO ".db_prefix("dwellingtypes")." (module) VALUES ('dwinns')";
			db_query($sql);
		}
	}