Esempio n. 1
0
} else {
    if ($update) {
        $sql = "SELECT * FROM  " . RABBITOSHI_GENERAL_TABLE;
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_MESSAGE, $lang['Rabbitoshi_owner_pet_lack']);
        }
        while ($row = $db->sql_fetchrow($result)) {
            $rabbit_general[$row['config_name']] = $row['config_value'];
        }
        $rsql = "SELECT * FROM  " . RABBITOSHI_USERS_TABLE;
        if (!($rresult = $db->sql_query($rsql))) {
            message_die(CRITICAL_ERROR, 'Error Getting users Config!');
        }
        $rrow = $db->sql_fetchrowset($rresult);
        for ($i = 0; $i < count($rrow); $i++) {
            $rabbit_user = rabbitoshi_get_user_stats($rrow[$i]['owner_id']);
            $message = '';
            $pet_dead = FALSE;
            $thought = '';
            $status = 0;
            $hotel_time = $rabbit_user['creature_hotel'] - time();
            if ($hotel_time > 0) {
                $is_in_hotel = TRUE;
            } else {
                $is_in_hotel = FALSE;
            }
            $visit_time = time() - $rabbit_user['owner_last_visit'];
            $hunger_time = floor($visit_time / $rabbit_general['hunger_time']);
            $hunger_less = $hunger_time * $rabbit_general['hunger_value'];
            $thirst_time = floor($visit_time / $rabbit_general['thirst_time']);
            $thirst_less = $thirst_time * $rabbit_general['thirst_value'];
Esempio n. 2
0
function rabbitoshi_get_hotel()
{
    global $db, $view_userdata;
    $rabbit_user = rabbitoshi_get_user_stats($view_userdata['user_id']);
    $hotel_time = $rabbit_user['creature_hotel'] - time();
    // V: first, check if currently in hotel... before doing stupid sql...
    if ($rabbit_user['creature_hotel']) {
        if ($hotel_time > 0) {
            $is_in_hotel = TRUE;
        } else {
            $is_in_hotel = FALSE;
            $sql = " UPDATE " . RABBITOSHI_USERS_TABLE . " \r\n\t\t\t\tSET creature_hotel = 0\r\n\t\t\t\tWHERE owner_id = " . $view_userdata['user_id'];
            if (!($result = $db->sql_query($sql))) {
                message_die(CRITICAL_ERROR, 'Error Getting Rabbitishi Config!');
            }
        }
    } else {
        $is_in_hotel = false;
    }
    return array($is_in_hotel, $hotel_time);
}
Esempio n. 3
0
     if (!$is_in_hotel) {
         $sql = "UPDATE " . RABBITOSHI_USERS_TABLE . "\r\n\t\t\t\tSET creature_hunger = creature_hunger - {$hunger_less} ,\r\n\t\t\t\t    creature_thirst = creature_thirst - {$thirst_less} ,\r\n\t\t\t\t    creature_health = creature_health - {$health_less} ,\r\n\t\t\t\t    creature_hygiene = creature_hygiene - {$hygiene_less} ,\r\n\t\t\t\t    owner_last_visit = " . time() . "\r\n\t\t\t\tWHERE owner_id = {$user_id}";
         if (!$db->sql_query($sql)) {
             message_die(GENERAL_ERROR, '', __LINE__, __FILE__, $sql);
         }
     } else {
         $sql = "UPDATE " . RABBITOSHI_USERS_TABLE . "\r\n\t\t\t\tSET owner_last_visit = " . time() . "\r\n\t\t\t\tWHERE owner_id = {$user_id}";
         if (!$db->sql_query($sql)) {
             message_die(GENERAL_ERROR, '', __LINE__, __FILE__, $sql);
         }
     }
     $rabbit_stats = get_rabbitoshi_config($rabbit_user['owner_creature_id']);
     list($value, $thought, $message, $pet_dead) = rabbitoshi_get_pet_value();
 }
 if ($board_config['rabbitoshi_enable']) {
     $rabbit_user = rabbitoshi_get_user_stats($view_userdata['user_id']);
     $rabbit_stats = get_rabbitoshi_config($rabbit_user['owner_creature_id']);
     list($value, $thought, $message, $pet_dead) = rabbitoshi_get_pet_value();
     if ($pet_dead && $searchid == $user_id) {
         // Rebirth Disabled
         if (!$rabbit_general['evolution_enable']) {
             // rabbitoshi_delete_pet($user_id);
             rabbitoshi_previous(Rabbitoshi_pet_dead, rabbitoshi, '');
         }
         // Rebirth Enabled
         if ($rabbit_general['rebirth_enable'] == 1) {
             if ($points > $rabbit_general['rebirth_price']) {
                 if ($resurrect_ok) {
                     $hunger = $rabbit_user['creature_hunger_max'];
                     $thirst = $rabbit_user['creature_thirst_max'];
                     $health = $rabbit_user['creature_health_max'];