you can check if you have the bg begin buff on you or not.
you can check if you have the bg begin buff on you or not.
here is how I do :
It's very easy.Code:bgStarted = !Me.HasBuff(44521);
And how can we determine if bg has ended?
I mean, do you have to wait those 2 minutes when bg has ended? You know when the scorewindow is up at the end. If you don't click the "leave battleground" button you stay in. (there is a 2m countdown right?) So the true question is; when didn't leave but bg has ended, BattleGroundStatus says: none? Or still active until you leave really?
Last edited by Pimpace; 11-18-2009 at 03:23 PM.
Here is my translation of lua_GetBattlefieldWinner. Did this a half year ago, so don't blame me if I messed up.
Just update it with the last binary:
//hasBattlefieldEnded : 4bit-Integer, 0x01129344
//battlefieldWinner: Double, 0x01129348
Code:int SomeWoWClass::lua_getBattleFieldWinner(lua_State* L) { double returnvalue; if(hasBattlefieldEnded != 0) { returnvalue = battlefieldWinner; if(returnvalue < 0) { returnvalue += 4294967296; //UINT_MAX } lua_pushNumber(L, returnvalue); } else { lua_pushNil(L); } return 1; }
Hey, it compiles! Ship it!
Your addresses seem to be correct but your translation of the function seems to be a bit off.
This one should be accurate:
Code:int __cdecl Lua_GetBattlefieldWinner(void* pLuaState) { if (HasBattlefieldEnded) { LuaPushNumber(pLuaState, BattlefieldWinner); } else { LuaPushNil(pLuaState); } return 1; }
Yeah, I know.
Did it some time ago and had a strange style doing so I know later exactly what types those vars have etc.
Funny that Hexrays displayed it to me as __thiscall, which makes absolutly no sense for a lua function.
So this is exactly doing...nothing? I guess I have to read a bit more about binary operations, compiler generated arithmetics and stuff.if(returnvalue < 0)
{
returnvalue += 4294967296; //UINT_MAX
}
Especially as WoW treats so many numbers as double.
I see, I need HexRays 1.1 .... but its just so damn expensive, so I got to live with my cracked 1.0 -.-
Hey, it compiles! Ship it!
The crap with "4.294967296e9" is the math required to convert an integer to a double. Sorry, I ommitted the casts in the code I posted.
It would actually be more likely to look like this at the source level:
LuaPushNumber(pLuaState, static_cast<double>(BattlefieldWinner));
I'm about to go out so I don't have time to explain it, but you should be able to pull up some answers with the help of Google.
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - Martin Golding
"I cried a little earlier when I had to poop" - Sku