Exemplo n.º 1
0
 function share($id = 0)
 {
     is_numeric($id) or attack();
     $data = $this->db->find('place', $id, 'id', '*,(SELECT avatar FROM user WHERE id=uid) authorFace,(SELECT name FROM user WHERE id=uid) authorName');
     !empty($data) or die('<h1>此钓点不存在!</h1>');
     $this->load->view('share', $data);
 }
Exemplo n.º 2
0
 function add($type, $data, $id, $uid = 0)
 {
     $res = ['link' => $id, 'uid' => $uid, 'time' => time(), 'type' => $type];
     switch ($type) {
         case Notify::COMMENT:
             $res['msg'] = $data['name'] . '评价了你的微博';
             break;
         case Notify::REPLY:
             $res['msg'] = $data['name'] . '回复了你的微博';
             break;
         case Notify::PASS:
             $res['msg'] = '您的钓点' . $data['name'] . '通过了审核';
             break;
         case Notify::FAIL:
             $res['msg'] = "您的钓点{$data['name']}因为{$data['info']}被拒绝了";
             break;
         case Notify::ADD:
             $res['msg'] = "新增钓点{$data['name']}";
             break;
         case Notify::ATTEND:
             $res['msg'] = "{$data['name']}关注了你";
             break;
         default:
             attack();
     }
     return $this->db->insert('notify', $res);
 }
Exemplo n.º 3
0
 function del()
 {
     $this->load->model('muser');
     $this->muser->check() or noRights();
     $id = (int) $this->input->post('id') or errInput();
     $uid = $this->db->find('bbs', $id, 'id', 'uid') or ajax(4001, '帖子不存在');
     if ($uid['uid'] != UID) {
         attack();
     }
     $this->db->delete('bbs', ['id' => $id]) ? ajax() : busy();
     //有外键,只删除bbs就可以了
 }
Exemplo n.º 4
0
 function del()
 {
     $this->load->model('muser');
     $this->muser->check() or noRights();
     $id = (int) $this->input->post('id') or errInput();
     $uid = $this->db->find('yue', $id, 'id', 'uid') or ajax(5001, '此记录不存在');
     if ($uid['uid'] != UID) {
         attack();
     }
     $this->db->delete('yue_people', ['yid' => $id]);
     $this->db->delete('bbs', ['id' => $id]) ? ajax() : busy();
 }
Exemplo n.º 5
0
 function placeCheck()
 {
     $data = $this->input->post(['id', 'state']) or errInput();
     $res = $this->db->find('place', $data['id'], 'id', 'uid,name');
     $res or attack();
     $this->load->model('notify');
     if ($data['state'] == 1) {
         $this->notify->add(Notify::PASS, $res, $data['id'], $res['uid']);
         $this->notify->add(Notify::ADD, $res, $data['id']);
     } else {
         $res['info'] = $this->input->post('info', FALSE);
         $this->notify->add(Notify::FAIL, $res, $data['id'], $res['uid']);
     }
     $this->db->query("UPDATE place SET state=? WHERE id=?", [$data['state'], $data['id']]) ? ajax() : busy();
 }
Exemplo n.º 6
0
 function del()
 {
     $this->load->model('muser', 'user');
     if (!$this->user->check()) {
         noRights();
     }
     $id = $this->input->post('id');
     $uid = $this->db->find('weibo', $id, 'id', 'authorId');
     if (!empty($uid) && $uid['authorId'] == UID) {
         $this->db->delete('weibo', ['id' => $id]) ? ajax() : busy();
         //做了外键约束,只删微博就够了
     } else {
         attack();
     }
 }
function mag_decl_attack($who, $to)
{
    // po idee magiej npc napadatq nebudut, no na vsjakij pozharnyj i tak puwu:
    //$who = preg_replace ('/[^a-z0-9_\.]/i', '', $who);
    //$to = preg_replace ('/[^a-z0-9_\.]/i', '', $to);
    if ($to == $who) {
        put_g_error('на себя напасть нелзя!');
    }
    $id = is_player($who);
    $n = 0;
    if ($id) {
        $q = do_mysql("SELECT in_battle, status1, location, last FROM players WHERE id_player = '" . $id . "';");
    } else {
        $id = is_npc($who);
        $n = 1;
        $q = do_mysql("SELECT in_battle, location FROM npc WHERE id_npc = '" . $id . "';");
    }
    $w_inf = mysql_fetch_assoc($q);
    $tid = is_player($to);
    $tn = 0;
    if ($tid) {
        $q = do_mysql("SELECT in_battle, status1, location FROM players WHERE id_player = '" . $tid . "';");
    } else {
        $tid = is_npc($to);
        $tn = 1;
        $q = do_mysql("SELECT in_battle, location FROM npc WHERE id_npc = '" . $tid . "';");
    }
    $t_inf = mysql_fetch_assoc($q);
    if ($w_inf['location'] != $t_inf['location']) {
        return 0;
    }
    // celq nedostezhima
    include_once 'modules/f_attack.php';
    attack($who, $to);
    return 1;
}
Exemplo n.º 8
0
	  </td>
               
    	</tr>
        
      </table>
      
      </td>
    </tr>
    
<tr>
    <td width="100%">
      <h3>


