本文整理汇总了C++中CCharEntity::pushPacket方法的典型用法代码示例。如果您正苦于以下问题:C++ CCharEntity::pushPacket方法的具体用法?C++ CCharEntity::pushPacket怎么用?C++ CCharEntity::pushPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCharEntity
的用法示例。
在下文中一共展示了CCharEntity::pushPacket方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveStatusEffect
void CStatusEffectContainer::RemoveStatusEffect(uint32 id, bool silent)
{
CStatusEffect* PStatusEffect = m_StatusEffectList.at(id);
if (PStatusEffect->GetStatusID() >= EFFECT_FIRE_MANEUVER &&
PStatusEffect->GetStatusID() <= EFFECT_DARK_MANEUVER &&
m_POwner->objtype == TYPE_PC)
{
puppetutils::CheckAttachmentsForManeuver((CCharEntity*)m_POwner, PStatusEffect->GetStatusID(), false);
}
m_StatusEffectList.erase(m_StatusEffectList.begin() + id);
luautils::OnEffectLose(m_POwner, PStatusEffect);
m_POwner->delModifiers(&PStatusEffect->modList);
m_POwner->UpdateHealth();
if (m_POwner->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_POwner;
if (PStatusEffect->GetIcon() != 0)
{
UpdateStatusIcons();
if (silent == false)
{
PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, PStatusEffect->GetIcon(), 0, 206));
}
}
//check for latents
PChar->PLatentEffectContainer->CheckLatentsFoodEffect();
PChar->PLatentEffectContainer->CheckLatentsStatusEffect();
PChar->PLatentEffectContainer->CheckLatentsRollSong(HasStatusEffectByFlag(EFFECTFLAG_SONG | EFFECTFLAG_ROLL));
PChar->UpdateHealth();
PChar->pushPacket(new CCharHealthPacket(PChar));
PChar->pushPacket(new CCharSyncPacket(PChar));
}
else
{
if (silent == false && PStatusEffect->GetIcon() != 0 && ((PStatusEffect->GetFlag() & EFFECTFLAG_NO_LOSS_MESSAGE) == 0) && !m_POwner->isDead())
{
m_POwner->loc.zone->PushPacket(m_POwner, CHAR_INRANGE, new CMessageBasicPacket(m_POwner, m_POwner, PStatusEffect->GetIcon(), 0, 206));
}
}
delete PStatusEffect;
}
示例2: DisbandParty
void CParty::DisbandParty()
{
DisableSync();
SetQuaterMaster(NULL);
m_PLeader = NULL;
m_PAlliance = NULL;
if (m_PartyType == PARTY_PCS)
{
PushPacket(NULL, 0, new CPartyDefinePacket(NULL));
for (uint8 i = 0; i < members.size(); ++i)
{
CCharEntity* PChar = (CCharEntity*)members.at(i);
PChar->PParty = NULL;
PChar->PLatentEffectContainer->CheckLatentsPartyJobs();
PChar->PLatentEffectContainer->CheckLatentsPartyMembers(members.size());
PChar->PLatentEffectContainer->CheckLatentsPartyAvatar();
PChar->pushPacket(new CPartyMemberUpdatePacket(PChar, 0, PChar->getZone()));
// TODO: TreasurePool должен оставаться у последнего персонажа, но сейчас это не критично
if (PChar->PTreasurePool != NULL &&
PChar->PTreasurePool->GetPoolType() != TREASUREPOOL_ZONE)
{
PChar->PTreasurePool->DelMember(PChar);
PChar->PTreasurePool = new CTreasurePool(TREASUREPOOL_SOLO);
PChar->PTreasurePool->AddMember(PChar);
PChar->PTreasurePool->UpdatePool(PChar);
}
CStatusEffect* sync = PChar->StatusEffectContainer->GetStatusEffect(EFFECT_LEVEL_SYNC);
if (sync && sync->GetDuration() == 0)
{
PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, 0, 30, 553));
sync->SetStartTime(gettick());
sync->SetDuration(30000);
}
}
Sql_Query(SqlHandle,"UPDATE accounts_sessions SET partyid = %u WHERE partyid = %u", 0, m_PartyID);
}
delete this;
}
示例3: RemoveStatusEffect
void CStatusEffectContainer::RemoveStatusEffect(uint32 id, bool silent)
{
CStatusEffect* PStatusEffect = m_StatusEffectList.at(id);
m_StatusEffectList.erase(m_StatusEffectList.begin() + id);
luautils::OnEffectLose(m_POwner, PStatusEffect);
m_POwner->delModifiers(&PStatusEffect->modList);
m_POwner->UpdateHealth();
if (m_POwner->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_POwner;
if (PStatusEffect->GetIcon() != 0)
{
UpdateStatusIcons();
if (silent == false)
{
PChar->pushPacket(new CMessageBasicPacket(PChar, PChar, PStatusEffect->GetIcon(), 0, 206));
}
}
//check for latents
CLatentEffectContainer* PLatentEffectContainer;
PChar->PLatentEffectContainer->CheckLatentsFoodEffect();
PChar->PLatentEffectContainer->CheckLatentsStatusEffect();
PChar->UpdateHealth();
if (PChar->status == STATUS_NORMAL) PChar->status = STATUS_UPDATE;
PChar->pushPacket(new CCharHealthPacket(PChar));
PChar->pushPacket(new CCharSyncPacket(PChar));
}
else
{
if (silent == false && PStatusEffect->GetIcon() != 0 && ((PStatusEffect->GetFlag() & EFFECTFLAG_NO_LOSS_MESSAGE) == 0) && !m_POwner->isDead())
{
m_POwner->loc.zone->PushPacket(m_POwner, CHAR_INRANGE, new CMessageBasicPacket(m_POwner, m_POwner, PStatusEffect->GetIcon(), 0, 206));
}
}
delete PStatusEffect;
}
示例4: ReloadParty
void CParty::ReloadParty()
{
//alliance
if (this->m_PAlliance != NULL)
{
CAlliance* ourAlliance = this->m_PAlliance;
for (uint8 a = 0; a < ourAlliance->partyList.size(); ++a)
{
for (uint8 i = 0; i < ourAlliance->partyList.at(a)->members.size(); ++i)
{
CCharEntity* PChar = (CCharEntity*)ourAlliance->partyList.at(a)->members.at(i);
PChar->pushPacket(new CPartyDefinePacket(ourAlliance->partyList.at(a)));
for (uint8 y = 0; y < ourAlliance->partyList.at(a)->members.size(); ++y)
{
PChar->pushPacket(new CPartyMemberUpdatePacket((CCharEntity*)ourAlliance->partyList.at(a)->members.at(y),y, PChar->getZone()));
}
}
}
return;
}
//regular party
for (uint8 i = 0; i < members.size(); ++i)
{
CCharEntity* PChar = (CCharEntity*)members.at(i);
PChar->PLatentEffectContainer->CheckLatentsPartyJobs();
PChar->PLatentEffectContainer->CheckLatentsPartyMembers(members.size());
PChar->PLatentEffectContainer->CheckLatentsPartyAvatar();
PChar->pushPacket(new CPartyDefinePacket(this));
for (uint8 y = 0; y < members.size(); ++y)
{
PChar->pushPacket(new CPartyMemberUpdatePacket((CCharEntity*)members.at(y), y, PChar->getZone()));
}
}
}
示例5: DespawnPC
void CZoneEntities::DespawnPC(CCharEntity* PChar)
{
for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it)
{
CCharEntity* PCurrentChar = (CCharEntity*)it->second;
SpawnIDList_t::iterator PC = PCurrentChar->SpawnPCList.find(PChar->id);
if (PC != PCurrentChar->SpawnPCList.end())
{
PCurrentChar->SpawnPCList.erase(PC);
PCurrentChar->pushPacket(new CCharPacket(PChar, ENTITY_DESPAWN, 0));
}
}
}
示例6: SpawnPCs
void CZone::SpawnPCs(CCharEntity* PChar)
{
for (EntityList_t::const_iterator it = m_charList.begin() ; it != m_charList.end() ; ++it)
{
CCharEntity* PCurrentChar = (CCharEntity*)it->second;
SpawnIDList_t::iterator PC = PChar->SpawnPCList.find(PCurrentChar->id);
if (PChar != PCurrentChar)
{
if(distance(PChar->loc.p, PCurrentChar->loc.p) < 50)
{
if( PC == PChar->SpawnPCList.end() )
{
PChar->SpawnPCList[PCurrentChar->id] = PCurrentChar;
PChar->pushPacket(new CCharPacket(PCurrentChar,ENTITY_SPAWN));
PChar->pushPacket(new CCharSyncPacket(PCurrentChar));
PCurrentChar->SpawnPCList[PChar->id] = PChar;
PCurrentChar->pushPacket(new CCharPacket(PChar,ENTITY_SPAWN));
PCurrentChar->pushPacket(new CCharSyncPacket(PChar));
}else{
PCurrentChar->pushPacket(new CCharPacket(PChar,ENTITY_UPDATE));
}
} else {
if( PC != PChar->SpawnPCList.end() )
{
PChar->SpawnPCList.erase(PC);
PChar->pushPacket(new CCharPacket(PCurrentChar,ENTITY_DESPAWN));
PCurrentChar->SpawnPCList.erase(PChar->id);
PCurrentChar->pushPacket(new CCharPacket(PChar,ENTITY_DESPAWN));
}
}
}
}
}
示例7: PushMessage
void CState::PushMessage(MSGBASIC_ID msgID, int32 param, int32 value)
{
CBattleEntity* PTarget = m_PTarget;
// always need an entity sent
if(PTarget == NULL)
{
PTarget = m_PEntity;
}
if(m_PEntity->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_PEntity;
PChar->pushPacket(new CMessageBasicPacket(PChar,PTarget,param,value,msgID));
}
m_PEntity->loc.zone->PushPacket(m_PEntity, CHAR_INRANGE, new CMessageBasicPacket(m_PEntity,PTarget,param,value,msgID));
}
示例8: RemoveMemberByName
void CLinkshell::RemoveMemberByName(int8* MemberName)
{
PROFILE_FUNC();
for (uint32 i = 0; i < members.size(); ++i)
{
if (strcmp(MemberName, members.at(i)->GetName()) == 0)
{
CCharEntity* PMember = (CCharEntity*)members.at(i);
CItemLinkshell* PItemLinkshell = (CItemLinkshell*)PMember->getStorage(LOC_INVENTORY)->GetItem(PMember->equip[SLOT_LINK]);
if (PItemLinkshell != NULL && PItemLinkshell->isType(ITEM_LINKSHELL))
{
linkshell::DelOnlineMember(PMember, PItemLinkshell);
PItemLinkshell->setSubType(ITEM_UNLOCKED);
PMember->equip[SLOT_LINK] = 0;
PMember->nameflags.flags &= ~FLAG_LINKSHELL;
PMember->pushPacket(new CInventoryAssignPacket(PItemLinkshell, INV_NORMAL));
PMember->pushPacket(new CLinkshellEquipPacket(PMember));
}
CItemContainer* Inventory = PMember->getStorage(LOC_INVENTORY);
for (uint8 SlotID = 0; SlotID < Inventory->GetSize(); ++SlotID)
{
CItemLinkshell* PItemLinkshell = (CItemLinkshell*)Inventory->GetItem(SlotID);
if (PItemLinkshell != NULL && PItemLinkshell->isType(ITEM_LINKSHELL) && PItemLinkshell->GetLSID() == m_id)
{
const int8* Query = "UPDATE char_inventory SET itemid = (itemid+2) WHERE charid = %u AND location = %u AND slot = %u LIMIT 1";
Sql_Query(SqlHandle, Query, PMember->id, LOC_INVENTORY, SlotID);
PItemLinkshell->SetLSID(0);
PItemLinkshell->setID(PItemLinkshell->getID() + 2);
PMember->pushPacket(new CInventoryItemPacket(PItemLinkshell, LOC_INVENTORY, SlotID));
}
}
charutils::SaveCharStats(PMember);
charutils::SaveCharEquip(PMember);
if (PMember->status == STATUS_NORMAL) PMember->status = STATUS_UPDATE;
PMember->pushPacket(new CInventoryFinishPacket());
PMember->pushPacket(new CCharUpdatePacket(PMember));
PMember->pushPacket(new CMessageSystemPacket(0,0,109));
return;
}
}
}
示例9: PushError
void CState::PushError(MSGBASIC_ID msgID, int32 param, int32 value)
{
PROFILE_FUNC();
if(m_PEntity->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_PEntity;
CBattleEntity* PTarget = m_PTarget;
// always need an entity sent
if(PTarget == NULL)
{
PTarget = m_PEntity;
}
PChar->pushPacket(new CMessageBasicPacket(PChar,PTarget,param,value,msgID));
}
}
示例10: PushPacket
void CParty::PushPacket(CCharEntity* PPartyMember, uint8 ZoneID, CBasicPacket* packet)
{
for (uint32 i = 0; i < members.size(); ++i)
{
if(members.at(i)->objtype != TYPE_PC) continue;
CCharEntity* member = (CCharEntity*)members.at(i);
if (member != PPartyMember &&
member->status != STATUS_DISAPPEAR &&
!jailutils::InPrison(member) )
{
if (ZoneID == 0 || member->getZone() == ZoneID)
{
member->pushPacket(new CBasicPacket(*packet));
}
}
}
delete packet;
}
示例11: RefreshSync
void CParty::RefreshSync()
{
CCharEntity* sync = (CCharEntity*)m_PSyncTarget;
uint8 syncLevel = sync->jobs.job[sync->GetMJob()];
if (syncLevel < 10)
{
SetSyncTarget(NULL, 554);
}
for (uint32 i = 0; i < members.size(); ++i)
{
if(members.at(i)->objtype != TYPE_PC) continue;
CCharEntity* member = (CCharEntity*)members.at(i);
uint8 NewMLevel = 0;
if (syncLevel < member->jobs.job[member->GetMJob()])
{
NewMLevel = syncLevel;
}else{
NewMLevel = member->jobs.job[member->GetMJob()];
}
if (member->GetMLevel() != NewMLevel)
{
charutils::RemoveAllEquipMods(member);
member->SetMLevel(NewMLevel);
member->SetSLevel(member->jobs.job[member->GetSJob()]);
charutils::ApplyAllEquipMods(member);
blueutils::ValidateBlueSpells(member);
charutils::BuildingCharSkillsTable(member);
charutils::CalculateStats(member);
charutils::BuildingCharTraitsTable(member);
charutils::BuildingCharAbilityTable(member);
charutils::CheckValidEquipment(member); // Handles rebuilding weapon skills as well.
}
member->pushPacket(new CMessageBasicPacket(member, member, 0, syncLevel, 540));
}
m_PSyncTarget = sync;
}
示例12: CharAfterFinish
void CMagicState::CharAfterFinish()
{
if(m_PEntity->objtype != TYPE_PC)
{
return;
}
CCharEntity* PChar = (CCharEntity*)m_PEntity;
charutils::RemoveStratagems(PChar, m_PSpell);
charutils::UpdateHealth(PChar);
// only skill up if the effect landed
if(m_PSpell->tookEffect()){
charutils::TrySkillUP(PChar, (SKILLTYPE)m_PSpell->getSkillType(), m_PTarget->GetMLevel());
if (m_PSpell->getSkillType() == SKILL_SNG)
{
CItemWeapon* PItem = (CItemWeapon*)PChar->getEquip(SLOT_RANGED);
if (PItem && PItem->isType(ITEM_ARMOR))
{
SKILLTYPE Skilltype = (SKILLTYPE)PItem->getSkillType();
if (Skilltype == SKILL_STR || Skilltype == SKILL_WND || Skilltype == SKILL_SNG)
{
charutils::TrySkillUP(PChar, Skilltype, m_PTarget->GetMLevel());
}
}
}
}
PChar->pushPacket(new CCharUpdatePacket(PChar));
// make wyvern use breath
if(PChar->PPet!=NULL && ((CPetEntity*)PChar->PPet)->getPetType() == PETTYPE_WYVERN)
{
((CAIPetDummy*)PChar->PPet->PBattleAI)->m_MasterCommand = MASTERCOMMAND_HEALING_BREATH;
PChar->PPet->PBattleAI->SetCurrentAction(ACTION_MOBABILITY_START);
}
SetHiPCLvl(m_PTarget, PChar->GetMLevel());
}
示例13: PushError
void CState::PushError(MSGBASIC_ID msgID, int32 param, int32 value, CBattleEntity* PTarget)
{
if(m_PEntity->objtype == TYPE_PC)
{
CCharEntity* PChar = (CCharEntity*)m_PEntity;
// always need an entity sent
if(PTarget == nullptr)
{
if(m_PTarget != nullptr)
{
PTarget = m_PTarget;
}
else
{
PTarget = m_PEntity;
}
}
PChar->pushPacket(new CMessageBasicPacket(PChar,PTarget,param,value,msgID));
}
}
示例14: InsertPET
void CZone::InsertPET(CBaseEntity* PPet)
{
if ((PPet != NULL) && (PPet->objtype == TYPE_PET))
{
uint16 targid = 0x700;
for (EntityList_t::const_iterator it = m_petList.begin() ; it != m_petList.end() ; ++it)
{
if (targid != it->first)
{
break;
}
targid++;
}
if (targid >= 0x800)
{
ShowError(CL_RED"CZone::InsertPET : targid is high (03hX)\n" CL_RESET, targid);
return;
}
PPet->id = 0x1000000 + (m_zoneID << 12) + targid;
PPet->targid = targid;
PPet->loc.zone = this;
m_petList[PPet->targid] = PPet;
for (EntityList_t::const_iterator it = m_charList.begin() ; it != m_charList.end() ; ++it)
{
CCharEntity* PCurrentChar = (CCharEntity*)it->second;
if(distance(PPet->loc.p, PCurrentChar->loc.p) < 50)
{
PCurrentChar->SpawnPETList[PPet->id] = PPet;
PCurrentChar->pushPacket(new CEntityUpdatePacket(PPet, ENTITY_SPAWN));
}
}
return;
}
ShowError(CL_RED"CZone::InsertPET : entity is not pet\n" CL_RESET);
}
示例15: InsertPET
void CZoneEntities::InsertPET(CBaseEntity* PPet)
{
if (PPet != nullptr)
{
uint16 targid = 0x700;
for (EntityList_t::const_iterator it = m_petList.begin(); it != m_petList.end(); ++it)
{
if (targid != it->first)
{
break;
}
targid++;
}
if (targid >= 0x800)
{
ShowError(CL_RED"CZone::InsertPET : targid is high (03hX)\n" CL_RESET, targid);
return;
}
PPet->id = 0x1000000 + (m_zone->GetID() << 12) + targid;
PPet->targid = targid;
PPet->loc.zone = m_zone;
m_petList[PPet->targid] = PPet;
for (EntityList_t::const_iterator it = m_charList.begin(); it != m_charList.end(); ++it)
{
CCharEntity* PCurrentChar = (CCharEntity*)it->second;
if (distance(PPet->loc.p, PCurrentChar->loc.p) < 50)
{
PCurrentChar->SpawnPETList[PPet->id] = PPet;
PCurrentChar->pushPacket(new CEntityUpdatePacket(PPet, ENTITY_SPAWN, UPDATE_ALL_MOB));
}
}
return;
}
ShowError(CL_RED"CZone::InsertPET : entity is null\n" CL_RESET);
}