diff --git a/_incl_data/class/Battle.php b/_incl_data/class/Battle.php index 37501bad..50f45b42 100644 --- a/_incl_data/class/Battle.php +++ b/_incl_data/class/Battle.php @@ -3,11 +3,13 @@ use Battle\Fighter; use Battle\Finish; use Battle\Helper; +use Battle\Info; use Battle\Log; use Battle\Razmen; use Clan\ClanInfo; use Core\Config; use Core\Db; +use DTO\BattlePriem; use Helper\Conversion; use User\Effects; use User\ItemsModel; @@ -43,158 +45,12 @@ class Battle 'тьма' => 6, 'серая' => 7, ]; + /** - * act: 1 - когда персонаж получает повреждение - * 2 - когда персонаж наносит удар - * - * type_of: 1 - уворот - * 2 - крит - * 3 - атака - * 4 - защита - * 5 - прочее - * @var array|array[] + * Параметры приёмов, которые, наверное, надо бы занести в БД. + * @var array|BattlePriem[] */ - private array $prm = [ - 1 => ['name' => 'Прикрыться', 'act' => 1, 'type_of' => 5], - 2 => ['name' => 'Вломить', 'act' => 2, 'type_of' => 3], - 4 => ['name' => 'Сильный удар', 'act' => 2, 'type_of' => 3], - 7 => ['name' => 'Активная защита', 'act' => 1, 'type_of' => 4], - 290 => ['name' => 'Вытягивание души', 'act' => 1, 'type_of' => 4], - //Канализация - 294 => ['name' => 'Зловонная Вода', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 295 => ['name' => 'Проткнуть', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 296 => ['name' => 'Гнилая Кровь', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 297 => ['name' => 'Собраться', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 298 => ['name' => 'Приказ Слабости', 'act' => 2, 'type_of' => 3], - 141 => ['name' => 'Призрачная защита', 'act' => 2, 'type_of' => 4], - 147 => ['name' => 'Призрачный кинжал', 'act' => 2, 'type_of' => 4], - 148 => ['name' => 'Призрачный топор', 'act' => 2, 'type_of' => 4], - 149 => ['name' => 'Призрачный удар', 'act' => 2, 'type_of' => 4], - 150 => ['name' => 'Призрачное лезвие', 'act' => 2, 'type_of' => 4], - 142 => ['name' => 'Призрачный огонь', 'act' => 2, 'type_of' => 4], - 144 => ['name' => 'Призрачный воздух', 'act' => 2, 'type_of' => 4], - 146 => ['name' => 'Призрачная земля', 'act' => 2, 'type_of' => 4], - 145 => ['name' => 'Призрачная вода', 'act' => 2, 'type_of' => 4], - 8 => ['name' => 'Танец ветра', 'act' => 1, 'type_of' => 1], - 9 => ['name' => 'Дикая удача', 'act' => 2, 'type_of' => 3], - 10 => ['name' => 'Предвидение', 'act' => 1, 'type_of' => 1], - 11 => ['name' => 'Удачный удар', 'act' => 2, 'type_of' => 3], - 45 => ['name' => 'Полная защита', 'act' => 1, 'type_of' => 4], - 47 => ['name' => 'Слепая удача', 'act' => 2, 'type_of' => 2], - 48 => ['name' => 'Танец лезвий', 'act' => 1, 'type_of' => 1], - 49 => ['name' => 'Второе дыхание', 'act' => 1, 'type_of' => 1], - 138 => ['name' => 'Сокрушающий удар', 'act' => 2, 'type_of' => 3], - 140 => ['name' => 'Абсолютная защита', 'act' => 1, 'type_of' => 4], - 193 => ['name' => 'Усиленные удары', 'act' => 2, 'type_of' => 3], - 204 => ['name' => 'Обречённость', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 211 => ['name' => 'Агрессивная защита', 'act' => 1, 'type_of' => 4], - 213 => ['name' => 'Коварный Уход', 'act' => 1, 'type_of' => 4], - 215 => ['name' => 'Скрытая ловкость', 'act' => 1, 'type_of' => 1], - 216 => ['name' => 'Скрытая сила', 'act' => 2, 'type_of' => 2], - 217 => ['name' => 'Разгадать тактику', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 219 => ['name' => 'Точный удар', 'act' => 2, 'type_of' => 3], - 220 => ['name' => 'Ставка на опережение', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 222 => ['name' => 'Последний удар', 'act' => 2, 'type_of' => 3], - 225 => ['name' => 'Магическая защита', 'act' => 1, 'type_of' => 4], - 226 => ['name' => 'Возмездие', 'act' => 1, 'type_of' => 4], - 231 => ['name' => 'Глухая защита', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 234 => ['name' => 'Осторожность', 'act' => 2, 'type_of' => 4], - 235 => ['name' => 'Шокирующий удар', 'act' => 2, 'type_of' => 3], - 342 => ['name' => 'Круговая Защита', 'act' => 0, 'type_of' => 0], - 343 => ['name' => 'Натиск', 'act' => 0, 'type_of' => 0], - 237 => ['name' => 'Разведка боем', 'act' => 2, 'type_of' => 3], - 239 => ['name' => 'Поступь смерти', 'act' => 2, 'type_of' => 3], - 240 => ['name' => 'Хлебнуть крови', 'act' => 2, 'type_of' => 5], - 21 => ['name' => 'Оледенение [4]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 73 => ['name' => 'Оледенение [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 74 => ['name' => 'Оледенение [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 75 => ['name' => 'Оледенение [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 76 => ['name' => 'Оледенение [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 77 => ['name' => 'Оледенение [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 78 => ['name' => 'Оледенение [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 79 => ['name' => 'Оледенение [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 22 => ['name' => 'Отравление [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 80 => ['name' => 'Отравление [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 81 => ['name' => 'Отравление [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 82 => ['name' => 'Отравление [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 83 => ['name' => 'Отравление [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 84 => ['name' => 'Отравление [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 36 => ['name' => 'Регенерация [5]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 85 => ['name' => 'Регенерация [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 86 => ['name' => 'Регенерация [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 87 => ['name' => 'Регенерация [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 88 => ['name' => 'Регенерация [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 89 => ['name' => 'Регенерация [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 90 => ['name' => 'Регенерация [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 23 => ['name' => 'Ядовитое Облако [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 70 => ['name' => 'Ядовитое Облако [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 71 => ['name' => 'Ядовитое Облако [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 72 => ['name' => 'Ядовитое Облако [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 269 => ['name' => 'Иней [8]', 'act' => 2, 'type_of' => 9], - 276 => ['name' => 'Иней [9]', 'act' => 2, 'type_of' => 9], - 277 => ['name' => 'Иней [10]', 'act' => 2, 'type_of' => 9], - 270 => ['name' => 'Духи Льда', 'act' => 2, 'type_of' => 5, 'type_sec' => 5], - 280 => ['name' => 'Хватка Льда', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 281 => ['name' => 'Жертва Воде', 'act' => 2, 'type_of' => 5], - 282 => ['name' => 'Ледяное Спасение', 'act' => 2, 'type_of' => 5], - 24 => ['name' => 'Медитация', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 210 => ['name' => 'Магический Барьер [4]', 'act' => 2, 'type_of' => 8], - 209 => ['name' => 'Магический Барьер [7]', 'act' => 2, 'type_of' => 8], - 208 => ['name' => 'Магический Барьер [8]', 'act' => 2, 'type_of' => 8], - 207 => ['name' => 'Магический Барьер [9]', 'act' => 2, 'type_of' => 8], - 206 => ['name' => 'Магический Барьер [10]', 'act' => 2, 'type_of' => 8], - 284 => ['name' => 'Магический Барьер [11]', 'act' => 2, 'type_of' => 8], - 175 => ['name' => 'Магический Барьер [7]', 'act' => 2, 'type_of' => 8], - 176 => ['name' => 'Магический Барьер [8]', 'act' => 2, 'type_of' => 8], - 177 => ['name' => 'Магический Барьер [9]', 'act' => 2, 'type_of' => 8], - 178 => ['name' => 'Магический Барьер [10]', 'act' => 2, 'type_of' => 8], - 179 => ['name' => 'Магический Барьер [11]', 'act' => 2, 'type_of' => 8], - 42 => ['name' => 'Метеорит [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 121 => ['name' => 'Метеорит [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 122 => ['name' => 'Метеорит [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 123 => ['name' => 'Метеорит [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 124 => ['name' => 'Метеорит [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 125 => ['name' => 'Метеорит [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 249 => ['name' => 'Каменный Щит', 'act' => 2, 'type_of' => 4], - 248 => ['name' => 'Песчаный Щит', 'act' => 2, 'type_of' => 4], - 251 => ['name' => 'Заземление: Плюс', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 252 => ['name' => 'Заземление: Минус', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 273 => ['name' => 'Туманный Образ [10]', 'act' => 1, 'type_of' => 4], - 286 => ['name' => 'Туманный Образ [9]', 'act' => 1, 'type_of' => 4], - 287 => ['name' => 'Туманный Образ [8]', 'act' => 1, 'type_of' => 4], - 288 => ['name' => 'Туманный Образ [7]', 'act' => 1, 'type_of' => 4], - 255 => ['name' => 'Воздушный Щит', 'act' => 2, 'type_of' => 8], - 337 => ['name' => 'Выпить Душу', 'act' => 2, 'type_of' => 5], - 33 => ['name' => 'Пожирающее Пламя [6]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 56 => ['name' => 'Пожирающее Пламя [7]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 57 => ['name' => 'Пожирающее Пламя [8]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 58 => ['name' => 'Пожирающее Пламя [9]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 59 => ['name' => 'Пожирающее Пламя [10]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 60 => ['name' => 'Пожирающее Пламя [11]', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 245 => ['name' => 'Огненный Щит', 'act' => 2, 'type_of' => 9], - 327 => ['name' => 'Живая Вода', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 328 => ['name' => 'Сушеный Мухомор', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 329 => ['name' => 'Мешочек Пыли', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 330 => ['name' => 'Отвар когтей ПГ', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 331 => ['name' => 'Отвар Василиска', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 332 => ['name' => 'Точильный Камень', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 333 => ['name' => 'Волшебный Эликсир', 'act' => 2, 'type_of' => 0, 'moment' => 3], - 334 => ['name' => 'Цепь Защитника', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 335 => [ - 'name' => 'Эликсир Безумного Критовика', - 'act' => 2, - 'type_of' => 0, - 'moment' => 0, - 'moment_end' => 3, - ], - 299 => ['name' => 'Ядовитые язвы', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 300 => ['name' => 'Элементарный заряд', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 301 => ['name' => 'Темное ранение', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 302 => ['name' => 'Подлечиться', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 303 => ['name' => 'Шкура поглощения', 'act' => 2, 'type_of' => 4], - 304 => ['name' => 'Особенное проклятье!', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - 305 => ['name' => 'Кровожадность', 'act' => 2, 'type_of' => 0, 'moment' => 0, 'moment_end' => 3], - ]; + private array $prm; /**Кэширование данных (?!)*/ public bool $cached = false; @@ -202,9 +58,64 @@ class Battle /**Отображаем главное окно (1 - можно бить, 2 - ожидаем ход противника, 3 - Проиграли. Ожидаем завершения поединка)*/ public int $mainStatus = 1; - /**Информация о поединке*/ + /**Информация о поединке + * array (size=51) + * 'id' => int 466012 + * 'city' => string 'capitalcity' (length=11) + * 'time_start' => int 1704495486 + * 'testfinish' => int 0 + * 'players' => string '' (length=0) + * 'timeout' => int 60 + * 'type' => int 0 + * 'status' => int 0 + * 'kulak' => int 0 + * 'invis' => int 0 + * 'noinc' => int 0 + * 'travmChance' => int 0 + * 'typeBattle' => int 0 + * 'addExp' => float 0 + * 'money' => float 0 + * 'money3' => float 0 + * 'time_over' => int 0 + * 'team_win' => int -1 + * 'dungeon' => string '0' (length=1) + * 'razdel' => int 5 + * 'dn_id' => int 0 + * 'x' => int 0 + * 'y' => int 0 + * 'fDate' => string '' (length=0) + * 'izlom' => int 0 + * 'izlomLvl' => int 0 + * 'izlomRound' => int 0 + * 'start1' => int 1704495496 + * 'start2' => int 1704495496 + * 'izlomRoundSee' => int 0 + * 'izlomObr' => int 0 + * 'izlomObrNow' => int 0 + * 'turnir' => int 0 + * 'inTurnir' => int 0 + * 'clone' => int 0 + * 'players_c' => int 0 + * 'fastfight' => int 0 + * 'nobot' => null + * 'kingfight' => null + * 'arand' => null + * 'noatack' => null + * 'noeff' => null + * 'smert' => null + * 'noart' => null + * 'zarad' => int 0 + * 'priz' => int 0 + * 'otmorozok' => int 0 + * 'otmorozok_use' => int 0 + * 'hod' => int 0 + * 'clan1' => int 0 + * 'clan2' => int 0 + * */ public array $info = []; + public Info $i; + /**Информация о пользователях в этом бою*/ public array $users = []; @@ -246,8 +157,6 @@ class Battle /** Ошибка (текст) */ public string $e = ''; - public array $is = []; - public array $items = []; //Очистка кэша для ... private array $uclearc = []; private array $ucleari = []; @@ -267,14 +176,147 @@ class Battle { ignore_user_abort(true); $this->finish = new Finish($this); + + $this->prm = [1 => new BattlePriem(act:1, typeOf:5), + 2 => new BattlePriem(act:2, typeOf:3), + 4 => new BattlePriem(act:2, typeOf:3), + 7 => new BattlePriem(act:1, typeOf:4), + 290 => new BattlePriem(act:1, typeOf:4), + 294 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 295 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 296 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 297 => new BattlePriem(act:2, typeOf:0, moment:3), + 298 => new BattlePriem(act:2, typeOf:3), + 141 => new BattlePriem(act:2, typeOf:4), + 147 => new BattlePriem(act:2, typeOf:4), + 148 => new BattlePriem(act:2, typeOf:4), + 149 => new BattlePriem(act:2, typeOf:4), + 150 => new BattlePriem(act:2, typeOf:4), + 142 => new BattlePriem(act:2, typeOf:4), + 144 => new BattlePriem(act:2, typeOf:4), + 146 => new BattlePriem(act:2, typeOf:4), + 145 => new BattlePriem(act:2, typeOf:4), + 8 => new BattlePriem(act:1, typeOf:1), + 9 => new BattlePriem(act:2, typeOf:3), + 10 => new BattlePriem(act:1, typeOf:1), + 11 => new BattlePriem(act:2, typeOf:3), + 45 => new BattlePriem(act:1, typeOf:4), + 47 => new BattlePriem(act:2, typeOf:2), + 48 => new BattlePriem(act:1, typeOf:1), + 49 => new BattlePriem(act:1, typeOf:1), + 138 => new BattlePriem(act:2, typeOf:3), + 140 => new BattlePriem(act:1, typeOf:4), + 193 => new BattlePriem(act:2, typeOf:3), + 204 => new BattlePriem(act:2, typeOf:0, moment:3), + 211 => new BattlePriem(act:1, typeOf:4), + 213 => new BattlePriem(act:1, typeOf:4), + 215 => new BattlePriem(act:1, typeOf:1), + 216 => new BattlePriem(act:2, typeOf:2), + 217 => new BattlePriem(act:2, typeOf:0, moment:3), + 219 => new BattlePriem(act:2, typeOf:3), + 220 => new BattlePriem(act:2, typeOf:0, moment:3), + 222 => new BattlePriem(act:2, typeOf:3), + 225 => new BattlePriem(act:1, typeOf:4), + 226 => new BattlePriem(act:1, typeOf:4), + 231 => new BattlePriem(act:2, typeOf:0, moment:3), + 234 => new BattlePriem(act:2, typeOf:4), + 235 => new BattlePriem(act:2, typeOf:3), + 342 => new BattlePriem(act:0, typeOf:0), + 343 => new BattlePriem(act:0, typeOf:0), + 237 => new BattlePriem(act:2, typeOf:3), + 239 => new BattlePriem(act:2, typeOf:3), + 240 => new BattlePriem(act:2, typeOf:5), + 21 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 73 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 74 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 75 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 76 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 77 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 78 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 79 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 22 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 80 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 81 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 82 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 83 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 84 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 36 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 85 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 86 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 87 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 88 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 89 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 90 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 23 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 70 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 71 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 72 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 269 => new BattlePriem(act:2, typeOf:9), + 276 => new BattlePriem(act:2, typeOf:9), + 277 => new BattlePriem(act:2, typeOf:9), + 270 => new BattlePriem(act:2, typeOf:5, typeSec:5), + 280 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 281 => new BattlePriem(act:2, typeOf:5), + 282 => new BattlePriem(act:2, typeOf:5), + 24 => new BattlePriem(act:2, typeOf:0, moment:3), + 210 => new BattlePriem(act:2, typeOf:8), + 209 => new BattlePriem(act:2, typeOf:8), + 208 => new BattlePriem(act:2, typeOf:8), + 207 => new BattlePriem(act:2, typeOf:8), + 206 => new BattlePriem(act:2, typeOf:8), + 284 => new BattlePriem(act:2, typeOf:8), + 175 => new BattlePriem(act:2, typeOf:8), + 176 => new BattlePriem(act:2, typeOf:8), + 177 => new BattlePriem(act:2, typeOf:8), + 178 => new BattlePriem(act:2, typeOf:8), + 179 => new BattlePriem(act:2, typeOf:8), + 42 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 121 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 122 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 123 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 124 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 125 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 249 => new BattlePriem(act:2, typeOf:4), + 248 => new BattlePriem(act:2, typeOf:4), + 251 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 252 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 273 => new BattlePriem(act:1, typeOf:4), + 286 => new BattlePriem(act:1, typeOf:4), + 287 => new BattlePriem(act:1, typeOf:4), + 288 => new BattlePriem(act:1, typeOf:4), + 255 => new BattlePriem(act:2, typeOf:8), + 337 => new BattlePriem(act:2, typeOf:5), + 33 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 56 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 57 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 58 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 59 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 60 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 245 => new BattlePriem(act:2, typeOf:9), + 327 => new BattlePriem(act:2, typeOf:0, moment:3), + 328 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 329 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 330 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 331 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 332 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 333 => new BattlePriem(act:2, typeOf:0, moment:3), + 334 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 335 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 299 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 300 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 301 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 302 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 303 => new BattlePriem(act:2, typeOf:4), + 304 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + 305 => new BattlePriem(act:2, typeOf:0, moment:0, momentEnd:3), + ]; + } public function initRefresh(User $user): bool { - $this->is = $user->is; - $this->items = $user->items; - $this->info = $this->battleInfo($user->info['battle']); - return !empty($this->info['id']); + $this->i = new Info($user->info['battle']); + return !empty($this->i->id); } //JS информация о игроке @@ -454,8 +496,8 @@ class Battle $this->users[$this->uids[$id]] = Db::getRow( 'select u.zag,u.id,u.login,u.login2,u.online,u.admin,u.city,u.cityreg,u.align,u.align_lvl,u.align_exp,u.clan, u.level,u.money,u.money3,u.money2,u.money4,u.battle,u.sex,u.obraz,u.win,u.win_t, - u.lose,u.lose_t,u.nich,u.timeMain,u.invis,u.bot_id,u.animal,u.type_pers, - u.notrhod,u.bot_room,u.inUser,u.inTurnir,u.inTurnirnew,u.stopexp,u.real, s.* from users as u left join stats as s on (u.id = s.id) where u.id = ?', [$id] + u.lose,u.lose_t,u.nich,u.timemain,u.invis,u.bot_id,u.animal,u.type_pers, + u.notrhod,u.bot_room,u.inuser,u.inturnir,u.inturnirnew,u.stopexp,u.real, s.* from users as u left join stats as s on (u.id = s.id) where u.id = ?', [$id] ); $this->stats[$this->uids[$id]] = $u->getStats($this->users[$this->uids[$id]], 0, 0, false, false, true); @@ -708,11 +750,12 @@ class Battle $upinfo = <<{$ur['login2']} [{$ur['level']}]  JS; - $hpmp = [floor($st['hpNow']), floor($st['hpAll']), floor($st['mpNow']), floor($st['mpAll']), ]; + $hpmp = [floor($st['hpNow']), floor($st['hpAll']), floor($st['mpNow']), floor($st['mpAll']),]; $info = <<'; $td = Conversion::dataStringToArray($itm[$i]['data']); - var_dump($td); + $lvar = ''; if ($td['add_hpAll'] > 0) { $td['add_hpAll'] = '+' . $td['add_hpAll']; @@ -835,313 +878,311 @@ JS; [ 'id' => $check, 'team_win' => $tw, - ] = Db::getRow('select id, team_win from battle where id = ?', [$this->info['id']]); + ] = Db::getRow('select id, team_win from battle where id = ?', [$this->i->id]); if (empty($check)) { return; } - if ($tw === -1) { - $hp = []; - $tml = []; - $tmv = []; - $tl = 0; - $i = 0; - $j = 0; - //fixme есть аналогичное во внешней функции, возможно ошибка. testUsersLive() - while ($i < count($this->uids)) { - if ($this->stats[$i]['id'] > 0) { - if (floor($this->stats[$i]['hpNow']) < 1) { - $this->stats[$i]['hpNow'] = 0; - } - $hp[$this->users[$i]['team']] += floor($this->stats[$i]['hpNow']); - if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { - $tml[$this->users[$i]['team']] = 1; - $tmv[$j] = $this->users[$i]['team']; - $tl++; - } - } - $i++; - } + if ($tw !== -1) { + $this->finish->finishBattle(nl:10); + return; + } - if ($tl <= 1) { - //Доп.проверка - $tmHpNow = []; - $tmNow = []; - - foreach ( - Db::getRow('select team, hpNow from users left join stats on users.id = stats.id where battle = ?', [$this->info['id']]) - as $pl - ) { - if (!isset($tmHpNow[$pl['team']])) { - $tmHpNow[$pl['team']] = 0; - $tmNow[] = $pl['team']; - } - $hpTm = floor($pl['hpNow']); - if ($hpTm < 0) { - $hpTm = 0; - } - if ($hpTm > 0) { - $tmHpNow[$pl['team']] += $pl['hpNow']; - } + $tml = []; + $tmv = []; + $tl = 0; + $i = 0; + $j = 0; + //fixme есть аналогичное во внешней функции, возможно ошибка. testUsersLive() + while ($i < count($this->uids)) { + if ($this->stats[$i]['id'] > 0) { + if (floor($this->stats[$i]['hpNow']) < 1) { + $this->stats[$i]['hpNow'] = 0; } - $gdj = 0; - $i = 0; - while ($i < count($tmNow)) { - if (isset($tmNow[$i])) { - $j = $tmNow[$i]; - if ($tmHpNow[$j] > 0) { - $gdj++; - } - } - $i++; - } - if ($gdj > 1) { - $tl = $gdj; - echo 'Поединок может завершиться не корректно... (Сообщите Администрации об этом)'; + if (!isset($tml[$this->users[$i]['team']]) && floor($this->stats[$i]['hpNow']) >= 1) { + $tml[$this->users[$i]['team']] = 1; + $tmv[$j] = $this->users[$i]['team']; + $tl++; } } + $i++; + } - if ($tl <= 1) { - //завершаем поединок, кто-то один победил, либо ничья + if ($tl > 1) { + return; + } - $i = 0; - $tmwin = 0; - while ($i < count($tmv)) { - if ($tmv[$i] >= 1 && $tml[$tmv[$i]] > 0) { - $tmwin = $tmv[$i]; - } - $i++; + //Доп.проверка + $tmHpNow = []; + $tmNow = []; + + foreach ( + Db::getRow('select team, hpnow from users left join stats on users.id = stats.id where battle = ?', [$this->i->id]) + as $pl + ) { + if (!isset($tmHpNow[$pl['team']])) { + $tmHpNow[$pl['team']] = 0; + $tmNow[] = $pl['team']; + } + $hpTm = floor($pl['hpNow']); + if ($hpTm < 0) { + $hpTm = 0; + } + if ($hpTm > 0) { + $tmHpNow[$pl['team']] += $pl['hpNow']; + } + } + + $gdj = 0; + $i = 0; + while ($i < count($tmNow)) { + if (isset($tmNow[$i])) { + $j = $tmNow[$i]; + if ($tmHpNow[$j] > 0) { + $gdj++; } + } + $i++; + } + if ($gdj > 1) { + echo 'Поединок может завершиться не корректно... (Сообщите Администрации об этом)'; + } - $ir = 0; - $bi = 0; - if ($this->info['id'] > 0) { - if ($this->info['izlom'] == 0) { - //данные о игроках в бою - $trl = mysql_query( - 'SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`bot_id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->info['id'] . '" ORDER BY `st`.`bot` DESC' - ); + //завершаем поединок, кто-то один победил, либо ничья - $this->users = []; - $this->stats = []; - $this->uids = []; - $this->bots = []; - $this->iBots = []; + $i = 0; + $tmwin = 0; + while ($i < count($tmv)) { + if ($tmv[$i] >= 1 && $tml[$tmv[$i]] > 0) { + $tmwin = $tmv[$i]; + } + $i++; + } - while ($pl = mysql_fetch_array($trl)) { - //записываем данные - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[$ir] = $pl; - $this->uids[$pl['id']] = $ir; - if ($pl['bot'] > 0) { - $this->bots[$bi] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - $bi++; - } - //записываем статы - $this->stats[$ir] = $u->getStats($pl['id'], 0, 0, false, false, true); - $ir++; - } - } elseif (!isset($this->uids[$u->info['id']])) { - //данные о игроках в бою - $trl = mysql_query( - 'SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = ' . $this->info['id'] - ); - $pl = mysql_fetch_array($trl); - //записываем данные - if ($pl['login2'] == '') { - $pl['login2'] = $pl['login']; - } - $this->users[] = $pl; - $this->uids[$pl['id']] = $ir; - if ($pl['bot'] > 0) { - $this->bots[] = $pl['id']; - $this->iBots[$pl['id']] = $bi; - } - //записываем статы - $this->stats[] = $u->getStats($pl['id'], 0, 0, false, false, true); - } - } - - if ($this->info['izlom'] > 0 && $tmwin == 1) { - // выкидываем ботов из боя - $i = 0; - - $botsIds = Db::getColumn('select users.id from users left join stats on users.id = stats.id where battle = ? and bot = 1 and team != ?', [$this->info['id'], $u->info['team']]); - Db::sql('delete from users where id in (?)', [implode(',', $botsIds)]); - Db::sql('delete from stats where id in (?)', [implode(',', $botsIds)]); - Db::sql('delete from items_users where uid in (?)', [implode(',', $botsIds)]); - Db::sql('delete from eff_users where uid in (?)', [implode(',', $botsIds)]); - - $j = 0; - $obr = 0; - $bots = []; - //Это излом, добавляем еще ботов - if (Helper::getChanse(20)) { - //Уникальные монстры - - if ($this->info['izlomLvl'] == 8) { - $bots = [ - 'Валентайский Охотник', - 'Шипокрыл Хаоса', - 'Шипокрыл', - 'Лик Хаоса', - 'Фанатик Хаоса', - ]; - } - - echo '
Приближается нечто...
'; - - $this->addIzlomBot($bots, $j, $obr, $this->users[$i]['id']); - - } else { - //Обычные монстры - if ($this->info['izlomLvl'] == 8) { - $bots = [ - 'Литейщик', - 'Проклятие Глубин', - 'Пустынник Маньяк', - 'Пустынник Убийца', - 'Рабочий Мглы', - 'Смотритель Мглы', - 'Сторож Мглы', - ]; - } - - $this->addIzlomBot($bots, $j, $obr); - $this->addIzlomBot($bots, $j, $obr); - - if (rand(0, 100) < 70) { - $this->addIzlomBot($bots, $j, $obr); - } - - //Каждые 10 волн = +1 монстр - $irb = floor($this->info['izlomRoundSee'] / 10); - while ($irb > 0) { - $this->addIzlomBot($bots, $j, $obr); - $irb--; - } - } - - - if ($j == 0) { - //конец излома - $this->finishBattle($tml, $tmv, null); - mysql_query( - 'INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time( - ) . '","' . $this->info['izlomRoundSee'] . '","' . $this->info['izlomLvl'] . '","0","0","' . ($this->info['izlomObr'] - $this->info['izlomObrNow']) . '","' . $this->info['id'] . '")' - ); - } else { - $this->info['izlomRound'] = $iz['round']; - mysql_query( - 'UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->info['izlomRound'] + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->info['id'] . '" LIMIT 1' - ); - $this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25; - $this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25; - $this->users[$this->uids[$u->info['id']]]['hpNow'] = $this->stats[$this->uids[$u->info['id']]]['hpAll']; - $this->users[$this->uids[$u->info['id']]]['mpNow'] = $this->stats[$this->uids[$u->info['id']]]['mpAll']; - - //где это брать?? - $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . - '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . - '||bl1=' . $this->atacks[$id]['b' . $a] . - '||bl2=' . $this->atacks[$id]['b' . $b] . - '||time1=' . $this->atacks[$id]['time'] . - '||time2=' . $this->atacks[$id]['time2'] . - '||s2=' . $this->users[$this->uids[$u2]]['sex'] . - '||s1=' . $this->users[$this->uids[$u1]]['sex'] . - '||t2=' . $this->users[$this->uids[$u2]]['team'] . - '||t1=' . $this->users[$this->uids[$u1]]['team'] . - '||login1=' . $this->users[$this->uids[$u1]]['login2'] . - '||login2=' . $this->users[$this->uids[$u2]]['login2']; - - $mas = [ - 'battle' => $this->info['id'], - 'id_hod' => ($this->hodID + 1), - 'vars' => $vLog, - 'type' => 1, - ]; - - $textpart1 = $u->info['sex'] == 1 ? 'воспользовалась' : 'воспользовался'; - - $mas['text'] = '' . date('H:i') . - ' ' . $u->info['login'] . - ' ' . $textpart1 . ' приемом "Передышка".'; - - if ($u->stats['hpNow'] < $u->stats['hpAll']) { - $hpSks = floor(($u->stats['hpAll'] * ((rand(15, 25)) / 100))); - if ($hpSks > floor($u->stats['hpAll'] - $u->stats['hpNow'])) { - $hpSks = floor($u->stats['hpAll'] - $u->stats['hpNow']); - } - $textpart2 = "+$hpSks"; - } else { - $hpSks = 0; - $textpart2 = '--'; - } - - $mas['text'] .= ' +' . $textpart2 . ''; - $mas['text'] .= ' [' . floor($u->info['hpNow'] + $hpSks) . '/' . $u->stats['hpAll'] . ']'; - - - $this->add_log($mas); - - Db::sql( - 'update stats set hpNow = ?, mpNow = ? where id = ?', - [ - $u->info['hpNow'] + $u->stats['hpAll'] * ((rand(15, 25)) / 100), - $u->info['mpNow'] + $u->stats['mpAll'] * 0.25, - $u->info['id'], - ] - ); - } - - } else { - //завершаем бой - $this->finishBattle($tml, $tmv, null); - if ($this->info['izlom'] > 0) { - Db::sql( - 'insert into izlom_rating (uid, time, voln, level, obr, btl) values (?,unix_timestamp(),?,?,?,?)', - [ - $u->info['id'], - $this->info['izlomRoundSee'], - $this->info['izlomLvl'], - $this->info['izlomObr'] - $this->info['izlomObrNow'], - $this->info['id'], - ] - ); - } - } - - Effects::addById($u->info['id'], 31); - - $cmsg = new ChatMessage(); - $cmsg->setRoom($u->info['room']); - $cmsg->setTo($u->info['login']); - $cmsg->setType(6); - $cmsg->setText( - 'Вы создали предмет "Образец" x' . (($this->info['izlomObr'] - $this->info['izlomObrNow']) * 7) + $ir = 0; + $bi = 0; + if ($this->i->id > 0) { + if ($this->i->izlom == 0) { + //данные о игроках в бою + $trl = mysql_query( + 'SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`bot_id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this->i->id . '" ORDER BY `st`.`bot` DESC' ); - (new Chat())->sendMsg($cmsg); - $i01 = 1; - while ($i01 <= ($this->info['izlomObr'] - $this->info['izlomObrNow']) * 7) { - ItemsModel::addItem(1226, $u->info['id'], '|sudba=' . $u->info['login']); - $i01++; + $this->users = []; + $this->stats = []; + $this->uids = []; + $this->bots = []; + $this->iBots = []; + + while ($pl = mysql_fetch_array($trl)) { + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[$ir] = $pl; + $this->uids[$pl['id']] = $ir; + if ($pl['bot'] > 0) { + $this->bots[$bi] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + $bi++; + } + //записываем статы + $this->stats[$ir] = $u->getStats($pl['id'], 0, 0, false, false, true); + $ir++; } + } elseif (!isset($this->uids[$u->info['id']])) { + //данные о игроках в бою + $trl = mysql_query( + 'SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = ' . $this->i->id + ); + $pl = mysql_fetch_array($trl); + //записываем данные + if ($pl['login2'] == '') { + $pl['login2'] = $pl['login']; + } + $this->users[] = $pl; + $this->uids[$pl['id']] = $ir; + if ($pl['bot'] > 0) { + $this->bots[] = $pl['id']; + $this->iBots[$pl['id']] = $bi; + } + //записываем статы + $this->stats[] = $u->getStats($pl['id'], 0, 0, false, false, true); + } + } + + if ($this->i->izlom > 0 && $tmwin == 1) { + // выкидываем ботов из боя + $i = 0; + + $botsIds = Db::getColumn('select users.id from users left join stats on users.id = stats.id where battle = ? and bot = 1 and team != ?', [$this->i->id, $u->info['team']]); + Db::sql('delete from users where id in (?)', [implode(',', $botsIds)]); + Db::sql('delete from stats where id in (?)', [implode(',', $botsIds)]); + Db::sql('delete from items_users where uid in (?)', [implode(',', $botsIds)]); + Db::sql('delete from eff_users where uid in (?)', [implode(',', $botsIds)]); + + $j = 0; + $obr = 0; + $bots = []; + //Это излом, добавляем еще ботов + if (Helper::getChanse(20)) { + //Уникальные монстры + + if ($this->i->izlomlvl == 8) { + $bots = [ + 'Валентайский Охотник', + 'Шипокрыл Хаоса', + 'Шипокрыл', + 'Лик Хаоса', + 'Фанатик Хаоса', + ]; + } + + echo '
Приближается нечто...
'; + + $this->addIzlomBot($bots, $j, $obr, $this->users[$i]['id']); + + } else { + //Обычные монстры + if ($this->i->izlomlvl == 8) { + $bots = [ + 'Литейщик', + 'Проклятие Глубин', + 'Пустынник Маньяк', + 'Пустынник Убийца', + 'Рабочий Мглы', + 'Смотритель Мглы', + 'Сторож Мглы', + ]; + } + + $this->addIzlomBot($bots, $j, $obr); + $this->addIzlomBot($bots, $j, $obr); + + if (rand(0, 100) < 70) { + $this->addIzlomBot($bots, $j, $obr); + } + + //Каждые 10 волн = +1 монстр + $irb = floor($this->i->izlomroundsee / 10); + while ($irb > 0) { + $this->addIzlomBot($bots, $j, $obr); + $irb--; + } + } + + + if ($j == 0) { + //конец излома + $this->finish->finishBattle($tml, $tmv); + mysql_query( + 'INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u->info['id'] . '","' . time( + ) . '","' . $this->i->izlomroundsee . '","' . $this->i->izlomlvl . '","0","0","' . ($this->i->izlomobr - $this->i->izlomobrnow) . '","' . $this->i->id . '")' + ); + } else { + $this->i->setIzlomround($iz['round']); + mysql_query( + 'UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ($this->i->getIzlomround() + 1) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this->i->id . '" LIMIT 1' + ); + $this->stats[$this->uids[$u->info['id']]]['hpNow'] += $this->stats[$this->uids[$u->info['id']]]['hpAll'] * 0.25; + $this->stats[$this->uids[$u->info['id']]]['mpNow'] += $this->stats[$this->uids[$u->info['id']]]['mpAll'] * 0.25; + $this->users[$this->uids[$u->info['id']]]['hpNow'] = $this->stats[$this->uids[$u->info['id']]]['hpAll']; + $this->users[$this->uids[$u->info['id']]]['mpNow'] = $this->stats[$this->uids[$u->info['id']]]['mpAll']; + + //где это брать?? + $vLog = 'at1=00000||at2=00000||zb1=' . $this->stats[$this->uids[$u1]]['zonb'] . + '||zb2=' . $this->stats[$this->uids[$u2]]['zonb'] . + '||bl1=' . $this->atacks[$id]['b' . $a] . + '||bl2=' . $this->atacks[$id]['b' . $b] . + '||time1=' . $this->atacks[$id]['time'] . + '||time2=' . $this->atacks[$id]['time2'] . + '||s2=' . $this->users[$this->uids[$u2]]['sex'] . + '||s1=' . $this->users[$this->uids[$u1]]['sex'] . + '||t2=' . $this->users[$this->uids[$u2]]['team'] . + '||t1=' . $this->users[$this->uids[$u1]]['team'] . + '||login1=' . $this->users[$this->uids[$u1]]['login2'] . + '||login2=' . $this->users[$this->uids[$u2]]['login2']; + + $mas = [ + 'battle' => $this->i->id, + 'id_hod' => ($this->hodID + 1), + 'vars' => $vLog, + 'type' => 1, + ]; + + $textpart1 = $u->info['sex'] == 1 ? 'воспользовалась' : 'воспользовался'; + + $mas['text'] = '' . date('H:i') . + ' ' . $u->info['login'] . + ' ' . $textpart1 . ' приемом "Передышка".'; + + if ($u->stats['hpNow'] < $u->stats['hpAll']) { + $hpSks = floor(($u->stats['hpAll'] * ((rand(15, 25)) / 100))); + if ($hpSks > floor($u->stats['hpAll'] - $u->stats['hpNow'])) { + $hpSks = floor($u->stats['hpAll'] - $u->stats['hpNow']); + } + $textpart2 = "+$hpSks"; + } else { + $hpSks = 0; + $textpart2 = '--'; + } + + $mas['text'] .= ' +' . $textpart2 . ''; + $mas['text'] .= ' [' . floor($u->info['hpNow'] + $hpSks) . '/' . $u->stats['hpAll'] . ']'; + + + $this->add_log($mas); Db::sql( - "insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,unix_timestamp(),'capitalcity',?,'izlom','','','')", - [$u->info['id'], $u->info['room']] + 'update stats set hpnow = ?, mpnow = ? where id = ?', + [ + $u->info['hpNow'] + $u->stats['hpAll'] * ((rand(15, 25)) / 100), + $u->info['mpNow'] + $u->stats['mpAll'] * 0.25, + $u->info['id'], + ] ); - } + } else { - $this->finishBattle(null, null, 10); + //завершаем бой + $this->finish->finishBattle($tml, $tmv); + if ($this->i->izlom > 0) { + Db::sql( + 'insert into izlom_rating (uid, time, voln, level, obr, btl) values (?,unix_timestamp(),?,?,?,?)', + [ + $u->info['id'], + $this->i->izlomroundsee, + $this->i->izlomlvl, + $this->i->izlomobr - $this->i->izlomobrnow, + $this->i->id, + ] + ); + } } + + Effects::addById($u->info['id'], 31); + + $cmsg = new ChatMessage(); + $cmsg->setRoom($u->info['room']); + $cmsg->setTo($u->info['login']); + $cmsg->setType(6); + $cmsg->setText( + 'Вы создали предмет "Образец" x' . (($this->i->izlomobr - $this->i->izlomobrnow) * 7) + ); + (new Chat())->sendMsg($cmsg); + + $i01 = 1; + while ($i01 <= ($this->i->izlomobr - $this->i->izlomobrnow) * 7) { + ItemsModel::addItem(1226, $u->info['id'], '|sudba=' . $u->info['login']); + $i01++; + } + + Db::sql( + "insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,unix_timestamp(),'capitalcity',?,'izlom','','','')", + [$u->info['id'], $u->info['room']] + ); } /** @@ -1169,7 +1210,7 @@ JS; "select id, align, clan, level, sex, login from test_bot where login = ? and pishera != '' and active = 1 and level <= ? order by level desc limit 1", [$botLogins[array_rand($botLogins)], $u->info['level']] ); - $bot = $u->addNewbot(id: $id, round: round($this->info['izlomRoundSee']) * mt_rand(1, 2)); + $bot = $u->addNewbot(id: $id, round: round($this->i->izlomroundsee) * mt_rand(1, 2)); if (empty($bot)) { return; } @@ -1180,7 +1221,7 @@ JS; Log::add( [ 'text' => "{tm1} $btxt", - 'battle' => $this->info['id'], + 'battle' => $this->i->id, 'id_hod' => ($this->hodID + 1), 'vars' => 'at1=00000||at2=00000||zb1=0||zb2=0||bl1=0||bl2=0||time1=' . time() . '||time2=' . time() . @@ -1191,7 +1232,7 @@ JS; ] ); - Db::sql('update users left join stats on users.id = stats.id set battle = ?, team = 2 where users.id = ?', [$this->info['id'], $bot['id']]); + Db::sql('update users left join stats on users.id = stats.id set battle = ?, team = 2 where users.id = ?', [$this->i->id, $bot['id']]); if ($unique) { $u->addAction(time(), 'win_bot_' . $id, '', $unique); @@ -1222,47 +1263,7 @@ JS; //Игрок1 наносит удар Игрок2 - - private function finishBattle($t, $v, $nl): void - { - $this->finish->finishBattle($t, $v, $nl); - } - - //Проверка ухода удара в игрока - - public function addTravm($uid, $type, $lvl): void - { - $stat = rand(1, 3); // пока без духовности - $img = "eff_travma$type.gif"; - if ($type == 1) { - $name = 'Легкая травма'; - $timeEnd = rand(1, 3);// время травмы от 1.30 до 6 часов - $data = 'add_s' . $stat . '=-' . $lvl; - } elseif ($type == 2) { - $name = 'Средняя травма'; - $timeEnd = rand(3, 5);// время травмы от 6 до 12 часов - $data = 'add_s' . $stat . '=-' . ($lvl * 2); - } elseif ($type == 3) { - $name = 'Тяжелая травма'; - $timeEnd = rand(5, 7);// время травмы от 12 до 6 часов - $data = 'add_s' . $stat . '=-' . ($lvl * 3); - } else { - $name = 'Неизлечимая травма'; - $timeEnd = 24;// время травмы от 24 часа - $data = 'add_s' . $stat . '=-' . ($lvl * 50); - } - $timeEnd *= 3600; - mysql_query( - 'INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time( - ) . '","-1","' . $name . '","' . $data . '","' . $uid . '", "4", "' . $img . '","' . $timeEnd . '", "' . $type . '")' - ); - mysql_query( - 'INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time( - ) . '","-1","Иммунитет: Защита от травм","add_notravma=1","' . $uid . '", "263", "cure1.gif","21600", "")' - ); - } - //Расчет уворота игроков //Расчет крита игроков //Расчет блока щитом игроков @@ -1282,7 +1283,7 @@ JS; $arr = [ 'text' => $text, - 'battle' => $this->info['id'], + 'battle' => $this->i->id, 'id_hod' => $this->hodID + $hodID, 'vars' => $vLog, 'type' => 1, @@ -1344,10 +1345,10 @@ JS; $this->stats[$this->uids[$u2]]['u_priem'][] = [ $j, $effect['v2'], - $this->prm[$effect['v2']]['act'], + $this->prm[$effect['v2']]->act, $effect['id'], - $this->prm[$effect['v2']]['type_of'], - $this->prm[$effect['v2']]['moment'], + $this->prm[$effect['v2']]->typeOf, + $this->prm[$effect['v2']]->moment, ]; } } @@ -1460,7 +1461,7 @@ JS; $this->addNewStat( [ 1 => [ - 'battle' => $this->info['id'], + 'battle' => $this->i->id, 'uid1' => $this->users[$this->uids[$u1]]['id'], 'uid2' => $this->users[$this->uids[$u2]]['id'], 'time' => time(), @@ -1538,25 +1539,6 @@ JS; $addExp = 100; } - if ($this->info['razdel'] != 5 && Config::get('exp_limit_many')) { - $texp = Db::getValue( - 'select count(*) from battle_users as a where uid = ? and battle in (select battle from battle_users where uid = ? and team != a.team and time_enter > unix_timestamp() - 86400)' - ); - // - if ($texp > 5) { - $addExp = 0; - } elseif ($texp > 4) { - $addExp = $addExp * 0.50; - } elseif ($texp > 3) { - $addExp = $addExp * 0.75; - } elseif ($texp > 2) { - $addExp = $addExp * 1.00; - } elseif ($texp > 1) { - $addExp = $addExp * 1.00; - } else { - $addExp = $addExp * 1.00; - } - } return (int)round($addExp); } @@ -1568,7 +1550,7 @@ JS; mysql_query( 'INSERT INTO `battle_stat` ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( - "' . $this->info['id'] . '", + "' . $this->i->id . '", "' . $stat[1]['uid1'] . '", "' . $stat[1]['uid2'] . '", "' . $stat[1]['time'] . '", @@ -1590,7 +1572,7 @@ JS; mysql_query( 'INSERT INTO `battle_stat` ( `battle`,`uid1`,`uid2`,`time`,`type`,`a`,`b`,`ma`,`mb`,`type_a`,`type_b`,`yrn`,`yrn_krit`,`tm1`,`tm2` ) VALUES ( - "' . $this->info['id'] . '", + "' . $this->i->id . '", "' . $stat[2]['uid1'] . '", "' . $stat[2]['uid2'] . '", "' . $stat[2]['time'] . '", @@ -1618,7 +1600,7 @@ JS; $hodID = mysql_fetch_array( mysql_query( - 'SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` LIMIT 1' + 'SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->i->id . '" ORDER BY `time` LIMIT 1' ) ); if ($hodID['id_hod'] <= 1) { @@ -1635,14 +1617,14 @@ JS; 'SELECT `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` FROM `battle_logs` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC' + WHERE `battle` = "' . $this->i->id . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC' ); - if (isset($sp) && $this->info['team_win'] != -1) { + if (isset($sp) && $this->i->getTeamwin() != -1) { $sp = mysql_query( 'SELECT `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` FROM `battle_logs_save` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC' + WHERE `battle` = "' . $this->i->id . '" AND `id_hod` >= ' . $talog['alog'] . ' ORDER BY `id` DESC' ); } $jin = 0; @@ -1699,10 +1681,10 @@ JS; $js = ''; $pll = 0; - if ($this->info['type'] != 9) { + if ($this->i->type != 9) { $hodID = mysql_fetch_array( mysql_query( - 'SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `time` LIMIT 1' + 'SELECT `id_hod` FROM `battle_logs` WHERE `battle` = "' . $this->i->id . '" ORDER BY `time` LIMIT 1' ) ); if ($hodID['id_hod'] <= 1) { @@ -1716,15 +1698,15 @@ JS; 'SELECT `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` FROM `battle_logs` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC' + WHERE `battle` = "' . $this->i->id . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC' ); - if (isset($spm) && $this->info['team_win'] != -1) { + if (isset($spm) && $this->i->getTeamwin() != -1) { $spm = mysql_query( 'SELECT `id`,`type`,`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zona2`,`zonb1`,`zonb2` FROM `battle_logs_save` - WHERE `battle` = "' . $this->info['id'] . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC' + WHERE `battle` = "' . $this->i->id . '" AND `id_hod` >= ' . $tmlog['mlog'] . ' AND `vars` LIKE "%' . $u->info['login'] . '%" ORDER BY `id` DESC' ); } @@ -1893,7 +1875,7 @@ JS; { global $u; //проверяем удары - $m = mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" ORDER BY `id`'); + $m = mysql_query('SELECT * FROM `battle_act` WHERE `battle` = "' . $this->i->id . '" ORDER BY `id`'); $i = 0; while ($pl = mysql_fetch_array($m)) { $pluids = mysql_fetch_array( @@ -1907,7 +1889,7 @@ JS; if (isset($pltest['id'])) { if (isset($pluids['hpNow'])) { mysql_query('DELETE FROM `battle_act` WHERE `id` = "' . $pl['id'] . '" LIMIT 1'); - } elseif ($pl['time'] + $this->info['timeout'] > time()) { + } elseif ($pl['time'] + $this->i->timeout > time()) { //удар не пропущен по тайму, просто заносим данные $this->atacks[$pl['id']] = $pl; $this->ga[$pl['uid1']][$pl['uid2']] = $pl['id']; @@ -1954,8 +1936,6 @@ JS; } } - var_dump($this->ga, $this->ag); - //тест, бот делает удары while ($i < count($this->bots)) { $bot = $this->bots[$i]; @@ -1966,7 +1946,7 @@ JS; ) { //Тут проверка на бота saintlucia $j = 0; while ($j < count($this->users)) { - if ($this->info['razdel'] == 0) { + if ($this->i->razdel == 0) { $tnbot = time() + rand(1, 1); } else { $tnbot = time() + rand(1, 2); @@ -2066,7 +2046,7 @@ JS; $this->users[$this->uids[$bot]]['timeGo'] < time() ) { $tnbot = time() + rand(3, 7); - if ($this->info['type'] == 329) { // тестовый бой + if ($this->i->type == 329) { // тестовый бой $tnbot = time() - 1; } $this->startAtack($this->ga[$bot][$this->users[$j]['id']]); @@ -2085,7 +2065,7 @@ JS; ) { $this->startAtack($this->ag[$bot][$this->users[$j]['id']]); $tnbot = time() + rand(3, 7); - if ($this->info['type'] == 329) { // тестовый бой + if ($this->i->type == 329) { // тестовый бой $tnbot = time() - 1; } $this->users[$this->uids[$bot]]['timeGo'] = $tnbot; @@ -2110,7 +2090,7 @@ JS; { $test_atack = mysql_fetch_array( mysql_query( - 'SELECT `id` FROM `battle_act` WHERE `battle` = "' . $this->info['id'] . '" AND (( + 'SELECT `id` FROM `battle_act` WHERE `battle` = "' . $this->i->id . '" AND (( `uid1` = "' . $pl . '" AND `uid2` = "' . $uid . '" ) OR ( `uid2` = "' . $pl . '" AND `uid1` = "' . $uid . '" @@ -2130,7 +2110,7 @@ JS; $b = rand(1, 5); Db::sql( "insert into battle_act (battle,time,uid1,uid2,a1,b1,a2,b2,invis1,invis2) values (?,unix_timestamp(),?,?,?,?,'',0,0,0)", - [$this->info['id'], $pl, $uid, $a, $b,] + [$this->i->id, $pl, $uid, $a, $b,] ); } } elseif ($tp == 2) { @@ -2367,30 +2347,30 @@ JS; //Обновляем задержки пирожков mysql_query( - 'UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' + 'UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->i->id . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' ); mysql_query( - 'UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' + 'UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->i->id . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' ); //Тактики - mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); - mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + mysql_query('DELETE FROM `pirogi` WHERE `btl` = "' . $this->i->id . '" AND `hod` < 1'); + mysql_query('DELETE FROM `tactic` WHERE `btl` = "' . $this->i->id . '" AND `hod` < 1'); //Обновляем задержки пирожков mysql_query( - 'UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->info['id'] . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' + 'UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this->i->id . '" AND (`uid` = "' . $this->atacks[$id]['uid1'] . '" OR `uid` = "' . $this->atacks[$id]['uid2'] . '")' ); - mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->info['id'] . '" AND `hod` < 1'); + mysql_query('DELETE FROM `spells` WHERE `btl` = "' . $this->i->id . '" AND `hod` < 1'); //Обновляем данные в battle_users mysql_query( 'UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid1']]]['hpNow'] . '" - WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' + WHERE `battle` = "' . $this->i->id . '" AND `uid` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' ); mysql_query( 'UPDATE `battle_users` SET `hp` = "' . $this->stats[$this->uids[$this->atacks[$id]['uid2']]]['hpNow'] . '" - WHERE `battle` = "' . $this->info['id'] . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' + WHERE `battle` = "' . $this->i->id . '" AND `uid` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' ); //Восстановление манны 25% от мудрости за ход @@ -2410,7 +2390,7 @@ JS; ); } - $sql = 'update stats set hpNow = :hpnow, mpNow = :mpnow, + $sql = 'update stats set hpnow = :hpnow, mpnow = :mpnow, tactic1 = :t1, tactic2 = :t2, tactic3 = :t3, tactic4 = :t4, tactic5 = :t5, tactic6 = :t6, tactic7 = :t7, enemy = :enemy, battle_yron = :by, last_hp = :lasthp, battle_exp = :be, @@ -2638,15 +2618,15 @@ JS; $j++; } //Проверяем - if (Config::get('propsk_die') > 0 && $this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + if (Config::get('propsk_die') > 0 && $this->i->razdel == 0 && $this->i->dnId == 0 && $this->i->izlom == 0) { $cn1 = mysql_fetch_array( mysql_query( - 'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' + 'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->i->id . '" AND `uid1` = "' . $this->atacks[$id]['uid1'] . '" LIMIT 1' ) ); $cn2 = mysql_fetch_array( mysql_query( - 'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->info['id'] . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' + 'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this->i->id . '" AND `uid1` = "' . $this->atacks[$id]['uid2'] . '" LIMIT 1' ) ); if ($cn1[0] > 3) { @@ -2727,7 +2707,7 @@ JS; $vLog .= '||s2=' . $u2['sex'] . '||t2=' . $u2['team'] . '||login2=' . $u2['login']; } $mas1 = [ - 'battle' => $this->info['id'], + 'battle' => $this->i->id, 'id_hod' => $this->hodID, 'text' => '', 'vars' => $vLog, @@ -2901,12 +2881,12 @@ JS; $this->stats[$this->uids[$uid1]]['u_priem'] = [ $j, $effect['v2'], - $this->prm[$effect['v2']]['act'], + $this->prm[$effect['v2']]->act, $effect['id'], - $this->prm[$effect['v2']]['type_of'], - $this->prm[$effect['v2']]['moment'], - $this->prm[$effect['v2']]['moment_end'], - $this->prm[$effect['v2']]['type_sec'], + $this->prm[$effect['v2']]->typeOf, + $this->prm[$effect['v2']]->moment, + $this->prm[$effect['v2']]->momentEnd, + $this->prm[$effect['v2']]->typeSec, ]; $j++; } @@ -2919,12 +2899,12 @@ JS; $this->stats[$this->uids[$uid2]]['u_priem'] = [ $j, $effect['v2'], - $this->prm[$effect['v2']]['act'], + $this->prm[$effect['v2']]->act, $effect['id'], - $this->prm[$effect['v2']]['type_of'], - $this->prm[$effect['v2']]['moment'], - $this->prm[$effect['v2']]['moment_end'], - $this->prm[$effect['v2']]['type_sec'], + $this->prm[$effect['v2']]->typeOf, + $this->prm[$effect['v2']]->moment, + $this->prm[$effect['v2']]->momentEnd, + $this->prm[$effect['v2']]->typeSec, ]; $j++; } @@ -3542,7 +3522,7 @@ JS; $defd = mysql_fetch_array( mysql_query( - 'SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" AND `vars` = "use_defteam' . $u2['team'] . '" LIMIT 1' + 'SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->i->id . '" AND `vars` = "use_defteam' . $u2['team'] . '" LIMIT 1' ) ); if ($defd[0] > 100) { @@ -3551,7 +3531,7 @@ JS; $defd = 0 + $defd[0]; $powd = mysql_fetch_array( mysql_query( - 'SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->info['id'] . '" AND `vars` = "use_powteam' . $u1['team'] . '" LIMIT 1' + 'SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this->i->id . '" AND `vars` = "use_powteam' . $u1['team'] . '" LIMIT 1' ) ); if ($powd[0] > 100) { @@ -4047,7 +4027,7 @@ JS; $e = 0; } - if ((int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && $this->users[$this->uids[$id1]]['dnow'] != 0 && $this->info['dungeon'] != 1) { + if ((int)$this->users[$this->uids[$id1]]['bot_id'] == 0 && $this->users[$this->uids[$id1]]['dnow'] != 0 && $this->i->dungeon != 1) { $dun_limitForLevel = [ // Максимум для каждого уровня. 4 => 750, 5 => 1500, @@ -4078,7 +4058,7 @@ JS; if (isset($dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']])) { $e = $e * $dun_expFactor[(int)$this->users[$this->uids[$id1]]['level']]; } - if ($this->info['dungeon'] > 1 && $this->users[$this->uids[$id1]]['battle'] > 0) { // пещерный лимит + if ($this->i->dungeon > 1 && $this->users[$this->uids[$id1]]['battle'] > 0) { // пещерный лимит $dun_exp = []; // Текущий лимит опыта игрока в подземельях. $rep = Db::getValue( 'select dungeonexp from rep where id = ?', [$this->users[$this->uids[$id1]]['id']] @@ -4092,31 +4072,31 @@ JS; } unset($rep); - if (!isset($dun_exp[$this->info['dungeon']])) { - $dun_exp[$this->info['dungeon']] = 0; + if (!isset($dun_exp[$this->i->dungeon])) { + $dun_exp[$this->i->dungeon] = 0; } if (!isset($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']])) { // Если лимит не задан, опыт не даем. $e = 0; } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_exp[$this->info['dungeon']] >= $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] + isset($dun_exp[$this->i->dungeon]) && + $dun_exp[$this->i->dungeon] >= $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] ) { // Если лимит уже достигнут, опыт не даем. $e = 0; } elseif ( - isset($dun_exp[$this->info['dungeon']]) && - $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > $dun_exp[$this->info['dungeon']] + isset($dun_exp[$this->i->dungeon]) && + $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > $dun_exp[$this->i->dungeon] ) { // Если текущая репутация не достигла лимита. - if (($dun_exp[$this->info['dungeon']] + $e) > $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']]) { + if (($dun_exp[$this->i->dungeon] + $e) > $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']]) { // Если опыта набрано достаточно, для достижения лимита. $e = abs( $e - abs( - $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ($e + $dun_exp[$this->info['dungeon']]) + $dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] - ($e + $dun_exp[$this->i->dungeon]) ) ); - $dun_exp[$this->info['dungeon']] += $e; - } elseif ($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > ($dun_exp[$this->info['dungeon']] + $e)) { + $dun_exp[$this->i->dungeon] += $e; + } elseif ($dun_limitForLevel[(int)$this->users[$this->uids[$id1]]['level']] > ($dun_exp[$this->i->dungeon] + $e)) { // Если опыта недостаточно, для достижения лимита. - $dun_exp[$this->info['dungeon']] += $e; + $dun_exp[$this->i->dungeon] += $e; } else { $e = 0; } @@ -4125,7 +4105,7 @@ JS; } } // Опыт в пещерах. - if ($this->info['dungeon'] == 102) { + if ($this->i->dungeon == 102) { $e = floor($e * 0.002); } } @@ -4287,7 +4267,7 @@ JS; $mas = [ 'text' => '', 'time' => time(), - 'battle' => $this->info['id'], + 'battle' => $this->i->id, 'id_hod' => $this->hodID, 'vars' => $vLog, 'type' => 1, @@ -4298,10 +4278,10 @@ JS; $mas['text'] .= '{u1} потратил свой ход на магию.'; } else { - if ($this->info['razdel'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + if ($this->i->razdel == 0 && $this->i->dnId == 0 && $this->i->izlom == 0) { mysql_query( 'INSERT INTO `battle_out` (`battle`,`uid1`,`uid2`,`time`,`out`) VALUES ( - "' . $this->info['id'] . '","' . $u1 . '","' . $u2 . '","' . time() . '","1" + "' . $this->i->id . '","' . $u1 . '","' . $u2 . '","' . time() . '","1" )' ); } @@ -4402,13 +4382,13 @@ JS; $mas['text'] .= ', нанеся противнику '; if ($at[$a]['atack'][$j]['yron']['travma'][0] == 1) { $mas['text'] .= 'Легкую'; - $this->addTravm($u2, 1, rand(3, 5)); + Effects::addInjury($u2, 1, rand(3, 5)); } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 2) { $mas['text'] .= 'Среднюю'; - $this->addTravm($u2, 2, rand(3, 5)); + Effects::addInjury($u2, 2, rand(3, 5)); } elseif ($at[$a]['atack'][$j]['yron']['travma'][0] == 3) { $mas['text'] .= 'Тяжелую'; - $this->addTravm($u2, 3, rand(3, 5)); + Effects::addInjury($u2, 3, rand(3, 5)); } $mas['text'] .= ' травму. '; } @@ -4484,12 +4464,12 @@ JS; $rtngwin = [1, 2, 3, 5, 10, 20, 40, 80, 160]; $rtnglos = [0, 0, 0, -1, -2, -5, -10, -20, -40]; - if ($this->info['typeBattle'] == 99) { + if ($this->i->typebattle == 99) { if ($this->finish->getBtlstatus()[0] == 0) { //Кровавые бои обычные $rtngwin = [2, 4, 6, 10, 20, 40, 80, 160, 320]; - if ($this->info['razdel'] == 5) { + if ($this->i->razdel == 5) { //не хаот $rtnglos = [0, 0, 0, -2, -4, -10, -20, -40, -80]; } else { @@ -4520,7 +4500,7 @@ JS; } else { if ($this->finish->getBtlstatus()[0] == 0) { //Обычный поединок - if ($this->info['razdel'] != 5) { + if ($this->i->razdel != 5) { //хаот $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; } @@ -4547,11 +4527,11 @@ JS; } } - if ($this->info['dn_id'] > 0 || $this->info['izlom'] != 0 || $this->info['turnir'] != 0) { + if ($this->i->dnId > 0 || $this->i->izlom != 0 || $this->i->turnir != 0) { //Пещерные бои не считаются и Изломы тоже, ну и Турниры $rtngwin = [0, 0, 0, 0, 0, 0, 0, 0, 0]; $rtnglos = [0, 0, 0, 0, 0, 0, 0, 0, 0]; - } elseif ($this->info['clan1'] > 0 && $this->info['clan2'] > 0) { + } elseif ($this->i->clan1 > 0 && $this->i->clan2 > 0) { //Клановая война $rtngwin = [3, 6, 9, 15, 30, 60, 120, 240, 480]; $rtnglos = [-1, -2, -4, -8, -16, -32, -64, -128, -256]; @@ -4561,7 +4541,7 @@ JS; $rtng2 = 0; if ($dies[1] == 1) { - if ($this->info['dn_id'] <= 0 && $this->users[$this->uids[$u1]]['level'] >= 4) { + if ($this->i->dnId <= 0 && $this->users[$this->uids[$u1]]['level'] >= 4) { $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; } @@ -4569,7 +4549,7 @@ JS; $this->spaCheck($this->users[$this->uids[$u1]]['id']); } if ($dies[2] == 1) { - if ($this->info['dn_id'] <= 0 && $this->users[$this->uids[$u1]]['level'] >= 4) { + if ($this->i->dnId <= 0 && $this->users[$this->uids[$u1]]['level'] >= 4) { $rtng1 += $rtnglos[$this->users[$this->uids[$u1]]['level'] - 4]; $rtng2 += $rtngwin[$this->users[$this->uids[$u1]]['level'] - 4]; } @@ -4578,7 +4558,7 @@ JS; } //Записываем рейтинг // - if ($this->info['type'] != 564 && $this->stats[$this->uids[$u1]]['inTurnir'] == 0 && $this->stats[$this->uids[$u2]]['inTurnir'] == 0 && $this->info['dn_id'] == 0 && $this->info['izlom'] == 0) { + if ($this->i->type != 564 && $this->stats[$this->uids[$u1]]['inTurnir'] == 0 && $this->stats[$this->uids[$u2]]['inTurnir'] == 0 && $this->i->dnId == 0 && $this->i->izlom == 0) { // if ($this->users[$this->uids[$u2]]['bot'] == 0) { mysql_query( @@ -4738,7 +4718,7 @@ JS; $mas = [ 'text' => $text, - 'battle' => $this->info['id'], + 'battle' => $this->i->id, 'id_hod' => $hodID, 'vars' => $vLog, 'type' => 1, @@ -4877,7 +4857,7 @@ JS; Db::sql( 'delete from battle_act where battle = ? and uid1 in (?,?) and uid2 in (?,?)', [ - $this->info['id'], + $this->i->id, $u->info['id'], $u->info['enemy'], $u->info['id'], @@ -4887,7 +4867,7 @@ JS; Db::sql( "insert into battle_act (battle,uid1,uid2,a1,b1,time,a2,b2,invis1,invis2) values (?,?,?,?,?,unix_timestamp(),'',0,0,0)", [ - $this->info['id'], + $this->i->id, $u->info['id'], $u->info['enemy'], $a, @@ -4983,7 +4963,7 @@ JS; public function teamsTake(User $u): void { - if ($this->info['id'] < 1) { + if ($this->i->id < 1) { return; } @@ -4995,21 +4975,21 @@ JS; $usersInBattle = Db::getRows( "select room,no_ip,twink,stopexp,users.id,notrhod,login, if(login2 != '', login2, login) as login2, sex,online,admin, - align,align_lvl,align_exp,clan,level,battle,obraz,win,lose,nich,animal,stats,hpNow,mpNow,exp,dnow,team, - battle_yron,battle_exp,enemy,battle_text,upLevel,timeGo,timeGoL,bot,lider,btl_cof, - tactic1,tactic2,tactic3,tactic4,tactic5,tactic6,tactic7,x,y,battleEnd,priemslot,priems,priems_z,bet,clone, + align,align_lvl,align_exp,clan,level,battle,obraz,win,lose,nich,animal,stats,hpnow,mpnow,exp,dnow,team, + battle_yron,battle_exp,enemy,battle_text,uplevel,timego,timegol,bot,lider,btl_cof, + tactic1,tactic2,tactic3,tactic4,tactic5,tactic6,tactic7,x,y,battleend,priemslot,priems,priems_z,bet,clone, atack,bbexp,res_x,res_y,res_s,last_hp,last_pr,sex,money,bot_id,money3,money2 - from users left join stats on users.id = stats.id where battle = ?", [$this->info['id']] + from users left join stats on users.id = stats.id where battle = ?", [$this->i->id] ); $i = 0; $bi = 0; - if ($this->info['start2'] == 0) { - if (Db::getValue('select count(id) from battle where id = ? and start2 = 0', [$this->info['id']]) === 1) { - Db::sql('update battle set start2 = unix_timestamp() where id = ?', [$this->info['id']]); + if ($this->i->getStart2() == 0) { + if (Db::getValue('select count(id) from battle where id = ? and start2 = 0', [$this->i->id]) === 1) { + Db::sql('update battle set start2 = unix_timestamp() where id = ?', [$this->i->id]); } else { - $this->info['start2'] = time(); + $this->i->setStart2(); } } @@ -5030,7 +5010,7 @@ JS; $this->stats[$i] = $stats->getStats(btl_cache: $this->cached); //Заносим старт - if ($this->info['start2'] == 0) { + if ($this->i->getStart2() == 0) { Db::sql('update users set notrhod = default where id = ?', [$this->users[$i]['id']]); $this->users[$i]['notrhod'] = -1; @@ -5074,7 +5054,7 @@ JS; } //battle-user (статистика, начальная) - $mybu = Db::getValue('select id from battle_users where battle = ? and uid = ? limit 1', [$this->info['id'], $user['id']]); + $mybu = Db::getValue('select id from battle_users where battle = ? and uid = ? limit 1', [$this->i->id, $user['id']]); if (!$mybu) { //Пустое значение статистики для данного персонажа за текущий бой @@ -5086,15 +5066,15 @@ JS; //Заносим в лог начало поединка - if ($this->info['start1'] != 0) { + if ($this->i->getStart1() != 0) { return; } - if (Db::getValue('select count(id) from battle where id = ? and start1 = 0', [$this->info['id']]) !== 1) { + if (Db::getValue('select count(id) from battle where id = ? and start1 = 0', [$this->i->id]) !== 1) { return; } - Db::sql('update battle set start1 = unix_timestamp() where id = ?', [$this->info['id']]); + Db::sql('update battle set start1 = unix_timestamp() where id = ?', [$this->i->id]); $teamlist = []; for ($j = 1; $j <= $tsi; $j++) { //was 0 @@ -5108,19 +5088,19 @@ JS; $this->hodID++; - $timestart = date('d.m.Y H:i', $this->info['time_start']); + $timestart = date('d.m.Y H:i', $this->i->timeStart); Log::add( [ 'text' => "Часы показывали $timestart, когда $vsTeams бросили вызов друг другу.", - 'battle' => $this->info['id'], + 'battle' => $this->i->id, 'id_hod' => $this->hodID, 'vars' => 'time1=' . time() . '||', 'type' => '1', ] ); - $this->info['start1'] = time(); + $this->i->setStart1(); } private function addstatuser($uid): void @@ -5135,9 +5115,9 @@ JS; $this->stats[$id]['hp'] = $this->stats[$id]['hpNow']; } Db::sql( - 'insert into battle_users (battle,uid,time_enter,login,level,align,clan,hpAll,hp,hpStart,team) values (?,?,unix_timestamp(),?,?,?,?,?,?,?,?)', + 'insert into battle_users (battle,uid,time_enter,login,level,align,clan,hpall,hp,hpstart,team) values (?,?,unix_timestamp(),?,?,?,?,?,?,?,?)', [ - $this->info['id'], + $this->i->id, $uid, $this->users[$id]['login'], $this->users[$id]['level'], @@ -5213,7 +5193,7 @@ JS; 'SELECT * FROM `battle_act` WHERE `id` = "' . $this->ga[$this->users[$i]['id']][$you] . '" LIMIT 1' ) ); - if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { + if (isset($ac) && $ac['time'] + $this->i->timeout - 15 < time()) { $a1mc = 'color:red;'; } $a1ms = 'style=\"text-decoration: underline; ' . $a1mc . '\"'; @@ -5224,7 +5204,7 @@ JS; 'SELECT * FROM `battle_act` WHERE `id` = "' . $this->ag[$this->users[$i]['id']][$you] . '" LIMIT 1' ) ); - if (isset($ac) && $ac['time'] + $this->info['timeout'] - 15 < time()) { + if (isset($ac) && $ac['time'] + $this->i->timeout - 15 < time()) { $a1mc = 'color:green;'; } $a1ms = 'style=\"text-decoration: overline; ' . $a1mc . '\"'; @@ -5237,7 +5217,7 @@ JS; $this->stats[$i]['hpAll'] = '100%'; } $ldr = ''; - if ($this->users[$i]['lider'] == $this->info['id']) { + if ($this->users[$i]['lider'] == $this->i->id) { $ldr = 'users[$i]['team'] . '.gif \>'; } $teams[$this->users[$i]['team']] .= ', ' . $ldr . 'users[$i]['team'] . '\" onClick=\"top.chat.addto(\'' . $this->users[$i]['login2'] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this->users[$i]['login2'] . '\',event,\'main\'); return false;\">' . $this->users[$i]['login2'] . ' [' . floor( @@ -5364,7 +5344,7 @@ JS; Log::add( [ - 'battle' => $this->info['id'], + 'battle' => $this->i->id, 'id_hod' => 1, 'vars' => 'time1=' . time() . diff --git a/_incl_data/class/Battle/Fighter.php b/_incl_data/class/Battle/Fighter.php index 4955ad04..40be3849 100644 --- a/_incl_data/class/Battle/Fighter.php +++ b/_incl_data/class/Battle/Fighter.php @@ -4,5 +4,552 @@ namespace Battle; class Fighter { + private int $id; + private string $login; + private string $login2; + private int $online; + private int $admin; + private string $align; + private int $clan; + private int $level; -} \ No newline at end of file + public function __construct() {} +} + +/* + +/app/_incl_data/class/Battle.php:471: +array (size=126) + 'zag' => string '' (length=0) + 'id' => int 27205347 + 'login' => string 'Merlin' (length=6) + 'login2' => string '' (length=0) + 'online' => int 1704494746 + 'admin' => int 1 + 'city' => string 'capitalcity' (length=11) + 'cityreg' => string 'capitalcity' (length=11) + 'align' => string '1.99' (length=4) + 'align_lvl' => int 0 + 'align_exp' => int 0 + 'clan' => int 0 + 'level' => int 8 + 'money' => float 62531.5 + 'money3' => float 30 + 'money2' => float 15 + 'money4' => float 40 + 'battle' => int 466011 + 'sex' => int 0 + 'obraz' => string '78.gif' (length=6) + 'win' => int 0 + 'win_t' => int 0 + 'lose' => int 4 + 'lose_t' => int 0 + 'nich' => int 16 + 'timeMain' => int 1704494746 + 'invis' => int 0 + 'bot_id' => int 0 + 'animal' => int 0 + 'type_pers' => int 0 + 'notrhod' => int -1 + 'bot_room' => int 0 + 'inUser' => int 0 + 'inTurnir' => int 0 + 'inTurnirnew' => int 0 + 'stopexp' => int 0 + 'real' => int 1 + 'stats' => string 's1=3|s2=3|s3=3|s4=250|rinv=40|m9=5|m6=10|s7="0"|a1=0|a2=0|a3=0|a4=0|a5=0|mg1=0|mg2=0|mg3=0|mg4=0|mg5=0|mg6=0|mg7=0|s5=0|s6=0|a6=0|s8=0|s9=0|s10=0|s11=0|s12=0|s13=0|s14=0|s15=0' (length=175) + 's1' => int 0 + 's2' => int 0 + 's3' => int 0 + 's4' => int 0 + 's5' => int 0 + 's6' => int 0 + 's7' => int 0 + 'a1' => int 0 + 'a2' => int 0 + 'a3' => int 0 + 'a4' => int 0 + 'mg1' => int 0 + 'mg2' => int 0 + 'mg3' => int 0 + 'mg4' => int 0 + 'hpNow' => int 1132 + 'mpNow' => int 0 + 'enNow' => int 0 + 'hpAll' => int 2130 + 'mpAll' => int 0 + 'regHP' => int 1704492966 + 'regMP' => int 1704492966 + 'showmenu' => string '1|1|1|1|1|1|1|1' (length=15) + 'prmenu' => string '0|1|2|3|4|5|6|7' (length=15) + 'ability' => int 78 + 'skills' => int 9 + 'sskills' => int 0 + 'nskills' => int 0 + 'exp' => int 250 + 'minHP' => int 15 + 'minMP' => int 8 + 'zv' => int 0 + 'dn' => int 0 + 'dnow' => int 0 + 'team' => int 1 + 'battle_yron' => int 0 + 'battle_exp' => int 0 + 'enemy' => int 27319397 + 'last_a' => int 0 + 'last_b' => int 0 + 'battle_text' => string '' (length=0) + 'upLevel' => int 57 + 'wipe' => int 0 + 'bagStats' => string '0' (length=1) + 'timeGo' => int 1704297684 + 'timeGoL' => int 1704297679 + 'nextAct' => string '64e9f79e15fca80055d7eabb26f390a4' (length=32) + 'active' => string '' (length=0) + 'bot' => int 0 + 'lastAlign' => string '' (length=0) + 'tactic1' => int 0 + 'tactic2' => int 0 + 'tactic3' => int 0 + 'tactic4' => int 7 + 'tactic5' => int 0 + 'tactic6' => float 0 + 'tactic7' => float 20 + 'x' => int 3 + 'y' => int 4 + 's' => int 1 + 'battleEnd' => int 0 + 'priemslot' => int 10 + 'priems' => string '0|2|3|0|0|138|235|213|140|4|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0' (length=87) + 'priems_z' => string '0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0' (length=101) + 'bet' => int 0 + 'clone' => int 0 + 'atack' => int 0 + 'bbexp' => int 0 + 'ref_data' => string '' (length=0) + 'res_x' => int 0 + 'res_y' => int 0 + 'res_s' => int 1 + 'bn_capitalcity' => int 0 + 'bn_demonscity' => int 0 + 'smena' => int 3 + 'last_hp' => int -20 + 'last_pr' => int 0 + 'transfers' => int 65000 + 'btl_cof' => int 381 + 'dieline' => int 0 + 'lider' => int 462716 + 'old_battle' => int 10 + 'alog' => int 0 + 'mlog' => int 0 + 'seff' => null + 'upexpdate' => int 1671486569 + 'expstopu' => int 0 + 'repexp' => int 35 +/app/_incl_data/class/Battle.php:471: +array (size=102) + 'a1' => int 0 + 'a2' => int 0 + 'a3' => int 0 + 'a4' => int 0 + 'a5' => int 0 + 'aall' => int 0 + 'm1' => int 15 + 'm10' => int 90 + 'm11' => int 0 + 'm14' => int 0 + 'm15' => int 0 + 'm18' => int 0 + 'm19' => int 0 + 'm2' => int 15 + 'm3' => int 0 + 'm4' => int 15 + 'm5' => int 15 + 'm6' => int 10 + 'm7' => int 0 + 'm8' => int 0 + 'm9' => int 5 + 'mall' => int 0 + 'mg1' => int 0 + 'mg2' => int 0 + 'mg3' => int 0 + 'mg4' => int 0 + 'mg7' => int 0 + 'pa1' => int 0 + 'pa2' => int 0 + 'pa3' => int 0 + 'pa4' => int 0 + 'pm1' => int 0 + 'pm2' => int 0 + 'pm3' => int 0 + 'pm4' => int 0 + 'pm7' => int 0 + 's1' => int 3 + 's2' => int 3 + 's3' => int 3 + 's4' => int 250 + 's5' => int 0 + 's6' => int 0 + 's7' => int 0 + 'za' => int 375 + 'za1' => int 375 + 'za2' => int 375 + 'za3' => int 375 + 'za4' => int 375 + 'zm' => int 125 + 'zm1' => int 125 + 'zm2' => int 125 + 'zm3' => int 125 + 'zm4' => int 125 + 'zona' => int 2 + 'zonb' => int 2 + 'levels' => + array (size=17) + 'upLevel' => int 57 + 'nextLevel' => int 8 + 'exp' => int 200000 + 'money' => int 0 + 'money_bonus1' => int 0 + 'money_bonus2' => int 0 + 'ability' => int 0 + 'skills' => int 0 + 'nskills' => int 0 + 'sskills' => int 0 + 'expBtlMax' => int 5000 + 'bprice' => int 2300 + 'hpRegen' => int 250 + 'mpRegen' => int 250 + 'money2' => float 0.5 + 'duh' => int 0 + 'vinos' => int 0 + 'id' => int 27205347 + 'login' => string 'Merlin' (length=6) + 'hpNow' => int 1132 + 'mpNow' => int 0 + 'items' => + array (size=5) + 0 => + array (size=14) + 'type' => int 1 + 'data' => string '' (length=0) + 'inOdet' => int 1 + 'item_id' => int 391 + 'inslot' => int 1 + 'useInBattle' => int 0 + 'btl_zd' => int 0 + 'iznosNOW' => float 0.7 + 'iznosMAX' => float 30 + 'magic_inci' => string '' (length=0) + 'name' => string 'Серый Шлем' (length=19) + 'id' => int 75917766 + 'img' => string 'helmet77.gif' (length=12) + '2h' => int 0 + 1 => + array (size=14) + 'type' => int 26 + 'data' => string 'tr_lvl=4|sv_yron_min=5|sv_yron_max=10|tya1=20|tya3=80' (length=53) + 'inOdet' => int 3 + 'item_id' => int 631 + 'inslot' => int 3 + 'useInBattle' => int 0 + 'btl_zd' => int 0 + 'iznosNOW' => float 0.55 + 'iznosMAX' => float 110 + 'magic_inci' => string '' (length=0) + 'name' => string 'Укрепленный Костыль ' (length=38) + 'id' => int 75917784 + 'img' => string 'kostyl2.gif' (length=11) + '2h' => int 0 + 2 => + array (size=14) + 'type' => int 29 + 'data' => string '' (length=0) + 'inOdet' => int 54 + 'item_id' => int 1032 + 'inslot' => int 53 + 'useInBattle' => int 1 + 'btl_zd' => int 0 + 'iznosNOW' => float 0 + 'iznosMAX' => float 3 + 'magic_inci' => string '446' (length=3) + 'name' => string 'Живая Вода' (length=19) + 'id' => int 75917747 + 'img' => string 'invoke_kar3_lifew.gif' (length=21) + '2h' => int 0 + 3 => + array (size=14) + 'type' => int 29 + 'data' => string '' (length=0) + 'inOdet' => int 53 + 'item_id' => int 1034 + 'inslot' => int 53 + 'useInBattle' => int 1 + 'btl_zd' => int 0 + 'iznosNOW' => float 0 + 'iznosMAX' => float 3 + 'magic_inci' => string '449' (length=3) + 'name' => string 'Сушеный Мухомор' (length=29) + 'id' => int 75917742 + 'img' => string 'invoke_kar3_mush.gif' (length=20) + '2h' => int 0 + 4 => + array (size=14) + 'type' => int 18 + 'data' => string 'tr_lvl=8|tr_s2=30|tr_s3=30|tr_s1=15|tr_s4=30|tr_a1=9|add_m4=40|add_s2=1|add_s3=2|sv_yron_min=5|sv_yron_max=15|add_m5=30|add_m1=30|add_m9=15|complect=106|tya1=75|tya3=25||fromshop=1' (length=180) + 'inOdet' => int 14 + 'item_id' => int 6473 + 'inslot' => int 3 + 'useInBattle' => int 0 + 'btl_zd' => int 0 + 'iznosNOW' => float 0.7 + 'iznosMAX' => float 25 + 'magic_inci' => string '' (length=0) + 'name' => string 'Кинжал Злодеяний [8]' (length=35) + 'id' => int 75917776 + 'img' => string 'knife76.gif' (length=11) + '2h' => int 0 + 'effects' => + array (size=1) + 0 => + array (size=41) + 'id' => int 106916938 + 'id_eff' => int 31 + 'uid' => int 27205347 + 'name' => string 'Касание Хаоса' (length=25) + 'data' => string 'nofastfinisheff=1' (length=17) + 'overType' => int 0 + 'timeUse' => int 1704492685 + 'timeAce' => int 0 + 'user_use' => string '' (length=0) + 'delete' => int 0 + 'v1' => string '0' (length=1) + 'v2' => int 0 + 'img2' => string '' (length=0) + 'x' => int 1 + 'hod' => int -1 + 'bj' => string '0' (length=1) + 'sleeptime' => int 0 + 'no_Ace' => int 0 + 'file_finish' => string '' (length=0) + 'tr_life_user' => int 0 + 'deactiveTime' => int 0 + 'deactiveLast' => int 0 + 'mark' => int 0 + 'bs' => int 0 + 'id2' => int 31 + 'mname' => string 'Касание Хаоса' (length=25) + 'type1' => int 21 + 'img' => string 'survival_timeout.gif' (length=20) + 'mdata' => string 'nofastfinisheff=1' (length=17) + 'actionTime' => int 86400 + 'type2' => int 6 + 'type3' => int 6 + 'onlyOne' => int 1 + 'oneType' => int 0 + 'noAce' => int 0 + 'see' => int 1 + 'info' => string 'Вы слишком близко приблизились к центру Излома Хаоса' (length=97) + 'overch' => int 0 + 'bp' => int 1 + 'noch' => int 0 + 'minfo' => string '' (length=0) + 'vip' => null + 'rinv' => int 40 + 'mg5' => int 0 + 'mg6' => int 0 + 'a6' => int 0 + 's8' => int 0 + 's9' => int 0 + 's10' => int 0 + 's11' => int 0 + 's12' => int 0 + 's13' => int 0 + 's14' => int 0 + 's15' => int 0 + 'wp1id' => int 0 + 'reting' => int 3 + 'wp3id' => int 1 + 'wp54id' => int 2 + 'wp53id' => int 3 + 'wp14id' => int 4 + 'set_pog' => + array (size=0) + empty + 'set_pog2' => + array (size=0) + empty + 'ozash' => + array (size=4) + 1 => + array (size=2) + 0 => int 0 + 1 => int 0 + 2 => + array (size=2) + 0 => int 0 + 1 => int 0 + 3 => + array (size=2) + 0 => int 0 + 1 => int 0 + 4 => + array (size=2) + 0 => int 0 + 1 => int 0 + 'ozmsh' => + array (size=4) + 1 => + array (size=2) + 0 => int 0 + 1 => int 0 + 2 => + array (size=2) + 0 => int 0 + 1 => int 0 + 3 => + array (size=2) + 0 => int 0 + 1 => int 0 + 4 => + array (size=2) + 0 => int 0 + 1 => int 0 + 'weapon1' => int 1 + 'weapon2' => int 1 + 'sheld1' => int 0 + 'sv_' => + array (size=57) + 'a1' => int 0 + 'a2' => int 0 + 'a3' => int 0 + 'a4' => int 0 + 'a5' => int 0 + 'aall' => int 0 + 'hpall' => int 0 + 'm1' => int 0 + 'm10' => int 0 + 'm11' => int 0 + 'm14' => int 0 + 'm15' => int 0 + 'm18' => int 0 + 'm19' => int 0 + 'm2' => int 0 + 'm3' => int 0 + 'm4' => int 0 + 'm5' => int 0 + 'm6' => int 0 + 'm7' => int 0 + 'm8' => int 0 + 'm9' => int 0 + 'mall' => int 0 + 'mg1' => int 0 + 'mg2' => int 0 + 'mg3' => int 0 + 'mg4' => int 0 + 'mg7' => int 0 + 'mpall' => int 0 + 'pa1' => int 0 + 'pa2' => int 0 + 'pa3' => int 0 + 'pa4' => int 0 + 'pm1' => int 0 + 'pm2' => int 0 + 'pm3' => int 0 + 'pm4' => int 0 + 'pm7' => int 0 + 's1' => int 0 + 's2' => int 0 + 's3' => int 0 + 's4' => int 0 + 's5' => int 0 + 's6' => int 0 + 's7' => int 0 + 'za' => int 0 + 'za1' => int 0 + 'za2' => int 0 + 'za3' => int 0 + 'za4' => int 0 + 'zm' => int 0 + 'zm1' => int 0 + 'zm2' => int 0 + 'zm3' => int 0 + 'zm4' => int 0 + 'zona' => int 0 + 'zonb' => int 0 + 'sv_i' => + array (size=57) + 'a1' => int 0 + 'a2' => int 0 + 'a3' => int 0 + 'a4' => int 0 + 'a5' => int 0 + 'aall' => int 0 + 'hpall' => int 0 + 'm1' => int 0 + 'm10' => int 0 + 'm11' => int 0 + 'm14' => int 0 + 'm15' => int 0 + 'm18' => int 0 + 'm19' => int 0 + 'm2' => int 0 + 'm3' => int 0 + 'm4' => int 0 + 'm5' => int 0 + 'm6' => int 0 + 'm7' => int 0 + 'm8' => int 0 + 'm9' => int 0 + 'mall' => int 0 + 'mg1' => int 0 + 'mg2' => int 0 + 'mg3' => int 0 + 'mg4' => int 0 + 'mg7' => int 0 + 'mpall' => int 0 + 'pa1' => int 0 + 'pa2' => int 0 + 'pa3' => int 0 + 'pa4' => int 0 + 'pm1' => int 0 + 'pm2' => int 0 + 'pm3' => int 0 + 'pm4' => int 0 + 'pm7' => int 0 + 's1' => int 0 + 's2' => int 0 + 's3' => int 0 + 's4' => int 0 + 's5' => int 0 + 's6' => int 0 + 's7' => int 0 + 'za' => int 0 + 'za1' => int 0 + 'za2' => int 0 + 'za3' => int 0 + 'za4' => int 0 + 'zm' => int 0 + 'zm1' => int 0 + 'zm2' => int 0 + 'zm3' => int 0 + 'zm4' => int 0 + 'zona' => int 0 + 'zonb' => int 0 + 'dom' => + array (size=0) + empty + 'prsu' => + array (size=0) + empty + 'x' => int 3 + 'y' => int 4 + 's' => int 1 + 'maxves' => int 100 + 'speed_dungeon' => int 500 + 'speedhp' => int 500 + 'this_animal' => int 0 + 'lvl' => int 8 + 'hpAll' => int 2130 + 'mpAll' => int 0 + +*/ diff --git a/_incl_data/class/Battle/Finish.php b/_incl_data/class/Battle/Finish.php index 6098dd1e..0a55c7f4 100644 --- a/_incl_data/class/Battle/Finish.php +++ b/_incl_data/class/Battle/Finish.php @@ -31,30 +31,30 @@ class Finish $this->battle = $battle; } - public function finishBattle(?array $t, ?array $v, ?int $nl): void + public function finishBattle(?array $t = null, ?array $v = null, ?int $nl = null): void { global $u; $injuryName = [1 => 'легкую', 2 => 'среднюю', 3 => 'тяжелую', 4 => 'неизлечимую',]; $dnr = 0; //??? $chat = new Chat(); - $test = Db::getRow('select id, team_win, testfinish from battle where id = ? and team_win != -1', [$this->battle->info['id']]); + $test = Db::getRow('select id, team_win, testfinish from battle where id = ? and team_win != -1', [$this->battle->i->id]); if ($test['testfinish'] == -1) { sleep(2); } else { - Db::sql('update battle set testfinish = -1 where id = ?', [$this->battle->info['id']]); - if ($nl != 10 && $this->battle->info['team_win'] == -1) { - $this->battle->info['team_win'] = 0; + Db::sql('update battle set testfinish = -1 where id = ?', [$this->battle->i->id]); + if ($nl != 10 && $this->battle->i->getTeamwin() == -1) { + $this->battle->i->setTeamWin(); if (is_array($v) && is_array($t)) { foreach ($v as $vs) { if ($vs < 1 || $t[$vs] <= 0) { continue; } - $this->battle->info['team_win'] = $vs; + $this->battle->i->setTeamWin($vs); } } } - + //данные о игроках в бою $t = Db::getRows( @@ -71,7 +71,7 @@ class Finish if(login2 = '',login,login2) as login2 from users left join stats on users.id = stats.id - where battle = ?", [$this->battle->info['id']] + where battle = ?", [$this->battle->i->id] ); foreach ($t as $userInBattle) { @@ -86,13 +86,13 @@ class Finish $this->battle->stats[key($this->battle->users)] = $u->getStats(uid: $userInBattle['id'], minimal: true); } - if ($this->battle->info['time_over'] == 0) { + if ($this->battle->i->timeover == 0) { - $tststrt = Db::getRow('select * from battle where id = ? and time_over = 0', [$this->battle->info['id']]); + $tststrt = Db::getRow('select * from battle where id = ? and time_over = 0', [$this->battle->i->id]); if (isset($tststrt['id'])) { - if ($this->battle->info['inTurnir'] == 0 || $this->battle->info['type'] == 500) { - Db::sql('update battle set time_over = unix_timestamp(), team_win = ? where id = ?', [$this->battle->info['team_win'], $this->battle->info['id']]); + if ($this->battle->i->inturnir == 0 || $this->battle->i->type == 500) { + Db::sql('update battle set time_over = unix_timestamp(), team_win = ? where id = ?', [$this->battle->i->getTeamwin(), $this->battle->i->id]); } //Заносим данные о завершении боя $queryValues = ''; @@ -104,7 +104,7 @@ class Finish [ $user['login'], $user['city'], - $this->battle->info['id'], + $this->battle->i->id, $user['id'], $user['team'], $user['level'], @@ -119,27 +119,28 @@ class Finish ); $queryValues .= "('$inner',unix_timestamp()),"; - if ($user['team'] == $this->battle->info['team_win'] && $this->battle->info['team_win'] > 0) { + if ($user['team'] == $this->battle->i->getTeamwin() && $this->battle->i->getTeamwin() > 0) { $vtvl .= '' . $user['login'] . ', '; } } - $this->battle->info['players_c'] = Db::getValue("select count(id) from users where login not like '%(зверь%' and battle = ?", [$this->battle->info['id']]); - Db::sql('update battle set players_c = ? where id = ?', [$this->battle->info['players_c'], $this->battle->info['id']]); + $this->battle->i->setPlayerC(); + + Db::sql('update battle set players_c = ? where id = ?', [$this->battle->i->getPlayersC(), $this->battle->i->id]); if (!empty($vtvl)) { $vtvl = rtrim($vtvl, ', '); $vtvl = str_replace('"', '\\\\\"', $vtvl); $logtext = "Бой закончен, победа за $vtvl."; } else { - $this->battle->info['players_cc'] = $this->battle->info['players_cc2'] = 0; + $this->battle->i->setDraw(); $logtext = 'Бой закончен, ничья.'; } $this->battle->hodID++; Log::add( [ - 'battle' => $this->battle->info['id'], + 'battle' => $this->battle->i->id, 'id_hod' => $this->battle->hodID, 'text' => $logtext, 'vars' => 'time1=' . time(), @@ -149,9 +150,9 @@ class Finish unset($logtext); $this->saveLogs(); - if ($this->battle->info['type'] == 99) { + if ($this->battle->i->type == 99) { $logarray = [ - 'battle' => $this->battle->info['id'], + 'battle' => $this->battle->i->id, 'id_hod' => $this->battle->hodID, 'text' => 'И победители стали калечить проигравших...', 'vars' => 'time1=' . time(), @@ -161,7 +162,7 @@ class Finish $vtvl = ''; foreach ($this->battle->users as $userToInjure) { - if ($userToInjure['team'] == $this->battle->info['team_win']) { + if ($userToInjure['team'] == $this->battle->i->getTeamwin()) { continue; } $injuryCaster = Db::getRow('select id, v1 from eff_users where id_eff = 4 and uid = ? order by v1 desc limit 1'); @@ -169,13 +170,13 @@ class Finish continue; } $a = $userToInjure['sex'] == 1 ? 'а' : ''; - $injuryType = $this->battle->info['smert'] == 1 ? 4 : mt_rand(1, 3); + $injuryType = $this->battle->i->smert == 1 ? 4 : mt_rand(1, 3); if (!empty($injuryCaster['id'])) { $injuryType = mt_rand($injuryCaster['v1'] + 1, 3); } $vtvl = "{$userToInjure['login']} получил$a повреждение:" . " $injuryName[$injuryType].
$vtvl"; - $this->battle->addTravm($userToInjure['id'], $injuryType, rand(3, 5)); + Effects::addInjury($userToInjure['id'], $injuryType, rand(3, 5)); } $logarray['text'] = $vtvl; @@ -188,12 +189,12 @@ class Finish } Db::sql( 'insert into battle_end (battle_id, city, time, team_win) values (?,?,?,?)', - [$this->battle->info['id'], $this->battle->info['city'], $this->battle->info['time_start'], $this->battle->info['team_win']] + [$this->battle->i->id, $this->battle->i->city, $this->battle->i->timeStart, $this->battle->i->getTeamwin()] ); } $logarray = [ - 'battle' => $this->battle->info['id'], + 'battle' => $this->battle->i->id, 'id_hod' => $this->battle->hodID, 'vars' => 'time1=' . time(), 'type' => '1', @@ -201,7 +202,7 @@ class Finish $vtvl = ''; foreach ($this->battle->users as $userToInjure) { - if ($userToInjure['team'] == $this->battle->info['team_win'] || $this->battle->info['team_win'] == 0) { + if ($userToInjure['team'] == $this->battle->i->getTeamwin() || $this->battle->i->getTeamwin() == 0) { continue; } $injuryCaster = Db::getRow("select id, v1, data, user_use from eff_users where v1 = 'priem' and v2 = 292 and uid = ? limit 1"); @@ -217,11 +218,11 @@ class Finish $vtvl = "{$userToInjure['login']} получил$a повреждение" . " (Искалечить, автор: $injuryCasterLogin):" . " $injuryName[$injuryType].
$vtvl"; - $this->battle->addTravm($userToInjure['id'], $injuryType, rand(3, 5)); + Effects::addInjury($userToInjure['id'], $injuryType, rand(3, 5)); } if (!empty($vtvl)) { - if ($this->battle->info['type'] != 99) { + if ($this->battle->i->type != 99) { $logarray['text'] = 'И победители стали калечить проигравших...'; Log::add($logarray); } @@ -231,9 +232,9 @@ class Finish //Турнир БС - if ($this->battle->info['inTurnir'] > 0 && $this->battle->info['dungeon'] != 15 && $u->info['room'] != 413) { + if ($this->battle->i->inturnir > 0 && $this->battle->i->dungeon != 15 && $u->info['room'] != 413) { $bs = mysql_fetch_array( - mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->battle->info['inTurnir'] . '" LIMIT 1') + mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $this->battle->i->inturnir . '" LIMIT 1') ); $i = 0; $j = 0; @@ -320,7 +321,7 @@ class Finish } //Награда за события - if ($this->battle->info['type'] == 500 && isset($tststrt['id'])) { + if ($this->battle->i->type == 500 && isset($tststrt['id'])) { //Предметы которые выпадают в центр $i = 0; @@ -335,7 +336,7 @@ class Finish ) ); if (isset($mon['id'])) { - if ($this->battle->info['team_win'] == 0) { + if ($this->battle->i->getTeamwin() == 0) { //Ничья mysql_query( 'UPDATE `stats` SET `hpNow` = "' . $this->battle->stats[$i]['hpAll'] . '",`mpNow` = "' . $this->battle->stats[$i]['mpAll'] . '" WHERE `id` = "' . $this->battle->users[$i]['id'] . '" LIMIT 1' @@ -348,7 +349,7 @@ class Finish ) ); $chat->sendMsg($cmsg); - } elseif ($this->battle->info['team_win'] != $this->battle->users[$i]['team']) { + } elseif ($this->battle->i->getTeamwin() != $this->battle->users[$i]['team']) { //Выиграли $j = 0; $usrwin = ''; @@ -421,7 +422,7 @@ class Finish if (isset($tststrt['id'])) { while ($i < count($this->battle->users)) { //Тут выкидываем юзеров из Призавого хаота - if ($this->battle->info['type'] == 33) { + if ($this->battle->i->type == 33) { $plde = mysql_fetch_array( mysql_query('SELECT * FROM `users` WHERE `id` = "' . $this->battle->users[$i]['id'] . '" LIMIT 1') ); @@ -438,7 +439,7 @@ class Finish 'UPDATE `users_achiv` SET `pg`= `pg`+1 WHERE `id` = "' . $pld['id'] . '" LIMIT 1' ); - if ($this->battle->users[$i]['team'] == $this->battle->info['team_win'] && rand(1, 100) <= 5) { + if ($this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && rand(1, 100) <= 5) { ItemsModel::addItem(10020, $pld['id'], ''); $pld['battle_text'] .= ' За Героическое Сражение вы получаете Жетон Успеха. '; } @@ -494,9 +495,9 @@ class Finish } if ($this->battle->users[$i]['clone'] > 0 && $this->battle->users[$i]['bot'] > 0 && isset($this->battle->users[$this->battle->uids[$this->battle->users[$i]['clone']]]['id']) && $this->battle->users[$this->battle->uids[$this->battle->users[$i]['clone']]]['team'] != $this->battle->users[$i]['team']) { //Добавляем что клон побежден - if ($this->battle->users[$this->battle->uids[$this->battle->users[$i]['clone']]]['team'] == $this->battle->info['team_win']) { + if ($this->battle->users[$this->battle->uids[$this->battle->users[$i]['clone']]]['team'] == $this->battle->i->getTeamwin()) { $u->addAction(time(), 'win_bot_clone', '', $this->battle->users[$i]['clone']); - } elseif ($this->battle->info['team_win'] == 0) { + } elseif ($this->battle->i->getTeamwin() == 0) { $u->addAction(time(), 'nich_bot_clone', '', $this->battle->users[$i]['clone']); } else { $u->addAction(time(), 'lose_bot_clone', '', $this->battle->users[$i]['clone']); @@ -506,7 +507,7 @@ class Finish $j = 0; while ($j < count($this->battle->users)) { if ($this->battle->users[$j]['bot'] == 0 && $this->battle->users[$j]['team'] != $this->battle->users[$i]['team']) { - if ($this->battle->users[$j]['team'] == $this->battle->info['team_win']) { // if($this->battle->users[$j]['team']==$this->battle->info['team_win']){ + if ($this->battle->users[$j]['team'] == $this->battle->i->getTeamwin()) { // if($this->battle->users[$j]['team']==$this->battle->i->getTeamwin()){ $u->addAction( time(), 'win_bot_' . $this->battle->users[$i]['bot_id'], '', $this->battle->users[$j]['id'] @@ -519,7 +520,7 @@ class Finish LIMIT 1' ); // - } elseif ($this->battle->info['team_win'] == 0) { + } elseif ($this->battle->i->getTeamwin() == 0) { $u->addAction( time(), 'nich_bot_' . $this->battle->users[$i]['bot_id'], '', $this->battle->users[$j]['id'] @@ -539,11 +540,11 @@ class Finish } //Из бота падают предметы - if ($nl != 10 && $this->battle->info['dungeon'] > 0) { - if ($this->battle->info['team_win'] == $u->info['team'] && $this->battle->info['dungeon'] == 102) { + if ($nl != 10 && $this->battle->i->dungeon > 0) { + if ($this->battle->i->getTeamwin() == $u->info['team'] && $this->battle->i->dungeon == 102) { $j1 = mysql_fetch_array( mysql_query( - 'SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->battle->info['dn_id'] . '" AND `x` = "' . $this->battle->info['x'] . '" AND `y` = "' . $this->battle->info['y'] . '" LIMIT 1' + 'SELECT * FROM `laba_obj` WHERE `type` = 2 AND `lib` = "' . $this->battle->i->dnId . '" AND `x` = "' . $this->battle->i->x . '" AND `y` = "' . $this->battle->i->y . '" LIMIT 1' ) ); if (isset($j1['id'])) { @@ -555,14 +556,14 @@ class Finish )' ); } - } elseif ($this->battle->info['team_win'] == $u->info['team']) { + } elseif ($this->battle->i->getTeamwin() == $u->info['team']) { //выйграли люди, выкидываем предметы из мобов $j1 = mysql_query( - 'SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->battle->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->battle->info['x'] . '" AND `delete` = "0" AND `y`= "' . $this->battle->info['y'] . '" LIMIT 100' + 'SELECT * FROM `dungeon_bots` WHERE `dn` = "' . $this->battle->i->dnId . '" AND `for_dn` = "0" AND `x` = "' . $this->battle->i->x . '" AND `delete` = "0" AND `y`= "' . $this->battle->i->y . '" LIMIT 100' ); while ($tbot = mysql_fetch_array($j1)) { $cmsg = new ChatMessage(); - $cmsg->setDn($this->battle->info['dn_id']); + $cmsg->setDn($this->battle->i->dnId); $cmsg->setRoom($this->battle->users[0]['room']); $cmsg->setType(6); $cmsg->setTypeTime(1); @@ -606,12 +607,12 @@ class Finish mysql_query( 'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->battle->info['dn_id'] . '", + "' . $this->battle->i->dnId . '", "' . $tou . '", "' . $itmz[0] . '", "' . time() . '", - "' . $this->battle->info['x'] . '", - "' . $this->battle->info['y'] . '")' + "' . $this->battle->i->x . '", + "' . $this->battle->i->y . '")' ); if (!isset($questDrop['id'])) { $testdrop = 1; //ТУТ drop-drop //quest @@ -629,7 +630,7 @@ class Finish date('m') == 9 && date('d') < 15 && !Helper::getChanse(99) && - ($this->battle->info['dungeon'] == 12 || $this->battle->info['dungeon'] == 101) + ($this->battle->i->dungeon == 12 || $this->battle->i->dungeon == 101) ) { $tou = 0; //какому юзеру предназначено /* выделяем случайного юзера из команды */ @@ -645,12 +646,12 @@ class Finish mysql_query( 'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->battle->info['dn_id'] . '", + "' . $this->battle->i->dnId . '", "' . $tou . '", "' . $itmz[0] . '", "' . time() . '", - "' . $this->battle->info['x'] . '", - "' . $this->battle->info['y'] . '")' + "' . $this->battle->i->x . '", + "' . $this->battle->i->y . '")' ); } // @@ -661,10 +662,10 @@ class Finish } if ( - $this->battle->info['dungeon'] == 12 || $this->battle->info['dungeon'] == 3 || - $this->battle->info['dungeon'] == 101 || $this->battle->info['dungeon'] == 16 || - $this->battle->info['dungeon'] == 9 || $this->battle->info['dungeon'] == 10 || - $this->battle->info['dungeon'] == 13 || $this->battle->info['dungeon'] == 106 + $this->battle->i->dungeon == 12 || $this->battle->i->dungeon == 3 || + $this->battle->i->dungeon == 101 || $this->battle->i->dungeon == 16 || + $this->battle->i->dungeon == 9 || $this->battle->i->dungeon == 10 || + $this->battle->i->dungeon == 13 || $this->battle->i->dungeon == 106 ) { $tou = 0; //какому юзеру предназначено // выделяем случайного юзера из команды @@ -676,25 +677,25 @@ class Finish mysql_query( 'INSERT INTO `dungeon_items` (`dn`,`user`,`item_id`,`time`,`x`,`y`) VALUES ( - "' . $this->battle->info['dn_id'] . '", + "' . $this->battle->i->dnId . '", "' . $tou . '", "' . $itmz . '", "' . time() . '", - "' . $this->battle->info['x'] . '", - "' . $this->battle->info['y'] . '")' + "' . $this->battle->i->x . '", + "' . $this->battle->i->y . '")' ); } } mysql_query( 'UPDATE `dungeon_bots` SET `delete` = "' . time( - ) . '" AND `inBattle` = "' . $this->battle->info['id'] . '" WHERE `dn` = "' . $this->battle->info['dn_id'] . '" AND `for_dn` = "0" AND `delete` = "0" ' + ) . '" AND `inBattle` = "' . $this->battle->i->id . '" WHERE `dn` = "' . $this->battle->i->dnId . '" AND `for_dn` = "0" AND `delete` = "0" ' ); } else { //выкидываем всех игроков в клетку RESTART $dnr = 1; - if ($this->battle->info['dungeon'] != 102) { + if ($this->battle->i->dungeon != 102) { mysql_query( - 'UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->battle->info['dn_id'] . '" AND `for_dn` = "0" AND `x` = "' . $this->battle->info['x'] . '" AND `y`= "' . $this->battle->info['y'] . '"' + 'UPDATE `dungeon_bots` SET `inBattle` = "0" WHERE `dn` = "' . $this->battle->i->dnId . '" AND `for_dn` = "0" AND `x` = "' . $this->battle->i->x . '" AND `y`= "' . $this->battle->i->y . '"' ); } } @@ -711,7 +712,7 @@ class Finish //завершаем поединок $i = $this->battle->uids[$u->info['id']]; - if ($this->battle->info['team_win'] >= 0) { + if ($this->battle->i->getTeamwin() >= 0) { $cmsg = new ChatMessage(); $cmsg->setRoom($this->battle->users[$i]['room']); $cmsg->setType(6); @@ -721,7 +722,7 @@ class Finish $this->expCoef += $this->battle->stats[$i]['pbe']; } - if ($this->battle->info['razdel'] == 5 && (Config::get('m') >= 6 && Config::get('m') <= 8 || Config::get('w') == 0 || Config::get('w') == 6)) { + if ($this->battle->i->razdel == 5 && (Config::get('m') >= 6 && Config::get('m') <= 8 || Config::get('w') == 0 || Config::get('w') == 6)) { $this->expCoef += 5; } @@ -736,17 +737,17 @@ class Finish $act01 = 0; $this->battle->users[$i]['battle_exp'] = round( - $this->battle->users[$i]['battle_exp'] + ($this->battle->users[$i]['battle_exp'] / 100 * (1 + $this->battle->info['addExp'] + $this->battle->stats[$i]['exp'])) + $this->battle->users[$i]['battle_exp'] + ($this->battle->users[$i]['battle_exp'] / 100 * (1 + $this->battle->i->getAddexp() + $this->battle->stats[$i]['exp'])) ); - if ($this->battle->info['type'] == 564) { + if ($this->battle->i->type == 564) { //Бой с копией $this->battle->users[$i]['battle_exp'] = 0; } - if ($this->battle->info['dungeon'] == 104) { + if ($this->battle->i->dungeon == 104) { $this->battle->users[$i]['battle_exp'] = ($u->info['level'] * 2) * (count($this->battle->uids) - 1); - } elseif ($this->battle->info['dungeon'] > 0 && $this->battle->users[$i]['dnow'] != 0 && $this->battle->info['dungeon'] != 1 && $this->battle->users[$i]['team'] == $this->battle->info['team_win']) { + } elseif ($this->battle->i->dungeon > 0 && $this->battle->users[$i]['dnow'] != 0 && $this->battle->i->dungeon != 1 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) { $dun_limitForLevel = [ 4 => 750, 5 => 1500, @@ -779,32 +780,32 @@ class Finish unset($rep); } - if (!isset($dun_exp[$this->battle->info['dungeon']])) { - $dun_exp[$this->battle->info['dungeon']] = 0; + if (!isset($dun_exp[$this->battle->i->dungeon])) { + $dun_exp[$this->battle->i->dungeon] = 0; } if (!isset($dun_limitForLevel[(int)$this->battle->users[$i]['level']])) { // Если лимит не задан, опыт не даем. $this->battle->users[$i]['battle_exp'] = 0; } elseif ( - isset($dun_exp[$this->battle->info['dungeon']]) && - $dun_exp[$this->battle->info['dungeon']] >= $dun_limitForLevel[(int)$this->battle->users[$i]['level']] + isset($dun_exp[$this->battle->i->dungeon]) && + $dun_exp[$this->battle->i->dungeon] >= $dun_limitForLevel[(int)$this->battle->users[$i]['level']] ) { // Если лимит уже достигнут, опыт не даем. $this->battle->users[$i]['battle_exp'] = 0; } elseif ( - isset($dun_exp[$this->battle->info['dungeon']]) && - $dun_limitForLevel[(int)$this->battle->users[$i]['level']] > $dun_exp[$this->battle->info['dungeon']] + isset($dun_exp[$this->battle->i->dungeon]) && + $dun_limitForLevel[(int)$this->battle->users[$i]['level']] > $dun_exp[$this->battle->i->dungeon] ) { // Если текущая репутация не достигла лимита. - if (($dun_exp[$this->battle->info['dungeon']] + $this->battle->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->battle->users[$i]['level']]) { + if (($dun_exp[$this->battle->i->dungeon] + $this->battle->users[$i]['battle_exp']) > $dun_limitForLevel[(int)$this->battle->users[$i]['level']]) { // Если опыта набрано достаточно, для достижения лимита. $this->battle->users[$i]['battle_exp'] = abs( $this->battle->users[$i]['battle_exp'] - abs( - $dun_limitForLevel[(int)$this->battle->users[$i]['level']] - ($this->battle->users[$i]['battle_exp'] + $dun_exp[$this->battle->info['dungeon']]) + $dun_limitForLevel[(int)$this->battle->users[$i]['level']] - ($this->battle->users[$i]['battle_exp'] + $dun_exp[$this->battle->i->dungeon]) ) ); - $dun_exp[$this->battle->info['dungeon']] += $this->battle->users[$i]['battle_exp']; - } elseif ($dun_limitForLevel[(int)$this->battle->users[$i]['level']] > ($dun_exp[$this->battle->info['dungeon']] + $this->battle->users[$i]['battle_exp'])) { + $dun_exp[$this->battle->i->dungeon] += $this->battle->users[$i]['battle_exp']; + } elseif ($dun_limitForLevel[(int)$this->battle->users[$i]['level']] > ($dun_exp[$this->battle->i->dungeon] + $this->battle->users[$i]['battle_exp'])) { // Если опыта недостаточно, для достижения лимита. - $dun_exp[$this->battle->info['dungeon']] += $this->battle->users[$i]['battle_exp']; + $dun_exp[$this->battle->i->dungeon] += $this->battle->users[$i]['battle_exp']; } else { $this->battle->users[$i]['battle_exp'] = 0; } @@ -813,7 +814,7 @@ class Finish } - if ($this->battle->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->battle->info['dungeon']]) && $dun_exp[$this->battle->info['dungeon']] > 0) { + if ($this->battle->users[$i]['battle_exp'] > 0 && isset($dun_exp[$this->battle->i->dungeon]) && $dun_exp[$this->battle->i->dungeon] > 0) { $dunexp = []; foreach ($dun_exp as $key => $val) { $dunexp[$key] = $key . '=' . $val; // текущий лимит опыта в подземке @@ -834,31 +835,31 @@ class Finish ); } - if ($this->battle->info['team_win'] == 0 && $this->battle->info['type'] != 564) { + if ($this->battle->i->getTeamwin() == 0 && $this->battle->i->type != 564) { if ($this->battle->users[$i]['level'] <= 1) { $this->battle->users[$i]['battle_exp'] = floor($this->battle->users[$i]['battle_exp'] * 0.50); } else { $this->battle->users[$i]['battle_exp'] = ceil($this->battle->users[$i]['battle_exp'] * 0.10); } $this->battle->users[$i]['nich'] += 1; - } elseif ($this->battle->users[$i]['team'] == $this->battle->info['team_win'] && $this->battle->info['type'] != 564) { - $gm[$i] = $this->battle->info['money']; - $gms[$i] = $this->battle->info['money3']; + } elseif ($this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && $this->battle->i->type != 564) { + $gm[$i] = $this->battle->i->money; + $gms[$i] = $this->battle->i->money3; $this->battle->users[$i]['win'] += 1; $act01 = 1; - } elseif ($this->battle->info['type'] != 564) { + } elseif ($this->battle->i->type != 564) { if ($this->battle->users[$i]['level'] <= 1) { $this->battle->users[$i]['battle_exp'] = ceil($this->battle->users[$i]['battle_exp'] * 0.33); } else { $this->battle->users[$i]['battle_exp'] = ceil($this->battle->users[$i]['battle_exp'] * 0.10); } - $bm[$i] = $this->battle->info['money']; - $bms[$i] = $this->battle->info['money3']; + $bm[$i] = $this->battle->i->money; + $bms[$i] = $this->battle->i->money3; $this->battle->users[$i]['lose'] += 1; $act01 = 2; } //Рассчитываем кол-во выигрышных сумм и кто сколько получил (для екр.) - if ($this->battle->info['money3'] > 0 && isset($gms[$i]) && $this->battle->info['type'] != 564) { + if ($this->battle->i->money3 > 0 && isset($gms[$i]) && $this->battle->i->type != 564) { $mn = [ 'l' => 0, //сколько проигравших игроков 'w' => 0, //сколько выигрывших игроков @@ -867,17 +868,17 @@ class Finish if ($act01 == 1) { $mn['l'] = mysql_fetch_array( mysql_query( - 'SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->battle->info['id'] . '" AND `team` != "' . $this->battle->users[$i]['team'] . '" LIMIT 1' + 'SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->battle->i->id . '" AND `team` != "' . $this->battle->users[$i]['team'] . '" LIMIT 1' ) ); $mn['l'] = $mn['l'][0]; $mn['w'] = mysql_fetch_array( mysql_query( - 'SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->battle->info['id'] . '" AND `team` = "' . $this->battle->users[$i]['team'] . '" LIMIT 1' + 'SELECT COUNT(`id`) FROM `battle_users` WHERE `battle` = "' . $this->battle->i->id . '" AND `team` = "' . $this->battle->users[$i]['team'] . '" LIMIT 1' ) ); $mn['w'] = $mn['w'][0]; - $mn['m'] = round(($mn['l'] * $this->battle->info['money3']) / 100 * 87, 2); + $mn['m'] = round(($mn['l'] * $this->battle->i->money3) / 100 * 87, 2); $gms[$i] = round(($mn['m'] / $mn['w']), 2); } } @@ -897,7 +898,7 @@ class Finish $lom = 0.05; } $nlom = [0 => rand(0, 18), 1 => rand(0, 18), 2 => rand(0, 18), 3 => rand(0, 18)]; - if ($this->battle->info['type'] == 564 || $this->battle->stats[$i]['silver']) { + if ($this->battle->i->type == 564 || $this->battle->stats[$i]['silver']) { $lom = 0; } @@ -911,10 +912,10 @@ class Finish } if ($this->battle->users[$i]['animal'] > 0) { $ulan = $u->testAction( - '`uid` = "' . $this->battle->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->battle->info['id'] . '" LIMIT 1', + '`uid` = "' . $this->battle->users[$i]['id'] . '" AND `vars` = "animal_use' . $this->battle->i->id . '" LIMIT 1', 1 ); - if (isset($ulan['id']) && $this->battle->users[$i]['team'] == $this->battle->info['team_win'] && $this->battle->users[$i]['level'] > $ulan['vals']) { + if (isset($ulan['id']) && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && $this->battle->users[$i]['level'] > $ulan['vals']) { $a004 = mysql_fetch_array( mysql_query( 'SELECT `max_exp`,`name` FROM `users_animal` WHERE `uid` = "' . $this->battle->users[$i]['id'] . '" AND `id` = "' . $this->battle->users[$i]['animal'] . '" AND `pet_in_cage` = "0" AND `delete` = "0" LIMIT 1' @@ -936,52 +937,49 @@ class Finish ); if ($upd) { $this->battle->users[$i]['battle_exp'] = round($this->battle->users[$i]['battle_exp'] / 100 * 67); - $this->battle->info['addExp'] -= 33.333; + $this->battle->i->modifyAddExp(-33.333); } } } $prsusers = mysql_fetch_array( mysql_query( - 'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->battle->info['id'] . '" LIMIT 1' + 'SELECT SUM(`price1`) FROM `battle_users` WHERE `battle` = "' . $this->battle->i->id . '" LIMIT 1' ) ); $this->btlstatus = Battle::getType($prsusers[0]); - if ($this->battle->info['smert'] == 1) { + if ($this->battle->i->smert == 1) { $this->btlstatus = [150, 150, 'Жесточайшее Сражение', 'Жесточайшее Сражение']; } // - if ($this->battle->stats[$i]['clanpos'] > 0 && ($this->battle->stats[$i]['clanpos'] == 1 || $this->battle->stats[$i]['clanpos'] == 2 || $this->battle->stats[$i]['clanpos'] == 3)) { - $this->battle->info['addExp'] += 0; - } unset($r1); //Статусная битва if ($this->btlstatus[0] > 0) { - if ($this->battle->info['type'] == 99) { - $this->battle->info['addExp'] += $this->btlstatus[1]; + if ($this->battle->i->type == 99) { + $this->battle->i->modifyAddExp($this->btlstatus[1]); } else { - $this->battle->info['addExp'] += $this->btlstatus[0]; + $this->battle->i->modifyAddExp($this->btlstatus[0]); } } if ($this->battle->users[$i]['align'] == 2 || $this->battle->users[$i]['haos'] > time()) { - $this->battle->stats[$i]['exp'] = -($this->battle->info['addExp'] + 50); + $this->battle->stats[$i]['exp'] = -($this->battle->i->getAddexp() + 50); } - if ($this->battle->info['addExp'] + $this->battle->stats[$i]['exp'] != 0) { - $prc = ' (' . (100 + $this->battle->info['addExp'] + $this->battle->stats[$i]['exp']) . '%)'; + if ($this->battle->i->getAddexp() + $this->battle->stats[$i]['exp'] != 0) { + $prc = ' (' . (100 + $this->battle->i->getAddexp() + $this->battle->stats[$i]['exp']) . '%)'; } - if ($this->battle->info['money'] > 0) { + if ($this->battle->i->money > 0) { if (isset($gm[$i])) { $prc .= ' Вы выйграли ' . $gm[$i] . ' кр. за этот бой.'; Delo::add( 4, 'System.battle', $this->battle->users[$i]['id'], - '"System.battle": Персонаж выйграл ' . $gm[$i] . ' кр. (В бою №' . $this->battle->info['id'] . ').', + '"System.battle": Персонаж выйграл ' . $gm[$i] . ' кр. (В бою №' . $this->battle->i->id . ').', ); $this->battle->users[$i]['money'] += $gm[$i]; } elseif (isset($bm[$i])) { @@ -990,12 +988,12 @@ class Finish 4, 'System.battle', $this->battle->users[$i]['id'], - '"System.battle": Персонаж проиграл ' . $gm[$i] . ' кр. (В бою №' . $this->battle->info['id'] . ').', + '"System.battle": Персонаж проиграл ' . $gm[$i] . ' кр. (В бою №' . $this->battle->i->id . ').', ); $this->battle->users[$i]['money'] -= $bm[$i]; } } - if (Config::get('money_haot') && $this->battle->users[$i]['exp'] <= 200000000 && $act01 == 1 && $this->battle->info['razdel'] == 5 && $this->battle->users[$i]['level'] >= 8) { + if (Config::get('money_haot') && $this->battle->users[$i]['exp'] <= 200000000 && $act01 == 1 && $this->battle->i->razdel == 5 && $this->battle->users[$i]['level'] >= 8) { //Сколько нужно опыта набить $trexp = [ 8 => 1200, @@ -1047,26 +1045,26 @@ class Finish if ($this->battle->users[$i]['battle_exp'] < $trexp) { $prc .= ', Награда 0 ЕКР за этот бой (Мало опыта набили).'; } elseif ($admn > 0) { - if ($this->battle->info['type'] != 33) { + if ($this->battle->i->type != 33) { $prc .= ', Награда ' . $admn . ' ЕКР за этот бой.'; } Delo::add( 4, 'System.battle', $this->battle->users[$i]['id'], - '"System.battle": Персонаж получил ' . $admn . ' ЕКР (В бою №' . $this->battle->info['id'] . ').', + '"System.battle": Персонаж получил ' . $admn . ' ЕКР (В бою №' . $this->battle->i->id . ').', ); $this->battle->users[$i]['money2'] += $admn; } } - if ($this->battle->info['money3'] > 0) { + if ($this->battle->i->money3 > 0) { if (isset($gms[$i])) { $prc .= ' Вы выйграли ' . $gms[$i] . ' $. за этот бой.'; Delo::add( 4, 'System.battle', $this->battle->users[$i]['id'], - '"System.battle": Персонаж выйграл ' . $gms[$i] . ' $. (В бою №' . $this->battle->info['id'] . ').', + '"System.battle": Персонаж выйграл ' . $gms[$i] . ' $. (В бою №' . $this->battle->i->id . ').', ); $this->battle->users[$i]['money3'] += $gms[$i]; mysql_query( @@ -1078,7 +1076,7 @@ class Finish 4, 'System.battle', $this->battle->users[$i]['id'], - '"System.battle": Персонаж проиграл ' . $gms[$i] . ' $. (В бою №' . $this->battle->info['id'] . ').', + '"System.battle": Персонаж проиграл ' . $gms[$i] . ' $. (В бою №' . $this->battle->i->id . ').', ); $this->battle->users[$i]['money3'] -= $bms[$i]; mysql_query( @@ -1126,30 +1124,30 @@ class Finish unset($lime); if ($this->btlstatus[0] > 0) { - if ($this->battle->info['type'] == 99) { + if ($this->battle->i->type == 99) { $prc .= ' (' . $this->btlstatus[3] . ')'; } else { $prc .= ' (' . $this->btlstatus[2] . ')'; } } - if ($this->battle->info['dungeon'] == 1 && $this->battle->users[$i]['team'] == $this->battle->info['team_win']) { + if ($this->battle->i->dungeon == 1 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) { //канализация лимит $rep = mysql_fetch_array( mysql_query( 'SELECT `dl1`,`id` FROM `rep` WHERE `id` = "' . $this->battle->users[$i]['id'] . '" LIMIT 1' ) ); - if ($rep['dl' . $this->battle->info['dungeon']] > 0) { + if ($rep['dl' . $this->battle->i->dungeon] > 0) { $this->battle->users[$i]['battle_exp'] += 3 * count($this->battle->users); - if ($rep['dl' . $this->battle->info['dungeon']] > $this->battle->users[$i]['battle_exp']) { - $rep['dl' . $this->battle->info['dungeon']] -= $this->battle->users[$i]['battle_exp']; + if ($rep['dl' . $this->battle->i->dungeon] > $this->battle->users[$i]['battle_exp']) { + $rep['dl' . $this->battle->i->dungeon] -= $this->battle->users[$i]['battle_exp']; } else { - $this->battle->users[$i]['battle_exp'] = $rep['dl' . $this->battle->info['dungeon']]; - $rep['dl' . $this->battle->info['dungeon']] = 0; + $this->battle->users[$i]['battle_exp'] = $rep['dl' . $this->battle->i->dungeon]; + $rep['dl' . $this->battle->i->dungeon] = 0; } mysql_query( - 'UPDATE `rep` SET `dl' . $this->battle->info['dungeon'] . '` = "' . $rep['dl' . $this->battle->info['dungeon']] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1' + 'UPDATE `rep` SET `dl' . $this->battle->i->dungeon . '` = "' . $rep['dl' . $this->battle->i->dungeon] . '" WHERE `id` = "' . $rep['id'] . '" LIMIT 1' ); } else { $this->battle->users[$i]['battle_exp'] = 0; @@ -1163,9 +1161,9 @@ class Finish if ( $this->battle->users[$i]['battle_exp'] < 1 && $this->battle->users[$i]['twink'] == 0 && - $this->battle->info['money'] == 0 && - $this->battle->info['money3'] == 0 && - $this->battle->info['kingfight'] == 0 && + $this->battle->i->money == 0 && + $this->battle->i->money3 == 0 && + $this->battle->i->kingfight == 0 && (!isset($admnb) || $admnb == 0) ) { $prc = ''; @@ -1194,14 +1192,14 @@ class Finish } //------------------------------------- - if ($this->battle->info['type'] != 33) { + if ($this->battle->i->type != 33) { $this->battle->users[$i]['battle_text'] = 'Бой закончен. Всего вами нанесено урона: ' . floor( $this->battle->users[$i]['battle_yron'] ) . ' HP. Получено опыта: ' . (0 + $this->battle->users[$i]['battle_exp']) . '' . $prc . '.' . $sinf; //stats } //Снижение времени Право на подвиг Титул за победу в хаоте - if ($this->battle->info['dungeon'] == 0 && $this->battle->info['razdel'] == 5 && $this->battle->users[$i]['team'] == $this->battle->info['team_win']) { + if ($this->battle->i->dungeon == 0 && $this->battle->i->razdel == 5 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) { //ТУТ2 StatsModel::addRepexpById($this->battle->users[$i]['id'], 2); //Репутация за поб в хаоте +2 $check = mysql_fetch_array( @@ -1234,7 +1232,7 @@ class Finish } //Награда за клан вар - if ($this->battle->info['dungeon'] == 0 && $this->battle->info['type'] == 250 && $this->battle->users[$i]['team'] == $this->battle->info['team_win']) { + if ($this->battle->i->dungeon == 0 && $this->battle->i->type == 250 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) { mysql_query( 'UPDATE `users_achiv` SET `kw`= `kw`+1 WHERE `id` = "' . $this->battle->users[$i]['id'] . '" LIMIT 1' ); @@ -1244,16 +1242,16 @@ class Finish } //Награда за клан вар if ( - $this->battle->info['dungeon'] == 0 && - $this->battle->info['type'] == 99 && - $this->battle->users[$i]['team'] == $this->battle->info['team_win'] && + $this->battle->i->dungeon == 0 && + $this->battle->i->type == 99 && + $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && (date('w') == 0 || date('w') == 6 || date('w') == 5) ) { StatsModel::addRepexpById($this->battle->users[$i]['id'], 10); //Кровавые войны(победа) 10 } //Новая выдача на трупожора - if ($this->battle->info['dungeon'] == 0 && $this->battle->info['type'] == 500 && $this->battle->users[$i]['team'] == $this->battle->info['team_win'] && $this->battle->users[$i]['no_ip'] != 'trupojor' && $this->battle->users[$i]['bot'] == 0) { + if ($this->battle->i->dungeon == 0 && $this->battle->i->type == 500 && $this->battle->users[$i]['team'] == $this->battle->i->getTeamwin() && $this->battle->users[$i]['no_ip'] != 'trupojor' && $this->battle->users[$i]['bot'] == 0) { if ($this->battle->users[$i]['level'] > 9) { $mid = 903093; } else { @@ -1322,7 +1320,7 @@ class Finish } if ( - ($this->battle->info['razdel'] == 5 || $this->battle->info['razdel'] == 4) && + ($this->battle->i->razdel == 5 || $this->battle->i->razdel == 4) && (date('d.m') == '31.10' || (date('m') == 11 && date('d') < 7)) ) { //Хэллоуин 4504 @@ -1333,8 +1331,8 @@ class Finish //Добавляем воинственность if ( - $this->battle->info['dungeon'] == 0 && - $this->battle->info['razdel'] == 5 && + $this->battle->i->dungeon == 0 && + $this->battle->i->razdel == 5 && $this->battle->users[$i]['exp'] >= 1500 && $this->battle->users[$i]['battle_exp'] > 100 * $this->battle->users[$i]['level'] ) { @@ -1356,7 +1354,7 @@ class Finish $rzbvo = 250; } - if ($this->battle->info['type'] != 33) { + if ($this->battle->i->type != 33) { $this->battle->users[$i]['battle_text'] .= ' Вы получили ' . $rzbvo . ' воинственности за этот бой.'; } mysql_query( @@ -1371,13 +1369,13 @@ class Finish if ($this->battle->stats[$i]['hpNow'] >= 1) { $this->battle->stats[$i]['test_heal'] = mysql_fetch_array( mysql_query( - 'SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->battle->users[$i]['id'] . '" AND `battle` = "' . $this->battle->info['id'] . '" LIMIT 1' + 'SELECT SUM(`yrn`) FROM `battle_stat` WHERE `uid2` = "' . $this->battle->users[$i]['id'] . '" AND `battle` = "' . $this->battle->i->id . '" LIMIT 1' ) ); $this->battle->stats[$i]['test_heal'] = $this->battle->stats[$i]['test_heal'][0]; $this->battle->stats[$i]['test_start'] = mysql_fetch_array( mysql_query( - 'SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->battle->users[$i]['id'] . '" AND `battle` = "' . $this->battle->info['id'] . '" LIMIT 1' + 'SELECT `hpStart` FROM `battle_users` WHERE `uid` = "' . $this->battle->users[$i]['id'] . '" AND `battle` = "' . $this->battle->i->id . '" LIMIT 1' ) ); $this->battle->stats[$i]['test_start'] = $this->battle->stats[$i]['test_start']['hpStart']; @@ -1392,7 +1390,7 @@ class Finish unset($this->battle->stats[$i]['test_heal']); - $this->battle->users[$i]['last_b'] = $this->battle->info['id']; //stats + $this->battle->users[$i]['last_b'] = $this->battle->i->id; //stats $this->battle->users[$i]['last_a'] = $act01; $this->battle->users[$i]['battle'] = -1; //users $this->battle->users[$i]['battle_yron'] = 0; //stats @@ -1403,9 +1401,9 @@ class Finish if ($this->battle->users[$i]['clan'] > 0) { $cpr = 1; - if ($this->battle->info['typeBattle'] == 9) { + if ($this->battle->i->typebattle == 9) { $cpr = 25; - } elseif ($this->battle->info['typeBattle'] == 50) { + } elseif ($this->battle->i->typebattle == 50) { $cpr = 65; } if ($this->battle->stats[$i]['silver'] >= 5) { @@ -1420,7 +1418,7 @@ class Finish $this->battle->users[$i]['battle_exp'] = 0; //stats - if ($this->battle->users[$i]['team'] == $this->battle->info['team_win']) { + if ($this->battle->users[$i]['team'] == $this->battle->i->getTeamwin()) { $r = new Reputation($this->battle->users[$i]['id']); $r->addRep('n_capitalcity', $this->battle->users[$i]['bn_capitalcity']); $r->addRep('n_demonscity', $this->battle->users[$i]['bn_demonscity']); @@ -1437,7 +1435,7 @@ class Finish $this->dieInDungeon($dnr, $i, $u, $cmsg, $chat); - Db::sql('update users set login2 = default where battle = ?', [$this->battle->info['id']]); + Db::sql('update users set login2 = default where battle = ?', [$this->battle->i->id]); Db::sql( 'update users set login2 = default, money = ?, money2 = ?, win = ?, lose = ?, nich = ?, battle = -1 where id = ?', [ @@ -1465,21 +1463,21 @@ class Finish $this->battle->users[$i]['exp'], $this->battle->users[$i]['battle_exp'], $this->battle->users[$i]['battle_text'], - $this->battle->info['id'], + $this->battle->i->id, $this->battle->users[$i]['id'], ] ); - - if ($this->battle->info['turnir'] == 0) { + + if ($this->battle->i->turnir == 0) { //пишем в чат $cmsg->setTo($this->battle->users[$i]['login']); $cmsg->setText($this->battle->users[$i]['battle_text']); $chat->sendMsg($cmsg); } else { - Db::sql('update turnirs set winner = ? where id = ?', [$this->battle->info['team_win'], $this->battle->info['turnir']]); + Db::sql('update turnirs set winner = ? where id = ?', [$this->battle->i->getTeamwin(), $this->battle->i->turnir]); } //завершаем сам бой - Db::sql('update battle set time_over = unix_timestamp(), team_win = ? where id = ?', [$this->battle->info['team_win'], $this->battle->info['id']]); + Db::sql('update battle set time_over = unix_timestamp(), team_win = ? where id = ?', [$this->battle->i->getTeamwin(), $this->battle->i->id]); // Жрать хочет if ($this->battle->users[$i]['animal'] > 0) { @@ -1512,7 +1510,7 @@ class Finish } } } - mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->battle->info['id'] . '" LIMIT 1'); + mysql_query('UPDATE `battle` SET `testfinish` = "0" WHERE `id` = "' . $this->battle->i->id . '" LIMIT 1'); } @@ -1593,11 +1591,11 @@ class Finish { Db::sql( 'insert into battle_logs_save select id, time, battle, id_hod, text, vars, zona1, zonb1, zona2, zonb2, type from battle_logs where battle = ? and id_hod <= ?', - [$this->battle->info['id'], $this->battle->hodID] + [$this->battle->i->id, $this->battle->hodID] ); - Db::sql('delete from battle_logs where battle = ?', [$this->battle->info['id']]); - Db::sql('delete from battle_stat where battle < ?', [$this->battle->info['id'] - 100]); - Db::sql('delete from battle_actions where btl = ?', [$this->battle->info['id']]); + Db::sql('delete from battle_logs where battle = ?', [$this->battle->i->id]); + Db::sql('delete from battle_stat where battle < ?', [$this->battle->i->id - 100]); + Db::sql('delete from battle_actions where btl = ?', [$this->battle->i->id]); } private function dieInDungeon(int $dnr, int $i, User $u, ChatMessage $cmsg, Chat $chat): void @@ -1622,7 +1620,7 @@ class Finish $la = $this->battle->users[$i]['sex'] == 1 ? 'ла' : ''; - if ($dies < 2 || $this->battle->info['dungeon'] == 15) { + if ($dies < 2 || $this->battle->i->dungeon == 15) { $shaibaItemId = Db::getValue('select id from items_users where uid = ? and item_id = 4910 limit 1', [$this->battle->users[$i]['id']]); @@ -1633,7 +1631,7 @@ class Finish "insert into dungeon_obj (name, dn, x, y, img, action, w, h, os1, os2, os3, date) values ('Шайба',?,?,?,'shaiba.png','fileact:15/shaiba',120,220,5,8,12,?)", [ - $this->battle->info['dn_id'], + $this->battle->i->dnId, $this->battle->users[$i]['x'], $this->battle->users[$i]['y'], "{use:'takeit',rt1:69,rl1:-47,rt2:74,rl2:126,rt3:76,rl3:140,rt4:80,rl4:150}", @@ -1651,7 +1649,7 @@ class Finish $reviveRoomName = $this->battle->users[$i]['room'] == 370 ? 'начале лабиринта' : "комнате «{$roomName}»"; $rtxt = "{$this->battle->users[$i]['login']} трагически погиб$la и находится в $reviveRoomName"; - } elseif ($this->battle->info['dungeon'] == 102) { + } elseif ($this->battle->i->dungeon == 102) { $nld = ''; $lab = Db::getRow('select id, users from laba_now where id = ?', [$this->battle->users[$i]['id']]); @@ -1689,14 +1687,14 @@ class Finish } else { $tinf = mysql_fetch_array( mysql_query( - 'SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->battle->info['dn_id'] . '" LIMIT 1' + 'SELECT `uid` FROM `dungeon_now` WHERE `id` = "' . $this->battle->i->dnId . '" LIMIT 1' ) ); $nld = ''; if ($tinf['uid'] == $this->battle->users[$i]['id']) { $tinf = mysql_fetch_array( mysql_query( - 'SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->battle->info['dn_id'] . '" AND `hpNow` >= 1 LIMIT 1' + 'SELECT `id` FROM `stats` WHERE `dnow` = "' . $this->battle->i->dnId . '" AND `hpNow` >= 1 LIMIT 1' ) ); if (isset($tinf['id'])) { @@ -1707,7 +1705,7 @@ class Finish ); $nld .= ', новым лидером становится "' . $tinf['login'] . '"'; mysql_query( - 'UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->battle->info['dn_id'] . '" LIMIT 1' + 'UPDATE `dungeon_now` SET `uid` = "' . $tinf['id'] . '" WHERE `id` = "' . $this->battle->i->dnId . '" LIMIT 1' ); } } @@ -1733,7 +1731,7 @@ class Finish } } if (!empty($rtxt)) { - $cmsg->setDn($this->battle->info['dn_id']); + $cmsg->setDn($this->battle->i->dnId); $cmsg->setText($rtxt); $cmsg->setTypeTime(1); $chat->sendMsg($cmsg); diff --git a/_incl_data/class/Battle/Info.php b/_incl_data/class/Battle/Info.php new file mode 100644 index 00000000..9351b42d --- /dev/null +++ b/_incl_data/class/Battle/Info.php @@ -0,0 +1,208 @@ +addexp; + } + + public function getTeamwin(): int + { + return $this->teamwin; + } + + public function getIzlomround(): int + { + return $this->izlomround; + } + + public function getStart1(): int + { + return $this->start1; + } + + public function getStart2(): int + { + return $this->start2; + } + + public function getPlayersC(): int + { + return $this->playersC; + } + + public function getPlayersCC(): int + { + return $this->playersCC; + } + + public function getPlayersCC2(): int + { + return $this->playersCC2; + } + + + /** + * Иноформация о поединке. + * @param int $battleId + */ + public function __construct(int $battleId) + { + $b = Db::getRow('select * from battle where id = ?', [$battleId]); + if (!$b) { + return; + } + $this->id = $b['id']; + $this->city = $b['city']; + $this->timeStart = $b['time_start']; + $this->testFinish = $b['testfinish']; + $this->players = $b['players']; + $this->timeout = $b['timeout']; + $this->type = $b['type']; + $this->status = $b['status']; + $this->kulak = $b['kulak']; + $this->invis = $b['invis']; + $this->noinc = $b['noinc']; + $this->travmchance = $b['travmChance']; + $this->typebattle = $b['typeBattle']; + $this->addexp = $b['addExp']; + $this->money = $b['money']; + $this->money3 = $b['money3']; + $this->timeover = $b['time_over']; + $this->teamwin = $b['team_win']; + $this->dungeon = $b['dungeon']; + $this->razdel = $b['razdel']; + $this->dnId = $b['dn_id']; + $this->x = $b['x']; + $this->y = $b['y']; + $this->fdate = $b['fDate']; + $this->izlom = $b['izlom']; + $this->izlomlvl = $b['izlomLvl']; + $this->izlomround = $b['izlomRound']; + $this->start1 = $b['start1']; + $this->start2 = $b['start2']; + $this->izlomroundsee = $b['izlomRoundSee']; + $this->izlomobr = $b['izlomObr']; + $this->izlomobrnow = $b['izlomObrNow']; + $this->turnir = $b['turnir']; + $this->inturnir = $b['inTurnir']; + $this->clone = $b['clone']; + $this->playersC = $b['players_c']; + $this->fastfight = $b['fastfight']; + $this->nobot = $b['nobot']; + $this->kingfight = $b['kingfight']; + $this->arand = $b['arand']; + $this->noatack = $b['noatack']; + $this->noeff = $b['noeff']; + $this->smert = $b['smert']; + $this->noart = $b['noart']; + $this->zarad = $b['zarad']; + $this->priz = $b['priz']; + $this->otmorozok = $b['otmorozok']; + $this->otmorozokUse = $b['otmorozok_use']; + $this->hod = $b['hod']; + $this->clan1 = $b['clan1']; + $this->clan2 = $b['clan2']; + } + + /** + * Ничья + * @return void + */ + public function setDraw(): void + { + $this->playersCC = 0; + $this->playersCC2 = 0; + } + + public function setTeamWin(int $team = 0): void + { + $this->teamwin = $team; + } + + public function modifyAddExp(int $value): void + { + $this->addexp += $value; + } + + public function setStart1(): void + { + $this->start1 = time(); + } + + public function setStart2(): void + { + $this->start2 = time(); + } + + public function setIzlomround(int $izlomround): void + { + $this->izlomround = $izlomround; + } + + public function setPlayerC(): void + { + $this->playersC = + Db::getValue("select count(id) from users where login not like '%(зверь%' and battle = ?", [$this->id]); + } +} + diff --git a/_incl_data/class/Battle/Log.php b/_incl_data/class/Battle/Log.php index e8e7a12f..edc38417 100644 --- a/_incl_data/class/Battle/Log.php +++ b/_incl_data/class/Battle/Log.php @@ -172,7 +172,7 @@ class Log self::add( [ - 'battle' => $battle->info['id'], + 'battle' => $battle->i->id, 'id_hod' => $battle->hodID, 'text' => "{tm1} Комментатор: $randomcomment", 'vars' => 'time1=' . time(), diff --git a/_incl_data/class/DTO/BattlePriem.php b/_incl_data/class/DTO/BattlePriem.php new file mode 100644 index 00000000..28684218 --- /dev/null +++ b/_incl_data/class/DTO/BattlePriem.php @@ -0,0 +1,29 @@ +error = 'Неудалось использовать на мертвых...'; } elseif ($u->info['hpNow'] < 1) { $u->error = 'Неудалось использовать, вы погибли...'; - } elseif ($btl->info['noeff'] > 0) { + } elseif ($btl->i->noeff > 0) { $u->error = 'Запрет на использования свитков восстановления'; } elseif ($po['magic_hpNow'] < 1 && $po['magic_mpNow'] < 1) { $u->error = 'Неудалось использовать, в магическом свитке нет магии...'; @@ -845,7 +845,7 @@ class Magic ); if (isset($bu['id'])) { $u->error = 'Нельзя использовать свиток каждый ход...'; - } elseif ($btl->info['noeff'] > 0) { + } elseif ($btl->i->noeff > 0) { $u->error = 'Запрет на использования свитков восстановления'; } elseif (($usr['battle'] == $u->info['battle'] && ($u->info['team'] == $usr['team'] && ($po['magic_hpNow'] > 0 || $po['magic_mpNow'] > 0))) && $usr['hpNow'] > 1 && $u->info['hpNow'] >= 1) { //кастуем diff --git a/_incl_data/class/Magic/berezka_tactic.php b/_incl_data/class/Magic/berezka_tactic.php index 6770a12d..b402a827 100644 --- a/_incl_data/class/Magic/berezka_tactic.php +++ b/_incl_data/class/Magic/berezka_tactic.php @@ -1,39 +1,43 @@ info['battle'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1')); +$bu = mysql_fetch_array(mysql_query('SELECT * FROM `tactic` WHERE `btl` = "' . $u->info['battle'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1')); -if($u->info['battle']==0) { - $u->error = 'Использовать можно только в поединке'; -}elseif(isset($bu['id'])) { - $u->error = 'Нельзя использовать свиток каждый ход...'; -}elseif( isset($btl->info['id']) ) { - // - mysql_query('INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("'.$u->info['battle'].'","'.$u->info['id'].'","'.time().'","'.$itm['item_id'].'","'.$itm['name'].'","1")'); - // - $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], - '', - '{tm1} {u1} использовал заклятие "'.$itm['name'].'".', - ($btl->hodID) - ); - $btl->users[$btl->uids[$u->info['id']]]['tactic1'] += 1; - $btl->users[$btl->uids[$u->info['id']]]['tactic2'] += 1; - $btl->users[$btl->uids[$u->info['id']]]['tactic3'] += 1; - $btl->users[$btl->uids[$u->info['id']]]['tactic4'] += 1; - $btl->users[$btl->uids[$u->info['id']]]['tactic5'] += 1; - - mysql_query('UPDATE `stats` SET - `tactic1` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic1'].'", - `tactic2` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic2'].'", - `tactic3` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic3'].'", - `tactic4` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic4'].'", - `tactic5` = "'.$btl->users[$btl->uids[$u->info['id']]]['tactic5'].'" - WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); - // - mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); - $u->error = '‚ы использовали “никальную тактику +1'; +if ($u->info['battle'] == 0) { + $u->error = 'Использовать можно только в поединке'; +} elseif (isset($bu['id'])) { + $u->error = 'Нельзя использовать свиток каждый ход...'; +} elseif (isset($btl->i->id)) { + // + mysql_query( + 'INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time( + ) . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1")' + ); + // + $btl->priemAddLog( + $id, 1, 2, $u->info['id'], $u->info['enemy'], + '', + '{tm1} {u1} использовал заклятие "' . $itm['name'] . '".', + ($btl->hodID) + ); + $btl->users[$btl->uids[$u->info['id']]]['tactic1'] += 1; + $btl->users[$btl->uids[$u->info['id']]]['tactic2'] += 1; + $btl->users[$btl->uids[$u->info['id']]]['tactic3'] += 1; + $btl->users[$btl->uids[$u->info['id']]]['tactic4'] += 1; + $btl->users[$btl->uids[$u->info['id']]]['tactic5'] += 1; + + mysql_query( + 'UPDATE `stats` SET + `tactic1` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic1'] . '", + `tactic2` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic2'] . '", + `tactic3` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic3'] . '", + `tactic4` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic4'] . '", + `tactic5` = "' . $btl->users[$btl->uids[$u->info['id']]]['tactic5'] . '" + WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' + ); + // + mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = ' . $itm['id'] . ' LIMIT 1'); + $u->error = '‚ы использовали “никальную тактику +1'; } -?> \ No newline at end of file diff --git a/_incl_data/class/Magic/dispell.php b/_incl_data/class/Magic/dispell.php index 99c39a1a..857742b9 100644 --- a/_incl_data/class/Magic/dispell.php +++ b/_incl_data/class/Magic/dispell.php @@ -18,7 +18,7 @@ if( $itm['magic_inci'] == 'dispell' ) { //Действие при клике - if( isset($btl->info['id']) ) { + if( isset($btl->i->id) ) { $btl->priemAddLog( $id, 1, 2, $usr['id'], $u->info['enemy'], '', '{tm1} {u1} использовал заклятие "'.$itm['name'].'".', @@ -56,7 +56,7 @@ if( $itm['magic_inci'] == 'dispell' ) { $pvr['pl'] = mysql_fetch_array($pvr['sp']); if(!isset($pvr['pl']['id'])) { $u->error = 'Не удалось использовать "'.$itm['name'].'", на вас нет проклятий!'; - }elseif( isset($btl->info['id']) ) { + }elseif( isset($btl->i->id) ) { $pvr['pl']['priem'] = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "'.$pvr['pl']['v2'].'" LIMIT 1')); //if( isset($pvr['pl']['priem']) ) { // $btl->delPriem($pvr['pl'],$btl->users[$btl->uids[$u->info['id']]],100); diff --git a/_incl_data/class/Magic/esfer.php b/_incl_data/class/Magic/esfer.php index 768bd49a..6997116d 100644 --- a/_incl_data/class/Magic/esfer.php +++ b/_incl_data/class/Magic/esfer.php @@ -13,9 +13,9 @@ if( $itm['magic_inci'] == 'esfer' ) { //Действие при клике if( $u->stats['hpNow'] < 1 ) { $u->error = 'Вы поглибли и не можете воспользоваться свитком...'; - }elseif( isset($btl->info['id']) ) { + }elseif( isset($btl->i->id) ) { - if( $btl->info['noinc'] > 0 ) { + if( $btl->i->noinc > 0 ) { $u->error = 'Бой был изолирован ранее'; }else{ $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], @@ -24,7 +24,7 @@ if( $itm['magic_inci'] == 'esfer' ) { ($btl->hodID) ); $u->error = 'Мерцающая сфера отделила всех вас от остального мира... '; - mysql_query('UPDATE `battle` SET `noinc` = 1 WHERE `id` = '.$btl->info['id'].' LIMIT 1'); + mysql_query('UPDATE `battle` SET `noinc` = 1 WHERE `id` = '.$btl->i->id.' LIMIT 1'); mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); } diff --git a/_incl_data/class/Magic/exitbtl.php b/_incl_data/class/Magic/exitbtl.php index 053a1bcb..71ec2adc 100644 --- a/_incl_data/class/Magic/exitbtl.php +++ b/_incl_data/class/Magic/exitbtl.php @@ -11,19 +11,19 @@ if( $itm['magic_inci'] == 'exitbtl' ) { $pvr = array(); //Действие при клике - if( isset($btl->info['id']) ) { + if( isset($btl->i->id) ) { - if( $btl->info['dn_id'] > 0 || $btl->info['izlom'] > 0 ) { + if( $btl->i->dnId > 0 || $btl->i->izlom > 0 ) { $u->error = 'Магия не действует в пещерах и подобных локациях...'; - }elseif( $btl->info['noinc'] > 0 ) { + }elseif( $btl->i->noinc > 0 ) { $u->error = 'Бой изолирован и вы не можете его покинуть'; - }elseif( $btl->info['clone'] > 0 ) { + }elseif( $btl->i->clone > 0 ) { $u->error = 'Невозможно покинуть поединок с клоном'; }elseif( $u->info['hpNow'] < 1 ) { $u->error = 'Вы умерли и не можете покинуть бой'; - }elseif( $btl->info['type'] == 500 || $btl->info['type'] == 33){ + }elseif( $btl->i->type == 500 || $btl->i->type == 33){ $u->error = 'Невозможно покинуть этот поединок!'; - }elseif( $btl->info['smert'] == 1){ + }elseif( $btl->i->smert == 1){ $u->error = 'Невозможно покинуть этот поединок!'; }else{ $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], @@ -33,7 +33,7 @@ if( $itm['magic_inci'] == 'exitbtl' ) { ); $u->error = 'Вы сбежали с поля боя и потеряли всю энергию...'; // - mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ("'.$u->info['login'].'","'.$u->info['city'].'","'.$btl->info['id'].'","'.$u->info['id'].'","'.time().'","'.$btl->info['team_win'].'","'.$u->info['lvl'].'","'.$u->info['align'].'","'.$u->info['clan'].'","0","0","'.$u->info['money'].'","'.$u->info['money2'].'","'.$u->info['money'].'")'); + mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ("'.$u->info['login'].'","'.$u->info['city'].'","'.$btl->i->id.'","'.$u->info['id'].'","'.time().'","'.$btl->i->getTeamwin().'","'.$u->info['lvl'].'","'.$u->info['align'].'","'.$u->info['clan'].'","0","0","'.$u->info['money'].'","'.$u->info['money2'].'","'.$u->info['money'].'")'); mysql_query('UPDATE `stats` SET `battle_yron` = 0, `battle_exp` = 0,`tactic1` = 0 , `tactic2` = 0 , `tactic3` = 0 , `tactic4` = 0 , `tactic5` = 0 , `tactic6` = 0 , `tactic7` = -1 , `last_pr` = 0 , `last_hp` = -1 , `team` = 0 WHERE `id` = '.$u->info['id'].' LIMIT 1'); mysql_query('UPDATE `users` SET `battle` = "0", `lose` = `lose` + 1 WHERE `id` = '.$u->info['id'].' LIMIT 1'); // @@ -41,7 +41,7 @@ if( $itm['magic_inci'] == 'exitbtl' ) { // mysql_query('UPDATE `items_users` SET `iznosNOW` = `iznosNOW` + 1 WHERE `id` = '.$itm['id'].' LIMIT 1'); // - mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ('.$u->info['login'].','.$u->info['city'].','.$btl->info['id'].','.$u->info['id'].','.time().','.$btl->info['team_win'].','.$u->info['lvl'].','.$u->info['align'].','.$u->info['clan'].',0,0,'.$u->info['money'].','.$u->info['money2'].','.$u->info['money'].')'); + mysql_query('INSERT INTO `battle_last` (`login`,`city`,`battle_id`,`uid`,`time`,`team`,`lvl`,`align`,`clan`,`exp`,`bot`,`money`,`money2`,`money3`) VALUES ('.$u->info['login'].','.$u->info['city'].','.$btl->i->id.','.$u->info['id'].','.time().','.$btl->i->getTeamwin().','.$u->info['lvl'].','.$u->info['align'].','.$u->info['clan'].',0,0,'.$u->info['money'].','.$u->info['money2'].','.$u->info['money'].')'); mysql_query('DELETE FROM `battle_act` WHERE `uid1` = "'.$u->info['id'].'" OR `uid2` = "'.$u->info['id'].'"'); mysql_query('UPDATE `battle_users` SET `finish` = 1 WHERE `uid` = "'.$u->info['id'].'"'); mysql_query('UPDATE `stats` SET `hpNow`= 1, `mpNow` = 1,`priems_z` = "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); diff --git a/_incl_data/class/Magic/undie.php b/_incl_data/class/Magic/undie.php index c5fa29c9..cff1db4d 100644 --- a/_incl_data/class/Magic/undie.php +++ b/_incl_data/class/Magic/undie.php @@ -19,7 +19,7 @@ if( $itm['magic_inci'] == 'undie' ) { $u->error = 'Вы поглибли и не можете воспользоваться свитком...'; }elseif( $u->info['tactic7'] < $pvr['trs7'] ) { $u->error = 'Недостаточно духа, необходимо '.$pvr['trs7'].'...'; - }elseif( isset($btl->info['id']) ) { + }elseif( isset($btl->i->id) ) { /* $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], '', diff --git a/_incl_data/class/Magic/yarostzvezd.php b/_incl_data/class/Magic/yarostzvezd.php index b12fb50d..6c3fd06f 100644 --- a/_incl_data/class/Magic/yarostzvezd.php +++ b/_incl_data/class/Magic/yarostzvezd.php @@ -16,7 +16,7 @@ if( $itm['magic_inci'] == 'yarostzvezd' ) { $u->error = 'Вы поглибли и не можете воспользоваться свитком...'; }elseif( $u->info['tactic7'] < $pvr['trs7'] ) { $u->error = 'Недостаточно духа, необходимо '.$pvr['trs7'].'...'; - }elseif( isset($btl->info['id']) ) { + }elseif( isset($btl->i->id) ) { /* $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], '', diff --git a/_incl_data/class/Priems.php b/_incl_data/class/Priems.php index dd2af900..7ca72786 100644 --- a/_incl_data/class/Priems.php +++ b/_incl_data/class/Priems.php @@ -4,6 +4,7 @@ use Core\Db; use DarksLight2\Training\TrainingManager; use Helper\Conversion; use Helper\Math; +use User\Effects; /* - доделать добавление приема в $btl->users[]['eff'] после использования, в противном случаи некотрые приемы используются через 1 ход @@ -114,7 +115,7 @@ class Priems $return_main = true; $ue = Db::getRow( 'select * from users left join stats on (users.id = stats.id) where users.id = ? and battle = ? and hpnow > 0', - [$eff['uid'], $btl->info['id']] + [$eff['uid'], $btl->i->id] ); if (!empty($pr['file'])) { @@ -249,7 +250,7 @@ class Priems '||login2=' . $btl->users[$btl->uids[$uen]]['login']; $mas1 = [ 'time' => time(), - 'battle' => $btl->info['id'], + 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, @@ -349,7 +350,7 @@ class Priems $pm[2] = $s2['antm11']; } - if (isset($btl->info['id'])) { + if (isset($btl->i->id)) { $pm[3] = $btl->zmgo($s2['zm' . $t]); $pm[3] = round($pm[3]); } @@ -947,13 +948,13 @@ class Priems } // тяж травма для кровавых - if ($btl->info['type'] == 99 and $hp2 == 0 and !$trawm_off) { + if ($btl->i->type == 99 and $hp2 == 0 and !$trawm_off) { //$eff['user_use'] //$sp1 = mysql_query('SELECT `e`.* FROM `eff_users` AS `e` WHERE `e`.`uid` = "'.$uen.'" AND `e`.`id_eff` = "22" AND `e`.`delete` = "0" AND `e`.`v1` = "priem" LIMIT 25'); $trawm_off = true; //$at[2][$i]['ttravm']='получил Тяжелую травму.'; - $btl->addTravm($btl->users[$btl->uids[$uen]]['id'], 3, $btl->users[$btl->uids[$eff['user_use']]]['level']); + Effects::addInjury($btl->users[$btl->uids[$uen]]['id'], 3, $btl->users[$btl->uids[$eff['user_use']]]['level']); } $upd = mysql_query( 'UPDATE `stats` SET `hpNow` = ' . $hp2 . ',`last_hp` = "' . $btl->stats[$btl->uids[$uen]]['last_hp'] . '" WHERE `id` = "' . $uen . '" LIMIT 1' @@ -964,7 +965,7 @@ class Priems ) . '||s1=' . $btl->users[$btl->uids[$usu]]['sex'] . '||t1=' . $btl->users[$btl->uids[$usu]]['team'] . '||login1=' . $btl->users[$btl->uids[$usu]]['login'] . '||s2=' . $btl->users[$btl->uids[$uen]]['sex'] . '||t2=' . $btl->users[$btl->uids[$uen]]['team'] . '||login2=' . $btl->users[$btl->uids[$uen]]['login'] . ''; $mas1 = [ 'time' => time(), - 'battle' => $btl->info['id'], + 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, @@ -1088,7 +1089,7 @@ class Priems $u = $this->u; // Для присоедиянемых файлов. if ($id == 100500 && $this->u->info['animal'] > 0) { $use_lst = $this->u->testAction( - '`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->info['id'] . '" LIMIT 1', + '`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->i->id . '" LIMIT 1', 1 ); if (!isset($use_lst['id'])) { @@ -1117,7 +1118,7 @@ class Priems 'SELECT `id` FROM `test_bot` WHERE `login` = "' . $tp[$a['type']] . ' [' . $a['level'] . ']" LIMIT 1' ) ); - if (isset($id['id']) && $btl->info['type'] != 500) { + if (isset($id['id']) && $btl->i->type != 500) { $b = $this->u->addNewbot($id['id'], null, null); if ($b > 0 && $b) { $a['eda'] -= 4; @@ -1128,7 +1129,7 @@ class Priems $vLog = 'time1=' . time() . '||s1=' . $this->u->info['sex'] . '||t1=' . $this->u->info['team'] . '||login1=' . $this->u->info['login'] . ''; $mas1 = [ 'time' => time(), - 'battle' => $btl->info['id'], + 'battle' => $btl->i->id, 'id_hod' => $btl->hodID, 'vars' => $vLog, 'zona1' => '', @@ -1143,7 +1144,7 @@ class Priems $btl->add_log($mas1); mysql_query( - 'UPDATE `users` SET `login` = "' . $a['name'] . ' (зверь ' . $this->u->info['login'] . ')",`obraz` = "' . $a['obraz'] . '.gif",`battle` = "' . $btl->info['id'] . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1' + 'UPDATE `users` SET `login` = "' . $a['name'] . ' (зверь ' . $this->u->info['login'] . ')",`obraz` = "' . $a['obraz'] . '.gif",`battle` = "' . $btl->i->id . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1' ); mysql_query( 'UPDATE `stats` SET `team` = "' . $this->u->info['team'] . '" WHERE `id` = "' . $b['id'] . '" LIMIT 1' @@ -1151,7 +1152,7 @@ class Priems mysql_query( 'UPDATE `users_animal` SET `eda` = "' . $a['eda'] . '" WHERE `id` = "' . $a['id'] . '" LIMIT 1' ); - $this->u->addAction(time(), 'animal_use' . $btl->info['id'], $a['level']); + $this->u->addAction(time(), 'animal_use' . $btl->i->id, $a['level']); } else { echo 'Не удалось выпустить зверя...'; } @@ -1212,7 +1213,7 @@ class Priems ( `u`.`inUser` > 0 OR ( - `u`.`battle`="' . $btl->info['id'] . '" AND + `u`.`battle`="' . $btl->i->id . '" AND `st`.`hpNow` > 0 ) ) ORDER BY `u`.`id` DESC LIMIT 1' @@ -1233,7 +1234,7 @@ class Priems FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id`=`st`.`id`) WHERE - `u`.`battle`="' . $btl->info['id'] . '" AND + `u`.`battle`="' . $btl->i->id . '" AND `st`.`hpNow` > 0) AND `u`.`id` = "' . $this->ue['inUser'] . '" ORDER BY `u`.`id` ASC LIMIT 1' ) @@ -1256,7 +1257,7 @@ class Priems } else { $ga = mysql_fetch_assoc( mysql_query( - 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $this->u->info['enemy'] . '" LIMIT 1' + 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->i->id . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $this->u->info['enemy'] . '" LIMIT 1' ) ); if (($this->u->info['enemy'] == 0 || isset($ga['id'])) && ($pl['tr_hod'] > 0 || $pl['trUser'] > 0)) { @@ -1423,7 +1424,7 @@ class Priems if ($pl['xuse'] > 0) { $xu = $this->u->testAction( - '`vars` = "use_priem_' . $btl->info['id'] . '_' . $this->u->info['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'], + '`vars` = "use_priem_' . $btl->i->id . '_' . $this->u->info['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'], 2 ); if ($xu[0] >= $pl['xuse']) { @@ -1535,7 +1536,7 @@ class Priems //требует чтобы пользователь с кем-то разменивался (при ожидании не пропадает, но не используется) $ga = mysql_fetch_assoc( mysql_query( - 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $btl->users[$btl->uids[$this->u->info['id']]]['enemy'] . '" LIMIT 1' + 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->i->id . '" AND `uid1` = "' . $this->u->info['id'] . '" AND `uid2` = "' . $btl->users[$btl->uids[$this->u->info['id']]]['enemy'] . '" LIMIT 1' ) ); if (isset($ga['id'])) { @@ -1960,7 +1961,7 @@ class Priems } else { $a1 = mysql_fetch_assoc( mysql_query( - 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->info['id'] . '" AND `uid2` = "' . $this->u->info['id'] . '" AND `uid1` = "' . $this->u->info['enemy'] . '" LIMIT 1' + 'SELECT * FROM `battle_act` WHERE `battle` = "' . $btl->i->id . '" AND `uid2` = "' . $this->u->info['id'] . '" AND `uid1` = "' . $this->u->info['enemy'] . '" LIMIT 1' ) ); if (isset($a1['id'])) { @@ -1976,7 +1977,7 @@ class Priems } else { //бьем противника с пропуском хода mysql_query( - 'INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("' . $btl->info['id'] . '","' . $this->u->info['id'] . '","' . $this->u->info['enemy'] . '","' . time( + 'INSERT INTO `battle_act` (`battle`,`uid1`,`uid2`,`time`,`out1`,`type`,`tpo1`) VALUES ("' . $btl->i->id . '","' . $this->u->info['id'] . '","' . $this->u->info['enemy'] . '","' . time( ) . '","1","1","2")' ); } @@ -2191,7 +2192,7 @@ class Priems } if ($this->u->info['animal'] > 0 && $t == 2) { $use_lst = $this->u->testAction( - '`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->info['id'] . '" LIMIT 1', + '`uid` = "' . $this->u->info['id'] . '" AND `vars` = "animal_use' . $btl->i->id . '" LIMIT 1', 1 ); if (!isset($use_lst['id'])) { @@ -2721,7 +2722,7 @@ class Priems $x++; } if ($pl['xuse'] > 0) { - $this->u->addAction(time(), 'use_priem_' . $btl->info['id'] . '_' . $this->u->info['id'], $pl['id']); + $this->u->addAction(time(), 'use_priem_' . $btl->i->id . '_' . $this->u->info['id'], $pl['id']); } $rt = ltrim($rt, ','); mysql_query('UPDATE `stats` SET ' . $rt . ' WHERE `id` = "' . $this->u->info['id'] . '" LIMIT 1'); diff --git a/_incl_data/class/User/Effects.php b/_incl_data/class/User/Effects.php index 0c08b3a3..ca9ee225 100644 --- a/_incl_data/class/User/Effects.php +++ b/_incl_data/class/User/Effects.php @@ -118,6 +118,37 @@ insert into eff_users return true; } + public static function addInjury($uid, $type, $lvl): void + { + $stat = rand(1, 3); // пока без духовности + $img = "eff_travma$type.gif"; + if ($type == 1) { + $name = 'Легкая травма'; + $timeEnd = rand(1, 3);// время травмы от 1.30 до 6 часов + $data = 'add_s' . $stat . '=-' . $lvl; + } elseif ($type == 2) { + $name = 'Средняя травма'; + $timeEnd = rand(3, 5);// время травмы от 6 до 12 часов + $data = 'add_s' . $stat . '=-' . ($lvl * 2); + } elseif ($type == 3) { + $name = 'Тяжелая травма'; + $timeEnd = rand(5, 7);// время травмы от 12 до 6 часов + $data = 'add_s' . $stat . '=-' . ($lvl * 3); + } else { + $name = 'Неизлечимая травма'; + $timeEnd = 24;// время травмы от 24 часа + $data = 'add_s' . $stat . '=-' . ($lvl * 50); + } + $timeEnd *= 3600; + + Db::sql( + "insert into eff_users (id_eff, uid, name, timeUse, data, img2, v1, timeace) values (4,?,?,unix_timestamp(),?,?,?,?)", + [$uid, $name, $data, $img, $type, $timeEnd] + ); + + self::addById($uid, 263); + } + public static function removeByEffectId(int $userId, int $effectId): void { Db::sql('delete from eff_users where id_eff = ? and uid = ?', [$effectId, $userId]); diff --git a/_incl_data/class/priem/21.php b/_incl_data/class/priem/21.php index 33ad32a3..78ab9227 100644 --- a/_incl_data/class/priem/21.php +++ b/_incl_data/class/priem/21.php @@ -6,7 +6,7 @@ if (!defined('GAME')) { Прием: Оледенение [4] */ $pvr = []; -if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !isset($this->info['id'])) { +if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->i->id) && !isset($this->info['id'])) { } elseif (isset($pr_used_this) && isset($pr_moment)) { //Каждый ход diff --git a/_incl_data/class/priem/24.php b/_incl_data/class/priem/24.php index c7d1d9f6..dca1c3c5 100644 --- a/_incl_data/class/priem/24.php +++ b/_incl_data/class/priem/24.php @@ -17,12 +17,12 @@ if( isset($pr_momental_this)) { return $at; }; unset( $pr_used_this ); -}elseif( isset($pr_used_this) && isset($pr_moment) && isset($btl->info['id']) ) { +}elseif( isset($pr_used_this) && isset($pr_moment) && isset($btl->i->id) ) { $fx_priem = function( $id , $at , $uid, $j_id ) { return $at; }; unset( $pr_used_this ); -}elseif(isset($btl->info['id'])) { +}elseif(isset($btl->i->id)) { //Действие при клике /* $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], diff --git a/_incl_data/class/priem/253.php b/_incl_data/class/priem/253.php index 1434a2d8..525622ec 100644 --- a/_incl_data/class/priem/253.php +++ b/_incl_data/class/priem/253.php @@ -11,14 +11,14 @@ $pvr['id'] = mysql_fetch_array(mysql_query('SELECT `id` FROM `test_bot` WHERE `l if( isset($pvr['id']['id']) ) { $pvr['bot'] = $u->addNewbot($pvr['id']['id'],NULL,NULL); // - $pvr['xznm'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `battle` = "'.$btl->info['id'].'" AND `login` LIKE "Каменный Страж%" LIMIT 1')); + $pvr['xznm'] = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `battle` = "'.$btl->i->id.'" AND `login` LIKE "Каменный Страж%" LIMIT 1')); if($pvr['xznm'][0] > 0) { $pvr['xznm'] = ' ('.($pvr['xznm'][0]).')'; }else{ $pvr['xznm'] = ''; } // - mysql_query('UPDATE `users` SET `login` = "Каменный Страж'.$pvr['xznm'].'",`obraz` = "0.gif",`battle` = "'.$btl->info['id'].'" WHERE `id` = "'.$pvr['bot']['id'].'" LIMIT 1'); + mysql_query('UPDATE `users` SET `login` = "Каменный Страж'.$pvr['xznm'].'",`obraz` = "0.gif",`battle` = "'.$btl->i->id.'" WHERE `id` = "'.$pvr['bot']['id'].'" LIMIT 1'); mysql_query('UPDATE `stats` SET `team` = "'.$u->info['team'].'" WHERE `id` = "'.$pvr['bot']['id'].'" LIMIT 1'); // $btl->priemAddLog( $id, 1, 2, $u->info['id'], $u->info['enemy'], diff --git a/_incl_data/class/priem/281.php b/_incl_data/class/priem/281.php index ae0aa7ce..f47e0d5c 100644 --- a/_incl_data/class/priem/281.php +++ b/_incl_data/class/priem/281.php @@ -46,7 +46,7 @@ if(isset($pr_momental_this)) { return $at; }; unset( $pr_used_this ); -//}elseif( isset($pr_used_this) && !isset($btl->info['id']) ) { +//}elseif( isset($pr_used_this) && !isset($btl->i->id) ) { }elseif( isset($pr_used_this) ) { $fx_priem = function( $id , $at , $uid, $j_id ) { diff --git a/_incl_data/class/priem/342.php b/_incl_data/class/priem/342.php index 51f39d37..fe815070 100644 --- a/_incl_data/class/priem/342.php +++ b/_incl_data/class/priem/342.php @@ -19,7 +19,7 @@ if( isset($pr_momental_this)) { 0, time() ); // mysql_query('INSERT INTO `battle_actions` (`btl`,`uid`,`time`,`vars`,`vals`) VALUES ( - "'.$btl->info['id'].'","'.$u->info['id'].'","'.time().'","use_defteam'.$u->info['team'].'","1" + "'.$btl->i->id.'","'.$u->info['id'].'","'.time().'","use_defteam'.$u->info['team'].'","1" )'); // $this->mintr($pl); diff --git a/_incl_data/class/priem/343.php b/_incl_data/class/priem/343.php index 82376696..7fb11886 100644 --- a/_incl_data/class/priem/343.php +++ b/_incl_data/class/priem/343.php @@ -19,7 +19,7 @@ if( isset($pr_momental_this)) { 0, time() ); // mysql_query('INSERT INTO `battle_actions` (`btl`,`uid`,`time`,`vars`,`vals`) VALUES ( - "'.$btl->info['id'].'","'.$u->info['id'].'","'.time().'","use_powteam'.$u->info['team'].'","1" + "'.$btl->i->id.'","'.$u->info['id'].'","'.time().'","use_powteam'.$u->info['team'].'","1" )'); // $this->mintr($pl); diff --git a/_incl_data/class/priem/73.php b/_incl_data/class/priem/73.php index 4262f9ac..63d7ea8a 100644 --- a/_incl_data/class/priem/73.php +++ b/_incl_data/class/priem/73.php @@ -6,7 +6,7 @@ if (!defined('GAME')) { Прием: Оледенение [5] */ $pvr = []; -if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !isset($this->info['id'])) { +if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->i->id) && !isset($this->info['id'])) { } elseif (isset($pr_used_this) && isset($pr_moment)) { //Каждый ход diff --git a/_incl_data/class/priem/74.php b/_incl_data/class/priem/74.php index 2445648e..d593501b 100644 --- a/_incl_data/class/priem/74.php +++ b/_incl_data/class/priem/74.php @@ -6,7 +6,7 @@ if (!defined('GAME')) { Прием: Оледенение [6] */ $pvr = []; -if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !isset($this->info['id'])) { +if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->i->id) && !isset($this->info['id'])) { } elseif (isset($pr_used_this) && isset($pr_moment)) { //Каждый ход diff --git a/_incl_data/class/priem/75.php b/_incl_data/class/priem/75.php index c1b79ed7..d7220d59 100644 --- a/_incl_data/class/priem/75.php +++ b/_incl_data/class/priem/75.php @@ -6,7 +6,7 @@ if (!defined('GAME')) { Прием: Оледенение [7] */ $pvr = []; -if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !isset($this->info['id'])) { +if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->i->id) && !isset($this->info['id'])) { } elseif (isset($pr_used_this) && isset($pr_moment)) { //Каждый ход diff --git a/_incl_data/class/priem/76.php b/_incl_data/class/priem/76.php index 55538898..4a2194a7 100644 --- a/_incl_data/class/priem/76.php +++ b/_incl_data/class/priem/76.php @@ -6,7 +6,7 @@ if (!defined('GAME')) { Прием: Оледенение [8] */ $pvr = []; -if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !isset($this->info['id'])) { +if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->i->id) && !isset($this->info['id'])) { } elseif (isset($pr_used_this) && isset($pr_moment)) { //Каждый ход diff --git a/_incl_data/class/priem/77.php b/_incl_data/class/priem/77.php index cb2eca9d..5b5bbf61 100644 --- a/_incl_data/class/priem/77.php +++ b/_incl_data/class/priem/77.php @@ -7,7 +7,7 @@ if (!defined('GAME')) { */ $pvr = []; -if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !isset($this->info['id'])) { +if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->i->id) && !isset($this->info['id'])) { } elseif (isset($pr_used_this) && isset($pr_moment)) { diff --git a/_incl_data/class/priem/78.php b/_incl_data/class/priem/78.php index 376052a4..559d75ee 100644 --- a/_incl_data/class/priem/78.php +++ b/_incl_data/class/priem/78.php @@ -6,7 +6,7 @@ if (!defined('GAME')) { Прием: Оледенение [10] */ $pvr = []; -if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !isset($this->info['id'])) { +if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->i->id) && !isset($this->info['id'])) { } elseif (isset($pr_used_this) && isset($pr_moment)) { //Каждый ход diff --git a/_incl_data/class/priem/79.php b/_incl_data/class/priem/79.php index dfa86cd5..a9b1a369 100644 --- a/_incl_data/class/priem/79.php +++ b/_incl_data/class/priem/79.php @@ -6,7 +6,7 @@ if (!defined('GAME')) { Прием: Оледенение [11] */ $pvr = []; -if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->info['id']) && !isset($this->info['id'])) { +if (isset($pr_used_this) && isset($pr_moment) && !isset($btl->i->id) && !isset($this->info['id'])) { } elseif (isset($pr_used_this) && isset($pr_moment)) { //Каждый ход diff --git a/_incl_data/class/priems/air.php b/_incl_data/class/priems/air.php index a7a6b76f..4ae970b6 100644 --- a/_incl_data/class/priems/air.php +++ b/_incl_data/class/priems/air.php @@ -88,7 +88,7 @@ if (isset($hod)) { mysql_query('UPDATE `stats` SET `mpNow` = "' . $btl->stats[$btl->uids[$u->info['id']]]['mpNow'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); //заносим в лог боя $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . '||s2=' . $btl->users[$btl->uids[$u->info['enemy']]]['sex'] . '||t2=' . $btl->users[$btl->uids[$u->info['enemy']]]['team'] . '||login2=' . $btl->users[$btl->uids[$u->info['enemy']]]['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; if ($rg > 0) { $rg = '+' . $rg; } else { diff --git a/_incl_data/class/priems/eath.php b/_incl_data/class/priems/eath.php index cf0acbb4..36fe832c 100644 --- a/_incl_data/class/priems/eath.php +++ b/_incl_data/class/priems/eath.php @@ -117,17 +117,17 @@ if(isset($hod)) $b = $u->addNewbot($id['id'],NULL,NULL); if($b>0 && $b!=false) { - $xznm = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `battle` = "'.$btl->info['id'].'" AND `login` LIKE "Каменный Страж%" LIMIT 1')); + $xznm = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `users` WHERE `battle` = "'.$btl->i->id.'" AND `login` LIKE "Каменный Страж%" LIMIT 1')); if($xznm[0] > 0) { $xznm = ' ('.($xznm[0]).')'; }else{ $xznm = ''; } - mysql_query('UPDATE `users` SET `login` = "Каменный Страж'.$xznm.'",`obraz` = "0.gif",`battle` = "'.$btl->info['id'].'" WHERE `id` = "'.$b['id'].'" LIMIT 1'); + mysql_query('UPDATE `users` SET `login` = "Каменный Страж'.$xznm.'",`obraz` = "0.gif",`battle` = "'.$btl->i->id.'" WHERE `id` = "'.$b['id'].'" LIMIT 1'); mysql_query('UPDATE `stats` SET `team` = "'.$u->info['team'].'" WHERE `id` = "'.$b['id'].'" LIMIT 1'); mysql_query('INSERT INTO `eff_users` (`id_eff`,`uid`,`user_use`,`name`,`timeUse`,`v1`,`v2`,`img2`) VALUES ("22","'.$b['id'].'","'.$u->info['id'].'","Каменный Страж: Защитить","77","priem","254","wis_earth_summon") '); $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>$btl->hodID,'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>$btl->hodID,'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); if($u->info['sex'] == 1) { $mas1['text'] = '{tm1} {u1} начертила круг на земле и призвала "Каменный Страж'.$xznm.'".'; }else{ @@ -201,7 +201,7 @@ if(isset($hod)) //заносим в лог боя $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$btl->users[$btl->uids[$u->info['enemy']]]['sex'].'||t2='.$btl->users[$btl->uids[$u->info['enemy']]]['team'].'||login2='.$btl->users[$btl->uids[$u->info['enemy']]]['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); if($rg>0) { $rg = '+'.$rg; @@ -252,7 +252,7 @@ if(isset($hod)) mysql_query('UPDATE `eff_users` SET `data` = "'.$dell['data'].'", `x`="'.$dell['x'].'" WHERE `id` = "'.$dell['id'].'"'); $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>$btl->hodID,'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>$btl->hodID,'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); $mas1['text'] = '{u1} Ослабил эфект "'.$dell['name'].'" с помощью Очиститься Кровью .'; $btl->add_log($mas1); }*/ @@ -275,7 +275,7 @@ if(isset($hod)) //заносим в лог боя $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$btl->users[$btl->uids[$u->info['enemy']]]['sex'].'||t2='.$btl->users[$btl->uids[$u->info['enemy']]]['team'].'||login2='.$btl->users[$btl->uids[$u->info['enemy']]]['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); if($rg>0) { $rg = '+'.$rg; diff --git a/_incl_data/class/priems/fire.php b/_incl_data/class/priems/fire.php index 2be7bbc8..1460d015 100644 --- a/_incl_data/class/priems/fire.php +++ b/_incl_data/class/priems/fire.php @@ -149,7 +149,7 @@ if(isset($hod)) //$hpmin = $yn; $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$ue['sex'].'||t2='.$ue['team'].'||login2='.$ue['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'",`uid` = "0" WHERE `id` = "'.$ptst['id'].'" LIMIT 1'); @@ -210,7 +210,7 @@ if(isset($hod)) //$hpmin = $yn; $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$ue['sex'].'||t2='.$ue['team'].'||login2='.$ue['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'",`uid` = "0" WHERE `id` = "'.$ptst['id'].'" LIMIT 1'); @@ -254,7 +254,7 @@ if(isset($hod)) $hpmin = $yn; $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$ue['sex'].'||t2='.$ue['team'].'||login2='.$ue['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'",`uid` = "0" WHERE `id` = "'.$ptst['id'].'" LIMIT 1'); @@ -510,7 +510,7 @@ if(isset($hod)) mysql_query('UPDATE `stats` SET `mpNow` = "'.$btl->users[$btl->uids[$u->info['id']]]['mpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); //заносим в лог боя $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$btl->users[$btl->uids[$u->info['enemy']]]['sex'].'||t2='.$btl->users[$btl->uids[$u->info['enemy']]]['team'].'||login2='.$btl->users[$btl->uids[$u->info['enemy']]]['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>($btl->hodID),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); if($rg>0) { $rg = '+'.$rg; diff --git a/_incl_data/class/priems/grey.php b/_incl_data/class/priems/grey.php index f2209709..cc3d18b4 100644 --- a/_incl_data/class/priems/grey.php +++ b/_incl_data/class/priems/grey.php @@ -41,7 +41,7 @@ if(!defined('GAME')) mysql_query('UPDATE `stats` SET `mpNow` = "'.$btl->stats[$btl->uids[$u->info['id']]]['mpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1'); //заносим в лог боя $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login'].'||s2='.$btl->users[$btl->uids[$u->info['enemy']]]['sex'].'||t2='.$btl->users[$btl->uids[$u->info['enemy']]]['team'].'||login2='.$btl->users[$btl->uids[$u->info['enemy']]]['login'].''; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); if($rg>0) { $rg = '+'.$rg; diff --git a/_incl_data/class/priems/moment.php b/_incl_data/class/priems/moment.php index d3d9aef7..d8dbf604 100644 --- a/_incl_data/class/priems/moment.php +++ b/_incl_data/class/priems/moment.php @@ -34,7 +34,7 @@ if ($pl['id'] == 189) { $sx = 'а'; } $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . '||s2=' . $btl->users[$btl->uids[$u->info['enemy']]]['sex'] . '||t2=' . $btl->users[$btl->uids[$u->info['enemy']]]['team'] . '||login2=' . $btl->users[$btl->uids[$u->info['enemy']]]['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '" и ошеломил' . $sx . ' персонажа {u2} на два хода.'; $pz = $btl->users[$btl->uids[$u->info['enemy']]]['priems_z']; @@ -75,7 +75,7 @@ if ($pl['id'] == 189) { $sx = 'а'; } $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . '||s2=' . $btl->users[$btl->uids[$u->info['enemy']]]['sex'] . '||t2=' . $btl->users[$btl->uids[$u->info['enemy']]]['team'] . '||login2=' . $btl->users[$btl->uids[$u->info['enemy']]]['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; $hp = $u->info['level'] * 2 - $u->info['level']; @@ -140,7 +140,7 @@ if ($pl['id'] == 189) { } mysql_query('UPDATE `stats` SET `tactic6` = "' . $btl->users[$btl->uids[$this->ue['id']]]['tactic6'] . '" WHERE `id` = "' . $this->ue['id'] . '" LIMIT 1'); $vLog = 'time1=' . time() . '||s1=' . $btl->users[$btl->uids[$u->info['id']]]['sex'] . '||t1=' . $btl->users[$btl->uids[$u->info['id']]]['team'] . '||login1=' . $btl->users[$btl->uids[$u->info['id']]]['login'] . '||s2=' . $btl->users[$btl->uids[$this->ue['id']]]['sex'] . '||t2=' . $btl->users[$btl->uids[$this->ue['id']]]['team'] . '||login2=' . $btl->users[$btl->uids[$this->ue['id']]]['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '" на персонажа {u2}.'; $btl->add_log($mas1); $pz[(int)$id] = 1; @@ -209,7 +209,7 @@ if ($pl['id'] == 189) { } $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '". ' . $hp . ' [' . floor($btl->stats[$btl->uids[$u->info['id']]]['hpNow']) . '/' . $btl->stats[$btl->uids[$u->info['id']]]['hpAll'] . ']'; $btl->add_log($mas1); @@ -243,7 +243,7 @@ if ($pl['id'] == 189) { } $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '". ' . $hp . ' [' . floor($btl->stats[$btl->uids[$u->info['id']]]['hpNow']) . '/' . $btl->stats[$btl->uids[$u->info['id']]]['hpAll'] . ']'; $btl->add_log($mas1); @@ -323,7 +323,7 @@ if ($pl['id'] == 189) { } elseif ($pl['id'] == 212) { //Ограниченный маневр $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . '||s2=' . $btl->users[$btl->uids[$u->info['enemy']]]['sex'] . '||t2=' . $btl->users[$btl->uids[$u->info['enemy']]]['team'] . '||login2=' . $btl->users[$btl->uids[$u->info['enemy']]]['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '" на персонажа {u2}'; $btl->add_log($mas1); $pz[(int)$id] = 1; @@ -332,7 +332,7 @@ if ($pl['id'] == 189) { //заносим в лог боя if (isset($this->ue['id'], $btl->users[$btl->uids[$this->ue['id']]]) && ($btl->users[$btl->uids[$this->ue['id']]]['team'] != $u->info['team'] && $btl->stats[$btl->uids[$this->ue['id']]]['hpNow'] >= 1)) { $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . '||s2=' . $btl->users[$btl->uids[$this->ue['id']]]['sex'] . '||t2=' . $btl->users[$btl->uids[$this->ue['id']]]['team'] . '||login2=' . $btl->users[$btl->uids[$this->ue['id']]]['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; $mas1['text'] = '{tm1} {u1} {1x16x0} прием "' . $pl['name'] . '". (Новая цель: {u2})'; $btl->add_log($mas1); $pz[(int)$id] = 1; @@ -420,7 +420,7 @@ if (isset($hpmin) && $hpmin > 0 && $u->info['enemy'] > 0) { //заносим в лог боя $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . '||s2=' . $btl->users[$btl->uids[$u->info['enemy']]]['sex'] . '||t2=' . $btl->users[$btl->uids[$u->info['enemy']]]['team'] . '||login2=' . $btl->users[$btl->uids[$u->info['enemy']]]['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => ($btl->hodID + 1), 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; if ($hpmin > 0) { $hpmin = '-' . $hpmin; } else { diff --git a/_incl_data/class/priems/muh.php b/_incl_data/class/priems/muh.php index 14efd490..c6f2a1f6 100644 --- a/_incl_data/class/priems/muh.php +++ b/_incl_data/class/priems/muh.php @@ -6,7 +6,7 @@ if(!defined('GAME')) if($st['usefromfile']=='muh' && $u->info['battle'] > 0 && $u->info['hpNow'] >= 1) { - if($btl->info['team_win'] != -1 ) { + if($btl->i->getTeamwin() != -1 ) { $u->error = 'Использовать пирожки возможно только во время боя'; }else{ $bu = mysql_fetch_array(mysql_query('SELECT * FROM `pirogi` WHERE `btl` = "'.$u->info['battle'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1')); diff --git a/_incl_data/class/priems/pirogi.php b/_incl_data/class/priems/pirogi.php index 20497e05..c0e739a2 100644 --- a/_incl_data/class/priems/pirogi.php +++ b/_incl_data/class/priems/pirogi.php @@ -6,7 +6,7 @@ if(!defined('GAME')) if($st['usefromfile']=='pirogi' && $u->info['battle'] > 0 && $u->info['hpNow'] >= 1) { - if($btl->info['team_win'] != -1 ) { + if($btl->i->getTeamwin() != -1 ) { $u->error = 'Использовать пирожки возможно только во время боя'; }else{ $bu = mysql_fetch_array(mysql_query('SELECT * FROM `pirogi` WHERE `btl` = "'.$u->info['battle'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1')); diff --git a/_incl_data/class/priems/pirogi2.php b/_incl_data/class/priems/pirogi2.php index 394bf18d..f78d8d16 100644 --- a/_incl_data/class/priems/pirogi2.php +++ b/_incl_data/class/priems/pirogi2.php @@ -7,7 +7,7 @@ if(!defined('GAME')) if($st['usefromfile']=='pirogi2' && $u->info['battle'] > 0 && $u->info['hpNow'] >= 1) { - if($btl->info['team_win'] != -1 ) { + if($btl->i->getTeamwin() != -1 ) { $u->error = 'Использовать пирожки возможно только во время боя'; }else{ $bu = mysql_fetch_array(mysql_query('SELECT * FROM `pirogi` WHERE `btl` = "'.$u->info['battle'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1')); diff --git a/_incl_data/class/priems/test.php b/_incl_data/class/priems/test.php index 730d8dbb..d7e563af 100644 --- a/_incl_data/class/priems/test.php +++ b/_incl_data/class/priems/test.php @@ -255,7 +255,7 @@ OR `name` LIKE "Пожирающее Пламя%" OR `name` LIKE "Переохл mysql_query('UPDATE `eff_users` SET `data` = "' . $dell['data'] . '", `x`="' . $dell['x'] . '" WHERE `id` = "' . $dell['id'] . '"'); $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; $mas1['text'] = '{u1} Ослабил эфект "' . $dell['name'] . '" с помощью Очиститься Кровью .'; $btl->add_log($mas1); } @@ -285,7 +285,7 @@ if (isset($hpadd)) { $upd = mysql_query('UPDATE `stats` SET `hpNow` = ' . $u->info['hpNow'] . ' WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); if ($upd) { $vLog = 'time1=' . time() . '||s1=' . $u->info['sex'] . '||t1=' . $u->info['team'] . '||login1=' . $u->info['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; if ($hpadd > 0) { $hpadd = '+' . ceil($hpadd); } else { @@ -324,7 +324,7 @@ if (isset($hpadd)) { $upd = mysql_query('UPDATE `stats` SET `hpNow` = ' . $btl->stats[$btl->uids[$ue['id']]]['hpNow'] . ' WHERE `id` = "' . $btl->users[$btl->uids[$ue['id']]]['id'] . '" LIMIT 1'); if ($upd) { $vLog = 'time1=' . time() . '||s1=' . $btl->users[$btl->uids[$ue['id']]]['sex'] . '||t1=' . $btl->users[$btl->uids[$ue['id']]]['team'] . '||login1=' . $btl->users[$btl->uids[$ue['id']]]['login'] . ''; - $mas1 = ['time' => time(), 'battle' => $btl->info['id'], 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; + $mas1 = ['time' => time(), 'battle' => $btl->i->id, 'id_hod' => $btl->hodID, 'text' => '', 'vars' => $vLog, 'zona1' => '', 'zonb1' => '', 'zona2' => '', 'zonb2' => '', 'type' => '1']; if ($hpadd_pr > 0) { $hpadd_pr = '+' . ceil($hpadd_pr); } else { diff --git a/_incl_data/class/priems/veter1.php b/_incl_data/class/priems/veter1.php index 06e29d58..2ffa0fcf 100644 --- a/_incl_data/class/priems/veter1.php +++ b/_incl_data/class/priems/veter1.php @@ -6,7 +6,7 @@ if(!defined('GAME')) if($st['usefromfile']=='veter1' && $u->info['battle'] > 0 && $u->info['hpNow'] >= 1) { - if($btl->info['team_win'] != -1 ) { + if($btl->i->getTeamwin() != -1 ) { $u->error = 'Использовать кольцо возможно только во время боя'; }else{ $bu = mysql_fetch_array(mysql_query('SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = "228" AND `delete` = "0" LIMIT 1')); diff --git a/_incl_data/class/priems/water.php b/_incl_data/class/priems/water.php index 10c265ab..98583219 100644 --- a/_incl_data/class/priems/water.php +++ b/_incl_data/class/priems/water.php @@ -436,7 +436,7 @@ if(isset($hod)) $cup = true; }else{ $vLog = 'time1='.time().'||s1='.$u->info['sex'].'||t1='.$u->info['team'].'||login1='.$u->info['login']; - $mas1 = array('time'=>time(),'battle'=>$btl->info['id'],'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); + $mas1 = array('time'=>time(),'battle'=>$btl->i->id,'id_hod'=>($btl->hodID+1),'text'=>'','vars'=>$vLog,'zona1'=>'','zonb1'=>'','zona2'=>'','zonb2'=>'','type'=>'1'); $mas1['text'] = '{tm1} {u1} {1x16x0} прием "'.$pl['name'].'". (Сняты задержки на магию Воды)'; $btl->add_log($mas1); } diff --git a/jx/battle/refresh.php b/jx/battle/refresh.php index 222e1f70..34281d40 100644 --- a/jx/battle/refresh.php +++ b/jx/battle/refresh.php @@ -158,14 +158,14 @@ if (!$isBattle) { $btl->testFinish(); } - if ($btl->info['team_win'] == -1) { + if ($btl->i->getTeamwin() == -1) { $js .= $btl->genTeams($u->info['id']); } else { $btl->mainStatus = 3; $btl->e = $u->btl_txt; } - if ($btl->info['id'] == $u->info['lider']) { + if ($btl->i->id == $u->info['lider']) { $js .= '$("#btn_down_img3").show();$("#btn_down_img4").show();'; } else { $js .= '$("#btn_down_img3").hide();$("#btn_down_img4").hide();'; @@ -186,14 +186,14 @@ if (!$isBattle) { $btl->mainStatus = 2; } elseif ( $u->info['enemy'] != 0 && - $btl->info['team_win'] == -1 && + $btl->i->getTeamwin() == -1 && $u->info['hpNow'] >= 1 ) { $js .= $btl->myInfo($u->info['enemy'], 2); } - if ($btl->info['izlom'] > 0) { - $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; + if ($btl->i->izlom > 0) { + $js .= 'volna(' . (1 + $btl->i->izlomroundsee) . ');'; } $i = 1; @@ -218,7 +218,7 @@ if (!$isBattle) { $atk1 = isset($btl->ga[$u->info['enemy']][$u->info['id']]) ? 1 : 0; $nabito = floor($btl->users[$btl->uids[$u->info['id']]]['battle_yron']); $expmaybe = floor($btl->users[$btl->uids[$u->info['id']]]['battle_exp']); - $tmr = round(($btl->info['timeout'] / 60), 2); + $tmr = round(($btl->i->timeout / 60), 2); $persMagic = $u->btlMagicList(); $za = (int)$btl->stats[$btl->uids[$u->info['id']]]['zona']; $zb = (int)$btl->testZonbVis(); diff --git a/jx/battle/refresh1.php b/jx/battle/refresh1.php index 4ef703a7..7fd9144f 100644 --- a/jx/battle/refresh1.php +++ b/jx/battle/refresh1.php @@ -57,11 +57,9 @@ if (!isset($CRON_CORE)) { } } -$btl->is = $u->is; -$btl->items = $u->items; -$btl->info = $btl->battleInfo($u->info['battle']); +$isBattle = $btl->initRefresh($u); -if (!isset($btl->info['id'])) { +if (!$isBattle) { if ($u->info['battle'] == -1) { //завершаем поединок $upd = mysql_query( @@ -142,7 +140,7 @@ if (!isset($btl->info['id'])) { if (!isset($_POST['usepriem'])) { $btl->testFinish(); } - if ($btl->info['team_win'] == -1) { + if ($btl->i->getTeamwin() == -1) { $js .= $btl->genTeams($u->info['id']); } else { $btl->mainStatus = 3; @@ -160,12 +158,12 @@ if (!isset($btl->info['id'])) { $btl->mainStatus = 2; } } else { - if ($u->info['enemy'] != 0 && $btl->info['team_win'] == -1 && $u->info['hpNow'] >= 1) { + if ($u->info['enemy'] != 0 && $btl->i->getTeamwin() == -1 && $u->info['hpNow'] >= 1) { $js .= $btl->myInfo($u->info['enemy'], 2); } } - if ($btl->info['izlom'] > 0) { - $js .= 'volna(' . (1 + $btl->info['izlomRoundSee']) . ');'; + if ($btl->i->izlom > 0) { + $js .= 'volna(' . (1 + $btl->i->izlomroundsee) . ');'; } $i = 1; while ($i <= 7) { @@ -200,7 +198,7 @@ if (!isset($btl->info['id'])) { } unset($jslog); //} - $rehtml .= '