Jump to content
  • 1
pedrodks

Actualize Old Emulator Hercules

Question

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

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Hi.

The actual problem is that you've changed the the data type of a parameter which is passes to the clif_add_random_options method.
Thus you have to change the data type when calling clif_add_random_options, too.
Double click each warning in VS to jump to the line where the data type mismatch was detected.
You'll notice, that the method call tries to pass something like WBUFP(buf, 19) or WFIFOP(fd,21+offset) which both wont return an ItemInfo struct which clif_add_random_options expects to be passed.
Now that you've found the faulty spots, have a look at the corresponding code parts in Hercules and change your code accordingly.
Hope this helps.


~Kenpachi

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

Sorry dude, but I wont write a complete patch for the item options system that works with your emulator version.
it's not just updating the clif.c/.h but also packets, the socket, macros and everything else related to items.
I spent more than an hour trying to add that diff to your emulator version, but didn't even came close to something compilable...
Again, sorry.


~Kenpachi

Edited by Kenpachi

Share this post


Link to post
Share on other sites
  • 0
On 12/19/2019 at 1:52 AM, pedrodks said:

Hello @ Kenpachi

 

 

I managed to update.

 

With a lot of effort, did we get anything right?

 

 

I leave the incentive to others.

 

screenChaos002.jpg.2857d95159646f8f9cfa3574db6be772.jpgscreenChaos004.jpg.29c0608f6f3785894bd72e2754cd4cf8.jpg

Olá, estou tentando fazer exatamente o mesmo.

 

Estou tendo vários erros com a versão "legacy" do brathena.

 

Pode dia compartilhar o seu código no github, por favor?

 

Thanks, man!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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