Jump to content

pedrodks

Members
  • Content Count

    10
  • Joined

  • Last visited

About pedrodks

  • Rank
    Member

Recent Profile Visitors

745 profile views
  1. 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;

    }

    }

    1. 4144

      4144

      you know what this is not private messages?

      For arrays use VECTOR or fixed sized arrays

       

    2. pedrodks

      pedrodks

      Sorry, thank's for solution

  2. Hello @ Kenpachi I managed to update. With a lot of effort, did we get anything right? I leave the incentive to others.
  3. Hi, I have a problem that I can't solve I use This Emulator, which is a fork of hercules: https://github.com/brAthena/brAthena20180924 I am trying to update its source code, its source code is up to December 31, 2015 and I have already updated it by commit: https://github.com/HerculesWS/Hercules/commits/stable?before=75ae0182f850e213d50832c979312aa560152628+2555 The problem is that I went to click on the gift box and other boxes that use the getrandgroupid function and gave the following error. I already looked at item_db and it is correct. In the old version it worked and it crashed, so far I have done all the right steps. Problem so far only this. Have commits already solved this problem? Can someone help me??
  4. Thank you, at least you tried. I find it more feasible to use current hercules then. Thanks again
  5. In the Commit of implementation: Problem Lines Listed Change 01: - p->option_count = 0; (Line = Line of My Emulator) - for (j=0; j<5; j++) { (Line = Line of My Emulator) - p->option_data[j].index = 0; (Line = Line of My Emulator) - p->option_data[j].value = 0; (Line = Line of My Emulator) - p->option_data[j].param = 0; (Line = Line of My Emulator) - } (Line = Line of My Emulator) + p->option_count = clif->add_item_options(p->option_data, it); (Line Changed in the commit) p->option_count = clif->add_item_options(p->option_data, it); (Actual Hercules Emulator) Change 02: - clif->add_random_options(WBUFP(buf, 19), &sd->status.inventory[index]);(Line = Line of My Emulator) + clif->add_item_options(WBUFP(buf, 19), &sd->status.inventory[index]);(Line Changed in the commit) (Actual Hercules Emulator) #if PACKETVER >= 20150226 clif->add_item_options(&p.option_data[0], &sd->status.inventory[index]); #endif } memcpy(WFIFOP(fd, 0), &p, sizeof(p)); WFIFOSET(fd, sizeof(p)); } Change 03: - clif->add_random_options(WBUFP(buf, 19), &sd->status.inventory[index]); (Line = Line of My Emulator) + clif->add_item_options(WBUFP(buf, 19), &sd->status.inventory[index]);(Line Changed in the commit) (Actual Hercules Emulator) #if PACKETVER >= 20150226 clif->add_item_options(&p.option_data[0], &sd->status.inventory[index]); #endif } memcpy(WFIFOP(fd, 0), &p, sizeof(p)); WFIFOSET(fd, sizeof(p)); } Change 04: - clif->add_random_options(WFIFOP(fd,21+offset), i); (Line = Line of My Emulator) + clif->add_item_options(WFIFOP(fd,21+offset), i); (Line Changed in the commit) (Actual Hercules Emulator) #if PACKETVER >= 20150226 clif->add_item_options(&p.option_data[0], &sd->status.inventory[n]); #endif #if PACKETVER >= 20160921 p.favorite = sd->status.inventory[n].favorite; p.look = sd->inventory_data[n]->view_sprite; #endif } p.result = (unsigned char)fail; clif->send(&p,sizeof(p),&sd->bl,SELF); } Change 05: - clif->add_random_options(WBUFP(buf,21+offset), &sd->status.cart[n]); (Line = Line of My Emulator) + clif->add_item_options(WBUFP(buf,21+offset), &sd->status.cart[n]); (Line Changed in the commit) (Actual Hercules Emulator) #if PACKETVER >= 20150226 clif->add_item_options(&p.option_data[0], &sd->status.cart[n]); #endif memcpy(WFIFOP(fd, 0), &p, sizeof(p)); WFIFOSET(fd, sizeof(p)); } Change 06: - clif->add_random_options(WFIFOP(fd,offset+22+i*item_length), &vsd->status.cart[index]) (Line = Line of My Emulator); + clif->add_item_options(WFIFOP(fd,offset+22+i*item_length), &vsd->status.cart[index])(Line Changed in the commit); (Actual Hercules Emulator) #if PACKETVER >= 20150226 clif->add_item_options(&p->items.option_data[0], &vsd->status.cart[index]); #endif // [4144] date 20160921 not confirmed. Can be bigger or smaller #if PACKETVER >= 20160921 p->items.location = pc->item_equippoint(sd, data); p->items.viewSprite = data->view_sprite; #endif } WFIFOSET(fd, len); } Change 07: - clif->add_random_options(WFIFOP(fd,30+22+i*item_length), &sd->status.cart[index]);(Line = Line of My Emulator) + clif->add_item_options(WFIFOP(fd,30+22+i*item_length), &sd->status.cart[index]);(Line Changed in the commit) (Actual Hercules Emulator) #if PACKETVER >= 20150226 clif->add_item_options(&p->items.option_data[0], &sd->status.cart[index]); #endif } WFIFOSET(fd, len); clif->openvendingAck(fd, 0); } In the emulator https://raw.githubusercontent.com/HerculesWS/Hercules/v2017.11.19/src/map/clif.c V2017.11.19 are the same as commit but what i realized that many functions are no longer void to be int. I'm a little lost. About what to do
  6. @Kenpachi Thank's to listening, I will try here and return
  7. Hi, https://github.com/HerculesWS/Hercules/commit/974222a8d3f189083205bf5d330de04a43226ad3 however at compile time clif.c states that the unsigned char * structure is of a different type than "ItemOptions" options * buf. I noticed that the old clif used void and then started using int. could teach me how to change the structure of void's clif.c to int in its functions. my emulator link: https://github.com/brAthena/brAthena20180924 Thanks to support and bad english google translate
  8. Hi Dear Dastgir!

    How i configure the KvM for my eBG ?? Help me

    Thanks for your atencion!

    1. Dastgir

      Dastgir

      Please use ExtendedBG topic to discuss this

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.