本文整理汇总了PHP中add_journal函数的典型用法代码示例。如果您正苦于以下问题:PHP add_journal函数的具体用法?PHP add_journal怎么用?PHP add_journal使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_journal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_pl_exp
function check_pl_exp($login)
{
//$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
$id = is_player($login);
if (!$id) {
return 0;
}
$q = do_mysql("SELECT stats FROM players WHERE id_player = '" . $id . "';");
$stats = mysql_result($q, 0);
$stats = explode('|', $stats);
if ($stats[1] >= $stats[2]) {
$q = do_mysql("SELECT skills, rase FROM players WHERE id_player = '" . $id . "';");
$sk = mysql_fetch_assoc($q);
$sk['skills'] = explode('|', $sk['skills']);
switch ($sk['rase']) {
case 1:
$sk['skills'][0] += 1;
$sk['skills'][2] += 1;
break;
case 2:
$sk['skills'][1] += 1;
$sk['skills'][3] += 1;
break;
case 3:
$sk['skills'][0] += 1;
$sk['skills'][3] += 1;
break;
}
$sk['skills'] = implode('|', $sk['skills']);
if (substr($sk['skills'], 0, 1) == '|') {
$sk['skills'] = substr($sk['skills'], 1);
}
$stats[0] += 1;
if ($stats[0] <= 12 || $stats[0] % 10 == 0) {
$stats[3] += 1;
}
$stats[1] -= $stats[2];
$stats[2] = 600 * $stats[0] * $stats[0] + 1000 * $stats[0];
$nstats = $stats[0] . '|' . $stats[1] . '|' . $stats[2] . '|' . $stats[3] . '|' . $stats[4] . '|' . $stats[5] . '|' . $stats[6] . '|' . $stats[7];
do_mysql("UPDATE players SET stats = '" . $nstats . "', skills = '" . $sk['skills'] . "' WHERE id_player = '" . $id . "';");
add_journal('новый уровень: ' . $stats[0] . '!', $login);
add_journal('вы получили очко навыка!', $login);
}
if ($stats[4] >= $stats[5]) {
// poluchitq ochko opyta:
$stats[6] += 1;
$stats[4] -= $stats[5];
$stats[7] += 1;
$stats[5] = round((600 * $stats[0] * $stats[0] + 1000 * $stats[0]) / 9);
$nstats = $stats[0] . '|' . $stats[1] . '|' . $stats[2] . '|' . $stats[3] . '|' . $stats[4] . '|' . $stats[5] . '|' . $stats[6] . '|' . $stats[7];
do_mysql("UPDATE players SET stats = '" . $nstats . "' WHERE id_player = '" . $id . "';");
add_journal('вы получили очко опыта!', $login);
}
return 1;
}
示例2: increase_karma
function increase_karma($login, $plus)
{
//$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
$plus = preg_replace('/[^0-9]/', '', $plus);
$id = is_player($login);
$q = do_mysql("SELECT karma FROM players WHERE id_player = '" . $id . "';");
$karma = mysql_result($q, 0);
$karma += $plus;
do_mysql("UPDATE players SET karma = '" . $karma . "' WHERE id_player = '" . $id . "';");
add_journal('карма +' . $plus, $login);
return 1;
}
示例3: gain_item
function gain_item($item, $count, $login)
{
global $I_SEP_C, $p;
//$item = preg_replace ('/[^a-z0-9\._]/i', '', $item);
$count = preg_replace('/[^0-9]/', '', $count);
//$login = preg_replace ('/[^a-z0-9_]/', '', $login);
if (!$item || !$count || !$login) {
put_error('заполните усе данные (это к админу)');
}
$id = is_player($login);
include_once 'modules/f_create_item.php';
include_once 'modules/f_add_item_to_pl.php';
include_once 'modules/f_add_item_to_loc.php';
include_once 'modules/f_get_it_name.php';
if (substr($item, 2, 1) == 'm') {
$nitem = create_item($item);
//add_item_to_pl ($login, $nitem);
$name = get_it_name($nitem);
$q = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $login . "' AND is_in = 'inv' AND weight > 0;");
$c = mysql_result($q, 0);
if ($c > $I_SEP_C) {
add_item_to_loc($p['location'], $nitem);
} else {
$q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $login . "' AND is_in = 'inv' AND realname = '" . $item . "';");
if (mysql_num_rows($q)) {
$fn = mysql_result($q, 0);
do_mysql("UPDATE items SET on_take = on_take + " . $count . " WHERE fullname = '" . $fn . "';");
do_mysql("DELETE FROM items WHERE fullname = '" . $nitem . "';");
} else {
add_item_to_pl($login, $nitem);
do_mysql("UPDATE items SET on_take = '" . $count . "' WHERE fullname = '" . $nitem . "';");
}
}
add_journal('вы получили ' . $name . '!', $login);
} else {
for ($i = 0; $i < $count; $i++) {
$nitem = create_item($item);
$name = get_it_name($nitem);
$q = do_mysql("SELECT COUNT(*) FROM items WHERE belongs = '" . $login . "' AND is_in = 'inv' AND weight > 0;");
$c = mysql_result($q, 0);
if ($c > $I_SEP_C) {
add_item_to_loc($p['location'], $nitem);
} else {
add_item_to_pl($login, $nitem);
}
add_journal('вы получили ' . $name . '!', $login);
}
}
return $nitem;
}
示例4: block
function block($to)
{
$id = is_player($to);
if ($id) {
$q = do_mysql("SELECT name, location FROM players WHERE id_player = '" . $id . "';");
$p = mysql_fetch_assoc($q);
add_journal($p['name'] . ' блокировал!', 'l.' . $p['location']);
} else {
$id = is_npc($to);
$q = do_mysql("SELECT name, location FROM npc WHERE id_npc = '" . $id . "';");
$n = mysql_fetch_assoc($q);
add_journal($n['name'] . ' блокировал!', 'l.' . $n['location']);
}
return 1;
}
示例5: gain_silver
function gain_silver($silver, $login)
{
$silver = preg_replace('/[^-0-9]/', '', $silver);
//$login = preg_replace ('/[^a-z0-9_]/', '', $login);
$id = is_player($login);
if (!$id) {
return 0;
}
do_mysql("UPDATE players SET money = money + '" . $silver . "' WHERE id_player = '" . $id . "';");
if ($silver > -1) {
add_journal('серебро +' . $silver, $login);
} else {
add_journal('серебро ' . $silver, $login);
}
//add_journal ('[green]'.$login.' +'.$silver.'[/end]', 'maxx');
return 1;
}
示例6: gain_peace_exp
function gain_peace_exp($exp, $login)
{
$exp = preg_replace('/[^0-9]/', '', $exp);
//$login = preg_replace ('/[^a-z0-9_]/', '', $login);
$id = is_player($login);
$q = do_mysql("SELECT stats FROM players WHERE id_player = '" . $id . "';");
$stats = mysql_result($q, 0);
$stats = explode('|', $stats);
$stats[1] += $exp;
$stats[4] += $exp;
$nstats = $stats[0] . '|' . $stats[1] . '|' . $stats[2] . '|' . $stats[3] . '|' . $stats[4] . '|' . $stats[5] . '|' . $stats[6] . '|' . $stats[7];
include_once 'modules/f_check_pl_exp.php';
do_mysql("UPDATE players SET stats = '" . $nstats . "' WHERE id_player = '" . $id . "';");
add_journal('exp +' . $exp, $login);
check_pl_exp($login);
return 1;
}
示例7: mag_summon
function mag_summon($spell, $login)
{
//$spell = preg_replace ('/[^a-z0-9_]/i', '', $spell);
//$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
$id = is_player($login);
$q = do_mysql("SELECT cname FROM magic WHERE fullname = '" . $spell . "';");
if (!mysql_num_rows($q)) {
return 0;
}
$fullname = mysql_result($q, 0);
if (!$fullname) {
return 0;
}
// zapros na lokaciju igroka i kolichestvo priruchennyh zhivotnyh
$q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
if (!mysql_num_rows($q)) {
return 0;
}
$loc = mysql_result($q, 0);
$q = do_mysql("SELECT COUNT(*) FROM npc WHERE belongs = '" . $login . "';");
$c = mysql_result($q, 0);
if ($c > 0) {
put_g_error('у вас уже есть нпц, принадлежащие вам');
}
// sozdaem npc:
include_once 'modules/f_create_npc.php';
$npc = create_npc($fullname, substr($loc, 0, 4), $loc);
$nid = is_npc($npc);
// izmenim imja:
$q = do_mysql("SELECT name FROM npc WHERE id_npc = '" . $nid . "';");
$name = mysql_result($q, 0);
$nname = 'призванный ' . $name;
$fullname = $npc . '.' . $login;
// ataka:
$q = do_mysql("SELECT in_battle FROM players WHERE id_player = '" . $id . "';");
$inb = mysql_result($q, 0);
do_mysql("UPDATE npc SET fullname = '" . $fullname . "', name = '" . $nname . "', belongs = '" . $login . "', move = '30', in_battle = '" . $inb . "', type = 'a' WHERE id_npc = '" . $nid . "';");
$q = do_mysql("SELECT name FROM players WHERE id_player = '" . $id . "';");
$pn = mysql_result($q, 0);
add_journal($pn . ': призвал ' . $name . '!', 'l.' . $loc);
return 1;
}
示例8: drop_item
function drop_item($item, $login)
{
//$item = preg_replace ('/[^a-z0-9\._]/i', '', $item);
//$login = mysql_real_escape_string ($login);
$id = is_player($login);
$q = do_mysql("SELECT name FROM items WHERE belongs = '" . $login . "' AND is_in <> 'ban' AND fullname = '" . $item . "';");
if (!mysql_num_rows($q)) {
put_g_error('у вас нету этой вещи');
}
$name = mysql_result($q, 0);
// raz vse estq, vykinem v lokaciju.
$q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
$loc = mysql_result($q, 0);
include_once 'modules/f_add_item_to_loc.php';
add_item_to_loc($loc, $item);
$q = do_mysql("SELECT gender, name FROM players WHERE id_player = '" . $id . "';");
$p = mysql_fetch_assoc($q);
if ($p['gender'] == 'male') {
$text = $p['name'] . ' 6poccul';
} else {
$text = $p['name'] . ' 6poccula';
}
add_journal($text . ' ' . $name . '!', 'l.' . $loc);
}
示例9: do_mysql
$nn['move'] = 30;
$f .= $nn['name'] . ' сного пойдет за вами!';
}
do_mysql("UPDATE npc SET move = '" . $nn['move'] . "' WHERE id_npc = '" . $nid . "';");
} else {
if ($part == 'sit') {
$f .= $nn['name'] . ' сел';
add_journal('<p>' . $nn['name'] . ' сел</p>', 'l.' . $p['location'], 0);
} else {
if ($part == 'lay') {
$f .= $nn['name'] . ' лег';
add_journal('<p>' . $nn['name'] . ' лег</p>', 'l.' . $p['location'], 0);
} else {
if ($part == 'give_hand') {
$f .= $nn['name'] . ' дал вам лапу';
add_journal('<p>' . $nn['name'] . ' дал ' . $LOGIN . ' лапу</p>', 'l.' . $p['location'], 0);
} else {
if ($part == 'go_away') {
if (substr($npc, strlen($npc) - strlen($LOGIN)) == $LOGIN) {
// prizvannyj
do_mysql("DELETE FROM npc WHERE id_npc = '" . $nid . "';");
$f .= $nn['name'] . ' изчез.';
} else {
$nn['name'] = preg_replace('/[a-z]/', '', $nn['name']);
do_mysql("UPDATE npc SET name = '" . $nn['name'] . "', belongs = '0', in_battle = '0' WHERE id_npc = '" . $nid . "';");
$f .= $nn['name'] . ' обиделся и ушел.';
}
} else {
if ($part == 'har') {
$f .= '<b>характеристика:</b><br/>';
$f .= 'сила: ' . $nn['str'] . '<br/>';
示例10: put_g_error
}
if (!$p['skills'][35]) {
put_g_error('нема навыка - нема дров }=[');
}
$f = '';
$q = do_mysql("SELECT on_use FROM items WHERE fullname = '" . $item . "';");
$time = mysql_result($q, 0);
if ($time > 0 && $time > time()) {
add_journal('Нету гринписа на вас! Глянь во что дерево превратили!!!', $LOGIN);
} else {
$q = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $item . "';");
$count = mysql_result($q, 0);
if ($time > 0) {
do_mysql("UPDATE items SET on_use = '' WHERE fullname = '" . $item . "';");
$count = 5;
}
if ($p['skills'][35] * 10 >= rand(0, 100)) {
// рубим ветви -
$count--;
include_once 'modules/f_gain_item.php';
gain_item('i.q.que.vetka', 1, $LOGIN);
} else {
add_journal('Вам неудалось срубить ветки!', $LOGIN);
$count--;
}
// obnovim kolichestvo
do_mysql("UPDATE items SET on_take = '" . $count . "' WHERE fullname = '" . $item . "';");
if ($count == 0) {
do_mysql("UPDATE items SET on_use = '" . (time() + 300) . "' WHERE fullname = '" . $item . "';");
}
}
示例11: mysql_result
}
$count_i = mysql_result($q, 0);
if ($count > $count_i) {
$count = $count_i;
}
if (!$count) {
$count = 1;
}
$iq = do_mysql("SELECT name FROM items WHERE fullname = '" . $item . "';");
$itname = mysql_result($iq, 0);
include_once 'modules/f_add_item_to_loc.php';
// esli kidaetsja vse:
if ($count == $count_i) {
add_item_to_loc($p['location'], $item);
} else {
include_once 'modules/f_decrease_misc.php';
include_once 'modules/f_create_item_m.php';
include_once 'modules/f_real_name.php';
$rn = real_name($item);
$nitem = create_item_m($rn, $count);
decrease_misc($item, $count);
add_item_to_loc($p['location'], $nitem);
}
if ($p['gender'] == 'male') {
$vz = 'бросил';
} else {
$vz = 'бросила';
}
add_journal('<p>' . $p['name'] . ' ' . $vz . ' ' . $itname . ' (' . $count . ')</p>', 'l.' . $p['location']);
$NO_CONTINUE = 1;
include 'modules/s_journal.php';
示例12: do_mysql
<?php
// butylka:
// esli rjadom estq bereg reki ili bereg ozera, to ona prevratitsja v vodu
$q = do_mysql("SELECT COUNT(*) FROM items WHERE (realname = 'i.o.sta.seashore' OR realname = 'i.o.sta.riverbank' OR realname = 'i.o.sta.lake') AND location = '" . $p['location'] . "';");
$c = mysql_result($q, 0);
if ($c) {
// naberem vody:
include_once 'modules/f_delete_item.php';
include_once 'modules/f_gain_item.php';
delete_item($item);
gain_item('i.f.dri.nor.water21', 1, $LOGIN);
} else {
add_journal('никакого эффекта', $LOGIN);
}
$action = '';
示例13: do_mysql
<?php
// novyj rjugzak 5
$p['settings'][5] = 5;
do_mysql("UPDATE players SET settings = '" . $p['settings'] . "' WHERE login = '" . $LOGIN . "';");
add_journal('вы сменили заплесный мешок!', $LOGIN);
include_once 'modules/f_delete_item.php';
delete_item($item);
示例14: real_name
$to = real_name($to);
// dalee, berem shans prigotovitq
// on raven 100 - ves * 10 + navyk * 10.
// esli ves > 30, on raven navyku prigotovlenija
// esli navyk 0, shans 0
$chanse = 0;
if ($wgh < 30) {
$chanse = 100 - $wgh * 10 + $p['skills'][37] * 10;
} else {
$chanse = $p['skills'][37];
}
if (!$p['skills'][37]) {
$chanse = 0;
}
// proverjaem vyshlo li prigotovitq -
if (rand(0, 100) <= $chanse) {
$to = str_replace('raw_', 'fry_', $to);
$to = str_replace('fish', 'fry_fish', $to);
include_once 'modules/f_gain_item.php';
gain_item($to, 1, $LOGIN);
} else {
add_journal('еда обуглилась...', $LOGIN);
}
}
} else {
if ($_GET['sa'] == 'takeugolq') {
include_once 'modules/f_gain_item.php';
gain_item('i.q.que.alch.ugolq', 1, $LOGIN);
}
}
}
示例15: rand
<?php
// skript ispolqzovanija regeneracii:
$lp = rand(0, $p['skills'][5]) * $p['skills'][0];
$p['life'][0] += $lp;
if ($p['life'][0] > $p['life'][1]) {
$p['life'][0] = $p['life'][1];
}
$nlife = $p['life'][0] . '|' . $p['life'][1];
add_journal('жизнь +' . $lp . '!', $LOGIN);
// zalechivanie ran -
$pp = $p['skills'][5] * 10;
if (rand(0, 100) <= $pp && $p['status1'][2] == 1) {
$p['status1'][2] = 0;
add_journal('ваши раны зажили!', $LOGIN);
}
do_mysql("UPDATE players SET life = '" . $nlife . "', status1 = '" . $p['status1'] . "' WHERE id_player = '" . $p['id_player'] . "';");