Patch 11.0.2/API changes

From Warcraft Wiki
Jump to navigation Jump to search

Resources

Breaking changes

  • The Settings API has been changed, particularly around the creation of settings. Refer to Settings API changes for more details.
  • Macros and the macrotext attribute of SecureActionButtonTemplate have new limitations:
    • macrotext limited to 255 characters (same length as real macros)
    • All macros (real and macrotext-based) can no longer chain macros. One macro cannot /click a button that would execute another macro

Settings API changes

The Settings API has been updated to resolve a few usability issues with respect to the creation and management of settings.

  • The Settings.RegisterAddOnSetting function has had its signature changed significantly and now requires two additional parameters (variableKey and variableTbl) in the middle of the parameter list. These are used to directly read and write settings from a supplied table, which is typically expected to be the addon's saved variables.
  • The Settings.RegisterProxySetting function has been adjusted and can now be called from insecure code. Proxy settings can be used to execute author-supplied callbacks when reading and writing settings as an alternative to RegisterAddOnSetting.
  • The Settings.OpenToCategory function has been improved and now supports directly opening to a subcategory, as well as automatically expanding any categories that it opens.

A minimal example of registering both an addon and a proxy setting is provided below.

MyAddOn_SavedVars = {}

local category = Settings.RegisterVerticalLayoutCategory("My AddOn")

local function OnSettingChanged(setting, value)
	-- This callback will be invoked whenever a setting is modified.
	print("Setting changed:", setting:GetVariable(), value)
end

do 
	-- RegisterAddOnSetting example. This will read/write the setting directly
	-- to `MyAddOn_SavedVars.toggle`.

    local name = "Test Checkbox"
    local variable = "MyAddOn_Toggle"
	local variableKey = "toggle"
	local variableTbl = MyAddOn_SavedVars
    local defaultValue = false

    local setting = Settings.RegisterAddOnSetting(category, variable, variableKey, variableTbl, type(defaultValue), name, defaultValue)
	setting:SetValueChangedCallback(OnSettingChanged)

    local tooltip = "This is a tooltip for the checkbox."
	Settings.CreateCheckbox(category, setting, tooltip)
end

do
	-- RegisterProxySetting example. This will run the GetValue and SetValue
	-- callbacks whenever access to the setting is required.

	local name = "Test Slider"
	local variable = "MyAddOn_Slider"
    local defaultValue = 180
    local minValue = 90
    local maxValue = 360
    local step = 10

	local function GetValue()
		return MyAddOn_SavedVars.slider or defaultValue
	end

	local function SetValue(value)
		MyAddOn_SavedVars.slider = value
	end

	local setting = Settings.RegisterProxySetting(category, variable, type(defaultValue), name, defaultValue, GetValue, SetValue)
	setting:SetValueChangedCallback(OnSettingChanged)

	local tooltip = "This is a tooltip for the slider."
    local options = Settings.CreateSliderOptions(minValue, maxValue, step)
    options:SetLabelFormatter(MinimalSliderWithSteppersMixin.Label.Right);
    Settings.CreateSlider(category, setting, options, tooltip)
end

Settings.RegisterAddOnCategory(category)

Consolidated changes

11.0.0 (55818)11.0.2 (56819) Sep 27 2024

Global API

Added (17) Removed (3)
C_QuestLog.DoesQuestAwardReputationWithFaction
  # arg 2: factionID -> targetFactionID

Events

Added (5) Removed (0)
CURRENCY_DISPLAY_UPDATE
  # 5: quantityLostSource -> destroyReason
START_TIMER
  # 1: timerType, Type: luaIndex -> StartTimerType
STOP_TIMER_OF_TYPE
  # 1: timerType, Type: luaIndex -> StartTimerType

CVars

Added (4) Removed (1)
minimapTrackedInfov2CVar: minimapTrackedInfov2
mouseAccelerationCVar: mouseAcceleration (Game)
Default: -1
-1: use desktop mouse acceleration, 0: disable mouse acceleration, 1: enable mouse acceleration
useCompactPartyFramesCVar: useCompactPartyFrames
UseOldVolumeFogCVar: UseOldVolumeFog (Graphics)
Default: 0.000000
Use old volume fog system instead of the rework.
mouseAccelCVar: mouseAccel (Game)
Default: 1

Enums

Enum.BagFlag
  + SkipValidCountCheck
Enum.EventToastDisplayType
  + SingleLineWithIcon
Enum.MountType
  + RideAlong
Enum.MountTypeFlag
  + IsRideAlongMount
Enum.QuestClassification
  + BonusObjective
  + Threat
  + WorldQuest
Enum.TooltipDataItemBinding
  + AccountUntilEquipped
Enum.TraitConditionType
  + DisplayError
Enum.UIMapFlag
  + IgnoreInTranslationsToParent
Enum.UIWidgetVisualizationType
  + ScenarioHeaderDelves

Structures

CampaignInfo
  + sortAsNormalQuest
CharacterCurrencyData
  + fullCharacterName
CraftingOrderRewardInfo
  # currencyAmount -> count
CurrencyTransferTransaction
  + fullSourceCharacterName
  + fullDestinationCharacterName
