本文整理汇总了C++中LPCHARACTER::ChatPacket方法的典型用法代码示例。如果您正苦于以下问题:C++ LPCHARACTER::ChatPacket方法的具体用法?C++ LPCHARACTER::ChatPacket怎么用?C++ LPCHARACTER::ChatPacket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPCHARACTER
的用法示例。
在下文中一共展示了LPCHARACTER::ChatPacket方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
示例2: __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);
}
}
示例3: IS_SPEED_HACK
bool IS_SPEED_HACK(LPCHARACTER ch, LPCHARACTER victim, DWORD current_time)
{
if (ch->m_kAttackLog.dwVID == victim->GetVID())
{
if (current_time - ch->m_kAttackLog.dwTime < GET_ATTACK_SPEED(ch))
{
INCREASE_SPEED_HACK_COUNT(ch);
if (test_server)
{
sys_log(0, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d",
ch->GetName(),
current_time - ch->m_kAttackLog.dwTime,
GET_ATTACK_SPEED(ch),
ch->m_speed_hack_count);
ch->ChatPacket(CHAT_TYPE_INFO, "%s attack hack! time (delta, limit)=(%u, %u) hack_count %d",
ch->GetName(),
current_time - ch->m_kAttackLog.dwTime,
GET_ATTACK_SPEED(ch),
ch->m_speed_hack_count);
}
SET_ATTACK_TIME(ch, victim, current_time);
SET_ATTACKED_TIME(ch, victim, current_time);
return true;
}
}
SET_ATTACK_TIME(ch, victim, current_time);
if (victim->m_AttackedLog.dwPID == ch->GetPlayerID())
{
if (current_time - victim->m_AttackedLog.dwAttackedTime < GET_ATTACK_SPEED(ch))
{
INCREASE_SPEED_HACK_COUNT(ch);
if (test_server)
{
sys_log(0, "%s Attack Speed HACK! time (delta, limit)=(%u, %u), hack_count = %d",
ch->GetName(),
current_time - victim->m_AttackedLog.dwAttackedTime,
GET_ATTACK_SPEED(ch),
ch->m_speed_hack_count);
ch->ChatPacket(CHAT_TYPE_INFO, "Attack Speed Hack(%s), (delta, limit)=(%u, %u)",
ch->GetName(),
current_time - victim->m_AttackedLog.dwAttackedTime,
GET_ATTACK_SPEED(ch));
}
SET_ATTACKED_TIME(ch, victim, current_time);
return true;
}
}
SET_ATTACKED_TIME(ch, victim, current_time);
return false;
}
示例4: IncMember
void CWarMap::IncMember(LPCHARACTER ch)
{
if (!ch->IsPC())
return;
sys_log(0, "WarMap::IncMember");
DWORD gid = 0;
if (ch->GetGuild())
gid = ch->GetGuild()->GetID();
bool isWarMember = ch->GetQuestFlag("war.is_war_member") > 0 ? true : false;
if (isWarMember && gid != m_TeamData[0].dwID && gid != m_TeamData[1].dwID)
{
ch->SetQuestFlag("war.is_war_member", 0);
isWarMember = false;
}
if (isWarMember)
{
if (gid == m_TeamData[0].dwID)
{
m_TeamData[0].AppendMember(ch);
}
else if (gid == m_TeamData[1].dwID)
{
m_TeamData[1].AppendMember(ch);
}
event_cancel(&m_pkTimeoutEvent);
sys_log(0, "WarMap +m %u(cur:%d, acc:%d) vs %u(cur:%d, acc:%d)",
m_TeamData[0].dwID, m_TeamData[0].GetCurJointerCount(), m_TeamData[0].GetAccumulatedJoinerCount(),
m_TeamData[1].dwID, m_TeamData[1].GetCurJointerCount(), m_TeamData[1].GetAccumulatedJoinerCount());
}
else
{
++m_iObserverCount;
sys_log(0, "WarMap +o %d", m_iObserverCount);
ch->SetObserverMode(true);
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("관전 모드로 길드전에 참가하셨습니다."));
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("자신을 선택하시면 밖으로 나갈 수 있는 <관람 종료> 버튼이 나옵니다."));
}
UpdateUserCount();
m_set_pkChr.insert(ch);
LPDESC d = ch->GetDesc();
SendWarPacket(d);
SendScorePacket(0, d);
SendScorePacket(1, d);
}
示例5: __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;
}
}
示例6: ShowQuizList
bool COXEventManager::ShowQuizList(LPCHARACTER pkChar)
{
int c = 0;
for (size_t i = 0; i < m_vec_quiz.size(); ++i)
{
for (size_t j = 0; j < m_vec_quiz[i].size(); ++j, ++c)
{
pkChar->ChatPacket(CHAT_TYPE_INFO, "%d %s %s", m_vec_quiz[i][j].level, m_vec_quiz[i][j].Quiz, m_vec_quiz[i][j].answer ? LC_TEXT("Âü") : LC_TEXT("°ÅÁþ"));
}
}
pkChar->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("ÃÑ ÄûÁî ¼ö: %d"), c);
return true;
}
示例7: Reward
void PC::Reward(LPCHARACTER ch)
{
if (m_bIsGivenReward)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("<ДщЅєЖ®> АМАьїЎ °°Ає єё»уА» №ЮАє АыАМ АЦѕо ґЩЅГ №ЮБц ѕКЅАґПґЩ."));
m_bIsGivenReward = false;
}
for (vector<RewardData>::iterator it = m_vRewardData.begin(); it != m_vRewardData.end(); ++it)
{
switch (it->type)
{
case RewardData::REWARD_TYPE_EXP:
sys_log(0, "EXP cur %d add %d next %d",ch->GetExp(), it->value1, ch->GetNextExp());
if (ch->GetExp() + it->value1 > ch->GetNextExp())
ch->PointChange(POINT_EXP, ch->GetNextExp() - 1 - ch->GetExp());
else
ch->PointChange(POINT_EXP, it->value1);
break;
case RewardData::REWARD_TYPE_ITEM:
ch->AutoGiveItem(it->value1, it->value2);
break;
case RewardData::REWARD_TYPE_NONE:
default:
sys_err("Invalid RewardData type");
break;
}
}
m_vRewardData.clear();
}
示例8: SendFlagList
void PC::SendFlagList(LPCHARACTER ch)
{
for (TFlagMap::const_iterator it = m_FlagMap.begin(); it != m_FlagMap.end(); ++it)
{
if (it->first.size()>9 && it->first.compare(it->first.size()-9,9, ".__status") == 0)
{
const string quest_name = it->first.substr(0, it->first.size()-9);
const char* state_name = CQuestManager::instance().GetQuestStateName(quest_name, it->second);
ch->ChatPacket(CHAT_TYPE_INFO, "%s %s (%d)", quest_name.c_str(), state_name, it->second);
}
else
{
ch->ChatPacket(CHAT_TYPE_INFO, "%s %d", it->first.c_str(), it->second);
}
}
}
示例9: AccessorySocketDegrade
void CItem::AccessorySocketDegrade()
{
if (GetAccessorySocketGrade() > 0)
{
LPCHARACTER ch = GetOwner();
if (ch)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("%s¿¡ ¹ÚÇôÀÖ´ø º¸¼®ÀÌ »ç¶óÁý´Ï´Ù."), GetName());
}
ModifyPoints(false);
SetAccessorySocketGrade(GetAccessorySocketGrade()-1);
ModifyPoints(true);
int iDownTime = aiAccessorySocketDegradeTime[GetAccessorySocketGrade()];
if (test_server)
iDownTime /= 60;
SetAccessorySocketDownGradeTime(iDownTime);
if (iDownTime)
StartAccessorySocketExpireEvent();
}
}
示例10: UpdateBookPracticeGrade
bool CPolymorphUtils::UpdateBookPracticeGrade(LPCHARACTER pChar, LPITEM pItem)
{
if (pChar == NULL || pItem == NULL)
return false;
if (pItem->GetSocket(1) > 0)
pItem->SetSocket(1, pItem->GetSocket(1) - 1);
else
pChar->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("µР°©ј јц·ГА» ё¶ГєЅАґПґЩ. ЅЕј±їЎ°Ф ГЈѕЖ°Ўјјїд."));
return true;
}
示例11: Buy
// 아이템 구입
void CShopManager::Buy(LPCHARACTER ch, BYTE pos)
{
if (!ch->GetShop())
return;
if (!ch->GetShopOwner())
return;
if (DISTANCE_APPROX(ch->GetX() - ch->GetShopOwner()->GetX(), ch->GetY() - ch->GetShopOwner()->GetY()) > 2000)
{
ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("상점과의 거리가 너무 멀어 물건을 살 수 없습니다."));
return;
}
CShop* pkShop = ch->GetShop();
if (!pkShop->IsPCShop())
{
//if (pkShop->GetVnum() == 0)
// return;
//const CMob* pkMob = CMobManager::instance().Get(pkShop->GetNPCVnum());
//if (!pkMob)
// return;
//if (pkMob->m_table.bType != CHAR_TYPE_NPC)
//{
// return;
//}
}
else
{
}
//PREVENT_ITEM_COPY
ch->SetMyShopTime();
//END_PREVENT_ITEM_COPY
int ret = pkShop->Buy(ch, pos);
if (SHOP_SUBHEADER_GC_OK != ret) // 문제가 있었으면 보낸다.
{
TPacketGCShop pack;
pack.header = HEADER_GC_SHOP;
pack.subheader = ret;
pack.size = sizeof(TPacketGCShop);
ch->GetDesc()->Packet(&pack, sizeof(pack));
}
}
示例12: SetObserverMode
void CEntity::SetObserverMode(bool bFlag)
{
if (m_bIsObserver == bFlag)
return;
m_bIsObserver = bFlag;
m_bObserverModeChange = true;
UpdateSectree();
if (IsType(ENTITY_CHARACTER))
{
LPCHARACTER ch = (LPCHARACTER) this;
ch->ChatPacket(CHAT_TYPE_COMMAND, "ObserverMode %d", m_bIsObserver ? 1 : 0);
}
}
示例13: StartShopping
// 상점 거래를 시작
bool CShopManager::StartShopping(LPCHARACTER pkChr, LPCHARACTER pkChrShopKeeper, int iShopVnum)
{
if (pkChr->GetShopOwner() == pkChrShopKeeper)
return false;
// this method is only for NPC
if (pkChrShopKeeper->IsPC())
return false;
//PREVENT_TRADE_WINDOW
if (pkChr->IsOpenSafebox() || pkChr->GetExchange() || pkChr->GetMyShop() || pkChr->IsCubeOpen())
{
pkChr->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("다른 거래창이 열린상태에서는 상점거래를 할수 가 없습니다."));
return false;
}
//END_PREVENT_TRADE_WINDOW
long distance = DISTANCE_APPROX(pkChr->GetX() - pkChrShopKeeper->GetX(), pkChr->GetY() - pkChrShopKeeper->GetY());
if (distance >= SHOP_MAX_DISTANCE)
{
sys_log(1, "SHOP: TOO_FAR: %s distance %d", pkChr->GetName(), distance);
return false;
}
LPSHOP pkShop;
if (iShopVnum)
pkShop = Get(iShopVnum);
else
pkShop = GetByNPCVnum(pkChrShopKeeper->GetRaceNum());
if (!pkShop)
{
sys_log(1, "SHOP: NO SHOP");
return false;
}
bool bOtherEmpire = false;
if (pkChr->GetEmpire() != pkChrShopKeeper->GetEmpire())
bOtherEmpire = true;
pkShop->AddGuest(pkChr, pkChrShopKeeper->GetVID(), bOtherEmpire);
pkChr->SetShopOwner(pkChrShopKeeper);
sys_log(0, "SHOP: START: %s", pkChr->GetName());
return true;
}
示例14: iss
void LibM2::interpretCommand(LPCHARACTER ch,const char* data, size_t len) {
LibM2* self=instance();
std::istringstream iss(std::string(data,len));
std::vector<std::string> arguments;
copy(std::istream_iterator<std::string>(iss),std::istream_iterator<std::string>(),std::back_inserter<std::vector<std::string> >(arguments));
if (self->m_map_command.find(arguments.front())!=self->m_map_command.end()) {
ICommand* cmd = self->m_map_command[arguments.front()];
if (cmd->usableFor(ch)) {
cmd->use(ch, arguments);
return;
} else if(cmd->isReplaced()) {
ch->ChatPacket(1,locale_find("그런 명령어는 없습니다"));
return;
}
}
self->detour_interpretCommand->GetOriginalFunction()(ch,data,len);
}
示例15: PolymorphCharacter
bool CPolymorphUtils::PolymorphCharacter(LPCHARACTER pChar, LPITEM pItem, const CMob* pMob)
{
BYTE bySkillLevel = pChar->GetSkillLevel(POLYMORPH_SKILL_ID);
DWORD dwDuration = 0;
DWORD dwBonusPercent = 0;
int iPolyPercent = 0;
switch (pChar->GetSkillMasterType(POLYMORPH_SKILL_ID))
{
case SKILL_NORMAL:
dwDuration = 10;
break;
case SKILL_MASTER:
dwDuration = 15;
break;
case SKILL_GRAND_MASTER:
dwDuration = 20;
break;
case SKILL_PERFECT_MASTER:
dwDuration = 25;
break;
default:
return false;
}
// dwDuration *= 60;
// 변신 확률 = 캐릭터 레벨 - 몹 레벨 + 둔갑서 레벨 + 29 + 둔갑 스킬 레벨
iPolyPercent = pChar->GetLevel() - pMob->m_table.bLevel + pItem->GetSocket(2) + (29 + bySkillLevel);
if (iPolyPercent <= 0)
{
pChar->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("둔갑에 실패 하였습니다"));
return false;
}
else
{
if (number(1, 100) > iPolyPercent)
{
pChar->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("둔갑에 실패 하였습니다"));
return false;
}
}
pChar->AddAffect(AFFECT_POLYMORPH, POINT_POLYMORPH, pMob->m_table.dwVnum, AFF_POLYMORPH, dwDuration, 0, true);
// 변신 보너스 = 둔갑 스킬 레벨 + 둔갑서 레벨
dwBonusPercent = bySkillLevel + pItem->GetSocket(2);
switch (GetBonusType(pMob->m_table.dwVnum))
{
case POLYMORPH_ATK_BONUS:
pChar->AddAffect(AFFECT_POLYMORPH, POINT_ATT_BONUS, dwBonusPercent, AFF_POLYMORPH, dwDuration - 1, 0, false);
break;
case POLYMORPH_DEF_BONUS:
pChar->AddAffect(AFFECT_POLYMORPH, POINT_DEF_BONUS, dwBonusPercent, AFF_POLYMORPH, dwDuration - 1, 0, false);
break;
case POLYMORPH_SPD_BONUS:
pChar->AddAffect(AFFECT_POLYMORPH, POINT_MOV_SPEED, dwBonusPercent, AFF_POLYMORPH, dwDuration - 1, 0, false);
break;
default:
case POLYMORPH_NO_BONUS:
break;
}
return true;
}