Új karakter hajszín probléma

Indította TrueLev, 2017-07-29, 00:10:58

2017-07-29, 00:10:58 Utolsó szerkesztés: 2017-07-29, 00:38:07 Szerző: TrueLev
Sziasztok

Azt vettem észre ha új karaktert hozok létre aminek 2. alap kinézetet adok meg, akkor a hajszín fehér lesz. Mármint nem úgy fehér hogy szar a textúrája, hanem a fehér hajfestékes fehér textúra.
Bár nem rossz feature ez hogy 2. kinézethez más színű haj jár, viszont mivel nem én raktam be, valami előidézte, ezért mégis szeretném javítani. Igazából olyan régen nem hoztam létre 2. kinézetes karaktert hogy nem tudom mióta van jelen ez a hiba.

Valaki találkozott már vele?

(Tehát  a hiba az hogy karakter létrehozáskor a part_hair-t 1-re teszi ha a part_base is 1)

CClientManager::__QUERY_PLAYER_CREATE:
void CClientManager::__QUERY_PLAYER_CREATE(CPeer *peer, DWORD dwHandle, TPlayerCreatePacket* packet)
{
char queryStr[QUERY_MAX_LEN];
int queryLen;
int player_id;

time_by_id_map_t::iterator it = s_createTimeByAccountID.find(packet->account_id);
if (it != s_createTimeByAccountID.end())
{
time_t curtime = time(0);
if (curtime - it->second < 30)
{
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
return;
}
}

queryLen = snprintf(queryStr, sizeof(queryStr), "SELECT pid%u FROM player_index%s WHERE id=%d", packet->account_index + 1, GetTablePostfix(), packet->account_id);
std::auto_ptr<SQLMsg> pMsg0(CDBManager::instance().DirectQuery(queryStr));
if (pMsg0->Get()->uiNumRows != 0)
{
if (!pMsg0->Get()->pSQLResult)
{
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
return;
}

MYSQL_ROW row = mysql_fetch_row(pMsg0->Get()->pSQLResult);
DWORD dwPID = 0; str_to_number(dwPID, row[0]);
if (row[0] && dwPID > 0)
{
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0);
sys_log(0, "ALREADY EXIST AccountChrIdx %d ID %d", packet->account_index, dwPID);
return;
}
}
else
{
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
return;
}

if (g_stLocale == "sjis")
snprintf(queryStr, sizeof(queryStr), "SELECT COUNT(*) as count FROM player%s WHERE name='%s' collate sjis_japanese_ci", GetTablePostfix(), packet->player_table.name);
else
snprintf(queryStr, sizeof(queryStr), "SELECT COUNT(*) as count FROM player%s WHERE name='%s'", GetTablePostfix(), packet->player_table.name);

std::auto_ptr<SQLMsg> pMsg1(CDBManager::instance().DirectQuery(queryStr));
if (pMsg1->Get()->uiNumRows)
{
if (!pMsg1->Get()->pSQLResult)
{
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
return;
}

MYSQL_ROW row = mysql_fetch_row(pMsg1->Get()->pSQLResult);
if (*row[0] != '0')
{
sys_log(0, "ALREADY EXIST name %s, row[0] %s query %s", packet->player_table.name, row[0], queryStr);
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0);
return;
}
}
else
{
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
return;
}

// queryLen = snprintf(queryStr, sizeof(queryStr),
// "INSERT INTO player%s "
// "(id, account_id, name, level, st, ht, dx, iq, "
// "job, voice, dir, x, y, z, "
// "hp, mp, random_hp, random_sp, stat_point, stamina, part_base, part_main, part_hair, gold, playtime, "
// "skill_level, quickslot) "
// "VALUES(0, %u, '%s', %d, %d, %d, %d, %d, "
// "%d, %d, %d, %d, %d, %d, %d, "
// "%d, %d, %d, %d, %d, %d, %d, 0, %lld, 0, ",
// GetTablePostfix(),
// packet->account_id, packet->player_table.name, packet->player_table.level, packet->player_table.st, packet->player_table.ht, packet->player_table.dx, packet->player_table.iq,
// packet->player_table.job, packet->player_table.voice, packet->player_table.dir, packet->player_table.x, packet->player_table.y, packet->player_table.z,
// packet->player_table.hp, packet->player_table.sp, packet->player_table.sRandomHP, packet->player_table.sRandomSP, packet->player_table.stat_point, packet->player_table.stamina, packet->player_table.part_base, packet->player_table.part_base, packet->player_table.gold);

