本文整理汇总了C++中LPDESC类的典型用法代码示例。如果您正苦于以下问题:C++ LPDESC类的具体用法?C++ LPDESC怎么用?C++ LPDESC使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LPDESC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: __proc_login_notice
static void __proc_login_notice(char *login, int on_time, int off_time)
{
//{ check player's name
LPDESC desc = DESC_MANAGER::instance().FindByLoginName(login);
if (NULL==desc) return;
LPCHARACTER ch = desc->GetCharacter();
if (NULL==ch) return;
//} check player's name
char on_time_string[64];
char off_time_string[64];
__sec_to_timestring(on_time, on_time_string, sizeof(on_time_string));
__sec_to_timestring(off_time, off_time_string, sizeof(off_time_string));
if (0==on_time)
{
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("당신의 누적 오프라인 시간은 %s입니다."), off_time_string);
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("당신의 누적 온라인 시간은 0이 되었습니다. 100% 효과를 얻으실 수 있습니다."));
return;
}
else
{
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("당신의 누적 오프라인 시간은 %s이며, 누적 온라인 시간은 %s입니다."),
off_time_string, on_time_string);
}
}
示例2: EncodeInsertPacket
void CObject::EncodeInsertPacket(LPENTITY entity)
{
LPDESC d;
if (!(d = entity->GetDesc()))
return;
sys_log(0, "ObjectInsertPacket vid %u vnum %u rot %f %f %f",
m_dwVID, m_data.dwVnum, m_data.xRot, m_data.yRot, m_data.zRot);
TPacketGCCharacterAdd pack;
memset(&pack, 0, sizeof(TPacketGCCharacterAdd));
pack.header = HEADER_GC_CHARACTER_ADD;
pack.dwVID = m_dwVID;
pack.bType = CHAR_TYPE_BUILDING;
pack.angle = m_data.zRot;
pack.x = GetX();
pack.y = GetY();
pack.z = GetZ();
pack.wRaceNum = m_data.dwVnum;
// 빌딩 회전 정보(벽일때는 문 위치)를 변환
pack.dwAffectFlag[0] = unsigned(m_data.xRot);
pack.dwAffectFlag[1] = unsigned(m_data.yRot);
if (GetLand())
{
// pack.dwGuild = GetLand()->GetOwner();
}
d->Packet(&pack, sizeof(pack));
}
示例3: while
void DESC_MANAGER::DestroyClosed()
{
DESC_SET::iterator i = m_set_pkDesc.begin();
while (i != m_set_pkDesc.end())
{
LPDESC d = *i;
DESC_SET::iterator ci = i;
++i;
if (d->IsPhase(PHASE_CLOSE))
{
if (d->GetType() == DESC_TYPE_CONNECTOR)
{
LPCLIENT_DESC client_desc = (LPCLIENT_DESC)d;
if (client_desc->IsRetryWhenClosed())
{
client_desc->Reset();
continue;
}
}
DestroyDesc(d, false);
m_set_pkDesc.erase(ci);
}
}
}
示例4: operator
bool operator () (LPDESC d)
{
if (d->GetCharacter() && !strcmp(d->GetCharacter()->GetName(), m_name))
return true;
return false;
}
示例5: kPVP
void CPVPManager::Insert(LPCHARACTER pkChr, LPCHARACTER pkVictim)
{
if (pkChr->IsDead() || pkVictim->IsDead())
return;
CPVP kPVP(pkChr->GetPlayerID(), pkVictim->GetPlayerID());
CPVP * pkPVP;
if ((pkPVP = Find(kPVP.m_dwCRC)))
{
// 복수할 수 있으면 바로 싸움!
if (pkPVP->Agree(pkChr->GetPlayerID()))
{
pkVictim->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s님과의 대결 시작!"), pkChr->GetName());
pkChr->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s님과의 대결 시작!"), pkVictim->GetName());
}
return;
}
pkPVP = M2_NEW CPVP(kPVP);
pkPVP->SetVID(pkChr->GetPlayerID(), pkChr->GetVID());
pkPVP->SetVID(pkVictim->GetPlayerID(), pkVictim->GetVID());
m_map_pkPVP.insert(map<DWORD, CPVP *>::value_type(pkPVP->m_dwCRC, pkPVP));
m_map_pkPVPSetByID[pkChr->GetPlayerID()].insert(pkPVP);
m_map_pkPVPSetByID[pkVictim->GetPlayerID()].insert(pkPVP);
pkPVP->Packet();
char msg[CHAT_MAX_LEN + 1];
snprintf(msg, sizeof(msg), LC_TEXT("%s님이 대결신청을 했습니다. 승낙하려면 대결동의를 하세요."), pkChr->GetName());
pkVictim->ChatPacket(CHAT_TYPE_INFO, msg);
pkChr->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s에게 대결신청을 했습니다."), pkVictim->GetName());
// NOTIFY_PVP_MESSAGE
LPDESC pkVictimDesc = pkVictim->GetDesc();
if (pkVictimDesc)
{
TPacketGCWhisper pack;
int len = MIN(CHAT_MAX_LEN, strlen(msg) + 1);
pack.bHeader = HEADER_GC_WHISPER;
pack.wSize = sizeof(TPacketGCWhisper) + len;
pack.bType = WHISPER_TYPE_SYSTEM;
strlcpy(pack.szNameFrom, pkChr->GetName(), sizeof(pack.szNameFrom));
TEMP_BUFFER buf;
buf.write(&pack, sizeof(TPacketGCWhisper));
buf.write(msg, len);
pkVictimDesc->Packet(buf.read_peek(), buf.size());
}
// END_OF_NOTIFY_PVP_MESSAGE
}
示例6: Handshake
void CInputProcessor::Handshake(LPDESC d, const char * c_pData)
{
TPacketCGHandshake * p = (TPacketCGHandshake *) c_pData;
if (d->GetHandshake() != p->dwHandshake)
{
sys_err("Invalid Handshake on %d", d->GetSocket());
d->SetPhase(PHASE_CLOSE);
}
else
{
if (d->IsPhase(PHASE_HANDSHAKE))
{
if (d->HandshakeProcess(p->dwTime, p->lDelta, false))
{
#ifdef _IMPROVED_PACKET_ENCRYPTION_
d->SendKeyAgreement();
#else
if (g_bAuthServer)
d->SetPhase(PHASE_AUTH);
else
d->SetPhase(PHASE_LOGIN);
#endif // #ifdef _IMPROVED_PACKET_ENCRYPTION_
}
}
else
d->HandshakeProcess(p->dwTime, p->lDelta, true);
}
}
示例7: sys_err
void CPVP::Packet(bool bDelete)
{
if (!m_players[0].dwVID || !m_players[1].dwVID)
{
if (bDelete)
sys_err("null vid when removing %u %u", m_players[0].dwVID, m_players[0].dwVID);
return;
}
TPacketGCPVP pack;
pack.bHeader = HEADER_GC_PVP;
if (bDelete)
{
pack.bMode = PVP_MODE_NONE;
pack.dwVIDSrc = m_players[0].dwVID;
pack.dwVIDDst = m_players[1].dwVID;
}
else if (IsFight())
{
pack.bMode = PVP_MODE_FIGHT;
pack.dwVIDSrc = m_players[0].dwVID;
pack.dwVIDDst = m_players[1].dwVID;
}
else
{
pack.bMode = m_bRevenge ? PVP_MODE_REVENGE : PVP_MODE_AGREE;
if (m_players[0].bAgree)
{
pack.dwVIDSrc = m_players[0].dwVID;
pack.dwVIDDst = m_players[1].dwVID;
}
else
{
pack.dwVIDSrc = m_players[1].dwVID;
pack.dwVIDDst = m_players[0].dwVID;
}
}
const DESC_MANAGER::DESC_SET & c_rSet = DESC_MANAGER::instance().GetClientSet();
DESC_MANAGER::DESC_SET::const_iterator it = c_rSet.begin();
while (it != c_rSet.end())
{
LPDESC d = *it++;
if (d->IsPhase(PHASE_GAME) || d->IsPhase(PHASE_DEAD))
d->Packet(&pack, sizeof(pack));
}
}
示例8: Handshake
void CInputUDP::Handshake(LPDESC pDesc, const char * c_pData)
{
TPacketCGHandshake * pInfo = (TPacketCGHandshake *) c_pData;
if (pDesc->GetHandshake() == pInfo->dwHandshake)
{
sys_log(0, "UDP: Grant %s:%d", inet_ntoa(m_SockAddr.sin_addr), m_SockAddr.sin_port);
pDesc->UDPGrant(m_SockAddr);
return;
}
else
sys_log(0, "UDP: Handshake differs %s", pDesc->GetHostName());
}
示例9: SendLandList
void CManager::SendLandList(LPDESC d, long lMapIndex)
{
TLandPacketElement e;
TEMP_BUFFER buf;
WORD wCount = 0;
itertype(m_map_pkLand) it = m_map_pkLand.begin();
while (it != m_map_pkLand.end())
{
CLand * pkLand = (it++)->second;
const TLand & r = pkLand->GetData();
if (r.lMapIndex != lMapIndex)
continue;
//
LPCHARACTER ch = d->GetCharacter();
if (ch)
{
CGuild *guild = CGuildManager::instance().FindGuild(r.dwGuildID);
ch->SendGuildName(guild);
}
//
e.dwID = r.dwID;
e.x = r.x;
e.y = r.y;
e.width = r.width;
e.height = r.height;
e.dwGuildID = r.dwGuildID;
buf.write(&e, sizeof(TLandPacketElement));
++wCount;
}
sys_log(0, "SendLandList map %d count %u elem_size: %d", lMapIndex, wCount, buf.size());
if (wCount != 0)
{
TPacketGCLandList p;
p.header = HEADER_GC_LAND_LIST;
p.size = sizeof(TPacketGCLandList) + buf.size();
d->BufferedPacket(&p, sizeof(TPacketGCLandList));
d->Packet(buf.read_peek(), buf.size());
}
}
示例10: PasspodAnswer
void CInputAuth::PasspodAnswer(LPDESC d, const char * c_pData)
{
if (!g_bAuthServer)
{
sys_err ("CInputAuth class is not for game server. IP %s might be a hacker.",
inet_ntoa(d->GetAddr().sin_addr));
d->DelayedDisconnect(5);
return;
}
TPacketCGPasspod * packet = (TPacketCGPasspod*)c_pData;
RequestConfirmPasspod Confirm;
memcpy(Confirm.passpod, packet->szAnswer, MAX_PASSPOD + 1);
memcpy(Confirm.login, d->GetAccountTable().login, LOGIN_MAX_LEN + 1);
if (!d->GetAccountTable().id)
{
sys_err("HEADER_CG_PASSPOD_ANSWER received to desc with no account table binded");
return;
}
int ret_code = 1;
sys_log(0, "Passpod start %s %s", d->GetAccountTable().login, packet->szAnswer);
ret_code = CPasspod::instance().ConfirmPasspod(d->GetAccountTable().login, packet->szAnswer);
if (ret_code != 0)
{
sys_log(0, "PASSPOD: wrong answer: %s ret_code %d", d->GetAccountTable().login, ret_code);
LoginFailure(d, ERR_MESSAGE[ret_code]);
if (!d->CheckMatrixTryCount())
{
LoginFailure(d, "QUIT");
d->SetPhase(PHASE_CLOSE);
}
}
else
{
sys_log(0, "PASSPOD: success: %s", d->GetAccountTable().login);
DBManager::instance().SendAuthLogin(d);
}
// g_PasspodDesc->DBPacket(HEADER_GP_CONFIRM_PASSPOD, 0, &Confirm, sizeof(Confirm));
// sys_log(0, "PASSPOD %s %d", Confirm.login, Confirm.passpod);
}
示例11: SendParameter
void CParty::SendParameter(LPCHARACTER ch)
{
TPacketGCPartyParameter p;
p.bHeader = HEADER_GC_PARTY_PARAMETER;
p.bDistributeMode = m_iExpDistributionMode;
LPDESC d = ch->GetDesc();
if (d)
{
d->Packet(&p, sizeof(TPacketGCPartyParameter));
}
}
示例12: __proc_teen_notice
static void __proc_teen_notice(char *login, int hour)
{
LPDESC desc = DESC_MANAGER::instance().FindByLoginName(login);
if (NULL==desc) return;
LPCHARACTER ch = desc->GetCharacter();
if (NULL==ch) return;
switch (hour)
{
case 0:
{
SET_OVER_TIME(ch, OT_NONE);
return;
}
break;
case 1:
case 2:
{
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("당신의 누적 온라인 시간이 이미 %d시간이 지났습니다."), hour);
SET_OVER_TIME(ch, OT_NONE);
}
break;
case 3:
{
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("당신의 누적 온라인 시간이 이미 %d시간이 되었습니다,"), hour);
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("조속히 접속을 종료하신 후 건강을 위해 휴식을 취해주시기바랍니다."));
SET_OVER_TIME(ch, OT_3HOUR);
}
break;
case 4:
{
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("당신은 이미 게임 피로 상태에 들어섰으며,"));
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("게임 내의 수익이 정상치의 50%로 하향됩니다."));
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("당신의 건강을 위해 조속히 접속을 종료하시고"));
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("휴식 및 학업에 열중해주십시오."));
SET_OVER_TIME(ch, OT_3HOUR);
}
break;
default:
{
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("당신은 이미 온전하지 못한 게임 시간에 들어섰습니다."));
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("건강을 위해 조속히 접속을 종료하신 후 휴식을 취해주십시오,"));
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("그렇지 않으면 건강 상에 피해를 입을 수 있으며 게임 내의 수치는 0이 됩니다."));
ch->ChatPacket(CHAT_TYPE_NOTICE, LC_TEXT("누적 오프라인 시간이 5시간이 되면 정상으로 돌아옵니다."));
SET_OVER_TIME(ch, OT_5HOUR);
}
break;
}
}
示例13: AcceptDesc
LPDESC DESC_MANAGER::AcceptDesc(LPFDWATCH fdw, socket_t s)
{
socket_t desc;
LPDESC newd;
static struct sockaddr_in peer;
static char host[MAX_HOST_LENGTH + 1];
if ((desc = socket_accept(s, &peer)) == -1)
return NULL;
strlcpy(host, inet_ntoa(peer.sin_addr), sizeof(host));
if (g_bAuthServer)
{
if (IsBanIP(peer.sin_addr))
{
sys_log(0, "connection from %s was banned.", host);
socket_close(desc);
return NULL;
}
}
if (!IsValidIP(admin_ip, host)) // admin_ip 에 등록된 IP 는 최대 사용자 수에 구애받지 않는다.
{
if (m_iSocketsConnected >= MAX_ALLOW_USER)
{
sys_err("max connection reached. MAX_ALLOW_USER = %d", MAX_ALLOW_USER);
socket_close(desc);
return NULL;
}
}
newd = M2_NEW DESC;
crc_t handshake = CreateHandshake();
if (!newd->Setup(fdw, desc, peer, ++m_iHandleCount, handshake))
{
socket_close(desc);
M2_DELETE(newd);
return NULL;
}
m_map_handshake.insert(DESC_HANDSHAKE_MAP::value_type(handshake, newd));
m_map_handle.insert(DESC_HANDLE_MAP::value_type(newd->GetHandle(), newd));
m_set_pkDesc.insert(newd);
++m_iSocketsConnected;
return (newd);
}
示例14: EncodeRemovePacket
void CItem::EncodeRemovePacket(LPENTITY ent)
{
LPDESC d;
if (!(d = ent->GetDesc()))
return;
struct packet_item_ground_del pack;
pack.bHeader = HEADER_GC_ITEM_GROUND_DEL;
pack.dwVID = m_dwVID;
d->Packet(&pack, sizeof(pack));
sys_log(2, "Item::EncodeRemovePacket %s to %s", GetName(), ((LPCHARACTER) ent)->GetName());
}
示例15: Analyze
int CInputAuth::Analyze(LPDESC d, BYTE bHeader, const char * c_pData)
{
if (!g_bAuthServer)
{
sys_err ("CInputAuth class is not for game server. IP %s might be a hacker.",
inet_ntoa(d->GetAddr().sin_addr));
d->DelayedDisconnect(5);
return 0;
}
int iExtraLen = 0;
if (test_server)
sys_log(0, " InputAuth Analyze Header[%d] ", bHeader);
switch (bHeader)
{
case HEADER_CG_PONG:
Pong(d);
break;
case HEADER_CG_LOGIN3:
Login(d, c_pData);
break;
//2012.07.19 OpenID : 김용욱
case HEADER_CG_LOGIN5_OPENID:
if (openid_server)
LoginOpenID(d, c_pData);
else
sys_err("HEADER_CG_LOGIN5_OPENID : wrong client access");
break;
case HEADER_CG_PASSPOD_ANSWER:
PasspodAnswer(d, c_pData);
break;
case HEADER_CG_HANDSHAKE:
break;
default:
sys_err("This phase does not handle this header %d (0x%x)(phase: AUTH)", bHeader, bHeader);
break;
}
return iExtraLen;
}