linpc
Гуру форума
- Регистрация
- 6 Апр 2012
- Сообщения
- 178
- Реакции
- 55
- Автор темы
- #1
PHP:
public function calcstats(){
$t=array(0=> 0,2,4);
$od=45;
$bl=0;
$invent = $this->db->sql('SELECT `invent`.*, `items`.* FROM `items` INNER JOIN `invent` ON `items`.`id` = `invent`.`protype` WHERE `used`=1 and `pl_id` = '.$this->pers['id'].'', __FILE__,__LINE__,__FUNCTION__,__CLASS__);
while ($row = mysql_fetch_array($invent)) {
$item = explode("|",$row['i_param']);
if($row['type']=="w20"){
$bl=$row['block'];
}
if($row['slot']==3 and $row['type']!="w20"){
$it = explode("|",$row['i_need']);
foreach ($it as $val) {
$need=explode("@",$val);
if($need[0]==28 and $need[1]>$od)
$od=$need[1];
$tw=$row['type'];
}
}
foreach ($item as $value) {
$stat=explode("@",$value);
if(in_array ($stat[0], $t)){
$par[$stat[0]]='';
continue;
}
if($stat[0]==1){
$tmp=explode("-",$stat[1]);
switch($tw){
case w1: $k=$this->pers['um_1']/150+1;break;
case w2: $k=$this->pers['um_2']/150+1;break;
case w3: $k=$this->pers['um_3']/150+1;break;
case w4: $k=$this->pers['um_4']/150+1;break;
case w5: $k=$this->pers['um_5']/150+1;break;
case w6: $k=$this->pers['um_6']/150+1;break;
case w7: $k=$this->pers['um_7']/150+1;break;}
$tmp[0]=round($tmp[0]*$k);
$tmp[1]=round($tmp[1]*$k);
$tmp1=explode("-",$par[1]);
$tmp[0]+=$tmp1[0];
$tmp[1]+=$tmp1[1];
continue;
}
$par[1]=implode("-",$tmp);
$par[$stat[0]]+=$stat[1];
}
}
$sil=$par[30]+$this->pers['sila'];
$dmg=explode("-",$par[1]);
$dmg[0]+=$sil;
$dmg[1]+=$sil*1.5;
$par[1]=implode("-",$dmg);
var_dump ($par[1]);
switch($tw){
case '':
$od=round($od/(($this->pers['um_0']/100)*0.15+1));
$par[1]=round($sil*(1+$this->pers['um_0']/300))."-".round($sil*(1+$this->pers['um_0']/150)+1);
break;
case w1: $od=round($od/(($this->pers['um_1']/100)*0.15+1));break;
case w2: $od=round($od/(($this->pers['um_2']/100)*0.15+1));break;
case w3: $od=round($od/(($this->pers['um_3']/100)*0.15+1));break;
case w4: $od=round($od/(($this->pers['um_4']/100)*0.15+1));break;
case w5: $od=round($od/(($this->pers['um_5']/100)*0.15+1));break;
case w6: $od=round($od/(($this->pers['um_6']/100)*0.15+1));break;
case w7: $od=round($od/(($this->pers['um_7']/100)*0.15+1));break;}
$hps=(1500/(($par[62]+$this->pers['um_30'])/100+1));
$mps=(9000/(($par[66]+$this->pers['um_33'])/100+1));
for($i=0;$i<=70;$i++){
$st.="$par[$i]|";
}
$this->db->sql('UPDATE `user` SET `bl`='.$bl.',`od`='.$od.',st='.$st.',hps='.$hps.',mps='.$mps.' WHERE `id`='.$this->pers['id'].'', __FILE__,__LINE__,__FUNCTION__,__CLASS__);
}
Распечатал var_dump:
string(7) "39-58.5" - $par[1]
array(2) { [0]=> int(37) [1]=> float(55.5) } - $dmg
Помогите