queryLen = snprintf(queryStr, sizeof(queryStr),
"INSERT INTO player%s ("
"id, "
"account_id, "
"name, "
"level, "
"st, "
"ht, "
"dx, "
"iq, "
"job, "
"voice, "
"dir, "
"x, "
"y, "
"z, "
"hp, "
"mp, "
"random_hp, "
"random_sp, "
"stat_point, "
"stamina, "
"part_base, "
"part_main, "
"part_hair, "
#ifdef __SASH_SYSTEM__
"part_sash, "
#endif
"gold, "
"playtime, "
"skill_level, "
"quickslot"
") VALUES("
"0, "
"%u, "
"'%s', "
"%u, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
"%d, "
#ifdef __SASH_SYSTEM__
"0, "
#endif
// "%d, " //RÉGI GOLD
"%lld, "
"0, "
,
GetTablePostfix(),
packet->account_id,
packet->player_table.name,
packet->player_table.level,
packet->player_table.st,
packet->player_table.ht,
packet->player_table.dx,
packet->player_table.iq,
packet->player_table.job,
packet->player_table.voice,
packet->player_table.dir,
packet->player_table.x,
packet->player_table.y,
packet->player_table.z,
packet->player_table.hp,
packet->player_table.sp,
packet->player_table.sRandomHP,
packet->player_table.sRandomSP,
packet->player_table.stat_point,
packet->player_table.stamina,
packet->player_table.part_base,
packet->player_table.part_base,
packet->player_table.part_base,
packet->player_table.gold
);

sys_log(0, "PlayerCreate accountid %d name %s level %d gold %lld, st %d ht %d job %d",
packet->account_id,
packet->player_table.name,
packet->player_table.level,
packet->player_table.gold,
packet->player_table.st,
packet->player_table.ht,
packet->player_table.job);

static char text[4096 + 1];

CDBManager::instance().EscapeString(text, packet->player_table.skills, sizeof(packet->player_table.skills));
queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s', ", text);
if (g_test_server)
sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text);

CDBManager::instance().EscapeString(text, packet->player_table.quickslot, sizeof(packet->player_table.quickslot));
queryLen += snprintf(queryStr + queryLen, sizeof(queryStr) - queryLen, "'%s')", text);

std::auto_ptr<SQLMsg> pMsg2(CDBManager::instance().DirectQuery(queryStr));
if (g_test_server)
sys_log(0, "Create_Player queryLen[%d] TEXT[%s]", queryLen, text);

if (pMsg2->Get()->uiAffectedRows <= 0)
{
peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_ALREADY, dwHandle, 0);
sys_log(0, "ALREADY EXIST3 query: %s AffectedRows %lu", queryStr, pMsg2->Get()->uiAffectedRows);
return;
}

player_id = pMsg2->Get()->uiInsertID;

snprintf(queryStr, sizeof(queryStr), "UPDATE player_index%s SET pid%d=%d WHERE id=%d", GetTablePostfix(), packet->account_index + 1, player_id, packet->account_id);
std::auto_ptr<SQLMsg> pMsg3(CDBManager::instance().DirectQuery(queryStr));
if (pMsg3->Get()->uiAffectedRows <= 0)
{
sys_err("QUERY_ERROR: %s", queryStr);

snprintf(queryStr, sizeof(queryStr), "DELETE FROM player%s WHERE id=%d", GetTablePostfix(), player_id);
CDBManager::instance().DirectQuery(queryStr);

peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_FAILED, dwHandle, 0);
return;
}

TPacketDGCreateSuccess pack;
memset(&pack, 0, sizeof(pack));

pack.bAccountCharacterIndex = packet->account_index;
pack.player.dwID = player_id;
strlcpy(pack.player.szName, packet->player_table.name, sizeof(pack.player.szName));
pack.player.byJob = packet->player_table.job;
pack.player.byLevel = 1;
pack.player.dwPlayMinutes = 0;
pack.player.byST = packet->player_table.st;
pack.player.byHT = packet->player_table.ht;
pack.player.byDX = packet->player_table.dx;
pack.player.byIQ = packet->player_table.iq;
pack.player.wMainPart = packet->player_table.part_base;
pack.player.x = packet->player_table.x;
pack.player.y = packet->player_table.y;

peer->EncodeHeader(HEADER_DG_PLAYER_CREATE_SUCCESS, dwHandle, sizeof(TPacketDGCreateSuccess));
peer->Encode(&pack, sizeof(TPacketDGCreateSuccess));

sys_log(0, "7 name %s job %d", pack.player.szName, pack.player.byJob);
s_createTimeByAccountID[packet->account_id] = time(0);
}

Valami pedig nem stimmel, mert nálam alap hajjal hozza létre:

Am nálad a query rész mért van kikommentelve? :o


2017-07-29, 00:36:48 #3 Utolsó szerkesztés: 2017-07-29, 01:04:34 Szerző: TrueLev
Mert felül kellett írni az item_scales sash systembe :D
Az alap kódot kikommentezve otthagytam. Jól is tettem, meglett a hiba.
A part_hair értéke nálam %d, alap kódban meg 0.
0-ra visszaírva jó lett.

Tudtam hogy jobb lett volna ha különbséget nézek nem felülírom amikor beteszem a sash systemet :)
(Amúgy csak itt írtam felül az egész kódot, mert a leírástkészítő szépen felsorolásba tette a query-t, az alap kódba meg csak oda van hányva egykupacba :) )

Zárom.