[Help] Max stats 65535

ludlud

Active Member
Joined
Jun 27, 2008
Messages
917
Reaction score
101
искам да ви попитам как да направя в сайта когато дигнат над 32767 статса да не се реска а да се запазва и да могат да дигат само до 65к ? мууеб 0.8
 
http://darksteam.net/showthread.php?t=4946 Това ли е темата и обяснете на BG какво трябва да се направи защото нещо не мога да го разбере напълно ...
 
Last edited:
За addstats ли става на въпрос?

PHP:
    function add_stats($name)
    {
        if ((isset($_SESSION['pass'])) && (isset($_SESSION['user'])))
            ;
        {

            
            require ("config.php");
            require ("includes/validate.class.php");
            $login = stripslashes($_SESSION['user']);
            $vitality = stripslashes($_POST['vitality']);
            $strength = stripslashes($_POST['strength']);
            $energy = stripslashes($_POST['energy']);
            $dexterity = stripslashes($_POST['agility']);

            $login = str_replace(";", "", $login);
            $vitality = str_replace(";", "", $vitality);
            $strength = str_replace(";", "", $strength);
            $energy = str_replace(";", "", $energy);
            $dexterity = str_replace(";", "", $dexterity);

            $login = str_replace("drop", "", $login);
            $vitality = str_replace("drop", "", $vitality);
            $strength = str_replace("drop", "", $strength);
            $energy = str_replace("drop", "", $energy);
            $dexterity = str_replace("drop", "", $dexterity);

            $login = str_replace("shutdown", "", $login);
            $vitality = str_replace("shutdown", "", $vitality);
            $strength = str_replace("shutdown", "", $strength);
            $energy = str_replace("shutdown", "", $energy);
            $dexterity = str_replace("shutdown", "", $dexterity);


            $sql_online_check = $db->Execute("SELECT ConnectStat FROM MEMB_STAT WHERE memb___id=?",
                array($login));
            $row2 = $sql_online_check->fetchrow();

            $result = $db->Execute("select Vitality,Strength,Energy,Dexterity,LevelUpPoint from Character WHERE Name=?",
                array($name));
            $row = $result->fetchrow();

            $result2 = $db->Execute("select LevelUpPoint from Character WHERE Name=?", array
                ($name));
            $points = $result2->fetchrow();

            $new_vit = fix_stats($row[0]) + $vitality;
            $new_str = fix_stats($row[1]) + $strength;
            $new_eng = fix_stats($row[2]) + $energy;
            $new_agi = fix_stats($row[3]) + $dexterity;
            $row[4] = fix_stats($row[4]) - $vitality - $strength - $energy - $dexterity;


            if (fix_stats($new_vit) > "65000" or fix_stats($new_str) > "65000" or fix_stats($new_eng) > "65000" or fix_stats($new_agi) >
                "65000")
            {
                echo "You can't add more than 65000 points";
            }
            else
            {

                $elems[] = array('name' => 'vitality', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Vitality: Digits Only Please dont go over 32500</font> ' .
                    $warning_end . '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' =>
                    'digit');
                $elems[] = array('name' => 'energy', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Energy: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32600, 'cont' => 'digit');
                $elems[] = array('name' => 'agility', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Agility: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' => 'digit');
                $elems[] = array('name' => 'strength', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Strength: Digits Only Please dont go over 32500</font> ' .
                    $warning_end . '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' =>
                    'digit');

                $f = new FormValidator($elems);
                $err = $f->validate($_POST);

                if ($err === true)
                {

                    $valid = $f->getValidElems();

                    foreach ($valid as $k => $v)
                    {

                        if ($valid[$k][0][1] == false)
                        {

                            if (empty($valid[$k][0][2]))
                            {

                                show_error($valid[$k][0][2]);
                            }
                            else
                            {
                                show_error($valid[$k][0][2]);
                            }
                        }
                    }

                }
                else
                {

                    if ($row2[0] != 0)
                    {
                        $error = 1;
                        show_error("$warning_start Character $name Is Online, Must Be Logged Off! $warning_end");
                    }

                    if ($row[4] < 0)
                    {
                        $error = 1;
                        show_error("$warning_start $name Don't Have Enough Points (Currently: $points[0])! $warning_end");
                    }


                    if ($error != 1)
                    {
                        $add_stats = $db->Execute("UPDATE Character SET [Vitality]='".fix_stats($new_vit)."',[Strength]='".fix_stats($new_str)."',[Energy]='".fix_stats($new_eng)."',[Dexterity]='".fix_stats($new_agi)."',[LevelUpPoint]='".fix_stats($row[4])."' WHERE Name =?",
                            array($name));
                        show_error("$ok_start Stats SuccessFully Added!<br>Points Left To Add: $row[4]  $ok_end");


                        $logfile = 'logs/stats_logs.php';
                        $ip = $_SERVER['REMOTE_ADDR'];
                        $date = date('Y-m-d H:i');
                        $data = "Character $_POST[character] Has Been <font color=#FF0000>Updated</font> Stats with the next ->Strength:$new_str|Agiltiy:$new_agi|Vitality:$new_vit|Energy:$new_eng,Levelup Points Left:$row[4] All Those On $date By ip:$ip \n";

                        $fp = fopen($logfile, 'a');
                        fputs($fp, $data);
                        fclose($fp);
                    }

                }

            }
        }

    }


    function add_stats_dl($name)
    {
        if ((isset($_SESSION['pass'])) && (isset($_SESSION['user'])))
            ;
        {
            require ("config.php");
            require ("includes/validate.class.php");

            $login = stripslashes($_SESSION['user']);
            $vitality = stripslashes($_POST['vitality']);
            $strength = stripslashes($_POST['strength']);
            $energy = stripslashes($_POST['energy']);
            $dexterity = stripslashes($_POST['agility']);
            $command = stripslashes($_POST['command']);


            $login = str_replace(";", "", $login);
            $vitality = str_replace(";", "", $vitality);
            $strength = str_replace(";", "", $strength);
            $energy = str_replace(";", "", $energy);
            $dexterity = str_replace(";", "", $dexterity);
            $command = str_replace(";", "", $command);

            $login = str_replace("drop", "", $login);
            $vitality = str_replace("drop", "", $vitality);
            $strength = str_replace("drop", "", $strength);
            $energy = str_replace("drop", "", $energy);
            $dexterity = str_replace("drop", "", $dexterity);
            $command = str_replace("drop", "", $command);

            $login = str_replace("shutdown", "", $login);
            $vitality = str_replace("shutdown", "", $vitality);
            $strength = str_replace("shutdown", "", $strength);
            $energy = str_replace("shutdown", "", $energy);
            $dexterity = str_replace("shutdown", "", $dexterity);
            $command = str_replace("shutdown", "", $command);

            $sql_online_check = $db->Execute("SELECT ConnectStat FROM MEMB_STAT WHERE memb___id=?",
                array($login));
            $row2 = $sql_online_check->fetchrow();

            $result = $db->Execute("select vitality,strength,energy,dexterity,levelupPoint,leadership from Character WHERE Name=?",
                array($name));
            $row = $result->fetchrow();

            $result2 = $db->Execute("select LevelUpPoint from Character WHERE Name=?", array
                ($name));
            $points = $result2->fetchrow();

            $new_vit = $row[0] + $vitality;
            $new_str = $row[1] + $strength;
            $new_eng = $row[2] + $energy;
            $new_agi = $row[3] + $dexterity;

            $new_command = $row[5] + $command;
            $row[4] = $row[4] - $vitality - $strength - $energy - $dexterity - $command;

            if ($new_vit > "65000" or $new_str > "65000" or $new_eng > "65000" or $new_agi >
                "65000" or $new_command > "65000")
            {
                echo "You can't add more than 65000 points!";
            }
            else
            {


                $elems[] = array('name' => 'vitality', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Vitality: Digits Only Please dont go over 32500</font> ' .
                    $warning_end . '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' =>
                    'digit');
                $elems[] = array('name' => 'energy', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Energy: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32600, 'cont' => 'digit');
                $elems[] = array('name' => 'agility', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Agility: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' => 'digit');
                $elems[] = array('name' => 'strength', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Strength: Digits Only Please dont go over 32500</font> ' .
                    $warning_end . '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' =>
                    'digit');
                $elems[] = array('name' => 'command', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Command: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' => 'digit');

                $f = new FormValidator($elems);
                $err = $f->validate($_POST);

                if ($err === true)
                {

                    $valid = $f->getValidElems();

                    foreach ($valid as $k => $v)
                    {

                        if ($valid[$k][0][1] == false)
                        {

                            if (empty($valid[$k][0][2]))
                            {

                                show_error($valid[$k][0][2]);
                            }
                            else
                            {
                                show_error($valid[$k][0][2]);
                            }
                        }
                    }

                }
                else
                {


                    if ($row2[0] != 0)
                    {
                        $error = 1;
                        show_error("$warning_start Character $name Is Online, Must Be Logged Off! $warning_end");
                    }


                    if ($row[4] < 0)
                    {
                        $error = 1;
                        show_error("$warning_start $name Don't Have Enough Points (Currently: $points[0])! $warning_end");
                    }


                    if ($error != 1)
                    {
                        $add_stats = $db->Execute("UPDATE Character SET [Vitality]='$new_vit',[Strength]='$new_str',[Energy]='$new_eng',[Dexterity]='$new_agi',[leadership]='$new_command',[LevelUpPoint]='$row[4]' WHERE Name =?",
                            array($name));
                        show_error("$ok_start Stats SuccessFully Added!<br>Points Left To Add: $row[4]  $ok_end");


                        $logfile = 'logs/stats_logs.php';
                        $ip = $_SERVER['REMOTE_ADDR'];
                        $date = date('Y-m-d H:i');
                        $data = "Character $_POST[character] Has Been <font color=#FF0000>Updated</font> Stats with the next ->Strength:$new_str|Agiltiy:$new_agi|Vitality:$new_vit|Energy:$new_eng|Command:$new_command,Levelup Points Left:$row[4] All Those On $date By ip:$ip \n";

                        $fp = fopen($logfile, 'a');
                        fputs($fp, $data);
                        fclose($fp);
                    }

                }

            }
        }

    }

И сложи в index-a някъде...
PHP:
function fix_stats($value)
{
if($value < 0) { $value = 32768*2+$value; }
return $value;
}
 
За addstats ли става на въпрос?

PHP:
    function add_stats($name)
    {
        if ((isset($_SESSION['pass'])) && (isset($_SESSION['user'])))
            ;
        {

            
            require ("config.php");
            require ("includes/validate.class.php");
            $login = stripslashes($_SESSION['user']);
            $vitality = stripslashes($_POST['vitality']);
            $strength = stripslashes($_POST['strength']);
            $energy = stripslashes($_POST['energy']);
            $dexterity = stripslashes($_POST['agility']);

            $login = str_replace(";", "", $login);
            $vitality = str_replace(";", "", $vitality);
            $strength = str_replace(";", "", $strength);
            $energy = str_replace(";", "", $energy);
            $dexterity = str_replace(";", "", $dexterity);

            $login = str_replace("drop", "", $login);
            $vitality = str_replace("drop", "", $vitality);
            $strength = str_replace("drop", "", $strength);
            $energy = str_replace("drop", "", $energy);
            $dexterity = str_replace("drop", "", $dexterity);

            $login = str_replace("shutdown", "", $login);
            $vitality = str_replace("shutdown", "", $vitality);
            $strength = str_replace("shutdown", "", $strength);
            $energy = str_replace("shutdown", "", $energy);
            $dexterity = str_replace("shutdown", "", $dexterity);


            $sql_online_check = $db->Execute("SELECT ConnectStat FROM MEMB_STAT WHERE memb___id=?",
                array($login));
            $row2 = $sql_online_check->fetchrow();

            $result = $db->Execute("select Vitality,Strength,Energy,Dexterity,LevelUpPoint from Character WHERE Name=?",
                array($name));
            $row = $result->fetchrow();

            $result2 = $db->Execute("select LevelUpPoint from Character WHERE Name=?", array
                ($name));
            $points = $result2->fetchrow();

            $new_vit = fix_stats($row[0]) + $vitality;
            $new_str = fix_stats($row[1]) + $strength;
            $new_eng = fix_stats($row[2]) + $energy;
            $new_agi = fix_stats($row[3]) + $dexterity;
            $row[4] = fix_stats($row[4]) - $vitality - $strength - $energy - $dexterity;


            if (fix_stats($new_vit) > "65000" or fix_stats($new_str) > "65000" or fix_stats($new_eng) > "65000" or fix_stats($new_agi) >
                "65000")
            {
                echo "You can't add more than 65000 points";
            }
            else
            {

                $elems[] = array('name' => 'vitality', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Vitality: Digits Only Please dont go over 32500</font> ' .
                    $warning_end . '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' =>
                    'digit');
                $elems[] = array('name' => 'energy', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Energy: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32600, 'cont' => 'digit');
                $elems[] = array('name' => 'agility', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Agility: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' => 'digit');
                $elems[] = array('name' => 'strength', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Strength: Digits Only Please dont go over 32500</font> ' .
                    $warning_end . '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' =>
                    'digit');

                $f = new FormValidator($elems);
                $err = $f->validate($_POST);

                if ($err === true)
                {

                    $valid = $f->getValidElems();

                    foreach ($valid as $k => $v)
                    {

                        if ($valid[$k][0][1] == false)
                        {

                            if (empty($valid[$k][0][2]))
                            {

                                show_error($valid[$k][0][2]);
                            }
                            else
                            {
                                show_error($valid[$k][0][2]);
                            }
                        }
                    }

                }
                else
                {

                    if ($row2[0] != 0)
                    {
                        $error = 1;
                        show_error("$warning_start Character $name Is Online, Must Be Logged Off! $warning_end");
                    }

                    if ($row[4] < 0)
                    {
                        $error = 1;
                        show_error("$warning_start $name Don't Have Enough Points (Currently: $points[0])! $warning_end");
                    }


                    if ($error != 1)
                    {
                        $add_stats = $db->Execute("UPDATE Character SET [Vitality]='".fix_stats($new_vit)."',[Strength]='".fix_stats($new_str)."',[Energy]='".fix_stats($new_eng)."',[Dexterity]='".fix_stats($new_agi)."',[LevelUpPoint]='".fix_stats($row[4])."' WHERE Name =?",
                            array($name));
                        show_error("$ok_start Stats SuccessFully Added!<br>Points Left To Add: $row[4]  $ok_end");


                        $logfile = 'logs/stats_logs.php';
                        $ip = $_SERVER['REMOTE_ADDR'];
                        $date = date('Y-m-d H:i');
                        $data = "Character $_POST[character] Has Been <font color=#FF0000>Updated</font> Stats with the next ->Strength:$new_str|Agiltiy:$new_agi|Vitality:$new_vit|Energy:$new_eng,Levelup Points Left:$row[4] All Those On $date By ip:$ip \n";

                        $fp = fopen($logfile, 'a');
                        fputs($fp, $data);
                        fclose($fp);
                    }

                }

            }
        }

    }


    function add_stats_dl($name)
    {
        if ((isset($_SESSION['pass'])) && (isset($_SESSION['user'])))
            ;
        {
            require ("config.php");
            require ("includes/validate.class.php");

            $login = stripslashes($_SESSION['user']);
            $vitality = stripslashes($_POST['vitality']);
            $strength = stripslashes($_POST['strength']);
            $energy = stripslashes($_POST['energy']);
            $dexterity = stripslashes($_POST['agility']);
            $command = stripslashes($_POST['command']);


            $login = str_replace(";", "", $login);
            $vitality = str_replace(";", "", $vitality);
            $strength = str_replace(";", "", $strength);
            $energy = str_replace(";", "", $energy);
            $dexterity = str_replace(";", "", $dexterity);
            $command = str_replace(";", "", $command);

            $login = str_replace("drop", "", $login);
            $vitality = str_replace("drop", "", $vitality);
            $strength = str_replace("drop", "", $strength);
            $energy = str_replace("drop", "", $energy);
            $dexterity = str_replace("drop", "", $dexterity);
            $command = str_replace("drop", "", $command);

            $login = str_replace("shutdown", "", $login);
            $vitality = str_replace("shutdown", "", $vitality);
            $strength = str_replace("shutdown", "", $strength);
            $energy = str_replace("shutdown", "", $energy);
            $dexterity = str_replace("shutdown", "", $dexterity);
            $command = str_replace("shutdown", "", $command);

            $sql_online_check = $db->Execute("SELECT ConnectStat FROM MEMB_STAT WHERE memb___id=?",
                array($login));
            $row2 = $sql_online_check->fetchrow();

            $result = $db->Execute("select vitality,strength,energy,dexterity,levelupPoint,leadership from Character WHERE Name=?",
                array($name));
            $row = $result->fetchrow();

            $result2 = $db->Execute("select LevelUpPoint from Character WHERE Name=?", array
                ($name));
            $points = $result2->fetchrow();

            $new_vit = $row[0] + $vitality;
            $new_str = $row[1] + $strength;
            $new_eng = $row[2] + $energy;
            $new_agi = $row[3] + $dexterity;

            $new_command = $row[5] + $command;
            $row[4] = $row[4] - $vitality - $strength - $energy - $dexterity - $command;

            if ($new_vit > "65000" or $new_str > "65000" or $new_eng > "65000" or $new_agi >
                "65000" or $new_command > "65000")
            {
                echo "You can't add more than 65000 points!";
            }
            else
            {


                $elems[] = array('name' => 'vitality', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Vitality: Digits Only Please dont go over 32500</font> ' .
                    $warning_end . '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' =>
                    'digit');
                $elems[] = array('name' => 'energy', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Energy: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32600, 'cont' => 'digit');
                $elems[] = array('name' => 'agility', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Agility: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' => 'digit');
                $elems[] = array('name' => 'strength', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Strength: Digits Only Please dont go over 32500</font> ' .
                    $warning_end . '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' =>
                    'digit');
                $elems[] = array('name' => 'command', 'label' => '' . $warning_start .
                    ' <font color=FFFFFF>Command: Digits Only Please dont go over 32500</font> ' . $warning_end .
                    '', 'type' => 'text', 'val_min' => 0, 'val_max' => 32500, 'cont' => 'digit');

                $f = new FormValidator($elems);
                $err = $f->validate($_POST);

                if ($err === true)
                {

                    $valid = $f->getValidElems();

                    foreach ($valid as $k => $v)
                    {

                        if ($valid[$k][0][1] == false)
                        {

                            if (empty($valid[$k][0][2]))
                            {

                                show_error($valid[$k][0][2]);
                            }
                            else
                            {
                                show_error($valid[$k][0][2]);
                            }
                        }
                    }

                }
                else
                {


                    if ($row2[0] != 0)
                    {
                        $error = 1;
                        show_error("$warning_start Character $name Is Online, Must Be Logged Off! $warning_end");
                    }


                    if ($row[4] < 0)
                    {
                        $error = 1;
                        show_error("$warning_start $name Don't Have Enough Points (Currently: $points[0])! $warning_end");
                    }


                    if ($error != 1)
                    {
                        $add_stats = $db->Execute("UPDATE Character SET [Vitality]='$new_vit',[Strength]='$new_str',[Energy]='$new_eng',[Dexterity]='$new_agi',[leadership]='$new_command',[LevelUpPoint]='$row[4]' WHERE Name =?",
                            array($name));
                        show_error("$ok_start Stats SuccessFully Added!<br>Points Left To Add: $row[4]  $ok_end");


                        $logfile = 'logs/stats_logs.php';
                        $ip = $_SERVER['REMOTE_ADDR'];
                        $date = date('Y-m-d H:i');
                        $data = "Character $_POST[character] Has Been <font color=#FF0000>Updated</font> Stats with the next ->Strength:$new_str|Agiltiy:$new_agi|Vitality:$new_vit|Energy:$new_eng|Command:$new_command,Levelup Points Left:$row[4] All Those On $date By ip:$ip \n";

                        $fp = fopen($logfile, 'a');
                        fputs($fp, $data);
                        fclose($fp);
                    }

                }

            }
        }

    }

И сложи в index-a някъде...
PHP:
function fix_stats($value)
{
if($value < 0) { $value = 32768*2+$value; }
return $value;
}

Така ми е в character.class оначе това което си дал да го сложим в индекс-а може да съм объркал мястото където съм го сложил и за това да не ми работи ... някакви идеи ? Аз си дигам статса над 32767 но след като сложа дори 1 над него става 0 ...
 
Last edited: