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.

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 diffs

Global API

11.0.0 (55818)) → 11.0.2 (55763) Jul 19 2024
Added (6) Removed (3)
C_Item.GetItemCount
  - arg 5: includeAccountBank

Events

Added (3) Removed (0)
CURRENCY_DISPLAY_UPDATE
  # 3: quantityChange, No longer an absolute value. Can be negative when spending or losing currency
  # 5: quantityLostSource -> destroyReason
SHOW_DELVES_DISPLAY_UI
  + Documentation
START_TIMER
  # 1: timerType, Type: luaIndex -> StartTimerType
STOP_TIMER_OF_TYPE
  # 1: timerType, Type: luaIndex -> StartTimerType

CVars

Added (3) Removed (0)
minimapTrackedInfov2minimapTrackedInfov2
UseOldVolumeFogUseOldVolumeFog (Graphics)
Default: 0.000000
Use old volume fog system instead of the rework.
watchdogFreezeSecondswatchdogFreezeSeconds (Debug)
Default: 20

Enums

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

Structures

CampaignInfo
  + sortAsNormalQuest
CraftingOrderRewardInfo
  # currencyAmount -> count
HorizontalCurrenciesWidgetVisualizationInfo
  - updateAnimType
PlayerChoiceOptionInfo
  + consolidateWidgets
QuestInfo
  + sortAsNormalQuest
  + questClassification
  - isLegendarySort
SpellDisplayVisualizationInfo
  - shownState
  - enabledState
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.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
GetAddOnOptionalDependencies → C_AddOns.GetAddOnOptionalDependencies
GetNumAddOnsC_AddOns.GetNumAddOns
SaveAddOns → C_AddOns.SaveAddOns
ResetAddOns → C_AddOns.ResetAddOns
ResetDisabledAddOns → C_AddOns.ResetDisabledAddOns
IsAddonVersionCheckEnabled → C_AddOns.IsAddonVersionCheckEnabled
SetAddonVersionCheck → C_AddOns.SetAddonVersionCheck
IsAddOnLoadOnDemandC_AddOns.IsAddOnLoadOnDemand

10.2.5

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

10.2.6

FrameXML_DebugC_Debug.FrameXMLDebug
GetMawPowerLinkBySpellID → C_Spell.GetMawPowerLinkBySpellID

10.2.7

ClosePetStablesC_StableInfo.ClosePetStables
GetStablePetInfoC_StableInfo.GetStablePetInfo
PickupStablePetC_StableInfo.PickupStablePet
GetStablePetFoodTypesC_StableInfo.GetStablePetFoodTypes
IsAtStableMaster → C_StableInfo.IsAtStableMaster
SetPetSlot → C_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
GetItemSetInfo → C_Item.GetItemSetInfo
GetItemChildInfo → C_Item.GetItemChildInfo
DoesItemContainSpec → C_Item.DoesItemContainSpec
GetItemGemC_Item.GetItemGem
GetItemCreationContext → C_Item.GetItemCreationContext
GetItemIconC_Item.GetItemIconByID
GetItemFamilyC_Item.GetItemFamily
GetItemSpellC_Item.GetItemSpell
IsArtifactPowerItem → C_Item.IsArtifactPowerItem
IsCurrentItem → C_Item.IsCurrentItem
IsUsableItem → C_Item.IsUsableItem
IsHelpfulItem → C_Item.IsHelpfulItem
IsHarmfulItem → C_Item.IsHarmfulItem
IsConsumableItemC_Item.IsConsumableItem
IsEquippableItemC_Item.IsEquippableItem
IsEquippedItemC_Item.IsEquippedItem
IsEquippedItemTypeC_Item.IsEquippedItemType
ItemHasRange → C_Item.ItemHasRange
IsItemInRangeC_Item.IsItemInRange
GetItemClassInfoC_Item.GetItemClassInfo
GetItemInventorySlotInfo → C_Item.GetItemInventorySlotInfo
BindEnchantC_Item.BindEnchant
ActionBindsItem → C_Item.ActionBindsItem
ReplaceEnchantC_Item.ReplaceEnchant
ReplaceTradeEnchantC_Item.ReplaceTradeEnchant
ConfirmBindOnUseC_Item.ConfirmBindOnUse
ConfirmOnUse → C_Item.ConfirmOnUse
ConfirmNoRefundOnUse → C_Item.ConfirmNoRefundOnUse
DropItemOnUnitC_Item.DropItemOnUnit
EndBoundTradeable → C_Item.EndBoundTradeable
EndRefund → C_Item.EndRefund
GetItemInfoC_Item.GetItemInfo
GetDetailedItemLevelInfoC_Item.GetDetailedItemLevelInfo
GetItemSpecInfoC_Item.GetItemSpecInfo
GetItemUniqueness → C_Item.GetItemUniqueness
GetItemCountC_Item.GetItemCount
PickupItemC_Item.PickupItem
GetItemSubClassInfoC_Item.GetItemSubClassInfo
UseItemByNameC_Item.UseItemByName
EquipItemByNameC_Item.EquipItemByName
ReplaceTradeskillEnchant → C_Item.ReplaceTradeskillEnchant
GetItemCooldownC_Item.GetItemCooldown
IsCorruptedItemC_Item.IsCorruptedItem
IsCosmeticItem → C_Item.IsCosmeticItem
IsDressableItem → C_Item.IsDressableItem

Deprecated_PvpScript.lua

IsSubZonePVPPOI → C_PvP.IsSubZonePVPPOI
GetZonePVPInfoC_PvP.GetZonePVPInfo
TogglePVPC_PvP.TogglePVP
SetPVPC_PvP.SetPVP

Deprecated_SoundScript.lua

PlayVocalErrorSoundID → C_Sound.PlayVocalErrorSound

Deprecated_SpellScript.lua

TargetSpellReplacesBonusTree → C_Spell.TargetSpellReplacesBonusTree
GetMaxSpellStartRecoveryOffset → C_Spell.GetSpellQueueWindow
GetSpellQueueWindow → C_Spell.GetSpellQueueWindow
GetSchoolStringC_Spell.GetSchoolString