decompiled_code:
__int64 __fastcall mpedit_show(__int64 a1)
{
const char **v1; // rbp
__int64 v2; // rax
__int64 v3; // rax

v1 = *(const char ***)(*(_QWORD *)(a1 + 88) + 1632LL);
v2 = Format("Vnum: [%d]\n\r", (unsigned int)*(__int16 *)v1);
send_to_char(v2, a1);
v3 = Format("Code:\n\r%s\n\r", v1[1]);
send_to_char(v3, a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
const char **v1; // rbp
__int64 v2; // rax
__int64 v3; // rax

v1 = *(const char ***)(*(_QWORD *)(a1 + 88) + 1632LL);
v2 = Format("Vnum: [%d]\n\r", (unsigned int)*(__int16 *)v1);
send_to_char(v2, a1);
v3 = Format("Code:\n\r%s\n\r", v1[1]);
send_to_char(v3, a1);
return 0LL;
}

original_code:
bool mpedit_show(CHAR_DATA *ch, char*argument)
{
    MPROG_CODE *pMcode;
    ( pMcode = (MPROG_CODE*)ch->desc->pEdit );
    send_to_char( Format("Vnum:       [%d]\n\r", pMcode->vnum), ch);
    send_to_char( Format("Code:\n\r%s\n\r", pMcode->code), ch);
    return 0;
}

canonical_original_code:
unsigned char mpedit_show(struct char_data *ch, char *argument)
{
    struct mprog_code *pMcode;
    ( pMcode = (struct mprog_code *)ch->desc->pEdit );
    send_to_char( Format("Vnum:       [%d]\n\r", pMcode->vnum), ch);
    send_to_char( Format("Code:\n\r%s\n\r", pMcode->code), ch);
    return 0;
}

user_defined_types: struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data *pShop; struct mprog_list *mprogs; struct area_data *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; }

user_defined_types: struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t *pProtocol; }

user_defined_types: struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data *extra_descr; struct affect_data *affected; struct obj_index_data *pIndexData; struct room_index_data *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; }

user_defined_types: struct pc_data { struct pc_data *next; struct buf_type *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; }

user_defined_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; }

user_defined_types: enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 }

user_defined_types: struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }

user_defined_types: struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; }


repo: ptrayal/dungeonworld

decompiled_code:
__int64 __fastcall mpedit_code(__int64 a1, _BYTE *a2)
{
__int64 result; // rax

if ( a2 && *a2 )
{
send_to_char("Syntax: code\n\r", a1);
result = 0LL;
}
else
{
string_append(a1, *(_QWORD *)(*(_QWORD *)(a1 + 88) + 1632LL) + 8LL);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, _BYTE *a2)
{
__int64 result; // rax

if ( a2 && *a2 )
{
send_to_char("Syntax: code\n\r", a1);
result = 0LL;
}
else
{
string_append(a1, *(_QWORD *)(*(_QWORD *)(a1 + 88) + 1632LL) + 8LL);
result = 1LL;
}
return result;
}

original_code:
bool mpedit_code(CHAR_DATA *ch, char*argument)
{
    MPROG_CODE *pMcode;
    ( pMcode = (MPROG_CODE*)ch->desc->pEdit );
    if (((argument) == ((void *)0) || (argument)[0] == '\0'))
    {
       string_append(ch, &pMcode->code);
       return 1;
    }
    send_to_char("Syntax: code\n\r",ch);
    return 0;
}

canonical_original_code:
unsigned char mpedit_code(struct char_data *ch, char *argument)
{
    struct mprog_code *pMcode;
    ( pMcode = (struct mprog_code *)ch->desc->pEdit );
    if (((argument) == ((void *)0) || (argument)[0] == '\0'))
    {
       string_append(ch, &pMcode->code);
       return 1;
    }
    send_to_char("Syntax: code\n\r",ch);
    return 0;
}

variable_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; } *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; } *pShop; struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; } *mprogs; struct area_data { struct area_data *next; struct help_area_data { struct help_area_data *next; struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; } *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; } *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; } *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; } *pIndexData; struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t { int WriteOOB; enum bool_t { false=0, true=1 } Negotiated[-1]; enum bool_t { false=0, true=1 } bIACMode; enum bool_t { false=0, true=1 } bNegotiated; enum bool_t { false=0, true=1 } bRenegotiate; enum bool_t { false=0, true=1 } bNeedMXPVersion; enum bool_t { false=0, true=1 } bBlockMXP; enum bool_t { false=0, true=1 } bTTYPE; enum bool_t { false=0, true=1 } bECHO; enum bool_t { false=0, true=1 } bNAWS; enum bool_t { false=0, true=1 } bCHARSET; enum bool_t { false=0, true=1 } bMSDP; enum bool_t { false=0, true=1 } bMSSP; enum bool_t { false=0, true=1 } bATCP; enum bool_t { false=0, true=1 } bMSP; enum bool_t { false=0, true=1 } bMXP; enum bool_t { false=0, true=1 } bMCCP; enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 } b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t { enum bool_t { false=0, true=1 } bReport; enum bool_t { false=0, true=1 } bDirty; int ValueInt; char *pValueString; } **pVariables; } *pProtocol; } *desc; struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; } *affected; struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; } *pnote; struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; } *extra_descr; struct affect_data *affected; struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; } *pIndexData; struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; } *exit[6]; struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; } *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; } *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; } *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data { struct pc_data *next; struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; } *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; } *pcdata; struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; } *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; } *

variable_types:
argument
char *

variable_types: struct mprog_code { short vnum; char *code; struct mprog_code *next; } *

return_type: unsigned char

user_defined_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data *pIndexData; struct descriptor_data *desc; struct affect_data *affected; struct note_data *pnote; struct obj_data *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data *pcdata; struct gen_data *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; }

user_defined_types: struct area_data { struct area_data *next; struct help_area_data *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; }

user_defined_types: struct protocol_t { int WriteOOB; enum bool_t Negotiated[-1]; enum bool_t bIACMode; enum bool_t bNegotiated; enum bool_t bRenegotiate; enum bool_t bNeedMXPVersion; enum bool_t bBlockMXP; enum bool_t bTTYPE; enum bool_t bECHO; enum bool_t bNAWS; enum bool_t bCHARSET; enum bool_t bMSDP; enum bool_t bMSSP; enum bool_t bATCP; enum bool_t bMSP; enum bool_t bMXP; enum bool_t bMCCP; enum support_t b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t **pVariables; }

user_defined_types: struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data *exit[6]; struct reset_data *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; }

user_defined_types: struct help_area_data { struct help_area_data *next; struct help_data *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; }

user_defined_types: struct MSDP_t { enum bool_t bReport; enum bool_t bDirty; int ValueInt; char *pValueString; }


original_code:
bool mpedit_list(CHAR_DATA *ch, char*argument)
{
    int count = 1;
    MPROG_CODE *mprg;
    char buf[4608]={'\0'};
    BUFFER *buffer;
    bool fAll = !__strcmp(argument, "all", "olc_mpcode.c", __FUNCTION__, 230);
    char blah;
    AREA_DATA *ad;
    buffer = __new_buf("olc_mpcode.c", __FUNCTION__, 234);
    for (mprg = mprog_list; mprg !=((void *)0); mprg = mprg->next)
 if ( fAll || ( ((ch->in_room->area->min_vnum) < (mprg->vnum)) && ((mprg->vnum) < (ch->in_room->area->max_vnum)) ) )
 {
  ad = get_vnum_area(mprg->vnum);
  if ( ad == ((void *)0) )
   blah = '?';
  else
  if ( ( !((((ch)->act) & ((1)))) && !( ch->desc && ch->desc->original ) && ( ch->pcdata->security >= ad->security || strstr( ad->builders, ch->name ) || strstr( ad->builders, "All" ) ) ) )
   blah = '*';
  else
   blah = ' ';
  sprintf(buf, "[%3d] (%c) %5d\n\r", count, blah, mprg->vnum );
  add_buf(buffer, buf);
  count++;
 }
    if ( count == 1 )
    {
     if ( fAll )
      add_buf( buffer, "There are currently no existing mprogs.\n\r" );
     else
      add_buf( buffer, "There are no mprogs in this area.\n\r" );
    }
    page_to_char(buf_string(buffer), ch);
    free_buf(buffer);
    return 0;
}

canonical_original_code:
unsigned char mpedit_list(struct char_data *ch, char *argument)
{
    int count = 1;
    struct mprog_code *mprg;
    char buf[4608] = {'\0'};
    struct buf_type *buffer;
    unsigned char fAll = !__strcmp(argument, "all", "olc_mpcode.c", __FUNCTION__, 230);
    char blah;
    struct area_data *ad;
    buffer = __new_buf("olc_mpcode.c", __FUNCTION__, 234);
    for (mprg = mprog_list; mprg !=((void *)0); mprg = mprg->next)
 if ( fAll || ( ((ch->in_room->area->min_vnum) < (mprg->vnum)) && ((mprg->vnum) < (ch->in_room->area->max_vnum)) ) )
 {
  ad = get_vnum_area(mprg->vnum);
  if ( ad == ((void *)0) )
   blah = '?';
  else
  if ( ( !((((ch)->act) & ((1)))) && !( ch->desc && ch->desc->original ) && ( ch->pcdata->security >= ad->security || strstr( ad->builders, ch->name ) || strstr( ad->builders, "All" ) ) ) )
   blah = '*';
  else
   blah = ' ';
  sprintf(buf, "[%3d] (%c) %5d\n\r", count, blah, mprg->vnum );
  add_buf(buffer, buf);
  count++;
 }
    if ( count == 1 )
    {
     if ( fAll )
      add_buf( buffer, "There are currently no existing mprogs.\n\r" );
     else
      add_buf( buffer, "There are no mprogs in this area.\n\r" );
    }
    page_to_char(buf_string(buffer), ch);
    free_buf(buffer);
    return 0;
}

