[Release] Add command за muweb 0.8

newguy

Well-Known Member
Joined
Nov 23, 2008
Messages
644
Reaction score
572
Здравейте. Ето едно малко рилийзче с което ще ви покажа как може да добавяте command точки на muweb 0.8.



Отваряме includes/character.class.php и заменяме цялата функция add_stats($name) с тази.
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']);
		 $command = stripslashes($_POST['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 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;
                 $row[4] = $row[4] - $vitality - $strength - $energy - $dexterity - $command;


                 $elems[] = array('name'=>'vitality', 'label'=>''.$warning_start.' Vitality: Digits Only Please dont go over 32500 '.$warning_end.'', 'type'=>'text',  'val_min'=> 0,  'val_max'=>32500, 'cont' =>'digit');
                 $elems[] = array('name'=>'energy', 'label'=>''.$warning_start.' Energy: Digits Only Please dont go over 32500 '.$warning_end.'', 'type'=>'text', 'val_min'=> 0,  'val_max'=>32600, 'cont' =>'digit');
                 $elems[] = array('name'=>'agility', 'label'=>''.$warning_start.' Agility: Digits Only Please dont go over 32500 '.$warning_end.'', 'type'=>'text',  'val_min'=> 0,  'val_max'=>32500, 'cont' =>'digit');
                 $elems[] = array('name'=>'strength', 'label'=>''.$warning_start.' Strength: Digits Only Please dont go over 32500 '.$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',[LevelUpPoint]='$row[4]',[Leadership]=[Leadership]+$command 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);
                         }

                 }

         }
           
}

Отиваме modules/user/characters.php и заменяме целият ред

PHP:
$level_up_points = $db->Execute("Select leveluppoint,class,strength,dexterity,vitality,energy from character where name=?",array($chr));
с
PHP:
$level_up_points = $db->Execute("Select leveluppoint,class,strength,dexterity,vitality,energy,leadership from character where name=?",array($chr));

В същият файл добавяме
PHP:
                    <tr>
                      <td><div align="right">Command ['.$level_up[6].']</div></td>
                      <td><input name="command" type="text" class="text_statistics" size="10" maxlength="5">
                      <input name="character" type="hidden" id="character" value="'.$chr.'"></td>
                    </tr>
след
PHP:
                    <tr>
                      <td><div align="right">Energy ['.$level_up[5].']</div></td>
                      <td><input name="energy" type="text" class="text_statistics" id="energy" size="10" maxlength="5">
                      <input name="character" type="hidden" id="character" value="'.$chr.'"></td>
                    </tr>
Това е. Нищо сложно промяна на два файла мисля че няма да имате проблем с "инсталацията". (sun)

Айде и един screenshot, че така е модерно.
gcvgyb52vpnsxgj6y6wthfe0w1tv07y39e9htqzz.jpg
 
Last edited:
Ужасно ти благодаря ,че го направи !!!
Мерси !!!
 
ти си уникален :) точно това ми трябваше!
 
WoW супер е много полезно 10/10!
 
точно такова ми трябваше 10/10 добра работа ;)
 
Хубаво щеше да е ако беше сложил едно if(class='Classa na dl-to') за да не го показва на всички герои.
Иначе е добре нищо лошо само казвам :)