GossipOptionRewardInfo
  + context
HorizontalCurrenciesWidgetVisualizationInfo
  - updateAnimType
PlayerChoiceOptionInfo
  + consolidateWidgets
QuestInfo
  + sortAsNormalQuest
  + questClassification
  - isLegendarySort
ScenarioCriteriaInfo
  + quantityString
SpellDisplayVisualizationInfo
  - shownState
  - enabledState
TraitCondInfo
  + isSufficient
  + type
TraitEntryInfo
  + isDisplayError
TraitNodeInfo
  + isDisplayError
UIWidgetCurrencyInfo
  + textEnabledState
  + iconSizeType
  + updateAnimType
UIWidgetItemInfo
  + itemNameCustomColor
  + itemNameCustomColorOverrideState
UIWidgetSpellInfo
  + shownState
  + enabledState
  + showGlowState

Deprecated API

These API functions are deprecated and will be removed in patch 11.0.2

10.0.0

CursorCanGoInSlotC_PaperDollInfo.CanCursorCanGoInSlot

10.0.7

Enum.GarrisonType["Type_6_0"] = Enum.GarrisonType["Type_6_0_Garrison"]
Enum.GarrisonType["Type_7_0"] = Enum.GarrisonType["Type_7_0_Garrison"]
Enum.GarrisonType["Type_8_0"] = Enum.GarrisonType["Type_8_0_Garrison"]
Enum.GarrisonType["Type_9_0"] = Enum.GarrisonType["Type_9_0_Garrison"]

Enum.GarrisonFollowerType["FollowerType_6_0"] = Enum.GarrisonFollowerType["FollowerType_6_0_GarrisonFollower"]
Enum.GarrisonFollowerType["FollowerType_6_2"] = Enum.GarrisonFollowerType["FollowerType_6_0_Boat"]
Enum.GarrisonFollowerType["FollowerType_7_0"] = Enum.GarrisonFollowerType["FollowerType_7_0_GarrisonFollower"]
Enum.GarrisonFollowerType["FollowerType_8_0"] = Enum.GarrisonFollowerType["FollowerType_8_0_GarrisonFollower"]
Enum.GarrisonFollowerType["FollowerType_9_0"] = Enum.GarrisonFollowerType["FollowerType_9_0_GarrisonFollower"]

10.1.0

GetAddOnMetadataC_AddOns.GetAddOnMetadata

10.1.5

GetClassIDFromSpecIDC_SpecializationInfo.GetClassIDFromSpecID

10.2.0

GetCVarInfoC_CVar.GetCVarInfo
EnableAddOnC_AddOns.EnableAddOn
DisableAddOnC_AddOns.DisableAddOn
GetAddOnEnableStateC_AddOns.GetAddOnEnableState
LoadAddOnC_AddOns.LoadAddOn
IsAddOnLoadedC_AddOns.IsAddOnLoaded
EnableAllAddOnsC_AddOns.EnableAllAddOns
DisableAllAddOnsC_AddOns.DisableAllAddOns
GetAddOnInfoC_AddOns.GetAddOnInfo
GetAddOnDependenciesC_AddOns.GetAddOnDependencies
GetAddOnOptionalDependenciesC_AddOns.GetAddOnOptionalDependencies
GetNumAddOnsC_AddOns.GetNumAddOns
SaveAddOnsC_AddOns.SaveAddOns
ResetAddOnsC_AddOns.ResetAddOns
ResetDisabledAddOnsC_AddOns.ResetDisabledAddOns
IsAddonVersionCheckEnabledC_AddOns.IsAddonVersionCheckEnabled
SetAddonVersionCheckC_AddOns.SetAddonVersionCheck
IsAddOnLoadOnDemandC_AddOns.IsAddOnLoadOnDemand

10.2.5

FillLocalizedClassListLocalizedClassList
GetSetBonusesForSpecializationByItemIDC_Item.GetSetBonusesForSpecializationByItemID
GetItemStatsC_Item.GetItemStats
GetItemStatDeltaC_Item.GetItemStatDelta
UnitAuraC_UnitAuras.GetAuraDataByIndex
UnitBuffC_UnitAuras.GetBuffDataByIndex
UnitDebuffC_UnitAuras.GetDebuffDataByIndex
UnitAuraBySlotC_UnitAuras.GetAuraDataBySlot
UnitAuraSlotsC_UnitAuras.GetAuraSlots

10.2.6

FrameXML_DebugC_Debug.FrameXMLDebug
GetMawPowerLinkBySpellIDC_Spell.GetMawPowerLinkBySpellID

10.2.7

ClosePetStablesC_StableInfo.ClosePetStables
GetStablePetInfoC_StableInfo.GetStablePetInfo
PickupStablePetC_StableInfo.PickupStablePet
GetStablePetFoodTypesC_StableInfo.GetStablePetFoodTypes
IsAtStableMasterC_StableInfo.IsAtStableMaster
SetPetSlotC_StableInfo.SetPetSlot
PetAbandonC_PetInfo.PetAbandon
PetRenameC_PetInfo.PetRename
PetCanBeRenamed

