Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added packet version checks for random options #1524

Closed
wants to merge 1 commit into from

Conversation

Lemongrass3110
Copy link
Member

@Lemongrass3110 Lemongrass3110 commented Aug 28, 2016

This should address a few issues that were reported since we published item random options.

Might be related/solve:
#1515
#1523

Please test if this pull resolves your problems.
@Anacondaqq @admkakaroto

cydh
Copy link
Contributor

@cydh cydh commented on 57bffe9 Aug 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't make something like Pincode Packetver check?

#define PACKETVER_SUPPORTS_PINCODE PACKETVER>=20110309

#define PACKETVER_SUPPORTS_RANDOM_OPTIONS PACKETVER >= 20150226

@Lemongrass3110
Copy link
Member Author

@Lemongrass3110 Lemongrass3110 commented Aug 28, 2016

Yeah I just wanted to make this one reviewable for changes right now and will do that in another follow up, since this is actually used in more places than this.

@anacondaq
Copy link

@anacondaq anacondaq commented Aug 28, 2016

I have added these changes, and yes of course it fixes the issue for my old 2012-04-10 exe, because of removing extra bytes in item structure, and mmo_charstatus structure size less then 0xFFFF (65k bytes).
I have made custom functions to see size of each element in mmo_charstatus, and i was a little bit shocked by size of item structure (40 bytes) * 600 storage items = 24kb. + Extra storage / cart storage / etc.
The optimization of item structure will be so painful...

size of item structure without random option = ~40 bytes
size of item structure with random option structure = ~72 bytes.

Size of each element in mmo_charstatus (generated for another emulator based on rAthena, but between classic rAthena is not too much difference as you see on size, i can do the same for classic rAthena, but the size will be huge too).

