[RE-RELEASE]Kostümsystem .so Lib

05/09/2013 04:55 sshjyl#61
If anyone has the energy system, I will exchange him!

Complete ...

Skype: sshjyl

But I need a complete energy system!

dif or .so!
05/09/2013 11:31 IgorGlock#62
Wo bleibt der Sourcecode?
:/
bringt mir wenig das Ding.
05/09/2013 11:55 .Lowbob#63
Quote:
Originally Posted by IgorGlock View Post
Wo bleibt der Sourcecode?
:/
bringt mir wenig das Ding.
Code:
/* This file has been generated by the Hex-Rays decompiler.   Copyright (c) 2007-2011 Hex-Rays <[Only registered and activated users can see links. Click Here To Register...]>

   Detected compiler: GNU C++
*/

#include <defs.h>


//-------------------------------------------------------------------------
// Data declarations

extern _UNKNOWN unk_2740; // weak
extern char aVersion_txt[12]; // weak
extern char aBlackwolfMetin[27]; // weak
extern char a060914[9]; // weak
extern char aMar272013[12]; // weak
extern char aBuiltOnSS[17]; // weak
extern char aCostumeSystemV[28]; // weak
extern char aS[3]; // weak
extern char aSetcostumebody[18]; // weak
extern char aCsystem_part_m[18]; // weak
extern char aCsystem_part_h[23]; // weak
extern char aSetcostumehair[18]; // weak
extern char aCsystem_part_0[22]; // weak
extern char aCsystem_part_1[18]; // weak
extern char aGameFileVersio[65]; // weak
extern char asc_2868[48]; // weak
extern _UNKNOWN unk_2898; // weak
extern _DWORD dword_3008; // idb
extern int dword_3018; // weak
extern void *off_3200; // weak
extern int (**off_3204)(); // weak
extern int CItemManager; // weak
extern int ChatPacket; // weak
extern int SetPart; // weak
extern int GetPart; // weak
extern int GetEmptyInventory; // weak
extern int SetQuestFlag; // weak
extern int GetQuestFlag; // weak
extern int ComputePoints; // weak
extern int PointsPacket; // weak
extern int (__cdecl *AddAffect)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
extern int (__cdecl *RemoveAffect)(_DWORD, _DWORD); // weak
extern int CreateItem; // weak
extern int AddToCharacter; // weak
extern int one_argument; // weak
extern int UseItemEx; // weak
extern int ITEM_MANAGER__RemoveItem; // weak
extern int ITEM_MANAGER__DestroyItem; // weak
extern int locale_find; // weak
extern char aApplyInfo[82]; // weak
extern int (__cdecl *CInputLogin__Entergame)(_DWORD, _DWORD); // weak
extern int dword_3358; // weak
extern char byte_3360; // weak
extern _UNKNOWN unk_3364; // weak
extern _UNKNOWN unk_336C; // weak
// extern int _stdoutp; weak
extern _UNKNOWN _cxa_finalize; // weak
// extern char std::string::_Rep::_S_empty_rep_storage[4]; weak
// extern _UNKNOWN Jv_RegisterClasses; weak

//-------------------------------------------------------------------------
// Function declarations

void (*__cdecl init_proc())(void);
// void *malloc(size_t size);
// __int32 sysconf(int name);
// int __cdecl __cxa_finalize(_DWORD); weak
// int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
int initialize_new_useitems(void); // weak
// int pthread_mutex_unlock(pthread_mutex_t *mutex);
int initialize_costume_system_main(void); // weak
// __int32 strtol(const char *nptr, char **endptr, int base);
_DWORD __cdecl GetQFlag(_DWORD, _DWORD); // weak
_DWORD __cdecl get_costume(_DWORD, _DWORD); // weak
// size_t fwrite(const void *ptr, size_t size, size_t n, FILE *s);
// int __cdecl std::string::string(_DWORD, _DWORD); weak
int soEntry(void); // weak
// int fclose(FILE *stream);
_DWORD __cdecl remove_costume_bonus(_DWORD, _DWORD); // weak
// int fprintf(FILE *stream, const char *format, ...);
// int __cdecl std::string::_Rep::_M_destroy(_DWORD, _DWORD); weak
_DWORD __cdecl detour_x86(void *src, _DWORD, size_t n); // weak
// int mprotect(void *addr, size_t len, int prot);
// int __cdecl std::string::string(_DWORD, _DWORD, _DWORD); weak
// void *calloc(size_t nmemb, size_t size);
_DWORD __cdecl set_costume_bonus(_DWORD, __int16, _DWORD, _DWORD); // weak
_DWORD __cdecl unequip_costume(_DWORD, _DWORD); // weak
// void *memcpy(void *dest, const void *src, size_t n);
int soFinish(void); // weak
// int pthread_mutex_lock(pthread_mutex_t *mutex);
// FILE *fopen(const char *filename, const char *modes);
_DWORD __cdecl SetQFlag(_DWORD, _DWORD, _DWORD); // weak
_DWORD __cdecl equip_costume(_DWORD, _DWORD, _DWORD, _DWORD); // weak
// int puts(const char *s);
void __cdecl start();
int __cdecl sub_15A0();
void __cdecl sub_15D7();
void __cdecl sub_15E0();
int __cdecl set_costume_bonus(int a1, __int16 a2, int a3, int a4);
int __cdecl remove_costume_bonus(int a1, int a2);
int __cdecl get_costume(int a1, int a2);
int __cdecl hGetPart(int a1, int a2);
int __cdecl hSetPart(int a1, int a2, __int16 a3);
void __cdecl soFinish();
int __cdecl sub_17A0();
FILE *__cdecl my_WriteVersion();
void *__cdecl detour_x86(unsigned int src, int a2, size_t n);
int (__cdecl *__cdecl initialize_costume_system_main())(_DWORD, _DWORD);
int __cdecl initialize_new_useitems();
int __cdecl soEntry();
int __cdecl sub_1B30();
int __cdecl GetQFlag(int a1, int a2);
int __cdecl SetQFlag(int a1, int a2, int a3);
int __cdecl unequip_costume(int a1, int a2);
int __cdecl do_costume_unequip(int, int); // weak
int __cdecl equip_costume(int a1, int a2, int a3, int a4);
int __cdecl myEntergame(int, int); // weak
int __cdecl my_use_item_ex(int, int, int); // weak
void __cdecl sub_26F9();
void (*__cdecl sub_2700())(void);
void __cdecl term_proc();
int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));


//----- (00001320) --------------------------------------------------------
void (*__cdecl init_proc())(void)
{
  sub_15A0();
  return sub_2700();
}

//----- (00001540) --------------------------------------------------------
void __cdecl start()
{
  void (*v0)(void); // edx@5

  if ( !byte_3360 )
  {
    if ( &_cxa_finalize )
      __cxa_finalize(off_3200);
    while ( 1 )
    {
      v0 = *off_3204;
      if ( !*off_3204 )
        break;
      ++off_3204;
      v0();
    }
    byte_3360 = 1;
  }
}
// 1364: using guessed type int __cdecl __cxa_finalize(_DWORD);
// 3200: using guessed type void *off_3200;
// 3204: using guessed type int (**off_3204)();
// 3360: using guessed type char byte_3360;

//----- (000015A0) --------------------------------------------------------
int __cdecl sub_15A0()
{
  int result; // eax@3

  if ( dword_3018 )
  {
    if ( &Jv_RegisterClasses )
      result = Jv_RegisterClasses(&dword_3018);
  }
  return result;
}
// 3018: using guessed type int dword_3018;

//----- (000015D7) --------------------------------------------------------
void __cdecl sub_15D7()
{
  ;
}

//----- (000015E0) --------------------------------------------------------
void __cdecl sub_15E0()
{
  dword_3358 = 1;
}
// 3358: using guessed type int dword_3358;

//----- (00001600) --------------------------------------------------------
int __cdecl set_costume_bonus(int a1, __int16 a2, int a3, int a4)
{
  return AddAffect(a1, a4 + 519, aApplyInfo[a2], a3, 0, 31536000, 0, 0, 0);
}
// 3280: using guessed type int (__cdecl *AddAffect)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);

//----- (00001680) --------------------------------------------------------
int __cdecl remove_costume_bonus(int a1, int a2)
{
  return RemoveAffect(a1, a2 + 519);
}
// 3284: using guessed type int (__cdecl *RemoveAffect)(_DWORD, _DWORD);

