[RELEASE] Add a second world to your server!! [TitanMS v54]
Ok people, before i start, THIS IS NOT FAKE
people may think, he has a low post count, this is fake
NO WAY
i can code just fine xD
OK
how to start?
Open up your server and go to Worlds.cpp
find this
Code:
void Worlds::showWorld(PlayerLogin* player){
if(player->getStatus() != 4){
// hacking
return;
}
World world;
strcpy_s(world.name, 15, "Scania");
world.channels = Channels::getChannels();;
world.id = 0;
LoginPacket::showWorld(player, world);
LoginPacket::worldEnd(player);
}
add this beneath it
Code:
void Worlds::showWorld2(PlayerLogin* player){
if(player->getStatus() != 4){
// hacking
return;
}
World world;
strcpy_s(world.name, 15, "ChickenMS");
world.channels = Channels::getChannels();;
world.id = 9;
LoginPacket::showWorld(player, world);
LoginPacket::worldEnd(player);
}
Now go to Worlds.h
find this
Code:
static void showWorld(PlayerLogin* player);
add this beneath it
Code:
static void showWorld2(PlayerLogin* player);
Now go to Loginpacket.h
find this
Code:
static void showWorld(PlayerLogin* player, World world);
add this beneath it
Code:
static void showWorld2(PlayerLogin* player, World world);
Now go to PlayerLogin.cpp
find this
Code:
case 0x18: Worlds::showWorld(this); break;
REPLACE IT WITH THIS
Code:
case 0x18: Worlds::showWorld(this), Worlds::showWorld2(this); break;
DO THE SAME WITH case 0x02 !
Now go to LoginPacket.cpp
find this
Code:
void LoginPacket::showWorld(PlayerLogin* player, World world){
Packet packet = Packet();
packet.addHeader(0x05);
packet.addByte(world.id);
packet.addShort(strlen(world.name));
packet.addString(world.name, strlen(world.name));
packet.addByte(0); //Type 2-new
packet.addShort(0);
packet.addShort(100);
packet.addByte(100);
packet.addShort(0);
packet.addByte(world.channels);
for(int i=0; i<world.channels; i++){
char channelname[15];
strcpy_s(channelname, 15, world.name);
strcat_s(channelname, 15, "-");
char cid[15]={0};
cid[0] = i+'1';
strcat_s(channelname, 15, cid);
packet.addShort(strlen(channelname));
packet.addString(channelname, strlen(channelname));
packet.addInt(0x0); // Pop
packet.addByte(world.id);
packet.addShort(i);
}
packet.packetSendLogin(player);
}
Add this beneath it
Code:
void LoginPacket::showWorld2(PlayerLogin* player, World world){
Packet packet = Packet();
packet.addHeader(0x05);
packet.addByte(world.id);
packet.addShort(strlen(world.name));
packet.addString(world.name, strlen(world.name));
packet.addByte(0); //Type 2-new
packet.addShort(0);
packet.addShort(100);
packet.addByte(100);
packet.addShort(0);
packet.addByte(world.channels);
for(int i=0; i<world.channels; i++){
char channelname[15];
strcpy_s(channelname, 15, world.name);
strcat_s(channelname, 15, "-");
char cid[15]={0};
cid[0] = i+'1';
strcat_s(channelname, 15, cid);
packet.addShort(strlen(channelname));
packet.addString(channelname, strlen(channelname));
packet.addInt(0x0); // Pop
packet.addByte(world.id);
packet.addShort(i);
}
packet.packetSendLogin(player);
}
YOU ARE DONE
if you login you can choose between TWO worlds
HOWEVER
The characters will be the same between the two worlds
but im pretty sure that someone will see this and code it so that you can have different chars in different worlds :)
ENJOY IT
(+rep would be useful much? xD)
if you got errors post them here so i can help you!
Good luck, Kippieeej aka Bassoe
TRY THIS IF U USE REV8 OR BEFORE
Quote:
Originally Posted by
Xerixe
Nope, try opening your World.cpp and add
Code:
void Worlds::showWorld(PlayerLogin* player){
if(player->getStatus() != 4){
return;
}
World world;
strcpy_s(world.name, 15, "Scania");
world.channels = 1;
world.id = 0;
LoginPacket::showWorld(player, world);
LoginPacket::worldEnd(player);
}
proof ^^
http://img262.imageshack.us/img262/32/2ndworldcs1.png
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
This was released somewhere before.
I think lar, I'm a noob.
It just needs to add a World in the Characters table.
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
i think that's for odin source?
i've created this all by myself..
i don't know exactly how to do it so that you can have different chars on different worlds
but i WILL find it out, or have somebody tell me =]
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
The Easy Way AND WORKING FOR ALL VERSIONS!:
Quote:
void Worlds::showWorld(PlayerLogin* player){
if(player->getStatus() != 4){
// hacking
return;
}
World world;
strcpy_s(world.name, 15, "Scania");
world.channels = Channels::getChannels();;
world.id = 0;
LoginPacket::showWorld(player, world);
LoginPacket::worldEnd(player);
}
change to that
Quote:
void Worlds::showWorld(PlayerLogin* player){
if(player->getStatus() != 4){
// hacking
return;
}
World world;
strcpy_s(world.name, 15, "Scania");
world.channels = Channels::getChannels();;
world.id = 0;
LoginPacket::showWorld(player, world);
LoginPacket::worldEnd(player);
strcpy_s(world.name, 15, "Bera");
world.channels = Channels::getChannels();;
world.id = 1;
LoginPacket::showWorld(player, world);
LoginPacket::worldEnd(player);
}
thats it!
and if its says to u simthing is dubble u can del it..
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
Quote:
Now go to Loginpacket.cpp
find this
Code:
static void showWorld(PlayerLogin* player, World world);
add this beneath it
Code:
static void showWorld2(PlayerLogin* player, World world);
Bolded line is a typo should be loginpacket.h :)
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
you are right
will edit it now =]
btw @ dudido
i cant believe it is really that simple
that way you won't be able to create diff chars on the worlds
i will make a new mysql check asap!
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
Quote:
Originally Posted by
Dudido
The Easy Way AND WORKING FOR ALL VERSIONS!:
change to that
thats it!
and if its says to u simthing is dubble u can del it..
thanks it works
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
Ok I got this >.<
Quote:
1>------ Build started: Project: MapleStoryServer, Configuration: Debug Win32 ------
1>Compiling...
1>Worlds.cpp
1>c:\users\sean\desktop\seige new\seigems - test\maplestoryserver\worlds.cpp(15) : error C2653: 'Channels' : is not a class or namespace name
1>c:\users\sean\desktop\seige new\seigems - test\maplestoryserver\worlds.cpp(15) : error C3861: 'getChannels': identifier not found
1>c:\users\sean\desktop\seige new\seigems - test\maplestoryserver\worlds.cpp(20) : error C2653: 'Channels' : is not a class or namespace name
1>c:\users\sean\desktop\seige new\seigems - test\maplestoryserver\worlds.cpp(20) : error C3861: 'getChannels': identifier not found
1>Build log was saved at "file://c:\Users\Sean\Desktop\Seige new\Seigems - TesT\MapleStoryServer\Debug\BuildLog.htm"
1>MapleStoryServer - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
hmm
these are the includes of worlds.cpp
Code:
#include "Worlds.h"
#include "LoginPacket.h"
#include <string.h>
#include "PlayerLogin.h"
#include "Characters.h"
#include "Channels.h"
what repack do you use?
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
Quote:
Originally Posted by
kippieeej
hmm
these are the includes of worlds.cpp
Code:
#include "Worlds.h"
#include "LoginPacket.h"
#include <string.h>
#include "PlayerLogin.h"
#include "Characters.h"
#include "Channels.h"
what repack do you use?
lol now it says
Quote:
fatal error C1083: Cannot open include file: 'Channels.h': No such file or directory
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
ok so now i know the problem, heres my channels.h & channels.cpp
channels.h
Code:
#ifndef CHANNELS_H
#define CHANNELS_H
#include "stdio.h"
class Channel;
short getShort(unsigned char* buf);
int getInt(unsigned char* buf);
void getString(unsigned char* buf, int len, char* out);
class Channels {
public:
static void setChannels(int n);
static int getChannels(){
return channeln;
}
static int getChannelStatus(int n){
if(channels[n] == NULL)
return 0;
return 1;
}
static void removeChannel(Channel* channel);
static void acceptChannel(Channel* channel, unsigned char* packet);
static void changeChannel(Channel* channel, unsigned char* packet);
static Channel* channels[20];
private:
static int channeln;
};
#endif
channels.cpp
Code:
/*This file is part of TitanMS.
TitanMS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TitanMS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with TitanMS. If not, see <http://www.gnu.org/licenses/>.*/
#include "Channel.h"
#include "Channels.h"
#include "ChannelsPlayers.h"
#include "ChannelsPacket.h"
int Channels::channeln;
Channel* Channels::channels[20];
void Channels::setChannels(int n){
channeln = n;
for(int i=0; i<20; i++){
channels[i] = NULL;
}
strcpy_s(ChannelsPlayers::header, 100, "Welcome To ChickenMS!");
}
void Channels::acceptChannel(Channel* channel, unsigned char* packet){
int channelid = packet[0];
channel->setChannelID(channelid);
channels[channelid] = channel;
ChannelsPacket::sendHeader(channel, ChannelsPlayers::header);
}
void Channels::removeChannel(Channel* channel){
if(channel->getChannelID() != -1 && channels[channel->getChannelID()] == channel){
channels[channel->getChannelID()] = NULL;
ChannelsPlayers::removePlayersFromChannel(channel->getChannelID());
}
}
void Channels::changeChannel(Channel *channel, unsigned char *packet){
int playerid = getInt(packet);
char channelid = packet[4];
ChannelsPacket::changeChannel(channel, playerid, 8888+channelid, (getChannelStatus(channelid) != NULL));
}
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
Quote:
Originally Posted by
sean360
lol now it says
You cant find Channels.h because you are using 8c or lower. Channels are in 9 and higher
@TS: Great release and same to Duido or whatever his name was lol
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
Quote:
Originally Posted by
Mattraks
You cant find Channels.h because you are using 8c or lower. Channels are in 9 and higher
@TS: Great release and same to Duido or whatever his name was lol
So this only works on rev9?
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
yeah. unless you just add the channel files to your server
dunno
maybe it will work then
here is also Channel.h
Code:
/*This file is part of TitanMS.
TitanMS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TitanMS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with TitanMS. If not, see <http://www.gnu.org/licenses/>.*/
#ifndef CHANNEL_H
#define CHANNEL_G
#include "../Connection/AbstractPlayer.h"
#include "../Connection/PacketHandler.h"
class Channel:public AbstractPlayer {
public:
Channel () {
channelid=-1;
}
~Channel();
void handleRequest(unsigned char* buf, int len);
void sendPacket(unsigned char* buf, int len){ packetHandler->sendPacket(buf,len); }
void setChannelID(int n){
channelid = n;
}
int getChannelID(){
return channelid;
}
private:
int channelid;
};
class ChannelFactory:public AbstractPlayerFactory {
public:
AbstractPlayer* createPlayer() {
return new Channel();
}
};
#endif
Channel.cpp
Code:
/*This file is part of TitanMS.
TitanMS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
TitanMS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with TitanMS. If not, see <http://www.gnu.org/licenses/>.*/
#include "Channel.h"
#include "Channels.h"
#include "ChannelsPlayers.h"
void Channel::handleRequest(unsigned char* buf, int len){
short header = buf[0] + buf[1]*0x100;
switch(header){
case 0x00: Channels::acceptChannel(this, buf+2); break;
case 0x01: ChannelsPlayers::addPlayer(this, buf+2); break;
case 0x02: ChannelsPlayers::removePlayer(this, buf+2); break;
case 0x03: Channels::changeChannel(this, buf+2); break;
case 0x04: ChannelsPlayers::changeHeader(this, buf+2); break;
case 0x05: ChannelsPlayers::findRequest(this, buf+2); break;
}
}
Channel::~Channel(){
Channels::removeChannel(this);
}
in loginpacket.h
Code:
static void showChannels(PlayerLogin* player);
static void channelSelect(PlayerLogin* player);
in Playerlogin.cpp
Code:
case 0x19: Worlds::channelSelect(this, buf+2); break;
in Loginpacket.cpp
Code:
void LoginPacket::showChannels(PlayerLogin* player){
Packet packet = Packet();
packet.addHeader(0x12);
packet.addShort(0x00);
packet.packetSendLogin(player);
}
void LoginPacket::channelSelect(PlayerLogin* player){
Packet packet = Packet();
/*
packet.addHeader(0x10);
packet.addBytes("000500001040008612340097227400");
packet.addInt(4);
packet.addBytes("9F227400");
packet.addInt(4);
packet.addBytes("AC227400544D0500F073790028BC0000");
packet.packetSendLogin(player);
*/
}
Re: [RELEASE] Add a second world to your server!! [TitanMS v54]
Quote:
Originally Posted by
sean360
So this only works on rev9?
Nope, try opening your World.cpp and add
Code:
void Worlds::showWorld(PlayerLogin* player){
if(player->getStatus() != 4){
return;
}
World world;
strcpy_s(world.name, 15, "Scania");
world.channels = 1;
world.id = 0;
LoginPacket::showWorld(player, world);
LoginPacket::worldEnd(player);
}