OpenKore / openkore

A free/open source client and automation tool for Ragnarok Online
http://openkore.com
Other
1.28k stars 1.04k forks source link

[kRO_ ServerTypes] Runaway dependency #1060

Open lututui opened 7 years ago

lututui commented 7 years ago

The issue:

  1. Each kRO_RagexeRE servertype depends on the previous one.
  2. The earliest kRO_RagexeRE depends on a kRO_Sakexe which depends on the previous kRO_Sakexe.
  3. The earliest kRO_Sakexe depends on kRO_Sakexe_0 which depends on kRO.
  4. No servertype actually depends on kRO_RagexeRE_0.
  5. kRO_RagexeRE_0 depends on kRO_RagexeRE_2014_03_05b (which doesn't exist).

TLDR: it's just a mess.

A better structure:

                                    ServerType0
                                        |
       ___________________________ kRO_Sakexe_0
       |                                |
kRO_RagexeRE_0                          |
       |                                |
kRO_RagexeRE_                      kRO_Sakexe_

This would allow for a massive code cleanup (there are a lot of duped functions, i.e. sendStoragePassword, and things like '0871' => undef would become unnecessary) without breaking almost nothing, if anything at all.

alisonrag commented 6 years ago

the first step is move identical functions and packets from st0 and sakexe to receive.pm and send.pm

after this we can use st0 as base in sakexe_0

after this we need to clean every servertype file, i think we have to delete all this files and update tables with shuffle, recv, keys, and sync.

in my point of view shuffle, sync and recvpacket files should work better and more clean than create a send and receive file to every servertype

ghost commented 6 years ago

package Network::Receive::kRO::RagexeRE_0;

use strict; use base qw(Network::Receive::kRO::Sakexe_2009_04_08a);

ghost commented 4 years ago

My view is that need to be take attention about chain of responsability inside Network and take a read about https://github.com/OpenKore/openkore/issues/359

We can just do this clean after an analysis about coupling and cohesion of functions.

With this change all kore Source will change and will need of more classes and design patterns and GOF.

Or we use a language such as Java for to use Bot or according with @allanon Go