//----- (000016C0) --------------------------------------------------------
int __cdecl get_costume(int a1, int a2)
{
  int result; // eax@2

  if ( a2 )
  {
    result = 0;
    if ( a2 == 3 )
      result = *(_DWORD *)(a1 + 3996);
  }
  else
  {
    result = *(_DWORD *)(a1 + 3992);
  }
  return result;
}

//----- (000016F0) --------------------------------------------------------
int __cdecl hGetPart(int a1, int a2)
{
  unsigned __int16 v2; // si@1
  int v3; // eax@1

  v2 = *(_WORD *)(a1 + 2 * a2 + 2376);
  v3 = get_costume(a1, a2);
  if ( v3 )
    v2 = v3;
  return v2;
}
// 13D4: using guessed type _DWORD __cdecl get_costume(_DWORD, _DWORD);

//----- (00001740) --------------------------------------------------------
int __cdecl hSetPart(int a1, int a2, __int16 a3)
{
  int result; // eax@1
  __int16 v4; // dx@1

  result = get_costume(a1, a2);
  v4 = a3;
  if ( result )
    v4 = result;
  *(_WORD *)(a1 + 2 * a2 + 2376) = v4;
  return result;
}
// 13D4: using guessed type _DWORD __cdecl get_costume(_DWORD, _DWORD);

//----- (00001790) --------------------------------------------------------
void __cdecl soFinish()
{
  ;
}

//----- (000017A0) --------------------------------------------------------
int __cdecl sub_17A0()
{
  return soFinish();
}
// 14C4: using guessed type int soFinish(void);

//----- (000017C0) --------------------------------------------------------
FILE *__cdecl my_WriteVersion()
{
  FILE *result; // eax@1
  FILE *v1; // esi@1

  result = fopen("VERSION.txt", (const char *)&unk_2740);
  v1 = result;
  if ( result )
  {
    fwrite("Game file version: 2089M\nWith BlackWolf' Costume System Library.", 1u, 0x40u, result);
    result = (FILE *)fclose(v1);
  }
  return result;
}

//----- (000018C0) --------------------------------------------------------
void *__cdecl detour_x86(unsigned int src, int a2, size_t n)
{
  __int32 v3; // esi@1
  void *v4; // ST18_4@1

  v3 = -sysconf(47);
  mprotect((void *)(v3 & src), 5u, 7);
  v4 = malloc(n + 5);
  mprotect((void *)((unsigned int)v4 & v3), n + 5, 7);
  memcpy(v4, (const void *)src, n);
  *((_BYTE *)v4 + n) = -23;
  *(_DWORD *)((char *)v4 + n + 1) = src + n - 5 - (_DWORD)((char *)v4 + n);
  *(_BYTE *)src = -23;
  *(_DWORD *)(src + 1) = a2 - src - 5;
  return v4;
}

//----- (00001980) --------------------------------------------------------
int (__cdecl *__cdecl initialize_costume_system_main())(_DWORD, _DWORD)
{
  int (__cdecl *result)(_DWORD, _DWORD); // eax@1

  mprotect((void *)0x80A6E00, 4u, 7);
  v80A6E00 = 3996;
  SetPart = detour_x86((void *)0x806AEE0, hSetPart, 9u);
  GetPart = detour_x86((void *)0x806ADF0, hGetPart, 9u);
  detour_x86((void *)0x80C4E60, do_costume_unequip, 6u);
  result = (int (__cdecl *)(_DWORD, _DWORD))detour_x86((void *)0x8127C30, myEntergame, 5u);
  CInputLogin__Entergame = result;
  return result;
}
// 1454: using guessed type _DWORD __cdecl detour_x86(void *src, _DWORD, size_t n);
// 2370: using guessed type int __cdecl do_costume_unequip(int, int);
// 24D0: using guessed type int __cdecl myEntergame(int, int);
// 324C: using guessed type int SetPart;
// 3250: using guessed type int GetPart;
// 3354: using guessed type int (__cdecl *CInputLogin__Entergame)(_DWORD, _DWORD);

//----- (00001A50) --------------------------------------------------------
int __cdecl initialize_new_useitems()
{
  int result; // eax@1

  result = detour_x86((void *)0x8097E80, my_use_item_ex, 5u);
  UseItemEx = result;
  return result;
}
// 1454: using guessed type _DWORD __cdecl detour_x86(void *src, _DWORD, size_t n);
// 2590: using guessed type int __cdecl my_use_item_ex(int, int, int);
// 32D4: using guessed type int UseItemEx;

//----- (00001A90) --------------------------------------------------------
int __cdecl soEntry()
{
  puts("-----------------------------------------------");
  puts("BlackWolf' Metin2 Library.");
  fprintf((FILE *)_stdoutp, "Built on: %s %s\n", "Mar 27 2013", "06:09:14");
  initialize_new_useitems();
  initialize_costume_system_main();
  puts("Costume System version: 1.5");
  return detour_x86((void *)0x81E4EC0, my_WriteVersion, 0);
}
// 1384: using guessed type int initialize_new_useitems(void);
// 13A4: using guessed type int initialize_costume_system_main(void);
// 1454: using guessed type _DWORD __cdecl detour_x86(void *src, _DWORD, size_t n);
// 3378: using guessed type int _stdoutp;

//----- (00001B30) --------------------------------------------------------
int __cdecl sub_1B30()
{
  return soEntry();
}
// 1404: using guessed type int soEntry(void);

//----- (00001B50) --------------------------------------------------------
int __cdecl GetQFlag(int a1, int a2)
{
  int v2; // edi@1
  int v3; // edi@1
  int v4; // esi@1
  int v6; // eax@3
  signed __int32 v7; // edx@5
  int v8; // [sp+24h] [bp-14h]@1
  char v9; // [sp+2Ah] [bp-Eh]@7
  char v10; // [sp+2Bh] [bp-Dh]@1

  v2 = GetQuestFlag;
  std::string::string(&v8, a2, &v10);
  v3 = ((int (__cdecl *)(int, int *))v2)(a1, &v8);
  v4 = v8 - 12;
  if ( (char *)(v8 - 12) != std::string::_Rep::_S_empty_rep_storage )
  {
    v6 = dword_3358;
    if ( dword_3358 < 0 )
    {
      if ( &pthread_once )
      {
        pthread_mutex_lock((pthread_mutex_t *)&unk_336C);
        pthread_once((pthread_once_t *)&unk_3364, sub_15E0);
        pthread_mutex_unlock((pthread_mutex_t *)&unk_336C);
      }
      if ( dword_3358 < 0 )
        dword_3358 = 0;
      v6 = dword_3358;
    }
    if ( v6 )
    {
      v7 = _InterlockedExchangeAdd((signed __int32 *)(v4 + 8), 0xFFFFFFFFu);
    }
    else
    {
      v7 = *(_DWORD *)(v4 + 8);
      *(_DWORD *)(v4 + 8) = v7 - 1;
    }
    if ( v7 <= 0 )
      std::string::_Rep::_M_destroy(v4, &v9);
  }
  return v3;
}
// 1444: using guessed type int __cdecl std__string___Rep___M_destroy(_DWORD, _DWORD);
// 1474: using guessed type int __cdecl std__string__string(_DWORD, _DWORD, _DWORD);
// 3260: using guessed type int GetQuestFlag;
// 3358: using guessed type int dword_3358;

