allfoxwy / UnitXP_SP3

WoW Vanilla 1.12.1 mod giving Classic style nameplate hiding behaviour and a better TAB and background notifications.
9 stars 1 forks source link

UnitXP Service Pack 3

WoW Vanilla 1.12.1 mod giving Classic style nameplate hiding behaviour and better TAB key functions and background notifications.

I don't take ANY responsibility if this mod is originate in Burning Legion, or it would crash you game, or some Turtle ban your account. USE AT YOUR OWN RISK.

How to install

  1. Download UnitXP-SP3-with-loader.zip from https://github.com/allfoxwy/UnitXP_SP3/releases/latest
  2. Unzip everything into same place with WoW.exe
  3. Move UnitXP_SP3_Addon into WoWclient/Interface/AddOns/
  4. Run Enable sideload-DLL.exe
  5. Start game with WoW_sideload-DLL.exe

Additional tips:

How to use it in game

menu

Targeting function (for TAB key)

This mod adds a few targeting functions to help you have a better TAB.

Currently when continuously trigger these functions, you may experience a small lag between switching target. I believe this is because game needs a server communication to obtain Target of Target information. I wish I could find a better way in future.

Functions could be accessed via Key Bindings menu, or via macro.

keybindings

Nearest targeting

Return TRUE when found a target.

Target nearest enemy. It is the one and the only one nearest enemy. No bullshit. And it follows rules:

Raid mark targeting

Return TRUE when found a target.

These functions only target mobs with a mark icon in order:

  1. Skull
  2. Red X cross
  3. Blue square
  4. Moon
  5. Green triangle
  6. Purple diamond
  7. Orange circle
  8. Yellow star

With following rules:

Melee targeting

Return TRUE when found a target.

These functions are designed for melee:

Ranged targeting

Return TRUE when found a target.

These functions are designed for ranged:

World boss targeting

Return TRUE when found a world boss.

World boss needs special attention:

Range cone

"In front of player camera" is defined by a factor which could be adjusted with:

When this range cone factor in its minimum value 2, the cone is same as game's Field of View.

By default it's 2.2 . Increasing the factor would narrow the cone, so that only mobs in the center of vision would be targeted.

Using multiple targeting function together

For example: "We target raid mark first. However when no mark, we cycle in magic range":

This code works because targeting functions return TRUE or FALSE indicating if they got a target. Lua logic operators support short-cut evaluation, that is, they evaluate their second operand only when necessary.

Proper nameplates

Vanilla client only check distance for nameplates. This makes mobs behind wall/door also show up their nameplates.

This mod changes Vanilla behaviour to Classic style:

Lua nameplate addon would work out-of-box, no need to change anything.

By default this feature is enabled. You could toggle its switch:

Check if two units are in line of sight to each other

UNIT_ID could be "player", "target"... also GUID string "0x12345"

Return TRUE for in sight, FALSE for NOT in sight, NIL for error.

This function has limitation:

Measure distance between two units

UNIT_ID could be "player", "target"... also GUID string "0x12345"

Return a number, or NIL for error.

Flash operating system's taskbar icon when game is in background

Flash would stop when game back to foreground.

To make this function link with certain game events like whisper/trade/invitation etc, we need the Lua Addon.

Play operating system's event sound when game is in background

Only work when game is in background.

To make this function link with certain game events like whisper/trade/invitation etc, we need the Lua Addon.

Timer

Vanilla way doing periodic work is to use GetTime() in an OnUpdate() function and check if the time is come. This is basically doing busy waiting. And because of the game is single-threaded, these timer pulling call would cost FPS. Mostly these function call are useless. For example on a 60 Hz display, we need triggering an event every second, then there would be 59 useless function call before every 1 useful call. Blizz later added C_Timer facility in patch 6.0.2 to solve this problem.

This mod adding a new timer facility to the game. These timers are running in a serperated thread so that their pulling call would not block game thread. When a timer triggers, it would call the corresponding Lua callback in game thread. The callback is passed with a single parameter which is timer ID. It is safe to arm or to disarm timers in callbacks.

The arm method in above example has 2 numberic parameter: The first 1000 means the timer would goes off when 1000ms after the arm method. The second 3000 means the timer would repeatly run every 3000ms after first trigger. If we pass a 0 to second numberic parameter, the timer would only goes off for once then disarm itself.

Beware that the timer is running in a seperated thread so game's /reload would NOT disarm a repeating timer. AddOns need to take care of their own repeating timer in PLAYER_LOGOUT or PLAYER_LEAVING_WORLD event and call disarm method to shut down cleanly.

Timer accuracy is decided by FPS: There would be at most 1 callback for each timer per frame. And because of operating system's scheduling decision it is possible that there could be no timer callback during a frame.

Tell if UnitXP_SP3 functions available

These only work with included vanilla-dll-sideloader, VanillaFixes loader skip them.

When mod loads, it adds some globals to Lua:

You could check their existance to tell if certain function is available.

Some notes for compiling the code

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.