No unsigned char. Like gender, hair, haircolor, bylevel etc
Printable View
No unsigned char. Like gender, hair, haircolor, bylevel etc
I'll give you my sources but don't be affraid by gameserver lol
Uffff 545 hours google on how to convert std::string to WCHAR and still didnt found a function -.- fack mi lif
I did now std::string to std::wstring and then I used c_str() :laugh:
- - - Updated - - -
http://www.youtube.com/watch?v=C-4T64htHCU
perfect.
But for some reason the delete function doesnt work? The client dont send socket or something to the server after I enter password to delete the character
Hello everyone.
As stupid as this sounds, I really would like to help out with the game. I know very little about C++, Java, Runtime, and the other key components in helping to push this game forward.
But I am working with Dreamweaver and other stuff. Don't know if that will be handy at the moment. But I would like to try and help out in someway.
I also never worked with c++.. I just google google google google leach leach copy & paste. And it works xd
- - - Updated - - -
Opened ntlpacketgu/ug and I want to kill myself now.
@Arnie36
can you tell us :how to make npc in offline@@??????????????????????
- - - Updated - - -
@Arnie36
NPC's spawning
How to spawan all npc's
As you may have noticed the mini map of the client shows the
location of npc's even when there not spwawaned,this means the
client already knows where they should to be.
so just use your common sense and look in the source how the client
reads in the positions of thoser npc's and repeat that process in your server.
how???_? ]
source=client source?_?
Did u try what i've send you ?
? I deleted all messages and didnt receive one from you
- - - Updated - - -
Atidot3 Im sorry to tell you but you should rework the auth and char server :/ The query solution is very bad and uses over 200% more resources than mine. On a server where like 100 people log in the same time the server could crash.
And in your gameserver are functions which are for charserver ( UC_CHARACTER_LOAD_REQ )
- - - Updated - - -
at
mysqlquery.cpp inside charserver
(unsigned char)Quote:
sPcDataSummary->byRace = (unsigned char)res->getInt("byRace");
^ is not needed.
and only to load the amount of chars you have this
while I have for everything neededCode:char* quert = new char[strlen("SELECT charid FROM Characters WHERE AccountID = '") + 2];
char *acid = new char[10];
itoa(accids, acid, 10);
strcpy(quert, "SELECT charid FROM Characters WHERE AccountID = '");
strncat(quert, acid, 1);
strncat(quert, "'\0", 1);
sql::ResultSet *res;
stmt = con->createStatement();
res = stmt->executeQuery(quert);
int nmb = res->rowsCount();
int i = 0;
while (res->next())
{
charac[i] = res->getInt("charid");
i++;
}
if (nmb > 0)
return nmb;
else
return 0;
and your create charCode:app->db->prepare("SELECT * FROM characters WHERE AccountID = ?");
app->db->setInt(1, req->accountId);
app->db->execute();
cout << " TOTAL CHARACTERS: " << app->db->rowsCount() << endl;
// character info
CNtlPacket packet(sizeof(sCU_CHARACTER_INFO));
sCU_CHARACTER_INFO * res = (sCU_CHARACTER_INFO *)packet.GetPacketData();
res->wOpCode = CU_CHARACTER_INFO;
res->byCount = (int)app->db->rowsCount();
for ( int i = 0; i < (int)app->db->rowsCount(); i++ ) {
app->db->fetch();
memcpy(res->sPcData[i].awchName, s2ws(app->db->getString("CharName")).c_str(), sizeof(wchar_t)* NTL_MAX_SIZE_CHAR_NAME_UNICODE);
res->sPcData[i].charId = app->db->getInt("CharID");
res->sPcData[i].byRace = app->db->getInt("Race");
res->sPcData[i].byClass = app->db->getInt("Class");
res->sPcData[i].bIsAdult = app->db->getBoolean("Adult");
res->sPcData[i].byGender = app->db->getInt("Gender");
res->sPcData[i].byFace = app->db->getInt("Face");
res->sPcData[i].byHair = app->db->getInt("Hair");
res->sPcData[i].byHairColor = app->db->getInt("HairColor");
res->sPcData[i].bySkinColor = app->db->getInt("SkinColor");
res->sPcData[i].byLevel = app->db->getInt("Level");
res->sPcData[i].bTutorialFlag = app->db->getBoolean("TutorialFlag");
res->sPcData[i].bNeedNameChange = app->db->getBoolean("NameChange");
}
I only have for everythingCode:char *username = new char[32];
size_t userSize = wcslen(sPcDataSummary->awchName);
wcstombs(username, sPcDataSummary->awchName, userSize);
sql::PreparedStatement *prep1 = this->con->prepareStatement("INSERT INTO CHARACTERS (awchName,AccountID,byRace,byClass,bIsAdult,byGender,byFace,byHair,byHairColor,bySkinColor,byLevel,worldTblidx,worldId,fPositionX,fPositionY,fPositionZ,dwMoney,dwMoneyBank,sItem,dwMapInfoIndex,bTutorialFlag,sMarking,bNeedNameChange) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
if (prep1 == NULL)
{
printf("NULL VALUE CharCreate\n");
return 1;
}
int byRace = (int)sPcDataSummary->byRace;
int byClass = (int)sPcDataSummary->byClass;
int byGender = (int)sPcDataSummary->byGender;
int byHair = (int)sPcDataSummary->byHair;
int byHairColor = (int)sPcDataSummary->byHairColor;
int bySkinColor = (int)sPcDataSummary->bySkinColor;
int byLevel = (int)sPcDataSummary->byLevel;
int byFace = (int)sPcDataSummary->byFace;
double fPositionX =0.0;
fPositionX = sPcDataSummary->fPositionX;
double fPositionY =0.0;
fPositionX = sPcDataSummary->fPositionY;
double fPositionZ =0.0;
fPositionX = sPcDataSummary->fPositionZ;
char dwMapInfoIndex [11];
_ultoa_s(sPcDataSummary->dwMapInfoIndex,dwMapInfoIndex,sizeof(dwMapInfoIndex),10);
sql::SQLString usernames = username;
prep1->setString(1, usernames);
prep1->setUInt(2, accids);
prep1->setUInt(3, byRace);
prep1->setUInt(4, byClass);
prep1->setBoolean(5, sPcDataSummary->bIsAdult);
prep1->setUInt(6, byGender);
prep1->setUInt(7, byFace);
prep1->setUInt(8, byHair);
prep1->setUInt(9, byHairColor);
prep1->setUInt(10, bySkinColor);
prep1->setUInt(11, byLevel);
prep1->setUInt(12, sPcDataSummary->worldTblidx);
prep1->setUInt(13, sPcDataSummary->worldId);
prep1->setDouble(14, sPcDataSummary->fPositionX);
prep1->setDouble(15, sPcDataSummary->fPositionY);
prep1->setDouble(16, sPcDataSummary->fPositionZ);
prep1->setDouble(17, sPcDataSummary->dwMoney);
prep1->setDouble(18, sPcDataSummary->dwMoneyBank);
prep1->setString(19, "osef");
prep1->setString(20, dwMapInfoIndex);
prep1->setBoolean(21, sPcDataSummary->bTutorialFlag);
prep1->setString(22, "osef");
prep1->setBoolean(23, sPcDataSummary->bNeedNameChange);
prep1->executeQuery();
prep1->close();
delete prep1;
char* quert = new char[strlen("SELECT charid FROM Characters WHERE awchName = '") + strlen(username) + 2];
strcpy(quert, "SELECT charid FROM Characters WHERE awchName = '");
strncat(quert, username, userSize);
strncat(quert, "'\0", 1);
sql::ResultSet *res;
sql::Statement *stmt;
stmt = con->createStatement();
res = stmt->executeQuery(quert);
while (res->next())
{
sPcDataSummary->charId = res->getInt("charid");
}
res->close();
stmt->close();
delete stmt;
delete res;
return 0;
Code:sUC_CHARACTER_ADD_REQ * req = (sUC_CHARACTER_ADD_REQ*)pPacket->GetPacketData();
printf("--- CHARACTER ADD REQUEST --- \n");
app->db->prepare("CALL CharCreate (?,?,?,?,?,?,?,?, @CharId, @wResultCode)");
app->db->setString(1, Ntl_WC2MB(req->awchCharName));
app->db->setInt(2, req->byRace);
app->db->setInt(3, req->byClass);
app->db->setInt(4, req->byGender);
app->db->setInt(5, req->byFace);
app->db->setInt(6, req->byHair);
app->db->setInt(7, req->byHairColor);
app->db->setInt(8, req->bySkinColor);
app->db->execute();
app->db->execute("SELECT @CharId, @wResultCode");
app->db->fetch();
cout << "CHAR ID: " << app->db->print( @CharId")
<< " RESULT CODE: " << app->db->print("@wResultCode")
<< endl;
CNtlPacket packet(sizeof(sCU_CHARACTER_ADD_RES));
sCU_CHARACTER_ADD_RES * res = (sCU_CHARACTER_ADD_RES *)packet.GetPacketData();
res->wOpCode = CU_CHARACTER_ADD_RES;
res->wResultCode = app->db->getInt("@wResultCode");
if (res->wResultCode != 200) {
packet.SetPacketLen( sizeof(sCU_CHARACTER_ADD_RES) );
int rc = g_pApp->Send( this->GetHandle(), &packet );
cout << " RESULT CODE: " << res->wResultCode << endl;
}else{
res->sPcDataSummary.charId = app->db->getInt( @CharId");
memcpy(res->sPcDataSummary.awchName, req->awchCharName, sizeof(wchar_t)* NTL_MAX_SIZE_CHAR_NAME_UNICODE);
res->sPcDataSummary.byRace = req->byRace;
res->sPcDataSummary.byClass = req->byClass;
res->sPcDataSummary.bIsAdult = false;
res->sPcDataSummary.byGender = req->byGender;
res->sPcDataSummary.byFace = req->byFace;
res->sPcDataSummary.byHair = req->byHair;
res->sPcDataSummary.byHairColor = req->byHairColor;
res->sPcDataSummary.bySkinColor = req->bySkinColor;
res->sPcDataSummary.byLevel = 1;
res->sPcDataSummary.worldId = 1;
res->sPcDataSummary.fPositionX = 0.0;
res->sPcDataSummary.fPositionY = 0.0;
res->sPcDataSummary.fPositionZ = 0.0;
res->sPcDataSummary.dwMoney = 0;
res->sPcDataSummary.dwMoneyBank = 0;
packet.SetPacketLen( sizeof(sCU_CHARACTER_ADD_RES) );
int rc = g_pApp->Send( this->GetHandle(), &packet );
The compilator convert automaticaly but a cast is still better, i know i'll remake my function when i'll be back
Are you able to log into the game with the gameserver?