//----- (00001D10) --------------------------------------------------------
int __cdecl SetQFlag(int a1, int a2, int a3)
{
  int v3; // edi@1
  int result; // eax@1
  int v5; // esi@1
  int v6; // esi@2
  int v7; // eax@4
  int v8; // edx@6
  int v9; // eax@9
  int v10; // edx@11
  int v11; // [sp+1Ch] [bp-1Ch]@1
  int v12; // [sp+20h] [bp-18h]@1
  char v13; // [sp+27h] [bp-11h]@13
  char v14; // [sp+29h] [bp-Fh]@8
  char v15; // [sp+2Bh] [bp-Dh]@1

  std::string::string(&v12, a2, &v15);
  v3 = SetQuestFlag;
  std::string::string(&v11, &v12);
  result = ((int (__cdecl *)(int, int *, int))v3)(a1, &v11, a3);
  v5 = v11 - 12;
  if ( (char *)(v11 - 12) != std::string::_Rep::_S_empty_rep_storage )
  {
    v7 = dword_3358;
    if ( dword_3358 < 0 )
    {
      if ( &pthread_once )
      {
        pthread_mutex_lock((pthread_mutex_t *)&unk_336C);
        pthread_once((pthread_once_t *)&unk_3364, sub_15E0);
        pthread_mutex_unlock((pthread_mutex_t *)&unk_336C);
      }
      if ( dword_3358 < 0 )
        dword_3358 = 0;
      v7 = dword_3358;
    }
    if ( v7 )
    {
      result = _InterlockedExchangeAdd((signed __int32 *)(v5 + 8), 0xFFFFFFFFu);
      v8 = result;
    }
    else
    {
      v8 = *(_DWORD *)(v5 + 8);
      result = v8 - 1;
      *(_DWORD *)(v5 + 8) = v8 - 1;
    }
    if ( v8 <= 0 )
      result = std::string::_Rep::_M_destroy(v5, &v14);
  }
  v6 = v12 - 12;
  if ( std::string::_Rep::_S_empty_rep_storage != (char *)(v12 - 12) )
  {
    v9 = dword_3358;
    if ( dword_3358 < 0 )
    {
      if ( &pthread_once )
      {
        pthread_mutex_lock((pthread_mutex_t *)&unk_336C);
        pthread_once((pthread_once_t *)&unk_3364, sub_15E0);
        pthread_mutex_unlock((pthread_mutex_t *)&unk_336C);
      }
      if ( dword_3358 < 0 )
        dword_3358 = 0;
      v9 = dword_3358;
    }
    if ( v9 )
    {
      result = _InterlockedExchangeAdd((signed __int32 *)(v6 + 8), 0xFFFFFFFFu);
      v10 = result;
    }
    else
    {
      v10 = *(_DWORD *)(v6 + 8);
      result = v10 - 1;
      *(_DWORD *)(v6 + 8) = v10 - 1;
    }
    if ( v10 <= 0 )
      result = std::string::_Rep::_M_destroy(v6, &v13);
  }
  return result;
}
// 13F4: using guessed type int __cdecl std__string__string(_DWORD, _DWORD);
// 1444: using guessed type int __cdecl std__string___Rep___M_destroy(_DWORD, _DWORD);
// 1474: using guessed type int __cdecl std__string__string(_DWORD, _DWORD, _DWORD);
// 325C: using guessed type int SetQuestFlag;
// 3358: using guessed type int dword_3358;

//----- (00002060) --------------------------------------------------------
int __cdecl unequip_costume(int a1, int a2)
{
  int result; // eax@1
  int v3; // eax@5
  int v4; // edx@5
  int v5; // eax@5
  int v6; // eax@7
  int v7; // eax@11
  int v8; // eax@11
  int v9; // edx@11
  int v10; // eax@11
  int v11; // eax@12
  int v12; // eax@13
  int v13; // esi@15
  int v14; // eax@15
  int v15; // edx@15
  int v16; // esi@17
  int v17; // eax@17
  int v18; // [sp+4h] [bp-34h]@8
  int v19; // [sp+8h] [bp-30h]@8
  int v20; // [sp+1Ch] [bp-1Ch]@4
  int v21; // [sp+20h] [bp-18h]@5
  int v22; // [sp+24h] [bp-14h]@11
  int v23; // [sp+28h] [bp-10h]@11

  result = remove_costume_bonus(a1, a2);
  if ( !a2 )
  {
    result = get_costume(a1, 0);
    v20 = result;
    if ( !result )
      return result;
    v3 = ((int (__cdecl *)(_DWORD, int, signed int, _DWORD, signed int, signed int))CreateItem)(
           *(_DWORD *)CItemManager,
           result,
           1,
           0,
           1,
           -1);
    v4 = 0;
    v21 = v3;
    v5 = *(_DWORD *)(v3 + 68);
    if ( v5 )
      v4 = *(_DWORD *)(v5 + 57);
    v6 = ((int (__cdecl *)(int, int))GetEmptyInventory)(a1, v4);
    if ( v6 != -1 )
    {
      ((void (__cdecl *)(int, int, int))AddToCharacter)(v21, a1, v6);
      *(_DWORD *)(a1 + 3992) = 0;
      v19 = 0;
      v18 = (int)"CSystem.part_main";
LABEL_9:
      SetQFlag(a1, v18, v19);
      ((void (__cdecl *)(int))ComputePoints)(a1);
      return ((int (__cdecl *)(int))PointsPacket)(a1);
    }
    v13 = ChatPacket;
    v14 = ((int (__cdecl *)(_UNKNOWN *))locale_find)(&unk_2898);
    ((void (__cdecl *)(int, signed int, _DWORD, int))v13)(a1, 1, "%s", v14);
    ((void (__cdecl *)(int, signed int, _DWORD, int))ChatPacket)(a1, 5, "SetCostumeBody %i", v20);
    v15 = v21;
    return ((int (__cdecl *)(_DWORD, int))ITEM_MANAGER__DestroyItem)(*(_DWORD *)CItemManager, v15);
  }
  if ( a2 == 3 )
  {
    result = get_costume(a1, 3);
    if ( result )
    {
      v7 = GetQFlag(a1, "CSystem.part_hair_item");
      v22 = v7;
      v8 = ((int (__cdecl *)(_DWORD, int, signed int, _DWORD, signed int, signed int))CreateItem)(
             *(_DWORD *)CItemManager,
             v7,
             1,
             0,
             1,
             -1);
      v9 = 0;
      v23 = v8;
      v10 = *(_DWORD *)(v8 + 68);
      if ( v10 )
        v9 = *(_DWORD *)(v10 + 57);
      v11 = ((int (__cdecl *)(int, int))GetEmptyInventory)(a1, v9);
      if ( v11 != -1 )
      {
        ((void (__cdecl *)(int, int, int))AddToCharacter)(v23, a1, v11);
        v12 = GetQFlag(a1, "CSystem.part_hair_old");
        ((void (__cdecl *)(int, signed int, int))SetPart)(a1, 3, v12);
        *(_DWORD *)(a1 + 3996) = 0;
        SetQFlag(a1, "CSystem.part_hair", 0);
        SetQFlag(a1, "CSystem.part_hair_item", 0);
        v19 = 0;
        v18 = (int)"CSystem.part_hair_old";
        goto LABEL_9;
      }
      v16 = ChatPacket;
      v17 = ((int (__cdecl *)(_UNKNOWN *))locale_find)(&unk_2898);
      ((void (__cdecl *)(int, signed int, _DWORD, int))v16)(a1, 1, "%s", v17);
      ((void (__cdecl *)(int, signed int, _DWORD, int))ChatPacket)(a1, 5, "SetCostumeHair %i", v22);
      v15 = v23;
      return ((int (__cdecl *)(_DWORD, int))ITEM_MANAGER__DestroyItem)(*(_DWORD *)CItemManager, v15);
    }
  }
  return result;
}
// 13C4: using guessed type _DWORD __cdecl GetQFlag(_DWORD, _DWORD);
// 13D4: using guessed type _DWORD __cdecl get_costume(_DWORD, _DWORD);
// 1424: using guessed type _DWORD __cdecl remove_costume_bonus(_DWORD, _DWORD);
// 1504: using guessed type _DWORD __cdecl SetQFlag(_DWORD, _DWORD, _DWORD);
// 3224: using guessed type int CItemManager;
// 323C: using guessed type int ChatPacket;
// 324C: using guessed type int SetPart;
// 3258: using guessed type int GetEmptyInventory;
// 3270: using guessed type int ComputePoints;
// 3274: using guessed type int PointsPacket;
// 328C: using guessed type int CreateItem;
// 3290: using guessed type int AddToCharacter;
// 32DC: using guessed type int ITEM_MANAGER__DestroyItem;
// 32E0: using guessed type int locale_find;

//----- (00002370) --------------------------------------------------------
int __cdecl do_costume_unequip(int a1, int a2)
{
  void *v2; // esi@1
  __int32 v3; // eax@1

  v2 = calloc(0x100u, 1u);
  ((void (__cdecl *)(int, void *, signed int))one_argument)(a2, v2, 256);
  v3 = strtol((const char *)v2, 0, 10);
  unequip_costume(a1, v3);
  return 0;
}
// 14A4: using guessed type _DWORD __cdecl unequip_costume(_DWORD, _DWORD);
// 2370: using guessed type int __cdecl do_costume_unequip(int, int);
// 32A4: using guessed type int one_argument;

