Отлично, загрузи ещё как минимум common.j, чтобы люди сами могли глянуть. Я не всё новое смог вставить, на сайте ломалось форматирование.
Я все файлы прикрепил в предыдущему комментарию.
Обновлена функция GetCurrentCameraSetup(), так как в common.j были добавлены новые переменные типа camerafield.
Исправлена утечка в SmartCameraPanBJ(...).
Добавлена переменная boolean bj_lastInstObjFuncSuccessful. Изначально имеет значение true.
Добавлена функция BlzIsLastInstanceObjectFunctionSuccessful(), которая возвращает значение bj_lastInstObjFuncSuccessful.
Добавлены функции типа Set, Add, Remove по взаимодействию с полями Редактора Объектов. Они являются аналогами таких же функций из common.j с сохранением статуса вызванной операции в bj_lastInstObjFuncSuccessful.
cheats.j
Обновлена функция DebugCamInfo(): добавлен вывод информации о новых camerafield.
common.j
Добавлены типы.
types
// Типы для новых функций UI.
type framehandle extends handle
type originframetype extends handle
type framepointtype extends handle
type textaligntype extends handle
type frameeventtype extends handle
// Типы для клавиш на клавиатуре и не только.
type oskeytype extends handle
// Типы для считывания информации из Редактора Объектов.
type abilityintegerfield extends handle
type abilityrealfield extends handle
type abilitybooleanfield extends handle
type abilitystringfield extends handle
type abilityintegerlevelfield extends handle
type abilityreallevelfield extends handle
type abilitybooleanlevelfield extends handle
type abilitystringlevelfield extends handle
type abilityintegerlevelarrayfield extends handle
type abilityreallevelarrayfield extends handle
type abilitybooleanlevelarrayfield extends handle
type abilitystringlevelarrayfield extends handle
type unitintegerfield extends handle
type unitrealfield extends handle
type unitbooleanfield extends handle
type unitstringfield extends handle
type unitweaponintegerfield extends handle
type unitweaponrealfield extends handle
type unitweaponbooleanfield extends handle
type unitweaponstringfield extends handle
type itemintegerfield extends handle
type itemrealfield extends handle
type itembooleanfield extends handle
type itemstringfield extends handle
type movetype extends handle
type targetflag extends handle
type armortype extends handle
type heroattribute extends handle
type defensetype extends handle
type regentype extends handle
type unitcategory extends handle
type pathingflag extends handle
Добавлены нативки, которые используются для конвертации ID в объекты, типы которых были перечислены выше. С помощью их задаются переменные с осмысленным названием, которые потом и используются.
Добавлены константы, о которых была речь выше. Их ОЧЕНЬ много, потому лучше просмотрите их сами в прикреплённом файле.
Добавлены события.
events
// События конкретного юнита.
constant unitevent EVENT_UNIT_DAMAGING = ConvertUnitEvent(314)
// События для всех юнитов игрока.
constant playerunitevent EVENT_PLAYER_UNIT_DAMAGED = ConvertPlayerUnitEvent(308)
constant playerunitevent EVENT_PLAYER_UNIT_DAMAGING = ConvertPlayerUnitEvent(315)
// Игровые события.
constant gameevent EVENT_GAME_CUSTOM_UI_FRAME = ConvertGameEvent(310)
// События для игрока.
constant playerevent EVENT_PLAYER_SYNC_DATA = ConvertPlayerEvent(309)
constant playerevent EVENT_PLAYER_KEY = ConvertPlayerEvent(311)
constant playerevent EVENT_PLAYER_KEY_DOWN = ConvertPlayerEvent(312)
constant playerevent EVENT_PLAYER_KEY_UP = ConvertPlayerEvent(313)
Обновлены функции по добавлению и удалению юнита из группы.
changes
// Было.
native GroupAddUnit takes group whichGroup, unit whichUnit returns nothing
native GroupRemoveUnit takes group whichGroup, unit whichUnit returns nothing
// Стало.
native GroupAddUnit takes group whichGroup, unit whichUnit returns boolean
native GroupRemoveUnit takes group whichGroup, unit whichUnit returns boolean
Добавлены функции для работы с группами юнитов. Долой BJ аналоги!
natives
native BlzGroupAddGroupFast takes group whichGroup, group addGroup returns integer
native BlzGroupRemoveGroupFast takes group whichGroup, group removeGroup returns integer
native BlzGroupGetSize takes group whichGroup returns integer
native BlzGroupUnitAt takes group whichGroup, integer index returns unit
Добавлена функция для определения наличия конкретного игрока в группе игроков.
native
native BlzForceHasPlayer takes force whichForce, player whichPlayer returns boolean
Добавлены функция по сохранению и загрузке из хеш-таблицы объектов типа framehandle.
native BlzGetUnitAbility takes unit whichUnit, integer abilId returns ability
native BlzGetUnitAbilityByIndex takes unit whichUnit, integer index returns ability
native BlzPauseUnitEx takes unit whichUnit, boolean flag returns nothing
Добавлены функции для эффектов.
natives
native BlzGetSpecialEffectScale takes effect whichEffect returns real
native BlzSetSpecialEffectMatrixScale takes effect whichEffect, real x, real y, real z returns nothing
native BlzResetSpecialEffectMatrix takes effect whichEffect returns nothing
Добавлены функции битовых операций для целых чисел.
natives
native BlzBitOr takes integer x, integer y returns integer
native BlzBitAnd takes integer x, integer y returns integer
native BlzBitXor takes integer x, integer y returns integer
Добавлены функции по работе с синхронизацией и событием EVENT_PLAYER_SYNC_DATA.
Добавлены функции для получения, добавления, удаления и изменения значений полей Редактора Объектов. Не для всех новых типов были добавлены такие функции, например у armortype или heroattribute их нет.
natives
// Ability
native BlzGetAbilityBooleanField takes ability whichAbility, abilitybooleanfield whichField returns boolean
native BlzGetAbilityIntegerField takes ability whichAbility, abilityintegerfield whichField returns integer
native BlzGetAbilityRealField takes ability whichAbility, abilityrealfield whichField returns real
native BlzGetAbilityStringField takes ability whichAbility, abilitystringfield whichField returns string
native BlzGetAbilityBooleanLevelField takes ability whichAbility, abilitybooleanlevelfield whichField, integer level returns boolean
native BlzGetAbilityIntegerLevelField takes ability whichAbility, abilityintegerlevelfield whichField, integer level returns integer
native BlzGetAbilityRealLevelField takes ability whichAbility, abilityreallevelfield whichField, integer level returns real
native BlzGetAbilityStringLevelField takes ability whichAbility, abilitystringlevelfield whichField, integer level returns string
native BlzGetAbilityBooleanLevelArrayField takes ability whichAbility, abilitybooleanlevelarrayfield whichField, integer level, integer index returns boolean
native BlzGetAbilityIntegerLevelArrayField takes ability whichAbility, abilityintegerlevelarrayfield whichField, integer level, integer index returns integer
native BlzGetAbilityRealLevelArrayField takes ability whichAbility, abilityreallevelarrayfield whichField, integer level, integer index returns real
native BlzGetAbilityStringLevelArrayField takes ability whichAbility, abilitystringlevelarrayfield whichField, integer level, integer index returns string
native BlzSetAbilityBooleanField takes ability whichAbility, abilitybooleanfield whichField, boolean value returns boolean
native BlzSetAbilityIntegerField takes ability whichAbility, abilityintegerfield whichField, integer value returns boolean
native BlzSetAbilityRealField takes ability whichAbility, abilityrealfield whichField, real value returns boolean
native BlzSetAbilityStringField takes ability whichAbility, abilitystringfield whichField, string value returns boolean
native BlzSetAbilityBooleanLevelField takes ability whichAbility, abilitybooleanlevelfield whichField, integer level, boolean value returns boolean
native BlzSetAbilityIntegerLevelField takes ability whichAbility, abilityintegerlevelfield whichField, integer level, integer value returns boolean
native BlzSetAbilityRealLevelField takes ability whichAbility, abilityreallevelfield whichField, integer level, real value returns boolean
native BlzSetAbilityStringLevelField takes ability whichAbility, abilitystringlevelfield whichField, integer level, string value returns boolean
native BlzSetAbilityBooleanLevelArrayField takes ability whichAbility, abilitybooleanlevelarrayfield whichField, integer level, integer index, boolean value returns boolean
native BlzSetAbilityIntegerLevelArrayField takes ability whichAbility, abilityintegerlevelarrayfield whichField, integer level, integer index, integer value returns boolean
native BlzSetAbilityRealLevelArrayField takes ability whichAbility, abilityreallevelarrayfield whichField, integer level, integer index, real value returns boolean
native BlzSetAbilityStringLevelArrayField takes ability whichAbility, abilitystringlevelarrayfield whichField, integer level, integer index, string value returns boolean
native BlzAddAbilityBooleanLevelArrayField takes ability whichAbility, abilitybooleanlevelarrayfield whichField, integer level, boolean value returns boolean
native BlzAddAbilityIntegerLevelArrayField takes ability whichAbility, abilityintegerlevelarrayfield whichField, integer level, integer value returns boolean
native BlzAddAbilityRealLevelArrayField takes ability whichAbility, abilityreallevelarrayfield whichField, integer level, real value returns boolean
native BlzAddAbilityStringLevelArrayField takes ability whichAbility, abilitystringlevelarrayfield whichField, integer level, string value returns boolean
native BlzRemoveAbilityBooleanLevelArrayField takes ability whichAbility, abilitybooleanlevelarrayfield whichField, integer level, boolean value returns boolean
native BlzRemoveAbilityIntegerLevelArrayField takes ability whichAbility, abilityintegerlevelarrayfield whichField, integer level, integer value returns boolean
native BlzRemoveAbilityRealLevelArrayField takes ability whichAbility, abilityreallevelarrayfield whichField, integer level, real value returns boolean
native BlzRemoveAbilityStringLevelArrayField takes ability whichAbility, abilitystringlevelarrayfield whichField, integer level, string value returns boolean
// Item
native BlzGetItemAbilityByIndex takes item whichItem, integer index returns ability
native BlzGetItemAbility takes item whichItem, integer abilCode returns ability
native BlzItemAddAbility takes item whichItem, integer abilCode returns boolean
native BlzGetItemBooleanField takes item whichItem, itembooleanfield whichField returns boolean
native BlzGetItemIntegerField takes item whichItem, itemintegerfield whichField returns integer
native BlzGetItemRealField takes item whichItem, itemrealfield whichField returns real
native BlzGetItemStringField takes item whichItem, itemstringfield whichField returns string
native BlzSetItemBooleanField takes item whichItem, itembooleanfield whichField, boolean value returns boolean
native BlzSetItemIntegerField takes item whichItem, itemintegerfield whichField, integer value returns boolean
native BlzSetItemRealField takes item whichItem, itemrealfield whichField, real value returns boolean
native BlzSetItemStringField takes item whichItem, itemstringfield whichField, string value returns boolean
native BlzItemRemoveAbility takes item whichItem, integer abilCode returns boolean
// Unit
native BlzGetUnitBooleanField takes unit whichUnit, unitbooleanfield whichField returns boolean
native BlzGetUnitIntegerField takes unit whichUnit, unitintegerfield whichField returns integer
native BlzGetUnitRealField takes unit whichUnit, unitrealfield whichField returns real
native BlzGetUnitStringField takes unit whichUnit, unitstringfield whichField returns string
native BlzSetUnitBooleanField takes unit whichUnit, unitbooleanfield whichField, boolean value returns boolean
native BlzSetUnitIntegerField takes unit whichUnit, unitintegerfield whichField, integer value returns boolean
native BlzSetUnitRealField takes unit whichUnit, unitrealfield whichField, real value returns boolean
native BlzSetUnitStringField takes unit whichUnit, unitstringfield whichField, string value returns boolean
// Unit Weapon
native BlzGetUnitWeaponBooleanField takes unit whichUnit, unitweaponbooleanfield whichField, integer index returns boolean
native BlzGetUnitWeaponIntegerField takes unit whichUnit, unitweaponintegerfield whichField, integer index returns integer
native BlzGetUnitWeaponRealField takes unit whichUnit, unitweaponrealfield whichField, integer index returns real
native BlzGetUnitWeaponStringField takes unit whichUnit, unitweaponstringfield whichField, integer index returns string
native BlzSetUnitWeaponBooleanField takes unit whichUnit, unitweaponbooleanfield whichField, integer index, boolean value returns boolean
native BlzSetUnitWeaponIntegerField takes unit whichUnit, unitweaponintegerfield whichField, integer index, integer value returns boolean
native BlzSetUnitWeaponRealField takes unit whichUnit, unitweaponrealfield whichField, integer index, real value returns boolean
native BlzSetUnitWeaponStringField takes unit whichUnit, unitweaponstringfield whichField, integer index, string value returns boolean
через функции урона... хотя по идее какая разница, результат же тот же
В UnitDamageTarget() можно указать тип атаки, урона и оружия, а эта функция вызывает события получения урона. BlzGetUnitWeaponIntegerField позволяет найти типы атаки, урона и оружия у атаки ЮНИТА, а BlzGetEvent.*Type типы атаки, урона и оружия у входящего УРОНА.
Так что результат далеко не тот же самый.
Сегодня вечером закончу разбирать common.j, кину сюда. Там будут структурированы все изменения и добавления. Больших подробностей не будет, но будет все замечания из патчноута.
attacktype - тип атаки, может быть "Герой", "Хаос" и так далее. damagetype - тип урона, может быть магическим, чистым и так далее. weapontype влияет на звук при попадании снаряда.
Все эти типы были с самого запуска варика, как минимум в 1.26 они есть и никаким изменениям не подверглись.
Начну с простого. Изменения по сравнению с 1.30.4.
common.ai - без изменений.
blizzard.j
Добавлена переменная boolean bj_lastInstObjFuncSuccessful. Хранит информацию о том, была ли последняя операция с полями Редактора объектов завершена успешно или нет.
Обновлена функция GetCurrentCameraSetup(), так как в common.j были добавлены новые переменные типа camerafield.
Исправлена утечка в SmartCameraPanBJ(...).
Добавлены функции типа Set, Add, Remove по взаимодействию с полями Редактора Объектов. Аналоги таких же функций из common.j с сохранением статуса вызванной операции в bj_lastInstObjFuncSuccessful.
cheats.j
Обновлена функция DebugCamInfo(). Добавлен вывод информации о новых camerafield.
Можно сразу все действия делать в фильтре, так будет гораздо быстрее.
Согласно тестам DracoL1ch, вытаскивание юнитов группы через FirstOfGroup() и выполнение над ними нужных действий в цикле будет быстрее ForGroup().
Примеры
struct Tower
...
private static method DistributeExpFilterFunc takes nothing returns nothing
local thistype t = GetUnitUserData(GetFilterUnit())
if IsFilterUnitTower() and t.isReady and t.data.hasexp and t.selfupgrade then
call t.addExp(TransmittedExpAmount)
endif
endmethod
private static boolexpr DistributeExpFilter
private static integer TransmittedExpAmount
static method distributeExp takes Minion m, thistype killer returns nothing
local real x = GetUnitX(m.minion)
local real y = GetUnitY(m.minion)
set TransmittedExpAmount = m.data.towexpgain
// Add to killer if it has experience, is upgradable, but is out of range.
if killer.data.hasexp and killer.selfupgrade and not IsUnitInRangeXY(killer.tower, x, y, ExpRange) then
call killer.addExp(TransmittedExpAmount)
endif
call GroupEnumUnitsInRange(bj_lastCreatedGroup, x, y, ExpRange, DistributeExpFilter)
endmethod
...
private static method UpgradeTowerFilterFunc takes nothing returns boolean
local thistype t = GetUnitUserData(GetFilterUnit())
return IsFilterUnitTower() and t.isReady and not t.data.hasexp and t.selfupgrade and t.owner.isGoldEnough(t.ToNextLevel)
endmethod
private static boolexpr UpgradeTowerFilter
static method upgradeTower takes thistype this returns nothing
local thistype array selected
local thistype temp1
local thistype temp2
local integer n = -1
local integer i = -1
local group g = CreateGroup()
local unit u
call GroupEnumUnitsSelected(g, this.owner.user, UpgradeTowerFilter)
// Sort selected towers from tower with the lowest cost to the highest.
loop
set u = FirstOfGroup(g)
exitwhen u == null
call GroupRemoveUnit(g, u)
set temp1 = GetUnitUserData(u)
set n = n + 1
set selected[n] = temp1
loop
exitwhen i < 0 or selected[i].ToNextLevel <= temp1.ToNextLevel
set temp2 = selected[i]
set selected[i] = temp1
set selected[i + 1] = temp2
set i = i - 1
endloop
set i = n
endloop
call DestroyGroup(g)
set g = null
if n > -1 then
// Upgrade towers starting from towers with the highest cost.
loop
set temp1 = selected[n]
exitwhen not this.owner.spendGoldNoMessage(temp1.ToNextLevel)
call temp1.incLevel()
set n = n - 1
exitwhen n == -1
endloop
else
// Raise "Not enough Gold" error.
call this.owner.messageNotEnoughGold()
endif
endmethod
private static method onInit takes nothing returns nothing
...
set DistributeExpFilter = Filter(function thistype.DistributeExpFilterFunc)
set UpgradeTowerFilter = Filter(function thistype.UpgradeTowerFilterFunc)
endmethod
endstruct
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
Я все файлы прикрепил в предыдущему комментарию.
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
Все изменения в скриптовых файлах
Прикрепляю все обновлённые файлы.
» WarCraft 3 / Восстановление. Кулдауны.
» WarCraft 3 / Официально стал доступен PTR 1.31
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
Так что результат далеко не тот же самый.
» WarCraft 3 / Официально стал доступен PTR 1.31
Если нужен именно тип атаки того, кто наносит урон (а не тип атаки самого урона), то можно так (по идее).
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
» WarCraft 3 / Официально стал доступен PTR 1.31
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
common.ai - без изменений.
Ред. PT153
» WarCraft 3 / Официально стал доступен PTR 1.31
» WarCraft 3 / Официально стал доступен PTR 1.31
Теперь эти функции возвращают boolean, по которым можно узнать, был ли добавлен\удалён юнит, как с UnitAddAbility\UnitRemoveAbility.
» WarCraft 3 / Патч 1.31, скоро?
» WarCraft 3 / Патч 1.31, скоро?
» WarCraft 3 / Патч 1.31, скоро?
Ред. PT153
» WarCraft 3 / Выбрать юнитов, выделенные игроком при условии.
» WarCraft 3 / Музыкальное оформление.
» WarCraft 3 / Музыкальное оформление.
» WarCraft 3 / Музыкальное оформление.
» WarCraft 3 / Музыкальное оформление.
» WARTRACK / WARTRACK V0.3
» WARTRACK / WARTRACK V0.3
» WarCraft 3 / Область утечки