<?php 
            attack();
            if ($randeally == '3') {
                $youwin = $attackdmg + $attackdmg2;
            } else {
                $youwin = $attackdmg;
            }
            if ($randeally1 == '4') {
                $enemywin = $defdmg + $defdmg2;
            } else {
                $enemywin = $defdmg;
            }
            if ($youwin > $enemywin) {
                echo "<p align=center class=style54 id=message_{$mess} style=visibility:hidden><br><font color=lightgreen><b>{$stat['username']}</b></font> is the winner!</p><br><br>";
                $mess++;
                $pskilldiversion = mysql_fetch_assoc(mysql_query("select `end` from castedskills where `skillid`=8 and reciever={$stat1['id']} and `end` > UNIX_TIMESTAMP()"));
                if (!$pskilldiversion) {
Exemplo n.º 9
0
 function comment($input)
 {
     $this->load->model('notify');
     if ($input['fid'] != 0) {
         $t = $this->db->where(['wid' => $input['wid'], 'id' => $input['fid']])->get('wcomment');
         if (!$t || $t->num_rows() != 1) {
             attack();
         }
         $autId = $t->row_array()['uid'];
         $type = Notify::REPLY;
     } else {
         $autId = $this->db->find('weibo', $input['wid'], 'id', 'authorId')['authorId'];
         $type = Notify::COMMENT;
     }
     $input['uid'] = UID;
     $input['time'] = time();
     $this->notify->add($type, $this->db->find('user', UID, 'id', 'name'), $input['wid'], $autId);
     return $this->db->insert('wcomment', $input);
 }
Exemplo n.º 10
0
function attack_wrapper(&$pa, &$pd, $active)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    attack_prepare($pa, $pd, $active);
    attack($pa, $pd, $active);
    attack_finish($pa, $pd, $active);
}
$toloc = $p['location'];
if (substr($toloc, 0, 4) == 'rele' || substr($toloc, 0, 4) == 'elfc' || substr($toloc, 0, 4) == 'verg') {
    put_g_error('на этой локации атаковать нелзя');
}
if (!isset($_GET['to'])) {
    // pokazyvaem vybor igroka
    // ili npc
    include_once 'modules/f_list_inloc.php';
    $f = list_inloc($LOGIN, 'use_item&item=' . $item);
    exit_msg('выберите цель:', $f);
}
// esli vypolnjaetsja, znachet to vybran
$to = preg_replace('/[^a-z0-9_\\.-]/i', '', $_GET['to']);
// napadaem:
include_once 'modules/f_attack.php';
attack($LOGIN, $to);
// udalim
if ($ii['on_take'] > 1) {
    // umenqshim kolichestvo
    $ii['on_take']--;
    do_mysql("UPDATE items SET on_take = '" . $ii['on_take'] . "' WHERE id_item = '" . $ii['id_item'] . "';");
} else {
    include_once 'modules/f_delete_item.php';
    delete_item($item);
}
$id = is_player($to);
if ($id) {
    $q = do_mysql("SELECT life, mana, name FROM players WHERE id_player = '" . $id . "';");
    $t = mysql_fetch_assoc($q);
    $t['life'] = explode('|', $t['life']);
    $t['mana'] = explode('|', $t['mana']);
Exemplo n.º 12
0
function combat($active = 1, $wep_kind = '')
{
    global $log, $mode, $main, $cmd, $battle_title, $db, $tablepre, $pls, $message, $now, $w_log, $nosta, $hdamage, $hplayer;
    global $pid, $name, $club, $inf, $lvl, $exp, $killnum, $bid, $tactic, $pose, $hp, $mhp;
    global $wep, $wepk, $wepe, $weps, $wepsk;
    global $edata, $w_pid, $w_name, $w_pass, $w_type, $w_endtime, $w_deathtime, $w_gd, $w_sNo, $w_icon, $w_club, $w_hp, $w_mhp, $w_sp, $w_msp, $w_att, $w_def, $w_pls, $w_lvl, $w_exp, $w_money, $w_bid, $w_inf, $w_rage, $w_pose, $w_tactic, $w_killnum, $w_state, $w_wp, $w_wk, $w_wg, $w_wc, $w_wd, $w_wf, $w_teamID, $w_teamPass;
    global $w_wep, $w_wepk, $w_wepe, $w_weps, $w_arb, $w_arbk, $w_arbe, $w_arbs, $w_arh, $w_arhk, $w_arhe, $w_arhs, $w_ara, $w_arak, $w_arae, $w_aras, $w_arf, $w_arfk, $w_arfe, $w_arfs, $w_art, $w_artk, $w_arte, $w_arts, $w_itm0, $w_itmk0, $w_itme0, $w_itms0, $w_itm1, $w_itmk1, $w_itme1, $w_itms1, $w_itm2, $w_itmk2, $w_itme2, $w_itms2, $w_itm3, $w_itmk3, $w_itme3, $w_itms3, $w_itm4, $w_itmk4, $w_itme4, $w_itms4, $w_itm5, $w_itmk5, $w_itme5, $w_itms5, $w_itm6, $w_itmk6, $w_itme6, $w_itms6, $w_wepsk, $w_arbsk, $w_arhsk, $w_arask, $w_arfsk, $w_artsk, $w_itmsk0, $w_itmsk1, $w_itmsk2, $w_itmsk3, $w_itmsk4, $w_itmsk5, $w_itmsk6;
    global $infinfo, $w_combat_inf;
    global $rp, $w_rp, $action, $w_action, $achievement, $w_achievement, $skills, $w_skills, $skillpoint, $w_skillpoint;
    $battle_title = '战斗发生';
    if (!$wep_kind) {
        $w1 = substr($wepk, 1, 1);
        $w2 = substr($wepk, 2, 1);
        if (($w1 == 'G' || $w1 == 'J') && $weps == $nosta) {
            $wep_kind = $w2 ? $w2 : 'P';
        } else {
            $wep_kind = $w1;
        }
    } elseif (strpos($wepk, $wep_kind) === false && $wep_kind != 'back') {
        $wep_kind = substr($wepk, 1, 1);
    }
    $wep_temp = $wep;
    include_once GAME_ROOT . './include/game/clubskills.func.php';
    if ($active) {
        if ($wep_kind == 'back') {
            $log .= "你逃跑了。";
            $action = '';
            $mode = 'command';
            return;
        }
        $enemyid = $active ? str_replace('enemy', '', $action) : $bid;
        if (!$enemyid || strpos($action, 'enemy') === false) {
            $log .= "<span class=\"yellow\">你没有遇到敌人,或已经离开战场!</span><br>";
            $action = '';
            $mode = 'command';
            return;
        }
        $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$enemyid}'");
        if (!$db->num_rows($result)) {
            $log .= "对方不存在!<br>";
            $action = '';
            $mode = 'command';
            return;
        }
        $edata = $db->fetch_array($result);
        if ($edata['pls'] != $pls) {
            $log .= "<span class=\"yellow\">" . $edata['name'] . "</span>已经离开了<span class=\"yellow\">{$plsinfo[$pls]}</span>。<br>";
            $action = '';
            $mode = 'command';
            return;
        } elseif ($edata['hp'] <= 0) {
            global $corpseprotect, $gamestate;
            $log .= "<span class=\"red\">" . $edata['name'] . "</span>已经死亡,不能被攻击。<br>";
            if ($edata['endtime'] < $now - $corpseprotect && $gamestate < 40) {
                $action = 'corpse' . $edata['pid'];
                include_once GAME_ROOT . './include/game/battle.func.php';
                findcorpse($edata);
            }
            //$action = '';
            return;
        }
        if ($message) {
            //			foreach ( Array('<','>',';',',') as $value ) {
            //				if(strpos($message,$value)!==false){
            //					$message = str_replace ( $value, '', $message );
            //				}
            //			}
            $log .= "<span class=\"lime\">你对{$edata['name']}大喊:{$message}</span><br>";
            if (!$edata['type']) {
                $w_log = "<span class=\"lime\">{$name}对你大喊:{$message}</span><br>";
                logsave($edata['pid'], $now, $w_log, 'c');
            }
        }
        extract($edata, EXTR_PREFIX_ALL, 'w');
        init_battle(1);
        include_once GAME_ROOT . './include/game/attr.func.php';
        $log .= "你向<span class=\"red\">{$w_name}</span>发起了攻击!<br>";
        $att_dmg = attack($wep_kind, 1);
        global $ggflag;
        if ($ggflag) {
            return;
        }
        $w_hp -= $att_dmg;
        if ($w_hp > 0 && $w_tactic != 4 && $w_pose != 5) {
            global $rangeinfo;
            $w_w1 = substr($w_wepk, 1, 1);
            $w_w2 = substr($w_wepk, 2, 1);
            if (($w_w1 == 'G' || $w_w1 == 'J') && $w_weps == $nosta) {
                $w_wep_kind = $w_w2 ? $w_w2 : 'P';
            } else {
                $w_wep_kind = $w_w1;
            }
            //if (($rangeinfo [$wep_kind] == $rangeinfo [$w_wep_kind]) || ($rangeinfo [$w_wep_kind] == 'M')) {
            if ($rangeinfo[$wep_kind] <= $rangeinfo[$w_wep_kind] && $rangeinfo[$wep_kind] !== 0) {
                $counter = get_counter($w_wep_kind, $w_tactic, $w_club, $w_inf);
                $counter *= get_clubskill_bonus_counter($w_club, $w_skills, 'w_', $club, $skills, '');
                $counter_dice = rand(0, 99);
                if ($counter_dice < $counter) {
                    $log .= "<span class=\"red\">{$w_name}的反击!</span><br>";
                    $log .= npc_chat($w_type, $w_name, 'defend');
                    $def_dmg = defend($w_wep_kind);
                } else {
                    $log .= npc_chat($w_type, $w_name, 'escape');
                    $log .= "<span class=\"red\">{$w_name}处于无法反击的状态,逃跑了!</span><br>";
                }
            } else {
                $log .= npc_chat($w_type, $w_name, 'cannot');
                $log .= "<span class=\"red\">{$w_name}攻击范围不足,不能反击,逃跑了!</span><br>";
            }
        } elseif ($w_hp > 0) {
            $log .= "<span class=\"red\">{$w_name}逃跑了!</span><br>";
        }
    } else {
        $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$bid}'");
        $edata = $db->fetch_array($result);
        extract($edata, EXTR_PREFIX_ALL, 'w');
        init_battle(1);
        include_once GAME_ROOT . './include/game/attr.func.php';
        $log .= "<span class=\"red\">{$w_name}</span>突然向你袭来!<br>";
        $log .= npc_chat($w_type, $w_name, 'attack');
        npc_changewep();
        $w_w1 = substr($w_wepk, 1, 1);
        $w_w2 = substr($w_wepk, 2, 1);
        if (($w_w1 == 'G' || $w_w1 == 'J') && $w_weps == $nosta) {
            $w_wep_kind = $w_w2 ? $w_w2 : 'P';
        } else {
            $w_wep_kind = $w_w1;
        }
        $def_dmg = defend($w_wep_kind, 1);
        if ($hp > 0 && $tactic != 4 && $pose != 5) {
            global $rangeinfo;
            if ($rangeinfo[$wep_kind] >= $rangeinfo[$w_wep_kind] && $rangeinfo[$w_wep_kind] !== 0) {
                $counter = get_counter($wep_kind, $tactic, $club, $inf);
                $counter *= get_clubskill_bonus_counter($club, $skills, '', $w_club, $w_skills, 'w_');
                $counter_dice = rand(0, 99);
                if ($counter_dice < $counter) {
                    $log .= "<span class=\"red\">你的反击!</span><br>";
                    $wep_kind = substr($wepk, 1, 1);
                    $att_dmg = attack($wep_kind);
                    $w_hp -= $att_dmg;
                } else {
                    $log .= "<span class=\"red\">你处于无法反击的状态,逃跑了!</span><br>";
                }
            } else {
                $log .= "<span class=\"red\">你攻击范围不足,不能反击,逃跑了!</span><br>";
            }
        } elseif ($hp > 0) {
            $log .= "<span class=\"red\">你逃跑了!</span><br>";
        }
    }
    if ($hp == 0 && !$w_action) {
        $w_action = 'pacorpse' . $pid;
    }
    w_save($w_pid);
    $att_dmg = $att_dmg ? $att_dmg : 0;
    $def_dmg = $def_dmg ? $def_dmg : 0;
    if (!$w_type) {
        $w_inf_log = '';
        if ($w_combat_inf) {
            global $exdmginf;
            foreach ($exdmginf as $inf_ky => $w_inf_words) {
                if (strpos($w_combat_inf, $inf_ky) !== false) {
                    $w_inf_log .= "敌人的攻击造成你{$w_inf_words}了!<br>";
                }
            }
        }
        if ($active) {
            $w_log = "手持<span class=\"red\">{$wep_temp}</span>的<span class=\"yellow\">{$name}</span>向你袭击!<br>你受到其<span class=\"yellow\">{$att_dmg}</span>点攻击,对其做出了<span class=\"yellow\">{$def_dmg}</span>点反击。<br>{$w_inf_log}";
        } else {
            $w_log = "你发现了手持<span class=\"red\">{$wep_temp}</span>的<span class=\"yellow\">{$name}</span>并且先发制人!<br>你对其做出<span class=\"yellow\">{$def_dmg}</span>点攻击,受到其<span class=\"yellow\">{$att_dmg}</span>点反击。<br>{$w_inf_log}";
        }
        if ($hp == 0) {
            $w_log .= "<span class=\"yellow\">{$name}</span><span class=\"red\">被你杀死了!</span><br>";
            //include_once GAME_ROOT.'./include/game/achievement.func.php';
            //check_battle_achievement($w_achievement,$w_type,$name);
        }
        logsave($w_pid, $now, $w_log, 'b');
    }
    if ($att_dmg > $hdamage && $att_dmg >= $def_dmg) {
        $hdamage = $att_dmg;
        $hplayer = $name;
        save_combatinfo();
    } elseif ($def_dmg > $hdamage && !$w_type) {
        $hdamage = $def_dmg;
        $hplayer = $w_name;
        save_combatinfo();
    }
    //$bid = $w_pid;
    if ($w_hp <= 0 && $w_club != 99) {
        $w_bid = $pid;
        $w_hp = 0;
        if ($w_type == 0) {
            $killnum++;
        }
        include_once GAME_ROOT . './include/state.func.php';
        $killmsg = kill($wep_kind, $w_name, $w_type, $w_pid, $wep_temp);
        $log .= npc_chat($w_type, $w_name, 'death');
        include_once GAME_ROOT . './include/game/achievement.func.php';
        check_battle_achievement($name, $w_type, $w_name, $wep_temp);
        $log .= "<span class=\"red\">{$w_name}被你杀死了!</span><br>";
        //$rp = $rp + 20 ;
        if (!$w_type) {
            $rpup = $w_rp;
        } else {
            $rpup = 20;
        }
        if ($club == 19) {
            $rpdec = 30;
            $rpdec += get_clubskill_rp_dec($club, $skills);
            $rp += round($rpup * (100 - $rpdec) / 100);
        } else {
            $rp += $rpup;
        }
        if ($killmsg) {
            $log .= "<span class=\"yellow\">你对{$w_name}说:“{$killmsg}”</span><br>";
        }
        include_once GAME_ROOT . './include/game/battle.func.php';
        $result = $db->query("SELECT * FROM {$tablepre}players WHERE pid='{$w_pid}'");
        $cdata = $db->fetch_array($result);
        $action = 'corpse' . $edata['pid'];
        findcorpse($cdata);
        return;
    } else {
        if ($w_hp <= 0) {
            //有第二阶段
            if ($w_type) {
                $log .= npc_chat($w_type, $w_name, 'death');
                include_once GAME_ROOT . './include/system.func.php';
                $npcdata = evonpc($w_type, $w_name);
                $log .= '<span class="yellow">' . $w_name . '却没死去,反而爆发出真正的实力!</span><br>';
                if ($npcdata) {
                    addnews($now, 'evonpc', $w_name, $npcdata['name'], $name);
                    foreach ($npcdata as $key => $val) {
                        ${'w_' . $key} = $val;
                    }
                }
            } else {
                include_once GAME_ROOT . './include/state.func.php';
                $killmsg = kill($wep_kind, $w_name, $w_type, $w_pid, $wep_temp);
                $log .= '<span class="yellow">' . $w_name . '由于其及时按了BOMB键而原地满血复活了!</span><br>';
            }
        }
        $main = 'battle';
        init_battle(1);
        if (CURSCRIPT !== 'botservice') {
            include template('battleresult');
            //$cmd = '<br><br><input type="hidden" name="mode" value="command"><input type="radio" name="command" id="back" value="back" checked><a onclick=sl("back"); href="javascript:void(0);" >确定</a><br>';
            $cmd = ob_get_contents();
            ob_clean();
            //$bid = $hp <= 0 ? $bid : 0;
        }
        $action = '';
        return;
    }
}
Exemplo n.º 13
0
if (strtotime($user['timeOut']) > time()) {
    echo "You can not do anything until " . $user['timeOut'];
} else {
    //set 10 minutes timeout
    $user['timeOut'] = date("Y/m/d H:i:s a", time() + 600);
    if ($user['health'] == 0) {
        echo "You do not have health and can not fight!";
    } else {
        //find opponent
        $query = "SELECT * FROM `users` WHERE `users`.`username` != '" . $_SESSION['logged_user'] . "'";
        $opponent = $db->fetchArray($query);
        $opponent = $opponent[rand(0, sizeof($opponent) - 1)];
        //fight
        while ($opponent['health'] > 0 && $user['health'] > 0) {
            $opponent['health'] = $opponent['health'] - attack($user, $opponent);
            $user['health'] = $user['health'] - attack($opponent, $user);
        }
        //check for draw
        if ($user['health'] <= 0 && $opponent['health'] <= 0) {
            $user['health'] = 0;
            $opponent['health'] = 0;
            $db->saveArray("users", $user);
            $db->saveArray("users", $opponent);
            echo "Draw!";
        } else {
            //if p1 won
            if ($user['health'] <= 0) {
                $user['health'] = 0;
                $opponent['wins']++;
                $opponent['rank'] = $opponent['wins'] / 10;
                //calculate rank
Exemplo n.º 14
0
<?php 
// fail samoj ataki
$who = $LOGIN;
$to = preg_replace('/[^a-z0-9_\\.-]/i', '', $_GET['to']);
if (isset($_GET['type'])) {
    $type = preg_replace('/[^a-z]/', '', $_GET['type']);
} else {
    $type = 'NONE';
}
include_once 'modules/f_check_dead.php';
// napadaem:
include_once 'modules/f_attack.php';
attack($who, $to);
// proverjaem uspeshnostq ataki:
include_once 'modules/f_is_attack_successful.php';
$result = is_attack_successful($who, $to);
if ($result) {
    // vse, delaem uron
    include_once 'modules/f_do_dmg.php';
    if ($result > 1) {
        $PAR = 0;
    } else {
        $PAR = 1;
    }
    do_dmg($who, $to, $type, $PAR);
} else {
    include 'modules/s_main.php';
}
///////////////////////////////////////////////////////////////////////////////////
// podvodim itogi
// zhiv li
Exemplo n.º 15
0
 function attend()
 {
     if (!$this->m->check()) {
         noRights();
     }
     $id = $this->input->post('id') or errInput();
     $this->db->where(['fromid' => UID, 'toId' => $id])->get('attention')->num_rows() == 0 or ajax(1004, '你已经关注了此用户');
     $this->db->where('id', $id)->step('fans', 'user');
     $this->db->affected_rows() == 1 or attack();
     //此用户不存在
     $this->db->where('id', UID)->step('cared');
     $flag = $this->db->insert('attention', ['fromid' => UID, 'toId' => $id]);
     if (!$flag) {
         busy();
     }
     $this->load->model('notify');
     $this->notify->add(Notify::ATTEND, $this->db->find('user', UID, 'id', 'name'), UID, $id) ? ajax() : busy();
 }
Exemplo n.º 16
0
        }
        print "\n[*] Hash:\t";
        $passwd = blind("mot_passe", $i);
        print "\n";
        $md5 = strtolower($passwd);
        for ($a = 0; $a < sizeof($md5loc); $a++) {
            $r = crack($md5loc[$a][0], $md5loc[$a][1], $md5loc[$a][2]);
            if ($r) {
                print "[*] Password:\t{$r}\n";
                break;
            }
        }
        if (!$r) {
            print "[*] Can't find the hash on the net, sorry.\n";
        } else {
            attack($login, $r);
            die;
        }
    }
}
function blind($field, $i = 0)
{
    global $xpl, $url;
    $d = 0;
    $v = '';
    $charset = "etaonisrhldcumfpwgbyvkxjqz0123456789_-\$.^()[]{}Š*\"'@=/\\|#?+&!`<>:;,\\";
    if (eregi('p', $field)) {
        $charset = "0123456789abcdef";
    }
    while (TRUE) {
        $d++;
Exemplo n.º 17
0
 function score()
 {
     $this->load->model('muser', 'user');
     if (!$this->user->check()) {
         noRights();
     }
     $data = $this->input->post(['score', 'content', 'images', 'pid']);
     if (!$data) {
         errInput();
     }
     if (!is_numeric($data['score']) || $data['score'] < 0 || $data['score'] > 10) {
         attack();
     }
     is_array(json_decode($data['images'], TRUE)) or errInput();
     $data['images'] = gzcompress($data['images']);
     $data['uid'] = UID;
     $data['time'] = time();
     $flag = $this->db->insert('score', $data);
     if (!$flag) {
         busy();
     }
     $score = $this->db->query("SELECT count(*) num,sum(`score`) total FROM score WHERE pid=?", $data['pid'])->row();
     $newS = $score->total * 10 / $score->num;
     //添加评价了,num不可能为0
     $this->db->where('id', $data['pid'])->update('place', ['score' => round($newS) / 10]) ? ajax() : busy();
 }
Exemplo n.º 18
0
<?php

include "../site/connexion.php";
include "../site/verif_connexion.php";
include "../../www/include/attack.php";
if (isset($_GET['idAttaque']) && isset($_GET['idDefense'])) {
    attack($bdd, $_SESSION['id_partie'], $_GET['idAttaque'], $_GET['idDefense'], $_SESSION['usr_id']);
}
Exemplo n.º 19
0
echo "&nbsp; &nbsp; &nbsp;<input type='button' class='btn' onclick=\"window.location='?action=vixod'\" value='Выход'></div>";
//----------------------------------------------------
if (!isset($_SESSION["xy"])) {
    $_SESSION["xy"] = "9x4";
    $xx = 9;
    $yy = 4;
} else {
    $cor = explode("x", $_SESSION["xy"]);
    $xx = $cor[0];
    $yy = $cor[1];
}
//------------BATLLE WHEN WALK--------------------------------------
if ($_GET["action"] == 'walk') {
    $at = rand(0, 100);
    if ($at > 75) {
        attack($db);
    }
}
//------------TAKE MONEY--------------------------------------
echo "<table cellspacing=0 cellpadding=0 width=100% border=0>\n<tr>\n<td width=100%>";
if ($_POST['baks'] == 1) {
    ?>
		<form action="main.php" method="post">
	    	<p>	<img src="pic.php?<?php 
    echo session_name();
    ?>
=<?php 
    echo session_id();
    ?>
">
	    		<br>Введите текст:<input type="text" name="keystring">
Exemplo n.º 20
0
function game_move($gameid)
{
    $query1 = "SELECT * FROM games WHERE gameid = '{$gameid}' ";
    $recordset = mysql_query($query1) or die(mysql_error());
    $row = mysql_fetch_array($recordset);
    $gamestate = $row["gamestate"];
    $arrayplayersid = explode(",", $row["players"]);
    array_pop($arrayplayersid);
    $bosshealth = $row["bosshealth"];
    $boss = $row["boss"];
    $roundcount = $row["roundcount"];
    $weather = $row["weather"];
    //---prevent duplicative gameturns---//
    if ($gamestate == "calculating") {
        return "calculating";
    } else {
        $query2 = "UPDATE games SET gamestate = ('calculating') WHERE gameid = '{$gameid}' ";
        mysql_query($query2) or die(mysql_error());
        $story = "";
        //---attack the boss---//
        $totalattack = 0;
        foreach ($arrayplayersid as $playerid) {
            $query3 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
            $recordset = mysql_query($query3) or die(mysql_error());
            $row = mysql_fetch_array($recordset);
            $move = $row["playermove"];
            $raineffect = mt_rand(0, 99);
            $snoweffect = mt_rand(0, 99);
            if ($move == "attack" and $weather == "rainy" and $raineffect < number("percentage_rainy_miss")) {
                $story = $story . "Rain prevents @" . $playerid . "&'s attack.,";
                //story
            } elseif ($move == "attack" and $weather == "snowy" and $snoweffect < number("percentage_snowy_miss")) {
                $story = $story . "Snow prevents @" . $playerid . "&'s attack.,";
                //story
            } elseif ($move == "attack") {
                $attack = attack($playerid);
                $windeffect = mt_rand(0, 99);
                if ($weather == "windy" and $windeffect < number("percentage_windy_reduce")) {
                    $attack = $attack * number("windy_multiplier");
                    $story = $story . "Wind reduces @" . $playerid . "&'s attack to " . $attack . " damage.,";
                    //story
                } else {
                    $story = $story . "<i>@" . $playerid . "&" . storytime("attack") . "</i>,";
                    //storytime
                    $story = $story . "@" . $playerid . "& attacks for " . $attack . " damage.,";
                    //story
                }
                $totalattack = $totalattack + $attack;
            }
        }
        $bossmove = boss_move($gameid);
        //---boss dodges---//
        if ($bossmove == "dodge") {
            $totalattack = $totalattack * number("boss_dodge_multiplier");
            $story = $story . "The " . $boss . " dodges to escape some damage.,";
            //story
        }
        //---boss takes damage---//
        $story = $story . "The " . $boss . " takes " . $totalattack . " damage.,";
        //story
        $query4 = "SELECT * FROM games WHERE gameid = '{$gameid}' ";
        $recordset = mysql_query($query4) or die(mysql_error());
        $row = mysql_fetch_array($recordset);
        $bosshealth = $row["bosshealth"];
        $newbosshealth = $bosshealth - $totalattack;
        $query5 = "UPDATE games SET bosshealth = ('{$newbosshealth}') WHERE gameid = '{$gameid}' ";
        mysql_query($query5) or die(mysql_error());
        //---boss deals damage---//
        if ($newbosshealth > 0) {
            $windeffect2 = mt_rand(0, 99);
            $snoweffect2 = mt_rand(0, 99);
            //---weather: wind fail---//
            if (($bossmove == "attackone" or $bossmove == "attackall") and $weather == "windy" and $windeffect2 < number("percentage_windy_miss")) {
                $story = $story . "The wind causes the " . $boss . "'s attack to miss.,";
                //story
            } elseif (($bossmove == "attackone" or $bossmove == "attackall") and $weather == "snowy" and $snoweffect2 < number("percentage_snowy_miss")) {
                $story = $story . "The snow causes the " . $boss . "'s attack to miss.,";
                //story
            } elseif ($bossmove == "attackone") {
                $arraybossattack = explode(";", boss_attack_one($arrayplayersid));
                $target = $arraybossattack[0];
                $damage = $arraybossattack[1];
                $raineffect2 = mt_rand(0, 99);
                if ($weather == "rainy" and $raineffect2 < number("percentage_rainy_reduce")) {
                    $damage = $damage * number("rainy_multiplier");
                    $story = $story . "The rain reduces the " . $boss . "'s attack.,";
                    //story
                }
                $query6 = "SELECT * FROM players WHERE playerid = '{$target}' ";
                $recordset = mysql_query($query6) or die(mysql_error());
                $row = mysql_fetch_array($recordset);
                $currenthealth = $row["health"];
                //---player dodges---//
                $move = $row["playermove"];
                if ($move == "dodge") {
                    $story = $story . "@" . $target . "& dodges.,";
                    //story
                    $damage = $damage - dodge($target);
                    if ($damage < 0) {
                        $damage = 0;
                        $story = $story . "<i>@" . $playerid . "&" . storytime("dodge") . ",</i>";
                        //storytime
                        $story = $story . "@" . $target . "& dodges the " . $boss . "'s attack and takes no damage.,";
                        //story
                    } else {
                        $story = $story . "<i>@" . $playerid . "&" . storytime("dodge") . ",</i>";
                        //storytime
                        $story = $story . "@" . $target . "& dodges the " . $boss . "'s attack but takes " . $damage . " damage.,";
                        //story
                    }
                } else {
                    $story = $story . "<i>The " . $boss . storytime("boss") . ",</i>";
                    //storytime
                    $story = $story . "The " . $boss . " focuses an attack on @" . $target . "& for " . $damage . " damage.,";
                    //story
                }
                //---player takes damage---//
                $newhealth = $currenthealth - $damage;
                $query7 = "UPDATE players SET health = ('{$newhealth}') WHERE playerid = '{$target}' ";
                mysql_query($query7) or die(mysql_error());
            } elseif ($bossmove == "attackall") {
                $story = $story . "<i>The " . $boss . storytime("boss") . "</i>,";
                //storytime
                $story = $story . "The " . $boss . " attacks everyone.,";
                //story
                $arraybossattack = explode(";", boss_attack_all($arrayplayersid));
                $arraytargets = explode(",", $arraybossattack[0]);
                $damage = $arraybossattack[1];
                $raineffect2 = mt_rand(0, 99);
                if ($weather == "rainy" and $raineffect2 < number("percentage_rainy_miss")) {
                    $damage = $damage * number("rainy_multiplier");
                    $story = $story . "The rain reduces the " . $boss . "'s attack.,";
                    //story
                }
                foreach ($arraytargets as $target) {
                    $query8 = "SELECT * FROM players WHERE playerid = '{$target}' ";
                    $recordset = mysql_query($query8) or die(mysql_error());
                    $row = mysql_fetch_array($recordset);
                    $currenthealth = $row["health"];
                    //---player dodges---//
                    $move = $row["playermove"];
                    if ($move == "dodge") {
                        $damage = $damage - dodge($target);
                        if ($damage < 0) {
                            $damage = 0;
                            $story = $story . "<i>@" . $playerid . "&" . storytime("dodge") . "</i>,";
                            //storytime
                            $story = $story . "@" . $target . "& dodges the " . $boss . "'s attack and takes no damage.,";
                            //story
                        } else {
                            $story = $story . "<i>@" . $playerid . "&" . storytime("dodge") . "</i>,";
                            //storytime
                            $story = $story . "@" . $target . "& dodges the " . $boss . "'s attack but takes " . $damage . " damage.,";
                            //story
                        }
                    } else {
                        $story = $story . "@" . $target . "& takes " . $damage . " damage from the " . $boss . " attack.,";
                        //story
                    }
                    //---player takes damage---//
                    $newhealth = $currenthealth - $damage;
                    $query9 = "UPDATE players SET health = ('{$newhealth}') WHERE playerid = '{$target}' ";
                    mysql_query($query9) or die(mysql_error());
                }
            }
        } else {
            $story = $story . "The " . $boss . " is defeated!,";
            $endgame = "victory";
        }
        //---players heal---//
        foreach ($arrayplayersid as $playerid) {
            $query10 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
            $recordset = mysql_query($query10) or die(mysql_error());
            $row = mysql_fetch_array($recordset);
            $move = $row["playermove"];
            if ($move == "heal") {
                heal($playerid);
                $story = $story . "<i>@" . $playerid . "&" . storytime("heal") . "</i>,";
                //storytime
                $story = $story . "@" . $playerid . "& heals the team to help them recover.,";
                //story
            }
        }
        //---players die---//
        $arraydead = array("");
        array_pop($arraydead);
        foreach ($arrayplayersid as $playerid) {
            $query11 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
            $recordset = mysql_query($query11) or die(mysql_error());
            $row = mysql_fetch_array($recordset);
            $health = $row["health"];
            if ($health == 0 or $health < 0) {
                $deadplayer = array($playerid);
                $arraydead = array_merge($arraydead, $deadplayer);
                if ($row["playerstate"] !== "dead") {
                    $story = $story . "<i>@" . $playerid . "&" . storytime("die") . "</i>,";
                    //storytime
                    $story = $story . "@" . $playerid . "& has died.,";
                    //story
                    $query12 = "UPDATE players SET health = '0' WHERE playerid = '{$playerid}' ";
                    mysql_query($query12) or die(mysql_error());
                }
            }
        }
        //---change weather---//
        $newweather = change_weather($weather);
        $story = $story . "The weather is " . $newweather . ".";
        //story
        $query13 = "UPDATE games SET weather = ('{$newweather}') WHERE gameid = '{$gameid}' ";
        mysql_query($query13) or die(mysql_error());
        //---replace id numbers with names in story---//
        if (strpos($story, "@") !== FALSE) {
            $input = $story;
            preg_match_all("~@(.*?)&~", $input, $output);
            $arraytagged = $output[1];
            foreach ($arraytagged as $taggedid) {
                $query14 = "SELECT * FROM players WHERE playerid = '{$taggedid}'";
                $recordset = mysql_query($query14) or die(mysql_error());
                $row = mysql_fetch_array($recordset);
                $name = $row["name"];
                if (isset($name)) {
                    $story = str_replace("@{$taggedid}&", "{$name}", $story);
                }
            }
        }
        //---reset gamestate---//
        foreach ($arrayplayersid as $playerid) {
            $query15 = "UPDATE players SET playermove = ('') WHERE playerid = '{$playerid}' ";
            mysql_query($query15) or die(mysql_error());
            $query16 = "UPDATE players SET playerstate = ('playerturn') WHERE playerid = '{$playerid}' ";
            mysql_query($query16) or die(mysql_error());
        }
        foreach ($arraydead as $playerid) {
            $query17 = "UPDATE players SET playerstate = ('dead') WHERE playerid = '{$playerid}' ";
            mysql_query($query17) or die(mysql_error());
        }
        $slashstory = addslashes($story);
        $query18 = "UPDATE games SET bossmove = ('{$slashstory}') WHERE gameid = '{$gameid}' ";
        mysql_query($query18) or die(mysql_error());
        $roundcount = $roundcount + 1;
        $query19 = "UPDATE games SET roundcount = ('{$roundcount}') WHERE gameid = '{$gameid}' ";
        mysql_query($query19) or die(mysql_error());
        //---game over?---//
        if (isset($endgame) and $endgame == "victory") {
            $query20 = "UPDATE games SET gamestate = ('victory') WHERE gameid = '{$gameid}' ";
            mysql_query($query20) or die(mysql_error());
            foreach ($arrayplayersid as $playerid) {
                $query21 = "UPDATE players SET playerstate = ('victory') WHERE playerid = '{$playerid}' ";
                mysql_query($query21) or die(mysql_error());
            }
            return "victory";
        } elseif ($arrayplayersid == $arraydead) {
            $query22 = "UPDATE games SET gamestate = ('defeat') WHERE gameid = '{$gameid}' ";
            mysql_query($query22) or die(mysql_error());
            return "defeat";
        } else {
            $query23 = "UPDATE games SET gamestate = ('playerturn') WHERE gameid = '{$gameid}' ";
            mysql_query($query23) or die(mysql_error());
            return "continue";
        }
    }
}
Exemplo n.º 21
0
 attack('d_rcannons', $warfrigs2 * $stats['war']['rca']);
 attack('d_infinitys', $destroyers2 * $stats['des']['inf']);
 attack('d_wraiths', $destroyers2 * $stats['des']['wra']);
 attack('d_warfrigs', $destroyers2 * $stats['des']['war']);
 attack('d_astropods', $destroyers2 * $stats['des']['ast']);
 attack('d_destroyers', $destroyers2 * $stats['des']['des']);
 attack('d_scorpions', $destroyers2 * $stats['des']['sco']);
 attack('d_cobras', $destroyers2 * $stats['des']['cob']);
 attack('d_avengers', $destroyers2 * $stats['des']['ave']);
 attack('d_infinitys', $scorpions2 * $stats['sco']['inf']);
 attack('d_wraiths', $scorpions2 * $stats['sco']['wra']);
 attack('d_warfrigs', $scorpions2 * $stats['sco']['war']);
 attack('d_astropods', $scorpions2 * $stats['sco']['ast']);
 attack('d_destroyers', $scorpions2 * $stats['sco']['des']);
 attack('d_scorpions', $scorpions2 * $stats['sco']['sco']);
 attack('d_cobras', $scorpions2 * $stats['sco']['cob']);
 $salvagec = floor($salvagec);
 $salvagem = floor($salvagem);
 //Roid capturing
 $t_block = 0;
 $i = 0;
 while ($attack[$i]["id"] > 0) {
     if ($d_cobras >= $attack[$i]["astropods"]) {
         $block = $attack[$i]["astropods"];
     } else {
         $block = $d_cobras;
     }
     $t_block += $block;
     $roidsc = Roids_capped($attack[$i]["astropods"] - $block, $d_crystalroid, $d_metalroid, $d_ui_roids);
     $roidscapped = $roidsc["crystal"] + $roidsc["metal"] + $roidsc["ui"];
     $result3 = mysql_query("UPDATE " . $PA["table"] . " SET asteroid_metal=asteroid_metal+" . $roidsc["metal"] . ",asteroid_crystal=asteroid_crystal+" . $roidsc["crystal"] . ",ui_roids=ui_roids+" . $roidsc["ui"] . " WHERE id=" . $attack[$i]["id"], $db);
Exemplo n.º 22
0
function attack_and_farm_loop($village, $incoming_attack_remain_seconds)
{
    $result = get_a2b_page();
    // not being attacked, we need cumulate clubs for attack
    if ($incoming_attack_remain_seconds > 1800 || $incoming_attack_remain_seconds < 0) {
        $need_more_clubs = attack($result, $village);
        if ($need_more_clubs) {
            return;
        }
    }
    for ($i = 0; $i < 20; $i++) {
        if (!farm($result, $village)) {
            return;
        }
        // refresh a2b page
        $result = get_a2b_page();
    }
}
Exemplo n.º 23
0
        // villages in heavy defending
        if ($village == 999999) {
            transfer_to_village($village, $auto_transfer, true);
            // resource village
        } else {
            transfer_to_village($village, $auto_transfer);
        }
    } else {
        if ($village > 0) {
            $result = switch_village($village);
        }
        build($village, $result);
        if ($village == $main_village) {
            build_infantry(2, 25);
            $result = get_a2b_page();
            if (!attack($result, $village)) {
                for ($i = 0; $i < 20; $i++) {
                    if (!farm($result, $village)) {
                        break;
                    }
                    // refresh a2b page
                    $result = get_a2b_page();
                }
            }
            /*			}else{
            				// villages in building
            				transfer_to_village($village, $main_village, false, 70);
            */
        }
    }
}