//----- (000023F0) --------------------------------------------------------
int __cdecl equip_costume(int a1, int a2, int a3, int a4)
{
  int result; // eax@1

  result = a2;
  if ( a2 )
  {
    if ( a2 == 3 )
    {
      *(_DWORD *)(a1 + 3996) = a4;
      ((void (__cdecl *)(int, signed int, _DWORD, int))ChatPacket)(a1, 5, "SetCostumeHair %i", a3);
      SetQFlag(a1, "CSystem.part_hair", a4);
      result = SetQFlag(a1, "CSystem.part_hair_item", a3);
    }
  }
  else
  {
    *(_DWORD *)(a1 + 3992) = a3;
    ((void (__cdecl *)(int, signed int, _DWORD, int))ChatPacket)(a1, 5, "SetCostumeBody %i", a3);
    result = SetQFlag(a1, "CSystem.part_main", a3);
  }
  return result;
}
// 1504: using guessed type _DWORD __cdecl SetQFlag(_DWORD, _DWORD, _DWORD);
// 323C: using guessed type int ChatPacket;

//----- (000024D0) --------------------------------------------------------
int __cdecl myEntergame(int a1, int a2)
{
  int v2; // eax@1
  int v3; // esi@1
  int v4; // edi@1
  int v5; // eax@2
  int v7; // eax@5
  int v8; // [sp+18h] [bp-10h]@1

  v2 = CInputLogin__Entergame(a1, a2);
  v3 = *(_DWORD *)(a2 + 76);
  v8 = v2;
  v4 = GetQFlag(v3, "CSystem.part_hair");
  if ( v4 )
  {
    v7 = GetQFlag(v3, "CSystem.part_hair_item");
    equip_costume(v3, 3, v7, v4);
  }
  v5 = GetQFlag(v3, "CSystem.part_main");
  if ( v5 )
    equip_costume(v3, 0, v5, 0);
  return v8;
}
// 3354: invalid function type has been ignored
// 13C4: using guessed type _DWORD __cdecl GetQFlag(_DWORD, _DWORD);
// 1514: using guessed type _DWORD __cdecl equip_costume(_DWORD, _DWORD, _DWORD, _DWORD);
// 24D0: using guessed type int __cdecl myEntergame(int, int);
// 3354: using guessed type int (__cdecl *CInputLogin__Entergame)(_DWORD, _DWORD);

//----- (00002590) --------------------------------------------------------
int __cdecl my_use_item_ex(int a1, int a2, int a3)
{
  int v3; // esi@1
  int result; // eax@2
  char v5; // al@4
  char v6; // al@6
  int v7; // esi@6
  int v8; // eax@14
  int v9; // [sp+1Ch] [bp-1Ch]@4
  int v10; // [sp+20h] [bp-18h]@6
  char v11; // [sp+27h] [bp-11h]@6
  signed int v12; // [sp+28h] [bp-10h]@5

  v3 = *(_DWORD *)(a2 + 68);
  if ( *(_BYTE *)(v3 + 54) == 28 )
  {
    ((void (__cdecl *)(_DWORD, int, _DWORD))ITEM_MANAGER__RemoveItem)(*(_DWORD *)CItemManager, a2, 0);
    v9 = *(_DWORD *)v3;
    v5 = *(_BYTE *)(v3 + 55);
    if ( !v5 || (v12 = 3, v5 != 1) )
      v12 = 0;
    v10 = *(_DWORD *)(v3 + 119);
    v6 = *(_BYTE *)(v3 + 92);
    v7 = *(_DWORD *)(v3 + 93);
    v11 = v6;
    if ( get_costume(a1, v12) )
      unequip_costume(a1, v12);
    if ( v12 == 3 )
    {
      v8 = ((int (__cdecl *)(int, signed int))GetPart)(a1, 3);
      if ( v8 )
        SetQFlag(a1, "CSystem.part_hair_old", v8);
    }
    equip_costume(a1, v12, v9, v10);
    if ( v11 )
      set_costume_bonus(a1, v11, v7, v12);
    ((void (__cdecl *)(int))ComputePoints)(a1);
    ((void (__cdecl *)(int))PointsPacket)(a1);
    result = 0;
  }
  else
  {
    result = (char)((int (__cdecl *)(int, int, int))UseItemEx)(a1, a2, a3);
  }
  return result;
}
// 13D4: using guessed type _DWORD __cdecl get_costume(_DWORD, _DWORD);
// 1494: using guessed type _DWORD __cdecl set_costume_bonus(_DWORD, __int16, _DWORD, _DWORD);
// 14A4: using guessed type _DWORD __cdecl unequip_costume(_DWORD, _DWORD);
// 1504: using guessed type _DWORD __cdecl SetQFlag(_DWORD, _DWORD, _DWORD);
// 1514: using guessed type _DWORD __cdecl equip_costume(_DWORD, _DWORD, _DWORD, _DWORD);
// 2590: using guessed type int __cdecl my_use_item_ex(int, int, int);
// 3224: using guessed type int CItemManager;
// 3250: using guessed type int GetPart;
// 3270: using guessed type int ComputePoints;
// 3274: using guessed type int PointsPacket;
// 32D4: using guessed type int UseItemEx;
// 32D8: using guessed type int ITEM_MANAGER__RemoveItem;

//----- (000026F9) --------------------------------------------------------
void __cdecl sub_26F9()
{
  ;
}

//----- (00002700) --------------------------------------------------------
void (*__cdecl sub_2700())(void)
{
  void (*result)(void); // eax@1
  char *v1; // esi@2

  result = (void (*)(void))*(&dword_3008 - 1);
  if ( result != (void (*)(void))-1 )
  {
    v1 = (char *)(&dword_3008 - 1);
    do
    {
      result();
      result = (void (*)(void))*((_DWORD *)v1 - 1);
      v1 -= 4;
    }
    while ( result != (void (*)(void))-1 );
  }
  return result;
}

//----- (00002734) --------------------------------------------------------
void __cdecl term_proc()
{
  start();
}
 // ALL OK, 28 function(s) have been successfully decompiled
05/09/2013 12:01 IgorGlock#64
naja... da ist viel BlaBla im Code - als ob's Maschienensprache wär'. Echte Code wird 70% kürzer :D
05/09/2013 13:17 sinvalloko#65
[Only registered and activated users can see links. Click Here To Register...]
the original lib ae ...
05/10/2013 08:50 ballack12#66
that blackwolf96 is crazy. 55€ for a costume system? wake up man. thats a very high price :X if you low that price maybe me and a lot of people consider on buying it.
05/10/2013 11:22 Perfection-#67
die lib ist sowas von unnötig wenn Blackwolf besser überlegt hätte, hätte es es ganz anderes gemacht das system aber nein er hat quasi nur die liteversion quest genommen als lib in c++ gecoded und paar extra funktionen eingefügt, mehr ist es leider echt nicht, ich meine mal wenn er schon sowas hinbekommt dann solte man doch meinen das man auch auf die idee kommt einen neuen slot hinzuzufügen ( wie bei payla seiner dif ) und dann diese neuen slots mit dem type 28 zu checken alle funktionen dafür sind vorhanden nur werden leider nicht genutzt, finde ich bissel schade.


und naja das sie hier public ist wunderte mich nicht den bei einem preis von 55€ für quasi eine quest als lib musste sie public kommen ^^

55€ der preis wäre dann angemessen gewesen wenn es mit neuen slots und dem ganzen gewesen wäre!
05/10/2013 11:35 davidos12#68
Yes, cmdchat and other..

This system is really : quest + client edit. All
05/10/2013 11:35 RaiN..#69
Quote:
Originally Posted by ballack12 View Post
that blackwolf96 is crazy. 55€ for a costume system? wake up man. thats a very high price :X if you low that price maybe me and a lot of people consider on buying it.
smart people gonna do things for useless people like you, and all the effort that you will ever put on,it will never be the same thing instead.
once you paid, the work is over, no study, no knowledge, not even a brain, at least, you don't need it for pay.
So now, you should figure out how much time this kind of work took away.
05/10/2013 13:10 Pаylasici#70
Quote:
Originally Posted by .Lowbob View Post
Code:
/* This file has been generated by the Hex-Rays decompiler.   Copyright (c) 2007-2011 Hex-Rays <[Only registered and activated users can see links. Click Here To Register...]>

   Detected compiler: GNU C++
*/

