Example #1
0
function wear($who, $itm)
{
    $db = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE login='******'"));
    effects($db["id"], $effect);
    $item_data = mysql_fetch_array(mysql_query("SELECT * FROM inv WHERE owner='" . $who . "' and id='" . $itm . "' and object_razdel='obj' and wear=0"));
    if ($item_data) {
        $i_type = $item_data["object"];
        /*тип предмета*/
        $wearable = 0;
        if ($db["sila"] + $effect["add_sila"] >= $item_data["min_sila"] && $db["lovkost"] + $effect["add_lovkost"] >= $item_data["min_lovkost"] && $db["udacha"] + $effect["add_udacha"] >= $item_data["min_udacha"] && $db["power"] >= $item_data["min_power"] && $db["intellekt"] + $effect["add_intellekt"] >= $item_data["min_intellekt"] && $db["vospriyatie"] >= $item_data["min_vospriyatie"] && $db["level"] >= $item_data["min_level"] && $db["sword_vl"] + $effect["add_sword_vl"] >= $item_data["min_sword_vl"] && $db["staff_vl"] + $effect["add_staff_vl"] >= $item_data["min_staff_vl"] && $db["axe_vl"] + $effect["add_axe_vl"] >= $item_data["min_axe_vl"] && $db["hummer_vl"] + $effect["add_hummer_vl"] >= $item_data["min_fail_vl"] && $db["castet_vl"] + $effect["add_castet_vl"] >= $item_data["min_knife_vl"] && $db["copie_vl"] + $effect["add_copie_vl"] >= $item_data["min_spear_vl"] && $db["water_magic"] + $effect["add_water_magic"] >= $item_data["min_water"] && $db["earth_magic"] + $effect["add_earth_magic"] >= $item_data["min_earth"] && $db["fire_magic"] + $effect["add_fire_magic"] >= $item_data["min_fire"] && $db["air_magic"] + $effect["add_air_magic"] >= $item_data["min_air"]) {
            $wearable = 1;
        }
        if ($item_data["object_type"] == "kostyl") {
            $wearable = 1;
        }
        if ($item_data["iznos"] >= $item_data["iznos_max"]) {
            $wearable = 0;
        }
        if ($db['bs'] == 0 && $item_data["bs"] == 1) {
            $wearable = 0;
        }
        if ($db['bs'] == 1 && $item_data["bs"] == 0) {
            $wearable = 0;
        }
        if ($item_data["second_hand"] == 1) {
            if ($db["two_hand"] == 1) {
                unWear($who, $db["hand_r"]);
                wear($who, $itm);
                die;
            } else {
                if ($db["hand_r_free"] == 1) {
                    $slot = "hand_r";
                } else {
                    if ($db["hand_r_free"] == 0 && $db["hand_l_free"] == 1) {
                        $slot = "hand_l";
                    } else {
                        if ($db["hand_r_free"] == 0 && $db["hand_l_free"] == 0) {
                            unWear($who, $db["hand_r"]);
                            wear($who, $itm);
                            die;
                        }
                    }
                }
            }
            $w_type = $item_data["object_type"];
            /*тип оружия*/
        } else {
            if ($item_data["two_hand"] == 1) {
                if ($db["hand_r_free"] == 1 && $db["hand_l_free"] == 1) {
                    $slot = "hand_r";
                } else {
                    if ($db["hand_r_free"] == 1 && $db["hand_l_free"] == 0) {
                        unWear($who, $db["hand_l"]);
                        wear($who, $itm);
                        die;
                    } else {
                        if ($db["hand_r_free"] == 0 && $db["hand_l_free"] == 1) {
                            unWear($who, $db["hand_r"]);
                            wear($who, $itm);
                            die;
                        } else {
                            if ($db["hand_r_free"] == 0 && $db["hand_l_free"] == 0) {
                                unWear($who, $db["hand_r"]);
                                unWear($who, $db["hand_l"]);
                                wear($who, $itm);
                                die;
                            }
                        }
                    }
                }
                $w_type = $item_data["object_type"];
                /*тип оружия*/
            } else {
                if ($item_data["object_type"] == "sword" || $item_data["object_type"] == "axe" || $item_data["object_type"] == "fail" || $item_data["object_type"] == "spear" || $item_data["object_type"] == "knife" || $item_data["object_type"] == "kostyl") {
                    if ($item_data["second_hand"] == 0) {
                        if ($db["two_hand"] == 1) {
                            unWear($who, $db["hand_r"]);
                            wear($who, $itm);
                            die;
                        } else {
                            if ($db["hand_r_free"] == 0) {
                                unWear($who, $db["hand_r"]);
                                wear($who, $itm);
                                die;
                            } else {
                                $slot = "hand_r";
                            }
                        }
                    }
                    $w_type = $item_data["object_type"];
                    /*тип оружия*/
                } else {
                    if ($item_data["object_type"] == "shield" || $item_data["object_type"] == "amunition") {
                        if ($db["two_hand"] == 1) {
                            unWear($who, $db["hand_r"]);
                            wear($who, $itm);
                            die;
                        } else {
                            if ($db["hand_l_free"] == 1) {
                                $slot = "hand_l";
                            } else {
                                if ($db["hand_l_free"] == 0) {
                                    unWear($who, $db["hand_l"]);
                                    wear($who, $itm);
                                    die;
                                }
                            }
                        }
                        $w_type = $item_data["object_type"];
                        /*тип оружия*/
                    } else {
                        if ($item_data["object_type"] == "ring") {
                            if (!$db["ring1"]) {
                                $slot = "ring1";
                            } else {
                                if (!$db["ring2"]) {
                                    $slot = "ring2";
                                } else {
                                    if (!$db["ring3"]) {
                                        $slot = "ring3";
                                    } else {
                                        unWear($who, $db["ring1"]);
                                        wear($who, $itm);
                                        die;
                                    }
                                }
                            }
                            $wear_type = "paltar";
                        } else {
                            if ($db[$item_data["object_type"]] != 0) {
                                unWear($who, $db[$item_data["object_type"]]);
                                wear($who, $itm);
                                die;
                            }
                            $slot = $item_data["object_type"];
                            /*тип оружия*/
                            $wear_type = "paltar";
                        }
                    }
                }
            }
        }
        if ($item_data["need_orden"] != 0 && $db["orden"] != $item_data["need_orden"]) {
            $_SESSION["message"] = "Ваша склонность не позволяет одеть эту вещь.";
        } else {
            if ($item_data["sex"] != "" && $db["sex"] != $item_data["sex"]) {
                $_SESSION["message"] = "Ваша пол не позволяет одеть эту вещь.";
            } else {
                if ($wearable == 1) {
                    $new_sila = $db["sila"] + $item_data["add_sila"];
                    $new_lovkost = $db["lovkost"] + $item_data["add_lovkost"];
                    $new_udacha = $db["udacha"] + $item_data["add_udacha"];
                    $new_intellekt = $db["intellekt"] + $item_data["add_intellekt"];
                    $new_duxovnost = $db["duxovnost"] + $item_data["add_duxovnost"];
                    $new_phead = $db["bron_head"] + $item_data["protect_head"];
                    $new_parm = $db["bron_arm"] + $item_data["protect_arm"];
                    $new_pcorp = $db["bron_corp"] + $item_data["protect_corp"];
                    $new_ppoyas = $db["bron_poyas"] + $item_data["protect_poyas"];
                    $new_plegs = $db["bron_legs"] + $item_data["protect_legs"];
                    $new_mfkrit = $db["krit"] + $item_data["krit"];
                    $new_mfantikrit = $db["akrit"] + $item_data["akrit"];
                    $new_mfuvorot = $db["uvorot"] + $item_data["uvorot"];
                    $new_mfantiuvorot = $db["auvorot"] + $item_data["auvorot"];
                    $new_wpmin_h = $item_data["min_attack"];
                    $new_wpmax_h = $item_data["max_attack"];
                    if ($slot == "hand_l") {
                        $new_wpmin = $db["hand_l_hitmin"] + $item_data["min_attack"];
                        $new_wpmax = $db["hand_l_hitmax"] + $item_data["max_attack"];
                    } else {
                        if ($slot == "hand_r") {
                            $new_wpmin = $db["hand_r_hitmin"] + $item_data["min_attack"];
                            $new_wpmax = $db["hand_r_hitmax"] + $item_data["max_attack"];
                        }
                    }
                    $new_swordvl = $db["sword_vl"] + $item_data["add_sword_vl"];
                    $new_axevl = $db["axe_vl"] + $item_data["add_axe_vl"];
                    $new_failvl = $db["hummer_vl"] + $item_data["add_fail_vl"];
                    $new_knifevl = $db["castet_vl"] + $item_data["add_knife_vl"];
                    $new_spearvl = $db["copie_vl"] + $item_data["add_spear_vl"];
                    $new_staffvl = $db["staff_vl"] + $item_data["add_staff_vl"];
                    $new_fire = $db["fire_magic"] + $item_data["add_fire"];
                    $new_water = $db["water_magic"] + $item_data["add_water"];
                    $new_air = $db["air_magic"] + $item_data["add_air"];
                    $new_earth = $db["earth_magic"] + $item_data["add_earth"];
                    $new_svet = $db["svet_magic"] + $item_data["add_svet"];
                    $new_tma = $db["tma_magic"] + $item_data["add_tma"];
                    $new_gray = $db["gray_magic"] + $item_data["add_gray"];
                    $protect_rej = $db["protect_rej"] + $item_data["protect_rej"];
                    $protect_drob = $db["protect_drob"] + $item_data["protect_drob"];
                    $protect_kol = $db["protect_kol"] + $item_data["protect_kol"];
                    $protect_rub = $db["protect_rub"] + $item_data["protect_rub"];
                    $protect_fire = $db["protect_fire"] + $item_data["protect_fire"];
                    $protect_water = $db["protect_water"] + $item_data["protect_water"];
                    $protect_air = $db["protect_air"] + $item_data["protect_air"];
                    $protect_earth = $db["protect_earth"] + $item_data["protect_earth"];
                    $protect_svet = $db["protect_svet"] + $item_data["protect_svet"];
                    $protect_tma = $db["protect_tma"] + $item_data["protect_tma"];
                    $protect_gray = $db["protect_gray"] + $item_data["protect_gray"];
                    $protect_mag = $db["protect_mag"] + $item_data["protect_mag"];
                    $protect_udar = $db["protect_udar"] + $item_data["protect_udar"];
                    $shieldblock = $db["shieldblock"] + $item_data["shieldblock"];
                    $parry = $db["parry"] + $item_data["parry"];
                    $counter = $db["counter"] + $item_data["counter"];
                    $add_rej = $db["add_rej"] + $item_data["add_rej"];
                    $add_drob = $db["add_drob"] + $item_data["add_drob"];
                    $add_kol = $db["add_kol"] + $item_data["add_kol"];
                    $add_rub = $db["add_rub"] + $item_data["add_rub"];
                    $add_fire_att = $db["add_fire_att"] + $item_data["add_fire_att"];
                    $add_air_att = $db["add_air_att"] + $item_data["add_air_att"];
                    $add_watet_att = $db["add_watet_att"] + $item_data["add_watet_att"];
                    $add_earth_att = $db["add_earth_att"] + $item_data["add_earth_att"];
                    $ms_udar = $db["ms_udar"] + $item_data["ms_udar"];
                    $ms_krit = $db["ms_krit"] + $item_data["ms_krit"];
                    $ms_mag = $db["ms_mag"] + $item_data["ms_mag"];
                    $ms_fire = $db["ms_fire"] + $item_data["ms_fire"] + $item_data["ms_mag"];
                    $ms_water = $db["ms_water"] + $item_data["ms_water"] + $item_data["ms_mag"];
                    $ms_air = $db["ms_air"] + $item_data["ms_air"] + $item_data["ms_mag"];
                    $ms_earth = $db["ms_earth"] + $item_data["ms_earth"] + $item_data["ms_mag"];
                    $ms_svet = $db["ms_svet"] + $item_data["ms_svet"] + $item_data["ms_mag"];
                    $ms_tma = $db["ms_tma"] + $item_data["ms_tma"] + $item_data["ms_mag"];
                    $ms_gray = $db["ms_gray"] + $item_data["ms_gray"] + $item_data["ms_mag"];
                    $ms_rej = $db["ms_rej"] + $item_data["ms_rej"];
                    $ms_drob = $db["ms_drob"] + $item_data["ms_drob"];
                    $ms_kol = $db["ms_kol"] + $item_data["ms_kol"];
                    $ms_rub = $db["ms_rub"] + $item_data["ms_rub"];
                    $new_cost = $item_data["art"] > 0 ? $item_data["gos_price"] * 20 : $item_data["gos_price"];
                    $proboy = $db["proboy"] + $item_data["proboy"];
                    $add_oruj = $db["add_oruj"] + $item_data["add_oruj"];
                    $new_mana = $db["mana_all"] + $item_data["add_mana"];
                    $new_hp = $db["hp_all"] + $item_data["add_xp"] + $item_data["add_hp"];
                    $now_hp = $db["hp"];
                    $now_mn = $db["mana"];
                    setHP($who, $now_hp, $new_hp);
                    setMN($who, $now_mn, $new_mana);
                    $new_sql = "UPDATE `users` SET sila='{$new_sila}', lovkost='{$new_lovkost}', udacha='{$new_udacha}', intellekt='{$new_intellekt}', duxovnost='{$new_duxovnost}', ";
                    $new_sql .= "hp_all='{$new_hp}', mana_all='{$new_mana}',";
                    $new_sql .= "bron_head='{$new_phead}', bron_corp='{$new_pcorp}', bron_legs='{$new_plegs}', bron_arm='{$new_parm}', bron_poyas='{$new_ppoyas}',";
                    $new_sql .= "{$slot}='" . $item_data["id"] . "', sword_vl='{$new_swordvl}', axe_vl='{$new_axevl}', hummer_vl='{$new_failvl}', castet_vl='{$new_knifevl}', copie_vl='{$new_spearvl}', staff_vl='{$new_staffvl}',";
                    if ($slot == "hand_r") {
                        $new_sql .= "hand_r_type='{$w_type}', hand_r_free='0', hand_r_hitmin='{$new_wpmin}', hand_r_hitmax='{$new_wpmax}',";
                    } else {
                        if ($slot == "hand_l") {
                            $new_sql .= "hand_l_type='{$w_type}', hand_l_free='0', hand_l_hitmin='{$new_wpmin}', hand_l_hitmax='{$new_wpmax}',";
                        }
                    }
                    $new_sql .= "protect_rej='{$protect_rej}', protect_drob='{$protect_drob}', protect_kol='{$protect_kol}', protect_rub='{$protect_rub}', ";
                    $new_sql .= "protect_fire='{$protect_fire}', protect_water='{$protect_water}', protect_air='{$protect_air}', protect_earth='{$protect_earth}', protect_svet='{$protect_svet}', protect_tma='{$protect_tma}', protect_gray='{$protect_gray}', ";
                    $new_sql .= "protect_mag='{$protect_mag}', protect_udar='{$protect_udar}', shieldblock='{$shieldblock}', ";
                    $new_sql .= "parry='{$parry}', counter='{$counter}', ";
                    //$new_sql.="add_rej='$add_rej', add_drob='$add_drob', add_kol='$add_kol', add_rub='$add_rub', ";
                    //$new_sql.="add_fire_att='$add_fire_att', add_air_att='$add_air_att', add_watet_att='$add_watet_att', add_earth_att='$add_earth_att', ";
                    $new_sql .= "ms_udar='{$ms_udar}', ms_krit='{$ms_krit}', ms_mag='{$ms_mag}', ";
                    $new_sql .= "ms_fire='{$ms_fire}', ms_water='{$ms_water}', ms_air='{$ms_air}', ms_earth='{$ms_earth}', ms_svet='{$ms_svet}', ms_tma='{$ms_tma}', ms_gray='{$ms_gray}', ";
                    $new_sql .= "ms_rej='{$ms_rej}', ms_drob='{$ms_drob}', ms_kol='{$ms_kol}', ms_rub='{$ms_rub}', ";
                    $new_sql .= "proboy='{$proboy}', add_oruj='{$add_oruj}', ";
                    $new_sql .= "krit='{$new_mfkrit}', akrit='{$new_mfantikrit}', uvorot='{$new_mfuvorot}', auvorot='{$new_mfantiuvorot}', ";
                    $new_sql .= "fire_magic='{$new_fire}', water_magic='{$new_water}', air_magic='{$new_air}', earth_magic='{$new_earth}', ";
                    $new_sql .= "svet_magic='{$new_svet}',tma_magic='{$new_tma}',gray_magic='{$new_gray}',";
                    $new_sql .= $wear_type != "paltar" ? "two_hand=" . $item_data["two_hand"] . "," : "";
                    $new_sql .= "cost=cost+{$new_cost}";
                    $new_sql .= " WHERE login='******'";
                    mysql_query($new_sql);
                    mysql_query("UPDATE `inv` SET wear=1,slot='" . $slot . "' WHERE id='" . $itm . "'");
                }
            }
        }
    }
    $now = md5(time());
    Header("Location: main.php?act=inv&otdel=obj&tmp={$now}");
}
Example #2
0
File: inv.php Project: ehmedov/www
    $mass_style = "color=#ff0000";
    if ($db["movable"]) {
        mysql_query("UPDATE users SET movable='0' WHERE login='******'");
        $_SESSION["message"] = "Вы перегружены и не можете перемещаться...";
    }
} else {
    $mass_style = "";
    if (!$db["movable"]) {
        mysql_query("UPDATE users SET movable='1' WHERE login='******'");
        $_SESSION["message"] = "Вы больше не перегружены...";
    }
}
##############################################################################################
if ($_GET["wear"] && !$db["battle"] && !$db["zayavka"] && is_numeric($_GET["wear"])) {
    if ($db["room"] != "smert_room" && $db["room"] != "house" && $db["room"] != "zadaniya") {
        wear($login, $_GET["wear"]);
    } else {
        $_SESSION["message"] = "В этой комнате невозможно одеватся";
    }
}
if ($_GET["unwear"] && !$db["battle"] && !$db["zayavka"] && is_numeric($_GET["unwear"])) {
    if ($db["room"] != "smert_room" && $db["room"] != "house" && $db["room"] != "zadaniya") {
        unWear($login, $_GET["unwear"]);
    }
}
if ($_GET["act"] == "unwear_full" && !$db["battle"] && $db["room"] != "house") {
    unwear_full($login);
}
##############################################################################################
if ($_GET["act"] == "addToSlot" && !$db["battle"] && is_numeric($_GET['id']) && $db["room"] != "house") {
    set_svitok($db, $_GET['id']);
Example #3
0
$count = count($all_people);
$lucky = $all_people[rand(1, $count) - 1];
echo "<b style=color:#ff0000>{$msg} &nbsp;</b>";
echo "<TABLE WIDTH=100% CELLSPACING=1 CELLPADDING=3 BGCOLOR=#212120>\n\t<tr bgcolor=#504F4C>\n\t<td align='center'><b style=color:#ffffff>В комнате разбросаны вещи</b></td>\n\t<td align='center'><b style=color:#ffffff>Ваши координаты в игре ({$db['bs_x']},{$db['bs_y']})</b></td>\n\t<td align='center'><b style=color:#ffffff>Нападенние и прочее</b></td>\n\t</tr>\n     <tr bgcolor=#D5D5D5>\n         <td width=300 nowrap valign=top align=center height=150>";
$room = $db[room];
if ($_GET['do'] == "get" && is_numeric($_GET[id])) {
    $id = (int) $_GET[id];
    $b_s = mysql_num_rows(mysql_query("SELECT * FROM bs_objects WHERE bs_id={$id} and bs=0"));
    if ($b_s) {
        $bs_obj = mysql_fetch_array(mysql_query("SELECT id,object,name,iznos_max FROM paltar WHERE id={$id}"));
        if ($bs_obj) {
            mysql_query("INSERT INTO inv(owner,object_id,object_type,object_razdel,wear,iznos,iznos_max,noremont) VALUES ('{$login}','{$bs_obj['id']}','{$bs_obj['object']}','obj','0','0','{$bs_obj['iznos_max']}','1')");
            $itm_id = mysql_insert_id();
            mysql_query("UPDATE bs_objects SET bs=1 where bs_id={$id}");
            say($login, "Вы успешно подобрали этот предмет <b>{$bs_obj['name']}</b>", $login);
            wear($who, $itm_id);
            Header("Location: ?tmp={$now}");
        }
    } else {
        echo "<b style=color:#ff0000>Кто то оказался быстрее...</b>";
    }
}
$rand = rand(0, 10);
#выбираеш диапазон рандома
if ($_GET[go]) {
    if ($rand == 5) {
        $bs_obj_sel = mysql_query("SELECT bs_id FROM bs_objects where bs=0");
        while ($k = mysql_fetch_array($bs_obj_sel)) {
            $arr[] = $k[bs_id];
        }
        $item = (int) $arr[rand(0, count($arr) - 1)];
Example #4
0
if ($act == "otchet") {
    include_once "otchet.php";
}
if ($act == "inv" && !$db["battle"] && $db["room"] != "house") {
    include_once "inv.php";
    die;
}
if ($act == "addToSlot" && !$db["battle"] && is_numeric($_GET['id']) && $db["room"] != "house") {
    set_svitok($db, $_GET['id']);
}
if ($act == "setdown_svitok" && !$db["battle"] && is_numeric($_GET['id']) && is_numeric($_GET['slot']) && $db["room"] != "house") {
    setdown_svitok($db, $_GET['slot'], $_GET['id']);
}
if ($act == "wear" && !$db["battle"] && !$db["zayavka"] && is_numeric($_GET['item_id'])) {
    if ($db["room"] != "smert_room" && $db["room"] != "house" && $db["room"] != "zadaniya") {
        wear($_SESSION["login"], $_GET['item_id']);
    } else {
        $_SESSION["message"] = "В этой комнате невозможно одеватся";
        Header("Location: main.php?act=inv");
    }
}
if ($act == "unwear" && !$db["battle"] && !$db["zayavka"] && is_numeric($_GET['item_id'])) {
    if ($db["room"] != "smert_room" && $db["room"] != "house" && $db["room"] != "zadaniya") {
        unWear($_SESSION["login"], $_GET['item_id']);
    } else {
        Header("Location: main.php?act=inv");
    }
}
if ($act == "unwear_full" && !$db["battle"] && $db["room"] != "house") {
    unwear_full($_SESSION["login"]);
}
Example #5
0
File: inv.php Project: ehmedov/www
                wear($login, $kompl['helmet']);
            }
            if ($kompl['mask']) {
                wear($login, $kompl['mask']);
            }
            if ($kompl['naruchi']) {
                wear($login, $kompl['naruchi']);
            }
            if ($kompl['perchi']) {
                wear($login, $kompl['perchi']);
            }
            if ($kompl['boots']) {
                wear($login, $kompl['boots']);
            }
            if ($kompl['pants']) {
                wear($login, $kompl['pants']);
            }
        }
    } else {
        $_SESSION["message"] = "В этой комнате невозможно одеватся...";
    }
}
//------------------------------ Удалить комплект --------------------------------------------------------------
if ($_GET['delete'] == 'deletecomplect' && is_numeric($_GET['id'])) {
    $com = mysql_query("SELECT * FROM complect WHERE id='" . $_GET['id'] . "' and owner='" . $login . "'");
    if (!mysql_num_rows($com)) {
        $_SESSION["message"] = "Комплект не найден!";
    } else {
        $comm = mysql_fetch_array($com);
        mysql_query("DELETE FROM complect WHERE id='" . $_GET['id'] . "' and owner='" . $login . "'");
        $_SESSION["message"] = "Комплект '" . $comm['complect_name'] . "' удален!";