diff --git a/bin/data/scp/generic_text.scp b/bin/data/scp/generic_text.scp new file mode 100644 index 0000000..05d5a08 --- /dev/null +++ b/bin/data/scp/generic_text.scp @@ -0,0 +1,19 @@ +#dbname=generic_text + + +// Server auth, login, charlist, char create,... response code texts +[0] +47=Character created. +48=The server had an error when creating the character! +49=Character creation failed! +50=The name you have chosen is already in use. +51=Character creation is currently disabled on this realm! +52=You cannot create a character on this side; it would violate PVP rules! +53=You have reached the limit of characters on this realm! +54=You have reached the limit of characters on this account! +55=CHAR_CREATE_SERVER_QUEUE +56=CHAR_CREATE_ONLY_EXISTING +57=You do not have the required explainsion installed to create this character! +58=You do not have the required expansion installed to create characters of this class! +59=Your characters do not have reached the a level that is required to create this character! +60=You have reached the limit of characters of this class! \ No newline at end of file diff --git a/src/Client/World/MapMgr.cpp b/src/Client/World/MapMgr.cpp index bde7a03..bdcdde2 100644 --- a/src/Client/World/MapMgr.cpp +++ b/src/Client/World/MapMgr.cpp @@ -99,7 +99,7 @@ void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m) if( !_tiles->GetTile(gx,gy) ) { - ADTFile *adt = new ADTFile(); + char buf[300]; MakeMapFilename(buf,m,gx,gy); MemoryDataHolder::memblock mb = MemoryDataHolder::GetFileBasic(buf); @@ -108,10 +108,12 @@ void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m) ByteBuffer bb(mb.size); bb.append(mb.ptr,mb.size); MemoryDataHolder::Delete(buf); + ADTFile *adt = new ADTFile(); adt->LoadMem(bb); logdebug("MAPMGR: Loaded ADT '%s'",buf); MapTile *tile = new MapTile(); tile->ImportFromADT(adt); + delete adt; _tiles->SetTile(tile,gx,gy); logdebug("MAPMGR: Imported MapTile (%u, %u) for map %u",gx,gy,m); } @@ -119,7 +121,6 @@ void MapMgr::_LoadTile(uint32 gx, uint32 gy, uint32 m) { logerror("MAPMGR: Loading ADT '%s' failed!",buf); } - delete adt; } else { diff --git a/src/Client/World/WorldSession.cpp b/src/Client/World/WorldSession.cpp index 6f3b8b4..fef7f00 100644 --- a/src/Client/World/WorldSession.cpp +++ b/src/Client/World/WorldSession.cpp @@ -748,32 +748,35 @@ void WorldSession::PreloadDataBeforeEnterWorld(PlayerEnum& pl) { log("Loading data before entering world..."); _LoadCache(); // we are about to login, so we need cache data - GetWorld()->GetMapMgr()->Update(pl._x, pl._y, pl._mapId); // make it load the map files - - // preload additional map data only when the GUI is enabled - // TODO: at some later point we will need the geometry for correct collision calculation, etc... - if(GetInstance()->GetConf()->enablegui) + if(MapMgr *mmgr = GetWorld()->GetMapMgr()) { - for(uint32 tiley = 0; tiley < 3; tiley++) + mmgr->Update(pl._x, pl._y, pl._mapId); // make it load the map files + + // preload additional map data only when the GUI is enabled + // TODO: at some later point we will need the geometry for correct collision calculation, etc... + if(GetInstance()->GetConf()->enablegui) { - for(uint32 tilex = 0; tilex < 3; tilex++) + for(uint32 tiley = 0; tiley < 3; tiley++) { - MapTile *maptile = GetWorld()->GetMapMgr()->GetNearTile(tilex - 1, tiley - 1); - if(maptile) + for(uint32 tilex = 0; tilex < 3; tilex++) { - for(uint32 i = 0; i < maptile->GetDoodadCount(); i++) + MapTile *maptile = GetWorld()->GetMapMgr()->GetNearTile(tilex - 1, tiley - 1); + if(maptile) { - Doodad *doo = maptile->GetDoodad(i); + for(uint32 i = 0; i < maptile->GetDoodadCount(); i++) + { + Doodad *doo = maptile->GetDoodad(i); - // it is useless to load the file here, since its loaded when irrlicht needs it and kept in the MeshCache for later use - //MemoryDataHolder::BackgroundLoadFile(doo->model); + // it is useless to load the file here, since its loaded when irrlicht needs it and kept in the MeshCache for later use + //MemoryDataHolder::BackgroundLoadFile(doo->model); - // but we need to preload the .skin files, since they are not held in the MeshCache - // TODO: load *all* necessary skin files, also fix stuffextract for this! - std::string skinfile = doo->model.substr(0, doo->model.length()-3) + "00.skin"; - skinfile = GetAbsolutePath(skinfile.c_str()); - _FixFileName(skinfile); - MemoryDataHolder::BackgroundLoadFile(skinfile); + // but we need to preload the .skin files, since they are not held in the MeshCache + // TODO: load *all* necessary skin files, also fix stuffextract for this! + std::string skinfile = doo->model.substr(0, doo->model.length()-3) + "00.skin"; + skinfile = GetAbsolutePath(skinfile.c_str()); + _FixFileName(skinfile); + MemoryDataHolder::BackgroundLoadFile(skinfile); + } } } } diff --git a/src/shared/ADTFile.cpp b/src/shared/ADTFile.cpp index f91775e..5a152d0 100644 --- a/src/shared/ADTFile.cpp +++ b/src/shared/ADTFile.cpp @@ -89,7 +89,7 @@ bool ADTFile::LoadMem(ByteBuffer& buf) { buf.read(fourcc,4); flipcc(fourcc); buf.read((uint8*)&size,4); - //DEBUG(printf("ADT: reading '%s' size %u\n",fourcc,size)); + DEBUG(printf("ADT: reading '%s' size %u\n",fourcc,size)); if(!strcmp((char*)fourcc,"MVER")) { @@ -226,11 +226,13 @@ bool ADTFile::LoadMem(ByteBuffer& buf) buf.read(mfcc,4); flipcc(mfcc); buf.read((uint8*)&msize,4); + DEBUG(printf("ADT:MCNK[%u]: reading '%s' size %u\n",mcnkid,mfcc,msize)); + // HACKS to make it work properly if(!msize && !strcmp((char*)mfcc,"MCAL")) continue; - //if((!msize) && !strcmp((char*)mfcc,"MCLQ")) - // msize = _chunks[mcnkid].hdr.sizeLiquid; + if((!msize) && !strcmp((char*)mfcc,"MCLQ")) // size for MCLQ block is always 0 + msize = _chunks[mcnkid].hdr.sizeLiquid - 8; // but even the size in the header is somewhat wrong.. pfff //DEBUG(printf("ADT: MCNK: reading '%s' size %u\n",mfcc,msize)); @@ -290,7 +292,7 @@ bool ADTFile::LoadMem(ByteBuffer& buf) } } } - /*else if(!strcmp((char*)mfcc,"MCLQ")) // MCLQ changed to MH2O chunk for whole ADT file + else if(!strcmp((char*)mfcc,"MCLQ")) // MCLQ changed to MH2O chunk for whole ADT file { uint8 _cc3[5]; uint8 *fcc1 = &_cc3[0]; @@ -310,13 +312,13 @@ bool ADTFile::LoadMem(ByteBuffer& buf) float tmp; buf.rpos(buf.rpos()-4); uint32 bufpos=buf.rpos(); - uint32 rbytes,diffbytes; buf >> _chunks[mcnkid].waterlevel; buf >> tmp; //DEBUG(printf("ADT: MCNK: MCLQ base floats: %f %f\n",_chunks[mcnkid].waterlevel,tmp)); //buf.rpos(buf.rpos()+4); // base height?? if(msize > 8) // just to be sure { + uint32 rbytes,diffbytes; for(uint32 i = 0; i < 81; i++) { _chunks[mcnkid].lqvertex[i] = buf.read(); @@ -326,18 +328,18 @@ bool ADTFile::LoadMem(ByteBuffer& buf) buf >> _chunks[mcnkid].lqflags[i]; } rbytes = buf.rpos() - bufpos; - //DEBUG(printf("ADT: MCNK: MCLQ block loaded. %u / %u bytes.\n",rbytes,msize)); + DEBUG(printf("ADT: MCNK: MCLQ block loaded. %u / %u bytes.\n",rbytes,msize)); + // HACK: skip some unk junk bytes + diffbytes = msize - rbytes; // difference should always be 84 (0x54) bytes + buf.rpos(buf.rpos()+diffbytes); + DEBUG(printf("ADT: MCNK: MCLQ - %u junk bytes skipped\n",diffbytes)); } else { //DEBUG(printf("ADT: MCNK: MCLQ block has only %u bytes\n",msize)); } - // HACK: skip some unk junk bytes - diffbytes = (msize-8) - rbytes; // dont forget to skip the 8 initial bytes - buf.rpos(buf.rpos()+diffbytes); - //DEBUG(printf("ADT: MCNK: MCLQ - %u junk bytes skipped\n",diffbytes)); } - }*/ + } else if(!strcmp((char*)mfcc,"MCSE")) { uint32 emm = _chunks[mcnkid].hdr.nSndEmitters;