(all defined values (for arrays) are +- the same. Maybe just skill db not clean, and i'm using 1250 skills.
Storage = 600 items.

Size in bytes, and not really accurate. But show "mmo_charstatus" size eater.

Size of mmo_charstatus without RANDOM Option structure.

Size of mmmo->char_id : '4'
Size of mmmo->account_id : '4'
Size of mmmo->partner_id : '4'
Size of mmmo->father : '4'
Size of mmmo->mother : '4'
Size of mmmo->child : '4'
Size of mmmo->base_exp : '4'
Size of mmmo->job_exp : '4'
Size of mmmo->zeny : '4'
Size of mmmo->class_ : '2'
Size of mmmo->status_point : '4'
Size of mmmo->skill_point : '4'
Size of mmmo->hp : '4'
Size of mmmo->max_hp : '4'
Size of mmmo->sp : '4'
Size of mmmo->max_sp : '4'
Size of mmmo->option : '4'
Size of mmmo->manner : '2'
Size of mmmo->karma : '1'
Size of mmmo->hair : '2'
Size of mmmo->hair_color : '2'
Size of mmmo->clothes_color : '2'
Size of mmmo->body : '2'
Size of mmmo->party_id : '4'
Size of mmmo->guild_id : '4'
Size of mmmo->pet_id : '4'
Size of mmmo->hom_id : '4'
Size of mmmo->mer_id : '4'
Size of mmmo->ele_id : '4'
Size of mmmo->faction_id : '4'
Size of mmmo->fame : '4'
Size of mmmo->arch_faith : '4'
Size of mmmo->arch_calls : '4'
Size of mmmo->spear_faith : '4'
Size of mmmo->spear_calls : '4'
Size of mmmo->sword_faith : '4'
Size of mmmo->sword_calls : '4'
Size of mmmo->last_tick : '8'
Size of mmmo->playtime : '4'
Size of mmmo->weapon : '2'
Size of mmmo->shield : '2'
Size of mmmo->head_top : '2'
Size of mmmo->head_mid : '2'
Size of mmmo->head_bottom : '2'
Size of mmmo->robe : '2'
Size of mmmo->name : '24'
Size of mmmo->base_level : '4'
Size of mmmo->job_level : '4'
Size of mmmo->str : '2'
Size of mmmo->agi : '2'
Size of mmmo->vit : '2'
Size of mmmo->int_ : '2'
Size of mmmo->dex : '2'
Size of mmmo->luk : '2'
Size of mmmo->slot : '1'
Size of mmmo->sex : '1'
Size of mmmo->mapip : '4'
Size of mmmo->mapport : '2'
Size of mmmo->pvp : '8'
Size of mmmo->pk : '8'
Size of mmmo->bgstats : '204'
Size of mmmo->bg_skillcount : '336'
Size of mmmo->wstats : '108'
Size of mmmo->skillcount : '336'
Size of mmmo->last_point : '6'
Size of mmmo->save_point : '6'
Size of mmmo->memo_point : '18'
Size of mmmo->inventory : '4000'
Size of mmmo->cart : '4000'
Size of mmmo->storage : '24008'
Size of mmmo->ext_storage : '48'
Size of mmmo->skill : '6400'
Size of mmmo->friends : '1280'
Size of mmmo->hotkeys : '304'
Size of mmmo->show_equip : '1'
Size of mmmo->allow_party : '1'
Size of mmmo->iprank : '1'
Size of mmmo->rename : '2'
Size of mmmo->delete_date : '8'
Size of mmmo->unban_time : '8'
Size of mmmo->character_moves : '4'
Size of mmmo->font : '1'
Size of mmmo->cashshop_sent : '1'
Size of mmmo->uniqueitem_counter : '4'
Size of mmmo->hotkey_rowshift : '1'

Size of mmo_charstatus elements with RANDOM OPTION structure.

mmo_charstatus size = 66960 is too big to be transmitted. (must be below 0xFFFF)

Size of mmmo->char_id : '4'
Size of mmmo->account_id : '4'
Size of mmmo->partner_id : '4'
Size of mmmo->father : '4'
Size of mmmo->mother : '4'
Size of mmmo->child : '4'
Size of mmmo->base_exp : '4'
Size of mmmo->job_exp : '4'
Size of mmmo->zeny : '4'
Size of mmmo->class_ : '2'
Size of mmmo->status_point : '4'
Size of mmmo->skill_point : '4'
Size of mmmo->hp : '4'
Size of mmmo->max_hp : '4'
Size of mmmo->sp : '4'
Size of mmmo->max_sp : '4'
Size of mmmo->option : '4'
Size of mmmo->manner : '2'
Size of mmmo->karma : '1'
Size of mmmo->hair : '2'
Size of mmmo->hair_color : '2'
Size of mmmo->clothes_color : '2'
Size of mmmo->body : '2'
Size of mmmo->party_id : '4'
Size of mmmo->guild_id : '4'
Size of mmmo->pet_id : '4'
Size of mmmo->hom_id : '4'
Size of mmmo->mer_id : '4'
Size of mmmo->ele_id : '4'
Size of mmmo->faction_id : '4'
Size of mmmo->fame : '4'
Size of mmmo->arch_faith : '4'
Size of mmmo->arch_calls : '4'
Size of mmmo->spear_faith : '4'
Size of mmmo->spear_calls : '4'
Size of mmmo->sword_faith : '4'
Size of mmmo->sword_calls : '4'
Size of mmmo->last_tick : '8'
Size of mmmo->playtime : '4'
Size of mmmo->weapon : '2'
Size of mmmo->shield : '2'
Size of mmmo->head_top : '2'
Size of mmmo->head_mid : '2'
Size of mmmo->head_bottom : '2'
Size of mmmo->robe : '2'
Size of mmmo->name : '24'
Size of mmmo->base_level : '4'
Size of mmmo->job_level : '4'
Size of mmmo->str : '2'
Size of mmmo->agi : '2'
Size of mmmo->vit : '2'
Size of mmmo->int_ : '2'
Size of mmmo->dex : '2'
Size of mmmo->luk : '2'
Size of mmmo->slot : '1'
Size of mmmo->sex : '1'
Size of mmmo->mapip : '4'
Size of mmmo->mapport : '2'
Size of mmmo->pvp : '8'
Size of mmmo->pk : '8'
Size of mmmo->bgstats : '204'
Size of mmmo->bg_skillcount : '336'
Size of mmmo->wstats : '108'
Size of mmmo->skillcount : '336'
Size of mmmo->last_point : '6'
Size of mmmo->save_point : '6'
Size of mmmo->memo_point : '18'
Size of mmmo->inventory : '7200'             <----- same as below
Size of mmmo->cart : '7200'                  <----- same as below
Size of mmmo->storage : '43208'              <----- random option enabled, and size increased in ~1.5x times for all
Size of mmmo->ext_storage : '80'
Size of mmmo->skill : '6400'
Size of mmmo->friends : '1280'
Size of mmmo->hotkeys : '304'
Size of mmmo->show_equip : '1'
Size of mmmo->allow_party : '1'
Size of mmmo->iprank : '1'
Size of mmmo->rename : '2'
Size of mmmo->delete_date : '8'
Size of mmmo->unban_time : '8'
Size of mmmo->character_moves : '4'
Size of mmmo->font : '1'
Size of mmmo->cashshop_sent : '1'
Size of mmmo->uniqueitem_counter : '4'
Size of mmmo->hotkey_rowshift : '1'

Guys, I don't even know how it can be optimized) But you did well, I believe in you what you can handle with it. If you need any help - write, I will try what I can to help.

@aleos89
Copy link
Contributor

@aleos89 aleos89 commented Aug 29, 2016

Just push #1115 already. :P

@cydh
Copy link
Contributor

@cydh cydh commented Aug 29, 2016

just telling,
some compilers have byte gap for structs. so if u checking the var size by single variable then sum them will give different size if u do sizeof(struct mmo_charstatus);

@Lemongrass3110
Copy link
Member Author

@Lemongrass3110 Lemongrass3110 commented Aug 30, 2016

Since this should also be fixed with #1115 I will close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants