void CInputDB::PlayerCreateSuccess(LPDESC d, const char * data)
{
if (!d)
return;
TPacketDGCreateSuccess * pPacketDB = (TPacketDGCreateSuccess *)data;
if (pPacketDB->bAccountCharacterIndex >= PLAYER_PER_ACCOUNT)
{
d->Packet(encode_byte(HEADER_GC_CHARACTER_CREATE_FAILURE), 1);
return;
}
long lIndex = 0;
if (!CMapLocation::instance().Get(pPacketDB->player.x,
pPacketDB->player.y,
lIndex,
pPacketDB->player.lAddr,
pPacketDB->player.wPort))
{
sys_err("InputDB::PlayerCreateSuccess: cannot find server for mapindex %d %d x %d (name %s)",
lIndex,
pPacketDB->player.x,
pPacketDB->player.y,
pPacketDB->player.szName);
}
TAccountTable & r_Tab = d->GetAccountTable();
r_Tab.players[pPacketDB->bAccountCharacterIndex] = pPacketDB->player;
TPacketGCPlayerCreateSuccess pack;
pack.header = HEADER_GC_CHARACTER_CREATE_SUCCESS;
pack.bAccountCharacterIndex = pPacketDB->bAccountCharacterIndex;
pack.player = pPacketDB->player;
d->Packet(&pack, sizeof(TPacketGCPlayerCreateSuccess));
// 기본 무기와 귀환부를 지급
TPlayerItem t;
memset(&t, 0, sizeof(t));
//baslangic item verme
t.owner = r_Tab.players[pPacketDB->bAccountCharacterIndex].dwID;
struct SInitialItem
{
BYTE window;
BYTE pos;
DWORD count;
DWORD dwVnum;
long socket0;
long socket1;
long socket2;
long socket3;
long socket4;
long socket5;
};
const int MAX_INITIAL_ITEM = 10;
static SInitialItem initialItems[JOB_MAX_NUM][MAX_INITIAL_ITEM] =
{
// {window_type, envanterdeki yeri, adeti, item_vnum, socket0, socket1, socket2, socket3, socket4, socket5, socket6}
{
// WARRIOR
{EQUIPMENT, 0, 1, 11207, 0, 0, 0, 0, 0, 0}, // Zirh
{EQUIPMENT, 1, 1, 12207, 0, 0, 0, 0, 0, 0}, // Kafalik
{EQUIPMENT, 2, 1, 15007, 0, 0, 0, 0, 0, 0}, // Ayakkabi
{EQUIPMENT, 3, 1, 14007, 0, 0, 0, 0, 0, 0}, // Bilezik
{EQUIPMENT, 4, 1, 17, 0, 0, 0, 0, 0, 0}, // Silah
{EQUIPMENT, 5, 1, 16007, 0, 0, 0, 0, 0, 0}, // Kolye
{EQUIPMENT, 6, 1, 17007, 0, 0, 0, 0, 0, 0}, // Küpe
{EQUIPMENT, 10, 1, 13007, 0, 0, 0, 0, 0, 0}, // Kalkan
{INVENTORY, 0, 1, 50187, 0, 0, 0, 0, 0, 0}, //Cirak sandigi
},
{
// ASSASSIN
{EQUIPMENT, 0, 1, 11407, 0, 0, 0, 0, 0, 0}, // Zirh
{EQUIPMENT, 1, 1, 12347, 0, 0, 0, 0, 0, 0}, // Kafalik
{EQUIPMENT, 2, 1, 15007, 0, 0, 0, 0, 0, 0}, // Ayakkabi
{EQUIPMENT, 3, 1, 14007, 0, 0, 0, 0, 0, 0}, // Bilezik
{EQUIPMENT, 4, 1, 1007, 0, 0, 0, 0, 0, 0}, // Silah
{EQUIPMENT, 5, 1, 16007, 0, 0, 0, 0, 0, 0}, // Kolye
{EQUIPMENT, 6, 1, 17007, 0, 0, 0, 0, 0, 0}, // Küpe
{EQUIPMENT, 10, 1, 13007, 0, 0, 0, 0, 0, 0}, // Kalkan
{INVENTORY, 0, 1, 50212, 0, 0, 0, 0, 0, 0}, //Cirak sandigi
},
{
// SURA
{EQUIPMENT, 0, 1, 11607, 0, 0, 0, 0, 0, 0}, // Zirh
{EQUIPMENT, 1, 1, 12487, 0, 0, 0, 0, 0, 0}, // Kafalik
{EQUIPMENT, 2, 1, 15007, 0, 0, 0, 0, 0, 0}, // Ayakkabi
{EQUIPMENT, 3, 1, 14007, 0, 0, 0, 0, 0, 0}, // Bilezik
{EQUIPMENT, 4, 1, 17, 0, 0, 0, 0, 0, 0}, // Silah
{EQUIPMENT, 5, 1, 16007, 0, 0, 0, 0, 0, 0}, // Kolye
{EQUIPMENT, 6, 1, 17007, 0, 0, 0, 0, 0, 0}, // Küpe
{EQUIPMENT, 10, 1, 13007, 0, 0, 0, 0, 0, 0}, // Kalkan
{INVENTORY, 0, 1, 50187, 0, 0, 0, 0, 0, 0}, //Cirak sandigi
},
{
// SHAMAN
{EQUIPMENT, 0, 1, 11807, 0, 0, 0, 0, 0, 0}, // Zirh
{EQUIPMENT, 1, 1, 12627, 0, 0, 0, 0, 0, 0}, // Kafalik
{EQUIPMENT, 2, 1, 15007, 0, 0, 0, 0, 0, 0}, // Ayakkabi
{EQUIPMENT, 3, 1, 14007, 0, 0, 0, 0, 0, 0}, // Bilezik
{EQUIPMENT, 4, 1, 7007, 0, 0, 0, 0, 0, 0}, // Silah
{EQUIPMENT, 5, 1, 16007, 0, 0, 0, 0, 0, 0}, // Kolye
{EQUIPMENT, 6, 1, 17007, 0, 0, 0, 0, 0, 0}, // Küpe
{EQUIPMENT, 10, 1, 13007, 0, 0, 0, 0, 0, 0}, // Kalkan
{INVENTORY, 0, 1, 50213, 0, 0, 0, 0, 0, 0}, //Cirak sandigi
}
};
unsigned job = pPacketDB->player.byJob;
RaceToJob(job, &job);
for (int i = 0; i < MAX_INITIAL_ITEM; i++)
{
if (initialItems[job][i].dwVnum == 0)
continue;
t.id = ITEM_MANAGER::instance().GetNewID();
t.window = initialItems[job][i].window;
t.pos = initialItems[job][i].pos;
t.count = initialItems[job][i].count;
t.vnum = initialItems[job][i].dwVnum;
t.alSockets[0] = initialItems[job][i].socket0;
t.alSockets[1] = initialItems[job][i].socket1;
t.alSockets[2] = initialItems[job][i].socket2;
t.alSockets[3] = initialItems[job][i].socket3;
t.alSockets[4] = initialItems[job][i].socket4;
t.alSockets[5] = initialItems[job][i].socket5;
db_clientdesc->DBPacketHeader(HEADER_GD_ITEM_SAVE, 0, sizeof(TPlayerItem));
db_clientdesc->Packet(&t, sizeof(TPlayerItem));
}
//baslangic item verme bitis
LogManager::instance().CharLog(pack.player.dwID, 0, 0, 0, "CREATE PLAYER", "", d->GetHostName());
}