Actualize Old Emulator Hercules

pedrodks

New member
Messages
12
Points
0
Last edited by a moderator:
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

 
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


 
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

 
Last edited by a moderator:
Thank you, at least you tried. I find it more feasible to use current hercules then. Thanks again

 
Last edited by a moderator:
Hello @ Kenpachi

I managed to update.

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

I leave the incentive to others.

screenChaos002.jpgscreenChaos004.jpg

 
Last edited by a moderator:
Back
Top