#include <defs.h>


//-------------------------------------------------------------------------
// Data declarations

extern _UNKNOWN unk_2740; // weak
extern char aVersion_txt[12]; // weak
extern char aBlackwolfMetin[27]; // weak
extern char a060914[9]; // weak
extern char aMar272013[12]; // weak
extern char aBuiltOnSS[17]; // weak
extern char aCostumeSystemV[28]; // weak
extern char aS[3]; // weak
extern char aSetcostumebody[18]; // weak
extern char aCsystem_part_m[18]; // weak
extern char aCsystem_part_h[23]; // weak
extern char aSetcostumehair[18]; // weak
extern char aCsystem_part_0[22]; // weak
extern char aCsystem_part_1[18]; // weak
extern char aGameFileVersio[65]; // weak
extern char asc_2868[48]; // weak
extern _UNKNOWN unk_2898; // weak
extern _DWORD dword_3008; // idb
extern int dword_3018; // weak
extern void *off_3200; // weak
extern int (**off_3204)(); // weak
extern int CItemManager; // weak
extern int ChatPacket; // weak
extern int SetPart; // weak
extern int GetPart; // weak
extern int GetEmptyInventory; // weak
extern int SetQuestFlag; // weak
extern int GetQuestFlag; // weak
extern int ComputePoints; // weak
extern int PointsPacket; // weak
extern int (__cdecl *AddAffect)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD); // weak
extern int (__cdecl *RemoveAffect)(_DWORD, _DWORD); // weak
extern int CreateItem; // weak
extern int AddToCharacter; // weak
extern int one_argument; // weak
extern int UseItemEx; // weak
extern int ITEM_MANAGER__RemoveItem; // weak
extern int ITEM_MANAGER__DestroyItem; // weak
extern int locale_find; // weak
extern char aApplyInfo[82]; // weak
extern int (__cdecl *CInputLogin__Entergame)(_DWORD, _DWORD); // weak
extern int dword_3358; // weak
extern char byte_3360; // weak
extern _UNKNOWN unk_3364; // weak
extern _UNKNOWN unk_336C; // weak
// extern int _stdoutp; weak
extern _UNKNOWN _cxa_finalize; // weak
// extern char std::string::_Rep::_S_empty_rep_storage[4]; weak
// extern _UNKNOWN Jv_RegisterClasses; weak

//-------------------------------------------------------------------------
// Function declarations

void (*__cdecl init_proc())(void);
// void *malloc(size_t size);
// __int32 sysconf(int name);
// int __cdecl __cxa_finalize(_DWORD); weak
// int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));
int initialize_new_useitems(void); // weak
// int pthread_mutex_unlock(pthread_mutex_t *mutex);
int initialize_costume_system_main(void); // weak
// __int32 strtol(const char *nptr, char **endptr, int base);
_DWORD __cdecl GetQFlag(_DWORD, _DWORD); // weak
_DWORD __cdecl get_costume(_DWORD, _DWORD); // weak
// size_t fwrite(const void *ptr, size_t size, size_t n, FILE *s);
// int __cdecl std::string::string(_DWORD, _DWORD); weak
int soEntry(void); // weak
// int fclose(FILE *stream);
_DWORD __cdecl remove_costume_bonus(_DWORD, _DWORD); // weak
// int fprintf(FILE *stream, const char *format, ...);
// int __cdecl std::string::_Rep::_M_destroy(_DWORD, _DWORD); weak
_DWORD __cdecl detour_x86(void *src, _DWORD, size_t n); // weak
// int mprotect(void *addr, size_t len, int prot);
// int __cdecl std::string::string(_DWORD, _DWORD, _DWORD); weak
// void *calloc(size_t nmemb, size_t size);
_DWORD __cdecl set_costume_bonus(_DWORD, __int16, _DWORD, _DWORD); // weak
_DWORD __cdecl unequip_costume(_DWORD, _DWORD); // weak
// void *memcpy(void *dest, const void *src, size_t n);
int soFinish(void); // weak
// int pthread_mutex_lock(pthread_mutex_t *mutex);
// FILE *fopen(const char *filename, const char *modes);
_DWORD __cdecl SetQFlag(_DWORD, _DWORD, _DWORD); // weak
_DWORD __cdecl equip_costume(_DWORD, _DWORD, _DWORD, _DWORD); // weak
// int puts(const char *s);
void __cdecl start();
int __cdecl sub_15A0();
void __cdecl sub_15D7();
void __cdecl sub_15E0();
int __cdecl set_costume_bonus(int a1, __int16 a2, int a3, int a4);
int __cdecl remove_costume_bonus(int a1, int a2);
int __cdecl get_costume(int a1, int a2);
int __cdecl hGetPart(int a1, int a2);
int __cdecl hSetPart(int a1, int a2, __int16 a3);
void __cdecl soFinish();
int __cdecl sub_17A0();
FILE *__cdecl my_WriteVersion();
void *__cdecl detour_x86(unsigned int src, int a2, size_t n);
int (__cdecl *__cdecl initialize_costume_system_main())(_DWORD, _DWORD);
int __cdecl initialize_new_useitems();
int __cdecl soEntry();
int __cdecl sub_1B30();
int __cdecl GetQFlag(int a1, int a2);
int __cdecl SetQFlag(int a1, int a2, int a3);
int __cdecl unequip_costume(int a1, int a2);
int __cdecl do_costume_unequip(int, int); // weak
int __cdecl equip_costume(int a1, int a2, int a3, int a4);
int __cdecl myEntergame(int, int); // weak
int __cdecl my_use_item_ex(int, int, int); // weak
void __cdecl sub_26F9();
void (*__cdecl sub_2700())(void);
void __cdecl term_proc();
int pthread_once(pthread_once_t *once_control, void (*init_routine)(void));


//----- (00001320) --------------------------------------------------------
void (*__cdecl init_proc())(void)
{
  sub_15A0();
  return sub_2700();
}

//----- (00001540) --------------------------------------------------------
void __cdecl start()
{
  void (*v0)(void); // edx@5

  if ( !byte_3360 )
  {
    if ( &_cxa_finalize )
      __cxa_finalize(off_3200);
    while ( 1 )
    {
      v0 = *off_3204;
      if ( !*off_3204 )
        break;
      ++off_3204;
      v0();
    }
    byte_3360 = 1;
  }
}
// 1364: using guessed type int __cdecl __cxa_finalize(_DWORD);
// 3200: using guessed type void *off_3200;
// 3204: using guessed type int (**off_3204)();
// 3360: using guessed type char byte_3360;

//----- (000015A0) --------------------------------------------------------
int __cdecl sub_15A0()
{
  int result; // eax@3

  if ( dword_3018 )
  {
    if ( &Jv_RegisterClasses )
      result = Jv_RegisterClasses(&dword_3018);
  }
  return result;
}
// 3018: using guessed type int dword_3018;

//----- (000015D7) --------------------------------------------------------
void __cdecl sub_15D7()
{
  ;
}

//----- (000015E0) --------------------------------------------------------
void __cdecl sub_15E0()
{
  dword_3358 = 1;
}
// 3358: using guessed type int dword_3358;

//----- (00001600) --------------------------------------------------------
int __cdecl set_costume_bonus(int a1, __int16 a2, int a3, int a4)
{
  return AddAffect(a1, a4 + 519, aApplyInfo[a2], a3, 0, 31536000, 0, 0, 0);
}
// 3280: using guessed type int (__cdecl *AddAffect)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD, _DWORD);

//----- (00001680) --------------------------------------------------------
int __cdecl remove_costume_bonus(int a1, int a2)
{
  return RemoveAffect(a1, a2 + 519);
}
// 3284: using guessed type int (__cdecl *RemoveAffect)(_DWORD, _DWORD);

//----- (000016C0) --------------------------------------------------------
int __cdecl get_costume(int a1, int a2)
{
  int result; // eax@2

  if ( a2 )
  {
    result = 0;
    if ( a2 == 3 )
      result = *(_DWORD *)(a1 + 3996);
  }
  else
  {
    result = *(_DWORD *)(a1 + 3992);
  }
  return result;
}

