mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
fac3be3a0b4d71ff3a839574ad72364ea71fbdfe
17
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fac3be3a0b |
refactor(lua): take integer enum and constants entries as arrays
RegisterIntegerEnum and RegisterConstants took their entries with a count beside them, written as sizeof(t) / sizeof(t[0]), std::size, or a literal. They now take Game::ArrayRef<EnumIntegerEntry>, as RegisterFrameMethods does, so the count comes from the array's type. The documentation recorders RecordEnum and RecordConstants take the same view. All 34 call sites pass only the array. The six literal counts were checked against their arrays first: each was the full length, so every Enum.* and Constants.* table gets the same entries as before. Five files that included <iterator> only for std::size drop it. |
||
|
|
b49c107778 |
refactor(lua): take frame-method tables as arrays, not pointer and count
Every RegisterFrameMethods call passed its method table and doc table with a count beside each: sizeof(t) / sizeof(t[0]), std::size, or a literal. The literals had to be kept in step with the tables by hand. Game::ArrayRef<T> is a view over a file-scope array that takes the count from the array's type, the way Doc::FieldList already did for a function's arguments and returns. FieldList is now ArrayRef<Field>, Doc::MethodList is ArrayRef<Method>, and RegisterFrameMethods takes (context, methods, docs). The table and count still go to the engine's frame-method iterator (FUN_REGISTER_FRAME_METHODS) unchanged, and to the documentation recorder. All 84 call sites pass only the arrays. The 16 literal counts were checked against their tables first: each was the full length, so every registry gets the same methods as before. |
||
|
|
53b7f79440 |
fix(model): release dress builders and stopped effects with their frame
/reload crashed with an access violation in the model release (0x007103A3, inside FUN_MODEL_INSTANCE_RELEASE 0x007103A0) when SetDisplayInfo had dressed a few panes. 1.12.1 reloads in two steps. CGGameUI::Shutdown (0x00490BD0) deletes the CSimpleTop, which destroys every frame. A Model frame's teardown, DestroyModelFrame (0x0076CA50, from the CSimpleModel and CGCharacterModelBase destructors), releases the frame's M2 scene at +0x314, and the scene frees every model in it, even one that something else still holds a reference on. Only then does CGGameUI::Initialize (0x0048FBF0) reset the Lua state, which runs FrameScript_Initialize and our reload cleanups. DisplayInfo's cleanup destroyed each kept compositor there (FUN_CHARCOMP_DESTROY 0x00476000), and the compositor released its reference to a model that was already freed. VisualKit's cleanup detached and released stopped one-shot effects that live in the same freed scene. Model::Teardown hooks DestroyModelFrame and runs its subscribers before the original, while the frame's scene and models are intact, which is where the engine frees what its own frames hold. DisplayInfo drops the frame's dress job there, and VisualKit records each stopped effect's pane (in the done callback's user data) and discards that pane's effects there. Their reload cleanups keep only the pointer-keyed state. The ReloadAutoRegister doc now says that the cleanups run after the frames are gone, so they may forget pointers but never release an engine object tied to a frame. |
||
|
|
7b21453469 |
refactor(model): share the engine model calls across the model modules
The model modules each declared their own pointers to the same 1.12.1 engine functions: the instance gates FUN_MODEL_INSTANCE_LOADED (0x007103D0) and FUN_MODEL_INSTANCE_READY, AddRef / Release (0x00710390 / 0x007103A0), FUN_M2SCENE_CREATE_MODEL, FUN_M2MODEL_PLAY_ANIMATION, the done callback, the item visuals, the render callback, the M2 data lookup FUN_M2_LOOKUP_INDEX (0x00710310), and the pane's model, scene, SetModelInstance virtual (vtable +0x90) and SetDisplay. model/M2.h now holds one typed wrapper for each, and every module calls through it. - Game::Lua::ResolvePlayerModel / ResolveDressUpModel join the per-type resolvers, replacing four ResolvePane copies and five inline ResolveTypedObject calls. Game::Lua::TYPE_NONE replaces the local kTypeNone in Rotation and frame/CreateFrame. - Offsets.h has the full INVTYPE list, 0..28, named by the engine's own key table at 0x0083DDB0. It replaces the four scattered INVTYPE_* entries and the local copies in DressUp and ItemDisplay, and the try-on result switch reads by name. - DisplayInfo keeps its dress jobs in a map by frame, like the other modules, in place of the fixed 8-slot pool and its eviction. - DressUp names the held lane's bytes (item class, inventory type, sheathe type) and detaches a lane in one place. - ItemDisplay::OwnVisual is the one test for a display's own ItemVisuals row (GetItemDescVisual 0x0062EC70), used by SetItem and by TryOn's enchant glow. Both own-record panes share Pane::DisplayRecord, and the SetDisplayInfo records are cleared on /reload as the SetItem records are. |
||
|
|
c0b403ba05 |
feat(model): add PlayerModel:ApplySpellVisualKit
PlayerModel:ApplySpellVisualKit(spellVisualKitID [, oneShot]) shows a SpellVisualKit's effects on the pane's model. In the world, 1.12.1 plays a kit on a unit (0x0060EDF0), through effect objects, spell durations and the unit's own animation, and a pane has none of these. The engine's own kit on a bare model is the char-select ghost (0x004727F0), and this is that routine for any kit on the pane's model: - Each of the nine effect columns (+0x0C) is created as a model from its SpellVisualEffectName file, in the pane's scene. It is attached at the column's attachment (20, 34, 19, 21, 22, 17, 23, 24, 25) when the model has that attachment (0x00712CB0, 0x00712F70), as in 0x00472780. The effects get the frame's light through LightChildren. - Procedure kind 1 sets the tint (an 0xRRGGBB colour stored as a float, scaled by 1/255) and kind 14 the alpha, clamped to 0..1. Both are plain stores (0x00710CF0, 0x00710CB0), as the ghost kit makes them. The kit's animation and sound do not play, which matches retail. An effect model's sequence plays one time. Without oneShot, each effect gets the world's loop callback (KitEffectLoopCallback, 0x0060ED00): a clean end (reason 0) plays the animation again. With oneShot, each effect gets EffectDoneCallback's test (0x005FBF50) and CEffect::Stop's model steps (0x006203E0): clear the callback and hide the model, so its emitters stop and the particles already out finish. A FrameTick drain, which runs after the strata walk, then mirrors DrainDyingEffects (0x0061F680). It detaches a stopped effect (0x00713020) once HasLiveParticles (0x007135C0) is false, or at once when its model has already dropped it. A model's destructor detaches its children first (0x0070E3F5), so the drain never reaches a freed parent. The effects are children of the pane's model, so SetUnit, SetItem or a hide and show clears them. |
||
|
|
8f4f574174 |
feat(model): add PlayerModel:SetItem
PlayerModel:SetItem(itemID [, appearanceModID, itemVisualID]) shows one item's own model in the pane: a weapon, shield, helm, shoulder, quiver or ammo, with its skin texture and its glow. A 1.12.1 pane shows whatever its display record names (+0x3F0). SetDisplay (0x00505CB0) stores the record and builds it when the pane is visible, the show path (0x00505D49) builds it again, and the SetUnit helper (0x00505B50) clears it. SetItem gives the pane a record of its own and passes it to SetDisplay. The AttachDisplayModel (0x00505A70) co-hook in Model::DisplayInfo then builds the item instead of a creature. So hide, show, SetUnit, SetDisplayInfo and SetKeepModelOnHide handle an item with no new hooks. The model is built from 1.12.1's own steps: - the item folder by inventory type, from the engine's own Item\ObjectComponents\ path strings (0x00838CD8 on); - model name 0, else name 1, with the texture of the same index; - for a head item, the helm builder's (0x004799A0) path, with the player's race prefix (ChrRaces +0x18) and sex letter (0x00838AB4); - AttachItemModelFile's (0x004798C0) steps: create the model in the pane's scene, load the skin with the item-model status (0x00B424F0) and filter 3, bind it as texture type 2 (0x00710EC0), and attach the item visuals (0x00479700); - AttachDisplayModel's install: SetModelInstance (vtable +0x90), the pane's done callback (0x005062A0 through 0x00711BB0), Stand, and the release of the creation reference. The display's own ItemVisuals row wins over itemVisualID, the rule GetItemDescVisual (0x0062EC70) applies to enchants. The visual's child models get the frame's light and fog callback, now a shared LightChildren helper, so they are not drawn black. An uncached item is queued through Item::Data::WarmCache, and each visible pane that still shows it is built again when the item loads. |
||
|
|
43a989dd56 |
feat(model): add PlayerModel:FreezeAnimation
FreezeAnimation(animation, variation, frame) holds the model in one pose of an animation until the pane loads a new model, as SetAnimation does. frame is the time into the animation in milliseconds, the unit of M2 sequence times. The engine's sequence time is start + (ftol(elapsed * speed) + offset) mod length. So the pane's arm plays the animation through PlayAnimation (0x007121A0) at speed 0 and writes frame to bone 0's slot offset (+0xB8, bone states 0x118 bytes each at [model+0x90]). Speed 0 also puts the end stamp on the start stamp. Update (0x00719370) would then queue the done callback on the next frame, and the pane's done callback (0x005062A0) would arm Stand. The arm therefore sets the slot's done latch (+0xC0), the flag Update itself sets once it has reported done. A held animation never ends. SetAnimation and FreezeAnimation now also mark the pane for one re-arm. A call with the animation that already plays then still starts or ends a freeze, where the per-paint compare alone would skip it. |
||
|
|
0caddb8fe6 |
feat(model): add PlayerModel animation, keep-on-hide and unit methods
Adds SetAnimation, SetDoBlend/GetDoBlend, HasAnimation, SetKeepModelOnHide/GetKeepModelOnHide, CanSetUnit and GetDisplayInfo to PlayerModel (and so to DressUpModel and TabardModel). SetUnit now returns whether the unit exists, and SetCreature takes an optional display ID. Animation. A 1.12.1 pane rests on Stand: its per-paint UpdateModel (0x00505C50) arms Stand (PlayAnimation 0x007121A0 with id 0) whenever key bone -1 plays anything else and no turn is pending. A deadline of 0 counts as passed, so any other animation lasted one frame. SetAnimation gives the pane a resting animation and variation of its own. With one set, UpdateModel is hooked to arm that animation in Stand's place, using the pane's blend setting. Every other pane runs the stock function. The pane's done callback (0x005062A0) arms Stand when the animation ends, so the next paint starts it again and it loops. CSimpleModelFFX's SetModelInstance (0x0076CD30), which every pane model build and hide goes through, clears it, so a new model rests on Stand again. SetRotation turns without the shuffle while a resting animation other than Stand is set. HasAnimation is PlayAnimation's own test on the raw id: the lookup at shared data +0x24 must give an index below the sequence count at +0x1C. It is false until the model has loaded. Keep on hide. The pane's Hide (0x00505CE0) drops its model through slot 36, and its Show (0x00505D00) builds a new one from the unit or display record. With keep on, Hide runs only the base hide (0x0076AD50) and Show runs only the base show (0x0076AE10) while the pane still holds its model. The model then comes back with its try-ons and animation. The SetUnit helper (0x00505B50, behind SetUnit, RefreshUnit and Dress) and SetDisplay (0x00505CB0) only store the new subject while the pane is hidden, so they drop a kept model first. The next Show then builds the new one. Off is the default and matches the stock client. Units and displays. SetUnit runs the engine's method (0x00505D70, which Turtle patches) unchanged. It then reports whether the GUID it stored resolves to a unit (type mask 8), the same test the helper uses before it builds. CanSetUnit is that resolve without the set. GetDisplayInfo reads the display record's ID, or the unit's UNIT_FIELD_DISPLAYID (+0x1F4, field 0x7D). SetCreature with a display ID shows that display through the SetDisplayInfo record. |
||
|
|
4726fd7c85 |
feat(model): add DressUpModel try-on hand, enchant glow, sheathing and auto-dress
TryOn now takes retail's (item [, handSlotName, spellEnchantID]) and returns an Enum.ItemTryOnReason. The pane gains IsGeoReady, SetSheathed / GetSheathed and SetAutoDress / GetAutoDress. Hand: TryOnItem (0x00504540) picks a lane at one site, 0x0050492D (mov edx,[edi+0x2C]; cmp edx,0x0D). A 6-byte call there jumps a named hand to the worker's own main-hand (0x0050495F) or off-hand (0x005049B1) path, so its CanHoldBoth (0x00504BC0) eviction, lane store and attach all still run; with no hand it replays the two instructions and the jnz reads their flags. The name is matched like GetInventorySlotInfo matches it: SStrCmpI over the PaperDollItemFrame rows, slot 16 or 17. Enchant glow: the player's AttachEnchantVisual step (0x005EED50) on the attachment AttachItemModel (0x0047A0C0) returns: FindChild (0x00712F00), then AttachItemVisuals (0x00479700) with SpellItemEnchantment +0x58, skipped when the display's own ItemVisuals row exists (GetItemDescVisual's rule, 0x0062EC70). The enchant is the argument, else the link's enchant field, which Item::Arg now parses. Sheathing re-runs the unit's AttachHandItem step on the pane's lanes with the sheathed flag. The lanes keep no display row, so the pane records one: the unit's vtable +0x9C row when SetModelInstance (slot 0x00808438) clones it, then whatever the worker's attach (0x00504AE6) installs; its two evictions (0x00504A0C, 0x00504A55) drop theirs. Each lane keeps its glow too, a player's read through GetVisibleItem + GetItemDescVisual, so a re-hung weapon keeps it. Auto-dress off runs ClearModel (0x00504490) after SetModelInstance unless Dress() is the one rebuilding. TryOn's result reads the gates the worker passes: an uncached record is DataPending, a held type installs, armor needs the component and the ready byte (+0x40C). DressUpItemLink now passes the whole link to DressUpItem, so a Control-click shows the link's enchant, and skips a cached item that IsDressableItem rejects. DressUpItem stays, since Blizzard_AuctionUI and Turtle both replace it. |
||
|
|
6f3a8ffc1d |
feat(texture): add static creature portraits by display ID (#123)
* feat(texture): add static creature portraits by display ID * docs(api): document static creature portrait functions * Update API.md * refactor(model): bake display-ID portraits on the engine's own path SetPortraitTextureFromCreatureDisplayID now replays 1.12.1's unit portrait bake, BakePortrait (0x00524F60), call for call on a display model of its own, instead of driving a hidden PlayerModel through Lua. The display model is built the way AttachDisplayModel (0x00505A70) builds one, without a frame: M2CreateScene (0x00706E10), then CreateModelFromPath (0x00707350) on the CreatureModelData path, then ApplyCreatureDisplay (0x004797B0). A character display is dressed through the engine compositor with the same code that dresses PlayerModel:SetDisplayInfo, now shared as Model::DisplayInfo:: CreateDresser / PumpDresser / DestroyDresser. The bake's own gate, IsReady(model, 0, 1) (0x00710450), only passes for a model that something has drawn: a BLP texture gets its device texture only when GetTextureDeviceObject (0x0044ACF0) is asked with wait set. The shared M2 still loads on its own, so the gate here is IsLoaded(model, 0, 1) (0x007103D0) plus the dress, and the bake's IsReady(copy, 1, 1) makes the device textures, as it does for the copy of a unit's model. The bake itself is the engine's sequence: copy into a fresh scene, DetachAllItemModels, camera 0, PlayAnimation, save projection, view, viewport and fog (GxMasterEnable 0x0058A210 / 0x0058A1E0), the 64x64 DDC box in the bake's own float order, CameraSetDeviceTransforms, clear colour 0, ClearDevice(3), PortraitLighting, both scene passes, read back through 0x00589CF0, clear, cut the alpha mask in (0x005258A0), restore. It runs at the head of the UI render callback, the same point as an OnUpdate script that calls SetPortraitTexture, behind the bake's device gate (0x0058A260 window active, 0x0058A280 device alive). Each display ID owns one callback texture (TextureCreateWithCallback, which makes its device texture at creation). It is bound with SetImage (0x00770300) at call time and filled in place with GxTexMarkRectDirty (0x0058ACD0), the bake's own path for re-baking a cached portrait. A region the caller re-points before the bake finishes keeps what it was given, so no region is tracked: the request map, the region-destruction subscription and ClassicAPI_CancelPortraitTextureRequest are gone. The function returns nothing, as retail's does. Portraits are kept until logout, the lifetime of the engine's display-ID portrait cache (cleared in ShutdownGame). A display with no portrait camera is done once and stays transparent. Offsets.h: the portrait block is renamed to engine names with calling conventions and sources; the duplicates of FUN_M2SCENE_ANIMATE, FUN_M2MODEL_SET_ANIMATED and GetCameraById are removed, as are the made-up draw-flag and scene-count fields and the raw device-vtable slots. Model::Camera::CameraById is exposed instead of being copied. --------- Co-authored-by: z1xel <ramirezthiago@71gmail.com> Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com> |
||
|
|
984dc236ab |
feat(dressup): try on what a recipe makes
4.3.4's TryOnWithVisual swaps a recipe item (no inventory type, a spell that teaches a CREATE_ITEM spell) for the item it makes; 1.12's worker shows ERR_NOT_EQUIPPABLE instead. TryOnItem adds the swap in front of the worker for DressUpModel:TryOn and, via a call redirect, for the worker's item-cache callback, so Control-click on a pattern opens the dressing room even before the pattern is cached. The recipe walk is shared with IsDressableItem (Item::Dressable::RecipeItem). |
||
|
|
bbd78b437f |
feat(model): backport 4.3.4's PlayerModel and DressUpModel methods
SetDisplayInfo and SetCreature move from Model to PlayerModel, where 4.3.4 registers them, and now ride vanilla's own pane path: SetDisplay (0x505CB0) stores the record and AttachDisplayModel (0x505A70) builds the model with the engine's skins (ApplyCreatureDisplay), Stand, the pane camera and light, and rebuilds it on every show. A co-hook on AttachDisplayModel adds 4.3.4's SetUpModel step: a display with an Extra record is dressed through the character compositor. SetCreature passes the creature-cache record itself; SetDisplayInfo passes a per-pane record holding the display ID, the only field the pane reads. The hand-built ApplySkins is removed. SetPortraitZoom, SetCamDistanceScale and RefreshCamera apply 4.3.4's ConfigureCamera steps after vanilla's (0x505890); the defaults leave the camera untouched. The portrait camera id is bounds-checked, since GetCameraById indexes unchecked. DressUpModel gains UndressSlot (one step of vanilla's Undress) and a TryOn that takes item links, recipe links and carried item names in front of vanilla's worker. PlayerModel:SetRotation takes 4.3.4's animate flag, and Model:SetGlow exists as the no-op it is on a 4.3.4 Model. |
||
|
|
61db68dd7f |
fix(lua): gate frame-method self with the engine's own type check
Every engine frame method validates its `self` in three steps before
touching it: lua_type == table, resolve to the CFrameScriptObject, then
the IsA(typeId) vmethod at vtable+0x10. We did the first two and skipped
the third, so ResolveObject handed back a pointer for ANY frame and the
method cast it to whatever type it expected.
That was reachable from plain Lua, not just through a mirror or a hook.
The per-type method dispatcher is an __index handler that rawgeti's the
method closure out of the Lua registry, so frame methods are ordinary
first-class values, and
GameTooltip.SetSpellByID(ShapeshiftButton1, 133)
reached the tooltip builder with a Button, writing tooltip fields through
Button memory. The engine refuses that same call with "Wrong object type
for member function".
Game::Lua::ResolveTypedObject runs the engine's prologue and raises the
engine's own three error strings, read from .data rather than reinvented.
FrameScriptTypeId mirrors the lazy id assignment, so a check is valid
before any stock method of the type has run. Seven per-type wrappers stop
a call site pairing a method with the wrong class's id, and
ResolveTypedObjectAny covers a method that more than one type reaches.
45 call sites across 19 files now gate self. model/DisplayInfo.cpp had
already worked this out for Model alone and loses its private copy.
Type ids are per CLASS, one shared by all of that class's methods. Each
was read from the prologue of a method that can only belong to its class:
a base-class method registered into several tables carries the BASE id, so
sampling GetObjectType or GetDrawLayer would have produced a gate that
accepts unrelated types. Frame comes from Script_RegisterEvent and Texture
from Script_SetDesaturated, both cross-checked against the first entry of
their table.
Deliberately left ungated: the binding `owner` in bindings/Api.cpp and the
three co-hook sites in texture/Atlas.cpp. Each only uses the pointer as an
identity key and never casts it, so a gate would tighten the contract for
no safety gain -- and raising inside a co-hook would fire before the
original ran.
Verified in-game: the Button-as-tooltip call now raises the engine's
error; a Button still reaches a Frame-registry method
(button:SetAttribute round-trips), so IsA does accept derived types; and
fontstring:GetRotation() still answers -- that reader is registered on
both the Texture and FontString registries and needs the id pair rather
than the Texture id alone.
|
||
|
|
0c8468cf2f |
refactor(reload): auto-register per-/reload cleanup; fix Time::Timer stale refs
Modules that keep reload-fragile file-static state (Lua registry refs, frame/object-pointer-keyed maps, cached event-slot indices) each expose a PrepareForReload() that DllMain called from the FrameScript_Initialize hook. That list was hand-maintained, so a new module could silently forget to wire itself in -- the failure mode behind the Frame::Attributes stale-ref bug and Tooltip::SetEvents issue #33. Add Game::ReloadAutoRegister + Game::RunReloadCleanups(), mirroring the existing ModuleAutoRegister / HookAutoRegister / WorldTick::AutoSubscribe patterns. Each module self-registers with one file-scope line after its PrepareForReload: static const Game::ReloadAutoRegister _reloadReg{&PrepareForReload}; DllMain's 11-call manual list collapses to a single RunReloadCleanups(); a new module can no longer be forgotten. Player::NameCache::Flush stays an explicit call -- it's a save-before-teardown, not a stale-state clear, and also runs on the glue-return path. A sweep of all file-static state found one uncovered module: Time::Timer pins C_Timer.After/NewTimer/NewTicker callbacks in the Lua registry but never released them on /reload -- a surviving/stale ref could fire a dead closure. Add Time::Timer::PrepareForReload (release each pending timer's registry callback, clear the queue) and self-register it. - Game.{h,cpp}: ReloadAutoRegister + RunReloadCleanups. - DllMain.cpp: collapse the manual list to RunReloadCleanups(); drop 6 now-dead includes. - 11 existing reload modules + Time::Timer: add the self-register line. Behavior-preserving (same cleanups, before the Lua teardown); auto-register order is unspecified across TUs but every callback only clears its own state. |
||
|
|
c54556f6a1 |
refactor: centralize engine field/global access via Game::Read/Ref/Ptr
Replace the raw `*reinterpret_cast<const T *>(base + Offsets::OFF_X)` idiom (and its double-cast variant when base wasn't already a byte pointer) with three typed accessors in Game.h: Game::Read<T>(base, offset) field value read Game::Ref<T>(base, offset) writable field lvalue Game::Ptr<T>(base, offset) pointer to a field (arrays / out-params) Game::Read<T>(address) / Ref<T>(address) fixed-VA globals Pure mechanical refactor, zero behavior change: ~330 cast sites across 84 files collapse to 651 helper calls. Offsets stay in Offsets.h per the single-source-of-truth rule — the helpers only remove the cast noise and fold away the inner `reinterpret_cast<uint8_t*>(obj)` base casts. Left as raw casts by design: FUN_* function-pointer casts, void*/char* VA handles passed as arguments (caches, method registries), subobject- anchor pointers fed to __thiscall helpers, `void *volatile` player-ptr readiness gates (converting would strip volatile), and VA-as-array-base captures that are subscripted later. |
||
|
|
67172c95f7 |
feat(model): add Model:SetCreature; dress character displays natively
SetCreature(creatureID) resolves through the client creature cache to a display ID, then loads like SetDisplayInfo (uncached entry = no-op, documented with a RequestLoadCreatureByID recipe). Character-based displays (extendedDisplayInfoID != 0) are now dressed by the engine's own CharComponent compositor, mirroring CGUnit_C::UpdateCharacterCustomization's NPC branch field for field: baked body texture, hair/facial-hair geosets (CharHairGeosets, CharacterFacialHairStyles), equipment geosets (sleeves, robe->trousers, tabard), and helm/shoulder attachment models with HelmetGeosetVisData hiding. Dress jobs run on WorldTick behind the engine's own model-loaded gate, one compositor per Model frame, kept until the frame loads another display or the reload teardown (PrepareForReload). Attached helm/shoulder children additionally get the frame's light/fog pre-render callback: the frame only registers it on its own instance, so the children rendered pure black (verified in-game -- a light tint colored the body but not the equipment). Weapons cannot show: NPC weapons are server-pushed per spawned unit, not in any client table. The manual baked-skin/hair-texture appliers are superseded by the compositor and removed, along with the geoset debug probes (_classicapi_ModelInstance/Peek/Poke). Creature::Info gains a public DisplayID(creatureID) for the cache resolve. |
||
|
|
54782df95e |
feat(model): add Model:SetDisplayInfo(creatureDisplayID)
Backport the retail Model widget method (present since 5.4.8, string verified in the 5.4.8 and 1.15.8 binaries) that points a Model frame at a creature by its display ID rather than a raw .mdx path. Resolve creatureDisplayID -> CreatureDisplayInfo[+0x04] ModelID -> CreatureModelData[+0x08] ModelPath, load it through SetModel's own worker (vtable+0x94), then apply the display's TextureVariation columns as replaceable-texture skins (MONSTER_1/2/3 = slots 11/12/13). The DBC column offsets are verified two ways: parsing the extracted 1.12 DBCs and the engine's own unit-display resolver FUN_0060afb0. Verified in-game: displays 13/330 (human NPCs) load correctly textured and lit; missing assets fall back to the engine's error cube. Only the single-model form is implemented; the optional mountDisplayID (rider-on-mount) second arg is a separate follow-up. |