本文整理汇总了PHP中battle_log函数的典型用法代码示例。如果您正苦于以下问题:PHP battle_log函数的具体用法?PHP battle_log怎么用?PHP battle_log使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了battle_log函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mysql_query
$mana_add = 200;
break;
case "mn500":
$mana_add = 500;
break;
case "mn1000":
$mana_add = 1000;
break;
}
mysql_query("UPDATE inv SET iznos = iznos+1 WHERE id='" . $id . "'");
$DAT = mysql_fetch_array(mysql_query("SELECT iznos,iznos_max FROM inv WHERE id = '" . $id . "'"));
if ($DAT["iznos"] == $DAT["iznos_max"]) {
mysql_query("UPDATE users SET slot" . $slot . "=0 WHERE login='" . $login . "'");
mysql_query("DELETE FROM inv WHERE id = '" . $id . "'");
$_SESSION["message"] .= "Заклинание <b>«" . $name . "»</b> полностью использован!";
}
$mana = $db["mana"];
$mana_all = $db["mana_all"];
if ($mana_all - $mana < $mana_add) {
$mana_add = $mana_all - $mana;
}
$mana_new = $mana + $mana_add;
setMN($login, $mana_new, $mana_all);
$battle_id = $db["battle"];
$date = date("H:i");
$span = $db["battle_team"] == 1 ? "p1" : "p2";
$phrase = "<span class=date>{$date}</span> <span class={$span}>{$login}</span> использовал свиток <b>«" . $name . "»</b> и восстановил ману <span class=hitted>+{$mana_add}</span> [{$mana_new}/{$mana_all}]<br>";
$t = time();
battle_log($battle_id, $phrase);
}
}
示例2: time
if ($res["battle"] == 0) {
$timeout = time() + 3 * 60;
say("toroom", "<b>" . $login . "</b> напал на <b>" . $res["player"] . "</b>", $login);
mysql_query("INSERT INTO zayavka(status,type,timeout,creator) VALUES('3','" . $battle_type . "','3','" . $mine_id . "')");
mysql_query("INSERT INTO teams(player,team,ip,battle_id) VALUES('" . $db["login"] . "','2','" . $db["last_ip"] . "','" . $mine_id . "')");
mysql_query("INSERT INTO teams(player,team,ip,battle_id) VALUES('" . $res["player"] . "','1','" . $res["last_ip"] . "','" . $mine_id . "')");
mysql_query("INSERT INTO battles(type, creator_id, lasthit) VALUES('" . $battle_type . "', '" . $mine_id . "', '" . $timeout . "')");
goBattle($db["login"]);
goBattle($res["player"]);
} else {
if ($res["battle"] != 0) {
$D = mysql_fetch_array(mysql_query("SELECT * FROM teams WHERE player='" . $res["player"] . "'"));
if ($D) {
mysql_query("INSERT INTO teams(player, team, ip, battle_id) VALUES('" . $login . "','" . ($D["team"] == 1 ? 2 : 1) . "','" . $db["last_ip"] . "','" . $D["battle_id"] . "')");
$att = "<span class=date2>{$date}</span> <script>drwfl('" . $db['login'] . "','" . $db['id'] . "','" . $db['level'] . "','" . $db['dealer'] . "','" . $db['orden'] . "','" . $db['admin_level'] . "','" . $db['clan_short'] . "','" . $db['clan'] . "');</script> вмешался в поединок!</b><hr>";
battle_log($res['battle'], $att);
goBattle($login);
}
}
}
}
}
}
}
}
}
}
##################Декорации#############################################333
foreach ($Items_Array as $item_info) {
if (in_array($step1["fwd_cord"], $item_info)) {
$draw_item_fwd = $item_info["type"];
示例3: mysql_fetch_Array
echo "OK";
} else {
echo "NO USERS";
}
}
}
if ($_POST["heal"]) {
$query = mysql_fetch_Array(mysql_query("SELECT * FROM zayavka WHERE type=23"));
if ($query) {
$res = mysql_fetch_array(mysql_Query("SELECT * FROM battles WHERE creator_id=" . $query["creator"]));
$have_bot = mysql_fetch_array(mysql_Query("SELECT * FROM bot_temp WHERE battle_id=" . $res["id"] . " and team=2"));
$hp_add = 50000;
$new_hp = $have_bot["hp"] + $hp_add;
if ($new_hp > $have_bot["hp_all"]) {
$new_hp = $have_bot["hp_all"];
$hp_add = $have_bot["hp_all"] - $have_bot["hp"];
}
mysql_Query("UPDATE bot_temp SET hp=hp+{$hp_add} WHERE id=" . $have_bot["id"]);
$phrase_priem = "<span class=date>" . date("H:i") . "</span> <b>Исчадие Хаоса</b> понял что его спасение это прием <b>Воля к победе. <font color=green>+{$hp_add}</font></b> [" . $new_hp . "/" . $have_bot['hp_all'] . "]<br>";
battle_log($res["id"], $phrase_priem);
} else {
echo "You Should Start Battle";
}
}
?>
<form method="POST" action="?spell=chaos_battle">
Битва с Исчадием Хаоса <input type="submit" name="startBattle" value="Start Battle"><BR>
Heal HP <input type="submit" name="heal" value="OK"><BR>
</form>
<?php
}
示例4: startBattle
function startBattle($creator_id)
{
$zay = mysql_fetch_array(mysql_query("SELECT * FROM zayavka WHERE creator={$creator_id}"));
if ($zay["status"] != 3) {
$timeout = time() + $zay["timeout"] * 60;
mysql_query("UPDATE zayavka SET status='3' WHERE creator={$creator_id}");
mysql_query("INSERT INTO battles(type, creator_id, lasthit) VALUES('" . $zay["type"] . "', '" . $zay["creator"] . "', '" . $timeout . "')");
$b_id = mysql_insert_id();
#if ($zay["type"]!=1 && $zay["type"]!=100 && (rand(0,1)==1))mysql_query("INSERT INTO bot_temp(bot_name,hp,hp_all,battle_id,prototype,team,two_hands,shield_hands) VALUES('Снеговик','15000','15000','".$b_id."','Снеговик','".rand(1,2)."','2','0')");//new year
if ($zay["type"] == 7) {
include "bot_array.php";
foreach ($bot_level[$zay["maxlev1"]] as $k => $v) {
$bot_prototype = $k;
foreach ($v as $t => $tt) {
$hp_bot = $v["hp"];
$team_bot = $v["team"];
$two_hands_bot = $v["bot_two_hands"];
$shield_hands_bot = $v["bot_shield_hands"];
}
mysql_query("INSERT INTO bot_temp(bot_name,hp,hp_all,battle_id,prototype,team,two_hands,shield_hands) VALUES('{$bot_prototype}','{$hp_bot}','{$hp_bot}','" . $b_id . "','{$bot_prototype}','{$team_bot}','{$two_hands_bot}','{$shield_hands_bot}')");
}
}
mysql_query("UPDATE users,(SELECT team, player FROM teams WHERE battle_id=" . $creator_id . ") as upd SET zayavka=1,battle='" . $b_id . "', battle_team=upd.team, battle_pos='" . $creator_id . "' WHERE login=upd.player");
mysql_query("INSERT INTO battle_units(battle_id,player,hp) (SELECT '" . $b_id . "',users.login,users.level/2+5+users.duxovnost FROM teams LEFT JOIN users on users.login=teams.player WHERE teams.battle_id='" . $creator_id . "')");
$query_sql = mysql_query("SELECT group_concat(player) as players,team FROM `teams` WHERE battle_id=" . $creator_id . " GROUP by team");
while ($query = mysql_fetch_array($query_sql)) {
if ($query["team"] == 1) {
$team1_p = $query["players"];
} else {
if ($query["team"] == 2) {
$team2_p = $query["players"];
}
}
}
$date_s = date("Y-m-d H:i:s");
$diss = array();
$diss[0] = "На часах было <span class=date>{$date_s}</span>, когда <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> завязали драку...<hr>";
$diss[1] = "Небо было чистым и ничто не предвещало беды...Но когда часы показали <span class=date>{$date_s}</span>, <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> принялись варварски избивать друг друга.<hr>";
$diss[2] = "В этот день у скорой помощи было много работы...И в <span class=date>{$date_s}</span> поступил еще один вызов - <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> начали драться прямо на улице.<hr>";
$diss[3] = "Часы на башне показали <span class=date>{$date_s}</span>, когда <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> решили разобраться кто из них круче.<hr>";
$diss[4] = "Был обычный солнечный день...Но когда тени от стрелок часов показали <span class=date>{$date_s}</span>, <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> накинулись друг на друга, так словно не ели три дня.<hr>";
$diss[5] = "<span class=date>{$date_s}</span> Стая ворон с оглушительным карканьем сорвалась с низкого неба, хлопьями пепла упав на просяное поле; и рука сама нащупала за поясом рукоять меча. Просто так, для успокоения. Страха не было, но ощущение шершавой рукояти под ладонью доставило удовольствие. <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> замерли друг перед другом.<hr>";
$diss[6] = "<span class=date>{$date_s}</span> Мир ещё не решил, каким ему стать. Он просто плыл по течению, плескался, высматривал берега, наслаждаясь безмятежным покачиванием на волнах времени, изливавшегося теперь из совершенно другого источника. И не было ясно, кто останется в живых <b style='color:#000000'>{$team1_p}</b> или <b style='color:#000000'>{$team2_p}</b> ...<hr>";
$diss[7] = "Часы показывали <span class=date>{$date_s}</span>, когда <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> бросили вызов друг другу...<hr>";
$diss[8] = "Часы показывали <span class=date>{$date_s}</span>, когда <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> выбежали на арену...<hr>";
$diss[9] = "Часы показывали <span class=date>{$date_s}</span>, когда <b style='color:#000000'>{$team1_p}</b> и <b style='color:#000000'>{$team2_p}</b> вызвались на этот жестокий бой...<hr>";
$diss[10] = "Худой уборщик быстро сбежал со ступенек арены вниз, унося с собой напоминания, оставшиеся от предыдущего боя. Не успел он уйти, как на песок ступили новые бойцы, молча поклонились друг другу и завязалась новая битва.<hr>";
$diss[11] = "Колыхнулось покрывало в бортике арены, и как будто из стены, медленно стали выплывать люди. И какого только оружия они не держали – сразу видно, что идут воины, а не рыбаки или земледельцы. Чинно, не спеша, готовые к поединку повернулись навстречу друг другу, легко кивнули головами и бой начался!<hr>";
$diss_put = $diss[rand(0, 11)];
battle_log($b_id, $diss_put);
}
}
示例5: getNextEnemy
$opponent = getNextEnemy($login, $enemy_team, $creator, $bid);
$phrase_priem = "<span class=date>{$date}</span> <span class={$span}>{$login}</span> понял что его спасение это прием <b>Подлый удар</b>.<br> ";
battle_log($bid, $phrase_priem);
mysql_query("UPDATE person_on SET pr_active=1,pr_wait_for=" . (int) $is_pr["wait"] . " WHERE id_person='" . $db["id"] . "' and pr_name='" . $priem . "' and battle_id='" . $bid . "'");
mysql_query("UPDATE battle_units SET hit=hit-" . (int) $is_pr["hit"] . ",krit=krit-" . (int) $is_pr["krit"] . ",uvarot=uvarot-" . (int) $is_pr["uvarot"] . ",block=block-" . (int) $is_pr["block"] . ",hp=hp-" . (int) $is_pr["hp"] . ",counter=counter-" . (int) $is_pr["all_hit"] . " WHERE player='" . $login . "' and battle_id='" . $bid . "'");
}
} else {
if ($priem == "hitshock") {
if ($db['hp'] > 0) {
$select_target = htmlspecialchars(addslashes($_POST["target"]));
$q = mysql_query("SELECT * FROM users WHERE login='" . $select_target . "' and battle=" . $bid . " and battle_team=" . $enemy_team . " and hp>0");
$res = mysql_fetch_array($q);
if ($res) {
mysql_query("UPDATE person_on SET pr_wait_for=pr_wait_for+2 WHERE id_person='" . $res["id"] . "' and battle_id='" . $bid . "' and pr_active=1");
$phrase_priem = "<span class=date>{$date}</span> <span class={$span}>{$login}</span> сам не поняв зачем, применил прием <b>" . $is_pr["name"] . "</b> на персонажа <b>" . $res["login"] . "</b>.<br> ";
battle_log($bid, $phrase_priem);
mysql_query("UPDATE person_on SET pr_active=1,pr_wait_for=" . (int) $is_pr["wait"] . " WHERE id_person='" . $db["id"] . "' and pr_name='" . $priem . "' and battle_id='" . $bid . "'");
mysql_query("UPDATE battle_units SET hit=hit-" . (int) $is_pr["hit"] . ",krit=krit-" . (int) $is_pr["krit"] . ",uvarot=uvarot-" . (int) $is_pr["uvarot"] . ",block=block-" . (int) $is_pr["block"] . ",hp=hp-" . (int) $is_pr["hp"] . ",counter=counter-" . (int) $is_pr["all_hit"] . " WHERE player='" . $login . "' and battle_id='" . $bid . "'");
}
}
} else {
if ($db['hp'] > 0) {
mysql_query("UPDATE person_on SET pr_active=2,pr_wait_for=" . (int) $is_pr["wait"] . " WHERE id_person='" . $db["id"] . "' and pr_name='" . $priem . "' and battle_id='" . $bid . "'");
mysql_query("UPDATE battle_units SET hit=hit-" . (int) $is_pr["hit"] . ",krit=krit-" . (int) $is_pr["krit"] . ",uvarot=uvarot-" . (int) $is_pr["uvarot"] . ",block=block-" . (int) $is_pr["block"] . ",hp=hp-" . (int) $is_pr["hp"] . ",parry=parry-" . (int) $is_pr["parry"] . ",counter=counter-" . (int) $is_pr["all_hit"] . " WHERE player='" . $login . "' and battle_id='" . $bid . "'");
}
}
}
}
}
}
}
示例6: Header
}
Header("Location: main.php?act=go&level=crypt_go&tmp={$now}");
die;
}
//----------------------------Нападения--------------------------------------------------
if ($_GET['action'] == 'attack' && count($Bot_Array[$_GET['id']]) && !$db["zayavka"] && $db["hp"] > 0) {
$id = htmlspecialchars(addslashes($_GET['id']));
$sel_battle = mysql_fetch_array(mysql_query("SELECT * FROM bot_temp WHERE group_id={$group_id} and cord='" . $id . "' and etaj=2"));
if ($sel_battle) {
$battle_id = $sel_battle['battle_id'];
$bat = mysql_fetch_Array(mysql_query("SELECT * FROM battles WHERE id='" . $battle_id . "'"));
$creator = $bat['creator_id'];
mysql_query("INSERT INTO teams(player, team, ip, battle_id) VALUES('" . $login . "', '1', '" . $ip . "', '" . $creator . "')");
$date = date("H:i");
$att = "<span class=date2>{$date}</span> <script>drwfl('" . $db['login'] . "','" . $db['id'] . "','" . $db['level'] . "','" . $db['dealer'] . "','" . $db['orden'] . "','" . $db['admin_level'] . "','" . $db['clan_short'] . "','" . $db['clan'] . "');</script> вмешался в поединок!<hr>";
battle_log($battle_id, $att);
goBattle($login);
} else {
$timeout = time() + 180;
mysql_query("UPDATE users SET fwd='" . $id . "' WHERE login='" . $login . "'");
mysql_query("INSERT INTO zayavka(status,type,timeout,creator) VALUES('3','33','3','" . $mine_id . "')");
mysql_query("INSERT INTO teams(player,team,ip,battle_id) VALUES('" . $login . "','1','" . $ip . "','" . $mine_id . "')");
mysql_query("INSERT INTO battles(type, creator_id, lasthit) VALUES('33', '" . $mine_id . "', '" . $timeout . "')");
$b_id = mysql_insert_id();
foreach ($Bot_Array[$id] as $value) {
$i++;
$attacked_bot = $Bot_Names[$value];
$GBD = mysql_fetch_array(mysql_query("SELECT hp_all FROM users WHERE login='" . $attacked_bot . "'"));
mysql_query("INSERT INTO bot_temp(bot_name,hp,hp_all,battle_id,prototype,team, two_hands,shield_hands,group_id,cord,etaj) VALUES('" . $attacked_bot . "(" . $i . ")','" . $GBD["hp_all"] . "','" . $GBD["hp_all"] . "','" . $b_id . "','" . $attacked_bot . "','2','1','" . rand(0, 1) . "','" . $group_id . "','" . $id . "','2')");
}
goBattle($login);
示例7: ceil
$hp_now = $victims[$i]["hp"];
$hp_all = $victims[$i]["hp_all"];
$opponenti = $victims[$i]["opponent"];
$hp_add = ceil(mt_rand($hp_min, $hp_max));
if ($hp_all - $hp_now < $hp_add) {
$hp_add = $hp_all - $hp_now;
}
$hp_new = $hp_now + $hp_add;
setHP($opponenti, $hp_new, $hp_all);
$ret['action'] .= "<span class=date>{$date}</span> <span class={$span}>" . $login . "</span> понимая, что ситуация становится критической, применил прием <span class=magic>" . $is_pr["name"] . "</span> и восстановил здоровье <span class={$span}>" . $opponenti . "</span> на <span class=hitted>+{$hp_add}</span> [{$hp_new}/{$hp_all}]<BR>";
}
if ($db["hp"] < $db["hp_all"]) {
if ($db["hp_all"] - $db["hp"] < $hp_me) {
$hp_me = $db["hp_all"] - $db["hp"];
}
$hp_new_me = $db["hp"] + $hp_me;
setHP($login, $hp_new_me, $db["hp_all"]);
$ret['action'] .= "<span class=date>{$date}</span> <span class={$span}>" . $login . "</span> понимая, что ситуация становится критической, применил прием <span class=magic>" . $is_pr["name"] . "</span> и восстановил свое здоровье <span class=hitted>+{$hp_me}</span> [{$hp_new_me}/" . $db["hp_all"] . "]<BR>";
$yes_me = 1;
}
if (count($victims) > 0 || $yes_me == 1) {
mysql_query("UPDATE battle_units SET hit=hit-" . (int) $is_pr["hit"] . ",krit=krit-" . (int) $is_pr["krit"] . ",uvarot=uvarot-" . (int) $is_pr["uvarot"] . ",block=block-" . (int) $is_pr["block"] . ",hp=hp-" . (int) $is_pr["hp"] . ",counter=counter-" . (int) $is_pr["all_hit"] . " WHERE player='" . $login . "' and battle_id='" . $b_id . "'");
mysql_query("UPDATE person_on SET pr_active=1,pr_wait_for=" . $is_pr["wait"] . " WHERE id_person='" . $db["id"] . "' and pr_name='earthhp6' and battle_id='" . $b_id . "'");
mysql_query("UPDATE person_on SET pr_active=1,pr_wait_for=" . $is_pr["wait"] . " WHERE id_person='" . $db["id"] . "' and pr_name='earthhp7' and battle_id='" . $b_id . "'");
mysql_query("UPDATE person_on SET pr_active=1,pr_wait_for=" . $is_pr["wait"] . " WHERE id_person='" . $db["id"] . "' and pr_name='earthhp8' and battle_id='" . $b_id . "'");
mysql_query("UPDATE person_on SET pr_active=1,pr_wait_for=" . $is_pr["wait"] . " WHERE id_person='" . $db["id"] . "' and pr_name='earthhp9' and battle_id='" . $b_id . "'");
mysql_query("UPDATE person_on SET pr_active=1,pr_wait_for=" . $is_pr["wait"] . " WHERE id_person='" . $db["id"] . "' and pr_name='earthhp10' and battle_id='" . $b_id . "'");
}
battle_log($b_id, $ret['action']);
hit($login, $db["battle_opponent"], 0, 0, 0, 0, $b_id, 0);
}
示例8: switch
switch ($battle_team) {
case 1:
$mynewteam = 2;
break;
case 2:
$mynewteam = 1;
break;
}
mysql_query("INSERT INTO teams(player,team,ip,battle_id,hitted,over) VALUES('" . $login . "','" . $mynewteam . "','" . $db["remote_ip"] . "','" . $battle_id . "','0','0')");
talk("toall", "<b>«" . $login . "»</b> вмешался в поединок против <b>«" . $def["login"] . "»</b>! [Битва Ханств]", "");
$att = "<span class=sysdate>{$date_s}</span> <script>drwfl('" . $db['login'] . "','" . $db['id'] . "','" . $db['level'] . "','" . $db['dealer'] . "','" . $db['orden'] . "','" . $db['admin_level'] . "','" . $db['clan_short'] . "','" . $db['clan'] . "');</script> вмешался в поединок!<hr>";
$log_file = "logs/" . $def['battle'] . ".dis";
$f = fopen($log_file, "a");
fputs($f, $att);
fclose($f);
battle_log($def['battle'], $att);
goBattle($login);
} else {
echo "<font color=red>Другой тип боя</font>";
}
}
}
}
//-------------------------------------------------------------
$_SESSION["my_battle"] = 0;
$_SESSION["my_creator"] = 0;
//----------------------------------------------------------------------------------
$poch = mysql_fetch_Array(mysql_query("SELECT count(*) FROM pochta WHERE whom='" . $login . "' and `read`=0"));
if ($poch[0] > 0 && empty($_SESSION['mektub'])) {
echo "<script>alert('Вам новое письмо! \"Арена\"->\"Центральная площадь\" ->\"Западное крыло\" -> \"Почт\" ');</script>";
$_SESSION['mektub'] = "pochta";
示例9: fclose
fclose($fopen_chat);
echo "12.//INICHILIRUYEM BITVU {$FirstClanName} - {$SecondClanName}<br>";
$timeout = 3;
$creator_id = 100;
$battle_type = 13;
mysql_query("INSERT INTO zayavka(status, type, timeout, creator) VALUES('3', '" . $battle_type . "', '" . $timeout . "', '" . $creator_id . "')");
mysql_query("INSERT INTO battles(type, creator_id, lasthit) VALUES('" . $battle_type . "', '" . $creator_id . "', '" . (time() + 60 * $timeout) . "')");
$b_id = mysql_insert_id();
while ($gRightTeam = mysql_fetch_array($getRightTeam)) {
$opp1 = $gRightTeam["login"];
mysql_query("UPDATE users SET zayavka=1, battle='" . $b_id . "', battle_team='1', battle_pos='" . $creator_id . "' WHERE login='" . $opp1 . "'");
mysql_query("INSERT INTO teams(player, team, ip, battle_id) VALUES('" . $opp1 . "', '1', '" . $gRightTeam["remote_ip"] . "', '" . $creator_id . "')");
mysql_query("INSERT INTO battle_units(battle_id, player, hp) VALUES('" . $b_id . "', '" . $opp1 . "', 15)");
echo "13.//BOYCHI ZANSTVA " . $FirstClanName . " " . $opp1 . " [" . $gRightTeam["id"] . "] <br>";
}
while ($gLeftTeam = mysql_fetch_array($getLeftTeam)) {
$opp2 = $gLeftTeam["login"];
mysql_query("UPDATE users SET zayavka=1, battle='" . $b_id . "', battle_team='2', battle_pos='" . $creator_id . "' WHERE login='" . $opp2 . "'");
mysql_query("INSERT INTO teams(player, team, ip, battle_id) VALUES('" . $opp2 . "','2','" . $gLeftTeam["remote_ip"] . "','" . $creator_id . "')");
mysql_query("INSERT INTO battle_units(battle_id, player, hp) VALUES('" . $b_id . "', '" . $opp2 . "', 15)");
echo "14.//BOYCHI ZANSTVA " . $SecondClanName . " " . $opp2 . " [" . $gLeftTeam["id"] . "] <br>";
}
$comment = "„асы показывали <span class='date'>" . date("d-m-Y H:i") . "</span>, когда ’анство <b>" . $FirstClanName . "</b> и ’анство <b>" . $SecondClanName . "</b> бросили вызов друг другу.<hr>";
battle_log($b_id, $comment);
// cоздаем бой
mysql_query("INSERT INTO castle_log (defender,atacker,stavka,battle_time,battle_log) VALUES ('" . $FirstClan . "','" . $SecondClan . "','" . $getSecondClan["stavka"] . "','" . time() . "','" . $b_id . "')");
//---------------
echo "15. VSE OK! Bitvar " . $log_file . "<br>";
}
}
}
示例10: MissionCaseAttack
function MissionCaseAttack($fleetrow)
{
global $resource, $reslist;
battle_log("Battle on " . date("jS F Y \\a\t H:i:s:"));
//Get the attackers / defenders arrays
$attackers = array();
$defenders = array();
//This fleet
$techs = doquery("SELECT `" . $resource[109] . "`,`" . $resource[110] . "`,`" . $resource[111] . "` FROM {{table}} WHERE `id` = " . $fleetrow['owner_userid'], 'users', true);
$attackers[] = $fleetrow['fleet_id'] . ':' . $techs[$resource[109]] . ',' . $techs[$resource[110]] . ',' . $techs[$resource[111]] . ':' . $fleetrow['array'];
//ACS?
if ($fleetrow['fleet_group'] > 0) {
//We have some acs fleets, maybe
$acs = doquery("SELECT * FROM {{table}} WHERE `fleet_group` = '" . $fleetrow['fleet_group'] . "' AND `mission` = 2 AND `fleet_mess` = 0", 'fleets');
while ($acsrow = FetchArray($acs)) {
$techs = doquery("SELECT `" . $resource[109] . "`,`" . $resource[110] . "`,`" . $resource[111] . "` FROM {{table}} WHERE `id` = " . $acsrow['owner_userid'], 'users', true);
$attackers[] = $acsrow['fleet_id'] . ':' . $techs[$resource[109]] . ',' . $techs[$resource[110]] . ',' . $techs[$resource[111]] . ':' . $acsrow['array'];
}
}
//Defender
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $fleetrow['target_id'] . "' LIMIT 1 ;", 'planets', true);
$techs = doquery("SELECT `" . $resource[109] . "`,`" . $resource[110] . "`,`" . $resource[111] . "` FROM {{table}} WHERE `id` = '" . $fleetrow['target_userid'] . "' LIMIT 1 ;", 'users', true);
$str = '0:' . $techs[$resource[109]] . ',' . $techs[$resource[110]] . ',' . $techs[$resource[111]] . ':';
foreach ($reslist['dbattle'] as $e) {
if ($CurrentPlanet[$resource[$e]] > 0) {
$str .= $e . ',' . $CurrentPlanet[$resource[$e]] . ';';
}
}
foreach ($reslist['fleet'] as $e) {
if ($CurrentPlanet[$resource[$e]] > 0) {
$str .= $e . ',' . $CurrentPlanet[$resource[$e]] . ';';
}
}
$defenders[] = $str;
//ACS?
//We have some acs fleets, maybe
$acs = doquery("SELECT * FROM {{table}} WHERE `target_id` = '" . $fleetrow['target_id'] . "' AND `mission` = 5 AND `fleet_mess` = 0 AND `arrival` < '" . $fleetrow['arrival'] . "' AND `arrival`+`hold_time` > '" . $fleetrow['arrival'] . "'", 'fleets');
while ($acsrow = FetchArray($acs)) {
$techs = doquery("SELECT `" . $resource[109] . "`,`" . $resource[110] . "`,`" . $resource[111] . "` FROM {{table}} WHERE `id` = " . $acsrow['owner_userid'], 'users', true);
$defenders[] = $acsrow['id'] . ':' . $techs[$resource[109]] . ',' . $techs[$resource[110]] . ',' . $techs[$resource[111]] . ':' . $acsrow['array'];
}
//Generate the python arguments
$arg = str_replace(";", "\\;", sizeof($attackers) . " " . sizeof($defenders) . " " . implode(' ', $attackers) . " " . implode(' ', $defenders));
//Start timer
$start = microtime('true');
//Log the commands
battle_log("Battle command: " . "python " . ROOT_PATH . "includes/battle_engines/mr_combat.py " . $arg);
//let python do it
$serialized = shell_exec("python " . ROOT_PATH . "includes/battle_engines/mr_combat.py " . $arg);
$results = unserialize($serialized);
//unserialise the attack and defend fleets in each round
foreach ($results['data'] as $key => $val) {
$results['data'][$key]['attack_fleets'] = unserialize($results['data'][$key]['attack_fleets']);
$results['data'][$key]['defend_fleets'] = unserialize($results['data'][$key]['defend_fleets']);
}
//Log the results
battle_log("Serialized Results:\n" . $serialized);
battle_log("Results:\n" . print_r($results, true) . "\n\n");
//And python did it in...
$results['time'] = microtime('true') - $start;
//Return the raw results, another function can take it from here
return $results;
}