//----- (000016F0) --------------------------------------------------------
int __cdecl hGetPart(int a1, int a2)
{
  unsigned __int16 v2; // si@1
  int v3; // eax@1

  v2 = *(_WORD *)(a1 + 2 * a2 + 2376);
  v3 = get_costume(a1, a2);
  if ( v3 )
    v2 = v3;
  return v2;
}
// 13D4: using guessed type _DWORD __cdecl get_costume(_DWORD, _DWORD);

//----- (00001740) --------------------------------------------------------
int __cdecl hSetPart(int a1, int a2, __int16 a3)
{
  int result; // eax@1
  __int16 v4; // dx@1

  result = get_costume(a1, a2);
  v4 = a3;
  if ( result )
    v4 = result;
  *(_WORD *)(a1 + 2 * a2 + 2376) = v4;
  return result;
}
// 13D4: using guessed type _DWORD __cdecl get_costume(_DWORD, _DWORD);

//----- (00001790) --------------------------------------------------------
void __cdecl soFinish()
{
  ;
}

//----- (000017A0) --------------------------------------------------------
int __cdecl sub_17A0()
{
  return soFinish();
}
// 14C4: using guessed type int soFinish(void);

//----- (000017C0) --------------------------------------------------------
FILE *__cdecl my_WriteVersion()
{
  FILE *result; // eax@1
  FILE *v1; // esi@1

  result = fopen("VERSION.txt", (const char *)&unk_2740);
  v1 = result;
  if ( result )
  {
    fwrite("Game file version: 2089M\nWith BlackWolf' Costume System Library.", 1u, 0x40u, result);
    result = (FILE *)fclose(v1);
  }
  return result;
}

//----- (000018C0) --------------------------------------------------------
void *__cdecl detour_x86(unsigned int src, int a2, size_t n)
{
  __int32 v3; // esi@1
  void *v4; // ST18_4@1

  v3 = -sysconf(47);
  mprotect((void *)(v3 & src), 5u, 7);
  v4 = malloc(n + 5);
  mprotect((void *)((unsigned int)v4 & v3), n + 5, 7);
  memcpy(v4, (const void *)src, n);
  *((_BYTE *)v4 + n) = -23;
  *(_DWORD *)((char *)v4 + n + 1) = src + n - 5 - (_DWORD)((char *)v4 + n);
  *(_BYTE *)src = -23;
  *(_DWORD *)(src + 1) = a2 - src - 5;
  return v4;
}

//----- (00001980) --------------------------------------------------------
int (__cdecl *__cdecl initialize_costume_system_main())(_DWORD, _DWORD)
{
  int (__cdecl *result)(_DWORD, _DWORD); // eax@1

  mprotect((void *)0x80A6E00, 4u, 7);
  v80A6E00 = 3996;
  SetPart = detour_x86((void *)0x806AEE0, hSetPart, 9u);
  GetPart = detour_x86((void *)0x806ADF0, hGetPart, 9u);
  detour_x86((void *)0x80C4E60, do_costume_unequip, 6u);
  result = (int (__cdecl *)(_DWORD, _DWORD))detour_x86((void *)0x8127C30, myEntergame, 5u);
  CInputLogin__Entergame = result;
  return result;
}
// 1454: using guessed type _DWORD __cdecl detour_x86(void *src, _DWORD, size_t n);
// 2370: using guessed type int __cdecl do_costume_unequip(int, int);
// 24D0: using guessed type int __cdecl myEntergame(int, int);
// 324C: using guessed type int SetPart;
// 3250: using guessed type int GetPart;
// 3354: using guessed type int (__cdecl *CInputLogin__Entergame)(_DWORD, _DWORD);

//----- (00001A50) --------------------------------------------------------
int __cdecl initialize_new_useitems()
{
  int result; // eax@1

  result = detour_x86((void *)0x8097E80, my_use_item_ex, 5u);
  UseItemEx = result;
  return result;
}
// 1454: using guessed type _DWORD __cdecl detour_x86(void *src, _DWORD, size_t n);
// 2590: using guessed type int __cdecl my_use_item_ex(int, int, int);
// 32D4: using guessed type int UseItemEx;

//----- (00001A90) --------------------------------------------------------
int __cdecl soEntry()
{
  puts("-----------------------------------------------");
  puts("BlackWolf' Metin2 Library.");
  fprintf((FILE *)_stdoutp, "Built on: %s %s\n", "Mar 27 2013", "06:09:14");
  initialize_new_useitems();
  initialize_costume_system_main();
  puts("Costume System version: 1.5");
  return detour_x86((void *)0x81E4EC0, my_WriteVersion, 0);
}
// 1384: using guessed type int initialize_new_useitems(void);
// 13A4: using guessed type int initialize_costume_system_main(void);
// 1454: using guessed type _DWORD __cdecl detour_x86(void *src, _DWORD, size_t n);
// 3378: using guessed type int _stdoutp;

//----- (00001B30) --------------------------------------------------------
int __cdecl sub_1B30()
{
  return soEntry();
}
// 1404: using guessed type int soEntry(void);

//----- (00001B50) --------------------------------------------------------
int __cdecl GetQFlag(int a1, int a2)
{
  int v2; // edi@1
  int v3; // edi@1
  int v4; // esi@1
  int v6; // eax@3
  signed __int32 v7; // edx@5
  int v8; // [sp+24h] [bp-14h]@1
  char v9; // [sp+2Ah] [bp-Eh]@7
  char v10; // [sp+2Bh] [bp-Dh]@1

  v2 = GetQuestFlag;
  std::string::string(&v8, a2, &v10);
  v3 = ((int (__cdecl *)(int, int *))v2)(a1, &v8);
  v4 = v8 - 12;
  if ( (char *)(v8 - 12) != std::string::_Rep::_S_empty_rep_storage )
  {
    v6 = dword_3358;
    if ( dword_3358 < 0 )
    {
      if ( &pthread_once )
      {
        pthread_mutex_lock((pthread_mutex_t *)&unk_336C);
        pthread_once((pthread_once_t *)&unk_3364, sub_15E0);
        pthread_mutex_unlock((pthread_mutex_t *)&unk_336C);
      }
      if ( dword_3358 < 0 )
        dword_3358 = 0;
      v6 = dword_3358;
    }
    if ( v6 )
    {
      v7 = _InterlockedExchangeAdd((signed __int32 *)(v4 + 8), 0xFFFFFFFFu);
    }
    else
    {
      v7 = *(_DWORD *)(v4 + 8);
      *(_DWORD *)(v4 + 8) = v7 - 1;
    }
    if ( v7 <= 0 )
      std::string::_Rep::_M_destroy(v4, &v9);
  }
  return v3;
}
// 1444: using guessed type int __cdecl std__string___Rep___M_destroy(_DWORD, _DWORD);
// 1474: using guessed type int __cdecl std__string__string(_DWORD, _DWORD, _DWORD);
// 3260: using guessed type int GetQuestFlag;
// 3358: using guessed type int dword_3358;