11.0.0

GetSpellInfoC_Spell.GetSpellInfo
GetNumSpellTabsC_SpellBook.GetNumSpellBookSkillLines
GetSpellTabInfoC_SpellBook.GetSpellBookSkillLineInfo
GetSpellCooldownC_Spell.GetSpellCooldown
GetSpellBookItemNameC_SpellBook.GetSpellBookItemName
GetSpellTextureC_Spell.GetSpellTexture
GetSpellChargesC_Spell.GetSpellCharges
GetSpellDescriptionC_Spell.GetSpellDescription
GetSpellCountC_Spell.GetSpellCastCount
IsUsableSpellC_Spell.IsSpellUsable

These functions were deprecated in patch 10.2.6 but do not appear to be removed on the 11.0.2 beta.

Deprecated_CurrencyScript.lua

GetCoinIconC_CurrencyInfo.GetCoinIcon
GetCoinTextC_CurrencyInfo.GetCoinText
GetCoinTextureStringC_CurrencyInfo.GetCoinTextureString

Deprecated_GuildScript.lua

GuildInviteC_GuildInfo.Invite
GuildUninviteC_GuildInfo.Uninvite
GuildPromoteC_GuildInfo.Promote
GuildDemoteC_GuildInfo.Demote
GuildSetLeaderC_GuildInfo.SetLeader
GuildSetMOTDC_GuildInfo.SetMOTD
GuildLeaveC_GuildInfo.Leave
GuildDisbandC_GuildInfo.Disband

Deprecated_ItemScript.lua

GetItemQualityColorC_Item.GetItemQualityColor
GetItemInfoInstantC_Item.GetItemInfoInstant
GetItemSetInfoC_Item.GetItemSetInfo
GetItemChildInfoC_Item.GetItemChildInfo
DoesItemContainSpecC_Item.DoesItemContainSpec
GetItemGemC_Item.GetItemGem
GetItemCreationContextC_Item.GetItemCreationContext
GetItemIconC_Item.GetItemIconByID
GetItemFamilyC_Item.GetItemFamily
GetItemSpellC_Item.GetItemSpell
IsArtifactPowerItemC_Item.IsArtifactPowerItem
IsCurrentItemC_Item.IsCurrentItem
IsUsableItemC_Item.IsUsableItem
IsHelpfulItemC_Item.IsHelpfulItem
IsHarmfulItemC_Item.IsHarmfulItem
IsConsumableItemC_Item.IsConsumableItem
IsEquippableItemC_Item.IsEquippableItem
IsEquippedItemC_Item.IsEquippedItem
IsEquippedItemTypeC_Item.IsEquippedItemType
ItemHasRangeC_Item.ItemHasRange
IsItemInRangeC_Item.IsItemInRange
GetItemClassInfoC_Item.GetItemClassInfo
GetItemInventorySlotInfoC_Item.GetItemInventorySlotInfo
BindEnchantC_Item.BindEnchant
ActionBindsItemC_Item.ActionBindsItem
ReplaceEnchantC_Item.ReplaceEnchant
ReplaceTradeEnchantC_Item.ReplaceTradeEnchant
ConfirmBindOnUseC_Item.ConfirmBindOnUse
ConfirmOnUseC_Item.ConfirmOnUse
ConfirmNoRefundOnUseC_Item.ConfirmNoRefundOnUse
DropItemOnUnitC_Item.DropItemOnUnit
EndBoundTradeableC_Item.EndBoundTradeable
EndRefundC_Item.EndRefund
GetItemInfoC_Item.GetItemInfo
GetDetailedItemLevelInfoC_Item.GetDetailedItemLevelInfo
GetItemSpecInfoC_Item.GetItemSpecInfo
GetItemUniquenessC_Item.GetItemUniqueness
GetItemCountC_Item.GetItemCount
PickupItemC_Item.PickupItem
GetItemSubClassInfoC_Item.GetItemSubClassInfo
UseItemByNameC_Item.UseItemByName
EquipItemByNameC_Item.EquipItemByName
ReplaceTradeskillEnchantC_Item.ReplaceTradeskillEnchant
GetItemCooldownC_Item.GetItemCooldown
IsCorruptedItemC_Item.IsCorruptedItem
IsCosmeticItemC_Item.IsCosmeticItem
IsDressableItemC_Item.IsDressableItem C_Item.IsDressableItemByID

Deprecated_PvpScript.lua

IsSubZonePVPPOIC_PvP.IsSubZonePVPPOI
GetZonePVPInfoC_PvP.GetZonePVPInfo
TogglePVPC_PvP.TogglePVP
SetPVPC_PvP.SetPVP

Deprecated_SoundScript.lua

PlayVocalErrorSoundIDC_Sound.PlayVocalErrorSound

Deprecated_SpellScript.lua

TargetSpellReplacesBonusTreeC_Spell.TargetSpellReplacesBonusTree
GetMaxSpellStartRecoveryOffsetC_Spell.GetSpellQueueWindow
GetSpellQueueWindowC_Spell.GetSpellQueueWindow
GetSchoolStringC_Spell.GetSchoolString