View Single Post
10-25-10, 03:25 PM   #16
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Just trying to help explain:

Code:
local guid = UnitGUID("player"):sub(3) -- Current player GUID (faking your save)
local dungeonid = 603 -- Ulduar
local bossesDowned = "11111111111111111"
--[[                  ABCDEFGHIJKLMNOPQ -- imagine them as each one reference to one letter, 1 is dead and 0 is alive
A = Algalon the Observer
B = Auriaya
C = Flame Leviathan
D = Freya
E = General Vezax
F = Hodir
G = Ignis the Furnace Master
H = Kologarn
I = Mimiron
J = Razorscale
K = The Assembly of Iron
L = Thorim
M = TX-002 Deconstructor
N = Yogg-Saron
O = Elder Brightleaf
P = Elder Ironbranch
Q = Elder Stonebark
]]
local function visualBinaryToDecimal(str) -- just made this to turn the binary into a decimal number -you do NOT have to do it this way!
  local sum = 0
  for i=1, b:len() do
    if b:sub(i,i)=="1" then
      s = s + (2^(i-1))
    end
  end
  return s
end
print(format("\124Hinstancelock:%s:%d:0:%d\124h[Saved Test]\124h", guid, dungeonid, visualBinaryToDecimal(bossesDowned)))
Note:
1. There is no clear pattern, the most left or right digit does not mean first or last boss (this is a con as you wont know if player defeated the last boss or not, you have to keep a database over each dungeon and what their flags represent -lame!)

2. There are as many digits as there are bosses available (look at the raid save tooltip, each line is represented by a digit -this is a pro, as it's easy to find out the biggest value available. In Ulduar there are actually 17 boss flags so the max value that "bossesDowned" can have is 2^(17-1)=131071 (including where all bosses are alive, i.e. 0 while this value is when all are dead) Btw it's 2^16 because 17 would mean there are 18 bosses (don't get confused, just think number of lines in the tooltip, minus 1 that's what you power 2 by).

3. You can fake your saves like any other in-game link, I don't know if this is a pro or con.

A tip: look at ItemRef.lua in the FrameXML folder. You can see all the possible tooltips that you can send and receive. Also you could check how Blizz parses the text and finds out what's a link and not.

Last edited by Vlad : 10-25-10 at 03:33 PM.
  Reply With Quote