//----- (00001D10) --------------------------------------------------------
int __cdecl SetQFlag(int a1, int a2, int a3)
{
  int v3; // edi@1
  int result; // eax@1
  int v5; // esi@1
  int v6; // esi@2
  int v7; // eax@4
  int v8; // edx@6
  int v9; // eax@9
  int v10; // edx@11
  int v11; // [sp+1Ch] [bp-1Ch]@1
  int v12; // [sp+20h] [bp-18h]@1
  char v13; // [sp+27h] [bp-11h]@13
  char v14; // [sp+29h] [bp-Fh]@8
  char v15; // [sp+2Bh] [bp-Dh]@1

  std::string::string(&v12, a2, &v15);
  v3 = SetQuestFlag;
  std::string::string(&v11, &v12);
  result = ((int (__cdecl *)(int, int *, int))v3)(a1, &v11, a3);
  v5 = v11 - 12;
  if ( (char *)(v11 - 12) != std::string::_Rep::_S_empty_rep_storage )
  {
    v7 = dword_3358;
    if ( dword_3358 < 0 )
    {
      if ( &pthread_once )
      {
        pthread_mutex_lock((pthread_mutex_t *)&unk_336C);
        pthread_once((pthread_once_t *)&unk_3364, sub_15E0);
        pthread_mutex_unlock((pthread_mutex_t *)&unk_336C);
      }
      if ( dword_3358 < 0 )
        dword_3358 = 0;
      v7 = dword_3358;
    }
    if ( v7 )
    {
      result = _InterlockedExchangeAdd((signed __int32 *)(v5 + 8), 0xFFFFFFFFu);
      v8 = result;
    }
    else
    {
      v8 = *(_DWORD *)(v5 + 8);
      result = v8 - 1;
      *(_DWORD *)(v5 + 8) = v8 - 1;
    }
    if ( v8 <= 0 )
      result = std::string::_Rep::_M_destroy(v5, &v14);
  }
  v6 = v12 - 12;
  if ( std::string::_Rep::_S_empty_rep_storage != (char *)(v12 - 12) )
  {
    v9 = dword_3358;
    if ( dword_3358 < 0 )
    {
      if ( &pthread_once )
      {
        pthread_mutex_lock((pthread_mutex_t *)&unk_336C);
        pthread_once((pthread_once_t *)&unk_3364, sub_15E0);
        pthread_mutex_unlock((pthread_mutex_t *)&unk_336C);
      }
      if ( dword_3358 < 0 )
        dword_3358 = 0;
      v9 = dword_3358;
    }
    if ( v9 )
    {
      result = _InterlockedExchangeAdd((signed __int32 *)(v6 + 8), 0xFFFFFFFFu);
      v10 = result;
    }
    else
    {
      v10 = *(_DWORD *)(v6 + 8);
      result = v10 - 1;
      *(_DWORD *)(v6 + 8) = v10 - 1;
    }
    if ( v10 <= 0 )
      result = std::string::_Rep::_M_destroy(v6, &v13);
  }
  return result;
}
// 13F4: using guessed type int __cdecl std__string__string(_DWORD, _DWORD);
// 1444: using guessed type int __cdecl std__string___Rep___M_destroy(_DWORD, _DWORD);
// 1474: using guessed type int __cdecl std__string__string(_DWORD, _DWORD, _DWORD);
// 325C: using guessed type int SetQuestFlag;
// 3358: using guessed type int dword_3358;

//----- (00002060) --------------------------------------------------------
int __cdecl unequip_costume(int a1, int a2)
{
  int result; // eax@1
  int v3; // eax@5
  int v4; // edx@5
  int v5; // eax@5
  int v6; // eax@7
  int v7; // eax@11
  int v8; // eax@11
  int v9; // edx@11
  int v10; // eax@11
  int v11; // eax@12
  int v12; // eax@13
  int v13; // esi@15
  int v14; // eax@15
  int v15; // edx@15
  int v16; // esi@17
  int v17; // eax@17
  int v18; // [sp+4h] [bp-34h]@8
  int v19; // [sp+8h] [bp-30h]@8
  int v20; // [sp+1Ch] [bp-1Ch]@4
  int v21; // [sp+20h] [bp-18h]@5
  int v22; // [sp+24h] [bp-14h]@11
  int v23; // [sp+28h] [bp-10h]@11

  result = remove_costume_bonus(a1, a2);
  if ( !a2 )
  {
    result = get_costume(a1, 0);
    v20 = result;
    if ( !result )
      return result;
    v3 = ((int (__cdecl *)(_DWORD, int, signed int, _DWORD, signed int, signed int))CreateItem)(
           *(_DWORD *)CItemManager,
           result,
           1,
           0,
           1,
           -1);
    v4 = 0;
    v21 = v3;
    v5 = *(_DWORD *)(v3 + 68);
    if ( v5 )
      v4 = *(_DWORD *)(v5 + 57);
    v6 = ((int (__cdecl *)(int, int))GetEmptyInventory)(a1, v4);
    if ( v6 != -1 )
    {
      ((void (__cdecl *)(int, int, int))AddToCharacter)(v21, a1, v6);
      *(_DWORD *)(a1 + 3992) = 0;
      v19 = 0;
      v18 = (int)"CSystem.part_main";
LABEL_9:
      SetQFlag(a1, v18, v19);
      ((void (__cdecl *)(int))ComputePoints)(a1);
      return ((int (__cdecl *)(int))PointsPacket)(a1);
    }
    v13 = ChatPacket;
    v14 = ((int (__cdecl *)(_UNKNOWN *))locale_find)(&unk_2898);
    ((void (__cdecl *)(int, signed int, _DWORD, int))v13)(a1, 1, "%s", v14);
    ((void (__cdecl *)(int, signed int, _DWORD, int))ChatPacket)(a1, 5, "SetCostumeBody %i", v20);
    v15 = v21;
    return ((int (__cdecl *)(_DWORD, int))ITEM_MANAGER__DestroyItem)(*(_DWORD *)CItemManager, v15);
  }
  if ( a2 == 3 )
  {
    result = get_costume(a1, 3);
    if ( result )
    {
      v7 = GetQFlag(a1, "CSystem.part_hair_item");
      v22 = v7;
      v8 = ((int (__cdecl *)(_DWORD, int, signed int, _DWORD, signed int, signed int))CreateItem)(
             *(_DWORD *)CItemManager,
             v7,
             1,
             0,
             1,
             -1);
      v9 = 0;
      v23 = v8;
      v10 = *(_DWORD *)(v8 + 68);
      if ( v10 )
        v9 = *(_DWORD *)(v10 + 57);
      v11 = ((int (__cdecl *)(int, int))GetEmptyInventory)(a1, v9);
      if ( v11 != -1 )
      {
        ((void (__cdecl *)(int, int, int))AddToCharacter)(v23, a1, v11);
        v12 = GetQFlag(a1, "CSystem.part_hair_old");
        ((void (__cdecl *)(int, signed int, int))SetPart)(a1, 3, v12);
        *(_DWORD *)(a1 + 3996) = 0;
        SetQFlag(a1, "CSystem.part_hair", 0);
        SetQFlag(a1, "CSystem.part_hair_item", 0);
        v19 = 0;
        v18 = (int)"CSystem.part_hair_old";
        goto LABEL_9;
      }
      v16 = ChatPacket;
      v17 = ((int (__cdecl *)(_UNKNOWN *))locale_find)(&unk_2898);
      ((void (__cdecl *)(int, signed int, _DWORD, int))v16)(a1, 1, "%s", v17);
      ((void (__cdecl *)(int, signed int, _DWORD, int))ChatPacket)(a1, 5, "SetCostumeHair %i", v22);
      v15 = v23;
      return ((int (__cdecl *)(_DWORD, int))ITEM_MANAGER__DestroyItem)(*(_DWORD *)CItemManager, v15);
    }
  }
  return result;
}
// 13C4: using guessed type _DWORD __cdecl GetQFlag(_DWORD, _DWORD);
// 13D4: using guessed type _DWORD __cdecl get_costume(_DWORD, _DWORD);
// 1424: using guessed type _DWORD __cdecl remove_costume_bonus(_DWORD, _DWORD);
// 1504: using guessed type _DWORD __cdecl SetQFlag(_DWORD, _DWORD, _DWORD);
// 3224: using guessed type int CItemManager;
// 323C: using guessed type int ChatPacket;
// 324C: using guessed type int SetPart;
// 3258: using guessed type int GetEmptyInventory;
// 3270: using guessed type int ComputePoints;
// 3274: using guessed type int PointsPacket;
// 328C: using guessed type int CreateItem;
// 3290: using guessed type int AddToCharacter;
// 32DC: using guessed type int ITEM_MANAGER__DestroyItem;
// 32E0: using guessed type int locale_find;

//----- (00002370) --------------------------------------------------------
int __cdecl do_costume_unequip(int a1, int a2)
{
  void *v2; // esi@1
  __int32 v3; // eax@1

  v2 = calloc(0x100u, 1u);
  ((void (__cdecl *)(int, void *, signed int))one_argument)(a2, v2, 256);
  v3 = strtol((const char *)v2, 0, 10);
  unequip_costume(a1, v3);
  return 0;
}
// 14A4: using guessed type _DWORD __cdecl unequip_costume(_DWORD, _DWORD);
// 2370: using guessed type int __cdecl do_costume_unequip(int, int);
// 32A4: using guessed type int one_argument;

