Szerző Téma: Channel váltó tanácstalan vagyok ....  (Megtekintve 274 alkalommal)

Nem elérhető Aizen

  • Beginner
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Hozzászólások: 13
  • Segített: 0
Channel váltó tanácstalan vagyok ....
« Dátum: 2017-11-12, 16:40:57 »
Be raktam a szerverembe a következőt:
cmd.cp:

after:
ACMD(do_warp);
add:
ACMD(do_channel_switch);


after:
{ "mall_close", do_mall_close, 0, POS_DEAD, GM_PLAYER },
    add:
    { "channel", do_channel_switch, 0, POS_DEAD, GM_PLAYER },



cmd_general.cpp:

after:
ACMD(do_set_run_mode)
{
ch->SetNowWalking(false);
ch->SetWalking(false);
}

add:
ACMD(do_channel_switch)
{
   
    char arg1[256];
    one_argument(argument, arg1, sizeof(arg1));

    if (!*arg1)
            return;
   
    int new_ch;
    str_to_number(new_ch, arg1);
    if( new_ch <1 || new_ch >4)   // REPLACE 2 WITH YOUR MAX_CHANNEL
        return;
    if (!ch->IsPC())
        return;
    ch->ChannelSwitch(new_ch);
   
}


char.h:

after:
void StartWarpNPCEvent();

add:
void                            ChannelSwitch(int new_ch);




char.cpp:

after:
EVENTFUNC(warp_npc_event)
{
char_event_info* info = dynamic_cast<char_event_info*>( event->info );
if ( info == NULL )
{
sys_err( "warp_npc_event> <Factor> Null pointer" );
return 0;
}

LPCHARACTER ch = info->ch;

if (ch == NULL) { // <Factor>
return 0;
}

if (!ch->GetSectree())
{
ch->m_pkWarpNPCEvent = NULL;
return 0;
}

FuncCheckWarp f(ch);
if (f.Valid())
ch->GetSectree()->ForEachAround(f);

return passes_per_sec / 2;
}


add:
void CHARACTER::ChannelSwitch(int new_ch){
    long lAddr;
    long lMapIndex;
    WORD wPort;
    long x = this->GetX();
    long y = this->GetY();

    if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
    {
            sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName());
            return;
    }
    if(lMapIndex >= 10000){
        return;
    }
   
    std::map<WORD, int>micha;
   
    for(int i = 0; i < 4; i++){ //replace with maximum channels -1   actual 1300x - 1330x
        for(int i2 = 2; i2 < 9; i2++){ //replace with your core values actual  13x02 - 13x08
            micha[13*1000 + i*100 + i2] = i+1;
        }       
    }
    //micha[13002] = 1;
    int chan;
    if(micha.find(wPort) != micha.end()){
        chan = micha[wPort];
    }else{return;}
    Stop();
    Save();
   
    if(GetSectree()){
        GetSectree()->RemoveEntity(this);
        ViewCleanup();
        EncodeRemovePacket(this);
    }
    TPacketGCWarp p;

    p.bHeader = HEADER_GC_WARP;
    p.lX = x;
    p.lY = y;
    p.lAddr = lAddr;
    p.wPort = (wPort - 100*(chan-1) + 100*(new_ch-1));
   
    sys_err("x : %d y: %d, addr: %d, port: %d , newPort: %d", x, y, lAddr, wPort, (wPort - 100*chan + 100*new_ch));

    GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
}

Ez elméletileg a Wom2 csatorna választó ,viszont nem visz át a másik ch-ra ... Bent van kliensben is.

Üzenet összefésülés: 2017-11-12, 17:04:45
Segítségeket elfogadom ... a kliens syserr nem jelez ki semmit de arra gondoltam nem-e esetleg forrásban vagy serverinfoba kel valamit bővíteni ...
« Utoljára szerkesztve: 2017-11-12, 17:04:45 írta Aizen »

Nem elérhető Meli

  • Professional
  • ***
  • Thank You
  • -Given: 121
  • -Receive: 88
  • Hozzászólások: 563
  • Segített: 9
Re:Channel váltó tanácstalan vagyok ....
« Válasz #1 Dátum: 2017-11-13, 00:19:08 »
    for(int i = 0; i < 4; i++){ //replace with maximum channels -1   actual 1300x - 1330x
        for(int i2 = 2; i2 < 9; i2++){ //replace with your core values actual  13x02 - 13x08
            micha[13*1000 + i*100 + i2] = i+1;
        } 

Ebben lesz a hiba + config fájl.

Nem elérhető Aizen

  • Beginner
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Hozzászólások: 13
  • Segített: 0
Re:Channel váltó tanácstalan vagyok ....
« Válasz #2 Dátum: 2017-11-13, 21:07:58 »
Config ? :O

HOSTNAME: channel1
CHANNEL: 1
PORT: 13000
P2P_PORT: 13010
DB_PORT: 15000
DB_ADDR: localhost
MAP_ALLOW: 1 3 4 5 21 23 24 25 43 41 44 45 50 51 52 53 61 62 63 65 64 66 67 68 69 70 71 72 73 80 104 105 108 109 112 196 220 222 223 224 225 351 241 85 243 244 242 221 82 226 184 185 186 187 188 189 133 134 135 200 136 245 246 199 129 130 131 132 239 240
TABLE_POSTFIX:
PASSES_PER_SEC: 25
SAVE_EVENT_SECOND_CYCLE: 180
PING_EVENT_SECOND_CYCLE: 180
PLAYER_SQL: localhost mt2 mt2!@# player
COMMON_SQL: localhost mt2 mt2!@# common
LOG_SQL: localhost mt2 mt2!@# log
TEST_SERVER: 0
adminpage_ip1: 192.168.1.10
pk_server : 0
MALL_URL: google.hu/?/?
VIEW_RANGE: 8000
CHECK_MULTIHACK: 0
PACKAGE_ENABLE: 0
MAX_LEVEL: 250
MAX_STATUS: 125
LOCALE_SERVICE: hungary

HOSTNAME: channel2
CHANNEL: 2
PORT: 16000
P2P_PORT: 16010
DB_PORT: 15000
DB_ADDR: localhost
MAP_ALLOW: 1 3 4 5 21 23 24 25 43 41 44 45 50 51 52 53 61 62 63 65 64 66 67 68 69 70 71 72 73 80 104 105 108 109 112 196 220 222 223 224 225 351 241 85 243 244 242 221 82 226 184 185 186 187 188 189 133 134 135 200 136 245 246 199 129 130 131 132 239 240
TABLE_POSTFIX:
PASSES_PER_SEC: 25
SAVE_EVENT_SECOND_CYCLE: 180
PING_EVENT_SECOND_CYCLE: 180
PLAYER_SQL: localhost mt2 mt2!@# player
COMMON_SQL: localhost mt2 mt2!@# common
LOG_SQL: localhost mt2 mt2!@# log
TEST_SERVER: 0
adminpage_ip1: 192.168.1.10
pk_server : 0
MALL_URL: google.hu/?/?
VIEW_RANGE: 8000
CHECK_MULTIHACK: 0
PACKAGE_ENABLE: 0
MAX_LEVEL: 250
MAX_STATUS: 125
LOCALE_SERVICE: hungary



Üzenet összefésülés: 2017-11-13, 21:17:59
A char.cpp igy irtam át ...

void CHARACTER::ChannelSwitch(int new_ch){
long lAddr;
long lMapIndex;
WORD wPort;
long x = this->GetX();
long y = this->GetY();

if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
{
sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName());
return;
}
if (lMapIndex >= 10000){
return;
}

std::map<WORD, int>micha;

for (int i = 0; i < 4; i++){ //replace with maximum channels -1   actual 1300x - 1330x
for (int i2 = 2; i2 < 9; i2++){ //replace with your core values actual  13x02 - 13x08
micha[13 * 1000 + i * 100 + i2] = i + 1;
micha[16 * 1000 + i * 100 + i2] = i + 2;
micha[19 * 1000 + i * 100 + i2] = i + 3;
micha[21 * 1000 + i * 100 + i2] = i + 4;
}
}
micha[13000] = 1; //kommentelve volt.
micha[16000] = 2;
micha[19000] = 3;
micha[21000] = 4;
int chan;
if (micha.find(wPort) != micha.end()){
chan = micha[wPort];
}
else{ return; }
Stop();
Save();

if (GetSectree()){
GetSectree()->RemoveEntity(this);
ViewCleanup();
EncodeRemovePacket(this);
}
TPacketGCWarp p;

p.bHeader = HEADER_GC_WARP;
p.lX = x;
p.lY = y;
p.lAddr = lAddr;
p.wPort = (wPort - 100 * (chan - 4) + 100 * (new_ch - 4)); //p.wPort = (wPort - 100 * (chan - 1) + 100 * (new_ch - 1));

sys_err("x : %d y: %d, addr: %d, port: %d , newPort: %d", x, y, lAddr, wPort, (wPort - 100 * chan + 100 * new_ch));

GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
}

serverinfo:
SERVER_NAME   = "Szervernév"
SERVER_IP   = "81.115.221.105"
CH_NAME      = "Channel 1"
CH_NAME2   = "Channel 2"
CH_NAME3   = "Channel 3"
CH_NAME4   = "Channel 4"
PORT_0       = 11002      #LoginServer
PORT_1       = 13000      #Canal 1
PORT_2       = 16000      #Canal 2
PORT_3       = 19000      #Canal 3
PORT_4       = 21000      #Canal 4


STATE_NONE = "OFF"

STATE_DICT = {
   0 : "....",
   1 : "NORM",
   2 : "BUSY",
   3 : "FULL"
}

SERVER01_CHANNEL_DICT = {
   1:{"key":11,"name":CH_NAME,"ip":SERVER_IP,"tcp_port":PORT_1,"udp_port":PORT_1,"state":STATE_NONE,},
   2:{"key":12,"name":CH_NAME2,"ip":SERVER_IP,"tcp_port":PORT_2,"udp_port":PORT_2,"state":STATE_NONE,},
   3:{"key":13,"name":CH_NAME3,"ip":SERVER_IP,"tcp_port":PORT_3,"udp_port":PORT_3,"state":STATE_NONE,},
   4:{"key":14,"name":CH_NAME4,"ip":SERVER_IP,"tcp_port":PORT_4,"udp_port":PORT_4,"state":STATE_NONE,},

}

REGION_NAME_DICT = {
   0 : "",
}

REGION_AUTH_SERVER_DICT = {
   0 : {
      1 : { "ip":SERVER_IP, "port":PORT_0, },

   }
}

REGION_DICT = {
   0 : {
      1 : { "name" :SERVER_NAME, "channel" : SERVER01_CHANNEL_DICT, },                 
   },
}

MARKADDR_DICT = {
   10 : { "ip" : SERVER_IP, "tcp_port" : PORT_1, "mark" : "10.tga", "symbol_path" : "10", },
}
« Utoljára szerkesztve: 2017-11-13, 21:17:59 írta Aizen »