Example #1
0
function kill(&$pa, &$pd)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    $chprocess($pa, $pd);
    eval(import_module('sys', 'logger'));
    if (in_array($pd['state'], array(20, 21, 22, 23, 24, 25, 27, 29))) {
        if (\skillbase\skill_query(58, $pd) && (int) \skillbase\skill_getvalue(58, 'r', $pd) == 0) {
            \skillbase\skill_setvalue(58, 'r', '1', $pd);
            if ($pd['state'] == 27 && !$pd['sourceless']) {
                $log .= "<span class=\"lime\">但是,由于你及时按下了BOMB键,你原地满血复活了!</span><br>";
                $w_log = "<span class=\"lime\">但是,由于{$pd['name']}及时按下了BOMB键,其原地满血复活了!</span><br>";
                \logger\logsave($pa['pid'], $now, $w_log, 'b');
            } else {
                //击杀复活提示将接管player_kill_enemy进行
            }
            $pd['state'] = 0;
            $pd['hp'] = $pd['mhp'];
            $pd['skill58_flag'] = 1;
            if ($pd['type'] == 0) {
                $alivenum++;
            }
            save_gameinfo();
            addnews($now, 'revival', $pd['name']);
            //满血复活时加成效果(这个其实是技能“新生”的内容,但直接做在一起好了)
            $pd['mhp'] += $pd['lvl'] * 2;
            $pd['hp'] += $pd['lvl'] * 2;
            $pd['def'] += $pd['lvl'] * 5;
        }
    }
}
Example #2
0
function save_enemy_battlelog(&$pl)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('sys', 'logger'));
    \logger\logsave($pl['pid'], $now, $pl['battlelog'], 'b');
}
Example #3
0
function send_poison_enemylog($itm, $itmsk)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('sys', 'player', 'logger'));
    if ($hp <= 0) {
        $w_log = "<span class=\"red\">{$name}食用了你下毒的补给{$itm}并被毒死了!</span><br>";
        \logger\logsave($itmsk, $now, $w_log, 'b');
    } else {
        $w_log = "<span class=\"yellow\">{$name}食用了你下毒的补给{$itm}!</span><br>";
        \logger\logsave($itmsk, $now, $w_log, 'b');
    }
}
Example #4
0
function kill(&$pa, &$pd)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    $chprocess($pa, $pd);
    eval(import_module('sys', 'logger'));
    if (in_array($pd['state'], array(20, 21, 22, 23, 24, 25, 27, 29))) {
        if (\skillbase\skill_query(427, $pd)) {
            if ($pa['type'] == 88 || $pa['type'] == 1) {
                $log .= "<span class=\"linen\">都告诉你了,对某些NPC无效……快去死吧。</span><br>";
                return;
            }
            \skillbase\skill_setvalue(427, 'r', '1', $pd);
            if ($pd['state'] == 27 && !$pd['sourceless']) {
                $log .= "<span class=\"lime\">但是,由于你及时按下了BOMB键,你原地满血复活了!</span><br>";
                $w_log = "<span class=\"lime\">但是,由于{$pd['name']}及时按下了BOMB键,其原地满血复活了!</span><br>";
                \logger\logsave($pa['pid'], $now, $w_log, 'b');
            } else {
                //击杀复活提示将接管player_kill_enemy进行
            }
            $pd['state'] = 0;
            $pd['hp'] = $pd['mhp'];
            $pd['skill427_flag'] = 1;
            $deathnum--;
            if ($pd['type'] == 0) {
                $alivenum++;
            }
            save_gameinfo();
            if (\skillbase\skill_query(424, $pd)) {
                $clv = \skillbase\skill_getvalue(424, 'lvl', $pd);
                $clv = $clv - 2;
                if ($clv < 0) {
                    $clv = 0;
                }
                \skillbase\skill_setvalue(424, 'lvl', $clv, $pd);
            }
            //陷阱杀人得技能点一起放在这里
            if ($pd['state'] == 27) {
                $pa['skillpoint'] += 2;
                if (\skillbase\skill_query(424, $pa)) {
                    $clv = \skillbase\skill_getvalue(424, 'lvl', $pa);
                    $clv++;
                    \skillbase\skill_setvalue(424, 'lvl', $clv, $pa);
                }
            }
            addnews($now, 'revival', $pd['name']);
        }
    }
}
Example #5
0
function check_trapdef_proc()
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('sys', 'player', 'trap', 'logger'));
    $proc_rate = calculate_trapdef_proc_rate();
    $dice = rand(0, 99);
    if ($dice < $proc_rate) {
        //迎击触发
        if ($playerflag) {
            addnews($now, 'trapdef', $name, $trname, $itm0);
            if (!$selflag) {
                $w_log = "<span class=\"yellow\">{$name}触发了你设置的陷阱{$itm0},但是没有受到任何伤害!</span><br>";
                \logger\logsave($itmsk0, $now, $w_log, 'b');
            }
        }
        $log .= "糟糕,你触发了{$trperfix}陷阱<span class=\"yellow\">{$itm0}</span>!<br>不过,身上装备着的自动迎击系统启动了!<span class=\"yellow\">在迎击功能的保护下你毫发无伤。</span><br>";
        return 1;
    }
    return 0;
}
Example #6
0
function send_trap_enemylog($is_hit)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('sys', 'player', 'trap', 'logger'));
    if ($is_hit) {
        if ($playerflag && !$selflag && $hp <= 0) {
            $w_log = "<span class=\"red\">{$name}触发了你设置的陷阱{$itm0}并被杀死了!</span><br>";
            \logger\logsave($itmsk0, $now, $w_log, 'b');
        } elseif ($playerflag && !$selflag) {
            $w_log = "<span class=\"yellow\">{$name}触发了你设置的陷阱{$itm0}!</span><br>";
            \logger\logsave($itmsk0, $now, $w_log, 'b');
        }
    } else {
        if ($playerflag && !$selflag) {
            $w_log = "<span class=\"yellow\">{$name}回避了你设置的陷阱{$itm0}!</span><br>";
            \logger\logsave($itmsk0, $now, $w_log, 'b');
        }
    }
}
Example #7
0
function skill_onload_event(&$pa)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    if (\skillbase\skill_query(57, $pa) && $pa['hp'] > 0) {
        $i = \skillbase\skill_getvalue(57, 'l', $pa);
        $z = \skillbase\skill_getvalue(57, 'p', $pa);
        eval(import_module('sys', 'player', 'skill56', 'logger'));
        //判断触发者是否就是雇佣者本身
        if ($z == $pid) {
            $employer = NULL;
        } else {
            $employer = \player\fetch_playerdata_by_pid($z);
        }
        $infochanged = 0;
        //收钱判断
        $is_hired = (int) \skillbase\skill_getvalue(56, 'h' . $i, $employer);
        if ($is_hired == 1) {
            $lastsal = (int) \skillbase\skill_getvalue(56, 'l' . $i, $employer);
            $ty = (int) \skillbase\skill_getvalue(56, 's' . $i);
            while ($now - $lastsal >= 60) {
                $mercsal = $skill56_npc['sub'][$ty]['mercsalary'];
                if ($employer !== NULL) {
                    $emoney =& $employer['money'];
                } else {
                    $emoney =& $money;
                }
                if ($emoney >= $mercsal) {
                    //收钱成功
                    $pa['money'] += $mercsal;
                    $emoney -= $mercsal;
                    $lastsal += 60;
                    \skillbase\skill_setvalue(56, 'l' . $i, $lastsal, $employer);
                    $w_log = '你支付了<span class="yellow">' . $mercsal . '</span>元作为佣兵<span class="yellow">' . $skill56_npc['sub'][$ty]['name'] . '</span>的薪水!<br>';
                    \logger\logsave($z, $lastsal, $w_log, 'b');
                    $infochanged = 1;
                    $pa['infochanged'] = 1;
                } else {
                    if ($now - $lastsal >= $merc_leave_timeout) {
                        //强制解雇
                        $pa['money'] += $emoney;
                        $emoney = 0;
                        $lastsal += $merc_leave_timeout;
                        \skillbase\skill_setvalue(56, 'l' . $i, $lastsal, $employer);
                        \skillbase\skill_setvalue(56, 'h' . $i, 2, $employer);
                        if ($skill56_npc['sub'][$ty]['mercfireaction'] == 1) {
                            $pa['pls'] = 999;
                        }
                        $w_log = '<span class="red">因为你长期拖欠佣兵<span class="yellow">' . $skill56_npc['sub'][$ty]['name'] . '</span>的薪水,佣兵<span class="yellow">' . $skill56_npc['sub'][$ty]['name'] . '</span>与你解除了雇佣合同!</span><br>';
                        \logger\logsave($z, $lastsal, $w_log, 'b');
                        $infochanged = 1;
                        $pa['infochanged'] = 1;
                        break;
                    } else {
                        break;
                    }
                }
            }
        }
        if ($infochanged && $employer !== NULL) {
            \player\player_save($employer);
        }
    }
    $chprocess($pa);
}
Example #8
0
function senditem()
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('sys', 'map', 'logger', 'player', 'metman', 'input'));
    $mateid = str_replace('team', '', $action);
    if (!$mateid || strpos($action, 'team') === false) {
        $log .= '<span class="yellow">你没有遇到队友,或已经离开现场!</span><br>';
        $action = '';
        $mode = 'command';
        return;
    }
    $edata = \player\fetch_playerdata_by_pid($mateid);
    if (!isset($edata)) {
        $log .= "对方不存在!<br>";
        $action = '';
        $mode = 'command';
        return;
    }
    if ($edata['pls'] != $pls) {
        $log .= '<span class="yellow">' . $edata['name'] . '</span>已经离开了<span class="yellow">' . $plsinfo[$pls] . '</span>。<br>';
        $mode = 'command';
        $action = '';
        return;
    } elseif ($edata['hp'] <= 0) {
        $log .= '<span class="yellow">' . $edata['name'] . '</span>已经死亡,不能接受物品。<br>';
        $mode = 'command';
        $action = '';
        return;
    } elseif (!$teamID || $edata['teamID'] != $teamID || $pid == $edata['pid']) {
        $log .= '<span class="yellow">' . $edata['name'] . '</span>并非你的队友,不能接受物品。<br>';
        $mode = 'command';
        $action = '';
        return;
    }
    if ($message) {
        $log .= "<span class=\"lime\">你对{$edata['name']}说:“{$message}”</span><br>";
        $x = "<span class=\"lime\">{$name}对你说:“{$message}”</span>";
        if (!$edata['type']) {
            \logger\logsave($edata['pid'], $now, $x, 'c');
        }
    }
    if ($command != 'back') {
        $itmn = substr($command, 4);
        if (!${'itms' . $itmn}) {
            $log .= '此道具不存在!';
            $action = '';
            $mode = 'command';
            return;
        }
        $itm =& ${'itm' . $itmn};
        $itmk =& ${'itmk' . $itmn};
        $itme =& ${'itme' . $itmn};
        $itms =& ${'itms' . $itmn};
        $itmsk =& ${'itmsk' . $itmn};
        for ($i = 1; $i <= 6; $i++) {
            if (!$edata['itms' . $i]) {
                $edata['itm' . $i] = $itm;
                $edata['itmk' . $i] = $itmk;
                $edata['itme' . $i] = $itme;
                $edata['itms' . $i] = $itms;
                $edata['itmsk' . $i] = $itmsk;
                $log .= "你将<span class=\"yellow\">" . $edata['itm' . $i] . "</span>送给了<span class=\"yellow\">{$edata['name']}</span>。<br>";
                $x = "<span class=\"yellow\">{$name}</span>将<span class=\"yellow\">" . $edata['itm' . $i] . "</span>送给了你。";
                if (!$edata['type']) {
                    \logger\logsave($edata['pid'], $now, $x, 't');
                }
                addnews($now, 'senditem', $name, $edata['name'], $itm);
                \player\player_save($edata);
                $itm = $itmk = $itmsk = '';
                $itme = $itms = 0;
                $action = '';
                return;
            }
        }
        $log .= "<span class=\"yellow\">{$edata['name']}</span> 的包裹已经满了,不能赠送物品。<br>";
    }
    $action = '';
    $mode = 'command';
    return;
}
Example #9
0
function checklvlup($v, &$pa)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    eval(import_module('sys', 'player', 'logger', 'lvlctl'));
    $up_exp_temp = round((2 * $pa['lvl'] + 1) * $baseexp);
    $pa['exp'] += $v;
    if ($pa['exp'] >= $up_exp_temp && $pa['lvl'] < 255) {
        //升级判断
        $lvup = 1 + floor(($pa['exp'] - $up_exp_temp) / $baseexp / 2);
        $lvup = $lvup > 255 - $pa['lvl'] ? 255 - $pa['lvl'] : $lvup;
        $lvuphp = $lvupatt = $lvupdef = $lvupskill = $lvupsp = $lvupspref = $lvupskpt = 0;
        $sklog = '';
        for ($i = 0; $i < $lvup; $i += 1) {
            if ($pa['lvl'] < 255) {
                lvlup($pa);
            }
        }
        $up_exp_temp = round((2 * $pa['lvl'] + 1) * $baseexp);
        if ($pa['lvl'] >= 255) {
            $pa['lvl'] = 255;
            $pa['exp'] = $up_exp_temp;
        }
        $pa['upexp'] = $up_exp_temp;
        $pa['hp'] += $lvuphp;
        $pa['mhp'] += $lvuphp;
        $pa['sp'] += $lvupsp;
        $pa['msp'] += $lvupsp;
        $pa['att'] += $lvupatt;
        $pa['def'] += $lvupdef;
        /*
        if ($skname == 'all') {
        	${$perfix . 'wp'} += $lvupskill;
        	${$perfix . 'wk'} += $lvupskill;
        	${$perfix . 'wg'} += $lvupskill;
        	${$perfix . 'wc'} += $lvupskill;
        	${$perfix . 'wd'} += $lvupskill;
        	${$perfix . 'wf'} += $lvupskill;
        } elseif ($skname) {
        	${$perfix . $skname} += $lvupskill;
        }
        */
        if ($pa['sp'] + $lvupspref >= $pa['msp']) {
            $lvupspref = $pa['msp'] - $pa['sp'];
        }
        $pa['sp'] += $lvupspref;
        $pa['skillpoint'] += $lvupskpt;
        /*
        if ($skname) {
        	$sklog = ",{$sklanginfo[$skname]}+{$lvupskill}";
        }
        */
        if ($pa['pid'] === $pid) {
            $log .= "<span class=\"yellow\">你升了{$lvup}级!生命上限+{$lvuphp},体力上限+{$lvupsp},攻击+{$lvupatt},防御+{$lvupdef},体力恢复了{$lvupspref}{$sklog},获得了{$lvupskpt}点技能点!</span><br>";
        } elseif (!$pa['type']) {
            $w_log = "<span class=\"yellow\">你升了{$lvup}级!生命上限+{$lvuphp},体力上限+{$lvupsp},攻击+{$lvupatt},防御+{$lvupdef},体力恢复了{$lvupspref}{$sklog},获得了{$lvupskpt}点技能点!</span><br>";
            \logger\logsave($pa['pid'], $now, $w_log, 's');
        }
    } elseif ($pa['lvl'] >= 255) {
        $pa['lvl'] = 255;
        $pa['exp'] = $up_exp_temp;
    }
    return;
}
Example #10
0
function kill(&$pa, &$pd)
{
    if (eval(__MAGIC__)) {
        return $___RET_VALUE;
    }
    if (!\skillbase\skill_query(475, $pa) && !\skillbase\skill_query(475, $pd)) {
        return $chprocess($pa, $pd);
    }
    if ($pa['pid'] != $pd['pid'] && $pa['type'] == 0 && $pd['type'] == 0) {
        $ebounty = (int) \skillbase\skill_getvalue(475, 'bounty', $pd);
        $wptgain = round($ebounty * 0.15);
        $btgain = round($ebounty * 0.3);
        $nwpt = (int) \skillbase\skill_getvalue(475, 'wpt', $pa) + $wptgain;
        $nbt = (int) \skillbase\skill_getvalue(475, 'bounty', $pa) + $btgain;
        $nbt_pd = $ebounty - $wptgain - $btgain;
        \skillbase\skill_setvalue(475, 'wpt', $nwpt, $pa);
        \skillbase\skill_setvalue(475, 'bounty', $nbt, $pa);
        \skillbase\skill_setvalue(475, 'bounty', $nbt_pd, $pd);
        eval(import_module('sys', 'player', 'logger'));
        if ($pa['pid'] == $sdata['pid']) {
            $log .= '<span class="orange">你获得了' . $wptgain . '点胜利点数!</span><br>';
        } else {
            if (in_array($pd['state'], array(20, 21, 22, 23, 24, 25, 29))) {
                //战斗击杀
                $pa['battlelog'] .= '<span class="orange">你获得了' . $wptgain . '点胜利点数!</span><br>';
            } else {
                $w_log .= '<span class="orange">你获得了' . $wptgain . '点胜利点数!</span><br>';
                \logger\logsave($pa['pid'], $now, $w_log, 'b');
            }
        }
    } else {
        if ($pa['type'] == 0 && $pd['type'] > 0) {
            $wptarr = array(2 => 250, 5 => 1200, 6 => 2500, 11 => 750, 45 => 750, 90 => 20);
            if (isset($wptarr[$pd['type']])) {
                $wptgain = $wptarr[$pd['type']];
                $nwpt = (int) \skillbase\skill_getvalue(475, 'wpt', $pa) + $wptgain;
                \skillbase\skill_setvalue(475, 'wpt', $nwpt, $pa);
                eval(import_module('logger'));
                $log .= '<span class="orange">你获得了' . $wptgain . '点胜利点数!</span><br>';
            }
        } else {
            if ($pd['type'] == 0) {
                $cnt = (int) \skillbase\skill_getvalue(475, 'dc', $pd);
                $cnt++;
                if ($cnt > 3) {
                    $pd['mhp'] = ceil($pd['mhp'] * 0.95);
                    $nwpt = (int) \skillbase\skill_getvalue(475, 'wpt', $pd);
                    $nwpt = round($nwpt * 0.97);
                    \skillbase\skill_setvalue(475, 'wpt', $nwpt, $pd);
                }
                \skillbase\skill_setvalue(475, 'dc', $cnt, $pd);
            }
        }
    }
    return $chprocess($pa, $pd);
}