Code:
int __fastcall sub_1408DE6F0(__int64 a1, __int64 a2, int a3)
{
int v3; // ebx@1
__int64 v4; // rsi@1
__int64 v5; // rdi@1
__int64 v6; // rax@1
const char *v7; // rcx@4
__int64 v8; // rax@6
__int64 v9; // rax@6
signed int v10; // ebp@7
__int64 v11; // rax@9
__int64 v12; // r14@9
_BYTE *v13; // rax@12
_BYTE *v14; // rbx@12
const char *v15; // rcx@12
__int64 v16; // rax@14
unsigned int v17; // edx@15
__int64 v18; // rbp@16
__int64 v19; // r14@17
__int64 v20; // r15@18
char *v21; // rbx@19
__int64 v22; // rax@20
char *v23; // rsi@20
char *v24; // rdx@20
__m128d v25; // xmm1@22
__int64 v26; // rdx@22
__m128d v27; // xmm1@22
__int64 v28; // rdx@22
__int64 v29; // rax@22
__int128 v30; // xmm1@24
__int64 v31; // rdx@24
char v33; // [sp+30h] [bp-A18h]@6
char v34; // [sp+130h] [bp-918h]@6
char v35; // [sp+230h] [bp-818h]@24
v3 = a3;
v4 = a2;
v5 = a1;
LODWORD(v6) = lua_createtable(a1, 0i64, 0i64);
if ( *(_DWORD *)v4 )
{
lua_pushstring(v5, (__int64)"itemID");
lua_pushinteger(v5, *(_DWORD *)v4);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"quantity");
lua_pushinteger(v5, *(_DWORD *)(v4 + 4));
LODWORD(v6) = lua_settable(v5, 0xFFFFFFFD);
}
else if ( *(_DWORD *)(v4 + 16) )
{
lua_pushstring(v5, (__int64)"followerXP");
lua_pushinteger(v5, *(_DWORD *)(v4 + 16));
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"icon");
lua_pushstring(v5, (__int64)"Interface\\Icons\\XPBonus_Icon");
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"title");
v7 = "GARRISON_SHIPYARD_REWARD_XP";
if ( v3 != 3 )
v7 = "GARRISON_REWARD_XP";
v8 = sub_1400C42A0((__int64)v7);
lua_pushstring(v5, v8);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"tooltip");
sub_1400C2670(&v33, 256i64, *(_DWORD *)(v4 + 16));
v9 = sub_1400C42A0((__int64)"XP_GAIN");
sub_1402FB110(&v34, 256i64, v9, &v33);
lua_pushstring(v5, (__int64)&v34);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"name");
lua_pushstring(v5, (__int64)&v34);
LODWORD(v6) = lua_settable(v5, 0xFFFFFFFD);
}
else
{
v10 = *(_DWORD *)(v4 + 12);
if ( v10 )
{
lua_pushstring(v5, (__int64)"currencyID");
lua_pushinteger(v5, *(_DWORD *)(v4 + 8));
lua_settable(v5, 0xFFFFFFFD);
if ( *(_DWORD *)(v4 + 8) )
{
lua_pushstring(v5, (__int64)"icon");
LODWORD(v11) = sub_14036DA10((__int64)&qword_141805B50, *(_DWORD *)(v4 + 8), &xmmword_141B100F8, 0i64, 0i64, 0);
v12 = v11;
if ( v11 && *(_BYTE *)(v11 + 20) & 8 )
v10 /= 100;
LODWORD(v13) = sub_140363600(3i64);
v14 = v13;
sub_140927450(*(_DWORD *)(v4 + 8), v12);
*v14;
sub_1402FB110(&v33, 256i64, "%s%s%s", v14);
lua_pushstring(v5, (__int64)&v33);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"title");
v15 = "GARRISON_REWARD_CURRENCY";
}
else
{
lua_pushstring(v5, (__int64)"icon");
lua_pushstring(v5, (__int64)"Interface\\Icons\\inv_misc_coin_01");
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"title");
v15 = "GARRISON_REWARD_MONEY";
}
v16 = sub_1400C42A0((__int64)v15);
lua_pushstring(v5, v16);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"quantity");
lua_pushinteger(v5, v10);
LODWORD(v6) = lua_settable(v5, 0xFFFFFFFD);
}
else
{
v17 = *(_DWORD *)(v4 + 20);
if ( v17 )
{
LODWORD(v6) = sub_14036DA10((__int64)&qword_14180C010, v17, &xmmword_141B100F8, 0i64, 0i64, 0);
v18 = v6;
if ( v6 )
{
LODWORD(v6) = sub_14036DA10((__int64)&qword_141809430, *(_WORD *)(v6 + 8), &xmmword_141B100F8, 0i64, 0i64, 0);
v19 = v6;
if ( v6 )
{
LODWORD(v6) = sub_14036DA10(
(__int64)&qword_14180B990,
*(_BYTE *)(v18 + 11),
&xmmword_141B100F8,
0i64,
0i64,
0);
v20 = v6;
if ( v6 )
{
LODWORD(v6) = sub_14036DA10(
(__int64)&qword_14182C090,
*(_WORD *)(v6 + 8),
&xmmword_141B100F8,
0i64,
0i64,
0);
v21 = (char *)v6;
if ( v6 )
{
lua_pushstring(v5, (__int64)"bonusAbilityID");
lua_pushinteger(v5, *(_DWORD *)(v4 + 20));
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"textureAtlas");
v22 = *(_DWORD *)v21;
v23 = &buf;
v24 = &buf;
if ( (_DWORD)v22 )
v24 = &v21[v22];
lua_pushstring(v5, (__int64)v24);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"posX");
v25 = _mm_cvtps_pd((__m128)*(_DWORD *)v20);
sub_1401D4610(v5, v26);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"posY");
v27 = _mm_cvtps_pd((__m128)*(_DWORD *)(v20 + 4));
sub_1401D4610(v5, v28);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"name");
v29 = *(_DWORD *)v19;
if ( (_DWORD)v29 )
v23 = (char *)(v19 + v29);
lua_pushstring(v5, (__int64)v23);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"description");
sub_1408D43D0(v19, &v35, 2048i64);
lua_pushstring(v5, (__int64)&v35);
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"icon");
sub_1400CAB30(v5, *(_DWORD *)(v19 + 8));
lua_settable(v5, 0xFFFFFFFD);
lua_pushstring(v5, (__int64)"duration");
v30 = COERCE_UNSIGNED_INT64((double)*(signed int *)(v18 + 4));
sub_1401D4610(v5, v31);
LODWORD(v6) = lua_settable(v5, 0xFFFFFFFD);
}
}
}
}
}
}
}
return v6;
}