variable_types: count int

variable_types:
buf
char [4608]

variable_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; } *

variable_types:
fAll
unsigned char

variable_types: blah char

variable_types: struct area_data { struct area_data *next; struct help_area_data { struct help_area_data *next; struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; } *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; } *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; } *

user_defined_types: struct mprog_code { short vnum; char *code; struct mprog_code *next; }

user_defined_types: struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; }

user_defined_types: struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; }

user_defined_types: struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; }

user_defined_types: struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; }

user_defined_types: struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; }

user_defined_types: struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; }

user_defined_types: struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; }

user_defined_types: struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; }


mpedit

decompiled_code:
__int64 __fastcall mpedit(__int64 a1, const char *a2)
{
__int64 v2; // r13
__int16 *v3; // r14
__int64 v4; // rax
__int64 v5; // rdx
__int64 result; // rax
const char *v7; // rbx
__int64 v8; // rbx
const char *v9; // rsi
char v10[256]; // [rsp+0h] [rbp-228h] BYREF
char dest[296]; // [rsp+100h] [rbp-128h] BYREF

smash_tilde(a2);
strcpy(dest, a2);
v2 = one_argument(a2, v10);
v3 = *(__int16 **)(*(_QWORD *)(a1 + 88) + 1632LL);
if ( v3 )
{
v4 = get_vnum_area((unsigned int)*v3);
if ( !v4 )
return edit_done(a1);
if ( (*(_BYTE *)(a1 + 320) & 1) != 0
|| (v5 = *(_QWORD *)(a1 + 88)) != 0 && *(_QWORD *)(v5 + 24)
|| *(_DWORD *)(*(_QWORD *)(a1 + 152) + 536LL) < *(_DWORD *)(v4 + 72)
&& (v7 = *(const char **)(v4 + 56), !strstr(v7, *(const char **)(a1 + 176)))
&& !strstr(v7, "All") )
{
send_to_char("MPEdit: Insufficient security to modify code.\n\r", a1);
return edit_done(a1);
}
}
if ( !v10[0] )
return mpedit_show(a1);
v8 = 0LL;
v9 = "commands";
if ( !(unsigned __int8)_strcmp(v10, "done", "olc_mpcode.c", "mpedit", 75LL) )
return edit_done(a1);
while ( (unsigned __int8)str_prefix(v10, v9) )
{
++v8;
v9 = (&mpedit_table)[2 * v8];
if ( !v9 )
return interpret(a1, dest);
}
result = ((__int64 (__fastcall *)(__int64, __int64))(&mpedit_table)[2 * (int)v8 + 1])(a1, v2);
if ( v3 && (_BYTE)result )
{
result = get_vnum_area((unsigned int)*v3);
if ( result )
*(_DWORD *)(result + 68) |= 1u;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, const char *a2)
{
__int64 v2; // r13
__int16 *v3; // r14
__int64 v4; // rax
__int64 v5; // rdx
__int64 result; // rax
const char *v7; // rbx
__int64 v8; // rbx
const char *v9; // rsi
char v10[256]; // [rsp+0h] [rbp-228h] BYREF
char dest[296]; // [rsp+100h] [rbp-128h] BYREF

smash_tilde(a2);
strcpy(dest, a2);
v2 = one_argument(a2, v10);
v3 = *(__int16 **)(*(_QWORD *)(a1 + 88) + 1632LL);
if ( v3 )
{
v4 = get_vnum_area((unsigned int)*v3);
if ( !v4 )
return edit_done(a1);
if ( (*(_BYTE *)(a1 + 320) & 1) != 0
|| (v5 = *(_QWORD *)(a1 + 88)) != 0 && *(_QWORD *)(v5 + 24)
|| *(_DWORD *)(*(_QWORD *)(a1 + 152) + 536LL) < *(_DWORD *)(v4 + 72)
&& (v7 = *(const char **)(v4 + 56), !strstr(v7, *(const char **)(a1 + 176)))
&& !strstr(v7, "All") )
{
send_to_char("MPEdit: Insufficient security to modify code.\n\r", a1);
return edit_done(a1);
}
}
if ( !v10[0] )
return func1(a1);
v8 = 0LL;
v9 = "commands";
if ( !(unsigned __int8)_strcmp(v10, "done", "olc_mpcode.c", "mpedit", 75LL) )
return edit_done(a1);
while ( (unsigned __int8)str_prefix(v10, v9) )
{
++v8;
v9 = (&mpedit_table)[2 * v8];
if ( !v9 )
return interpret(a1, dest);
}
result = ((__int64 (__fastcall *)(__int64, __int64))(&mpedit_table)[2 * (int)v8 + 1])(a1, v2);
if ( v3 && (_BYTE)result )
{
result = get_vnum_area((unsigned int)*v3);
if ( result )
*(_DWORD *)(result + 68) |= 1u;
}
return result;
}

original_code:
void mpedit( CHAR_DATA *ch, char *argument)
{
    MPROG_CODE *pMcode;
    char arg[256];
    char command[256];
    int cmd;
    AREA_DATA *ad;
    smash_tilde(argument);
    strcpy(arg, argument);
    argument = one_argument( argument, command);
    ( pMcode = (MPROG_CODE*)ch->desc->pEdit );
    if (pMcode)
    {
 ad = get_vnum_area( pMcode->vnum );
 if ( ad == ((void *)0) )
 {
  edit_done(ch);
  return;
 }
 if ( !( !((((ch)->act) & ((1)))) && !( ch->desc && ch->desc->original ) && ( ch->pcdata->security >= ad->security || strstr( ad->builders, ch->name ) || strstr( ad->builders, "All" ) ) ) )
 {
  send_to_char("MPEdit: Insufficient security to modify code.\n\r", ch);
  edit_done(ch);
  return;
 }
    }
    if (((command) == ((void *)0) || (command)[0] == '\0'))
    {
        mpedit_show(ch, argument);
        return;
    }
    if (!__strcmp(command, "done", "olc_mpcode.c", __FUNCTION__, 75) )
    {
        edit_done(ch);
        return;
    }
    for (cmd = 0; mpedit_table[cmd].name != ((void *)0); cmd++)
    {
 if (!str_prefix(command, mpedit_table[cmd].name) )
 {
  if ((*mpedit_table[cmd].olc_fun) (ch, argument) && pMcode)
   if ((ad = get_vnum_area(pMcode->vnum)) != ((void *)0))
    ((ad->area_flags) |= (1));
  return;
 }
    }
    interpret(ch, arg);
    return;
}

canonical_original_code:
void mpedit(struct char_data *ch, char *argument)
{
    struct mprog_code *pMcode;
    char arg[256];
    char command[256];
    int cmd;
    struct area_data *ad;
    smash_tilde(argument);
    strcpy(arg, argument);
    argument = one_argument( argument, command);
    ( pMcode = (struct mprog_code *)ch->desc->pEdit );
    if (pMcode)
    {
 ad = get_vnum_area( pMcode->vnum );
 if ( ad == ((void *)0) )
 {
  edit_done(ch);
  return;
 }
 if ( !( !((((ch)->act) & ((1)))) && !( ch->desc && ch->desc->original ) && ( ch->pcdata->security >= ad->security || strstr( ad->builders, ch->name ) || strstr( ad->builders, "All" ) ) ) )
 {
  send_to_char("MPEdit: Insufficient security to modify code.\n\r", ch);
  edit_done(ch);
  return;
 }
    }
    if (((command) == ((void *)0) || (command)[0] == '\0'))
    {
        mpedit_show(ch, argument);
        return;
    }
    if (!__strcmp(command, "done", "olc_mpcode.c", __FUNCTION__, 75) )
    {
        edit_done(ch);
        return;
    }
    for (cmd = 0; mpedit_table[cmd].name != ((void *)0); cmd++)
    {
 if (!str_prefix(command, mpedit_table[cmd].name) )
 {
  if ((*mpedit_table[cmd].olc_fun) (ch, argument) && pMcode)
   if ((ad = get_vnum_area(pMcode->vnum)) != ((void *)0))
    ((ad->area_flags) |= (1));
  return;
 }
    }
    interpret(ch, arg);
    return;
}

variable_types:
arg
char [256]

variable_types:
command
char [256]

variable_types: cmd int

return_type: void

user_defined_types: struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data *pShop; struct mprog_list *mprogs; struct area_data *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; }

user_defined_types: struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t *pProtocol; }

user_defined_types: struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data *extra_descr; struct affect_data *affected; struct obj_index_data *pIndexData; struct room_index_data *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; }

user_defined_types: struct pc_data { struct pc_data *next; struct buf_type *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; }

user_defined_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; }

user_defined_types: struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; }

user_defined_types: enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 }

user_defined_types: struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }


decompiled_code:
__int64 __fastcall do_mpedit(__int64 a1, __int64 a2)
{
const char *v2; // rbp
unsigned int v3; // ebp
__int64 v4; // r12
__int64 v5; // rax
__int64 v6; // rbp
__int64 result; // rax
const char *v8; // r13
char v9[296]; // [rsp+0h] [rbp-128h] BYREF

v2 = (const char *)one_argument(a2, v9);
if ( (unsigned __int8)is_number(v9) )
{
v3 = atoi(v9);
v4 = get_mprog_index(v3);
if ( v4 )
{
v5 = get_vnum_area(v3);
if ( v5 )
{
if ( (*(_BYTE *)(a1 + 320) & 1) != 0
|| (v6 = *(_QWORD *)(a1 + 88)) != 0 && *(_QWORD *)(v6 + 24)
|| *(_DWORD *)(*(_QWORD *)(a1 + 152) + 536LL) < *(_DWORD *)(v5 + 72)
&& (v8 = *(const char **)(v5 + 56), !strstr(v8, *(const char **)(a1 + 176)))
&& !strstr(v8, "All") )
{
result = send_to_char("MPEdit : You do not have access to that area.\n\r", a1);
}
else
{
*(_QWORD *)(v6 + 1632) = v4;
result = *(_QWORD *)(a1 + 88);
*(_DWORD *)(result + 1648) = 5;
}
}
else
{
result = send_to_char("MPEdit : That vnum has not been assigned to an area.\n\r", a1);
}
}
else
{
result = send_to_char("MPEdit : That vnum does not exist.\n\r", a1);
}
}
else if ( !(unsigned __int8)_strcmp(v9, "create", "olc_mpcode.c", "do_mpedit", 135LL) )
{
if ( v2 && *v2 )
result = mpedit_create(a1, v2);
else
result = send_to_char("Syntax : mpedit create [vnum]\n\r", a1);
}
else
{
send_to_char("Syntax : mpedit [vnum]\n\r", a1);
result = send_to_char(" mpedit create [vnum]\n\r", a1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2)
{
const char *v2; // rbp
unsigned int v3; // ebp
__int64 v4; // r12
__int64 v5; // rax
__int64 v6; // rbp
__int64 result; // rax
const char *v8; // r13
char v9[296]; // [rsp+0h] [rbp-128h] BYREF

v2 = (const char *)one_argument(a2, v9);
if ( (unsigned __int8)is_number(v9) )
{
v3 = atoi(v9);
v4 = get_mprog_index(v3);
if ( v4 )
{
v5 = get_vnum_area(v3);
if ( v5 )
{
if ( (*(_BYTE *)(a1 + 320) & 1) != 0
|| (v6 = *(_QWORD *)(a1 + 88)) != 0 && *(_QWORD *)(v6 + 24)
|| *(_DWORD *)(*(_QWORD *)(a1 + 152) + 536LL) < *(_DWORD *)(v5 + 72)
&& (v8 = *(const char **)(v5 + 56), !strstr(v8, *(const char **)(a1 + 176)))
&& !strstr(v8, "All") )
{
result = send_to_char("MPEdit : You do not have access to that area.\n\r", a1);
}
else
{
*(_QWORD *)(v6 + 1632) = v4;
result = *(_QWORD *)(a1 + 88);
*(_DWORD *)(result + 1648) = 5;
}
}
else
{
result = send_to_char("MPEdit : That vnum has not been assigned to an area.\n\r", a1);
}
}
else
{
result = send_to_char("MPEdit : That vnum does not exist.\n\r", a1);
}
}
else if ( !(unsigned __int8)_strcmp(v9, "create", "olc_mpcode.c", "do_mpedit", 135LL) )
{
if ( v2 && *v2 )
result = func0(a1, v2);
else
result = send_to_char("Syntax : mpedit create [vnum]\n\r", a1);
}
else
{
send_to_char("Syntax : mpedit [vnum]\n\r", a1);
result = send_to_char(" mpedit create [vnum]\n\r", a1);
}
return result;
}

original_code:
void do_mpedit(CHAR_DATA *ch, char *argument)
{
    MPROG_CODE *pMcode;
    char command[256];
    argument = one_argument(argument, command);
    if( is_number(command) )
    {
 int vnum = atoi(command);
 AREA_DATA *ad;
 if ( (pMcode = get_mprog_index(vnum)) == ((void *)0) )
 {
  send_to_char("MPEdit : That vnum does not exist.\n\r",ch);
  return;
 }
 ad = get_vnum_area(vnum);
 if ( ad == ((void *)0) )
 {
  send_to_char( "MPEdit : That vnum has not been assigned to an area.\n\r", ch );
  return;
 }
 if ( !( !((((ch)->act) & ((1)))) && !( ch->desc && ch->desc->original ) && ( ch->pcdata->security >= ad->security || strstr( ad->builders, ch->name ) || strstr( ad->builders, "All" ) ) ) )
 {
  send_to_char("MPEdit : You do not have access to that area.\n\r", ch );
  return;
 }
 ch->desc->pEdit = (void *)pMcode;
 ch->desc->editor = 5;
 return;
    }
    if ( !__strcmp(command, "create", "olc_mpcode.c", __FUNCTION__, 135) )
    {
 if (((argument) == ((void *)0) || (argument)[0] == '\0'))
 {
  send_to_char( "Syntax : mpedit create [vnum]\n\r", ch );
  return;
 }
 mpedit_create(ch, argument);
 return;
    }
    send_to_char( "Syntax :   mpedit [vnum]\n\r", ch );
    send_to_char( "           mpedit create [vnum]\n\r", ch );
    return;
}

canonical_original_code:
void do_mpedit(struct char_data *ch, char *argument)
{
    struct mprog_code *pMcode;
    char command[256];
    argument = one_argument(argument, command);
    if( is_number(command) )
    {
 int vnum = atoi(command);
 struct area_data *ad;
 if ( (pMcode = get_mprog_index(vnum)) == ((void *)0) )
 {
  send_to_char("MPEdit : That vnum does not exist.\n\r",ch);
  return;
 }
 ad = get_vnum_area(vnum);
 if ( ad == ((void *)0) )
 {
  send_to_char( "MPEdit : That vnum has not been assigned to an area.\n\r", ch );
  return;
 }
 if ( !( !((((ch)->act) & ((1)))) && !( ch->desc && ch->desc->original ) && ( ch->pcdata->security >= ad->security || strstr( ad->builders, ch->name ) || strstr( ad->builders, "All" ) ) ) )
 {
  send_to_char("MPEdit : You do not have access to that area.\n\r", ch );
  return;
 }
 ch->desc->pEdit = (void *)pMcode;
 ch->desc->editor = 5;
 return;
    }
    if ( !__strcmp(command, "create", "olc_mpcode.c", __FUNCTION__, 135) )
    {
 if (((argument) == ((void *)0) || (argument)[0] == '\0'))
 {
  send_to_char( "Syntax : mpedit create [vnum]\n\r", ch );
  return;
 }
 mpedit_create(ch, argument);
 return;
    }
    send_to_char( "Syntax :   mpedit [vnum]\n\r", ch );
    send_to_char( "           mpedit create [vnum]\n\r", ch );
    return;
}

variable_types: vnum int

user_defined_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data *pIndexData; struct descriptor_data *desc; struct affect_data *affected; struct note_data *pnote; struct obj_data *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data *pcdata; struct gen_data *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; }

user_defined_types: struct mprog_code { short vnum; char *code; struct mprog_code *next; }

user_defined_types: struct area_data { struct area_data *next; struct help_area_data *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; }

user_defined_types: struct help_area_data { struct help_area_data *next; struct help_data *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; }

user_defined_types: struct protocol_t { int WriteOOB; enum bool_t Negotiated[-1]; enum bool_t bIACMode; enum bool_t bNegotiated; enum bool_t bRenegotiate; enum bool_t bNeedMXPVersion; enum bool_t bBlockMXP; enum bool_t bTTYPE; enum bool_t bECHO; enum bool_t bNAWS; enum bool_t bCHARSET; enum bool_t bMSDP; enum bool_t bMSSP; enum bool_t bATCP; enum bool_t bMSP; enum bool_t bMXP; enum bool_t bMCCP; enum support_t b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t **pVariables; }

user_defined_types: struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data *exit[6]; struct reset_data *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; }

user_defined_types: struct MSDP_t { enum bool_t bReport; enum bool_t bDirty; int ValueInt; char *pValueString; }

user_defined_types: struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; }


original_code:
void substitute_alias(DESCRIPTOR_DATA *d, char *argument)
{
 CHAR_DATA *ch;
 char buf[4608]={'\0'};
 char prefix[256]={'\0'};
 char name[256]={'\0'};
 char *point;
 int alias = 0;
 ch = d->original ? d->original : d->character;
 if (!((ch->prefix) == ((void *)0) || (ch->prefix)[0] == '\0') && str_prefix("prefix",argument))
 {
  if (strlen(ch->prefix) + strlen(argument) > 256)
   send_to_char("Line to long, prefix not processed.\r\n",ch);
  else
  {
   sprintf(prefix,"%s %s",ch->prefix,argument);
   argument = prefix;
  }
 }
 if (((((ch)->act) & ((1)))) || ch->pcdata->alias[0] == ((void *)0)
  || !str_prefix("alias",argument) || !str_prefix("una",argument)
  || !str_prefix("prefix",argument))
 {
  interpret(d->character,argument);
  return;
 }
 strcpy(buf,argument);
 for (alias = 0; alias < 5; alias++)
 {
  if (ch->pcdata->alias[alias] == ((void *)0))
   break;
  if (!str_prefix(ch->pcdata->alias[alias],argument))
  {
   point = one_argument(argument,name);
   if (!strcmp(ch->pcdata->alias[alias],name))
   {
    buf[0] = '\0';
    strcat(buf,ch->pcdata->alias_sub[alias]);
    strcat(buf," ");
    strcat(buf,point);
    if (strlen(buf) > 256 - 1)
    {
     send_to_char(
      "Alias substitution too long. Truncated.\r\n",ch);
     buf[256 -1] = '\0';
    }
    break;
   }
  }
 }
 interpret(d->character,buf);
}

canonical_original_code:
void substitute_alias(struct descriptor_data *d, char *argument)
{
 struct char_data *ch;
 char buf[4608] = {'\0'};
 char prefix[256] = {'\0'};
 char name[256] = {'\0'};
 char *point;
 int alias = 0;
 ch = d->original ? d->original : d->character;
 if (!((ch->prefix) == ((void *)0) || (ch->prefix)[0] == '\0') && str_prefix("prefix",argument))
 {
  if (strlen(ch->prefix) + strlen(argument) > 256)
   send_to_char("Line to long, prefix not processed.\r\n",ch);
  else
  {
   sprintf(prefix,"%s %s",ch->prefix,argument);
   argument = prefix;
  }
 }
 if (((((ch)->act) & ((1)))) || ch->pcdata->alias[0] == ((void *)0)
  || !str_prefix("alias",argument) || !str_prefix("una",argument)
  || !str_prefix("prefix",argument))
 {
  interpret(d->character,argument);
  return;
 }
 strcpy(buf,argument);
 for (alias = 0; alias < 5; alias++)
 {
  if (ch->pcdata->alias[alias] == ((void *)0))
   break;
  if (!str_prefix(ch->pcdata->alias[alias],argument))
  {
   point = one_argument(argument,name);
   if (!strcmp(ch->pcdata->alias[alias],name))
   {
    buf[0] = '\0';
    strcat(buf,ch->pcdata->alias_sub[alias]);
    strcat(buf," ");
    strcat(buf,point);
    if (strlen(buf) > 256 - 1)
    {
     send_to_char(
      "Alias substitution too long. Truncated.\r\n",ch);
     buf[256 -1] = '\0';
    }
    break;
   }
  }
 }
 interpret(d->character,buf);
}

variable_types: struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; } *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; } *pShop; struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; } *mprogs; struct area_data { struct area_data *next; struct help_area_data { struct help_area_data *next; struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; } *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; } *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; } *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; } *pIndexData; struct descriptor_data *desc; struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; } *affected; struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; } *pnote; struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; } *extra_descr; struct affect_data *affected; struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; } *pIndexData; struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; } *exit[6]; struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; } *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; } *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; } *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data { struct pc_data *next; struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; } *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; } *pcdata; struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; } *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; } *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t { int WriteOOB; enum bool_t { false=0, true=1 } Negotiated[-1]; enum bool_t { false=0, true=1 } bIACMode; enum bool_t { false=0, true=1 } bNegotiated; enum bool_t { false=0, true=1 } bRenegotiate; enum bool_t { false=0, true=1 } bNeedMXPVersion; enum bool_t { false=0, true=1 } bBlockMXP; enum bool_t { false=0, true=1 } bTTYPE; enum bool_t { false=0, true=1 } bECHO; enum bool_t { false=0, true=1 } bNAWS; enum bool_t { false=0, true=1 } bCHARSET; enum bool_t { false=0, true=1 } bMSDP; enum bool_t { false=0, true=1 } bMSSP; enum bool_t { false=0, true=1 } bATCP; enum bool_t { false=0, true=1 } bMSP; enum bool_t { false=0, true=1 } bMXP; enum bool_t { false=0, true=1 } bMCCP; enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 } b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t { enum bool_t { false=0, true=1 } bReport; enum bool_t { false=0, true=1 } bDirty; int ValueInt; char *pValueString; } **pVariables; } *pProtocol; } *

variable_types:
prefix
char [256]

variable_types:
name
char [256]

variable_types:
point
char *

variable_types: alias int


decompiled_code:
__int64 __fastcall do_alia(__int64 a1)
{
return send_to_char("I'm sorry, alias must be entered in full.\n\r", a1);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
return send_to_char("I'm sorry, alias must be entered in full.\n\r", a1);
}

original_code:
void do_alia(CHAR_DATA *ch, char *argument)
{
 send_to_char("I'm sorry, alias must be entered in full.\n\r",ch);
 return;
}

canonical_original_code:
void do_alia(struct char_data *ch, char *argument)
{
 send_to_char("I'm sorry, alias must be entered in full.\n\r",ch);
 return;
}

variable_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; } *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; } *pShop; struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; } *mprogs; struct area_data { struct area_data *next; struct help_area_data { struct help_area_data *next; struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; } *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; } *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; } *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; } *pIndexData; struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t { int WriteOOB; enum bool_t { false=0, true=1 } Negotiated[-1]; enum bool_t { false=0, true=1 } bIACMode; enum bool_t { false=0, true=1 } bNegotiated; enum bool_t { false=0, true=1 } bRenegotiate; enum bool_t { false=0, true=1 } bNeedMXPVersion; enum bool_t { false=0, true=1 } bBlockMXP; enum bool_t { false=0, true=1 } bTTYPE; enum bool_t { false=0, true=1 } bECHO; enum bool_t { false=0, true=1 } bNAWS; enum bool_t { false=0, true=1 } bCHARSET; enum bool_t { false=0, true=1 } bMSDP; enum bool_t { false=0, true=1 } bMSSP; enum bool_t { false=0, true=1 } bATCP; enum bool_t { false=0, true=1 } bMSP; enum bool_t { false=0, true=1 } bMXP; enum bool_t { false=0, true=1 } bMCCP; enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 } b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t { enum bool_t { false=0, true=1 } bReport; enum bool_t { false=0, true=1 } bDirty; int ValueInt; char *pValueString; } **pVariables; } *pProtocol; } *desc; struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; } *affected; struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; } *pnote; struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; } *extra_descr; struct affect_data *affected; struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; } *pIndexData; struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; } *exit[6]; struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; } *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; } *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; } *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data { struct pc_data *next; struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; } *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; } *pcdata; struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; } *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; } *

variable_types:
argument
char *


original_code:
void do_alias(CHAR_DATA *ch, char *argument)
{
 CHAR_DATA *rch;
 char arg[256]={'\0'};
 int pos = 0;
 smash_tilde(argument);
 if (ch->desc == ((void *)0))
  rch = ch;
 else
  rch = ch->desc->original ? ch->desc->original : ch;
 if (((((rch)->act) & ((1)))))
  return;
 argument = one_argument(argument,arg);
 if (((arg) == ((void *)0) || (arg)[0] == '\0'))
 {
  if (rch->pcdata->alias[0] == ((void *)0))
  {
   send_to_char("You have no aliases defined.\n\r",ch);
   return;
  }
  send_to_char("Your current aliases are:\n\r",ch);
  for (pos = 0; pos < 5; pos++)
  {
   if (rch->pcdata->alias[pos] == ((void *)0)
    || rch->pcdata->alias_sub[pos] == ((void *)0))
    break;
   send_to_char( Format("    %s:  %s\n\r",rch->pcdata->alias[pos], rch->pcdata->alias_sub[pos]), ch);
  }
  return;
 }
 if (!str_prefix("una",arg) || !__strcmp("alias", arg, "alias.c", __FUNCTION__, 146))
 {
  send_to_char("Sorry, that word is reserved.\n\r",ch);
  return;
 }
 if (((argument) == ((void *)0) || (argument)[0] == '\0') )
 {
  for (pos = 0; pos < 5; pos++)
  {
   if (rch->pcdata->alias[pos] == ((void *)0)
    || rch->pcdata->alias_sub[pos] == ((void *)0))
    break;
   if (!__strcmp(arg, rch->pcdata->alias[pos], "alias.c", __FUNCTION__, 160))
   {
    send_to_char( Format("%s aliases to '%s'.\n\r",rch->pcdata->alias[pos], rch->pcdata->alias_sub[pos]), ch);
    return;
   }
  }
  send_to_char("That alias is not defined.\n\r",ch);
  return;
 }
 if (!str_prefix(argument,"delete") || !str_prefix(argument,"prefix"))
 {
  send_to_char("That shall not be done!\n\r",ch);
  return;
 }
 for (pos = 0; pos < 5; pos++)
 {
  if (rch->pcdata->alias[pos] == ((void *)0))
   break;
 if (!__strcmp(arg, rch->pcdata->alias[pos], "alias.c", __FUNCTION__, 182))
  {
   do { if(rch->pcdata->alias_sub[pos]) { free((void *)rch->pcdata->alias_sub[pos]); } else { if(logFail) { log_string((char *)Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "alias.c", __FUNCTION__, 184)); } } rch->pcdata->alias_sub[pos] = ((void *)0); } while(0);
   rch->pcdata->alias_sub[pos] = _str_dup(argument, "alias.c", __FUNCTION__, 185);
   send_to_char( Format("%s is now realiased to '%s'.\n\r",arg,argument), ch);
   return;
  }
 }
 if (pos >= 5)
 {
  send_to_char("Sorry, you have reached the alias limit.\n\r",ch);
  return;
 }
 rch->pcdata->alias[pos] = _str_dup(arg, "alias.c", __FUNCTION__, 198);
 rch->pcdata->alias_sub[pos] = _str_dup(argument, "alias.c", __FUNCTION__, 199);
 send_to_char( Format("%s is now aliased to '%s'.\n\r",arg,argument), ch);
}

canonical_original_code:
void do_alias(struct char_data *ch, char *argument)
{
 struct char_data *rch;
 char arg[256] = {'\0'};
 int pos = 0;
 smash_tilde(argument);
 if (ch->desc == ((void *)0))
  rch = ch;
 else
  rch = ch->desc->original ? ch->desc->original : ch;
 if (((((rch)->act) & ((1)))))
  return;
 argument = one_argument(argument,arg);
 if (((arg) == ((void *)0) || (arg)[0] == '\0'))
 {
  if (rch->pcdata->alias[0] == ((void *)0))
  {
   send_to_char("You have no aliases defined.\n\r",ch);
   return;
  }
  send_to_char("Your current aliases are:\n\r",ch);
  for (pos = 0; pos < 5; pos++)
  {
   if (rch->pcdata->alias[pos] == ((void *)0)
    || rch->pcdata->alias_sub[pos] == ((void *)0))
    break;
   send_to_char( Format("    %s:  %s\n\r",rch->pcdata->alias[pos], rch->pcdata->alias_sub[pos]), ch);
  }
  return;
 }
 if (!str_prefix("una",arg) || !__strcmp("alias", arg, "alias.c", __FUNCTION__, 146))
 {
  send_to_char("Sorry, that word is reserved.\n\r",ch);
  return;
 }
 if (((argument) == ((void *)0) || (argument)[0] == '\0') )
 {
  for (pos = 0; pos < 5; pos++)
  {
   if (rch->pcdata->alias[pos] == ((void *)0)
    || rch->pcdata->alias_sub[pos] == ((void *)0))
    break;
   if (!__strcmp(arg, rch->pcdata->alias[pos], "alias.c", __FUNCTION__, 160))
   {
    send_to_char( Format("%s aliases to '%s'.\n\r",rch->pcdata->alias[pos], rch->pcdata->alias_sub[pos]), ch);
    return;
   }
  }
  send_to_char("That alias is not defined.\n\r",ch);
  return;
 }
 if (!str_prefix(argument,"delete") || !str_prefix(argument,"prefix"))
 {
  send_to_char("That shall not be done!\n\r",ch);
  return;
 }
 for (pos = 0; pos < 5; pos++)
 {
  if (rch->pcdata->alias[pos] == ((void *)0))
   break;
 if (!__strcmp(arg, rch->pcdata->alias[pos], "alias.c", __FUNCTION__, 182))
  {
   do { if(rch->pcdata->alias_sub[pos]) { free((void *)rch->pcdata->alias_sub[pos]); } else { if(logFail) { log_string((char *)Format("clear_free_lists: unable to purge_data as it was NULL from: %s %s %d", "alias.c", __FUNCTION__, 184)); } } rch->pcdata->alias_sub[pos] = ((void *)0); } while(0);
   rch->pcdata->alias_sub[pos] = _str_dup(argument, "alias.c", __FUNCTION__, 185);
   send_to_char( Format("%s is now realiased to '%s'.\n\r",arg,argument), ch);
   return;
  }
 }
 if (pos >= 5)
 {
  send_to_char("Sorry, you have reached the alias limit.\n\r",ch);
  return;
 }
 rch->pcdata->alias[pos] = _str_dup(arg, "alias.c", __FUNCTION__, 198);
 rch->pcdata->alias_sub[pos] = _str_dup(argument, "alias.c", __FUNCTION__, 199);
 send_to_char( Format("%s is now aliased to '%s'.\n\r",arg,argument), ch);
}

variable_types: pos int

user_defined_types: struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; }

user_defined_types: struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; }

user_defined_types: struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; }

user_defined_types: struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; }

user_defined_types: struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; }

user_defined_types: struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; }

user_defined_types: struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; }

user_defined_types: struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; }


decompiled_code:
__int64 __fastcall check_ban(__int64 a1, int a2)
{
const char *v2; // rax
char v3; // al
__int64 v4; // rbx
__int16 v6; // bp
__int64 v7[2]; // [rsp+0h] [rbp-1218h] BYREF
char v8[4592]; // [rsp+10h] [rbp-1208h] BYREF

v7[0] = 0LL;
v7[1] = 0LL;
memset(v8, 0, sizeof(v8));
v2 = (const char *)capitalize(a1);
strcpy((char *)v7, v2);
v3 = v7[0];
if ( (unsigned __int8)(LOBYTE(v7[0]) - 65) < 0x1Au )
v3 = LOBYTE(v7[0]) + 32;
LOBYTE(v7[0]) = v3;
v4 = ban_list;
if ( !ban_list )
return 0LL;
do
{
v6 = *(_WORD *)(v4 + 10);
if ( (a2 & v6) != 0 )
{
if ( (*(_WORD *)(v4 + 10) & 3) == 3 && strstr(*(const char **)(v4 + 16), (const char *)v7) )
return 1LL;
if ( (v6 & 2) != 0 && !(unsigned __int8)str_suffix(*(_QWORD *)(v4 + 16), v7) )
return 1LL;
if ( (*(_BYTE *)(v4 + 10) & 1) != 0 && !(unsigned __int8)str_prefix(*(_QWORD *)(v4 + 16), v7) )
return 1LL;
}
v4 = *(_QWORD *)v4;
}
while ( v4 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, int a2)
{
const char *v2; // rax
char v3; // al
__int64 v4; // rbx
__int16 v6; // bp
__int64 v7[2]; // [rsp+0h] [rbp-1218h] BYREF
char v8[4592]; // [rsp+10h] [rbp-1208h] BYREF

v7[0] = 0LL;
v7[1] = 0LL;
memset(v8, 0, sizeof(v8));
v2 = (const char *)capitalize(a1);
strcpy((char *)v7, v2);
v3 = v7[0];
if ( (unsigned __int8)(LOBYTE(v7[0]) - 65) < 0x1Au )
v3 = LOBYTE(v7[0]) + 32;
LOBYTE(v7[0]) = v3;
v4 = ban_list;
if ( !ban_list )
return 0LL;
do
{
v6 = *(_WORD *)(v4 + 10);
if ( (a2 & v6) != 0 )
{
if ( (*(_WORD *)(v4 + 10) & 3) == 3 && strstr(*(const char **)(v4 + 16), (const char *)v7) )
return 1LL;
if ( (v6 & 2) != 0 && !(unsigned __int8)str_suffix(*(_QWORD *)(v4 + 16), v7) )
return 1LL;
if ( (*(_BYTE *)(v4 + 10) & 1) != 0 && !(unsigned __int8)str_prefix(*(_QWORD *)(v4 + 16), v7) )
return 1LL;
}
v4 = *(_QWORD *)v4;
}
while ( v4 );
return 0LL;
}

original_code:
bool check_ban(char *site,int type)
{
 BAN_DATA *pban;
 char host[4608]={'\0'};
 strcpy(host,capitalize(site));
 host[0] = ((host[0]) >= 'A' && (host[0]) <= 'Z' ? (host[0])+'a'-'A' : (host[0]));
 for ( pban = ban_list; pban != ((void *)0); pban = pban->next )
 {
 if(!((pban->ban_flags) & (type)))
  continue;
 if (((pban->ban_flags) & (2))
 && ((pban->ban_flags) & (1))
 && strstr(pban->name,host) != ((void *)0))
  return 1;
 if (((pban->ban_flags) & (2))
 && !str_suffix(pban->name,host))
  return 1;
 if (((pban->ban_flags) & (1))
 && !str_prefix(pban->name,host))
  return 1;
 }
 return 0;
}

canonical_original_code:
unsigned char check_ban(char *site, int type)
{
 struct ban_data *pban;
 char host[4608] = {'\0'};
 strcpy(host,capitalize(site));
 host[0] = ((host[0]) >= 'A' && (host[0]) <= 'Z' ? (host[0])+'a'-'A' : (host[0]));
 for ( pban = ban_list; pban != ((void *)0); pban = pban->next )
 {
 if(!((pban->ban_flags) & (type)))
  continue;
 if (((pban->ban_flags) & (2))
 && ((pban->ban_flags) & (1))
 && strstr(pban->name,host) != ((void *)0))
  return 1;
 if (((pban->ban_flags) & (2))
 && !str_suffix(pban->name,host))
  return 1;
 if (((pban->ban_flags) & (1))
 && !str_prefix(pban->name,host))
  return 1;
 }
 return 0;
}

variable_types:
site
char *

variable_types: type int

variable_types: struct ban_data { struct ban_data *next; unsigned char valid; short ban_flags; short level; char *name; } *

variable_types:
host
char [4608]


original_code:
void ban_site(CHAR_DATA *ch, char *argument, bool fPerm)
{
 char buf[4608]={'\0'};
 char buf2[4608]={'\0'};
 char arg1[256]={'\0'};
 char arg2[256]={'\0'};
 char *name;
 BUFFER *buffer;
 BAN_DATA *pban, *prev;
 bool prefix = 0,suffix = 0;
 int type;
 argument = one_argument(argument,arg1);
 argument = one_argument(argument,arg2);
 if ( arg1[0] == '\0' )
 {
  if (ban_list == ((void *)0))
  {
   send_to_char("No sites banned at this time.\n\r",ch);
   return;
  }
  buffer = __new_buf("ban.c", __FUNCTION__, 157);
  add_buf(buffer,"Banned sites  level  type     status\n\r");
  for (pban = ban_list;pban != ((void *)0);pban = pban->next)
  {
   sprintf(buf2,"%s%s%s",
    ((pban->ban_flags) & (2)) ? "*" : "",
    pban->name,
    ((pban->ban_flags) & (1)) ? "*" : "");
   sprintf(buf,"%-12s    %-3d  %-7s  %s\n\r",
    buf2, pban->level,
    ((pban->ban_flags) & (4)) ? "newbies" :
    ((pban->ban_flags) & (16)) ? "permit" :
    ((pban->ban_flags) & (8)) ? "all" : "",
    ((pban->ban_flags) & (32)) ? "perm" : "temp");
   add_buf(buffer,buf);
  }
  page_to_char( buf_string(buffer), ch );
  free_buf(buffer);
  return;
 }
 if (arg2[0] == '\0' || !str_prefix(arg2,"all"))
  type = 8;
 else if (!str_prefix(arg2,"newbies"))
  type = 4;
 else if (!str_prefix(arg2,"permit"))
  type = 16;
 else
 {
  send_to_char("Acceptable ban types are all, newbies, and permit.\n\r", ch);
  return;
 }
 name = arg1;
 if (name[0] == '*')
 {
  prefix = 1;
  name++;
 }
 if (name[strlen(name) - 1] == '*')
 {
  suffix = 1;
  name[strlen(name) - 1] = '\0';
 }
 if (strlen(name) == 0)
 {
  send_to_char("You have to ban SOMETHING.\n\r",ch);
  return;
 }
 prev = ((void *)0);
 for ( pban = ban_list; pban != ((void *)0); prev = pban, pban = pban->next )
 {
  if (!__strcmp(name, pban->name, "ban.c", __FUNCTION__, 216))
  {
   if (pban->level > get_trust(ch))
   {
    send_to_char( "That ban was set by a higher power.\n\r", ch );
    return;
   }
   else
   {
    if (prev == ((void *)0))
     ban_list = pban->next;
    else
     prev->next = pban->next;
    free_ban(pban);
   }
  }
 }
 pban = new_ban();
 pban->name = _str_dup(name, "ban.c", __FUNCTION__, 235);
 pban->level = get_trust(ch);
 pban->ban_flags = type;
 if (prefix)
  ((pban->ban_flags) |= (2));
 if (suffix)
  ((pban->ban_flags) |= (1));
 if (fPerm)
  ((pban->ban_flags) |= (32));
 pban->next = ban_list;
 ban_list = pban;
 save_bans();
 send_to_char( Format("%s has been banned.\n\r",pban->name), ch );
 return;
}

canonical_original_code:
void ban_site(struct char_data *ch, char *argument, unsigned char fPerm)
{
 char buf[4608] = {'\0'};
 char buf2[4608] = {'\0'};
 char arg1[256] = {'\0'};
 char arg2[256] = {'\0'};
 char *name;
 struct buf_type *buffer;
 struct ban_data *pban; struct ban_data *prev;
 unsigned char prefix = 0; unsigned char suffix = 0;
 int type;
 argument = one_argument(argument,arg1);
 argument = one_argument(argument,arg2);
 if ( arg1[0] == '\0' )
 {
  if (ban_list == ((void *)0))
  {
   send_to_char("No sites banned at this time.\n\r",ch);
   return;
  }
  buffer = __new_buf("ban.c", __FUNCTION__, 157);
  add_buf(buffer,"Banned sites  level  type     status\n\r");
  for (pban = ban_list;pban != ((void *)0);pban = pban->next)
  {
   sprintf(buf2,"%s%s%s",
    ((pban->ban_flags) & (2)) ? "*" : "",
    pban->name,
    ((pban->ban_flags) & (1)) ? "*" : "");
   sprintf(buf,"%-12s    %-3d  %-7s  %s\n\r",
    buf2, pban->level,
    ((pban->ban_flags) & (4)) ? "newbies" :
    ((pban->ban_flags) & (16)) ? "permit" :
    ((pban->ban_flags) & (8)) ? "all" : "",
    ((pban->ban_flags) & (32)) ? "perm" : "temp");
   add_buf(buffer,buf);
  }
  page_to_char( buf_string(buffer), ch );
  free_buf(buffer);
  return;
 }
 if (arg2[0] == '\0' || !str_prefix(arg2,"all"))
  type = 8;
 else if (!str_prefix(arg2,"newbies"))
  type = 4;
 else if (!str_prefix(arg2,"permit"))
  type = 16;
 else
 {
  send_to_char("Acceptable ban types are all, newbies, and permit.\n\r", ch);
  return;
 }
 name = arg1;
 if (name[0] == '*')
 {
  prefix = 1;
  name++;
 }
 if (name[strlen(name) - 1] == '*')
 {
  suffix = 1;
  name[strlen(name) - 1] = '\0';
 }
 if (strlen(name) == 0)
 {
  send_to_char("You have to ban SOMETHING.\n\r",ch);
  return;
 }
 prev = ((void *)0);
 for ( pban = ban_list; pban != ((void *)0); prev = pban, pban = pban->next )
 {
  if (!__strcmp(name, pban->name, "ban.c", __FUNCTION__, 216))
  {
   if (pban->level > get_trust(ch))
   {
    send_to_char( "That ban was set by a higher power.\n\r", ch );
    return;
   }
   else
   {
    if (prev == ((void *)0))
     ban_list = pban->next;
    else
     prev->next = pban->next;
    free_ban(pban);
   }
  }
 }
 pban = new_ban();
 pban->name = _str_dup(name, "ban.c", __FUNCTION__, 235);
 pban->level = get_trust(ch);
 pban->ban_flags = type;
 if (prefix)
  ((pban->ban_flags) |= (2));
 if (suffix)
  ((pban->ban_flags) |= (1));
 if (fPerm)
  ((pban->ban_flags) |= (32));
 pban->next = ban_list;
 ban_list = pban;
 save_bans();
 send_to_char( Format("%s has been banned.\n\r",pban->name), ch );
 return;
}

variable_types:
fPerm
unsigned char

variable_types:
buf
char [4608]

variable_types:
name
char *

variable_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; } *

variable_types:
prefix
unsigned char

variable_types:
suffix
unsigned char

user_defined_types: struct ban_data { struct ban_data *next; unsigned char valid; short ban_flags; short level; char *name; }

user_defined_types: struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data *pShop; struct mprog_list *mprogs; struct area_data *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; }

user_defined_types: struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t *pProtocol; }

user_defined_types: struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data *extra_descr; struct affect_data *affected; struct obj_index_data *pIndexData; struct room_index_data *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; }

user_defined_types: struct pc_data { struct pc_data *next; struct buf_type *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; }

user_defined_types: enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 }

user_defined_types: struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }

user_defined_types: struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; }


decompiled_code:
__int64 __fastcall do_ban(__int64 a1, __int64 a2)
{
return ban_site(a1, a2, 0);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
return func3(a1, a2, 0);
}

original_code:
void do_ban(CHAR_DATA *ch, char *argument)
{
 ban_site(ch,argument,0);
}

canonical_original_code:
void do_ban(struct char_data *ch, char *argument)
{
 ban_site(ch,argument,0);
}

user_defined_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data *pIndexData; struct descriptor_data *desc; struct affect_data *affected; struct note_data *pnote; struct obj_data *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data *pcdata; struct gen_data *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; }

user_defined_types: struct area_data { struct area_data *next; struct help_area_data *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; }

user_defined_types: struct protocol_t { int WriteOOB; enum bool_t Negotiated[-1]; enum bool_t bIACMode; enum bool_t bNegotiated; enum bool_t bRenegotiate; enum bool_t bNeedMXPVersion; enum bool_t bBlockMXP; enum bool_t bTTYPE; enum bool_t bECHO; enum bool_t bNAWS; enum bool_t bCHARSET; enum bool_t bMSDP; enum bool_t bMSSP; enum bool_t bATCP; enum bool_t bMSP; enum bool_t bMXP; enum bool_t bMCCP; enum support_t b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t **pVariables; }

user_defined_types: struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data *exit[6]; struct reset_data *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; }

user_defined_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; }

user_defined_types: struct help_area_data { struct help_area_data *next; struct help_data *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; }

user_defined_types: struct MSDP_t { enum bool_t bReport; enum bool_t bDirty; int ValueInt; char *pValueString; }

user_defined_types: struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; }


decompiled_code:
__int64 __fastcall do_permban(__int64 a1, __int64 a2)
{
return ban_site(a1, a2, 1);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2)
{
return func3(a1, a2, 1);
}

original_code:
void do_permban(CHAR_DATA *ch, char *argument)
{
 ban_site(ch,argument,1);
}

canonical_original_code:
void do_permban(struct char_data *ch, char *argument)
{
 ban_site(ch,argument,1);
}

user_defined_types: struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; }

user_defined_types: struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; }

user_defined_types: struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; }

user_defined_types: struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; }

user_defined_types: struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; }

user_defined_types: struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; }

user_defined_types: struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; }

user_defined_types: struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; }


decompiled_code:
int __fastcall do_allow(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
_QWORD *v3; // rbp
int v5; // er13
__int64 v6; // rax
__int64 v7[37]; // [rsp+0h] [rbp-128h] BYREF

v7[0] = 0LL;
v7[1] = 0LL;
v7[2] = 0LL;
v7[3] = 0LL;
v7[4] = 0LL;
v7[5] = 0LL;
v7[6] = 0LL;
v7[7] = 0LL;
v7[8] = 0LL;
v7[9] = 0LL;
v7[10] = 0LL;
v7[11] = 0LL;
v7[12] = 0LL;
v7[13] = 0LL;
v7[14] = 0LL;
v7[15] = 0LL;
v7[16] = 0LL;
v7[17] = 0LL;
v7[18] = 0LL;
v7[19] = 0LL;
v7[20] = 0LL;
v7[21] = 0LL;
v7[22] = 0LL;
v7[23] = 0LL;
v7[24] = 0LL;
v7[25] = 0LL;
v7[26] = 0LL;
v7[27] = 0LL;
v7[28] = 0LL;
v7[29] = 0LL;
v7[30] = 0LL;
v7[31] = 0LL;
one_argument(a2, v7);
if ( !LOBYTE(v7[0]) )
return send_to_char("Remove which site from the ban list?\n\r", a1);
v2 = ban_list;
if ( !ban_list )
return send_to_char("Site is not banned.\n\r", a1);
v3 = 0LL;
while ( (unsigned __int8)_strcmp(v7, *(_QWORD *)(v2 + 16), "ban.c", "do_allow", 282LL) )
{
v3 = (_QWORD *)v2;
if ( !*(_QWORD *)v2 )
return send_to_char("Site is not banned.\n\r", a1);
v2 = *(_QWORD *)v2;
}
v5 = *(__int16 *)(v2 + 12);
if ( v5 > (int)get_trust(a1) )
return send_to_char("You are not powerful enough to lift that ban.\n\r", a1);
if ( v3 )
*v3 = *(_QWORD *)v2;
else
ban_list = *(_QWORD *)ban_list;
free_ban(v2);
v6 = Format("Ban on %s lifted.\n\r", (const char *)v7);
send_to_char(v6, a1);
return save_bans();
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
_QWORD *v3; // rbp
int v5; // er13
__int64 v6; // rax
__int64 v7[37]; // [rsp+0h] [rbp-128h] BYREF

v7[0] = 0LL;
v7[1] = 0LL;
v7[2] = 0LL;
v7[3] = 0LL;
v7[4] = 0LL;
v7[5] = 0LL;
v7[6] = 0LL;
v7[7] = 0LL;
v7[8] = 0LL;
v7[9] = 0LL;
v7[10] = 0LL;
v7[11] = 0LL;
v7[12] = 0LL;
v7[13] = 0LL;
v7[14] = 0LL;
v7[15] = 0LL;
v7[16] = 0LL;
v7[17] = 0LL;
v7[18] = 0LL;
v7[19] = 0LL;
v7[20] = 0LL;
v7[21] = 0LL;
v7[22] = 0LL;
v7[23] = 0LL;
v7[24] = 0LL;
v7[25] = 0LL;
v7[26] = 0LL;
v7[27] = 0LL;
v7[28] = 0LL;
v7[29] = 0LL;
v7[30] = 0LL;
v7[31] = 0LL;
one_argument(a2, v7);
if ( !LOBYTE(v7[0]) )
return send_to_char("Remove which site from the ban list?\n\r", a1);
v2 = ban_list;
if ( !ban_list )
return send_to_char("Site is not banned.\n\r", a1);
v3 = 0LL;
while ( (unsigned __int8)_strcmp(v7, *(_QWORD *)(v2 + 16), "ban.c", "do_allow", 282LL) )
{
v3 = (_QWORD *)v2;
if ( !*(_QWORD *)v2 )
return send_to_char("Site is not banned.\n\r", a1);
v2 = *(_QWORD *)v2;
}
v5 = *(__int16 *)(v2 + 12);
if ( v5 > (int)get_trust(a1) )
return send_to_char("You are not powerful enough to lift that ban.\n\r", a1);
if ( v3 )
*v3 = *(_QWORD *)v2;
else
ban_list = *(_QWORD *)ban_list;
free_ban(v2);
v6 = Format("Ban on %s lifted.\n\r", (const char *)v7);
send_to_char(v6, a1);
return func0();
}

original_code:
void do_allow( CHAR_DATA *ch, char *argument )
{
 char arg[256]={'\0'};
 BAN_DATA *prev;
 BAN_DATA *curr;
 one_argument( argument, arg );
 if ( arg[0] == '\0' )
 {
  send_to_char( "Remove which site from the ban list?\n\r", ch );
  return;
 }
 prev = ((void *)0);
 for ( curr = ban_list; curr != ((void *)0); prev = curr, curr = curr->next )
 {
  if ( !__strcmp(arg, curr->name, "ban.c", __FUNCTION__, 282) )
  {
   if (curr->level > get_trust(ch))
   {
    send_to_char( "You are not powerful enough to lift that ban.\n\r",ch);
    return;
   }
   if ( prev == ((void *)0) )
    ban_list = ban_list->next;
   else
    prev->next = curr->next;
   free_ban(curr);
   send_to_char( Format("Ban on %s lifted.\n\r",arg), ch );
   save_bans();
   return;
  }
 }
 send_to_char( "Site is not banned.\n\r", ch );
 return;
}

canonical_original_code:
void do_allow(struct char_data *ch, char *argument)
{
 char arg[256] = {'\0'};
 struct ban_data *prev;
 struct ban_data *curr;
 one_argument( argument, arg );
 if ( arg[0] == '\0' )
 {
  send_to_char( "Remove which site from the ban list?\n\r", ch );
  return;
 }
 prev = ((void *)0);
 for ( curr = ban_list; curr != ((void *)0); prev = curr, curr = curr->next )
 {
  if ( !__strcmp(arg, curr->name, "ban.c", __FUNCTION__, 282) )
  {
   if (curr->level > get_trust(ch))
   {
    send_to_char( "You are not powerful enough to lift that ban.\n\r",ch);
    return;
   }
   if ( prev == ((void *)0) )
    ban_list = ban_list->next;
   else
    prev->next = curr->next;
   free_ban(curr);
   send_to_char( Format("Ban on %s lifted.\n\r",arg), ch );
   save_bans();
   return;
  }
 }
 send_to_char( "Site is not banned.\n\r", ch );
 return;
}

variable_types:
arg
char [256]

user_defined_types: struct ban_data { struct ban_data *next; unsigned char valid; short ban_flags; short level; char *name; }

user_defined_types: struct mob_index_data { struct mob_index_data *next; unsigned char (*spec_fun)(struct char_data *ch); struct shop_data *pShop; struct mprog_list *mprogs; struct area_data *area; short vnum; short group; unsigned char new_format; short count; short killed; char *player_name; char *short_descr; char *long_descr; char *description; long act; long affected_by; short alignment; short level; short hitroll; short hit[3]; short mana[3]; short damage[3]; short ac[4]; short dam_type; long off_flags; long imm_flags; long res_flags; long vuln_flags; short start_pos; short default_pos; short sex; short race; long wealth; long form; long parts; short size; char *material; long mprog_flags; }

user_defined_types: struct descriptor_data { struct descriptor_data *next; struct descriptor_data *snoop_by; struct char_data *character; struct char_data *original; unsigned char valid; char *host; short descriptor; short connected; unsigned char fcommand; char inbuf[-1]; char incomm[256]; char inlast[256]; int repeat; char *outbuf; int outsize; int outtop; char *showstr_head; char *showstr_point; void *pEdit; char **pString; int editor; struct protocol_t *pProtocol; }

user_defined_types: struct obj_data { struct obj_data *next; struct obj_data *next_content; struct obj_data *contains; struct obj_data *in_obj; struct obj_data *on; struct char_data *carried_by; struct extra_descr_data *extra_descr; struct affect_data *affected; struct obj_index_data *pIndexData; struct room_index_data *in_room; unsigned char valid; unsigned char enchanted; char *owner; char *name; char *short_descr; char *description; short item_type; int extra_flags; int wear_flags; short wear_loc; short weight; int cost; short level; short condition; char *material; short timer; int value[5]; }

user_defined_types: struct pc_data { struct pc_data *next; struct buf_type *buffer; unsigned char valid; char *pwd; char *bamfin; char *bamfout; char *title; long last_note; long last_idea; long last_penalty; long last_news; long last_changes; short perm_hit; short perm_mana; short perm_move; short true_sex; int last_level; short condition[4]; short learned[151]; unsigned char group_known[30]; short points; unsigned char confirm_delete; char *alias[5]; char *alias_sub[5]; int security; }

user_defined_types: enum support_t { eUNKNOWN=0, eNO=1, eSOMETIMES=2, eYES=3 }

user_defined_types: struct reset_data { struct reset_data *next; char command; short arg1; short arg2; short arg3; short arg4; }

user_defined_types: struct help_data { struct help_data *next; struct help_data *next_area; short level; char *keyword; char *text; }


decompiled_code:
void __fastcall update_wizlist(__int64 a1, int a2)
{
_QWORD *v2; // rbx
_QWORD *v3; // rbp
__int64 v4; // rbx

if ( (*(_BYTE *)(a1 + 320) & 1) == 0 )
{
v2 = (_QWORD *)wiz_list;
if ( wiz_list )
{
v3 = 0LL;
while ( 1 )
{
if ( !(unsigned __int8)_strcmp(*(_QWORD *)(a1 + 176), v2[2], "wizlist.c", "update_wizlist", 313LL) )
{
if ( v3 )
*v3 = *v2;
else
wiz_list = *(_QWORD *)wiz_list;
free_wiz(v2);
save_wizlist();
}
v3 = v2;
if ( !*v2 )
break;
v2 = (_QWORD *)*v2;
}
}
if ( a2 > 51 )
{
v4 = new_wiz();
*(_QWORD *)(v4 + 16) = str_dup(*(_QWORD *)(a1 + 176), "wizlist.c", "update_wizlist", 329LL);
*(_WORD *)(v4 + 10) = a2;
*(_QWORD *)v4 = wiz_list;
wiz_list = v4;
save_wizlist();
}
}
}

canonical_decompiled_code:
void __fastcall func2(__int64 a1, int a2)
{
_QWORD *v2; // rbx
_QWORD *v3; // rbp
__int64 v4; // rbx

if ( (*(_BYTE *)(a1 + 320) & 1) == 0 )
{
v2 = (_QWORD *)wiz_list;
if ( wiz_list )
{
v3 = 0LL;
while ( 1 )
{
if ( !(unsigned __int8)_strcmp(*(_QWORD *)(a1 + 176), v2[2], "wizlist.c", "update_wizlist", 313LL) )
{
if ( v3 )
*v3 = *v2;
else
wiz_list = *(_QWORD *)wiz_list;
free_wiz(v2);
func0();
}
v3 = v2;
if ( !*v2 )
break;
v2 = (_QWORD *)*v2;
}
}
if ( a2 > 51 )
{
v4 = new_wiz();
*(_QWORD *)(v4 + 16) = str_dup(*(_QWORD *)(a1 + 176), "wizlist.c", "update_wizlist", 329LL);
*(_WORD *)(v4 + 10) = a2;
*(_QWORD *)v4 = wiz_list;
wiz_list = v4;
func0();
}
}
}

original_code:
void update_wizlist(CHAR_DATA *ch, int level)
{
 WIZ_DATA *prev;
 WIZ_DATA *curr;
 if (((((ch)->act) & ((1)))))
 {
  return;
 }
 prev = ((void *)0);
 for ( curr = wiz_list; curr != ((void *)0); prev = curr, curr = curr->next )
 {
  if ( !__strcmp(ch->name, curr->name, "wizlist.c", __FUNCTION__, 313) )
  {
   if ( prev == ((void *)0) )
    wiz_list = wiz_list->next;
   else
    prev->next = curr->next;
   free_wiz(curr);
   save_wizlist();
  }
 }
 if (level <= (60 - 9))
 {
  return;
 }
 curr = new_wiz();
 curr->name = _str_dup(ch->name, "wizlist.c", __FUNCTION__, 329);
 curr->level = level;
 curr->next = wiz_list;
 wiz_list = curr;
 save_wizlist();
 return;
}

canonical_original_code:
void update_wizlist(struct char_data *ch, int level)
{
 struct wiz_data *prev;
 struct wiz_data *curr;
 if (((((ch)->act) & ((1)))))
 {
  return;
 }
 prev = ((void *)0);
 for ( curr = wiz_list; curr != ((void *)0); prev = curr, curr = curr->next )
 {
  if ( !__strcmp(ch->name, curr->name, "wizlist.c", __FUNCTION__, 313) )
  {
   if ( prev == ((void *)0) )
    wiz_list = wiz_list->next;
   else
    prev->next = curr->next;
   free_wiz(curr);
   save_wizlist();
  }
 }
 if (level <= (60 - 9))
 {
  return;
 }
 curr = new_wiz();
 curr->name = _str_dup(ch->name, "wizlist.c", __FUNCTION__, 329);
 curr->level = level;
 curr->next = wiz_list;
 wiz_list = curr;
 save_wizlist();
 return;
}

variable_types: level int

variable_types: struct wiz_data { struct wiz_data *next; unsigned char valid; short level; char *name; } *

user_defined_types: struct char_data { struct char_data *next; struct char_data *next_in_room; struct char_data *master; struct char_data *leader; struct char_data *fighting; struct char_data *reply; struct char_data *pet; struct char_data *mprog_target; struct mem_data *memory; unsigned char (*spec_fun)(struct char_data *ch); struct mob_index_data *pIndexData; struct descriptor_data *desc; struct affect_data *affected; struct note_data *pnote; struct obj_data *carrying; struct obj_data *on; struct room_index_data *in_room; struct room_index_data *was_in_room; struct area_data *zone; struct pc_data *pcdata; struct gen_data *gen_data; unsigned char valid; char *name; long id; short version; char *short_descr; char *long_descr; char *description; char *prompt; char *prefix; short group; short clan; short sex; short iclass; short race; short level; short trust; int played; int lines; long logon; short timer; short wait; short daze; short hit; short max_hit; short mana; short max_mana; short move; short max_move; long gold; long silver; int exp; long act; long comm; long wiznet; long imm_flags; long res_flags; long vuln_flags; short invis_level; short incog_level; long affected_by; short position; short practice; short train; short carry_weight; short carry_number; short saving_throw; short alignment; short hitroll; short damroll; short armor[4]; short wimpy; short perm_stat[5]; short mod_stat[5]; long form; long parts; short size; char *material; long off_flags; short damage[3]; short dam_type; short start_pos; short default_pos; short mprog_delay; }

user_defined_types: struct area_data { struct area_data *next; struct help_area_data *helps; char *file_name; char *name; char *credits; short age; short nplayer; short low_range; short high_range; short min_vnum; short max_vnum; unsigned char empty; char *builders; int vnum; int area_flags; int security; }

user_defined_types: struct protocol_t { int WriteOOB; enum bool_t Negotiated[-1]; enum bool_t bIACMode; enum bool_t bNegotiated; enum bool_t bRenegotiate; enum bool_t bNeedMXPVersion; enum bool_t bBlockMXP; enum bool_t bTTYPE; enum bool_t bECHO; enum bool_t bNAWS; enum bool_t bCHARSET; enum bool_t bMSDP; enum bool_t bMSSP; enum bool_t bATCP; enum bool_t bMSP; enum bool_t bMXP; enum bool_t bMCCP; enum support_t b256Support; int ScreenWidth; int ScreenHeight; char *pMXPVersion; char *pLastTTYPE; struct MSDP_t **pVariables; }

user_defined_types: struct room_index_data { struct room_index_data *next; struct char_data *people; struct obj_data *contents; struct extra_descr_data *extra_descr; struct area_data *area; struct exit_data *exit[6]; struct reset_data *reset_first; struct reset_data *reset_last; char *name; char *description; char *owner; short vnum; int room_flags; short light; short sector_type; short heal_rate; short mana_rate; short clan; }

user_defined_types: struct buf_type { struct buf_type *next; unsigned char valid; short state; short size; char *string; char *file; char *function; int line; }

user_defined_types: struct help_area_data { struct help_area_data *next; struct help_data *first; struct help_data *last; struct area_data *area; char *filename; unsigned char changed; }

user_defined_types: struct MSDP_t { enum bool_t bReport; enum bool_t bDirty; int ValueInt; char *pValueString; }

user_defined_types: struct exit_data { union { struct room_index_data *to_room; short vnum; } u1; int exit_info; short key; char *keyword; char *description; struct exit_data *next; int rs_flags; int orig_door; }


original_code:
void change_wizlist(CHAR_DATA *ch, bool add, int level, char *argument)
{
 char arg[256]={'\0'};
 WIZ_DATA *curr;
 one_argument( argument, arg );
 if (arg[0] == '\0')
 {
  send_to_char( "Syntax:\n\r", ch );
  if ( !add )
   send_to_char( " wizlist delete <name>\n\r", ch );
  else
   send_to_char( " wizlist add <level> <name>\n\r", ch );
  return;
 }
 if ( add )
 {
  if ( ( level <= (60 - 9) ) || ( level > 60 ) )
  {
   send_to_char( "Syntax:\n\r", ch );
   send_to_char( " wizlist add <level> <name>\n\r", ch );
   return;
  }
 }
 if ( !add )
 {
  WIZ_DATA *prev;
  prev = ((void *)0);
  for ( curr = wiz_list; curr != ((void *)0); prev = curr, curr = curr->next )
  {
   if ( !__strcmp(capitalize( arg ), curr->name, "wizlist.c", __FUNCTION__, 367) )
   {
    if ( prev == ((void *)0) )
     wiz_list = wiz_list->next;
    else
     prev->next = curr->next;
    free_wiz(curr);
    save_wizlist();
   }
  }
 } else
 {
  curr = new_wiz();
  curr->name = _str_dup(capitalize( arg ), "wizlist.c", __FUNCTION__, 381);
  curr->level = level;
  curr->next = wiz_list;
  wiz_list = curr;
  save_wizlist();
 }
 return;
}

canonical_original_code:
void change_wizlist(struct char_data *ch, unsigned char add, int level, char *argument)
{
 char arg[256] = {'\0'};
 struct wiz_data *curr;
 one_argument( argument, arg );
 if (arg[0] == '\0')
 {
  send_to_char( "Syntax:\n\r", ch );
  if ( !add )
   send_to_char( " wizlist delete <name>\n\r", ch );
  else
   send_to_char( " wizlist add <level> <name>\n\r", ch );
  return;
 }
 if ( add )
 {
  if ( ( level <= (60 - 9) ) || ( level > 60 ) )
  {
   send_to_char( "Syntax:\n\r", ch );
   send_to_char( " wizlist add <level> <name>\n\r", ch );
   return;
  }
 }
 if ( !add )
 {
  struct wiz_data *prev;
  prev = ((void *)0);
  for ( curr = wiz_list; curr != ((void *)0); prev = curr, curr = curr->next )
  {
   if ( !__strcmp(capitalize( arg ), curr->name, "wizlist.c", __FUNCTION__, 367) )
   {
    if ( prev == ((void *)0) )
     wiz_list = wiz_list->next;
    else
     prev->next = curr->next;
    free_wiz(curr);
    save_wizlist();
   }
  }
 } else
 {
  curr = new_wiz();
  curr->name = _str_dup(capitalize( arg ), "wizlist.c", __FUNCTION__, 381);
  curr->level = level;
  curr->next = wiz_list;
  wiz_list = curr;
  save_wizlist();
 }
 return;
}

variable_types:
add
unsigned char

user_defined_types: struct wiz_data { struct wiz_data *next; unsigned char valid; short level; char *name; }

user_defined_types: struct mem_data { struct mem_data *next; unsigned char valid; int id; int reaction; long when; }

user_defined_types: struct affect_data { struct affect_data *next; unsigned char valid; short where; short type; short level; short duration; short location; short modifier; int bitvector; }

user_defined_types: struct note_data { struct note_data *next; unsigned char valid; short type; char *sender; char *date; char *to_list; char *subject; char *text; long date_stamp; }

user_defined_types: struct gen_data { struct gen_data *next; unsigned char valid; unsigned char skill_chosen[151]; unsigned char group_chosen[30]; int points_chosen; }

user_defined_types: struct shop_data { struct shop_data *next; short keeper; short buy_type[5]; short profit_buy; short profit_sell; short open_hour; short close_hour; }

user_defined_types: struct mprog_list { int trig_type; char *trig_phrase; short vnum; char *code; struct mprog_list *next; unsigned char valid; }

user_defined_types: struct extra_descr_data { struct extra_descr_data *next; unsigned char valid; char *keyword; char *description; }

user_defined_types: struct obj_index_data { struct obj_index_data *next; struct extra_descr_data *extra_descr; struct affect_data *affected; struct area_data *area; unsigned char new_format; char *name; char *short_descr; char *description; short vnum; short reset_num; char *material; short item_type; int extra_flags; int wear_flags; short level; short condition; short count; short weight; int cost; int value[5]; }