From 2e8fc1b84271926d766f7ec651fa7141c82f8b8b Mon Sep 17 00:00:00 2001 From: Frotty Date: Mon, 3 Feb 2020 16:50:38 +0100 Subject: [PATCH] Add common.j & blizzard.j from reforged game files --- Wurstpack/resources/blizzard.j | 445 ++++++++++++++++-- Wurstpack/resources/common.j | 250 ++++++---- Wurstpack/wurstscript/blizzard.j | 445 ++++++++++++++++-- Wurstpack/wurstscript/common.j | 160 +++++-- .../src/main/resources/blizzard.j | 445 ++++++++++++++++-- .../src/main/resources/common.j | 250 ++++++---- 6 files changed, 1665 insertions(+), 330 deletions(-) diff --git a/Wurstpack/resources/blizzard.j b/Wurstpack/resources/blizzard.j index 257ccaeea..4a37738e1 100644 --- a/Wurstpack/resources/blizzard.j +++ b/Wurstpack/resources/blizzard.j @@ -33,6 +33,10 @@ globals constant real bj_QUEUE_DELAY_HINT = 5.00 constant real bj_QUEUE_DELAY_SECRET = 3.00 constant real bj_HANDICAP_EASY = 60.00 + constant real bj_HANDICAP_NORMAL = 90.00 + constant real bj_HANDICAPDAMAGE_EASY = 50.00 + constant real bj_HANDICAPDAMAGE_NORMAL = 90.00 + constant real bj_HANDICAPREVIVE_NOTHARD = 50.00 constant real bj_GAME_STARTED_THRESHOLD = 0.01 constant real bj_WAIT_FOR_COND_MIN_INTERVAL = 0.10 constant real bj_POLLED_WAIT_INTERVAL = 0.10 @@ -49,6 +53,9 @@ globals constant integer bj_MAX_STOCK_UNIT_SLOTS = 11 constant integer bj_MAX_ITEM_LEVEL = 10 + // Auto Save constants + constant integer bj_MAX_CHECKPOINTS = 5 + // Ideally these would be looked up from Units/MiscData.txt, // but there is currently no script functionality exposed to do that constant real bj_TOD_DAWN = 6.00 @@ -159,15 +166,18 @@ globals constant integer bj_CAMPAIGN_OFFSET_U = 2 constant integer bj_CAMPAIGN_OFFSET_O = 3 constant integer bj_CAMPAIGN_OFFSET_N = 4 - constant integer bj_CAMPAIGN_OFFSET_XN = 0 - constant integer bj_CAMPAIGN_OFFSET_XH = 1 - constant integer bj_CAMPAIGN_OFFSET_XU = 2 - constant integer bj_CAMPAIGN_OFFSET_XO = 3 + constant integer bj_CAMPAIGN_OFFSET_XN = 5 + constant integer bj_CAMPAIGN_OFFSET_XH = 6 + constant integer bj_CAMPAIGN_OFFSET_XU = 7 + constant integer bj_CAMPAIGN_OFFSET_XO = 8 // Mission indexing constants // Tutorial constant integer bj_MISSION_INDEX_T00 = bj_CAMPAIGN_OFFSET_T * 1000 + 0 constant integer bj_MISSION_INDEX_T01 = bj_CAMPAIGN_OFFSET_T * 1000 + 1 + constant integer bj_MISSION_INDEX_T02 = bj_CAMPAIGN_OFFSET_T * 1000 + 2 + constant integer bj_MISSION_INDEX_T03 = bj_CAMPAIGN_OFFSET_T * 1000 + 3 + constant integer bj_MISSION_INDEX_T04 = bj_CAMPAIGN_OFFSET_T * 1000 + 4 // Human constant integer bj_MISSION_INDEX_H00 = bj_CAMPAIGN_OFFSET_H * 1000 + 0 constant integer bj_MISSION_INDEX_H01 = bj_CAMPAIGN_OFFSET_H * 1000 + 1 @@ -382,7 +392,7 @@ globals constant integer bj_GAMECACHE_REAL = 2 constant integer bj_GAMECACHE_UNIT = 3 constant integer bj_GAMECACHE_STRING = 4 - + // Hashtable value types constant integer bj_HASHTABLE_BOOLEAN = 0 constant integer bj_HASHTABLE_INTEGER = 1 @@ -408,6 +418,17 @@ globals constant integer bj_MINIMAPPINGSTYLE_FLASHY = 1 constant integer bj_MINIMAPPINGSTYLE_ATTACK = 2 + // Campaign Minimap icon styles + constant integer bj_CAMPPINGSTYLE_PRIMARY = 0 + constant integer bj_CAMPPINGSTYLE_PRIMARY_GREEN = 1 + constant integer bj_CAMPPINGSTYLE_PRIMARY_RED = 2 + constant integer bj_CAMPPINGSTYLE_BONUS = 3 + constant integer bj_CAMPPINGSTYLE_TURNIN = 4 + constant integer bj_CAMPPINGSTYLE_BOSS = 5 + constant integer bj_CAMPPINGSTYLE_CONTROL_ALLY = 6 + constant integer bj_CAMPPINGSTYLE_CONTROL_NEUTRAL = 7 + constant integer bj_CAMPPINGSTYLE_CONTROL_ENEMY = 8 + // Corpse creation settings constant real bj_CORPSE_MAX_DEATH_TIME = 8.00 @@ -626,6 +647,8 @@ globals lightning bj_lastCreatedLightning = null image bj_lastCreatedImage = null ubersplat bj_lastCreatedUbersplat = null + minimapicon bj_lastCreatedMinimapIcon = null + commandbuttoneffect bj_lastCreatedCommandButtonEffect = null // Filter function vars boolexpr filterIssueHauntOrderAtLocBJ = null @@ -1214,7 +1237,8 @@ endfunction // clipping the result to 0..max in case the input is invalid. // function PercentToInt takes real percentage, integer max returns integer - local integer result = R2I(percentage * I2R(max) * 0.01) + local real realpercent = percentage * I2R(max) * 0.01 + local integer result = MathRound(realpercent) if (result < 0) then set result = 0 @@ -1310,6 +1334,14 @@ function CameraSetupApplyForPlayer takes boolean doPan, camerasetup whichSetup, endif endfunction +//=========================================================================== +function CameraSetupApplyForPlayerSmooth takes boolean doPan, camerasetup whichSetup, player whichPlayer, real forcedDuration, real easeInDuration, real easeOutDuration, real smoothFactor returns nothing + if (GetLocalPlayer() == whichPlayer) then + // Use only local code (no net traffic) within this block to avoid desyncs. + call BlzCameraSetupApplyForceDurationSmooth(whichSetup, doPan, forcedDuration, easeInDuration, easeOutDuration, smoothFactor) + endif +endfunction + //=========================================================================== function CameraSetupGetFieldSwap takes camerafield whichField, camerasetup whichSetup returns real return CameraSetupGetField(whichSetup, whichField) @@ -1648,8 +1680,8 @@ endfunction // function SubStringBJ takes string source, integer start, integer end returns string return SubString(source, start-1, end) -endfunction - +endfunction + function GetHandleIdBJ takes handle h returns integer return GetHandleId(h) endfunction @@ -1850,6 +1882,31 @@ function TriggerRegisterBuildSubmenuEventBJ takes trigger trig returns event return TriggerRegisterGameEvent(trig, EVENT_GAME_BUILD_SUBMENU) endfunction +//=========================================================================== +function TriggerRegisterBuildCommandEventBJ takes trigger trig, integer unitId returns event + call TriggerRegisterCommandEvent(trig, 'ANbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AHbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AEbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AObu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AUbu', UnitId2String(unitId)) + return TriggerRegisterCommandEvent(trig, 'AGbu', UnitId2String(unitId)) +endfunction + +//=========================================================================== +function TriggerRegisterTrainCommandEventBJ takes trigger trig, integer unitId returns event + return TriggerRegisterCommandEvent(trig, 'Aque', UnitId2String(unitId)) +endfunction + +//=========================================================================== +function TriggerRegisterUpgradeCommandEventBJ takes trigger trig, integer techId returns event + return TriggerRegisterUpgradeCommandEvent(trig, techId) +endfunction + +//=========================================================================== +function TriggerRegisterCommonCommandEventBJ takes trigger trig, string order returns event + return TriggerRegisterCommandEvent(trig, 0, order) +endfunction + //=========================================================================== function TriggerRegisterGameLoadedEventBJ takes trigger trig returns event return TriggerRegisterGameEvent(trig, EVENT_GAME_LOADED) @@ -2187,6 +2244,159 @@ function GetLastCreatedUbersplat takes nothing returns ubersplat return bj_lastCreatedUbersplat endfunction +//============================================================================ +function GetLastCreatedMinimapIcon takes nothing returns minimapicon + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconOnUnitBJ takes unit whichUnit, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIconOnUnit(whichUnit, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconAtLocBJ takes location where, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIconAtLoc(where, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconBJ takes real x, real y, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIcon(x, y, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CampaignMinimapIconUnitBJ takes unit whichUnit, integer style returns nothing + local integer red + local integer green + local integer blue + local string path + if ( style == bj_CAMPPINGSTYLE_PRIMARY ) then + // green + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_GREEN ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_RED ) then + // green + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_BONUS ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectiveBonus" ) + elseif ( style == bj_CAMPPINGSTYLE_TURNIN ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestTurnIn" ) + elseif ( style == bj_CAMPPINGSTYLE_BOSS ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestBoss" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ALLY ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_NEUTRAL ) then + // white + set red = 255 + set green = 255 + set blue = 255 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ENEMY ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + endif + call CreateMinimapIconOnUnitBJ( whichUnit, red, green, blue, path, FOG_OF_WAR_MASKED ) + call SetMinimapIconOrphanDestroy( bj_lastCreatedMinimapIcon, true ) +endfunction + + +//============================================================================ +function CampaignMinimapIconLocBJ takes location where, integer style returns nothing + local integer red + local integer green + local integer blue + local string path + if ( style == bj_CAMPPINGSTYLE_PRIMARY ) then + // green (different from the unit version) + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_GREEN ) then + // green (different from the unit version) + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_RED ) then + // green (different from the unit version) + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_BONUS ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectiveBonus" ) + elseif ( style == bj_CAMPPINGSTYLE_TURNIN ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestTurnIn" ) + elseif ( style == bj_CAMPPINGSTYLE_BOSS ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestBoss" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ALLY ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_NEUTRAL ) then + // white + set red = 255 + set green = 255 + set blue = 255 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ENEMY ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + endif + call CreateMinimapIconAtLocBJ( where, red, green, blue, path, FOG_OF_WAR_MASKED ) +endfunction + //*************************************************************************** //* @@ -2568,6 +2778,67 @@ endfunction +//*************************************************************************** +//* +//* Command Button Effect Utility Functions +//* +//*************************************************************************** + +//=========================================================================== +function CreateCommandButtonEffectBJ takes integer abilityId, string order returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(abilityId, order) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateTrainCommandButtonEffectBJ takes integer unitId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect('Aque', UnitId2String(unitId)) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateUpgradeCommandButtonEffectBJ takes integer techId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateUpgradeCommandButtonEffect(techId) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateCommonCommandButtonEffectBJ takes string order returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(0, order) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateLearnCommandButtonEffectBJ takes integer abilityId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateLearnCommandButtonEffect(abilityId) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateBuildCommandButtonEffectBJ takes integer unitId returns commandbuttoneffect + local race r = GetPlayerRace(GetLocalPlayer()) + local integer abilityId + if (r == RACE_HUMAN) then + set abilityId = 'AHbu' + elseif (r == RACE_ORC) then + set abilityId = 'AObu' + elseif (r == RACE_UNDEAD) then + set abilityId = 'AUbu' + elseif (r == RACE_NIGHTELF) then + set abilityId = 'AEbu' + else + set abilityId = 'ANbu' + endif + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(abilityId, UnitId2String(unitId)) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function GetLastCreatedCommandButtonEffectBJ takes nothing returns commandbuttoneffect + return bj_lastCreatedCommandButtonEffect +endfunction + + //*************************************************************************** //* //* Hero and Item Utility Functions @@ -2646,7 +2917,7 @@ endfunction function UnitAddItemByIdSwapped takes integer itemId, unit whichHero returns item // Create the item at the hero's feet first, and then give it to him. // This is to ensure that the item will be left at the hero's feet if - // his inventory is full. + // his inventory is full. set bj_lastCreatedItem = CreateItem(itemId, GetUnitX(whichHero), GetUnitY(whichHero)) call UnitAddItem(whichHero, bj_lastCreatedItem) return bj_lastCreatedItem @@ -2697,6 +2968,26 @@ function SuspendHeroXPBJ takes boolean flag, unit whichHero returns nothing call SuspendHeroXP(whichHero, not flag) endfunction +//=========================================================================== +function SetPlayerHandicapDamageBJ takes player whichPlayer, real handicapPercent returns nothing + call SetPlayerHandicapDamage(whichPlayer, handicapPercent * 0.01) +endfunction + +//=========================================================================== +function GetPlayerHandicapDamageBJ takes player whichPlayer returns real + return GetPlayerHandicapDamage(whichPlayer) * 100 +endfunction + +//=========================================================================== +function SetPlayerHandicapReviveTimeBJ takes player whichPlayer, real handicapPercent returns nothing + call SetPlayerHandicapReviveTime(whichPlayer, handicapPercent * 0.01) +endfunction + +//=========================================================================== +function GetPlayerHandicapReviveTimeBJ takes player whichPlayer returns real + return GetPlayerHandicapReviveTime(whichPlayer) * 100 +endfunction + //=========================================================================== function SetPlayerHandicapXPBJ takes player whichPlayer, real handicapPercent returns nothing call SetPlayerHandicapXP(whichPlayer, handicapPercent * 0.01) @@ -3024,7 +3315,7 @@ endfunction //=========================================================================== function String2OrderIdBJ takes string orderIdString returns integer local integer orderId - + // Check to see if it's a generic order. set orderId = OrderId(orderIdString) if (orderId != 0) then @@ -3589,7 +3880,7 @@ function PauseAllUnitsBJEnum takes nothing returns nothing endfunction //=========================================================================== -// Pause all units +// Pause all units function PauseAllUnitsBJ takes boolean pause returns nothing local integer index local player indexPlayer @@ -4978,7 +5269,7 @@ function PlayersAreCoAllied takes player playerA, player playerB returns boolean endfunction //=========================================================================== -// Force (whichPlayer) AI player to share vision and advanced unit control +// Force (whichPlayer) AI player to share vision and advanced unit control // with all AI players of its allies. // function ShareEverythingWithTeamAI takes player whichPlayer returns nothing @@ -5026,7 +5317,7 @@ endfunction //=========================================================================== // Creates a 'Neutral Victim' player slot. This slot is passive towards all // other players, but all other players are aggressive towards him/her. -// +// function ConfigureNeutralVictim takes nothing returns nothing local integer index local player indexPlayer @@ -6301,7 +6592,7 @@ function PingMinimapForForceEx takes force whichForce, real x, real y, real dura else // Unrecognized ping style - ignore the request. endif - + //call StartSound(bj_pingMinimapSound) endif endfunction @@ -6367,8 +6658,8 @@ endfunction //=========================================================================== function SetCinematicSceneBJ takes sound soundHandle, integer portraitUnitId, playercolor color, string speakerTitle, string text, real sceneDuration, real voiceoverDuration returns nothing set bj_cineSceneLastSound = soundHandle - call PlaySoundBJ(soundHandle) call SetCinematicScene(portraitUnitId, color, speakerTitle, text, sceneDuration, voiceoverDuration) + call PlaySoundBJ(soundHandle) endfunction //=========================================================================== @@ -6442,6 +6733,8 @@ endfunction function TransmissionFromUnitWithNameBJ takes force toForce, unit whichUnit, string unitName, sound soundHandle, string message, integer timeType, real timeVal, boolean wait returns nothing call TryInitCinematicBehaviorBJ() + call AttachSoundToUnit(soundHandle, whichUnit) + // Ensure that the time value is non-negative. set timeVal = RMaxBJ(timeVal, 0) @@ -6469,6 +6762,62 @@ function TransmissionFromUnitWithNameBJ takes force toForce, unit whichUnit, str endfunction +//=========================================================================== +function PlayDialogueFromSpeakerEx takes force toForce, unit speaker, integer speakerType, sound soundHandle, integer timeType, real timeVal, boolean wait returns boolean + //Make sure that the runtime unit type and the parameter are the same, + //otherwise the offline animations will not match and will fail + if GetUnitTypeId(speaker) != speakerType then + debug call BJDebugMsg(("Attempted to play FacialAnimation with the wrong speaker UnitType - Param: " + I2S(speakerType) + " Runtime: " + I2S(GetUnitTypeId(speaker)))) + //return false + endif + + call TryInitCinematicBehaviorBJ() + + call AttachSoundToUnit(soundHandle, speaker) + + // Ensure that the time value is non-negative. + set timeVal = RMaxBJ(timeVal, 0) + + set bj_lastTransmissionDuration = GetTransmissionDuration(soundHandle, timeType, timeVal) + set bj_lastPlayedSound = soundHandle + + if (IsPlayerInForce(GetLocalPlayer(), toForce)) then + call SetCinematicSceneBJ(soundHandle, speakerType, GetPlayerColor(GetOwningPlayer(speaker)), GetLocalizedString(GetDialogueSpeakerNameKey(soundHandle)), GetLocalizedString(GetDialogueTextKey(soundHandle)), bj_lastTransmissionDuration + bj_TRANSMISSION_PORT_HANGTIME, bj_lastTransmissionDuration) + endif + + if wait and (bj_lastTransmissionDuration > 0) then + // call TriggerSleepAction(bj_lastTransmissionDuration) + call WaitTransmissionDuration(soundHandle, timeType, timeVal) + endif + + return true +endfunction + +//=========================================================================== +function PlayDialogueFromSpeakerTypeEx takes force toForce, player fromPlayer, integer speakerType, location loc, sound soundHandle, integer timeType, real timeVal, boolean wait returns boolean + call TryInitCinematicBehaviorBJ() + + // Ensure that the time value is non-negative. + set timeVal = RMaxBJ(timeVal, 0) + + set bj_lastTransmissionDuration = GetTransmissionDuration(soundHandle, timeType, timeVal) + set bj_lastPlayedSound = soundHandle + + if (IsPlayerInForce(GetLocalPlayer(), toForce)) then + call SetCinematicSceneBJ(soundHandle, speakerType, GetPlayerColor(fromPlayer), GetLocalizedString(GetDialogueSpeakerNameKey(soundHandle)), GetLocalizedString(GetDialogueTextKey(soundHandle)), bj_lastTransmissionDuration + bj_TRANSMISSION_PORT_HANGTIME, bj_lastTransmissionDuration) + if(speakerType != 0) then + call PingMinimap(GetLocationX(loc), GetLocationY(loc), bj_TRANSMISSION_PING_TIME) + endif + endif + + if wait and (bj_lastTransmissionDuration > 0) then + // call TriggerSleepAction(bj_lastTransmissionDuration) + call WaitTransmissionDuration(soundHandle, timeType, timeVal) + endif + + return true +endfunction + //=========================================================================== // This operates like TransmissionFromUnitWithNameBJ, but for a unit type // rather than a unit instance. As such, no speech indicator is employed. @@ -6540,6 +6889,7 @@ function CinematicModeExBJ takes boolean cineMode, force forForce, real interfac if (cineMode) then // Save the UI state so that we can restore it later. if (not bj_cineModeAlreadyIn) then + call SetCinematicAudio(true) set bj_cineModeAlreadyIn = true set bj_cineModePriorSpeed = GetGameSpeed() set bj_cineModePriorFogSetting = IsFogEnabled() @@ -6570,6 +6920,7 @@ function CinematicModeExBJ takes boolean cineMode, force forForce, real interfac call SetRandomSeed(0) else set bj_cineModeAlreadyIn = false + call SetCinematicAudio(false) // Perform local changes if (IsPlayerInForce(GetLocalPlayer(), forForce)) then @@ -6624,8 +6975,8 @@ function CinematicFadeCommonBJ takes real red, real green, real blue, real durat call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) call SetCineFilterStartUV(0, 0, 1, 1) call SetCineFilterEndUV(0, 0, 1, 1) - call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-startTrans)) - call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-endTrans)) + call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-startTrans)) + call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-endTrans)) call SetCineFilterDuration(duration) call DisplayCineFilter(true) endfunction @@ -6709,8 +7060,8 @@ function CinematicFilterGenericBJ takes real duration, blendmode bmode, string t call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) call SetCineFilterStartUV(0, 0, 1, 1) call SetCineFilterEndUV(0, 0, 1, 1) - call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0)) - call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1)) + call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100.0-trans0)) + call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100.0-trans1)) call SetCineFilterDuration(duration) call DisplayCineFilter(true) endfunction @@ -6957,7 +7308,7 @@ function SetCinematicAvailableBJ takes boolean available, integer cinematicIndex call PlayCinematic( "NightElfEd" ) elseif (cinematicIndex == bj_CINEMATICINDEX_XOP) then call SetOpCinematicAvailable( bj_CAMPAIGN_OFFSET_XN, available ) - call PlayCinematic( "IntroX" ) + // call PlayCinematic( "IntroX" ) elseif (cinematicIndex == bj_CINEMATICINDEX_XED) then call SetEdCinematicAvailable( bj_CAMPAIGN_OFFSET_XU, available ) call PlayCinematic( "OutroX" ) @@ -7569,6 +7920,13 @@ function IsCustomCampaignButtonVisibile takes integer whichButton returns boolea return GetCustomCampaignButtonVisible(whichButton - 1) endfunction +//=========================================================================== +// Placeholder function for auto save feature +//=========================================================================== +function SaveGameCheckPointBJ takes string mapSaveName, boolean doCheckpointHint returns nothing + call SaveGameCheckpoint(mapSaveName, doCheckpointHint) +endfunction + //=========================================================================== function LoadGameBJ takes string loadFileName, boolean doScoreScreen returns nothing call LoadGame(loadFileName, doScoreScreen) @@ -8120,7 +8478,7 @@ endfunction //=========================================================================== function MeleeClearNearbyUnits takes real x, real y, real range returns nothing local group nearbyUnits - + set nearbyUnits = CreateGroup() call GroupEnumUnitsInRange(nearbyUnits, x, y, range, null) call ForGroup(nearbyUnits, function MeleeClearExcessUnit) @@ -8282,7 +8640,7 @@ function MeleeStartingUnitsHuman takes player whichPlayer, location startLoc, bo if (nearestMine != null) then // Spawn Town Hall at the start location. set townHall = CreateUnitAtLoc(whichPlayer, 'htow', startLoc, bj_UNIT_FACING) - + // Spawn Peasants near the mine. set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0) set peonX = GetLocationX(nearMineLoc) @@ -8298,7 +8656,7 @@ function MeleeStartingUnitsHuman takes player whichPlayer, location startLoc, bo else // Spawn Town Hall at the start location. set townHall = CreateUnitAtLoc(whichPlayer, 'htow', startLoc, bj_UNIT_FACING) - + // Spawn Peasants directly south of the town hall. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8356,7 +8714,7 @@ function MeleeStartingUnitsOrc takes player whichPlayer, location startLoc, bool if (nearestMine != null) then // Spawn Great Hall at the start location. call CreateUnitAtLoc(whichPlayer, 'ogre', startLoc, bj_UNIT_FACING) - + // Spawn Peons near the mine. set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0) set peonX = GetLocationX(nearMineLoc) @@ -8372,7 +8730,7 @@ function MeleeStartingUnitsOrc takes player whichPlayer, location startLoc, bool else // Spawn Great Hall at the start location. call CreateUnitAtLoc(whichPlayer, 'ogre', startLoc, bj_UNIT_FACING) - + // Spawn Peons directly south of the town hall. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8431,7 +8789,7 @@ function MeleeStartingUnitsUndead takes player whichPlayer, location startLoc, b if (nearestMine != null) then // Spawn Necropolis at the start location. call CreateUnitAtLoc(whichPlayer, 'unpl', startLoc, bj_UNIT_FACING) - + // Replace the nearest gold mine with a blighted version. set nearestMine = BlightGoldMineForPlayerBJ(nearestMine, whichPlayer) @@ -8457,7 +8815,7 @@ function MeleeStartingUnitsUndead takes player whichPlayer, location startLoc, b else // Spawn Necropolis at the start location. call CreateUnitAtLoc(whichPlayer, 'unpl', startLoc, bj_UNIT_FACING) - + // Spawn Acolytes and Ghoul directly south of the Necropolis. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8631,7 +8989,7 @@ function MeleeStartingUnits takes nothing returns nothing set index = index + 1 exitwhen index == bj_MAX_PLAYERS endloop - + endfunction //=========================================================================== @@ -8785,7 +9143,7 @@ function MeleeGetAllyStructureCount takes player whichPlayer returns integer if (PlayersAreCoAllied(whichPlayer, indexPlayer)) then set buildingCount = buildingCount + GetPlayerStructureCount(indexPlayer, true) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -8834,12 +9192,9 @@ function MeleeGetAllyKeyStructureCount takes player whichPlayer returns integer loop set indexPlayer = Player(playerIndex) if (PlayersAreCoAllied(whichPlayer, indexPlayer)) then - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "townhall", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "greathall", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "treeoflife", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "necropolis", true, true) + set keyStructs = keyStructs + BlzGetPlayerTownHallCount(indexPlayer) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -8905,7 +9260,7 @@ endfunction //=========================================================================== // Remove all observers -// +// function MeleeRemoveObservers takes nothing returns nothing local integer playerIndex local player indexPlayer @@ -9009,7 +9364,7 @@ function MeleeCheckForLosersAndVictors takes nothing returns nothing set bj_meleeDefeated[playerIndex] = true endif endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -9175,11 +9530,11 @@ endfunction //=========================================================================== function MeleePlayerIsCrippled takes player whichPlayer returns boolean - local integer allyStructures = MeleeGetAllyStructureCount(whichPlayer) - local integer allyKeyStructures = MeleeGetAllyKeyStructureCount(whichPlayer) + local integer playerStructures = GetPlayerStructureCount(whichPlayer, true) + local integer playerKeyStructures = BlzGetPlayerTownHallCount(whichPlayer) - // Dead teams are not considered to be crippled. - return (allyStructures > 0) and (allyKeyStructures <= 0) + // Dead players are not considered to be crippled. + return (playerStructures > 0) and (playerKeyStructures <= 0) endfunction //=========================================================================== @@ -9245,7 +9600,7 @@ function MeleeCheckForCrippledPlayers takes nothing returns nothing call MeleeExposePlayer(indexPlayer, false) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -9332,7 +9687,7 @@ function MeleeTriggerActionPlayerLeft takes nothing returns nothing call CachePlayerHeroData(thePlayer) - // This is the same as defeat except the player generates the message + // This is the same as defeat except the player generates the message // "player left the game" as opposed to "player was defeated". if (MeleeGetAllyCount(thePlayer) > 0) then @@ -10134,7 +10489,7 @@ endfunction //* //* - RandomDistChoose will use the current distribution list to choose //* one of the objects randomly based on the chance distribution -//* +//* //* Note that the chances are effectively normalized by their sum, //* so only the relative values of each chance are important //* @@ -10376,7 +10731,7 @@ function BlzRemoveAbilityStringLevelArrayFieldBJ takes ability whichAbility, abi set bj_lastInstObjFuncSuccessful = BlzRemoveAbilityStringLevelArrayField(whichAbility, whichField, level, value) endfunction -// Item +// Item //============================================================= function BlzItemAddAbilityBJ takes item whichItem, integer abilCode returns nothing set bj_lastInstObjFuncSuccessful = BlzItemAddAbility(whichItem, abilCode) @@ -10408,7 +10763,7 @@ function BlzSetItemStringFieldBJ takes item whichItem, itemstringfield whichFiel endfunction -// Unit +// Unit //=========================================================================== function BlzSetUnitBooleanFieldBJ takes unit whichUnit, unitbooleanfield whichField, boolean value returns nothing set bj_lastInstObjFuncSuccessful = BlzSetUnitBooleanField(whichUnit, whichField, value) diff --git a/Wurstpack/resources/common.j b/Wurstpack/resources/common.j index 5ad446985..1bea181a6 100644 --- a/Wurstpack/resources/common.j +++ b/Wurstpack/resources/common.j @@ -56,6 +56,7 @@ type mapvisibility extends handle type mapsetting extends handle type mapdensity extends handle type mapcontrol extends handle +type minimapicon extends handle type playerslotstate extends handle type volumegroup extends handle type camerafield extends handle @@ -136,6 +137,7 @@ type defensetype extends handle type regentype extends handle type unitcategory extends handle type pathingflag extends handle +type commandbuttoneffect extends handle constant native ConvertRace takes integer i returns race @@ -245,7 +247,7 @@ constant native GetPlayerNeutralAggressive takes nothing returns integer globals //=================================================== -// Game Constants +// Game Constants //=================================================== // pfff @@ -442,7 +444,7 @@ globals constant subanimtype SUBANIM_TYPE_BERSERK = ConvertSubAnimType(62) //=================================================== -// Map Setup Constants +// Map Setup Constants //=================================================== constant racepreference RACE_PREF_HUMAN = ConvertRacePref(1) @@ -478,7 +480,7 @@ globals constant mapflag MAP_OBSERVERS_ON_DEATH = ConvertMapFlag(32) constant mapflag MAP_FIXED_COLORS = ConvertMapFlag(128) - + constant mapflag MAP_LOCK_RESOURCE_TRADING = ConvertMapFlag(256) constant mapflag MAP_RESOURCE_TRADING_ALLIES_ONLY = ConvertMapFlag(512) @@ -498,7 +500,7 @@ globals constant placement MAP_PLACEMENT_RANDOM = ConvertPlacement(0) // random among all slots constant placement MAP_PLACEMENT_FIXED = ConvertPlacement(1) // player 0 in start loc 0... constant placement MAP_PLACEMENT_USE_MAP_SETTINGS = ConvertPlacement(2) // whatever was specified by the script - constant placement MAP_PLACEMENT_TEAMS_TOGETHER = ConvertPlacement(3) // random with allies next to each other + constant placement MAP_PLACEMENT_TEAMS_TOGETHER = ConvertPlacement(3) // random with allies next to each other constant startlocprio MAP_LOC_PRIO_LOW = ConvertStartLocPrio(0) constant startlocprio MAP_LOC_PRIO_HIGH = ConvertStartLocPrio(1) @@ -613,7 +615,7 @@ globals constant playerscore PLAYER_SCORE_HERO_TOTAL = ConvertPlayerScore(22) constant playerscore PLAYER_SCORE_RESOURCE_TOTAL = ConvertPlayerScore(23) constant playerscore PLAYER_SCORE_TOTAL = ConvertPlayerScore(24) - + //=================================================== // Game, Player and Unit Events // @@ -630,14 +632,14 @@ globals //=================================================== //=================================================== - // For use with TriggerRegisterGameEvent - //=================================================== + // For use with TriggerRegisterGameEvent + //=================================================== constant gameevent EVENT_GAME_VICTORY = ConvertGameEvent(0) constant gameevent EVENT_GAME_END_LEVEL = ConvertGameEvent(1) constant gameevent EVENT_GAME_VARIABLE_LIMIT = ConvertGameEvent(2) - constant gameevent EVENT_GAME_STATE_LIMIT = ConvertGameEvent(3) + constant gameevent EVENT_GAME_STATE_LIMIT = ConvertGameEvent(3) constant gameevent EVENT_GAME_TIMER_EXPIRED = ConvertGameEvent(4) @@ -647,7 +649,7 @@ globals constant gameevent EVENT_GAME_TRACKABLE_HIT = ConvertGameEvent(7) constant gameevent EVENT_GAME_TRACKABLE_TRACK = ConvertGameEvent(8) - constant gameevent EVENT_GAME_SHOW_SKILL = ConvertGameEvent(9) + constant gameevent EVENT_GAME_SHOW_SKILL = ConvertGameEvent(9) constant gameevent EVENT_GAME_BUILD_SUBMENU = ConvertGameEvent(10) //=================================================== @@ -714,7 +716,7 @@ globals constant playerunitevent EVENT_PLAYER_UNIT_LOADED = ConvertPlayerUnitEvent(51) constant playerunitevent EVENT_PLAYER_UNIT_DAMAGED = ConvertPlayerUnitEvent(308) constant playerunitevent EVENT_PLAYER_UNIT_DAMAGING = ConvertPlayerUnitEvent(315) - + //=================================================== // For use with TriggerRegisterUnitEvent //=================================================== @@ -727,48 +729,48 @@ globals constant unitevent EVENT_UNIT_HIDDEN = ConvertUnitEvent(56) constant unitevent EVENT_UNIT_SELECTED = ConvertUnitEvent(57) constant unitevent EVENT_UNIT_DESELECTED = ConvertUnitEvent(58) - - constant unitevent EVENT_UNIT_STATE_LIMIT = ConvertUnitEvent(59) - // Events which may have a filter for the "other unit" - // + constant unitevent EVENT_UNIT_STATE_LIMIT = ConvertUnitEvent(59) + + // Events which may have a filter for the "other unit" + // constant unitevent EVENT_UNIT_ACQUIRED_TARGET = ConvertUnitEvent(60) constant unitevent EVENT_UNIT_TARGET_IN_RANGE = ConvertUnitEvent(61) constant unitevent EVENT_UNIT_ATTACKED = ConvertUnitEvent(62) constant unitevent EVENT_UNIT_RESCUED = ConvertUnitEvent(63) - + constant unitevent EVENT_UNIT_CONSTRUCT_CANCEL = ConvertUnitEvent(64) constant unitevent EVENT_UNIT_CONSTRUCT_FINISH = ConvertUnitEvent(65) - + constant unitevent EVENT_UNIT_UPGRADE_START = ConvertUnitEvent(66) constant unitevent EVENT_UNIT_UPGRADE_CANCEL = ConvertUnitEvent(67) constant unitevent EVENT_UNIT_UPGRADE_FINISH = ConvertUnitEvent(68) - - // Events which involve the specified unit performing - // training of other units - // + + // Events which involve the specified unit performing + // training of other units + // constant unitevent EVENT_UNIT_TRAIN_START = ConvertUnitEvent(69) constant unitevent EVENT_UNIT_TRAIN_CANCEL = ConvertUnitEvent(70) constant unitevent EVENT_UNIT_TRAIN_FINISH = ConvertUnitEvent(71) - + constant unitevent EVENT_UNIT_RESEARCH_START = ConvertUnitEvent(72) constant unitevent EVENT_UNIT_RESEARCH_CANCEL = ConvertUnitEvent(73) constant unitevent EVENT_UNIT_RESEARCH_FINISH = ConvertUnitEvent(74) - + constant unitevent EVENT_UNIT_ISSUED_ORDER = ConvertUnitEvent(75) constant unitevent EVENT_UNIT_ISSUED_POINT_ORDER = ConvertUnitEvent(76) constant unitevent EVENT_UNIT_ISSUED_TARGET_ORDER = ConvertUnitEvent(77) - + constant unitevent EVENT_UNIT_HERO_LEVEL = ConvertUnitEvent(78) constant unitevent EVENT_UNIT_HERO_SKILL = ConvertUnitEvent(79) - + constant unitevent EVENT_UNIT_HERO_REVIVABLE = ConvertUnitEvent(80) constant unitevent EVENT_UNIT_HERO_REVIVE_START = ConvertUnitEvent(81) constant unitevent EVENT_UNIT_HERO_REVIVE_CANCEL = ConvertUnitEvent(82) constant unitevent EVENT_UNIT_HERO_REVIVE_FINISH = ConvertUnitEvent(83) - + constant unitevent EVENT_UNIT_SUMMON = ConvertUnitEvent(84) - + constant unitevent EVENT_UNIT_DROP_ITEM = ConvertUnitEvent(85) constant unitevent EVENT_UNIT_PICKUP_ITEM = ConvertUnitEvent(86) constant unitevent EVENT_UNIT_USE_ITEM = ConvertUnitEvent(87) @@ -783,7 +785,11 @@ globals //=================================================== // Frozen Throne Expansion Events // Need to be added here to preserve compat - //=================================================== + //=================================================== + + //=================================================== + // For use with TriggerRegisterGameEvent + //=================================================== constant gameevent EVENT_GAME_LOADED = ConvertGameEvent(256) constant gameevent EVENT_GAME_TOURNAMENT_FINISH_SOON = ConvertGameEvent(257) @@ -840,7 +846,7 @@ globals constant unitevent EVENT_UNIT_PAWN_ITEM = ConvertUnitEvent(294) //=================================================== - // Limit Event API constants + // Limit Event API constants // variable, player state, game state, and unit state events // ( do NOT change the order of these... ) //=================================================== @@ -878,9 +884,9 @@ globals constant unittype UNIT_TYPE_MECHANICAL = ConvertUnitType(15) constant unittype UNIT_TYPE_PEON = ConvertUnitType(16) constant unittype UNIT_TYPE_SAPPER = ConvertUnitType(17) - constant unittype UNIT_TYPE_TOWNHALL = ConvertUnitType(18) + constant unittype UNIT_TYPE_TOWNHALL = ConvertUnitType(18) constant unittype UNIT_TYPE_ANCIENT = ConvertUnitType(19) - + constant unittype UNIT_TYPE_TAUREN = ConvertUnitType(20) constant unittype UNIT_TYPE_POISONED = ConvertUnitType(21) constant unittype UNIT_TYPE_POLYMORPHED = ConvertUnitType(22) @@ -929,7 +935,7 @@ globals constant blendmode BLEND_MODE_ADDITIVE = ConvertBlendMode(3) constant blendmode BLEND_MODE_MODULATE = ConvertBlendMode(4) constant blendmode BLEND_MODE_MODULATE_2X = ConvertBlendMode(5) - + constant raritycontrol RARITY_FREQUENT = ConvertRarityControl(0) constant raritycontrol RARITY_RARE = ConvertRarityControl(1) @@ -970,24 +976,29 @@ globals // Custom UI API constants //=================================================== - constant originframetype ORIGIN_FRAME_GAME_UI = ConvertOriginFrameType(0) - constant originframetype ORIGIN_FRAME_COMMAND_BUTTON = ConvertOriginFrameType(1) - constant originframetype ORIGIN_FRAME_HERO_BAR = ConvertOriginFrameType(2) - constant originframetype ORIGIN_FRAME_HERO_BUTTON = ConvertOriginFrameType(3) - constant originframetype ORIGIN_FRAME_HERO_HP_BAR = ConvertOriginFrameType(4) - constant originframetype ORIGIN_FRAME_HERO_MANA_BAR = ConvertOriginFrameType(5) - constant originframetype ORIGIN_FRAME_HERO_BUTTON_INDICATOR = ConvertOriginFrameType(6) - constant originframetype ORIGIN_FRAME_ITEM_BUTTON = ConvertOriginFrameType(7) - constant originframetype ORIGIN_FRAME_MINIMAP = ConvertOriginFrameType(8) - constant originframetype ORIGIN_FRAME_MINIMAP_BUTTON = ConvertOriginFrameType(9) - constant originframetype ORIGIN_FRAME_SYSTEM_BUTTON = ConvertOriginFrameType(10) - constant originframetype ORIGIN_FRAME_TOOLTIP = ConvertOriginFrameType(11) - constant originframetype ORIGIN_FRAME_UBERTOOLTIP = ConvertOriginFrameType(12) - constant originframetype ORIGIN_FRAME_CHAT_MSG = ConvertOriginFrameType(13) - constant originframetype ORIGIN_FRAME_UNIT_MSG = ConvertOriginFrameType(14) - constant originframetype ORIGIN_FRAME_TOP_MSG = ConvertOriginFrameType(15) - constant originframetype ORIGIN_FRAME_PORTRAIT = ConvertOriginFrameType(16) - constant originframetype ORIGIN_FRAME_WORLD_FRAME = ConvertOriginFrameType(17) + constant originframetype ORIGIN_FRAME_GAME_UI = ConvertOriginFrameType(0) + constant originframetype ORIGIN_FRAME_COMMAND_BUTTON = ConvertOriginFrameType(1) + constant originframetype ORIGIN_FRAME_HERO_BAR = ConvertOriginFrameType(2) + constant originframetype ORIGIN_FRAME_HERO_BUTTON = ConvertOriginFrameType(3) + constant originframetype ORIGIN_FRAME_HERO_HP_BAR = ConvertOriginFrameType(4) + constant originframetype ORIGIN_FRAME_HERO_MANA_BAR = ConvertOriginFrameType(5) + constant originframetype ORIGIN_FRAME_HERO_BUTTON_INDICATOR = ConvertOriginFrameType(6) + constant originframetype ORIGIN_FRAME_ITEM_BUTTON = ConvertOriginFrameType(7) + constant originframetype ORIGIN_FRAME_MINIMAP = ConvertOriginFrameType(8) + constant originframetype ORIGIN_FRAME_MINIMAP_BUTTON = ConvertOriginFrameType(9) + constant originframetype ORIGIN_FRAME_SYSTEM_BUTTON = ConvertOriginFrameType(10) + constant originframetype ORIGIN_FRAME_TOOLTIP = ConvertOriginFrameType(11) + constant originframetype ORIGIN_FRAME_UBERTOOLTIP = ConvertOriginFrameType(12) + constant originframetype ORIGIN_FRAME_CHAT_MSG = ConvertOriginFrameType(13) + constant originframetype ORIGIN_FRAME_UNIT_MSG = ConvertOriginFrameType(14) + constant originframetype ORIGIN_FRAME_TOP_MSG = ConvertOriginFrameType(15) + constant originframetype ORIGIN_FRAME_PORTRAIT = ConvertOriginFrameType(16) + constant originframetype ORIGIN_FRAME_WORLD_FRAME = ConvertOriginFrameType(17) + constant originframetype ORIGIN_FRAME_SIMPLE_UI_PARENT = ConvertOriginFrameType(18) + constant originframetype ORIGIN_FRAME_PORTRAIT_HP_TEXT = ConvertOriginFrameType(19) + constant originframetype ORIGIN_FRAME_PORTRAIT_MANA_TEXT = ConvertOriginFrameType(20) + constant originframetype ORIGIN_FRAME_UNIT_PANEL_BUFF_BAR = ConvertOriginFrameType(21) + constant originframetype ORIGIN_FRAME_UNIT_PANEL_BUFF_BAR_LABEL = ConvertOriginFrameType(22) constant framepointtype FRAMEPOINT_TOPLEFT = ConvertFramePointType(0) constant framepointtype FRAMEPOINT_TOP = ConvertFramePointType(1) @@ -1220,7 +1231,7 @@ globals //=================================================== // Instanced Object Operation API constants //=================================================== - + // Ability constant abilityintegerfield ABILITY_IF_BUTTON_POSITION_NORMAL_X = ConvertAbilityIntegerField('abpx') constant abilityintegerfield ABILITY_IF_BUTTON_POSITION_NORMAL_Y = ConvertAbilityIntegerField('abpy') @@ -1234,7 +1245,7 @@ globals constant abilityintegerfield ABILITY_IF_PRIORITY = ConvertAbilityIntegerField('apri') constant abilityintegerfield ABILITY_IF_LEVELS = ConvertAbilityIntegerField('alev') constant abilityintegerfield ABILITY_IF_REQUIRED_LEVEL = ConvertAbilityIntegerField('arlv') - constant abilityintegerfield ABILITY_IF_LEVEL_SKIP_REQUIREMENT = ConvertAbilityIntegerField('alsk') + constant abilityintegerfield ABILITY_IF_LEVEL_SKIP_REQUIREMENT = ConvertAbilityIntegerField('alsk') constant abilitybooleanfield ABILITY_BF_HERO_ABILITY = ConvertAbilityBooleanField('aher') // Get only constant abilitybooleanfield ABILITY_BF_ITEM_ABILITY = ConvertAbilityBooleanField('aite') @@ -1607,7 +1618,7 @@ globals constant abilityreallevelfield ABILITY_RLF_EXTRA_DAMAGE_POA1 = ConvertAbilityRealLevelField('Poa1') constant abilityreallevelfield ABILITY_RLF_DAMAGE_PER_SECOND_POA2 = ConvertAbilityRealLevelField('Poa2') constant abilityreallevelfield ABILITY_RLF_ATTACK_SPEED_FACTOR_POA3 = ConvertAbilityRealLevelField('Poa3') - constant abilityreallevelfield ABILITY_RLF_MOVEMENT_SPEED_FACTOR_POA4 = ConvertAbilityRealLevelField('Poa4') + constant abilityreallevelfield ABILITY_RLF_MOVEMENT_SPEED_FACTOR_POA4 = ConvertAbilityRealLevelField('Poa4') constant abilityreallevelfield ABILITY_RLF_DAMAGE_AMPLIFICATION = ConvertAbilityRealLevelField('Pos2') constant abilityreallevelfield ABILITY_RLF_CHANCE_TO_STOMP_PERCENT = ConvertAbilityRealLevelField('War1') constant abilityreallevelfield ABILITY_RLF_DAMAGE_DEALT_WAR2 = ConvertAbilityRealLevelField('War2') @@ -2096,7 +2107,7 @@ globals constant unitweaponbooleanfield UNIT_WEAPON_BF_ATTACK_SHOW_UI = ConvertUnitWeaponBooleanField('uwu1') constant unitweaponbooleanfield UNIT_WEAPON_BF_ATTACKS_ENABLED = ConvertUnitWeaponBooleanField('uaen') constant unitweaponbooleanfield UNIT_WEAPON_BF_ATTACK_PROJECTILE_HOMING_ENABLED = ConvertUnitWeaponBooleanField('umh1') - + constant unitweaponstringfield UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART = ConvertUnitWeaponStringField('ua1m') // Move Type @@ -2108,7 +2119,7 @@ globals constant movetype MOVE_TYPE_FLOAT = ConvertMoveType(16) constant movetype MOVE_TYPE_AMPHIBIOUS = ConvertMoveType(32) constant movetype MOVE_TYPE_UNBUILDABLE = ConvertMoveType(64) - + // Target Flag constant targetflag TARGET_FLAG_NONE = ConvertTargetFlag(1) constant targetflag TARGET_FLAG_GROUND = ConvertTargetFlag(2) @@ -2205,6 +2216,8 @@ native SquareRoot takes real x returns real // native Pow takes real x, real power returns real +constant native MathRound takes real r returns integer + //============================================================================ // String Utility API native I2R takes integer i returns real @@ -2238,12 +2251,14 @@ native SetMapDescription takes string description returns nothing native SetTeams takes integer teamcount returns nothing native SetPlayers takes integer playercount returns nothing -native DefineStartLocation takes integer whichStartLoc, real x, real y returns nothing -native DefineStartLocationLoc takes integer whichStartLoc, location whichLocation returns nothing -native SetStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing -native SetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing -native GetStartLocPrioSlot takes integer whichStartLoc, integer prioSlotIndex returns integer -native GetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex returns startlocprio +native DefineStartLocation takes integer whichStartLoc, real x, real y returns nothing +native DefineStartLocationLoc takes integer whichStartLoc, location whichLocation returns nothing +native SetStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing +native SetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing +native GetStartLocPrioSlot takes integer whichStartLoc, integer prioSlotIndex returns integer +native GetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex returns startlocprio +native SetEnemyStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing +native SetEnemyStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing native SetGameTypeSupported takes gametype whichGameType, boolean value returns nothing native SetMapFlag takes mapflag whichMapFlag, boolean value returns nothing @@ -2276,7 +2291,7 @@ native SetPlayerStartLocation takes player whichPlayer, integer startLocIndex // which removes it from consideration for subsequently placed players // ( i.e. you can use this to put people in a fixed loc and then // use random placement for any unplaced players etc ) -native ForcePlayerStartLocation takes player whichPlayer, integer startLocIndex returns nothing +native ForcePlayerStartLocation takes player whichPlayer, integer startLocIndex returns nothing native SetPlayerColor takes player whichPlayer, playercolor color returns nothing native SetPlayerAlliance takes player sourcePlayer, player otherPlayer, alliancetype whichAllianceSetting, boolean value returns nothing native SetPlayerTaxRate takes player sourcePlayer, player otherPlayer, playerstate whichResource, integer rate returns nothing @@ -2432,6 +2447,8 @@ constant native GetEnumDestructable takes nothing returns destructable constant native GetFilterItem takes nothing returns item constant native GetEnumItem takes nothing returns item +constant native ParseTags takes string taggedString returns string + constant native GetFilterPlayer takes nothing returns player constant native GetEnumPlayer takes nothing returns player @@ -2478,7 +2495,7 @@ native TriggerRegisterDialogButtonEvent takes trigger whichTrigger, button which constant native GetEventGameState takes nothing returns gamestate native TriggerRegisterGameEvent takes trigger whichTrigger, gameevent whichGameEvent returns event - + // EVENT_GAME_VICTORY constant native GetWinningPlayer takes nothing returns player @@ -2497,6 +2514,10 @@ constant native GetLeavingUnit takes nothing returns unit native TriggerRegisterTrackableHitEvent takes trigger whichTrigger, trackable t returns event native TriggerRegisterTrackableTrackEvent takes trigger whichTrigger, trackable t returns event +// EVENT_COMMAND_BUTTON_CLICK +native TriggerRegisterCommandEvent takes trigger whichTrigger, integer whichAbility, string order returns event +native TriggerRegisterUpgradeCommandEvent takes trigger whichTrigger, integer whichUpgrade returns event + // EVENT_GAME_TRACKABLE_HIT // EVENT_GAME_TRACKABLE_TRACK constant native GetTriggeringTrackable takes nothing returns trackable @@ -2691,7 +2712,7 @@ constant native GetEventDamageSource takes nothing returns unit // EVENT_UNIT_DECAY // Use the GetDyingUnit and GetDecayingUnit funcs above -// EVENT_UNIT_DETECTED +// EVENT_UNIT_DETECTED constant native GetEventDetectingPlayer takes nothing returns player native TriggerRegisterFilterUnitEvent takes trigger whichTrigger, unit whichUnit, unitevent whichEvent, boolexpr filter returns event @@ -3092,8 +3113,12 @@ constant native GetPlayerAlliance takes player sourcePlayer, player otherP constant native GetPlayerHandicap takes player whichPlayer returns real constant native GetPlayerHandicapXP takes player whichPlayer returns real +constant native GetPlayerHandicapReviveTime takes player whichPlayer returns real +constant native GetPlayerHandicapDamage takes player whichPlayer returns real constant native SetPlayerHandicap takes player whichPlayer, real handicap returns nothing constant native SetPlayerHandicapXP takes player whichPlayer, real handicap returns nothing +constant native SetPlayerHandicapReviveTime takes player whichPlayer, real handicap returns nothing +constant native SetPlayerHandicapDamage takes player whichPlayer, real handicap returns nothing constant native SetPlayerTechMaxAllowed takes player whichPlayer, integer techid, integer maximum returns nothing constant native GetPlayerTechMaxAllowed takes player whichPlayer, integer techid returns integer @@ -3150,17 +3175,19 @@ native SetCampaignMenuRace takes race r returns nothing native SetCampaignMenuRaceEx takes integer campaignIndex returns nothing native ForceCampaignSelectScreen takes nothing returns nothing -native LoadGame takes string saveFileName, boolean doScoreScreen returns nothing -native SaveGame takes string saveFileName returns nothing -native RenameSaveDirectory takes string sourceDirName, string destDirName returns boolean -native RemoveSaveDirectory takes string sourceDirName returns boolean -native CopySaveGame takes string sourceSaveName, string destSaveName returns boolean -native SaveGameExists takes string saveName returns boolean -native SyncSelections takes nothing returns nothing -native SetFloatGameState takes fgamestate whichFloatGameState, real value returns nothing -constant native GetFloatGameState takes fgamestate whichFloatGameState returns real -native SetIntegerGameState takes igamestate whichIntegerGameState, integer value returns nothing -constant native GetIntegerGameState takes igamestate whichIntegerGameState returns integer +native LoadGame takes string saveFileName, boolean doScoreScreen returns nothing +native SaveGame takes string saveFileName returns nothing +native RenameSaveDirectory takes string sourceDirName, string destDirName returns boolean +native RemoveSaveDirectory takes string sourceDirName returns boolean +native CopySaveGame takes string sourceSaveName, string destSaveName returns boolean +native SaveGameExists takes string saveName returns boolean +native SetMaxCheckpointSaves takes integer maxCheckpointSaves returns nothing +native SaveGameCheckpoint takes string saveFileName, boolean showWindow returns nothing +native SyncSelections takes nothing returns nothing +native SetFloatGameState takes fgamestate whichFloatGameState, real value returns nothing +constant native GetFloatGameState takes fgamestate whichFloatGameState returns real +native SetIntegerGameState takes igamestate whichIntegerGameState, integer value returns nothing +constant native GetIntegerGameState takes igamestate whichIntegerGameState returns integer //============================================================================ @@ -3372,6 +3399,7 @@ native DisplayTimedTextToPlayer takes player toPlayer, real x, real y, real native DisplayTimedTextFromPlayer takes player toPlayer, real x, real y, real duration, string message returns nothing native ClearTextMessages takes nothing returns nothing native SetDayNightModels takes string terrainDNCFile, string unitDNCFile returns nothing +native SetPortraitLight takes string portraitDNCFile returns nothing native SetSkyModel takes string skyModelFile returns nothing native EnableUserControl takes boolean b returns nothing native EnableUserUI takes boolean b returns nothing @@ -3384,6 +3412,13 @@ native UnitAddIndicator takes unit whichUnit, integer red, integer g native AddIndicator takes widget whichWidget, integer red, integer green, integer blue, integer alpha returns nothing native PingMinimap takes real x, real y, real duration returns nothing native PingMinimapEx takes real x, real y, real duration, integer red, integer green, integer blue, boolean extraEffects returns nothing +native CreateMinimapIconOnUnit takes unit whichUnit, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native CreateMinimapIconAtLoc takes location where, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native CreateMinimapIcon takes real x, real y, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native SkinManagerGetLocalPath takes string key returns string +native DestroyMinimapIcon takes minimapicon pingId returns nothing +native SetMinimapIconVisible takes minimapicon whichMinimapIcon, boolean visible returns nothing +native SetMinimapIconOrphanDestroy takes minimapicon whichMinimapIcon, boolean doDestroy returns nothing native EnableOcclusion takes boolean flag returns nothing native SetIntroShotText takes string introText returns nothing native SetIntroShotModel takes string introModelPath returns nothing @@ -3437,7 +3472,7 @@ native QuestSetCompleted takes quest whichQuest, boolean completed returns n native QuestSetDiscovered takes quest whichQuest, boolean discovered returns nothing native QuestSetFailed takes quest whichQuest, boolean failed returns nothing native QuestSetEnabled takes quest whichQuest, boolean enabled returns nothing - + native IsQuestRequired takes quest whichQuest returns boolean native IsQuestCompleted takes quest whichQuest returns boolean native IsQuestDiscovered takes quest whichQuest returns boolean @@ -3586,6 +3621,8 @@ native CameraSetupApply takes camerasetup whichSetup, boolea native CameraSetupApplyWithZ takes camerasetup whichSetup, real zDestOffset returns nothing native CameraSetupApplyForceDuration takes camerasetup whichSetup, boolean doPan, real forceDuration returns nothing native CameraSetupApplyForceDurationWithZ takes camerasetup whichSetup, real zDestOffset, real forceDuration returns nothing +native BlzCameraSetupSetLabel takes camerasetup whichSetup, string label returns nothing +native BlzCameraSetupGetLabel takes camerasetup whichSetup returns string native CameraSetTargetNoise takes real mag, real velocity returns nothing native CameraSetSourceNoise takes real mag, real velocity returns nothing @@ -3595,6 +3632,9 @@ native CameraSetSourceNoiseEx takes real mag, real velocity, boolean v native CameraSetSmoothingFactor takes real factor returns nothing +native CameraSetFocalDistance takes real distance returns nothing +native CameraSetDepthOfFieldScale takes real scale returns nothing + native SetCineFilterTexture takes string filename returns nothing native SetCineFilterBlendMode takes blendmode whichMode returns nothing native SetCineFilterTexMapFlags takes texmapflags whichFlags returns nothing @@ -3609,6 +3649,7 @@ native IsCineFilterDisplayed takes nothing returns boolean native SetCinematicScene takes integer portraitUnitId, playercolor color, string speakerTitle, string text, real sceneDuration, real voiceoverDuration returns nothing native EndCinematicScene takes nothing returns nothing native ForceCinematicSubtitles takes boolean flag returns nothing +native SetCinematicAudio takes boolean cinematicAudio returns nothing native GetCameraMargin takes integer whichMargin returns real @@ -3643,7 +3684,7 @@ native SetSoundChannel takes sound soundHandle, integer channel ret native SetSoundVolume takes sound soundHandle, integer volume returns nothing native SetSoundPitch takes sound soundHandle, real pitch returns nothing -// the following method must be called immediately after calling "StartSound" +// the following method must be called immediately after calling "StartSound" native SetSoundPlayPosition takes sound soundHandle, integer millisecs returns nothing // these calls are only valid if the sound was created with 3d enabled @@ -3689,6 +3730,16 @@ native GetSoundIsLoading takes sound soundHandle returns boolean native RegisterStackedSound takes sound soundHandle, boolean byPosition, real rectwidth, real rectheight returns nothing native UnregisterStackedSound takes sound soundHandle, boolean byPosition, real rectwidth, real rectheight returns nothing +native SetSoundFacialAnimationLabel takes sound soundHandle, string animationLabel returns boolean +native SetSoundFacialAnimationGroupLabel takes sound soundHandle, string groupLabel returns boolean +native SetSoundFacialAnimationSetFilepath takes sound soundHandle, string animationSetFilepath returns boolean + +//Subtitle support that is attached to the soundHandle rather than as disperate data with the legacy UI +native SetDialogueSpeakerNameKey takes sound soundHandle, string speakerName returns boolean +native GetDialogueSpeakerNameKey takes sound soundHandle returns string +native SetDialogueTextKey takes sound soundHandle, string dialogueText returns boolean +native GetDialogueTextKey takes sound soundHandle returns string + //============================================================================ // Effects API // @@ -3814,6 +3865,13 @@ native PreloadGenStart takes nothing returns nothing native PreloadGenEnd takes string filename returns nothing native Preloader takes string filename returns nothing + +//============================================================================ +//Machinima API +//============================================================================ +native BlzHideCinematicPanels takes boolean enable returns nothing + + // Automation Test native AutomationSetTestType takes string testType returns nothing native AutomationTestStart takes string testName returns nothing @@ -3912,9 +3970,10 @@ native BlzSetUnitAbilityCooldown takes unit whichUnit, integer native BlzGetUnitAbilityCooldown takes unit whichUnit, integer abilId, integer level returns real native BlzGetUnitAbilityCooldownRemaining takes unit whichUnit, integer abilId returns real native BlzEndUnitAbilityCooldown takes unit whichUnit, integer abilCode returns nothing +native BlzStartUnitAbilityCooldown takes unit whichUnit, integer abilCode, real cooldown returns nothing native BlzGetUnitAbilityManaCost takes unit whichUnit, integer abilId, integer level returns integer native BlzSetUnitAbilityManaCost takes unit whichUnit, integer abilId, integer level, integer manaCost returns nothing -native BlzGetLocalUnitZ takes unit whichUnit returns real +native BlzGetLocalUnitZ takes unit whichUnit returns real native BlzDecPlayerTechResearched takes player whichPlayer, integer techid, integer levels returns nothing native BlzSetEventDamage takes real damage returns nothing native BlzGetEventDamageTarget takes nothing returns unit @@ -3924,6 +3983,7 @@ native BlzGetEventWeaponType takes nothing returns weaponty native BlzSetEventAttackType takes attacktype attackType returns boolean native BlzSetEventDamageType takes damagetype damageType returns boolean native BlzSetEventWeaponType takes weapontype weaponType returns boolean +native BlzGetEventIsAttack takes nothing returns boolean native RequestExtraIntegerData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns integer native RequestExtraBooleanData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns boolean native RequestExtraStringData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns string @@ -3936,6 +3996,11 @@ native BlzIsSelectionCircleEnabled takes nothing returns boolean native BlzCameraSetupApplyForceDurationSmooth takes camerasetup whichSetup, boolean doPan, real forcedDuration, real easeInDuration, real easeOutDuration, real smoothFactor returns nothing native BlzEnableTargetIndicator takes boolean enable returns nothing native BlzIsTargetIndicatorEnabled takes nothing returns boolean +native BlzShowTerrain takes boolean show returns nothing +native BlzShowSkyBox takes boolean show returns nothing +native BlzStartRecording takes integer fps returns nothing +native BlzEndRecording takes nothing returns nothing +native BlzShowUnitTeamGlow takes unit whichUnit, boolean show returns nothing native BlzGetOriginFrame takes originframetype frameType, integer index returns framehandle native BlzEnableUIAutoPosition takes boolean enable returns nothing @@ -3957,6 +4022,7 @@ native BlzFrameGetName takes framehandle frame retur native BlzFrameClick takes framehandle frame returns nothing native BlzFrameSetText takes framehandle frame, string text returns nothing native BlzFrameGetText takes framehandle frame returns string +native BlzFrameAddText takes framehandle frame, string text returns nothing native BlzFrameSetTextSizeLimit takes framehandle frame, integer size returns nothing native BlzFrameGetTextSizeLimit takes framehandle frame returns integer native BlzFrameSetTextColor takes framehandle frame, integer color returns nothing @@ -3987,6 +4053,8 @@ native BlzFrameSetTextAlignment takes framehandle frame, text native BlzTriggerRegisterFrameEvent takes trigger whichTrigger, framehandle frame, frameeventtype eventId returns event native BlzGetTriggerFrame takes nothing returns framehandle native BlzGetTriggerFrameEvent takes nothing returns frameeventtype +native BlzGetTriggerFrameValue takes nothing returns real +native BlzGetTriggerFrameText takes nothing returns string native BlzTriggerRegisterPlayerSyncEvent takes trigger whichTrigger, player whichPlayer, string prefix, boolean fromServer returns event native BlzSendSyncData takes string prefix, string data returns boolean native BlzGetTriggerSyncPrefix takes nothing returns string @@ -4012,11 +4080,17 @@ native BlzDisplayChatMessage takes player whichPlayer, int native BlzPauseUnitEx takes unit whichUnit, boolean flag returns nothing // native BlzFourCC2S takes integer value returns string // native BlzS2FourCC takes string value returns integer +native BlzSetUnitFacingEx takes unit whichUnit, real facingAngle returns nothing + +native CreateCommandButtonEffect takes integer abilityId, string order returns commandbuttoneffect +native CreateUpgradeCommandButtonEffect takes integer whichUprgade returns commandbuttoneffect +native CreateLearnCommandButtonEffect takes integer abilityId returns commandbuttoneffect +native DestroyCommandButtonEffect takes commandbuttoneffect whichEffect returns nothing // Bit Operations 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 +native BlzBitXor takes integer x, integer y returns integer // Intanced Object Operations // Ability @@ -4053,7 +4127,7 @@ native BlzRemoveAbilityIntegerLevelArrayField takes ability whichAbility, a 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 +// 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 @@ -4067,7 +4141,7 @@ native BlzSetItemRealField takes item whichItem, itemrea native BlzSetItemStringField takes item whichItem, itemstringfield whichField, string value returns boolean native BlzItemRemoveAbility takes item whichItem, integer abilCode returns boolean -// Unit +// 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 @@ -4086,3 +4160,19 @@ native BlzSetUnitWeaponBooleanField takes unit whichUnit, unitwea 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 + +// Skin +native BlzGetUnitSkin takes unit whichUnit returns integer +native BlzGetItemSkin takes item whichItem returns integer +// native BlzGetDestructableSkin takes destructable whichDestructable returns integer +native BlzSetUnitSkin takes unit whichUnit, integer skinId returns nothing +native BlzSetItemSkin takes item whichItem, integer skinId returns nothing +// native BlzSetDestructableSkin takes destructable whichDestructable, integer skinId returns nothing + +native BlzCreateItemWithSkin takes integer itemid, real x, real y, integer skinId returns item +native BlzCreateUnitWithSkin takes player id, integer unitid, real x, real y, real face, integer skinId returns unit +native BlzCreateDestructableWithSkin takes integer objectid, real x, real y, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDestructableZWithSkin takes integer objectid, real x, real y, real z, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDeadDestructableWithSkin takes integer objectid, real x, real y, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDeadDestructableZWithSkin takes integer objectid, real x, real y, real z, real face, real scale, integer variation, integer skinId returns destructable +native BlzGetPlayerTownHallCount takes player whichPlayer returns integer diff --git a/Wurstpack/wurstscript/blizzard.j b/Wurstpack/wurstscript/blizzard.j index 257ccaeea..4a37738e1 100644 --- a/Wurstpack/wurstscript/blizzard.j +++ b/Wurstpack/wurstscript/blizzard.j @@ -33,6 +33,10 @@ globals constant real bj_QUEUE_DELAY_HINT = 5.00 constant real bj_QUEUE_DELAY_SECRET = 3.00 constant real bj_HANDICAP_EASY = 60.00 + constant real bj_HANDICAP_NORMAL = 90.00 + constant real bj_HANDICAPDAMAGE_EASY = 50.00 + constant real bj_HANDICAPDAMAGE_NORMAL = 90.00 + constant real bj_HANDICAPREVIVE_NOTHARD = 50.00 constant real bj_GAME_STARTED_THRESHOLD = 0.01 constant real bj_WAIT_FOR_COND_MIN_INTERVAL = 0.10 constant real bj_POLLED_WAIT_INTERVAL = 0.10 @@ -49,6 +53,9 @@ globals constant integer bj_MAX_STOCK_UNIT_SLOTS = 11 constant integer bj_MAX_ITEM_LEVEL = 10 + // Auto Save constants + constant integer bj_MAX_CHECKPOINTS = 5 + // Ideally these would be looked up from Units/MiscData.txt, // but there is currently no script functionality exposed to do that constant real bj_TOD_DAWN = 6.00 @@ -159,15 +166,18 @@ globals constant integer bj_CAMPAIGN_OFFSET_U = 2 constant integer bj_CAMPAIGN_OFFSET_O = 3 constant integer bj_CAMPAIGN_OFFSET_N = 4 - constant integer bj_CAMPAIGN_OFFSET_XN = 0 - constant integer bj_CAMPAIGN_OFFSET_XH = 1 - constant integer bj_CAMPAIGN_OFFSET_XU = 2 - constant integer bj_CAMPAIGN_OFFSET_XO = 3 + constant integer bj_CAMPAIGN_OFFSET_XN = 5 + constant integer bj_CAMPAIGN_OFFSET_XH = 6 + constant integer bj_CAMPAIGN_OFFSET_XU = 7 + constant integer bj_CAMPAIGN_OFFSET_XO = 8 // Mission indexing constants // Tutorial constant integer bj_MISSION_INDEX_T00 = bj_CAMPAIGN_OFFSET_T * 1000 + 0 constant integer bj_MISSION_INDEX_T01 = bj_CAMPAIGN_OFFSET_T * 1000 + 1 + constant integer bj_MISSION_INDEX_T02 = bj_CAMPAIGN_OFFSET_T * 1000 + 2 + constant integer bj_MISSION_INDEX_T03 = bj_CAMPAIGN_OFFSET_T * 1000 + 3 + constant integer bj_MISSION_INDEX_T04 = bj_CAMPAIGN_OFFSET_T * 1000 + 4 // Human constant integer bj_MISSION_INDEX_H00 = bj_CAMPAIGN_OFFSET_H * 1000 + 0 constant integer bj_MISSION_INDEX_H01 = bj_CAMPAIGN_OFFSET_H * 1000 + 1 @@ -382,7 +392,7 @@ globals constant integer bj_GAMECACHE_REAL = 2 constant integer bj_GAMECACHE_UNIT = 3 constant integer bj_GAMECACHE_STRING = 4 - + // Hashtable value types constant integer bj_HASHTABLE_BOOLEAN = 0 constant integer bj_HASHTABLE_INTEGER = 1 @@ -408,6 +418,17 @@ globals constant integer bj_MINIMAPPINGSTYLE_FLASHY = 1 constant integer bj_MINIMAPPINGSTYLE_ATTACK = 2 + // Campaign Minimap icon styles + constant integer bj_CAMPPINGSTYLE_PRIMARY = 0 + constant integer bj_CAMPPINGSTYLE_PRIMARY_GREEN = 1 + constant integer bj_CAMPPINGSTYLE_PRIMARY_RED = 2 + constant integer bj_CAMPPINGSTYLE_BONUS = 3 + constant integer bj_CAMPPINGSTYLE_TURNIN = 4 + constant integer bj_CAMPPINGSTYLE_BOSS = 5 + constant integer bj_CAMPPINGSTYLE_CONTROL_ALLY = 6 + constant integer bj_CAMPPINGSTYLE_CONTROL_NEUTRAL = 7 + constant integer bj_CAMPPINGSTYLE_CONTROL_ENEMY = 8 + // Corpse creation settings constant real bj_CORPSE_MAX_DEATH_TIME = 8.00 @@ -626,6 +647,8 @@ globals lightning bj_lastCreatedLightning = null image bj_lastCreatedImage = null ubersplat bj_lastCreatedUbersplat = null + minimapicon bj_lastCreatedMinimapIcon = null + commandbuttoneffect bj_lastCreatedCommandButtonEffect = null // Filter function vars boolexpr filterIssueHauntOrderAtLocBJ = null @@ -1214,7 +1237,8 @@ endfunction // clipping the result to 0..max in case the input is invalid. // function PercentToInt takes real percentage, integer max returns integer - local integer result = R2I(percentage * I2R(max) * 0.01) + local real realpercent = percentage * I2R(max) * 0.01 + local integer result = MathRound(realpercent) if (result < 0) then set result = 0 @@ -1310,6 +1334,14 @@ function CameraSetupApplyForPlayer takes boolean doPan, camerasetup whichSetup, endif endfunction +//=========================================================================== +function CameraSetupApplyForPlayerSmooth takes boolean doPan, camerasetup whichSetup, player whichPlayer, real forcedDuration, real easeInDuration, real easeOutDuration, real smoothFactor returns nothing + if (GetLocalPlayer() == whichPlayer) then + // Use only local code (no net traffic) within this block to avoid desyncs. + call BlzCameraSetupApplyForceDurationSmooth(whichSetup, doPan, forcedDuration, easeInDuration, easeOutDuration, smoothFactor) + endif +endfunction + //=========================================================================== function CameraSetupGetFieldSwap takes camerafield whichField, camerasetup whichSetup returns real return CameraSetupGetField(whichSetup, whichField) @@ -1648,8 +1680,8 @@ endfunction // function SubStringBJ takes string source, integer start, integer end returns string return SubString(source, start-1, end) -endfunction - +endfunction + function GetHandleIdBJ takes handle h returns integer return GetHandleId(h) endfunction @@ -1850,6 +1882,31 @@ function TriggerRegisterBuildSubmenuEventBJ takes trigger trig returns event return TriggerRegisterGameEvent(trig, EVENT_GAME_BUILD_SUBMENU) endfunction +//=========================================================================== +function TriggerRegisterBuildCommandEventBJ takes trigger trig, integer unitId returns event + call TriggerRegisterCommandEvent(trig, 'ANbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AHbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AEbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AObu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AUbu', UnitId2String(unitId)) + return TriggerRegisterCommandEvent(trig, 'AGbu', UnitId2String(unitId)) +endfunction + +//=========================================================================== +function TriggerRegisterTrainCommandEventBJ takes trigger trig, integer unitId returns event + return TriggerRegisterCommandEvent(trig, 'Aque', UnitId2String(unitId)) +endfunction + +//=========================================================================== +function TriggerRegisterUpgradeCommandEventBJ takes trigger trig, integer techId returns event + return TriggerRegisterUpgradeCommandEvent(trig, techId) +endfunction + +//=========================================================================== +function TriggerRegisterCommonCommandEventBJ takes trigger trig, string order returns event + return TriggerRegisterCommandEvent(trig, 0, order) +endfunction + //=========================================================================== function TriggerRegisterGameLoadedEventBJ takes trigger trig returns event return TriggerRegisterGameEvent(trig, EVENT_GAME_LOADED) @@ -2187,6 +2244,159 @@ function GetLastCreatedUbersplat takes nothing returns ubersplat return bj_lastCreatedUbersplat endfunction +//============================================================================ +function GetLastCreatedMinimapIcon takes nothing returns minimapicon + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconOnUnitBJ takes unit whichUnit, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIconOnUnit(whichUnit, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconAtLocBJ takes location where, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIconAtLoc(where, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconBJ takes real x, real y, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIcon(x, y, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CampaignMinimapIconUnitBJ takes unit whichUnit, integer style returns nothing + local integer red + local integer green + local integer blue + local string path + if ( style == bj_CAMPPINGSTYLE_PRIMARY ) then + // green + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_GREEN ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_RED ) then + // green + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_BONUS ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectiveBonus" ) + elseif ( style == bj_CAMPPINGSTYLE_TURNIN ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestTurnIn" ) + elseif ( style == bj_CAMPPINGSTYLE_BOSS ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestBoss" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ALLY ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_NEUTRAL ) then + // white + set red = 255 + set green = 255 + set blue = 255 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ENEMY ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + endif + call CreateMinimapIconOnUnitBJ( whichUnit, red, green, blue, path, FOG_OF_WAR_MASKED ) + call SetMinimapIconOrphanDestroy( bj_lastCreatedMinimapIcon, true ) +endfunction + + +//============================================================================ +function CampaignMinimapIconLocBJ takes location where, integer style returns nothing + local integer red + local integer green + local integer blue + local string path + if ( style == bj_CAMPPINGSTYLE_PRIMARY ) then + // green (different from the unit version) + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_GREEN ) then + // green (different from the unit version) + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_RED ) then + // green (different from the unit version) + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_BONUS ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectiveBonus" ) + elseif ( style == bj_CAMPPINGSTYLE_TURNIN ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestTurnIn" ) + elseif ( style == bj_CAMPPINGSTYLE_BOSS ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestBoss" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ALLY ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_NEUTRAL ) then + // white + set red = 255 + set green = 255 + set blue = 255 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ENEMY ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + endif + call CreateMinimapIconAtLocBJ( where, red, green, blue, path, FOG_OF_WAR_MASKED ) +endfunction + //*************************************************************************** //* @@ -2568,6 +2778,67 @@ endfunction +//*************************************************************************** +//* +//* Command Button Effect Utility Functions +//* +//*************************************************************************** + +//=========================================================================== +function CreateCommandButtonEffectBJ takes integer abilityId, string order returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(abilityId, order) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateTrainCommandButtonEffectBJ takes integer unitId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect('Aque', UnitId2String(unitId)) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateUpgradeCommandButtonEffectBJ takes integer techId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateUpgradeCommandButtonEffect(techId) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateCommonCommandButtonEffectBJ takes string order returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(0, order) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateLearnCommandButtonEffectBJ takes integer abilityId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateLearnCommandButtonEffect(abilityId) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateBuildCommandButtonEffectBJ takes integer unitId returns commandbuttoneffect + local race r = GetPlayerRace(GetLocalPlayer()) + local integer abilityId + if (r == RACE_HUMAN) then + set abilityId = 'AHbu' + elseif (r == RACE_ORC) then + set abilityId = 'AObu' + elseif (r == RACE_UNDEAD) then + set abilityId = 'AUbu' + elseif (r == RACE_NIGHTELF) then + set abilityId = 'AEbu' + else + set abilityId = 'ANbu' + endif + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(abilityId, UnitId2String(unitId)) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function GetLastCreatedCommandButtonEffectBJ takes nothing returns commandbuttoneffect + return bj_lastCreatedCommandButtonEffect +endfunction + + //*************************************************************************** //* //* Hero and Item Utility Functions @@ -2646,7 +2917,7 @@ endfunction function UnitAddItemByIdSwapped takes integer itemId, unit whichHero returns item // Create the item at the hero's feet first, and then give it to him. // This is to ensure that the item will be left at the hero's feet if - // his inventory is full. + // his inventory is full. set bj_lastCreatedItem = CreateItem(itemId, GetUnitX(whichHero), GetUnitY(whichHero)) call UnitAddItem(whichHero, bj_lastCreatedItem) return bj_lastCreatedItem @@ -2697,6 +2968,26 @@ function SuspendHeroXPBJ takes boolean flag, unit whichHero returns nothing call SuspendHeroXP(whichHero, not flag) endfunction +//=========================================================================== +function SetPlayerHandicapDamageBJ takes player whichPlayer, real handicapPercent returns nothing + call SetPlayerHandicapDamage(whichPlayer, handicapPercent * 0.01) +endfunction + +//=========================================================================== +function GetPlayerHandicapDamageBJ takes player whichPlayer returns real + return GetPlayerHandicapDamage(whichPlayer) * 100 +endfunction + +//=========================================================================== +function SetPlayerHandicapReviveTimeBJ takes player whichPlayer, real handicapPercent returns nothing + call SetPlayerHandicapReviveTime(whichPlayer, handicapPercent * 0.01) +endfunction + +//=========================================================================== +function GetPlayerHandicapReviveTimeBJ takes player whichPlayer returns real + return GetPlayerHandicapReviveTime(whichPlayer) * 100 +endfunction + //=========================================================================== function SetPlayerHandicapXPBJ takes player whichPlayer, real handicapPercent returns nothing call SetPlayerHandicapXP(whichPlayer, handicapPercent * 0.01) @@ -3024,7 +3315,7 @@ endfunction //=========================================================================== function String2OrderIdBJ takes string orderIdString returns integer local integer orderId - + // Check to see if it's a generic order. set orderId = OrderId(orderIdString) if (orderId != 0) then @@ -3589,7 +3880,7 @@ function PauseAllUnitsBJEnum takes nothing returns nothing endfunction //=========================================================================== -// Pause all units +// Pause all units function PauseAllUnitsBJ takes boolean pause returns nothing local integer index local player indexPlayer @@ -4978,7 +5269,7 @@ function PlayersAreCoAllied takes player playerA, player playerB returns boolean endfunction //=========================================================================== -// Force (whichPlayer) AI player to share vision and advanced unit control +// Force (whichPlayer) AI player to share vision and advanced unit control // with all AI players of its allies. // function ShareEverythingWithTeamAI takes player whichPlayer returns nothing @@ -5026,7 +5317,7 @@ endfunction //=========================================================================== // Creates a 'Neutral Victim' player slot. This slot is passive towards all // other players, but all other players are aggressive towards him/her. -// +// function ConfigureNeutralVictim takes nothing returns nothing local integer index local player indexPlayer @@ -6301,7 +6592,7 @@ function PingMinimapForForceEx takes force whichForce, real x, real y, real dura else // Unrecognized ping style - ignore the request. endif - + //call StartSound(bj_pingMinimapSound) endif endfunction @@ -6367,8 +6658,8 @@ endfunction //=========================================================================== function SetCinematicSceneBJ takes sound soundHandle, integer portraitUnitId, playercolor color, string speakerTitle, string text, real sceneDuration, real voiceoverDuration returns nothing set bj_cineSceneLastSound = soundHandle - call PlaySoundBJ(soundHandle) call SetCinematicScene(portraitUnitId, color, speakerTitle, text, sceneDuration, voiceoverDuration) + call PlaySoundBJ(soundHandle) endfunction //=========================================================================== @@ -6442,6 +6733,8 @@ endfunction function TransmissionFromUnitWithNameBJ takes force toForce, unit whichUnit, string unitName, sound soundHandle, string message, integer timeType, real timeVal, boolean wait returns nothing call TryInitCinematicBehaviorBJ() + call AttachSoundToUnit(soundHandle, whichUnit) + // Ensure that the time value is non-negative. set timeVal = RMaxBJ(timeVal, 0) @@ -6469,6 +6762,62 @@ function TransmissionFromUnitWithNameBJ takes force toForce, unit whichUnit, str endfunction +//=========================================================================== +function PlayDialogueFromSpeakerEx takes force toForce, unit speaker, integer speakerType, sound soundHandle, integer timeType, real timeVal, boolean wait returns boolean + //Make sure that the runtime unit type and the parameter are the same, + //otherwise the offline animations will not match and will fail + if GetUnitTypeId(speaker) != speakerType then + debug call BJDebugMsg(("Attempted to play FacialAnimation with the wrong speaker UnitType - Param: " + I2S(speakerType) + " Runtime: " + I2S(GetUnitTypeId(speaker)))) + //return false + endif + + call TryInitCinematicBehaviorBJ() + + call AttachSoundToUnit(soundHandle, speaker) + + // Ensure that the time value is non-negative. + set timeVal = RMaxBJ(timeVal, 0) + + set bj_lastTransmissionDuration = GetTransmissionDuration(soundHandle, timeType, timeVal) + set bj_lastPlayedSound = soundHandle + + if (IsPlayerInForce(GetLocalPlayer(), toForce)) then + call SetCinematicSceneBJ(soundHandle, speakerType, GetPlayerColor(GetOwningPlayer(speaker)), GetLocalizedString(GetDialogueSpeakerNameKey(soundHandle)), GetLocalizedString(GetDialogueTextKey(soundHandle)), bj_lastTransmissionDuration + bj_TRANSMISSION_PORT_HANGTIME, bj_lastTransmissionDuration) + endif + + if wait and (bj_lastTransmissionDuration > 0) then + // call TriggerSleepAction(bj_lastTransmissionDuration) + call WaitTransmissionDuration(soundHandle, timeType, timeVal) + endif + + return true +endfunction + +//=========================================================================== +function PlayDialogueFromSpeakerTypeEx takes force toForce, player fromPlayer, integer speakerType, location loc, sound soundHandle, integer timeType, real timeVal, boolean wait returns boolean + call TryInitCinematicBehaviorBJ() + + // Ensure that the time value is non-negative. + set timeVal = RMaxBJ(timeVal, 0) + + set bj_lastTransmissionDuration = GetTransmissionDuration(soundHandle, timeType, timeVal) + set bj_lastPlayedSound = soundHandle + + if (IsPlayerInForce(GetLocalPlayer(), toForce)) then + call SetCinematicSceneBJ(soundHandle, speakerType, GetPlayerColor(fromPlayer), GetLocalizedString(GetDialogueSpeakerNameKey(soundHandle)), GetLocalizedString(GetDialogueTextKey(soundHandle)), bj_lastTransmissionDuration + bj_TRANSMISSION_PORT_HANGTIME, bj_lastTransmissionDuration) + if(speakerType != 0) then + call PingMinimap(GetLocationX(loc), GetLocationY(loc), bj_TRANSMISSION_PING_TIME) + endif + endif + + if wait and (bj_lastTransmissionDuration > 0) then + // call TriggerSleepAction(bj_lastTransmissionDuration) + call WaitTransmissionDuration(soundHandle, timeType, timeVal) + endif + + return true +endfunction + //=========================================================================== // This operates like TransmissionFromUnitWithNameBJ, but for a unit type // rather than a unit instance. As such, no speech indicator is employed. @@ -6540,6 +6889,7 @@ function CinematicModeExBJ takes boolean cineMode, force forForce, real interfac if (cineMode) then // Save the UI state so that we can restore it later. if (not bj_cineModeAlreadyIn) then + call SetCinematicAudio(true) set bj_cineModeAlreadyIn = true set bj_cineModePriorSpeed = GetGameSpeed() set bj_cineModePriorFogSetting = IsFogEnabled() @@ -6570,6 +6920,7 @@ function CinematicModeExBJ takes boolean cineMode, force forForce, real interfac call SetRandomSeed(0) else set bj_cineModeAlreadyIn = false + call SetCinematicAudio(false) // Perform local changes if (IsPlayerInForce(GetLocalPlayer(), forForce)) then @@ -6624,8 +6975,8 @@ function CinematicFadeCommonBJ takes real red, real green, real blue, real durat call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) call SetCineFilterStartUV(0, 0, 1, 1) call SetCineFilterEndUV(0, 0, 1, 1) - call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-startTrans)) - call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-endTrans)) + call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-startTrans)) + call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-endTrans)) call SetCineFilterDuration(duration) call DisplayCineFilter(true) endfunction @@ -6709,8 +7060,8 @@ function CinematicFilterGenericBJ takes real duration, blendmode bmode, string t call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) call SetCineFilterStartUV(0, 0, 1, 1) call SetCineFilterEndUV(0, 0, 1, 1) - call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0)) - call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1)) + call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100.0-trans0)) + call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100.0-trans1)) call SetCineFilterDuration(duration) call DisplayCineFilter(true) endfunction @@ -6957,7 +7308,7 @@ function SetCinematicAvailableBJ takes boolean available, integer cinematicIndex call PlayCinematic( "NightElfEd" ) elseif (cinematicIndex == bj_CINEMATICINDEX_XOP) then call SetOpCinematicAvailable( bj_CAMPAIGN_OFFSET_XN, available ) - call PlayCinematic( "IntroX" ) + // call PlayCinematic( "IntroX" ) elseif (cinematicIndex == bj_CINEMATICINDEX_XED) then call SetEdCinematicAvailable( bj_CAMPAIGN_OFFSET_XU, available ) call PlayCinematic( "OutroX" ) @@ -7569,6 +7920,13 @@ function IsCustomCampaignButtonVisibile takes integer whichButton returns boolea return GetCustomCampaignButtonVisible(whichButton - 1) endfunction +//=========================================================================== +// Placeholder function for auto save feature +//=========================================================================== +function SaveGameCheckPointBJ takes string mapSaveName, boolean doCheckpointHint returns nothing + call SaveGameCheckpoint(mapSaveName, doCheckpointHint) +endfunction + //=========================================================================== function LoadGameBJ takes string loadFileName, boolean doScoreScreen returns nothing call LoadGame(loadFileName, doScoreScreen) @@ -8120,7 +8478,7 @@ endfunction //=========================================================================== function MeleeClearNearbyUnits takes real x, real y, real range returns nothing local group nearbyUnits - + set nearbyUnits = CreateGroup() call GroupEnumUnitsInRange(nearbyUnits, x, y, range, null) call ForGroup(nearbyUnits, function MeleeClearExcessUnit) @@ -8282,7 +8640,7 @@ function MeleeStartingUnitsHuman takes player whichPlayer, location startLoc, bo if (nearestMine != null) then // Spawn Town Hall at the start location. set townHall = CreateUnitAtLoc(whichPlayer, 'htow', startLoc, bj_UNIT_FACING) - + // Spawn Peasants near the mine. set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0) set peonX = GetLocationX(nearMineLoc) @@ -8298,7 +8656,7 @@ function MeleeStartingUnitsHuman takes player whichPlayer, location startLoc, bo else // Spawn Town Hall at the start location. set townHall = CreateUnitAtLoc(whichPlayer, 'htow', startLoc, bj_UNIT_FACING) - + // Spawn Peasants directly south of the town hall. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8356,7 +8714,7 @@ function MeleeStartingUnitsOrc takes player whichPlayer, location startLoc, bool if (nearestMine != null) then // Spawn Great Hall at the start location. call CreateUnitAtLoc(whichPlayer, 'ogre', startLoc, bj_UNIT_FACING) - + // Spawn Peons near the mine. set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0) set peonX = GetLocationX(nearMineLoc) @@ -8372,7 +8730,7 @@ function MeleeStartingUnitsOrc takes player whichPlayer, location startLoc, bool else // Spawn Great Hall at the start location. call CreateUnitAtLoc(whichPlayer, 'ogre', startLoc, bj_UNIT_FACING) - + // Spawn Peons directly south of the town hall. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8431,7 +8789,7 @@ function MeleeStartingUnitsUndead takes player whichPlayer, location startLoc, b if (nearestMine != null) then // Spawn Necropolis at the start location. call CreateUnitAtLoc(whichPlayer, 'unpl', startLoc, bj_UNIT_FACING) - + // Replace the nearest gold mine with a blighted version. set nearestMine = BlightGoldMineForPlayerBJ(nearestMine, whichPlayer) @@ -8457,7 +8815,7 @@ function MeleeStartingUnitsUndead takes player whichPlayer, location startLoc, b else // Spawn Necropolis at the start location. call CreateUnitAtLoc(whichPlayer, 'unpl', startLoc, bj_UNIT_FACING) - + // Spawn Acolytes and Ghoul directly south of the Necropolis. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8631,7 +8989,7 @@ function MeleeStartingUnits takes nothing returns nothing set index = index + 1 exitwhen index == bj_MAX_PLAYERS endloop - + endfunction //=========================================================================== @@ -8785,7 +9143,7 @@ function MeleeGetAllyStructureCount takes player whichPlayer returns integer if (PlayersAreCoAllied(whichPlayer, indexPlayer)) then set buildingCount = buildingCount + GetPlayerStructureCount(indexPlayer, true) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -8834,12 +9192,9 @@ function MeleeGetAllyKeyStructureCount takes player whichPlayer returns integer loop set indexPlayer = Player(playerIndex) if (PlayersAreCoAllied(whichPlayer, indexPlayer)) then - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "townhall", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "greathall", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "treeoflife", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "necropolis", true, true) + set keyStructs = keyStructs + BlzGetPlayerTownHallCount(indexPlayer) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -8905,7 +9260,7 @@ endfunction //=========================================================================== // Remove all observers -// +// function MeleeRemoveObservers takes nothing returns nothing local integer playerIndex local player indexPlayer @@ -9009,7 +9364,7 @@ function MeleeCheckForLosersAndVictors takes nothing returns nothing set bj_meleeDefeated[playerIndex] = true endif endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -9175,11 +9530,11 @@ endfunction //=========================================================================== function MeleePlayerIsCrippled takes player whichPlayer returns boolean - local integer allyStructures = MeleeGetAllyStructureCount(whichPlayer) - local integer allyKeyStructures = MeleeGetAllyKeyStructureCount(whichPlayer) + local integer playerStructures = GetPlayerStructureCount(whichPlayer, true) + local integer playerKeyStructures = BlzGetPlayerTownHallCount(whichPlayer) - // Dead teams are not considered to be crippled. - return (allyStructures > 0) and (allyKeyStructures <= 0) + // Dead players are not considered to be crippled. + return (playerStructures > 0) and (playerKeyStructures <= 0) endfunction //=========================================================================== @@ -9245,7 +9600,7 @@ function MeleeCheckForCrippledPlayers takes nothing returns nothing call MeleeExposePlayer(indexPlayer, false) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -9332,7 +9687,7 @@ function MeleeTriggerActionPlayerLeft takes nothing returns nothing call CachePlayerHeroData(thePlayer) - // This is the same as defeat except the player generates the message + // This is the same as defeat except the player generates the message // "player left the game" as opposed to "player was defeated". if (MeleeGetAllyCount(thePlayer) > 0) then @@ -10134,7 +10489,7 @@ endfunction //* //* - RandomDistChoose will use the current distribution list to choose //* one of the objects randomly based on the chance distribution -//* +//* //* Note that the chances are effectively normalized by their sum, //* so only the relative values of each chance are important //* @@ -10376,7 +10731,7 @@ function BlzRemoveAbilityStringLevelArrayFieldBJ takes ability whichAbility, abi set bj_lastInstObjFuncSuccessful = BlzRemoveAbilityStringLevelArrayField(whichAbility, whichField, level, value) endfunction -// Item +// Item //============================================================= function BlzItemAddAbilityBJ takes item whichItem, integer abilCode returns nothing set bj_lastInstObjFuncSuccessful = BlzItemAddAbility(whichItem, abilCode) @@ -10408,7 +10763,7 @@ function BlzSetItemStringFieldBJ takes item whichItem, itemstringfield whichFiel endfunction -// Unit +// Unit //=========================================================================== function BlzSetUnitBooleanFieldBJ takes unit whichUnit, unitbooleanfield whichField, boolean value returns nothing set bj_lastInstObjFuncSuccessful = BlzSetUnitBooleanField(whichUnit, whichField, value) diff --git a/Wurstpack/wurstscript/common.j b/Wurstpack/wurstscript/common.j index 6724e1399..1bea181a6 100644 --- a/Wurstpack/wurstscript/common.j +++ b/Wurstpack/wurstscript/common.j @@ -56,6 +56,7 @@ type mapvisibility extends handle type mapsetting extends handle type mapdensity extends handle type mapcontrol extends handle +type minimapicon extends handle type playerslotstate extends handle type volumegroup extends handle type camerafield extends handle @@ -136,6 +137,7 @@ type defensetype extends handle type regentype extends handle type unitcategory extends handle type pathingflag extends handle +type commandbuttoneffect extends handle constant native ConvertRace takes integer i returns race @@ -785,6 +787,10 @@ globals // Need to be added here to preserve compat //=================================================== + //=================================================== + // For use with TriggerRegisterGameEvent + //=================================================== + constant gameevent EVENT_GAME_LOADED = ConvertGameEvent(256) constant gameevent EVENT_GAME_TOURNAMENT_FINISH_SOON = ConvertGameEvent(257) constant gameevent EVENT_GAME_TOURNAMENT_FINISH_NOW = ConvertGameEvent(258) @@ -970,24 +976,29 @@ globals // Custom UI API constants //=================================================== - constant originframetype ORIGIN_FRAME_GAME_UI = ConvertOriginFrameType(0) - constant originframetype ORIGIN_FRAME_COMMAND_BUTTON = ConvertOriginFrameType(1) - constant originframetype ORIGIN_FRAME_HERO_BAR = ConvertOriginFrameType(2) - constant originframetype ORIGIN_FRAME_HERO_BUTTON = ConvertOriginFrameType(3) - constant originframetype ORIGIN_FRAME_HERO_HP_BAR = ConvertOriginFrameType(4) - constant originframetype ORIGIN_FRAME_HERO_MANA_BAR = ConvertOriginFrameType(5) - constant originframetype ORIGIN_FRAME_HERO_BUTTON_INDICATOR = ConvertOriginFrameType(6) - constant originframetype ORIGIN_FRAME_ITEM_BUTTON = ConvertOriginFrameType(7) - constant originframetype ORIGIN_FRAME_MINIMAP = ConvertOriginFrameType(8) - constant originframetype ORIGIN_FRAME_MINIMAP_BUTTON = ConvertOriginFrameType(9) - constant originframetype ORIGIN_FRAME_SYSTEM_BUTTON = ConvertOriginFrameType(10) - constant originframetype ORIGIN_FRAME_TOOLTIP = ConvertOriginFrameType(11) - constant originframetype ORIGIN_FRAME_UBERTOOLTIP = ConvertOriginFrameType(12) - constant originframetype ORIGIN_FRAME_CHAT_MSG = ConvertOriginFrameType(13) - constant originframetype ORIGIN_FRAME_UNIT_MSG = ConvertOriginFrameType(14) - constant originframetype ORIGIN_FRAME_TOP_MSG = ConvertOriginFrameType(15) - constant originframetype ORIGIN_FRAME_PORTRAIT = ConvertOriginFrameType(16) - constant originframetype ORIGIN_FRAME_WORLD_FRAME = ConvertOriginFrameType(17) + constant originframetype ORIGIN_FRAME_GAME_UI = ConvertOriginFrameType(0) + constant originframetype ORIGIN_FRAME_COMMAND_BUTTON = ConvertOriginFrameType(1) + constant originframetype ORIGIN_FRAME_HERO_BAR = ConvertOriginFrameType(2) + constant originframetype ORIGIN_FRAME_HERO_BUTTON = ConvertOriginFrameType(3) + constant originframetype ORIGIN_FRAME_HERO_HP_BAR = ConvertOriginFrameType(4) + constant originframetype ORIGIN_FRAME_HERO_MANA_BAR = ConvertOriginFrameType(5) + constant originframetype ORIGIN_FRAME_HERO_BUTTON_INDICATOR = ConvertOriginFrameType(6) + constant originframetype ORIGIN_FRAME_ITEM_BUTTON = ConvertOriginFrameType(7) + constant originframetype ORIGIN_FRAME_MINIMAP = ConvertOriginFrameType(8) + constant originframetype ORIGIN_FRAME_MINIMAP_BUTTON = ConvertOriginFrameType(9) + constant originframetype ORIGIN_FRAME_SYSTEM_BUTTON = ConvertOriginFrameType(10) + constant originframetype ORIGIN_FRAME_TOOLTIP = ConvertOriginFrameType(11) + constant originframetype ORIGIN_FRAME_UBERTOOLTIP = ConvertOriginFrameType(12) + constant originframetype ORIGIN_FRAME_CHAT_MSG = ConvertOriginFrameType(13) + constant originframetype ORIGIN_FRAME_UNIT_MSG = ConvertOriginFrameType(14) + constant originframetype ORIGIN_FRAME_TOP_MSG = ConvertOriginFrameType(15) + constant originframetype ORIGIN_FRAME_PORTRAIT = ConvertOriginFrameType(16) + constant originframetype ORIGIN_FRAME_WORLD_FRAME = ConvertOriginFrameType(17) + constant originframetype ORIGIN_FRAME_SIMPLE_UI_PARENT = ConvertOriginFrameType(18) + constant originframetype ORIGIN_FRAME_PORTRAIT_HP_TEXT = ConvertOriginFrameType(19) + constant originframetype ORIGIN_FRAME_PORTRAIT_MANA_TEXT = ConvertOriginFrameType(20) + constant originframetype ORIGIN_FRAME_UNIT_PANEL_BUFF_BAR = ConvertOriginFrameType(21) + constant originframetype ORIGIN_FRAME_UNIT_PANEL_BUFF_BAR_LABEL = ConvertOriginFrameType(22) constant framepointtype FRAMEPOINT_TOPLEFT = ConvertFramePointType(0) constant framepointtype FRAMEPOINT_TOP = ConvertFramePointType(1) @@ -2205,6 +2216,8 @@ native SquareRoot takes real x returns real // native Pow takes real x, real power returns real +constant native MathRound takes real r returns integer + //============================================================================ // String Utility API native I2R takes integer i returns real @@ -2238,12 +2251,14 @@ native SetMapDescription takes string description returns nothing native SetTeams takes integer teamcount returns nothing native SetPlayers takes integer playercount returns nothing -native DefineStartLocation takes integer whichStartLoc, real x, real y returns nothing -native DefineStartLocationLoc takes integer whichStartLoc, location whichLocation returns nothing -native SetStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing -native SetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing -native GetStartLocPrioSlot takes integer whichStartLoc, integer prioSlotIndex returns integer -native GetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex returns startlocprio +native DefineStartLocation takes integer whichStartLoc, real x, real y returns nothing +native DefineStartLocationLoc takes integer whichStartLoc, location whichLocation returns nothing +native SetStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing +native SetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing +native GetStartLocPrioSlot takes integer whichStartLoc, integer prioSlotIndex returns integer +native GetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex returns startlocprio +native SetEnemyStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing +native SetEnemyStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing native SetGameTypeSupported takes gametype whichGameType, boolean value returns nothing native SetMapFlag takes mapflag whichMapFlag, boolean value returns nothing @@ -2432,6 +2447,8 @@ constant native GetEnumDestructable takes nothing returns destructable constant native GetFilterItem takes nothing returns item constant native GetEnumItem takes nothing returns item +constant native ParseTags takes string taggedString returns string + constant native GetFilterPlayer takes nothing returns player constant native GetEnumPlayer takes nothing returns player @@ -2497,6 +2514,10 @@ constant native GetLeavingUnit takes nothing returns unit native TriggerRegisterTrackableHitEvent takes trigger whichTrigger, trackable t returns event native TriggerRegisterTrackableTrackEvent takes trigger whichTrigger, trackable t returns event +// EVENT_COMMAND_BUTTON_CLICK +native TriggerRegisterCommandEvent takes trigger whichTrigger, integer whichAbility, string order returns event +native TriggerRegisterUpgradeCommandEvent takes trigger whichTrigger, integer whichUpgrade returns event + // EVENT_GAME_TRACKABLE_HIT // EVENT_GAME_TRACKABLE_TRACK constant native GetTriggeringTrackable takes nothing returns trackable @@ -3092,8 +3113,12 @@ constant native GetPlayerAlliance takes player sourcePlayer, player otherP constant native GetPlayerHandicap takes player whichPlayer returns real constant native GetPlayerHandicapXP takes player whichPlayer returns real +constant native GetPlayerHandicapReviveTime takes player whichPlayer returns real +constant native GetPlayerHandicapDamage takes player whichPlayer returns real constant native SetPlayerHandicap takes player whichPlayer, real handicap returns nothing constant native SetPlayerHandicapXP takes player whichPlayer, real handicap returns nothing +constant native SetPlayerHandicapReviveTime takes player whichPlayer, real handicap returns nothing +constant native SetPlayerHandicapDamage takes player whichPlayer, real handicap returns nothing constant native SetPlayerTechMaxAllowed takes player whichPlayer, integer techid, integer maximum returns nothing constant native GetPlayerTechMaxAllowed takes player whichPlayer, integer techid returns integer @@ -3150,17 +3175,19 @@ native SetCampaignMenuRace takes race r returns nothing native SetCampaignMenuRaceEx takes integer campaignIndex returns nothing native ForceCampaignSelectScreen takes nothing returns nothing -native LoadGame takes string saveFileName, boolean doScoreScreen returns nothing -native SaveGame takes string saveFileName returns nothing -native RenameSaveDirectory takes string sourceDirName, string destDirName returns boolean -native RemoveSaveDirectory takes string sourceDirName returns boolean -native CopySaveGame takes string sourceSaveName, string destSaveName returns boolean -native SaveGameExists takes string saveName returns boolean -native SyncSelections takes nothing returns nothing -native SetFloatGameState takes fgamestate whichFloatGameState, real value returns nothing -constant native GetFloatGameState takes fgamestate whichFloatGameState returns real -native SetIntegerGameState takes igamestate whichIntegerGameState, integer value returns nothing -constant native GetIntegerGameState takes igamestate whichIntegerGameState returns integer +native LoadGame takes string saveFileName, boolean doScoreScreen returns nothing +native SaveGame takes string saveFileName returns nothing +native RenameSaveDirectory takes string sourceDirName, string destDirName returns boolean +native RemoveSaveDirectory takes string sourceDirName returns boolean +native CopySaveGame takes string sourceSaveName, string destSaveName returns boolean +native SaveGameExists takes string saveName returns boolean +native SetMaxCheckpointSaves takes integer maxCheckpointSaves returns nothing +native SaveGameCheckpoint takes string saveFileName, boolean showWindow returns nothing +native SyncSelections takes nothing returns nothing +native SetFloatGameState takes fgamestate whichFloatGameState, real value returns nothing +constant native GetFloatGameState takes fgamestate whichFloatGameState returns real +native SetIntegerGameState takes igamestate whichIntegerGameState, integer value returns nothing +constant native GetIntegerGameState takes igamestate whichIntegerGameState returns integer //============================================================================ @@ -3372,6 +3399,7 @@ native DisplayTimedTextToPlayer takes player toPlayer, real x, real y, real native DisplayTimedTextFromPlayer takes player toPlayer, real x, real y, real duration, string message returns nothing native ClearTextMessages takes nothing returns nothing native SetDayNightModels takes string terrainDNCFile, string unitDNCFile returns nothing +native SetPortraitLight takes string portraitDNCFile returns nothing native SetSkyModel takes string skyModelFile returns nothing native EnableUserControl takes boolean b returns nothing native EnableUserUI takes boolean b returns nothing @@ -3384,6 +3412,13 @@ native UnitAddIndicator takes unit whichUnit, integer red, integer g native AddIndicator takes widget whichWidget, integer red, integer green, integer blue, integer alpha returns nothing native PingMinimap takes real x, real y, real duration returns nothing native PingMinimapEx takes real x, real y, real duration, integer red, integer green, integer blue, boolean extraEffects returns nothing +native CreateMinimapIconOnUnit takes unit whichUnit, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native CreateMinimapIconAtLoc takes location where, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native CreateMinimapIcon takes real x, real y, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native SkinManagerGetLocalPath takes string key returns string +native DestroyMinimapIcon takes minimapicon pingId returns nothing +native SetMinimapIconVisible takes minimapicon whichMinimapIcon, boolean visible returns nothing +native SetMinimapIconOrphanDestroy takes minimapicon whichMinimapIcon, boolean doDestroy returns nothing native EnableOcclusion takes boolean flag returns nothing native SetIntroShotText takes string introText returns nothing native SetIntroShotModel takes string introModelPath returns nothing @@ -3586,6 +3621,8 @@ native CameraSetupApply takes camerasetup whichSetup, boolea native CameraSetupApplyWithZ takes camerasetup whichSetup, real zDestOffset returns nothing native CameraSetupApplyForceDuration takes camerasetup whichSetup, boolean doPan, real forceDuration returns nothing native CameraSetupApplyForceDurationWithZ takes camerasetup whichSetup, real zDestOffset, real forceDuration returns nothing +native BlzCameraSetupSetLabel takes camerasetup whichSetup, string label returns nothing +native BlzCameraSetupGetLabel takes camerasetup whichSetup returns string native CameraSetTargetNoise takes real mag, real velocity returns nothing native CameraSetSourceNoise takes real mag, real velocity returns nothing @@ -3595,6 +3632,9 @@ native CameraSetSourceNoiseEx takes real mag, real velocity, boolean v native CameraSetSmoothingFactor takes real factor returns nothing +native CameraSetFocalDistance takes real distance returns nothing +native CameraSetDepthOfFieldScale takes real scale returns nothing + native SetCineFilterTexture takes string filename returns nothing native SetCineFilterBlendMode takes blendmode whichMode returns nothing native SetCineFilterTexMapFlags takes texmapflags whichFlags returns nothing @@ -3609,6 +3649,7 @@ native IsCineFilterDisplayed takes nothing returns boolean native SetCinematicScene takes integer portraitUnitId, playercolor color, string speakerTitle, string text, real sceneDuration, real voiceoverDuration returns nothing native EndCinematicScene takes nothing returns nothing native ForceCinematicSubtitles takes boolean flag returns nothing +native SetCinematicAudio takes boolean cinematicAudio returns nothing native GetCameraMargin takes integer whichMargin returns real @@ -3689,6 +3730,16 @@ native GetSoundIsLoading takes sound soundHandle returns boolean native RegisterStackedSound takes sound soundHandle, boolean byPosition, real rectwidth, real rectheight returns nothing native UnregisterStackedSound takes sound soundHandle, boolean byPosition, real rectwidth, real rectheight returns nothing +native SetSoundFacialAnimationLabel takes sound soundHandle, string animationLabel returns boolean +native SetSoundFacialAnimationGroupLabel takes sound soundHandle, string groupLabel returns boolean +native SetSoundFacialAnimationSetFilepath takes sound soundHandle, string animationSetFilepath returns boolean + +//Subtitle support that is attached to the soundHandle rather than as disperate data with the legacy UI +native SetDialogueSpeakerNameKey takes sound soundHandle, string speakerName returns boolean +native GetDialogueSpeakerNameKey takes sound soundHandle returns string +native SetDialogueTextKey takes sound soundHandle, string dialogueText returns boolean +native GetDialogueTextKey takes sound soundHandle returns string + //============================================================================ // Effects API // @@ -3814,6 +3865,13 @@ native PreloadGenStart takes nothing returns nothing native PreloadGenEnd takes string filename returns nothing native Preloader takes string filename returns nothing + +//============================================================================ +//Machinima API +//============================================================================ +native BlzHideCinematicPanels takes boolean enable returns nothing + + // Automation Test native AutomationSetTestType takes string testType returns nothing native AutomationTestStart takes string testName returns nothing @@ -3912,6 +3970,7 @@ native BlzSetUnitAbilityCooldown takes unit whichUnit, integer native BlzGetUnitAbilityCooldown takes unit whichUnit, integer abilId, integer level returns real native BlzGetUnitAbilityCooldownRemaining takes unit whichUnit, integer abilId returns real native BlzEndUnitAbilityCooldown takes unit whichUnit, integer abilCode returns nothing +native BlzStartUnitAbilityCooldown takes unit whichUnit, integer abilCode, real cooldown returns nothing native BlzGetUnitAbilityManaCost takes unit whichUnit, integer abilId, integer level returns integer native BlzSetUnitAbilityManaCost takes unit whichUnit, integer abilId, integer level, integer manaCost returns nothing native BlzGetLocalUnitZ takes unit whichUnit returns real @@ -3924,6 +3983,7 @@ native BlzGetEventWeaponType takes nothing returns weaponty native BlzSetEventAttackType takes attacktype attackType returns boolean native BlzSetEventDamageType takes damagetype damageType returns boolean native BlzSetEventWeaponType takes weapontype weaponType returns boolean +native BlzGetEventIsAttack takes nothing returns boolean native RequestExtraIntegerData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns integer native RequestExtraBooleanData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns boolean native RequestExtraStringData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns string @@ -3936,6 +3996,11 @@ native BlzIsSelectionCircleEnabled takes nothing returns boolean native BlzCameraSetupApplyForceDurationSmooth takes camerasetup whichSetup, boolean doPan, real forcedDuration, real easeInDuration, real easeOutDuration, real smoothFactor returns nothing native BlzEnableTargetIndicator takes boolean enable returns nothing native BlzIsTargetIndicatorEnabled takes nothing returns boolean +native BlzShowTerrain takes boolean show returns nothing +native BlzShowSkyBox takes boolean show returns nothing +native BlzStartRecording takes integer fps returns nothing +native BlzEndRecording takes nothing returns nothing +native BlzShowUnitTeamGlow takes unit whichUnit, boolean show returns nothing native BlzGetOriginFrame takes originframetype frameType, integer index returns framehandle native BlzEnableUIAutoPosition takes boolean enable returns nothing @@ -3957,6 +4022,7 @@ native BlzFrameGetName takes framehandle frame retur native BlzFrameClick takes framehandle frame returns nothing native BlzFrameSetText takes framehandle frame, string text returns nothing native BlzFrameGetText takes framehandle frame returns string +native BlzFrameAddText takes framehandle frame, string text returns nothing native BlzFrameSetTextSizeLimit takes framehandle frame, integer size returns nothing native BlzFrameGetTextSizeLimit takes framehandle frame returns integer native BlzFrameSetTextColor takes framehandle frame, integer color returns nothing @@ -3987,6 +4053,8 @@ native BlzFrameSetTextAlignment takes framehandle frame, text native BlzTriggerRegisterFrameEvent takes trigger whichTrigger, framehandle frame, frameeventtype eventId returns event native BlzGetTriggerFrame takes nothing returns framehandle native BlzGetTriggerFrameEvent takes nothing returns frameeventtype +native BlzGetTriggerFrameValue takes nothing returns real +native BlzGetTriggerFrameText takes nothing returns string native BlzTriggerRegisterPlayerSyncEvent takes trigger whichTrigger, player whichPlayer, string prefix, boolean fromServer returns event native BlzSendSyncData takes string prefix, string data returns boolean native BlzGetTriggerSyncPrefix takes nothing returns string @@ -4012,6 +4080,12 @@ native BlzDisplayChatMessage takes player whichPlayer, int native BlzPauseUnitEx takes unit whichUnit, boolean flag returns nothing // native BlzFourCC2S takes integer value returns string // native BlzS2FourCC takes string value returns integer +native BlzSetUnitFacingEx takes unit whichUnit, real facingAngle returns nothing + +native CreateCommandButtonEffect takes integer abilityId, string order returns commandbuttoneffect +native CreateUpgradeCommandButtonEffect takes integer whichUprgade returns commandbuttoneffect +native CreateLearnCommandButtonEffect takes integer abilityId returns commandbuttoneffect +native DestroyCommandButtonEffect takes commandbuttoneffect whichEffect returns nothing // Bit Operations native BlzBitOr takes integer x, integer y returns integer @@ -4086,3 +4160,19 @@ native BlzSetUnitWeaponBooleanField takes unit whichUnit, unitwea 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 + +// Skin +native BlzGetUnitSkin takes unit whichUnit returns integer +native BlzGetItemSkin takes item whichItem returns integer +// native BlzGetDestructableSkin takes destructable whichDestructable returns integer +native BlzSetUnitSkin takes unit whichUnit, integer skinId returns nothing +native BlzSetItemSkin takes item whichItem, integer skinId returns nothing +// native BlzSetDestructableSkin takes destructable whichDestructable, integer skinId returns nothing + +native BlzCreateItemWithSkin takes integer itemid, real x, real y, integer skinId returns item +native BlzCreateUnitWithSkin takes player id, integer unitid, real x, real y, real face, integer skinId returns unit +native BlzCreateDestructableWithSkin takes integer objectid, real x, real y, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDestructableZWithSkin takes integer objectid, real x, real y, real z, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDeadDestructableWithSkin takes integer objectid, real x, real y, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDeadDestructableZWithSkin takes integer objectid, real x, real y, real z, real face, real scale, integer variation, integer skinId returns destructable +native BlzGetPlayerTownHallCount takes player whichPlayer returns integer diff --git a/de.peeeq.wurstscript/src/main/resources/blizzard.j b/de.peeeq.wurstscript/src/main/resources/blizzard.j index 257ccaeea..4a37738e1 100644 --- a/de.peeeq.wurstscript/src/main/resources/blizzard.j +++ b/de.peeeq.wurstscript/src/main/resources/blizzard.j @@ -33,6 +33,10 @@ globals constant real bj_QUEUE_DELAY_HINT = 5.00 constant real bj_QUEUE_DELAY_SECRET = 3.00 constant real bj_HANDICAP_EASY = 60.00 + constant real bj_HANDICAP_NORMAL = 90.00 + constant real bj_HANDICAPDAMAGE_EASY = 50.00 + constant real bj_HANDICAPDAMAGE_NORMAL = 90.00 + constant real bj_HANDICAPREVIVE_NOTHARD = 50.00 constant real bj_GAME_STARTED_THRESHOLD = 0.01 constant real bj_WAIT_FOR_COND_MIN_INTERVAL = 0.10 constant real bj_POLLED_WAIT_INTERVAL = 0.10 @@ -49,6 +53,9 @@ globals constant integer bj_MAX_STOCK_UNIT_SLOTS = 11 constant integer bj_MAX_ITEM_LEVEL = 10 + // Auto Save constants + constant integer bj_MAX_CHECKPOINTS = 5 + // Ideally these would be looked up from Units/MiscData.txt, // but there is currently no script functionality exposed to do that constant real bj_TOD_DAWN = 6.00 @@ -159,15 +166,18 @@ globals constant integer bj_CAMPAIGN_OFFSET_U = 2 constant integer bj_CAMPAIGN_OFFSET_O = 3 constant integer bj_CAMPAIGN_OFFSET_N = 4 - constant integer bj_CAMPAIGN_OFFSET_XN = 0 - constant integer bj_CAMPAIGN_OFFSET_XH = 1 - constant integer bj_CAMPAIGN_OFFSET_XU = 2 - constant integer bj_CAMPAIGN_OFFSET_XO = 3 + constant integer bj_CAMPAIGN_OFFSET_XN = 5 + constant integer bj_CAMPAIGN_OFFSET_XH = 6 + constant integer bj_CAMPAIGN_OFFSET_XU = 7 + constant integer bj_CAMPAIGN_OFFSET_XO = 8 // Mission indexing constants // Tutorial constant integer bj_MISSION_INDEX_T00 = bj_CAMPAIGN_OFFSET_T * 1000 + 0 constant integer bj_MISSION_INDEX_T01 = bj_CAMPAIGN_OFFSET_T * 1000 + 1 + constant integer bj_MISSION_INDEX_T02 = bj_CAMPAIGN_OFFSET_T * 1000 + 2 + constant integer bj_MISSION_INDEX_T03 = bj_CAMPAIGN_OFFSET_T * 1000 + 3 + constant integer bj_MISSION_INDEX_T04 = bj_CAMPAIGN_OFFSET_T * 1000 + 4 // Human constant integer bj_MISSION_INDEX_H00 = bj_CAMPAIGN_OFFSET_H * 1000 + 0 constant integer bj_MISSION_INDEX_H01 = bj_CAMPAIGN_OFFSET_H * 1000 + 1 @@ -382,7 +392,7 @@ globals constant integer bj_GAMECACHE_REAL = 2 constant integer bj_GAMECACHE_UNIT = 3 constant integer bj_GAMECACHE_STRING = 4 - + // Hashtable value types constant integer bj_HASHTABLE_BOOLEAN = 0 constant integer bj_HASHTABLE_INTEGER = 1 @@ -408,6 +418,17 @@ globals constant integer bj_MINIMAPPINGSTYLE_FLASHY = 1 constant integer bj_MINIMAPPINGSTYLE_ATTACK = 2 + // Campaign Minimap icon styles + constant integer bj_CAMPPINGSTYLE_PRIMARY = 0 + constant integer bj_CAMPPINGSTYLE_PRIMARY_GREEN = 1 + constant integer bj_CAMPPINGSTYLE_PRIMARY_RED = 2 + constant integer bj_CAMPPINGSTYLE_BONUS = 3 + constant integer bj_CAMPPINGSTYLE_TURNIN = 4 + constant integer bj_CAMPPINGSTYLE_BOSS = 5 + constant integer bj_CAMPPINGSTYLE_CONTROL_ALLY = 6 + constant integer bj_CAMPPINGSTYLE_CONTROL_NEUTRAL = 7 + constant integer bj_CAMPPINGSTYLE_CONTROL_ENEMY = 8 + // Corpse creation settings constant real bj_CORPSE_MAX_DEATH_TIME = 8.00 @@ -626,6 +647,8 @@ globals lightning bj_lastCreatedLightning = null image bj_lastCreatedImage = null ubersplat bj_lastCreatedUbersplat = null + minimapicon bj_lastCreatedMinimapIcon = null + commandbuttoneffect bj_lastCreatedCommandButtonEffect = null // Filter function vars boolexpr filterIssueHauntOrderAtLocBJ = null @@ -1214,7 +1237,8 @@ endfunction // clipping the result to 0..max in case the input is invalid. // function PercentToInt takes real percentage, integer max returns integer - local integer result = R2I(percentage * I2R(max) * 0.01) + local real realpercent = percentage * I2R(max) * 0.01 + local integer result = MathRound(realpercent) if (result < 0) then set result = 0 @@ -1310,6 +1334,14 @@ function CameraSetupApplyForPlayer takes boolean doPan, camerasetup whichSetup, endif endfunction +//=========================================================================== +function CameraSetupApplyForPlayerSmooth takes boolean doPan, camerasetup whichSetup, player whichPlayer, real forcedDuration, real easeInDuration, real easeOutDuration, real smoothFactor returns nothing + if (GetLocalPlayer() == whichPlayer) then + // Use only local code (no net traffic) within this block to avoid desyncs. + call BlzCameraSetupApplyForceDurationSmooth(whichSetup, doPan, forcedDuration, easeInDuration, easeOutDuration, smoothFactor) + endif +endfunction + //=========================================================================== function CameraSetupGetFieldSwap takes camerafield whichField, camerasetup whichSetup returns real return CameraSetupGetField(whichSetup, whichField) @@ -1648,8 +1680,8 @@ endfunction // function SubStringBJ takes string source, integer start, integer end returns string return SubString(source, start-1, end) -endfunction - +endfunction + function GetHandleIdBJ takes handle h returns integer return GetHandleId(h) endfunction @@ -1850,6 +1882,31 @@ function TriggerRegisterBuildSubmenuEventBJ takes trigger trig returns event return TriggerRegisterGameEvent(trig, EVENT_GAME_BUILD_SUBMENU) endfunction +//=========================================================================== +function TriggerRegisterBuildCommandEventBJ takes trigger trig, integer unitId returns event + call TriggerRegisterCommandEvent(trig, 'ANbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AHbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AEbu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AObu', UnitId2String(unitId)) + call TriggerRegisterCommandEvent(trig, 'AUbu', UnitId2String(unitId)) + return TriggerRegisterCommandEvent(trig, 'AGbu', UnitId2String(unitId)) +endfunction + +//=========================================================================== +function TriggerRegisterTrainCommandEventBJ takes trigger trig, integer unitId returns event + return TriggerRegisterCommandEvent(trig, 'Aque', UnitId2String(unitId)) +endfunction + +//=========================================================================== +function TriggerRegisterUpgradeCommandEventBJ takes trigger trig, integer techId returns event + return TriggerRegisterUpgradeCommandEvent(trig, techId) +endfunction + +//=========================================================================== +function TriggerRegisterCommonCommandEventBJ takes trigger trig, string order returns event + return TriggerRegisterCommandEvent(trig, 0, order) +endfunction + //=========================================================================== function TriggerRegisterGameLoadedEventBJ takes trigger trig returns event return TriggerRegisterGameEvent(trig, EVENT_GAME_LOADED) @@ -2187,6 +2244,159 @@ function GetLastCreatedUbersplat takes nothing returns ubersplat return bj_lastCreatedUbersplat endfunction +//============================================================================ +function GetLastCreatedMinimapIcon takes nothing returns minimapicon + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconOnUnitBJ takes unit whichUnit, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIconOnUnit(whichUnit, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconAtLocBJ takes location where, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIconAtLoc(where, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CreateMinimapIconBJ takes real x, real y, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon + set bj_lastCreatedMinimapIcon = CreateMinimapIcon(x, y, red, green, blue, pingPath, fogVisibility) + return bj_lastCreatedMinimapIcon +endfunction + +//============================================================================ +function CampaignMinimapIconUnitBJ takes unit whichUnit, integer style returns nothing + local integer red + local integer green + local integer blue + local string path + if ( style == bj_CAMPPINGSTYLE_PRIMARY ) then + // green + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_GREEN ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_RED ) then + // green + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_BONUS ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectiveBonus" ) + elseif ( style == bj_CAMPPINGSTYLE_TURNIN ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestTurnIn" ) + elseif ( style == bj_CAMPPINGSTYLE_BOSS ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestBoss" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ALLY ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_NEUTRAL ) then + // white + set red = 255 + set green = 255 + set blue = 255 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ENEMY ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + endif + call CreateMinimapIconOnUnitBJ( whichUnit, red, green, blue, path, FOG_OF_WAR_MASKED ) + call SetMinimapIconOrphanDestroy( bj_lastCreatedMinimapIcon, true ) +endfunction + + +//============================================================================ +function CampaignMinimapIconLocBJ takes location where, integer style returns nothing + local integer red + local integer green + local integer blue + local string path + if ( style == bj_CAMPPINGSTYLE_PRIMARY ) then + // green (different from the unit version) + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_GREEN ) then + // green (different from the unit version) + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_PRIMARY_RED ) then + // green (different from the unit version) + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectivePrimary" ) + elseif ( style == bj_CAMPPINGSTYLE_BONUS ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestObjectiveBonus" ) + elseif ( style == bj_CAMPPINGSTYLE_TURNIN ) then + // yellow + set red = 255 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestTurnIn" ) + elseif ( style == bj_CAMPPINGSTYLE_BOSS ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestBoss" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ALLY ) then + // green + set red = 0 + set green = 255 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_NEUTRAL ) then + // white + set red = 255 + set green = 255 + set blue = 255 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + elseif ( style == bj_CAMPPINGSTYLE_CONTROL_ENEMY ) then + // red + set red = 255 + set green = 0 + set blue = 0 + set path = SkinManagerGetLocalPath( "MinimapQuestControlPoint" ) + endif + call CreateMinimapIconAtLocBJ( where, red, green, blue, path, FOG_OF_WAR_MASKED ) +endfunction + //*************************************************************************** //* @@ -2568,6 +2778,67 @@ endfunction +//*************************************************************************** +//* +//* Command Button Effect Utility Functions +//* +//*************************************************************************** + +//=========================================================================== +function CreateCommandButtonEffectBJ takes integer abilityId, string order returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(abilityId, order) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateTrainCommandButtonEffectBJ takes integer unitId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect('Aque', UnitId2String(unitId)) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateUpgradeCommandButtonEffectBJ takes integer techId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateUpgradeCommandButtonEffect(techId) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateCommonCommandButtonEffectBJ takes string order returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(0, order) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateLearnCommandButtonEffectBJ takes integer abilityId returns commandbuttoneffect + set bj_lastCreatedCommandButtonEffect = CreateLearnCommandButtonEffect(abilityId) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function CreateBuildCommandButtonEffectBJ takes integer unitId returns commandbuttoneffect + local race r = GetPlayerRace(GetLocalPlayer()) + local integer abilityId + if (r == RACE_HUMAN) then + set abilityId = 'AHbu' + elseif (r == RACE_ORC) then + set abilityId = 'AObu' + elseif (r == RACE_UNDEAD) then + set abilityId = 'AUbu' + elseif (r == RACE_NIGHTELF) then + set abilityId = 'AEbu' + else + set abilityId = 'ANbu' + endif + set bj_lastCreatedCommandButtonEffect = CreateCommandButtonEffect(abilityId, UnitId2String(unitId)) + return bj_lastCreatedCommandButtonEffect +endfunction + +//=========================================================================== +function GetLastCreatedCommandButtonEffectBJ takes nothing returns commandbuttoneffect + return bj_lastCreatedCommandButtonEffect +endfunction + + //*************************************************************************** //* //* Hero and Item Utility Functions @@ -2646,7 +2917,7 @@ endfunction function UnitAddItemByIdSwapped takes integer itemId, unit whichHero returns item // Create the item at the hero's feet first, and then give it to him. // This is to ensure that the item will be left at the hero's feet if - // his inventory is full. + // his inventory is full. set bj_lastCreatedItem = CreateItem(itemId, GetUnitX(whichHero), GetUnitY(whichHero)) call UnitAddItem(whichHero, bj_lastCreatedItem) return bj_lastCreatedItem @@ -2697,6 +2968,26 @@ function SuspendHeroXPBJ takes boolean flag, unit whichHero returns nothing call SuspendHeroXP(whichHero, not flag) endfunction +//=========================================================================== +function SetPlayerHandicapDamageBJ takes player whichPlayer, real handicapPercent returns nothing + call SetPlayerHandicapDamage(whichPlayer, handicapPercent * 0.01) +endfunction + +//=========================================================================== +function GetPlayerHandicapDamageBJ takes player whichPlayer returns real + return GetPlayerHandicapDamage(whichPlayer) * 100 +endfunction + +//=========================================================================== +function SetPlayerHandicapReviveTimeBJ takes player whichPlayer, real handicapPercent returns nothing + call SetPlayerHandicapReviveTime(whichPlayer, handicapPercent * 0.01) +endfunction + +//=========================================================================== +function GetPlayerHandicapReviveTimeBJ takes player whichPlayer returns real + return GetPlayerHandicapReviveTime(whichPlayer) * 100 +endfunction + //=========================================================================== function SetPlayerHandicapXPBJ takes player whichPlayer, real handicapPercent returns nothing call SetPlayerHandicapXP(whichPlayer, handicapPercent * 0.01) @@ -3024,7 +3315,7 @@ endfunction //=========================================================================== function String2OrderIdBJ takes string orderIdString returns integer local integer orderId - + // Check to see if it's a generic order. set orderId = OrderId(orderIdString) if (orderId != 0) then @@ -3589,7 +3880,7 @@ function PauseAllUnitsBJEnum takes nothing returns nothing endfunction //=========================================================================== -// Pause all units +// Pause all units function PauseAllUnitsBJ takes boolean pause returns nothing local integer index local player indexPlayer @@ -4978,7 +5269,7 @@ function PlayersAreCoAllied takes player playerA, player playerB returns boolean endfunction //=========================================================================== -// Force (whichPlayer) AI player to share vision and advanced unit control +// Force (whichPlayer) AI player to share vision and advanced unit control // with all AI players of its allies. // function ShareEverythingWithTeamAI takes player whichPlayer returns nothing @@ -5026,7 +5317,7 @@ endfunction //=========================================================================== // Creates a 'Neutral Victim' player slot. This slot is passive towards all // other players, but all other players are aggressive towards him/her. -// +// function ConfigureNeutralVictim takes nothing returns nothing local integer index local player indexPlayer @@ -6301,7 +6592,7 @@ function PingMinimapForForceEx takes force whichForce, real x, real y, real dura else // Unrecognized ping style - ignore the request. endif - + //call StartSound(bj_pingMinimapSound) endif endfunction @@ -6367,8 +6658,8 @@ endfunction //=========================================================================== function SetCinematicSceneBJ takes sound soundHandle, integer portraitUnitId, playercolor color, string speakerTitle, string text, real sceneDuration, real voiceoverDuration returns nothing set bj_cineSceneLastSound = soundHandle - call PlaySoundBJ(soundHandle) call SetCinematicScene(portraitUnitId, color, speakerTitle, text, sceneDuration, voiceoverDuration) + call PlaySoundBJ(soundHandle) endfunction //=========================================================================== @@ -6442,6 +6733,8 @@ endfunction function TransmissionFromUnitWithNameBJ takes force toForce, unit whichUnit, string unitName, sound soundHandle, string message, integer timeType, real timeVal, boolean wait returns nothing call TryInitCinematicBehaviorBJ() + call AttachSoundToUnit(soundHandle, whichUnit) + // Ensure that the time value is non-negative. set timeVal = RMaxBJ(timeVal, 0) @@ -6469,6 +6762,62 @@ function TransmissionFromUnitWithNameBJ takes force toForce, unit whichUnit, str endfunction +//=========================================================================== +function PlayDialogueFromSpeakerEx takes force toForce, unit speaker, integer speakerType, sound soundHandle, integer timeType, real timeVal, boolean wait returns boolean + //Make sure that the runtime unit type and the parameter are the same, + //otherwise the offline animations will not match and will fail + if GetUnitTypeId(speaker) != speakerType then + debug call BJDebugMsg(("Attempted to play FacialAnimation with the wrong speaker UnitType - Param: " + I2S(speakerType) + " Runtime: " + I2S(GetUnitTypeId(speaker)))) + //return false + endif + + call TryInitCinematicBehaviorBJ() + + call AttachSoundToUnit(soundHandle, speaker) + + // Ensure that the time value is non-negative. + set timeVal = RMaxBJ(timeVal, 0) + + set bj_lastTransmissionDuration = GetTransmissionDuration(soundHandle, timeType, timeVal) + set bj_lastPlayedSound = soundHandle + + if (IsPlayerInForce(GetLocalPlayer(), toForce)) then + call SetCinematicSceneBJ(soundHandle, speakerType, GetPlayerColor(GetOwningPlayer(speaker)), GetLocalizedString(GetDialogueSpeakerNameKey(soundHandle)), GetLocalizedString(GetDialogueTextKey(soundHandle)), bj_lastTransmissionDuration + bj_TRANSMISSION_PORT_HANGTIME, bj_lastTransmissionDuration) + endif + + if wait and (bj_lastTransmissionDuration > 0) then + // call TriggerSleepAction(bj_lastTransmissionDuration) + call WaitTransmissionDuration(soundHandle, timeType, timeVal) + endif + + return true +endfunction + +//=========================================================================== +function PlayDialogueFromSpeakerTypeEx takes force toForce, player fromPlayer, integer speakerType, location loc, sound soundHandle, integer timeType, real timeVal, boolean wait returns boolean + call TryInitCinematicBehaviorBJ() + + // Ensure that the time value is non-negative. + set timeVal = RMaxBJ(timeVal, 0) + + set bj_lastTransmissionDuration = GetTransmissionDuration(soundHandle, timeType, timeVal) + set bj_lastPlayedSound = soundHandle + + if (IsPlayerInForce(GetLocalPlayer(), toForce)) then + call SetCinematicSceneBJ(soundHandle, speakerType, GetPlayerColor(fromPlayer), GetLocalizedString(GetDialogueSpeakerNameKey(soundHandle)), GetLocalizedString(GetDialogueTextKey(soundHandle)), bj_lastTransmissionDuration + bj_TRANSMISSION_PORT_HANGTIME, bj_lastTransmissionDuration) + if(speakerType != 0) then + call PingMinimap(GetLocationX(loc), GetLocationY(loc), bj_TRANSMISSION_PING_TIME) + endif + endif + + if wait and (bj_lastTransmissionDuration > 0) then + // call TriggerSleepAction(bj_lastTransmissionDuration) + call WaitTransmissionDuration(soundHandle, timeType, timeVal) + endif + + return true +endfunction + //=========================================================================== // This operates like TransmissionFromUnitWithNameBJ, but for a unit type // rather than a unit instance. As such, no speech indicator is employed. @@ -6540,6 +6889,7 @@ function CinematicModeExBJ takes boolean cineMode, force forForce, real interfac if (cineMode) then // Save the UI state so that we can restore it later. if (not bj_cineModeAlreadyIn) then + call SetCinematicAudio(true) set bj_cineModeAlreadyIn = true set bj_cineModePriorSpeed = GetGameSpeed() set bj_cineModePriorFogSetting = IsFogEnabled() @@ -6570,6 +6920,7 @@ function CinematicModeExBJ takes boolean cineMode, force forForce, real interfac call SetRandomSeed(0) else set bj_cineModeAlreadyIn = false + call SetCinematicAudio(false) // Perform local changes if (IsPlayerInForce(GetLocalPlayer(), forForce)) then @@ -6624,8 +6975,8 @@ function CinematicFadeCommonBJ takes real red, real green, real blue, real durat call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) call SetCineFilterStartUV(0, 0, 1, 1) call SetCineFilterEndUV(0, 0, 1, 1) - call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-startTrans)) - call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100-endTrans)) + call SetCineFilterStartColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-startTrans)) + call SetCineFilterEndColor(PercentTo255(red), PercentTo255(green), PercentTo255(blue), PercentTo255(100.0-endTrans)) call SetCineFilterDuration(duration) call DisplayCineFilter(true) endfunction @@ -6709,8 +7060,8 @@ function CinematicFilterGenericBJ takes real duration, blendmode bmode, string t call SetCineFilterTexMapFlags(TEXMAP_FLAG_NONE) call SetCineFilterStartUV(0, 0, 1, 1) call SetCineFilterEndUV(0, 0, 1, 1) - call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100-trans0)) - call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100-trans1)) + call SetCineFilterStartColor(PercentTo255(red0), PercentTo255(green0), PercentTo255(blue0), PercentTo255(100.0-trans0)) + call SetCineFilterEndColor(PercentTo255(red1), PercentTo255(green1), PercentTo255(blue1), PercentTo255(100.0-trans1)) call SetCineFilterDuration(duration) call DisplayCineFilter(true) endfunction @@ -6957,7 +7308,7 @@ function SetCinematicAvailableBJ takes boolean available, integer cinematicIndex call PlayCinematic( "NightElfEd" ) elseif (cinematicIndex == bj_CINEMATICINDEX_XOP) then call SetOpCinematicAvailable( bj_CAMPAIGN_OFFSET_XN, available ) - call PlayCinematic( "IntroX" ) + // call PlayCinematic( "IntroX" ) elseif (cinematicIndex == bj_CINEMATICINDEX_XED) then call SetEdCinematicAvailable( bj_CAMPAIGN_OFFSET_XU, available ) call PlayCinematic( "OutroX" ) @@ -7569,6 +7920,13 @@ function IsCustomCampaignButtonVisibile takes integer whichButton returns boolea return GetCustomCampaignButtonVisible(whichButton - 1) endfunction +//=========================================================================== +// Placeholder function for auto save feature +//=========================================================================== +function SaveGameCheckPointBJ takes string mapSaveName, boolean doCheckpointHint returns nothing + call SaveGameCheckpoint(mapSaveName, doCheckpointHint) +endfunction + //=========================================================================== function LoadGameBJ takes string loadFileName, boolean doScoreScreen returns nothing call LoadGame(loadFileName, doScoreScreen) @@ -8120,7 +8478,7 @@ endfunction //=========================================================================== function MeleeClearNearbyUnits takes real x, real y, real range returns nothing local group nearbyUnits - + set nearbyUnits = CreateGroup() call GroupEnumUnitsInRange(nearbyUnits, x, y, range, null) call ForGroup(nearbyUnits, function MeleeClearExcessUnit) @@ -8282,7 +8640,7 @@ function MeleeStartingUnitsHuman takes player whichPlayer, location startLoc, bo if (nearestMine != null) then // Spawn Town Hall at the start location. set townHall = CreateUnitAtLoc(whichPlayer, 'htow', startLoc, bj_UNIT_FACING) - + // Spawn Peasants near the mine. set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0) set peonX = GetLocationX(nearMineLoc) @@ -8298,7 +8656,7 @@ function MeleeStartingUnitsHuman takes player whichPlayer, location startLoc, bo else // Spawn Town Hall at the start location. set townHall = CreateUnitAtLoc(whichPlayer, 'htow', startLoc, bj_UNIT_FACING) - + // Spawn Peasants directly south of the town hall. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8356,7 +8714,7 @@ function MeleeStartingUnitsOrc takes player whichPlayer, location startLoc, bool if (nearestMine != null) then // Spawn Great Hall at the start location. call CreateUnitAtLoc(whichPlayer, 'ogre', startLoc, bj_UNIT_FACING) - + // Spawn Peons near the mine. set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0) set peonX = GetLocationX(nearMineLoc) @@ -8372,7 +8730,7 @@ function MeleeStartingUnitsOrc takes player whichPlayer, location startLoc, bool else // Spawn Great Hall at the start location. call CreateUnitAtLoc(whichPlayer, 'ogre', startLoc, bj_UNIT_FACING) - + // Spawn Peons directly south of the town hall. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8431,7 +8789,7 @@ function MeleeStartingUnitsUndead takes player whichPlayer, location startLoc, b if (nearestMine != null) then // Spawn Necropolis at the start location. call CreateUnitAtLoc(whichPlayer, 'unpl', startLoc, bj_UNIT_FACING) - + // Replace the nearest gold mine with a blighted version. set nearestMine = BlightGoldMineForPlayerBJ(nearestMine, whichPlayer) @@ -8457,7 +8815,7 @@ function MeleeStartingUnitsUndead takes player whichPlayer, location startLoc, b else // Spawn Necropolis at the start location. call CreateUnitAtLoc(whichPlayer, 'unpl', startLoc, bj_UNIT_FACING) - + // Spawn Acolytes and Ghoul directly south of the Necropolis. set peonX = GetLocationX(startLoc) set peonY = GetLocationY(startLoc) - 224.00 @@ -8631,7 +8989,7 @@ function MeleeStartingUnits takes nothing returns nothing set index = index + 1 exitwhen index == bj_MAX_PLAYERS endloop - + endfunction //=========================================================================== @@ -8785,7 +9143,7 @@ function MeleeGetAllyStructureCount takes player whichPlayer returns integer if (PlayersAreCoAllied(whichPlayer, indexPlayer)) then set buildingCount = buildingCount + GetPlayerStructureCount(indexPlayer, true) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -8834,12 +9192,9 @@ function MeleeGetAllyKeyStructureCount takes player whichPlayer returns integer loop set indexPlayer = Player(playerIndex) if (PlayersAreCoAllied(whichPlayer, indexPlayer)) then - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "townhall", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "greathall", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "treeoflife", true, true) - set keyStructs = keyStructs + GetPlayerTypedUnitCount(indexPlayer, "necropolis", true, true) + set keyStructs = keyStructs + BlzGetPlayerTownHallCount(indexPlayer) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -8905,7 +9260,7 @@ endfunction //=========================================================================== // Remove all observers -// +// function MeleeRemoveObservers takes nothing returns nothing local integer playerIndex local player indexPlayer @@ -9009,7 +9364,7 @@ function MeleeCheckForLosersAndVictors takes nothing returns nothing set bj_meleeDefeated[playerIndex] = true endif endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -9175,11 +9530,11 @@ endfunction //=========================================================================== function MeleePlayerIsCrippled takes player whichPlayer returns boolean - local integer allyStructures = MeleeGetAllyStructureCount(whichPlayer) - local integer allyKeyStructures = MeleeGetAllyKeyStructureCount(whichPlayer) + local integer playerStructures = GetPlayerStructureCount(whichPlayer, true) + local integer playerKeyStructures = BlzGetPlayerTownHallCount(whichPlayer) - // Dead teams are not considered to be crippled. - return (allyStructures > 0) and (allyKeyStructures <= 0) + // Dead players are not considered to be crippled. + return (playerStructures > 0) and (playerKeyStructures <= 0) endfunction //=========================================================================== @@ -9245,7 +9600,7 @@ function MeleeCheckForCrippledPlayers takes nothing returns nothing call MeleeExposePlayer(indexPlayer, false) endif - + set playerIndex = playerIndex + 1 exitwhen playerIndex == bj_MAX_PLAYERS endloop @@ -9332,7 +9687,7 @@ function MeleeTriggerActionPlayerLeft takes nothing returns nothing call CachePlayerHeroData(thePlayer) - // This is the same as defeat except the player generates the message + // This is the same as defeat except the player generates the message // "player left the game" as opposed to "player was defeated". if (MeleeGetAllyCount(thePlayer) > 0) then @@ -10134,7 +10489,7 @@ endfunction //* //* - RandomDistChoose will use the current distribution list to choose //* one of the objects randomly based on the chance distribution -//* +//* //* Note that the chances are effectively normalized by their sum, //* so only the relative values of each chance are important //* @@ -10376,7 +10731,7 @@ function BlzRemoveAbilityStringLevelArrayFieldBJ takes ability whichAbility, abi set bj_lastInstObjFuncSuccessful = BlzRemoveAbilityStringLevelArrayField(whichAbility, whichField, level, value) endfunction -// Item +// Item //============================================================= function BlzItemAddAbilityBJ takes item whichItem, integer abilCode returns nothing set bj_lastInstObjFuncSuccessful = BlzItemAddAbility(whichItem, abilCode) @@ -10408,7 +10763,7 @@ function BlzSetItemStringFieldBJ takes item whichItem, itemstringfield whichFiel endfunction -// Unit +// Unit //=========================================================================== function BlzSetUnitBooleanFieldBJ takes unit whichUnit, unitbooleanfield whichField, boolean value returns nothing set bj_lastInstObjFuncSuccessful = BlzSetUnitBooleanField(whichUnit, whichField, value) diff --git a/de.peeeq.wurstscript/src/main/resources/common.j b/de.peeeq.wurstscript/src/main/resources/common.j index 5ad446985..1bea181a6 100644 --- a/de.peeeq.wurstscript/src/main/resources/common.j +++ b/de.peeeq.wurstscript/src/main/resources/common.j @@ -56,6 +56,7 @@ type mapvisibility extends handle type mapsetting extends handle type mapdensity extends handle type mapcontrol extends handle +type minimapicon extends handle type playerslotstate extends handle type volumegroup extends handle type camerafield extends handle @@ -136,6 +137,7 @@ type defensetype extends handle type regentype extends handle type unitcategory extends handle type pathingflag extends handle +type commandbuttoneffect extends handle constant native ConvertRace takes integer i returns race @@ -245,7 +247,7 @@ constant native GetPlayerNeutralAggressive takes nothing returns integer globals //=================================================== -// Game Constants +// Game Constants //=================================================== // pfff @@ -442,7 +444,7 @@ globals constant subanimtype SUBANIM_TYPE_BERSERK = ConvertSubAnimType(62) //=================================================== -// Map Setup Constants +// Map Setup Constants //=================================================== constant racepreference RACE_PREF_HUMAN = ConvertRacePref(1) @@ -478,7 +480,7 @@ globals constant mapflag MAP_OBSERVERS_ON_DEATH = ConvertMapFlag(32) constant mapflag MAP_FIXED_COLORS = ConvertMapFlag(128) - + constant mapflag MAP_LOCK_RESOURCE_TRADING = ConvertMapFlag(256) constant mapflag MAP_RESOURCE_TRADING_ALLIES_ONLY = ConvertMapFlag(512) @@ -498,7 +500,7 @@ globals constant placement MAP_PLACEMENT_RANDOM = ConvertPlacement(0) // random among all slots constant placement MAP_PLACEMENT_FIXED = ConvertPlacement(1) // player 0 in start loc 0... constant placement MAP_PLACEMENT_USE_MAP_SETTINGS = ConvertPlacement(2) // whatever was specified by the script - constant placement MAP_PLACEMENT_TEAMS_TOGETHER = ConvertPlacement(3) // random with allies next to each other + constant placement MAP_PLACEMENT_TEAMS_TOGETHER = ConvertPlacement(3) // random with allies next to each other constant startlocprio MAP_LOC_PRIO_LOW = ConvertStartLocPrio(0) constant startlocprio MAP_LOC_PRIO_HIGH = ConvertStartLocPrio(1) @@ -613,7 +615,7 @@ globals constant playerscore PLAYER_SCORE_HERO_TOTAL = ConvertPlayerScore(22) constant playerscore PLAYER_SCORE_RESOURCE_TOTAL = ConvertPlayerScore(23) constant playerscore PLAYER_SCORE_TOTAL = ConvertPlayerScore(24) - + //=================================================== // Game, Player and Unit Events // @@ -630,14 +632,14 @@ globals //=================================================== //=================================================== - // For use with TriggerRegisterGameEvent - //=================================================== + // For use with TriggerRegisterGameEvent + //=================================================== constant gameevent EVENT_GAME_VICTORY = ConvertGameEvent(0) constant gameevent EVENT_GAME_END_LEVEL = ConvertGameEvent(1) constant gameevent EVENT_GAME_VARIABLE_LIMIT = ConvertGameEvent(2) - constant gameevent EVENT_GAME_STATE_LIMIT = ConvertGameEvent(3) + constant gameevent EVENT_GAME_STATE_LIMIT = ConvertGameEvent(3) constant gameevent EVENT_GAME_TIMER_EXPIRED = ConvertGameEvent(4) @@ -647,7 +649,7 @@ globals constant gameevent EVENT_GAME_TRACKABLE_HIT = ConvertGameEvent(7) constant gameevent EVENT_GAME_TRACKABLE_TRACK = ConvertGameEvent(8) - constant gameevent EVENT_GAME_SHOW_SKILL = ConvertGameEvent(9) + constant gameevent EVENT_GAME_SHOW_SKILL = ConvertGameEvent(9) constant gameevent EVENT_GAME_BUILD_SUBMENU = ConvertGameEvent(10) //=================================================== @@ -714,7 +716,7 @@ globals constant playerunitevent EVENT_PLAYER_UNIT_LOADED = ConvertPlayerUnitEvent(51) constant playerunitevent EVENT_PLAYER_UNIT_DAMAGED = ConvertPlayerUnitEvent(308) constant playerunitevent EVENT_PLAYER_UNIT_DAMAGING = ConvertPlayerUnitEvent(315) - + //=================================================== // For use with TriggerRegisterUnitEvent //=================================================== @@ -727,48 +729,48 @@ globals constant unitevent EVENT_UNIT_HIDDEN = ConvertUnitEvent(56) constant unitevent EVENT_UNIT_SELECTED = ConvertUnitEvent(57) constant unitevent EVENT_UNIT_DESELECTED = ConvertUnitEvent(58) - - constant unitevent EVENT_UNIT_STATE_LIMIT = ConvertUnitEvent(59) - // Events which may have a filter for the "other unit" - // + constant unitevent EVENT_UNIT_STATE_LIMIT = ConvertUnitEvent(59) + + // Events which may have a filter for the "other unit" + // constant unitevent EVENT_UNIT_ACQUIRED_TARGET = ConvertUnitEvent(60) constant unitevent EVENT_UNIT_TARGET_IN_RANGE = ConvertUnitEvent(61) constant unitevent EVENT_UNIT_ATTACKED = ConvertUnitEvent(62) constant unitevent EVENT_UNIT_RESCUED = ConvertUnitEvent(63) - + constant unitevent EVENT_UNIT_CONSTRUCT_CANCEL = ConvertUnitEvent(64) constant unitevent EVENT_UNIT_CONSTRUCT_FINISH = ConvertUnitEvent(65) - + constant unitevent EVENT_UNIT_UPGRADE_START = ConvertUnitEvent(66) constant unitevent EVENT_UNIT_UPGRADE_CANCEL = ConvertUnitEvent(67) constant unitevent EVENT_UNIT_UPGRADE_FINISH = ConvertUnitEvent(68) - - // Events which involve the specified unit performing - // training of other units - // + + // Events which involve the specified unit performing + // training of other units + // constant unitevent EVENT_UNIT_TRAIN_START = ConvertUnitEvent(69) constant unitevent EVENT_UNIT_TRAIN_CANCEL = ConvertUnitEvent(70) constant unitevent EVENT_UNIT_TRAIN_FINISH = ConvertUnitEvent(71) - + constant unitevent EVENT_UNIT_RESEARCH_START = ConvertUnitEvent(72) constant unitevent EVENT_UNIT_RESEARCH_CANCEL = ConvertUnitEvent(73) constant unitevent EVENT_UNIT_RESEARCH_FINISH = ConvertUnitEvent(74) - + constant unitevent EVENT_UNIT_ISSUED_ORDER = ConvertUnitEvent(75) constant unitevent EVENT_UNIT_ISSUED_POINT_ORDER = ConvertUnitEvent(76) constant unitevent EVENT_UNIT_ISSUED_TARGET_ORDER = ConvertUnitEvent(77) - + constant unitevent EVENT_UNIT_HERO_LEVEL = ConvertUnitEvent(78) constant unitevent EVENT_UNIT_HERO_SKILL = ConvertUnitEvent(79) - + constant unitevent EVENT_UNIT_HERO_REVIVABLE = ConvertUnitEvent(80) constant unitevent EVENT_UNIT_HERO_REVIVE_START = ConvertUnitEvent(81) constant unitevent EVENT_UNIT_HERO_REVIVE_CANCEL = ConvertUnitEvent(82) constant unitevent EVENT_UNIT_HERO_REVIVE_FINISH = ConvertUnitEvent(83) - + constant unitevent EVENT_UNIT_SUMMON = ConvertUnitEvent(84) - + constant unitevent EVENT_UNIT_DROP_ITEM = ConvertUnitEvent(85) constant unitevent EVENT_UNIT_PICKUP_ITEM = ConvertUnitEvent(86) constant unitevent EVENT_UNIT_USE_ITEM = ConvertUnitEvent(87) @@ -783,7 +785,11 @@ globals //=================================================== // Frozen Throne Expansion Events // Need to be added here to preserve compat - //=================================================== + //=================================================== + + //=================================================== + // For use with TriggerRegisterGameEvent + //=================================================== constant gameevent EVENT_GAME_LOADED = ConvertGameEvent(256) constant gameevent EVENT_GAME_TOURNAMENT_FINISH_SOON = ConvertGameEvent(257) @@ -840,7 +846,7 @@ globals constant unitevent EVENT_UNIT_PAWN_ITEM = ConvertUnitEvent(294) //=================================================== - // Limit Event API constants + // Limit Event API constants // variable, player state, game state, and unit state events // ( do NOT change the order of these... ) //=================================================== @@ -878,9 +884,9 @@ globals constant unittype UNIT_TYPE_MECHANICAL = ConvertUnitType(15) constant unittype UNIT_TYPE_PEON = ConvertUnitType(16) constant unittype UNIT_TYPE_SAPPER = ConvertUnitType(17) - constant unittype UNIT_TYPE_TOWNHALL = ConvertUnitType(18) + constant unittype UNIT_TYPE_TOWNHALL = ConvertUnitType(18) constant unittype UNIT_TYPE_ANCIENT = ConvertUnitType(19) - + constant unittype UNIT_TYPE_TAUREN = ConvertUnitType(20) constant unittype UNIT_TYPE_POISONED = ConvertUnitType(21) constant unittype UNIT_TYPE_POLYMORPHED = ConvertUnitType(22) @@ -929,7 +935,7 @@ globals constant blendmode BLEND_MODE_ADDITIVE = ConvertBlendMode(3) constant blendmode BLEND_MODE_MODULATE = ConvertBlendMode(4) constant blendmode BLEND_MODE_MODULATE_2X = ConvertBlendMode(5) - + constant raritycontrol RARITY_FREQUENT = ConvertRarityControl(0) constant raritycontrol RARITY_RARE = ConvertRarityControl(1) @@ -970,24 +976,29 @@ globals // Custom UI API constants //=================================================== - constant originframetype ORIGIN_FRAME_GAME_UI = ConvertOriginFrameType(0) - constant originframetype ORIGIN_FRAME_COMMAND_BUTTON = ConvertOriginFrameType(1) - constant originframetype ORIGIN_FRAME_HERO_BAR = ConvertOriginFrameType(2) - constant originframetype ORIGIN_FRAME_HERO_BUTTON = ConvertOriginFrameType(3) - constant originframetype ORIGIN_FRAME_HERO_HP_BAR = ConvertOriginFrameType(4) - constant originframetype ORIGIN_FRAME_HERO_MANA_BAR = ConvertOriginFrameType(5) - constant originframetype ORIGIN_FRAME_HERO_BUTTON_INDICATOR = ConvertOriginFrameType(6) - constant originframetype ORIGIN_FRAME_ITEM_BUTTON = ConvertOriginFrameType(7) - constant originframetype ORIGIN_FRAME_MINIMAP = ConvertOriginFrameType(8) - constant originframetype ORIGIN_FRAME_MINIMAP_BUTTON = ConvertOriginFrameType(9) - constant originframetype ORIGIN_FRAME_SYSTEM_BUTTON = ConvertOriginFrameType(10) - constant originframetype ORIGIN_FRAME_TOOLTIP = ConvertOriginFrameType(11) - constant originframetype ORIGIN_FRAME_UBERTOOLTIP = ConvertOriginFrameType(12) - constant originframetype ORIGIN_FRAME_CHAT_MSG = ConvertOriginFrameType(13) - constant originframetype ORIGIN_FRAME_UNIT_MSG = ConvertOriginFrameType(14) - constant originframetype ORIGIN_FRAME_TOP_MSG = ConvertOriginFrameType(15) - constant originframetype ORIGIN_FRAME_PORTRAIT = ConvertOriginFrameType(16) - constant originframetype ORIGIN_FRAME_WORLD_FRAME = ConvertOriginFrameType(17) + constant originframetype ORIGIN_FRAME_GAME_UI = ConvertOriginFrameType(0) + constant originframetype ORIGIN_FRAME_COMMAND_BUTTON = ConvertOriginFrameType(1) + constant originframetype ORIGIN_FRAME_HERO_BAR = ConvertOriginFrameType(2) + constant originframetype ORIGIN_FRAME_HERO_BUTTON = ConvertOriginFrameType(3) + constant originframetype ORIGIN_FRAME_HERO_HP_BAR = ConvertOriginFrameType(4) + constant originframetype ORIGIN_FRAME_HERO_MANA_BAR = ConvertOriginFrameType(5) + constant originframetype ORIGIN_FRAME_HERO_BUTTON_INDICATOR = ConvertOriginFrameType(6) + constant originframetype ORIGIN_FRAME_ITEM_BUTTON = ConvertOriginFrameType(7) + constant originframetype ORIGIN_FRAME_MINIMAP = ConvertOriginFrameType(8) + constant originframetype ORIGIN_FRAME_MINIMAP_BUTTON = ConvertOriginFrameType(9) + constant originframetype ORIGIN_FRAME_SYSTEM_BUTTON = ConvertOriginFrameType(10) + constant originframetype ORIGIN_FRAME_TOOLTIP = ConvertOriginFrameType(11) + constant originframetype ORIGIN_FRAME_UBERTOOLTIP = ConvertOriginFrameType(12) + constant originframetype ORIGIN_FRAME_CHAT_MSG = ConvertOriginFrameType(13) + constant originframetype ORIGIN_FRAME_UNIT_MSG = ConvertOriginFrameType(14) + constant originframetype ORIGIN_FRAME_TOP_MSG = ConvertOriginFrameType(15) + constant originframetype ORIGIN_FRAME_PORTRAIT = ConvertOriginFrameType(16) + constant originframetype ORIGIN_FRAME_WORLD_FRAME = ConvertOriginFrameType(17) + constant originframetype ORIGIN_FRAME_SIMPLE_UI_PARENT = ConvertOriginFrameType(18) + constant originframetype ORIGIN_FRAME_PORTRAIT_HP_TEXT = ConvertOriginFrameType(19) + constant originframetype ORIGIN_FRAME_PORTRAIT_MANA_TEXT = ConvertOriginFrameType(20) + constant originframetype ORIGIN_FRAME_UNIT_PANEL_BUFF_BAR = ConvertOriginFrameType(21) + constant originframetype ORIGIN_FRAME_UNIT_PANEL_BUFF_BAR_LABEL = ConvertOriginFrameType(22) constant framepointtype FRAMEPOINT_TOPLEFT = ConvertFramePointType(0) constant framepointtype FRAMEPOINT_TOP = ConvertFramePointType(1) @@ -1220,7 +1231,7 @@ globals //=================================================== // Instanced Object Operation API constants //=================================================== - + // Ability constant abilityintegerfield ABILITY_IF_BUTTON_POSITION_NORMAL_X = ConvertAbilityIntegerField('abpx') constant abilityintegerfield ABILITY_IF_BUTTON_POSITION_NORMAL_Y = ConvertAbilityIntegerField('abpy') @@ -1234,7 +1245,7 @@ globals constant abilityintegerfield ABILITY_IF_PRIORITY = ConvertAbilityIntegerField('apri') constant abilityintegerfield ABILITY_IF_LEVELS = ConvertAbilityIntegerField('alev') constant abilityintegerfield ABILITY_IF_REQUIRED_LEVEL = ConvertAbilityIntegerField('arlv') - constant abilityintegerfield ABILITY_IF_LEVEL_SKIP_REQUIREMENT = ConvertAbilityIntegerField('alsk') + constant abilityintegerfield ABILITY_IF_LEVEL_SKIP_REQUIREMENT = ConvertAbilityIntegerField('alsk') constant abilitybooleanfield ABILITY_BF_HERO_ABILITY = ConvertAbilityBooleanField('aher') // Get only constant abilitybooleanfield ABILITY_BF_ITEM_ABILITY = ConvertAbilityBooleanField('aite') @@ -1607,7 +1618,7 @@ globals constant abilityreallevelfield ABILITY_RLF_EXTRA_DAMAGE_POA1 = ConvertAbilityRealLevelField('Poa1') constant abilityreallevelfield ABILITY_RLF_DAMAGE_PER_SECOND_POA2 = ConvertAbilityRealLevelField('Poa2') constant abilityreallevelfield ABILITY_RLF_ATTACK_SPEED_FACTOR_POA3 = ConvertAbilityRealLevelField('Poa3') - constant abilityreallevelfield ABILITY_RLF_MOVEMENT_SPEED_FACTOR_POA4 = ConvertAbilityRealLevelField('Poa4') + constant abilityreallevelfield ABILITY_RLF_MOVEMENT_SPEED_FACTOR_POA4 = ConvertAbilityRealLevelField('Poa4') constant abilityreallevelfield ABILITY_RLF_DAMAGE_AMPLIFICATION = ConvertAbilityRealLevelField('Pos2') constant abilityreallevelfield ABILITY_RLF_CHANCE_TO_STOMP_PERCENT = ConvertAbilityRealLevelField('War1') constant abilityreallevelfield ABILITY_RLF_DAMAGE_DEALT_WAR2 = ConvertAbilityRealLevelField('War2') @@ -2096,7 +2107,7 @@ globals constant unitweaponbooleanfield UNIT_WEAPON_BF_ATTACK_SHOW_UI = ConvertUnitWeaponBooleanField('uwu1') constant unitweaponbooleanfield UNIT_WEAPON_BF_ATTACKS_ENABLED = ConvertUnitWeaponBooleanField('uaen') constant unitweaponbooleanfield UNIT_WEAPON_BF_ATTACK_PROJECTILE_HOMING_ENABLED = ConvertUnitWeaponBooleanField('umh1') - + constant unitweaponstringfield UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART = ConvertUnitWeaponStringField('ua1m') // Move Type @@ -2108,7 +2119,7 @@ globals constant movetype MOVE_TYPE_FLOAT = ConvertMoveType(16) constant movetype MOVE_TYPE_AMPHIBIOUS = ConvertMoveType(32) constant movetype MOVE_TYPE_UNBUILDABLE = ConvertMoveType(64) - + // Target Flag constant targetflag TARGET_FLAG_NONE = ConvertTargetFlag(1) constant targetflag TARGET_FLAG_GROUND = ConvertTargetFlag(2) @@ -2205,6 +2216,8 @@ native SquareRoot takes real x returns real // native Pow takes real x, real power returns real +constant native MathRound takes real r returns integer + //============================================================================ // String Utility API native I2R takes integer i returns real @@ -2238,12 +2251,14 @@ native SetMapDescription takes string description returns nothing native SetTeams takes integer teamcount returns nothing native SetPlayers takes integer playercount returns nothing -native DefineStartLocation takes integer whichStartLoc, real x, real y returns nothing -native DefineStartLocationLoc takes integer whichStartLoc, location whichLocation returns nothing -native SetStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing -native SetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing -native GetStartLocPrioSlot takes integer whichStartLoc, integer prioSlotIndex returns integer -native GetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex returns startlocprio +native DefineStartLocation takes integer whichStartLoc, real x, real y returns nothing +native DefineStartLocationLoc takes integer whichStartLoc, location whichLocation returns nothing +native SetStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing +native SetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing +native GetStartLocPrioSlot takes integer whichStartLoc, integer prioSlotIndex returns integer +native GetStartLocPrio takes integer whichStartLoc, integer prioSlotIndex returns startlocprio +native SetEnemyStartLocPrioCount takes integer whichStartLoc, integer prioSlotCount returns nothing +native SetEnemyStartLocPrio takes integer whichStartLoc, integer prioSlotIndex, integer otherStartLocIndex, startlocprio priority returns nothing native SetGameTypeSupported takes gametype whichGameType, boolean value returns nothing native SetMapFlag takes mapflag whichMapFlag, boolean value returns nothing @@ -2276,7 +2291,7 @@ native SetPlayerStartLocation takes player whichPlayer, integer startLocIndex // which removes it from consideration for subsequently placed players // ( i.e. you can use this to put people in a fixed loc and then // use random placement for any unplaced players etc ) -native ForcePlayerStartLocation takes player whichPlayer, integer startLocIndex returns nothing +native ForcePlayerStartLocation takes player whichPlayer, integer startLocIndex returns nothing native SetPlayerColor takes player whichPlayer, playercolor color returns nothing native SetPlayerAlliance takes player sourcePlayer, player otherPlayer, alliancetype whichAllianceSetting, boolean value returns nothing native SetPlayerTaxRate takes player sourcePlayer, player otherPlayer, playerstate whichResource, integer rate returns nothing @@ -2432,6 +2447,8 @@ constant native GetEnumDestructable takes nothing returns destructable constant native GetFilterItem takes nothing returns item constant native GetEnumItem takes nothing returns item +constant native ParseTags takes string taggedString returns string + constant native GetFilterPlayer takes nothing returns player constant native GetEnumPlayer takes nothing returns player @@ -2478,7 +2495,7 @@ native TriggerRegisterDialogButtonEvent takes trigger whichTrigger, button which constant native GetEventGameState takes nothing returns gamestate native TriggerRegisterGameEvent takes trigger whichTrigger, gameevent whichGameEvent returns event - + // EVENT_GAME_VICTORY constant native GetWinningPlayer takes nothing returns player @@ -2497,6 +2514,10 @@ constant native GetLeavingUnit takes nothing returns unit native TriggerRegisterTrackableHitEvent takes trigger whichTrigger, trackable t returns event native TriggerRegisterTrackableTrackEvent takes trigger whichTrigger, trackable t returns event +// EVENT_COMMAND_BUTTON_CLICK +native TriggerRegisterCommandEvent takes trigger whichTrigger, integer whichAbility, string order returns event +native TriggerRegisterUpgradeCommandEvent takes trigger whichTrigger, integer whichUpgrade returns event + // EVENT_GAME_TRACKABLE_HIT // EVENT_GAME_TRACKABLE_TRACK constant native GetTriggeringTrackable takes nothing returns trackable @@ -2691,7 +2712,7 @@ constant native GetEventDamageSource takes nothing returns unit // EVENT_UNIT_DECAY // Use the GetDyingUnit and GetDecayingUnit funcs above -// EVENT_UNIT_DETECTED +// EVENT_UNIT_DETECTED constant native GetEventDetectingPlayer takes nothing returns player native TriggerRegisterFilterUnitEvent takes trigger whichTrigger, unit whichUnit, unitevent whichEvent, boolexpr filter returns event @@ -3092,8 +3113,12 @@ constant native GetPlayerAlliance takes player sourcePlayer, player otherP constant native GetPlayerHandicap takes player whichPlayer returns real constant native GetPlayerHandicapXP takes player whichPlayer returns real +constant native GetPlayerHandicapReviveTime takes player whichPlayer returns real +constant native GetPlayerHandicapDamage takes player whichPlayer returns real constant native SetPlayerHandicap takes player whichPlayer, real handicap returns nothing constant native SetPlayerHandicapXP takes player whichPlayer, real handicap returns nothing +constant native SetPlayerHandicapReviveTime takes player whichPlayer, real handicap returns nothing +constant native SetPlayerHandicapDamage takes player whichPlayer, real handicap returns nothing constant native SetPlayerTechMaxAllowed takes player whichPlayer, integer techid, integer maximum returns nothing constant native GetPlayerTechMaxAllowed takes player whichPlayer, integer techid returns integer @@ -3150,17 +3175,19 @@ native SetCampaignMenuRace takes race r returns nothing native SetCampaignMenuRaceEx takes integer campaignIndex returns nothing native ForceCampaignSelectScreen takes nothing returns nothing -native LoadGame takes string saveFileName, boolean doScoreScreen returns nothing -native SaveGame takes string saveFileName returns nothing -native RenameSaveDirectory takes string sourceDirName, string destDirName returns boolean -native RemoveSaveDirectory takes string sourceDirName returns boolean -native CopySaveGame takes string sourceSaveName, string destSaveName returns boolean -native SaveGameExists takes string saveName returns boolean -native SyncSelections takes nothing returns nothing -native SetFloatGameState takes fgamestate whichFloatGameState, real value returns nothing -constant native GetFloatGameState takes fgamestate whichFloatGameState returns real -native SetIntegerGameState takes igamestate whichIntegerGameState, integer value returns nothing -constant native GetIntegerGameState takes igamestate whichIntegerGameState returns integer +native LoadGame takes string saveFileName, boolean doScoreScreen returns nothing +native SaveGame takes string saveFileName returns nothing +native RenameSaveDirectory takes string sourceDirName, string destDirName returns boolean +native RemoveSaveDirectory takes string sourceDirName returns boolean +native CopySaveGame takes string sourceSaveName, string destSaveName returns boolean +native SaveGameExists takes string saveName returns boolean +native SetMaxCheckpointSaves takes integer maxCheckpointSaves returns nothing +native SaveGameCheckpoint takes string saveFileName, boolean showWindow returns nothing +native SyncSelections takes nothing returns nothing +native SetFloatGameState takes fgamestate whichFloatGameState, real value returns nothing +constant native GetFloatGameState takes fgamestate whichFloatGameState returns real +native SetIntegerGameState takes igamestate whichIntegerGameState, integer value returns nothing +constant native GetIntegerGameState takes igamestate whichIntegerGameState returns integer //============================================================================ @@ -3372,6 +3399,7 @@ native DisplayTimedTextToPlayer takes player toPlayer, real x, real y, real native DisplayTimedTextFromPlayer takes player toPlayer, real x, real y, real duration, string message returns nothing native ClearTextMessages takes nothing returns nothing native SetDayNightModels takes string terrainDNCFile, string unitDNCFile returns nothing +native SetPortraitLight takes string portraitDNCFile returns nothing native SetSkyModel takes string skyModelFile returns nothing native EnableUserControl takes boolean b returns nothing native EnableUserUI takes boolean b returns nothing @@ -3384,6 +3412,13 @@ native UnitAddIndicator takes unit whichUnit, integer red, integer g native AddIndicator takes widget whichWidget, integer red, integer green, integer blue, integer alpha returns nothing native PingMinimap takes real x, real y, real duration returns nothing native PingMinimapEx takes real x, real y, real duration, integer red, integer green, integer blue, boolean extraEffects returns nothing +native CreateMinimapIconOnUnit takes unit whichUnit, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native CreateMinimapIconAtLoc takes location where, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native CreateMinimapIcon takes real x, real y, integer red, integer green, integer blue, string pingPath, fogstate fogVisibility returns minimapicon +native SkinManagerGetLocalPath takes string key returns string +native DestroyMinimapIcon takes minimapicon pingId returns nothing +native SetMinimapIconVisible takes minimapicon whichMinimapIcon, boolean visible returns nothing +native SetMinimapIconOrphanDestroy takes minimapicon whichMinimapIcon, boolean doDestroy returns nothing native EnableOcclusion takes boolean flag returns nothing native SetIntroShotText takes string introText returns nothing native SetIntroShotModel takes string introModelPath returns nothing @@ -3437,7 +3472,7 @@ native QuestSetCompleted takes quest whichQuest, boolean completed returns n native QuestSetDiscovered takes quest whichQuest, boolean discovered returns nothing native QuestSetFailed takes quest whichQuest, boolean failed returns nothing native QuestSetEnabled takes quest whichQuest, boolean enabled returns nothing - + native IsQuestRequired takes quest whichQuest returns boolean native IsQuestCompleted takes quest whichQuest returns boolean native IsQuestDiscovered takes quest whichQuest returns boolean @@ -3586,6 +3621,8 @@ native CameraSetupApply takes camerasetup whichSetup, boolea native CameraSetupApplyWithZ takes camerasetup whichSetup, real zDestOffset returns nothing native CameraSetupApplyForceDuration takes camerasetup whichSetup, boolean doPan, real forceDuration returns nothing native CameraSetupApplyForceDurationWithZ takes camerasetup whichSetup, real zDestOffset, real forceDuration returns nothing +native BlzCameraSetupSetLabel takes camerasetup whichSetup, string label returns nothing +native BlzCameraSetupGetLabel takes camerasetup whichSetup returns string native CameraSetTargetNoise takes real mag, real velocity returns nothing native CameraSetSourceNoise takes real mag, real velocity returns nothing @@ -3595,6 +3632,9 @@ native CameraSetSourceNoiseEx takes real mag, real velocity, boolean v native CameraSetSmoothingFactor takes real factor returns nothing +native CameraSetFocalDistance takes real distance returns nothing +native CameraSetDepthOfFieldScale takes real scale returns nothing + native SetCineFilterTexture takes string filename returns nothing native SetCineFilterBlendMode takes blendmode whichMode returns nothing native SetCineFilterTexMapFlags takes texmapflags whichFlags returns nothing @@ -3609,6 +3649,7 @@ native IsCineFilterDisplayed takes nothing returns boolean native SetCinematicScene takes integer portraitUnitId, playercolor color, string speakerTitle, string text, real sceneDuration, real voiceoverDuration returns nothing native EndCinematicScene takes nothing returns nothing native ForceCinematicSubtitles takes boolean flag returns nothing +native SetCinematicAudio takes boolean cinematicAudio returns nothing native GetCameraMargin takes integer whichMargin returns real @@ -3643,7 +3684,7 @@ native SetSoundChannel takes sound soundHandle, integer channel ret native SetSoundVolume takes sound soundHandle, integer volume returns nothing native SetSoundPitch takes sound soundHandle, real pitch returns nothing -// the following method must be called immediately after calling "StartSound" +// the following method must be called immediately after calling "StartSound" native SetSoundPlayPosition takes sound soundHandle, integer millisecs returns nothing // these calls are only valid if the sound was created with 3d enabled @@ -3689,6 +3730,16 @@ native GetSoundIsLoading takes sound soundHandle returns boolean native RegisterStackedSound takes sound soundHandle, boolean byPosition, real rectwidth, real rectheight returns nothing native UnregisterStackedSound takes sound soundHandle, boolean byPosition, real rectwidth, real rectheight returns nothing +native SetSoundFacialAnimationLabel takes sound soundHandle, string animationLabel returns boolean +native SetSoundFacialAnimationGroupLabel takes sound soundHandle, string groupLabel returns boolean +native SetSoundFacialAnimationSetFilepath takes sound soundHandle, string animationSetFilepath returns boolean + +//Subtitle support that is attached to the soundHandle rather than as disperate data with the legacy UI +native SetDialogueSpeakerNameKey takes sound soundHandle, string speakerName returns boolean +native GetDialogueSpeakerNameKey takes sound soundHandle returns string +native SetDialogueTextKey takes sound soundHandle, string dialogueText returns boolean +native GetDialogueTextKey takes sound soundHandle returns string + //============================================================================ // Effects API // @@ -3814,6 +3865,13 @@ native PreloadGenStart takes nothing returns nothing native PreloadGenEnd takes string filename returns nothing native Preloader takes string filename returns nothing + +//============================================================================ +//Machinima API +//============================================================================ +native BlzHideCinematicPanels takes boolean enable returns nothing + + // Automation Test native AutomationSetTestType takes string testType returns nothing native AutomationTestStart takes string testName returns nothing @@ -3912,9 +3970,10 @@ native BlzSetUnitAbilityCooldown takes unit whichUnit, integer native BlzGetUnitAbilityCooldown takes unit whichUnit, integer abilId, integer level returns real native BlzGetUnitAbilityCooldownRemaining takes unit whichUnit, integer abilId returns real native BlzEndUnitAbilityCooldown takes unit whichUnit, integer abilCode returns nothing +native BlzStartUnitAbilityCooldown takes unit whichUnit, integer abilCode, real cooldown returns nothing native BlzGetUnitAbilityManaCost takes unit whichUnit, integer abilId, integer level returns integer native BlzSetUnitAbilityManaCost takes unit whichUnit, integer abilId, integer level, integer manaCost returns nothing -native BlzGetLocalUnitZ takes unit whichUnit returns real +native BlzGetLocalUnitZ takes unit whichUnit returns real native BlzDecPlayerTechResearched takes player whichPlayer, integer techid, integer levels returns nothing native BlzSetEventDamage takes real damage returns nothing native BlzGetEventDamageTarget takes nothing returns unit @@ -3924,6 +3983,7 @@ native BlzGetEventWeaponType takes nothing returns weaponty native BlzSetEventAttackType takes attacktype attackType returns boolean native BlzSetEventDamageType takes damagetype damageType returns boolean native BlzSetEventWeaponType takes weapontype weaponType returns boolean +native BlzGetEventIsAttack takes nothing returns boolean native RequestExtraIntegerData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns integer native RequestExtraBooleanData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns boolean native RequestExtraStringData takes integer dataType, player whichPlayer, string param1, string param2, boolean param3, integer param4, integer param5, integer param6 returns string @@ -3936,6 +3996,11 @@ native BlzIsSelectionCircleEnabled takes nothing returns boolean native BlzCameraSetupApplyForceDurationSmooth takes camerasetup whichSetup, boolean doPan, real forcedDuration, real easeInDuration, real easeOutDuration, real smoothFactor returns nothing native BlzEnableTargetIndicator takes boolean enable returns nothing native BlzIsTargetIndicatorEnabled takes nothing returns boolean +native BlzShowTerrain takes boolean show returns nothing +native BlzShowSkyBox takes boolean show returns nothing +native BlzStartRecording takes integer fps returns nothing +native BlzEndRecording takes nothing returns nothing +native BlzShowUnitTeamGlow takes unit whichUnit, boolean show returns nothing native BlzGetOriginFrame takes originframetype frameType, integer index returns framehandle native BlzEnableUIAutoPosition takes boolean enable returns nothing @@ -3957,6 +4022,7 @@ native BlzFrameGetName takes framehandle frame retur native BlzFrameClick takes framehandle frame returns nothing native BlzFrameSetText takes framehandle frame, string text returns nothing native BlzFrameGetText takes framehandle frame returns string +native BlzFrameAddText takes framehandle frame, string text returns nothing native BlzFrameSetTextSizeLimit takes framehandle frame, integer size returns nothing native BlzFrameGetTextSizeLimit takes framehandle frame returns integer native BlzFrameSetTextColor takes framehandle frame, integer color returns nothing @@ -3987,6 +4053,8 @@ native BlzFrameSetTextAlignment takes framehandle frame, text native BlzTriggerRegisterFrameEvent takes trigger whichTrigger, framehandle frame, frameeventtype eventId returns event native BlzGetTriggerFrame takes nothing returns framehandle native BlzGetTriggerFrameEvent takes nothing returns frameeventtype +native BlzGetTriggerFrameValue takes nothing returns real +native BlzGetTriggerFrameText takes nothing returns string native BlzTriggerRegisterPlayerSyncEvent takes trigger whichTrigger, player whichPlayer, string prefix, boolean fromServer returns event native BlzSendSyncData takes string prefix, string data returns boolean native BlzGetTriggerSyncPrefix takes nothing returns string @@ -4012,11 +4080,17 @@ native BlzDisplayChatMessage takes player whichPlayer, int native BlzPauseUnitEx takes unit whichUnit, boolean flag returns nothing // native BlzFourCC2S takes integer value returns string // native BlzS2FourCC takes string value returns integer +native BlzSetUnitFacingEx takes unit whichUnit, real facingAngle returns nothing + +native CreateCommandButtonEffect takes integer abilityId, string order returns commandbuttoneffect +native CreateUpgradeCommandButtonEffect takes integer whichUprgade returns commandbuttoneffect +native CreateLearnCommandButtonEffect takes integer abilityId returns commandbuttoneffect +native DestroyCommandButtonEffect takes commandbuttoneffect whichEffect returns nothing // Bit Operations 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 +native BlzBitXor takes integer x, integer y returns integer // Intanced Object Operations // Ability @@ -4053,7 +4127,7 @@ native BlzRemoveAbilityIntegerLevelArrayField takes ability whichAbility, a 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 +// 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 @@ -4067,7 +4141,7 @@ native BlzSetItemRealField takes item whichItem, itemrea native BlzSetItemStringField takes item whichItem, itemstringfield whichField, string value returns boolean native BlzItemRemoveAbility takes item whichItem, integer abilCode returns boolean -// Unit +// 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 @@ -4086,3 +4160,19 @@ native BlzSetUnitWeaponBooleanField takes unit whichUnit, unitwea 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 + +// Skin +native BlzGetUnitSkin takes unit whichUnit returns integer +native BlzGetItemSkin takes item whichItem returns integer +// native BlzGetDestructableSkin takes destructable whichDestructable returns integer +native BlzSetUnitSkin takes unit whichUnit, integer skinId returns nothing +native BlzSetItemSkin takes item whichItem, integer skinId returns nothing +// native BlzSetDestructableSkin takes destructable whichDestructable, integer skinId returns nothing + +native BlzCreateItemWithSkin takes integer itemid, real x, real y, integer skinId returns item +native BlzCreateUnitWithSkin takes player id, integer unitid, real x, real y, real face, integer skinId returns unit +native BlzCreateDestructableWithSkin takes integer objectid, real x, real y, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDestructableZWithSkin takes integer objectid, real x, real y, real z, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDeadDestructableWithSkin takes integer objectid, real x, real y, real face, real scale, integer variation, integer skinId returns destructable +native BlzCreateDeadDestructableZWithSkin takes integer objectid, real x, real y, real z, real face, real scale, integer variation, integer skinId returns destructable +native BlzGetPlayerTownHallCount takes player whichPlayer returns integer