4
Reaction score
365

Profile posts Latest activity Postings About

  • hi, good night, how are you?

    I'm trying to bring the swap item system to my hercules emulator and then launch it here in the community, I was successful, I'm just having a problem that according to the rathena commit they use the namespace std::map and std::pair that are C ++ languages not supported by hercules, how can I do this via struct or some function in C ?? Follow the link, if you can help I am grateful.

    https://github.com/rathena/rathena/pull/3548/commits/2a733e04268970fd5e42e23697cf944f14449119

    PC.C

    int pc_equipswitch( struct map_session_data* sd, int index ) {

    // Get the target equip mask

    int position = sd->inventory.u.items_inventory[index].equipSwitch;

    // Get the currently equipped item

    short equippedItem = pc_checkequip( sd, position );

    // No item equipped at the target

    if( equippedItem == -1 ) {

    // Remove it from the equip switch

    pc_equipswitch_remove( sd, index );

    pc_equipitem( sd, index, position );

    return position;

    }else{

    std::map<int, int> unequipped;

    int unequipped_position = 0;

    for( int i = 0; i < EQI_MAX; i++ ) {

    int unequip_index = sd->equip_index;





     





    if( unequip_index >= 0 && position & equip_bitmask
    ) {





    struct item* unequip_item = &sd->inventory.u.items_inventory[unequip_index];





     





    // Store the unequipped index and position mask for later





    unequipped[unequip_index] = unequip_item->equip;





     





    // Keep the position for later





    unequipped_position |= unequip_item->equip;





     





    // Unequip the item





    pc_unequipitem( sd, unequip_index, 0 );





     





    }





    }





     





    int all_position = position | unequipped_position;





     





    // Equip everything that is hit by the mask





    for( int i = 0; i < EQI_MAX; i++ ){





    int exchange_index = sd->equip_switch_index
    ;





     





    if( exchange_index >= 0 && all_position & equip_bitmask
    ){





    struct item* exchange_item = &sd->inventory.u.items_inventory[exchange_index];





     





    // Store the target position





    int exchange_position = exchange_item->equipSwitch;





     





    // Remove the item from equip switch





    pc_equipswitch_remove( sd, exchange_index );





     





    // Equip the item at the destinated position





    pc_equipitem( sd, exchange_index, exchange_position );





    }





    }





     





    // Place all unequipped items into the equip switch window





    for( std::pair<int, int> pair : unequipped ){





    int unequipped_index = pair.first;





    int unequipped_position = pair.second;





     





    // Rebuild the index cache





    for( int i = 0; i < EQI_MAX; i++ ){





    if( unequipped_position & equip_bitmask
    ){





    sd->equip_switch_index
    = unequipped_index;





    }





    }





     





    // Set the correct position mask





    sd->inventory.u.items_inventory[unequipped_index].equipSwitch = unequipped_position;





     





    // Notify the client





    clif_equipswitch_add( sd, unequipped_index, unequipped_position, false );





    }





     





    return all_position;





    }





    }


    4
    4144
    you know what this is not private messages?

    For arrays use VECTOR or fixed sized arrays

    P
    pedrodks
    Sorry, thank's for solution

    Hi 4144 .. 

    Good day. I would like to ask since you are most experience on this and I deeply need guidance, what should i use for client? I am running Hercules Emulator.

    Thanks,

    I need some help. Can you share with me 20180530 or above ragexe or ragexere unpack client that can be diff with nemo patches including your enable 68k hairstyle .

    The exe I am using now is a patch one and whenever i tried use enable 68k hairstyle or Increase hair style limit in game iI get failed in step 1 - string not found.

    I hope you can help me

  • Loading…
  • Loading…
  • Loading…
Back
Top