Advertisement
Guest User

Untitled

a guest
Feb 7th, 2013
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. signed int __cdecl Script_GetBattlefieldStatus(int luaState)
  2. {
  3. int v1; // esi@1
  4. signed int result; // eax@2
  5. int v3; // ST18_4@2
  6. int v4; // ecx@3
  7. int curBG; // ebx@3
  8. int bgStatus; // edi@16
  9. int v7; // eax@17
  10. int v8; // eax@20
  11. int v9; // eax@27
  12. double v10; // st7@30
  13. int v11; // [sp+8h] [bp-18h]@11
  14.  
  15. v1 = luaState;
  16. if ( !lua_isnumber(luaState, 1) )
  17. {
  18. luaL_error(luaState, "Usage: GetBattlefieldStatus(id)", v3);
  19. return 0;
  20. }
  21. curBG = dword_ECCAE8;
  22. v4 = (signed __int64)lua_tonumber(luaState, 1);
  23. if ( dword_ECCAE8 & 1 || !dword_ECCAE8 )
  24. curBG = 0;
  25. while ( 1 )
  26. {
  27. if ( curBG & 1 || !curBG )
  28. {
  29. lua_pushstring(luaState, "none");
  30. lua_pushnil(luaState);
  31. lua_pushnumber(luaState, 0.0);
  32. lua_pushnil(luaState);
  33. lua_pushnil(luaState);
  34. return 5;
  35. }
  36. if ( *(_DWORD *)(curBG + 8) == v4 )
  37. break;
  38. curBG = *(_DWORD *)(curBG + 4);
  39. }
  40. switch ( *(_DWORD *)(curBG + 0x34) )
  41. {
  42. case 0:
  43. v11 = (int)"none";
  44. break;
  45. case 1:
  46. v11 = (int)"queued";
  47. break;
  48. case 2:
  49. v11 = (int)"confirm";
  50. break;
  51. case 4:
  52. v11 = (int)"active";
  53. break;
  54. default:
  55. v11 = (int)"error";
  56. break;
  57. }
  58. lua_pushstring(luaState, v11);
  59. bgStatus = *(_DWORD *)(curBG + 0x34);
  60. if ( bgStatus != 2 )
  61. goto LABEL_22;
  62. v7 = *(_DWORD *)(curBG + 40);
  63. if ( v7 & 0x100000 || ((*(_QWORD *)(curBG + 40) >> 16) & 0xF) == 1 )
  64. {
  65. v1 = luaState;
  66. LABEL_22:
  67. if ( bgStatus != 4 )
  68. goto LABEL_27;
  69. v8 = ClientDB_Size_0x4C__GetRow((int)&g_MapDB, dword_1126F1C);
  70. goto LABEL_24;
  71. }
  72. if ( (*(_DWORD *)(curBG + 40) & 0xFFFF) == 32 )
  73. {
  74. v1 = luaState;
  75. LABEL_27:
  76. v9 = sub_994690(*(_DWORD *)(curBG + 40) & 0xFFFF);
  77. if ( v9 )
  78. lua_pushstring(v1, *(_DWORD *)(v9 + 52));
  79. else
  80. lua_pushnil(v1);
  81. goto LABEL_30;
  82. }
  83. v8 = ClientDB_Size_0x4C__GetRow((int)&g_MapDB, *(_DWORD *)(curBG + 48));
  84. v1 = luaState;
  85. LABEL_24:
  86. if ( !v8 )
  87. goto LABEL_27;
  88. lua_pushstring(v1, *(_DWORD *)(v8 + 20));
  89. LABEL_30:
  90. v10 = (double)*(signed int *)(curBG + 80);
  91. if ( *(_DWORD *)(curBG + 80) < 0 )
  92. v10 = v10 + unk_D282A8;
  93. lua_pushnumber(v1, v10);
  94. if ( *(_DWORD *)(curBG + 84) )
  95. lua_pushnumber(v1, 1.0);
  96. else
  97. lua_pushnil(v1);
  98. if ( *(_DWORD *)(curBG + 92) )
  99. {
  100. lua_pushnumber(v1, 1.0);
  101. result = 5;
  102. }
  103. else
  104. {
  105. lua_pushnil(v1);
  106. result = 5;
  107. }
  108. return result;
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement