本文整理汇总了C++中LPDESC::Packet方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDESC::Packet方法的具体用法?C++ LPDESC::Packet怎么用?C++ LPDESC::Packet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDESC
的用法示例。
在下文中一共展示了LPDESC::Packet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendTargetDeletePacket
void SendTargetDeletePacket(LPDESC d, int iID)
{
TPacketGCTargetDelete pck;
pck.bHeader = HEADER_GC_TARGET_DELETE;
pck.lID = iID;
d->Packet(&pck, sizeof(TPacketGCTargetDelete));
}
示例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: Insert
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
}
示例4: SendTargetUpdatePacket
void SendTargetUpdatePacket(LPDESC d, int iID, int x, int y)
{
TPacketGCTargetUpdate pck;
pck.bHeader = HEADER_GC_TARGET_UPDATE;
pck.lID = iID;
pck.lX = x;
pck.lY = y;
d->Packet(&pck, sizeof(TPacketGCTargetUpdate));
sys_log(0, "SendTargetUpdatePacket %d %dx%d", iID, x, y);
}
示例5: Packet
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));
}
}
示例6: LoginFailure
void LoginFailure(LPDESC d, const char * c_pszStatus)
{
if (!d)
return;
TPacketGCLoginFailure failurePacket;
failurePacket.header = HEADER_GC_LOGIN_FAILURE;
strlcpy(failurePacket.szStatus, c_pszStatus, sizeof(failurePacket.szStatus));
d->Packet(&failurePacket, sizeof(failurePacket));
}
示例7: SendAffectAddPacket
void SendAffectAddPacket(LPDESC d, CAffect * pkAff)
{
TPacketGCAffectAdd ptoc;
ptoc.bHeader = HEADER_GC_AFFECT_ADD;
ptoc.elem.dwType = pkAff->dwType;
ptoc.elem.bApplyOn = pkAff->bApplyOn;
ptoc.elem.lApplyValue = pkAff->lApplyValue;
ptoc.elem.dwFlag = pkAff->dwFlag;
ptoc.elem.lDuration = pkAff->lDuration;
ptoc.elem.lSPCost = pkAff->lSPCost;
d->Packet(&ptoc, sizeof(TPacketGCAffectAdd));
}
示例8: EncodeInsertPacket
void CItem::EncodeInsertPacket(LPENTITY ent)
{
LPDESC d;
if (!(d = ent->GetDesc()))
return;
const PIXEL_POSITION & c_pos = GetXYZ();
struct packet_item_ground_add pack;
pack.bHeader = HEADER_GC_ITEM_GROUND_ADD;
pack.x = c_pos.x;
pack.y = c_pos.y;
pack.z = c_pos.z;
pack.dwVnum = GetVnum();
pack.dwVID = m_dwVID;
//pack.count = m_dwCount;
d->Packet(&pack, sizeof(pack));
if (m_pkOwnershipEvent != NULL)
{
item_event_info * info = dynamic_cast<item_event_info *>(m_pkOwnershipEvent->info);
if ( info == NULL )
{
sys_err( "CItem::EncodeInsertPacket> <Factor> Null pointer" );
return;
}
TPacketGCItemOwnership p;
p.bHeader = HEADER_GC_ITEM_OWNERSHIP;
p.dwVID = m_dwVID;
strlcpy(p.szName, info->szOwnerName, sizeof(p.szName));
d->Packet(&p, sizeof(TPacketGCItemOwnership));
}
}
示例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: SendTargetCreatePacket
/////////////////////////////////////////////////////////////////////
// Packet
/////////////////////////////////////////////////////////////////////
void SendTargetCreatePacket(LPDESC d, TargetInfo * info)
{
if (!info->bSendToClient)
return;
TPacketGCTargetCreate pck;
pck.bHeader = HEADER_GC_TARGET_CREATE;
pck.lID = info->iID;
pck.bType = info->iType;
pck.dwVID = info->iArg1;
strlcpy(pck.szName, info->szTargetDesc, sizeof(pck.szName));
d->Packet(&pck, sizeof(TPacketGCTargetCreate));
}
示例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: SendAffectRemovePacket
void SendAffectRemovePacket(LPDESC d, DWORD pid, DWORD type, BYTE point)
{
TPacketGCAffectRemove ptoc;
ptoc.bHeader = HEADER_GC_AFFECT_REMOVE;
ptoc.dwType = type;
ptoc.bApplyOn = point;
d->Packet(&ptoc, sizeof(TPacketGCAffectRemove));
TPacketGDRemoveAffect ptod;
ptod.dwPID = pid;
ptod.dwType = type;
ptod.bApplyOn = point;
db_clientdesc->DBPacket(HEADER_GD_REMOVE_AFFECT, 0, &ptod, sizeof(ptod));
}
示例13: 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());
}
示例14: EncodeRemovePacket
void CObject::EncodeRemovePacket(LPENTITY entity)
{
LPDESC d;
if (!(d = entity->GetDesc()))
return;
sys_log(0, "ObjectRemovePacket vid %u", m_dwVID);
TPacketGCCharacterDelete pack;
pack.header = HEADER_GC_CHARACTER_DEL;
pack.id = m_dwVID;
d->Packet(&pack, sizeof(TPacketGCCharacterDelete));
}
示例15: UpdateLand
void CManager::UpdateLand(TLand * pTable)
{
CLand * pkLand = FindLand(pTable->dwID);
if (!pkLand)
{
sys_err("cannot find land by id %u", pTable->dwID);
return;
}
pkLand->PutData(pTable);
const DESC_MANAGER::DESC_SET & cont = DESC_MANAGER::instance().GetClientSet();
itertype(cont) it = cont.begin();
TPacketGCLandList p;
p.header = HEADER_GC_LAND_LIST;
p.size = sizeof(TPacketGCLandList) + sizeof(TLandPacketElement);
TLandPacketElement e;
e.dwID = pTable->dwID;
e.x = pTable->x;
e.y = pTable->y;
e.width = pTable->width;
e.height = pTable->height;
e.dwGuildID = pTable->dwGuildID;
sys_log(0, "BUILDING: UpdateLand %u pos %dx%d guild %u", e.dwID, e.x, e.y, e.dwGuildID);
CGuild *guild = CGuildManager::instance().FindGuild(pTable->dwGuildID);
while (it != cont.end())
{
LPDESC d = *(it++);
if (d->GetCharacter() && d->GetCharacter()->GetMapIndex() == pTable->lMapIndex)
{
// we must send the guild name first
d->GetCharacter()->SendGuildName(guild);
d->BufferedPacket(&p, sizeof(TPacketGCLandList));
d->Packet(&e, sizeof(TLandPacketElement));
}
}
}