7.4 to the go
This commit is contained in:
+172
-172
@@ -1,173 +1,173 @@
|
||||
class Zone {
|
||||
|
||||
int id;
|
||||
|
||||
int type;
|
||||
|
||||
vector pos;
|
||||
|
||||
float radius;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum ZoneType {
|
||||
|
||||
SAFE,
|
||||
|
||||
PSI,
|
||||
|
||||
RAD,
|
||||
|
||||
BIO
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
ref array<ref Zone> ga_zones = new array<ref Zone>;
|
||||
|
||||
|
||||
|
||||
ref ControllerZones ctrl_zones = new ControllerZones;
|
||||
|
||||
|
||||
|
||||
class ControllerZones {
|
||||
|
||||
void ControllerZones() {
|
||||
|
||||
|
||||
|
||||
int id = 0;//
|
||||
|
||||
vector pos;
|
||||
|
||||
float radius;
|
||||
|
||||
int type = 0;
|
||||
|
||||
// only RAD param ↓↓↓
|
||||
|
||||
id = id + 1; // Територия янтаратя 200 метров RAD
|
||||
|
||||
pos = "2405 0 6541";
|
||||
|
||||
radius = 200.0;
|
||||
|
||||
AddZone(id, pos, radius, ZoneType.RAD);
|
||||
|
||||
|
||||
|
||||
// only PSI param ↓↓↓
|
||||
|
||||
id = id + 1; // Територия янтаратя 200 метров PSI
|
||||
|
||||
pos = "2405 0 6541";
|
||||
|
||||
radius = 200.0;
|
||||
|
||||
AddZone(id, pos, radius, ZoneType.PSI);
|
||||
|
||||
|
||||
|
||||
GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckZones, 5000, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ~ControllerZones() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void AddZone(int id, vector pos, float radius, int type) {
|
||||
|
||||
ref Zone zone = new ref Zone;
|
||||
|
||||
zone.id = id;
|
||||
|
||||
zone.pos = pos;
|
||||
|
||||
zone.radius = radius;
|
||||
|
||||
zone.type = type;
|
||||
|
||||
|
||||
|
||||
ga_zones.Insert(zone);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool InZone(PlayerBase player, ref Zone zone) {
|
||||
|
||||
vector player_position = player.GetPosition();
|
||||
|
||||
player_position[1] = 0;
|
||||
|
||||
|
||||
|
||||
EntityAI attachment;
|
||||
|
||||
ItemBase item;
|
||||
|
||||
string className;
|
||||
|
||||
float biosafe = 0;
|
||||
|
||||
float psisafe = 0;
|
||||
|
||||
float damage_player;
|
||||
|
||||
float damage_zone = 0;
|
||||
|
||||
float damage_zonePSI = 8.0;
|
||||
|
||||
float rpu = 1.0;
|
||||
|
||||
|
||||
|
||||
if( (vector.Distance(player_position, zone.pos)) < zone.radius && zone.type == ZoneType.RAD) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
attachment = player.FindAttachmentBySlotName("Mask"); // Перечеь защиты от радиации
|
||||
|
||||
if ( attachment && attachment.IsItemBase() )
|
||||
|
||||
{
|
||||
|
||||
item = Class.Cast(attachment);
|
||||
|
||||
className = item.GetType();
|
||||
|
||||
if ( className.Contains("dzrp_GasMask_GP1") )
|
||||
|
||||
{
|
||||
|
||||
biosafe = biosafe + 1.0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
attachment = player.FindAttachmentBySlotName("Body");
|
||||
|
||||
if ( attachment && attachment.IsItemBase() )
|
||||
|
||||
{
|
||||
|
||||
item = Class.Cast(attachment);
|
||||
|
||||
className = item.GetType();
|
||||
|
||||
class Zone {
|
||||
int id;
|
||||
int type;
|
||||
vector pos;
|
||||
float radius;
|
||||
}
|
||||
|
||||
enum ZoneType {
|
||||
SAFE,
|
||||
PSI,
|
||||
RAD,
|
||||
BIO
|
||||
}
|
||||
|
||||
ref array<ref Zone> ga_zones = new array<ref Zone>;
|
||||
|
||||
ref ControllerZones ctrl_zones = new ControllerZones;
|
||||
|
||||
class ControllerZones {
|
||||
void ControllerZones() {
|
||||
|
||||
int id = 0;//
|
||||
vector pos;
|
||||
float radius;
|
||||
int type = 0;
|
||||
// only RAD param ↓↓↓
|
||||
id = id + 1; // Територия янтаратя 200 метров RAD
|
||||
pos = "2405 0 6541";
|
||||
radius = 200.0;
|
||||
AddZone(id, pos, radius, ZoneType.RAD);
|
||||
|
||||
// only PSI param ↓↓↓
|
||||
id = id + 1; // Територия янтаратя 200 метров PSI
|
||||
pos = "2405 0 6541";
|
||||
radius = 200.0;
|
||||
AddZone(id, pos, radius, ZoneType.PSI);
|
||||
|
||||
GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckZones, 5000, true);
|
||||
}
|
||||
|
||||
void ~ControllerZones() {
|
||||
}
|
||||
|
||||
void AddZone(int id, vector pos, float radius, int type) {
|
||||
ref Zone zone = new ref Zone;
|
||||
zone.id = id;
|
||||
zone.pos = pos;
|
||||
zone.radius = radius;
|
||||
zone.type = type;
|
||||
|
||||
ga_zones.Insert(zone);
|
||||
}
|
||||
|
||||
bool InZone(PlayerBase player, ref Zone zone) {
|
||||
vector player_position = player.GetPosition();
|
||||
player_position[1] = 0;
|
||||
|
||||
EntityAI attachment;
|
||||
ItemBase item;
|
||||
string className;
|
||||
float biosafe = 0;
|
||||
float psisafe = 0;
|
||||
float damage_player;
|
||||
float damage_zone = 0;
|
||||
float damage_zonePSI = 8.0;
|
||||
float rpu = 1.0;
|
||||
|
||||
if( (vector.Distance(player_position, zone.pos)) < zone.radius && zone.type == ZoneType.RAD) {
|
||||
|
||||
|
||||
|
||||
attachment = player.FindAttachmentBySlotName("Mask"); // Перечеь защиты от радиации
|
||||
if ( attachment && attachment.IsItemBase() )
|
||||
{
|
||||
item = Class.Cast(attachment);
|
||||
className = item.GetType();
|
||||
if ( className.Contains("dzrp_GasMask_GP1") )
|
||||
{
|
||||
biosafe = biosafe + 1.0;
|
||||
}
|
||||
}
|
||||
attachment = player.FindAttachmentBySlotName("Body");
|
||||
if ( attachment && attachment.IsItemBase() )
|
||||
{
|
||||
item = Class.Cast(attachment);
|
||||
className = item.GetType();
|
||||
if ( className.Contains("Top_Admin") )
|
||||
{
|
||||
biosafe = biosafe + 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu) > 1 )
|
||||
{
|
||||
radiationcnt = ((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu) + Math.RandomInt(1,10000)*0.00001;
|
||||
if ( DayZRP_Static.IsItemInInventory( player, "DayZRP_Doz" ) ){
|
||||
Param1<string> m_MessageParamRD = new Param1<string>( "Дозиметр : " + radiationcnt + "м3в" );
|
||||
GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParamRD, true, player.GetIdentity());
|
||||
}
|
||||
}
|
||||
if (biosafe<1)
|
||||
{
|
||||
damage_zone=((ga_zones.Get(j).radius - (vector.Distance(player_position, ga_zones.Get(j).pos)) ) * rpu)/50;
|
||||
damage_player = player.GetHealth("GlobalHealth", "Health");
|
||||
player.SetHealth("GlobalHealth", "Health", damage_player - (damage_zone - (damage_zone * biosafe)));
|
||||
if (biosafe==0)
|
||||
{
|
||||
player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH); //Кашель
|
||||
Param1<string> m_MessageParam = new Param1<string>("Воздействие Радиации! Одень противогаз!");
|
||||
GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if((vector.Distance(player_position, zone.pos)) < zone.radius && zone.type == ZoneType.PSI) {
|
||||
|
||||
attachment = player.FindAttachmentBySlotName("Mask");// Перечеь защиты от PSI
|
||||
if ( attachment && attachment.IsItemBase() ) {
|
||||
item = Class.Cast(attachment);
|
||||
className = item.GetType();
|
||||
if ( className.Contains("dzrp_GasMask_GP7") ) {
|
||||
psisafe = psisafe + 1.0;
|
||||
}
|
||||
}
|
||||
attachment = player.FindAttachmentBySlotName("Body");
|
||||
if ( attachment && attachment.IsItemBase() ) {
|
||||
item = Class.Cast(attachment);
|
||||
className = item.GetType();
|
||||
if ( className.Contains("Top_Admin") ) {
|
||||
psisafe = psisafe + 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
damage_player = player.GetHealth("GlobalHealth", "Health");
|
||||
player.SetHealth("GlobalHealth", "Health", damage_player - (damage_zonePSI - (damage_zonePSI * psisafe)));
|
||||
if (psisafe>=1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (psisafe==0)
|
||||
{
|
||||
if (psisafe<0.5)
|
||||
{
|
||||
player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_VOMIT); // рвота // SNEEZE - чихать
|
||||
}
|
||||
Param1<string> m_MessageParamPSI = new Param1<string>("Воздействие PSI! Нужно бежать!");
|
||||
GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParamPSI, true, player.GetIdentity());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CheckZones() {
|
||||
ref array<Man> players = new array<Man>;
|
||||
GetGame().GetPlayers( players );
|
||||
|
||||
for ( int i = 0; i < players.Count(); i++ )
|
||||
{
|
||||
PlayerBase player;
|
||||
Class.CastTo(player, players.Get(i));
|
||||
|
||||
for ( int j = 0; j < ga_zones.Count(); j++ ) {
|
||||
if(InZone(player, ga_zones.Get(j))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+87
-86
@@ -1,93 +1,94 @@
|
||||
<?
|
||||
header( 'Expires: Mon, 26 Jul 1970 05:00:00 GMT' );
|
||||
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
|
||||
header( 'Cache-Control: no-store, no-cache, must-revalidate' );
|
||||
header( 'Cache-Control: post-check=0, pre-check=0', false );
|
||||
header( 'Pragma: no-cache' );
|
||||
header( 'Content-Type: text/html; charset=windows-1251' );
|
||||
<?php
|
||||
header('Expires: Mon, 26 Jul 1970 05:00:00 GMT');
|
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
header('Content-Type: text/html; charset=windows-1251');
|
||||
|
||||
define('GAME',true);
|
||||
const GAME = true;
|
||||
include('../_incl_data/class/__db_connect.php');
|
||||
include('../_incl_data/class/__user.php');
|
||||
$u = User::start();
|
||||
mysql_query('SET NAMES utf8');
|
||||
|
||||
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
|
||||
if( isset($u->info['id']) && $u->info['battle'] > 0 ) {
|
||||
//
|
||||
function json_fix_cyr($json_str) {
|
||||
$cyr_chars = array (
|
||||
'\u0430' => 'à', '\u0410' => 'À',
|
||||
'\u0431' => 'á', '\u0411' => 'Á',
|
||||
'\u0432' => 'â', '\u0412' => 'Â',
|
||||
'\u0433' => 'ã', '\u0413' => 'Ã',
|
||||
'\u0434' => 'ä', '\u0414' => 'Ä',
|
||||
'\u0435' => 'å', '\u0415' => 'Å',
|
||||
'\u0451' => '¸', '\u0401' => '¨',
|
||||
'\u0436' => 'æ', '\u0416' => 'Æ',
|
||||
'\u0437' => 'ç', '\u0417' => 'Ç',
|
||||
'\u0438' => 'è', '\u0418' => 'È',
|
||||
'\u0439' => 'é', '\u0419' => 'É',
|
||||
'\u043a' => 'ê', '\u041a' => 'Ê',
|
||||
'\u043b' => 'ë', '\u041b' => 'Ë',
|
||||
'\u043c' => 'ì', '\u041c' => 'Ì',
|
||||
'\u043d' => 'í', '\u041d' => 'Í',
|
||||
'\u043e' => 'î', '\u041e' => 'Î',
|
||||
'\u043f' => 'ï', '\u041f' => 'Ï',
|
||||
'\u0440' => 'ð', '\u0420' => 'Ð',
|
||||
'\u0441' => 'ñ', '\u0421' => 'Ñ',
|
||||
'\u0442' => 'ò', '\u0422' => 'Ò',
|
||||
'\u0443' => 'ó', '\u0423' => 'Ó',
|
||||
'\u0444' => 'ô', '\u0424' => 'Ô',
|
||||
'\u0445' => 'õ', '\u0425' => 'Õ',
|
||||
'\u0446' => 'ö', '\u0426' => 'Ö',
|
||||
'\u0447' => '÷', '\u0427' => '×',
|
||||
'\u0448' => 'ø', '\u0428' => 'Ø',
|
||||
'\u0449' => 'ù', '\u0429' => 'Ù',
|
||||
'\u044a' => 'ú', '\u042a' => 'Ú',
|
||||
'\u044b' => 'û', '\u042b' => 'Û',
|
||||
'\u044c' => 'ü', '\u042c' => 'Ü',
|
||||
'\u044d' => 'ý', '\u042d' => 'Ý',
|
||||
'\u044e' => 'þ', '\u042e' => 'Þ',
|
||||
'\u044f' => 'ÿ', '\u042f' => 'ß',
|
||||
|
||||
'\r' => '',
|
||||
'\n' => '<br />',
|
||||
'\t' => ''
|
||||
);
|
||||
foreach ($cyr_chars as $cyr_char_key => $cyr_char) {
|
||||
$json_str = str_replace($cyr_char_key, $cyr_char, $json_str);
|
||||
}
|
||||
return $json_str;
|
||||
}
|
||||
//
|
||||
$r = array();
|
||||
$p = array();
|
||||
$p['sp'] = mysql_query('SELECT
|
||||
if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
|
||||
if (isset($u->info['id']) && $u->info['battle'] > 0) {
|
||||
//
|
||||
function json_fix_cyr($json_str)
|
||||
{
|
||||
$cyr_chars = [
|
||||
'\u0430' => 'à', '\u0410' => 'À',
|
||||
'\u0431' => 'á', '\u0411' => 'Á',
|
||||
'\u0432' => 'â', '\u0412' => 'Â',
|
||||
'\u0433' => 'ã', '\u0413' => 'Ã',
|
||||
'\u0434' => 'ä', '\u0414' => 'Ä',
|
||||
'\u0435' => 'å', '\u0415' => 'Å',
|
||||
'\u0451' => '¸', '\u0401' => '¨',
|
||||
'\u0436' => 'æ', '\u0416' => 'Æ',
|
||||
'\u0437' => 'ç', '\u0417' => 'Ç',
|
||||
'\u0438' => 'è', '\u0418' => 'È',
|
||||
'\u0439' => 'é', '\u0419' => 'É',
|
||||
'\u043a' => 'ê', '\u041a' => 'Ê',
|
||||
'\u043b' => 'ë', '\u041b' => 'Ë',
|
||||
'\u043c' => 'ì', '\u041c' => 'Ì',
|
||||
'\u043d' => 'í', '\u041d' => 'Í',
|
||||
'\u043e' => 'î', '\u041e' => 'Î',
|
||||
'\u043f' => 'ï', '\u041f' => 'Ï',
|
||||
'\u0440' => 'ð', '\u0420' => 'Ð',
|
||||
'\u0441' => 'ñ', '\u0421' => 'Ñ',
|
||||
'\u0442' => 'ò', '\u0422' => 'Ò',
|
||||
'\u0443' => 'ó', '\u0423' => 'Ó',
|
||||
'\u0444' => 'ô', '\u0424' => 'Ô',
|
||||
'\u0445' => 'õ', '\u0425' => 'Õ',
|
||||
'\u0446' => 'ö', '\u0426' => 'Ö',
|
||||
'\u0447' => '÷', '\u0427' => '×',
|
||||
'\u0448' => 'ø', '\u0428' => 'Ø',
|
||||
'\u0449' => 'ù', '\u0429' => 'Ù',
|
||||
'\u044a' => 'ú', '\u042a' => 'Ú',
|
||||
'\u044b' => 'û', '\u042b' => 'Û',
|
||||
'\u044c' => 'ü', '\u042c' => 'Ü',
|
||||
'\u044d' => 'ý', '\u042d' => 'Ý',
|
||||
'\u044e' => 'þ', '\u042e' => 'Þ',
|
||||
'\u044f' => 'ÿ', '\u042f' => 'ß',
|
||||
|
||||
'\r' => '',
|
||||
'\n' => '<br />',
|
||||
'\t' => '',
|
||||
];
|
||||
foreach ($cyr_chars as $cyr_char_key => $cyr_char) {
|
||||
$json_str = str_replace($cyr_char_key, $cyr_char, $json_str);
|
||||
}
|
||||
return $json_str;
|
||||
}
|
||||
|
||||
//
|
||||
$r = [];
|
||||
$p = [];
|
||||
$p['sp'] = mysql_query(
|
||||
'SELECT
|
||||
`u`.`id`,`u`.`login`,`u`.`login2`,`u`.`align`,`u`.`level`,
|
||||
`s`.`hpNow`,`s`.`mpNow`,`s`.`team`
|
||||
FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "'.$u->info['battle'].'"
|
||||
');
|
||||
while( $p['pl'] = mysql_fetch_array($p['sp']) ) {
|
||||
$p['st'] = $u->getStats($p['pl']['id']);
|
||||
$r[] = array(
|
||||
'id' => $p['pl']['id'],
|
||||
'login' => $p['pl']['login'],
|
||||
'team' => $p['pl']['team'],
|
||||
'hpNow' => $p['pl']['hpNow'],
|
||||
'mpNow' => $p['pl']['mpNow'],
|
||||
'hpAll' => $p['st']['hpAll'],
|
||||
'mpAll' => $p['st']['mpAll'],
|
||||
'align' => $p['pl']['align'],
|
||||
'clan' => $p['pl']['clan'],
|
||||
'level' => $p['pl']['level']
|
||||
);
|
||||
}
|
||||
unset($p);
|
||||
//
|
||||
echo json_fix_cyr(json_encode($r));
|
||||
//echo json_encode($r);
|
||||
}else{
|
||||
echo 'false';
|
||||
}
|
||||
FROM `users` AS `u` LEFT JOIN `stats` AS `s` ON `s`.`id` = `u`.`id` WHERE `u`.`battle` = "' . $u->info['battle'] . '"
|
||||
'
|
||||
);
|
||||
while ($p['pl'] = mysql_fetch_array($p['sp'])) {
|
||||
$p['st'] = $u->getStats($p['pl']['id']);
|
||||
$r[] = [
|
||||
'id' => $p['pl']['id'],
|
||||
'login' => $p['pl']['login'],
|
||||
'team' => $p['pl']['team'],
|
||||
'hpNow' => $p['pl']['hpNow'],
|
||||
'mpNow' => $p['pl']['mpNow'],
|
||||
'hpAll' => $p['st']['hpAll'],
|
||||
'mpAll' => $p['st']['mpAll'],
|
||||
'align' => $p['pl']['align'],
|
||||
'clan' => $p['pl']['clan'],
|
||||
'level' => $p['pl']['level'],
|
||||
];
|
||||
}
|
||||
unset($p);
|
||||
echo json_fix_cyr(json_encode($r));
|
||||
} else {
|
||||
echo 'false';
|
||||
}
|
||||
}
|
||||
?>
|
||||
+1
-1
@@ -7,7 +7,7 @@ header( 'Pragma: no-cache' );
|
||||
header( 'Content-Type: text/html; charset=windows-1251' );
|
||||
|
||||
define('GAME',true);
|
||||
include('../_incl_data/class/__db_connect.php');
|
||||
require_once('../_incl_data/class/__db_connect.php');
|
||||
mysql_query('SET NAMES utf8');
|
||||
|
||||
if($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
|
||||
|
||||
Reference in New Issue
Block a user