3.0 API更新日志
Contents
本篇为已经发布的巫妖王之怒资料片(3.0)用户界面API和函数的变化列表。
IMPORTANT: Off-topic or entirely redundant posts are liable to get deleted. It is however in everyone's best interest to not post them in the first place - We'd rather slouken and the UI team could spend their time coding us cool things than moderating this thread!
An 'Actual API changes' thread can be found here: http://forums.worldofwarcraft.com/thread.html?topicId=10043170854&sid=1
重大更新
- Blizzard UI正在转向更多的使用self和其他的局部参数而不是this和argN。旧的参数传递方式已废弃,所以插件代码也需要更新。这可能意味着Blizzard UI函数的参数会产生变化——请更新那些hook或替换了Blizzard UI的代码!
The SecureStateHeader has been replaced by a new secure template which allows for a more natural specification of rules in lua rather than via complex state tables. Some initial documentation can be found at: !!!
http://www.iriel.org/wow/docs/SecureHeadersGuide%20-%20pre1.pdf
- Key bindings, macros, and many UI settings are now stored on the server and will be available wherever you play.
- Button objects appear to no longer have their own internal Font objects, and have replaced the various methods to alter them with methods to reference existing Font objects to use for each state (Simple color changes can still be done without creating your own Font objects by using the |c color escape)
- The old crafting API's have finally been retired and enchanting moved onto the more common tradeskill API
设置和偏好选项
The following functions have been replaced with server-stored cvars: SetAutoLootDefault(), GetAutoLootDefault(), ShowNameplates(), HideNameplates(), ShowFriendNameplates(), HideFriendNameplates()
Saving the settings on the server can be disabled by setting the "synchronizeSettings" cvar to 0. You can then use the new UploadSettings() and DownloadSettings() functions to manage synchronization manually.
- NEW value = GetCVarBool("cvar") - Returns the value of the cvar as 1 or nil instead of requiring you to compare the cvar value with "0" or "1"
- NEW name, defaultValue, serverStoredAccountWide, serverStoredPerCharacter = GetCVarInfo("cvar") - Returns information about the named cvar
- There is a new FOCUSCAST click modifier (with no default value) which will cause spells to be cast on your focus.
宏
你现在可以使用下列函数来随时维护和还原你的宏的备份:BackupMacros(), RestoreMacros()。这些函数不能在战斗中被插件调用。
- 现在每个账户可以使用36个通用宏。
Buff Information
The various GetPlayerBuff functions have been removed and integrated into the appropriate unit functions, adding a new UnitAura function and updating the others: The new parameters and return values are:
name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitAura("unit", [index] or ["name", "rank"][, "filter"])
UnitBuff() and UnitDebuff() are aliases for UnitAura() with built in helpful/harmful filters.
CancelPlayerBuff([index] or ["name", "rank"][, "filter"]);
GameTooltip:SetUnitAura("unit", [index] or ["name", "rank"][, "filter"]); GameTooltip:SetUnitBuff("unit", [index] or ["name", "rank"][, "filter"]); GameTooltip:SetUnitDebuff("unit", [index] or ["name", "rank"][, "filter"]);
The "filter" parameter can be any of "HELPFUL", "HARMFUL", "PLAYER", "RAID", "CANCELABLE", "NOT_CANCELABLE". You can also specify several filters separated by a space or | character to chain multiple filters together (e.g. "HELPFUL|RAID" == helpful buffs that you can cast on your raid). By default UnitAura has "HELPFUL" as an implicit filter - you cannot get back BOTH helpful and harmful at the same time. Neither "HELPFUL" or "HARMFUL" have meaning for UnitBuff/UnitDebuff, and will be ignored.
AddOns displaying remaining time should cache the expiry time and decrement their own counter, do not re-query the information every OnUpdate.
- The untilCanceled return value is true if the buff doesn't have its own duration (e.g. stealth)
Companions
- Mounts and non-combat pets have been changed to be spell rather than item based. There are a number of new API methods to query and use them (See post #57 from slouken for more details)
NEW count = GetNumCompanions(type) -- Gets the number of a specific type of companion (type is "CRITTER" or "MOUNT")
NEW creatureID, creatureName, spellID, icon, active = GetCompanionInfo(type, index) -- Gets information abotu a specific companiion
NEW PickupCompanion(type, index) -- Load a companion onto the cursor for placement into an action bar
NEW CallCompanion(type, index) -- Summon a specific companion
Also, the PlayerModel frame has a new method
NEW PlayerModel:SetCreature(creatureID) -- Show the model for the specified creature Finally, there's a new event COMPANION_UPDATE which has a single argument, type - If this is nil then the UI should update the current companion, if it's non il then it'll be "CRITTER" or "MOUNT" and indicates that the active companion of that type has changed.
Aggro Awareness (aka Threat)
(NOTE: Still very much subject to change -- See slouken's detailed post below (#80) for more details)
* NEW state = UnitThreatSituation(unit[, mob]) -- Determine a unit's threat situation with respect to the given mob (or the mob which has the highest threat for the unit if omitted), the result is one of: nil = unit not on threat list 0 = 0-99% raw threat (no indicator shown) 1 = 100% or more raw threat (yellow indicator) 2 = tanking, other has 100% or more raw threat (orange indicator -- you may lose primary target) 3 = tanking, all others have less than 100% raw threat (red indicator)
* NEW isTanking, state, scaledPercent, rawPercent, threatValue = UnitDetailedThreatSituation(unit, mob) -- Returns detailed information about the unit's state on a mob's threat list. isTanking -- true if the unit is the primary target of the mob (and by definition at 100% threat) state -- Unit's threat situaton, as above scaledPercent -- Distance-scaled threat percentage (0-100%) rawPercent -- Current percentage threat of the unit relative to mob's primary target threatValue -- Raw 'threat amount' for the unit, roughly approximate to amount of damage and healing done by the unit
* NEW r, g, b = GetThreatStatusColor(state) -- Gets the color to use in the standard UI for a threat situation state
There are also two new events, UNIT_THREAT_LIST_UPDATE is fired when a mob unit's threat list changes, the unit id of the mob is the first event argument. UNIT_THREAT_SITUATION_UPDATE fires when a unit's threat situation changes, the unit in question is the first event argument (Note this only fires for status value changes, not raw threat changes)
Unit Information
The unit functions (such as UnitExists) now work for unit names that begin with otherwise valid unit tokens (e.g. for a player named "Petlover")
Container Information
The GetInventoryItemsForSlot function now correctly finds and returns information for relics, and properly returns the flags for items in bank bags.
Frame API's
Textures
UPDATED - exists = Texture:SetTexture(path[, tiled]) -- Added a new tiled parameter, if this is true then the texture is tiled in each direction rather than the edge stretching to infinity.
Sliders
* NEW - Slider:Disable() -- Disables the slider * NEW - Slider:Enable() -- Enables the slider * NEW - isEnabled = Slider:IsEnabled() -- Returns the status of the slider (1 or nil)
Blizzard UI
Interface Options
InterfaceOptionsFrame_OpenToPage has been renamed InterfaceOptionsFrame_OpenToCategory !!!
- Panels have a new optional method panel.refresh, which is called by the options frame after the panel is updated with defaults, but before the panel is shown. Use this to sync the state of the panel with the options in case they've been changed outside of the options frame.
Other Observed Changes
- Item strings have changed format to include character level
3.0.2
* /cast Mount Name behaves oddly if the 'training item' has the same name as the mount and was learned this session. Log out and in again to fix. * The achievement dates displayed are a little off (a day ahead, for some of us)
3.0.3
In 3.0.3 you will be able to manage macros vs key bindings separately: /console synchronizeConfig 0 -- turns off synchronization of UI settings /console synchronizeBindings 0 -- turns off synchronization of key bindings /console synchronizeMacros 0 -- turns off synchronization of macros