//----- (000023F0) --------------------------------------------------------
int __cdecl equip_costume(int a1, int a2, int a3, int a4)
{
  int result; // eax@1

  result = a2;
  if ( a2 )
  {
    if ( a2 == 3 )
    {
      *(_DWORD *)(a1 + 3996) = a4;
      ((void (__cdecl *)(int, signed int, _DWORD, int))ChatPacket)(a1, 5, "SetCostumeHair %i", a3);
      SetQFlag(a1, "CSystem.part_hair", a4);
      result = SetQFlag(a1, "CSystem.part_hair_item", a3);
    }
  }
  else
  {
    *(_DWORD *)(a1 + 3992) = a3;
    ((void (__cdecl *)(int, signed int, _DWORD, int))ChatPacket)(a1, 5, "SetCostumeBody %i", a3);
    result = SetQFlag(a1, "CSystem.part_main", a3);
  }
  return result;
}
// 1504: using guessed type _DWORD __cdecl SetQFlag(_DWORD, _DWORD, _DWORD);
// 323C: using guessed type int ChatPacket;

//----- (000024D0) --------------------------------------------------------
int __cdecl myEntergame(int a1, int a2)
{
  int v2; // eax@1
  int v3; // esi@1
  int v4; // edi@1
  int v5; // eax@2
  int v7; // eax@5
  int v8; // [sp+18h] [bp-10h]@1

  v2 = CInputLogin__Entergame(a1, a2);
  v3 = *(_DWORD *)(a2 + 76);
  v8 = v2;
  v4 = GetQFlag(v3, "CSystem.part_hair");
  if ( v4 )
  {
    v7 = GetQFlag(v3, "CSystem.part_hair_item");
    equip_costume(v3, 3, v7, v4);
  }
  v5 = GetQFlag(v3, "CSystem.part_main");
  if ( v5 )
    equip_costume(v3, 0, v5, 0);
  return v8;
}
// 3354: invalid function type has been ignored
// 13C4: using guessed type _DWORD __cdecl GetQFlag(_DWORD, _DWORD);
// 1514: using guessed type _DWORD __cdecl equip_costume(_DWORD, _DWORD, _DWORD, _DWORD);
// 24D0: using guessed type int __cdecl myEntergame(int, int);
// 3354: using guessed type int (__cdecl *CInputLogin__Entergame)(_DWORD, _DWORD);

//----- (00002590) --------------------------------------------------------
int __cdecl my_use_item_ex(int a1, int a2, int a3)
{
  int v3; // esi@1
  int result; // eax@2
  char v5; // al@4
  char v6; // al@6
  int v7; // esi@6
  int v8; // eax@14
  int v9; // [sp+1Ch] [bp-1Ch]@4
  int v10; // [sp+20h] [bp-18h]@6
  char v11; // [sp+27h] [bp-11h]@6
  signed int v12; // [sp+28h] [bp-10h]@5

  v3 = *(_DWORD *)(a2 + 68);
  if ( *(_BYTE *)(v3 + 54) == 28 )
  {
    ((void (__cdecl *)(_DWORD, int, _DWORD))ITEM_MANAGER__RemoveItem)(*(_DWORD *)CItemManager, a2, 0);
    v9 = *(_DWORD *)v3;
    v5 = *(_BYTE *)(v3 + 55);
    if ( !v5 || (v12 = 3, v5 != 1) )
      v12 = 0;
    v10 = *(_DWORD *)(v3 + 119);
    v6 = *(_BYTE *)(v3 + 92);
    v7 = *(_DWORD *)(v3 + 93);
    v11 = v6;
    if ( get_costume(a1, v12) )
      unequip_costume(a1, v12);
    if ( v12 == 3 )
    {
      v8 = ((int (__cdecl *)(int, signed int))GetPart)(a1, 3);
      if ( v8 )
        SetQFlag(a1, "CSystem.part_hair_old", v8);
    }
    equip_costume(a1, v12, v9, v10);
    if ( v11 )
      set_costume_bonus(a1, v11, v7, v12);
    ((void (__cdecl *)(int))ComputePoints)(a1);
    ((void (__cdecl *)(int))PointsPacket)(a1);
    result = 0;
  }
  else
  {
    result = (char)((int (__cdecl *)(int, int, int))UseItemEx)(a1, a2, a3);
  }
  return result;
}
// 13D4: using guessed type _DWORD __cdecl get_costume(_DWORD, _DWORD);
// 1494: using guessed type _DWORD __cdecl set_costume_bonus(_DWORD, __int16, _DWORD, _DWORD);
// 14A4: using guessed type _DWORD __cdecl unequip_costume(_DWORD, _DWORD);
// 1504: using guessed type _DWORD __cdecl SetQFlag(_DWORD, _DWORD, _DWORD);
// 1514: using guessed type _DWORD __cdecl equip_costume(_DWORD, _DWORD, _DWORD, _DWORD);
// 2590: using guessed type int __cdecl my_use_item_ex(int, int, int);
// 3224: using guessed type int CItemManager;
// 3250: using guessed type int GetPart;
// 3270: using guessed type int ComputePoints;
// 3274: using guessed type int PointsPacket;
// 32D4: using guessed type int UseItemEx;
// 32D8: using guessed type int ITEM_MANAGER__RemoveItem;

//----- (000026F9) --------------------------------------------------------
void __cdecl sub_26F9()
{
  ;
}

//----- (00002700) --------------------------------------------------------
void (*__cdecl sub_2700())(void)
{
  void (*result)(void); // eax@1
  char *v1; // esi@2

  result = (void (*)(void))*(&dword_3008 - 1);
  if ( result != (void (*)(void))-1 )
  {
    v1 = (char *)(&dword_3008 - 1);
    do
    {
      result();
      result = (void (*)(void))*((_DWORD *)v1 - 1);
      v1 -= 4;
    }
    while ( result != (void (*)(void))-1 );
  }
  return result;
}

//----- (00002734) --------------------------------------------------------
void __cdecl term_proc()
{
  start();
}
 // ALL OK, 28 function(s) have been successfully decompiled

Pseudocode.
05/10/2013 13:59 .Lowbob#71
Quote:
Originally Posted by Pаylasici View Post

Pseudocode.
ich weiß das es der pseudocode ist steht auch da hex-rays oder nicht? so ein sinnloser beitrag von dir.. wolltest du auf cool machen weil du dich auskennst mit dem zeug? :facepalm:
05/10/2013 14:09 Prince43™#72
Quote:
Originally Posted by .Lowbob View Post
ich weiß das es der pseudocode ist steht auch da hex-rays oder nicht? so ein sinnloser beitrag von dir.. wolltest du auf cool machen weil du dich auskennst mit dem zeug? :facepalm:
Payla kann mehr labern als tuhen war schon immer der fall ;)




Kind Regards

Prince43™
05/10/2013 14:15 TheMarv :<#73
Quote:
Originally Posted by .Lowbob View Post
ich weiß das es der pseudocode ist steht auch da hex-rays oder nicht? so ein sinnloser beitrag von dir.. wolltest du auf cool machen weil du dich auskennst mit dem zeug? :facepalm:
Das heißt aber dann auch das dein Post unnötig war, weil Igor ja den Source Code wollte, nicht den Pseudo Code... :facepalm:
05/10/2013 15:03 Ocelot2606#74
Ich versteh das ganze drum herum sowieso nicht kuckt euch bitte mal an wie die normalen Slots in der game definiert werden und schwups schon weiss man wie man es machen kann

Ps.: Mehr als 127 geht nicht aber man benötigt ja nur mal 106 und 107 und mittels

PHP Code:
item.select_cell(106bzw item.select_cell(107
kann man da schön was basteln vlt mach ich es mal die tage public dann ist das endlich erledigt und die Threads hören endlich auf
05/10/2013 18:43 'oShet#75
Quote:
Originally Posted by Ocelot2606 View Post
Ich versteh das ganze drum herum sowieso nicht kuckt euch bitte mal an wie die normalen Slots in der game definiert werden und schwups schon weiss man wie man es machen kann

Ps.: Mehr als 127 geht nicht aber man benötigt ja nur mal 106 und 107 und mittels

PHP Code:
item.select_cell(106bzw item.select_cell(107
kann man da schön was basteln vlt mach ich es mal die tage public dann ist das endlich erledigt und die Threads hören endlich auf
dazu braucht man aber die dif von payla.