bool local_initSkill(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	ch->InitSkill(&ch->m_activeSkillList);
	ch->InitSkill(&ch->m_passiveSkillList, true);
	if( ch->m_job != JOB_NIGHTSHADOW )
		ch->m_job2 = 0;

	ch->InitStat();

	ch->CalcStatus(true);

	ch->resetCoolTime(&ch->m_activeSkillList);

	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::makeSkillListMsg(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}

	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::makeChangeJobReset(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}

	return true;
}
void do_MidReform(CPC *ch_, CItem *reformerItem_, CItem *magnifierItem_, CItem *reformItem_, unsigned int count_)
{
	const int needReformerItem = 1;

	// 리포머 한개 삭제
	{
		CNetMsg::SP rmsg(new CNetMsg);
		useItemFromInventory(ch_, rmsg, reformerItem_, needReformerItem);
		SEND_Q(rmsg, ch_->m_desc);
	}

	// 황금 돋보기 count_ 만큼 삭제
	{
		CNetMsg::SP rmsg(new CNetMsg);
		useItemFromInventory(ch_, rmsg, magnifierItem_, count_);
		SEND_Q(rmsg, ch_->m_desc);
	}

	// 여기까지 왔으면 작업 완료. 아래 아이템들은 사용완료로 삭제 되었을 수도 있어 NULL처리 함. 그렇다고 위에서 아이템을 갖고 작업하지 말것.
	reformerItem_ = NULL;
	magnifierItem_ = NULL;

	// 아이템 리폼
	reformItem_->IdentifyRareOption(true, count_);

	ch_->m_inventory.sendOneItemInfo(reformItem_);

	GAMELOG << init("RARE ITEM REFORM SUCCESS", ch_) << itemlog(reformItem_) << end;
}
Пример #3
0
void CAPet::LevelUp( bool bSendEffect )
{
	// stat point 증가
	if( !IsProtoFlag( APET_FLAG_EXP ) )
		m_nRemainStat += 9;

	m_hp = m_maxHP + GetOwner()->m_opJewelElementPetHPUP;
	m_mp = m_maxMP;

	m_nAccFaith		+= m_pProto->m_nMaxFaith - m_nFaith ;
	m_nAccStemina	+= m_pProto->m_nMaxStm - m_nStm;

	if( bSendEffect )
	{
		// LevelUp Effect Msg
		CNetMsg::SP rmsg(new CNetMsg);
		EffectEtcMsg(rmsg, this, MSG_EFFECT_ETC_LEVELUP);
		this->m_pArea->SendToCell(rmsg, this, true);
	}

	{
		// LevelUp Msg
		CNetMsg::SP rmsg(new CNetMsg);
		ExAPetFuntionMsg( rmsg, MSG_SUB_LEVELUP, NULL, 0 );
		SEND_Q( rmsg, GetOwner()->m_desc );
	}
}
bool local_NSCreateCard(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	// 100레벨이상 캐릭터가 있으면 안됨
	// 나이트 쉐도우 캐릭터가 있으면 안됨
	// 나이트 쉐도우 생성카드 사용했는지 확인
	if( ch->m_desc->m_bCreate90Lv
			|| ch->m_level >= 90
			|| ch->m_desc->m_bNotCreateNightShadow
			|| ch->m_desc->m_bIsNSCreateCardUse)
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::ItemNotUseMsg(rmsg, MSG_ITEM_USE_ERROR_NS_CARD_INSUFF);
		SEND_Q(rmsg, ch->m_desc);
		return false;
	}

	{
		CNetMsg::SP rmsg(new CNetMsg);
		HelperNSCreateCardUse(rmsg, MSG_HELPER_NS_CARD_USE, ch->m_desc->m_index, ch->m_index);
		RefMsg(rmsg) << item->getVIndex();
		SEND_Q(rmsg, gserver->m_helper);

		return false;
	}
}
//////////////////////////////////////////////////////////////////////////
// 스텟 초기화
bool local_initStat(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	ch->m_statpt_remain += ch->m_statpt_str + ch->m_statpt_dex + ch->m_statpt_int + ch->m_statpt_con;

	ch->m_statpt_str = ch->m_statpt_dex = ch->m_statpt_int = ch->m_statpt_con = 0;
	ch->InitStat();

	{
		CNetMsg::SP rmsg(new CNetMsg);
		StatPointRemainMsg(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}

	ch->CalcStatus(true);
	ch->m_hp = ch->m_maxHP;
	ch->m_mp = ch->m_maxMP;

	{
		CNetMsg::SP rmsg(new CNetMsg);
		StatPointRemainMsg(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}

	return true;
}
Пример #6
0
void RDDBIcon::MessageReceived(BMessage *msg)
{
	switch(msg->what)
	{
		case RESTART_RD:
		{
			status_t error=B_NO_ERROR;
			BMessenger msgr(APP1SIG,-1,&error);
			BMessage reply;
			BMessage rmsg(RD_RESTART_RD);
			msgr.SendMessage(&rmsg,&reply,200000,300000);
			if ((reply.what!=B_OK) || (error!=B_OK))
				(new BAlert("RD","There has been a problem restarting the restart_daemon. Ironic, yes?","Drat!"))->Go(NULL);
			
		}break;
		case QUIT_RD:
		{
			status_t error=B_NO_ERROR;
			BMessenger msgr(APP1SIG,-1,&error);
			BMessage reply;
			BMessage rmsg(RD_SHUTDOWN_RD);
			msgr.SendMessage(&rmsg,&reply,200000,300000);
			if ((reply.what!=B_OK) || (error!=B_OK))
				(new BAlert("RD","There has been a problem shutting down the restart_daemon. Ironic, yes?","Drat!"))->Go(NULL);
		}break;
		default:
			BView::MessageReceived(msg);
	}
	
}
bool local_apetStatInit(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	CAPet* apet = ch->GetAPet();

	if (apet == NULL)
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 1);
		SEND_Q( rmsg , ch->m_desc );

		return false;
	}

	CItem *pPetItem = ch->m_wearInventory.wearItemInfo[ WEARING_PET ];
	if( !pPetItem )		// 착용중인 펫 아이템 없음
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 1);
		SEND_Q( rmsg , ch->m_desc );
		return false;
	}

	if( pPetItem->getFlag() & FLAG_ITEM_SEALED || DEAD( apet ) )	// 봉인또는 죽었음
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 2);
		SEND_Q( rmsg , ch->m_desc );
		return false;
	}

	if( !( apet->m_nPlusStr || apet->m_nPlusCon || apet->m_nPlusDex || apet->m_nPlusInt ) )		// 초기화할 스텟 없음
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 3);
		SEND_Q( rmsg , ch->m_desc );
		return false;
	}

	// 이전 스텟 로그
	GAMELOG << init("APET_STAT_INIT BEFORE",ch ) << "REMAIN:" << apet->m_nRemainStat << delim
			<< "STR:" << apet->m_nPlusStr << delim << "DEX:" << apet->m_nPlusDex << delim
			<< "INT:" << apet->m_nPlusInt << delim << "CON:" << apet->m_nPlusCon <<  end;

	apet->InitStat();

	// 사용후 스텟 로그
	GAMELOG << init("APET_STAT_INIT AFTER",ch ) << "REMAIN:" << apet->m_nRemainStat << delim
			<< "STR:" << apet->m_nPlusStr << delim << "DEX:" << apet->m_nPlusDex << delim
			<< "INT:" << apet->m_nPlusInt << delim << "CON:" << apet->m_nPlusCon << end;

	{
		CNetMsg::SP rmsg(new CNetMsg);
		ExAPetFuntionMsg( rmsg, MSG_SUB_STATINIT, NULL, 0);
		SEND_Q( rmsg , ch->m_desc );
	}

	return true;
}
bool local_platinumSmelt(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	// 인벤토리에 최소 1개의 빈공간이 있어야 한다
	if (ch->m_inventory.getEmptyCount() < 1)
	{
		CNetMsg::SP rmsg(new CNetMsg);
		SysFullInventoryMsg(rmsg, 0);
		SEND_Q(rmsg, ch->m_desc);
		return false;
	}

	int giveItemIndex=0;
	if( item->m_itemProto->getItemIndex() == 1418 )
		giveItemIndex=1419;
	else if( item->m_itemProto->getItemIndex() == 2894 )
		giveItemIndex=2895;
	else if( item->m_itemProto->getItemIndex() == 3269 )
		giveItemIndex=3270;

	// 인벤토리에 최소 무게가 보장되어야 한다.
	const CItemProto* pItemProto = gserver->m_itemProtoList.FindIndex(giveItemIndex);
	if (pItemProto == NULL)
		return false;

	// 플러스를 붙인 플래티늄 제련석을 지급한다
	int rand = GetRandom(1, 100);

	// 5프로 +3, 15프로 +2, 나머지 +1
	//+1 60%, +2 25%, +3 15% 로 변경 /bw : 060613
	if( rand <= 15 )
	{
		rand = 3;
	}
	else if( rand <= 40 )
	{
		rand = 2;
	}
	else
	{
		rand = 1;
	}

	if( giveItemIndex == 3270 )
		rand = 3;			// +3 전용 제련 아이템

	if( !ch->GiveItem(giveItemIndex, rand, 0, 1) )
	{
		return false;
	}

	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::ItemNotUseMsg(rmsg, MSG_ITEM_USE_ERROR_PLATINUM_SPECIAL);
		SEND_Q(rmsg, ch->m_desc);
	}

	return true;
}
Пример #9
0
void CAPet::Mount( bool bMount )
{
	m_bMount = bMount;

	// 주인관련 처리
	if( m_pOwner )
	{
		CArea* area = m_pOwner->m_pArea;

		if( bMount )		// 탈때
		{
			if(m_pArea != NULL) // NULL이 아니면 실행, NULL이면 건너뛸것.
				m_pArea->MoveChar( this, GET_YLAYER(m_pOwner), GET_X(m_pOwner), GET_Z(m_pOwner), GET_H(m_pOwner), GET_R(m_pOwner), MSG_MOVE_STOP, NULL );

			// 소환 해제
			while ( m_pOwner->m_elementalList)
				m_pOwner->UnsummonElemental(m_pOwner->m_elementalList);
		}

		if(area)
		{
			{
				// 사라졌다 나타나기
				CNetMsg::SP rmsg(new CNetMsg);
				DisappearMsg(rmsg, this);
				area->SendToCell(rmsg, this, true);
			}

			{
				CNetMsg::SP rmsg(new CNetMsg);
				AppearMsg(rmsg, this);
				area->SendToCell(rmsg, this, true);
			}
		}


		if (m_pArea)
		{
			CNetMsg::SP rmsg(new CNetMsg);
			ExAPetStatusMsg( rmsg, this );
			m_pArea->SendToCell(rmsg, GetOwner(), true);
		}

		m_pOwner->CalcStatus(true);

		{
			CNetMsg::SP rmsg(new CNetMsg);
			ExAPetFuntionMsg( rmsg, MSG_SUB_MOUNT_REP, this , 0 );
			m_pOwner->m_pArea->SendToCell(rmsg, m_pOwner, true);
		}
	}
}
bool local_useCashItem_WareHouse_Grocery_ShowHP_Sub(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	if( item->getUsed() < gserver->getNowSecond() )
		return false;

	{
		CNetMsg::SP rmsg(new CNetMsg);
		UpdateClient::makeUpdateItemUsed(rmsg, item->tab(), item->getInvenIndex(), item->getUsed());
		SEND_Q( rmsg, ch->m_desc );
	}

	switch (item->m_itemProto->getItemIndex())
	{
	case SHOW_HP_ITEM1:
	case SHOW_HP_ITEM2:
	case SHOW_HP_ITEM3:
	case 2606:
		{
			{
				CNetMsg::SP rmsg(new CNetMsg);
				rmsg->Init(MSG_PK);
				RefMsg(rmsg) << (unsigned char)MSG_PK_TARGET_SHOWHP
							 << (char)1 ;
				SEND_Q( rmsg, ch->m_desc );
			}

			CSkill* skill = NULL;
			skill = gserver->m_skillProtoList.Create( item->m_itemProto->getItemNum0(), item->m_itemProto->getItemNum1() );
			if( skill == NULL )
				return false;

			bool bApply;
			ApplySkill( ch, ch, skill, item->m_itemProto->getItemIndex(), bApply );
			if( !bApply )
			{
				delete skill;
				return true;
			}
			ch->setSearchLife(true);
			delete skill;
		}
		break;
	}

	// 포션 사용 이펙트 메시지
	CNetMsg::SP effectMsg(new CNetMsg);
	EffectItemMsg(effectMsg, ch, item);
	ch->m_pArea->SendToCell(effectMsg, ch, true);

	return true;
}
Пример #11
0
void CParty::SetEndParty()
{
	updateCalcMember();

	{
		// 파티 해체 알림
		CNetMsg::SP rmsg(new CNetMsg);
		PartyMsg(rmsg, MSG_PARTY_END);
		SendToAllPC(rmsg);
	}

	// 초대 거절
	if (GetRequestIndex() > 0)
	{
		CPC* pRequestPC = PCManager::instance()->getPlayerByCharIndex(GetRequestIndex());
		if (pRequestPC)
		{
			CNetMsg::SP rmsg(new CNetMsg);
			PartyMsg(rmsg, MSG_PARTY_REJECT_SRC);
			SEND_Q(rmsg, pRequestPC->m_desc);
		}
		SetRequest(-1, "");
	}

	for(int i=0; i < MAX_PARTY_MEMBER; i++)
	{
		CPartyMember* pMember = (CPartyMember*)GetMemberByListIndex(i);
		if(pMember)
		{
			CPC* pc = pMember->GetMemberPCPtr();
			if(pc && (pc->m_pZone->IsExpedRaidZone() || pc->m_pZone->IsPartyRaidZone())
					&& pc->m_nJoinInzone_ZoneNo >=0 && pc->m_nJoinInzone_RoomNo >= 0)
			{
				CNetMsg::SP rmsg(new CNetMsg);
				RaidInzoneQuitReq(rmsg,1,0);
				do_Raid(pc, rmsg);
			}
		}
	}

	CPartyMember* pMember=NULL;

	for(int i=0; i < MAX_PARTY_MEMBER; i++)
	{
		pMember = (CPartyMember*)GetMemberByListIndex(i);
		if(pMember)
			SetMemberPCPtr(pMember->GetCharIndex(), NULL);
		delete m_listMember[i];
		m_listMember[i] = NULL;
	}
}
bool CExpedition::SetMemberRegister_AfterGoZone( CPC* pPC )
{
	if (!pPC || !pPC->m_desc)
		return false;

	SetMemberPCPtr(pPC->m_index, pPC);

	{
		//원정대 타입 정보
		CNetMsg::SP rmsg(new CNetMsg);
		ExpedTypeinfo(rmsg, GetExpedType(MSG_DIVITYPE_EXP), GetExpedType(MSG_DIVITYPE_ITEM), GetExpedType(MSG_DIVITYPE_SPECIAL));
		SEND_Q(rmsg, pPC->m_desc);
	}

	// 처음 접속에 원정대가 있으면
	for(int i = 0; i < MAX_EXPED_GROUP; i++)
	{
		for(int j = 0; j < MAX_EXPED_GMEMBER; j++)
		{
			const CExpedMember* pMember = GetMemberByListIndex(i,j);

			// 모두 전송
			if (pMember)
			{
				//대원들 정보 ==> 나에게 전송
				CNetMsg::SP rmsg(new CNetMsg);
				ExpedAddMsg(rmsg, pMember->GetCharIndex(), pMember->GetCharName(), i, pMember->GetMemberType(), pMember->GetListIndex(), pMember->GetMemberPCPtr());
				SEND_Q(rmsg, pPC->m_desc);
			}
		}
	}

	//내 정보 ==> 다른 대원에게 전송
	const CExpedMember* pMember = GetMemberByCharIndex(pPC->m_index);
	if(pMember)
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ExpedAddMsg(rmsg, pMember->GetCharIndex(), pMember->GetCharName(), pMember->GetGroupType(), pMember->GetMemberType(), pMember->GetListIndex(), pMember->GetMemberPCPtr());
		SendToAllPC(rmsg, pPC->m_index);
	}

	{
		CNetMsg::SP rmsg(new CNetMsg);
		HelperExpendOnlineMsg( rmsg, GetBossIndex() , pPC->m_index , pPC->m_level );
		SEND_Q(rmsg, gserver->m_helper);
	}

	return true;
}
Пример #13
0
void CAPet::CheckItemTime()
{
	int i;
	CItem* pItem = NULL ;

	for( i=0; i< APET_WEARPOINT; i++ )
	{
		pItem = m_wearing[i];
		if( pItem )
		{
			if (pItem->getUsed() > 0 && pItem->getUsed() < gserver->getNowSecond())
			{
				GAMELOG << init("ITEM USE TIMEOUT IN PET", GetOwner() )
						<< "ITEM" << delim
						<< itemlog(pItem) << delim
						<< "APET" << delim << m_index
						<< end;

				{
					CNetMsg::SP rmsg(new CNetMsg);
					ExAPetFuntionMsg( rmsg, MSG_SUB_DELETE_EQUIP, this, 0 );
					RefMsg(rmsg) << pItem->getDBIndex()
								 << (char) i;
					SEND_Q( rmsg, GetOwner()->m_desc );
				}

				delete pItem;
				m_wearing[i] = NULL;
			}
		}
	}
}
Пример #14
0
void CAPet::SendStatusMsg()
{
	CNetMsg::SP rmsg(new CNetMsg);

	ExAPetStatusMsg(rmsg, this);
	SEND_Q(rmsg, GetOwner()->m_desc);
}
Пример #15
0
void CAPet::Disappear()
{
	CArea* area = m_pArea;

//#ifdef MONSTER_COMBO_BUGFIX
//	GAMELOG << init("APET DISAPPEAR PREV")
//			<< m_index
//			<< end;
//#endif // MONSTER_COMBO_BUGFIX

	if (area == NULL)
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX") << "AREA NULL" << end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	if (!IS_IN_CELL(this))
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX")
//				<< "IS_IN_CELL" << delim
//				<< m_cellX
//				<< end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	if (!m_bSummon)
	{
//#ifdef MONSTER_COMBO_BUGFIX
//		GAMELOG << init("MONSTER_COMBO_BUGFIX") << "SUMMON FALSE" << end;
//#endif // MONSTER_COMBO_BUGFIX
		return ;
	}

	// 어택 리스트 지우고
	DelAttackList(this);

	{
		// 사라짐을 알리고
		CNetMsg::SP rmsg(new CNetMsg);
		DisappearMsg(rmsg, this);
		area->SendToCell(rmsg, this, true);
	}

	// 셀에서 제거
	area->CharFromCell(this, true);
	m_pZone = NULL;
	m_pArea = NULL;

	m_bSummon = false;
//#ifdef MONSTER_COMBO_BUGFIX
//	GAMELOG << init("APET DISAPPEAR AFTER")
//			<< m_index << delim
//			<< m_cellX << delim
//			<< m_cellZ << end;
//#endif // MONSTER_COMBO_BUGFIX
}
void CExpedition::SendToExpedTargetClear(CCharacter *ch)
{
	int i;
	CExpedMember* pMember = NULL;

	for (i = 0; i < MAX_EXPED_GROUP; i++)
	{
		for(int j=0; j < MAX_EXPED_GMEMBER; j++)
		{
			pMember = (CExpedMember*)m_listMember[i][j];
			if ( pMember != NULL)
			{
				CPC* pPC = pMember->GetMemberPCPtr();
				if(pPC != NULL && pPC->m_index>0 && pPC->m_level>0 &&
					pPC->m_pZone && pPC->m_pArea && pPC->m_pZone->m_index == ch->m_pZone->m_index && pPC->m_pArea->m_index == ch->m_pArea->m_index)
				{
					pPC->m_targetPC == NULL;
					CNetMsg::SP rmsg(new CNetMsg);
					TargetClearMsg(rmsg, ch->m_index);
					SEND_Q(rmsg, pPC->m_desc);
				}
			}
		}
	}
}
bool local_useCashItem_PetHPRecover(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	if (ch->m_wearInventory.wearItemInfo[WEARING_PET] == NULL)
		return false;

	CPet* pet = ch->GetPet();
	if (pet == false)
		return false;

	if( item->m_itemProto->getItemIndex() != PET_HPRECOVER_ITEM )
		return false;

	int upVal = 30;
	bool bUpdate = false;
	if( pet->m_hp < pet->m_maxHP )
	{
		pet->m_hp += upVal;
		if( pet->m_hp > pet->m_maxHP )
			pet->m_hp = pet->m_maxHP;
		bUpdate = true;
	}

	if( bUpdate )
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ExPetStatusMsg( rmsg, pet );
		SEND_Q( rmsg, ch->m_desc );
	}

	return true;
}
void GMToolInMessenger::operate( rnSocketIOService* service )
{
	if (this->isLogined())
	{
		LOG_ERROR("\n****************************\n"
				  "GM TOOL is already connected.\n"
				  "****************************\n");

		CNetMsg::SP rmsg(new CNetMsg);
		ResponseGMTool::makeAuthorize(rmsg, ResponseGMTool::ERR_ALREADY_CONNECT);
		service->deliver(rmsg);

		service->Close("GM TOOL is already connected");

		return;
	}

	GMToolProcessInMessenger* pGMTOOL = new GMToolProcessInMessenger(service);
	service->SetUserData(pGMTOOL);

	this->setFlag();

	LOG_INFO("\n****************************\n"
			 "GM TOOL is connected. / ip[%s]\n"
			 "****************************\n", service->ip().c_str());
}
bool CMeracCastle::TakeLordItem(CPC* pc)
{
	CItem* item = pc->m_inventory.FindByDBIndex(GetLordItemIndex(pc->m_job, 1), 0, 0);
	if (item == NULL)
	{
		item = pc->m_inventory.FindByDBIndex(GetLordItemIndex(pc->m_job, 2), 0, 0);
		if (item == NULL)
		{
			return false;
		}
	}

	if (item->getWearPos() != WEARING_NONE)
	{
		if (item->getWearPos() >= WEARING_SHOW_START && item->getWearPos() <= WEARING_SHOW_END && pc->m_pArea)
		{
			CNetMsg::SP rmsg(new CNetMsg);
			WearingMsg(rmsg, pc, item->getWearPos(), -1, 0);
			pc->m_pArea->SendToCell(rmsg, pc, true);
		}
		pc->m_wearInventory.RemoveItem(item->getWearPos());
	}

	if (GetOwnerCharIndex() == pc->m_index)
	{
		m_bGiveLordWeapon = false;
	}
	return true;
}
bool local_initAllStatAndSkill(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	ch->m_statpt_remain += ch->m_statpt_str + ch->m_statpt_dex + ch->m_statpt_int + ch->m_statpt_con;

	ch->m_statpt_str = ch->m_statpt_dex = ch->m_statpt_int = ch->m_statpt_con = 0;
	ch->InitStat();

	{
		CNetMsg::SP rmsg(new CNetMsg);
		StatPointRemainMsg(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}

	ch->CalcStatus(true);
	ch->m_hp = ch->m_maxHP;
	ch->m_mp = ch->m_maxMP;

	ch->InitSkill(&ch->m_activeSkillList);
	ch->InitSkill(&ch->m_passiveSkillList, true);
	ch->InitSSkill();
	if( ch->m_job != JOB_NIGHTSHADOW )
		ch->m_job2 = 0;
	ch->InitStat();

	ch->CalcStatus(true);

	ch->resetCoolTime(&ch->m_activeSkillList);

	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::makeSkillListMsg(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::makeSSkillList(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::makeChangeJobReset(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}

	return true;
}
Пример #21
0
int OscGetInput(OscHandler* osc)
{
  int msgcnt=0;

  if (osc->m_recvq.Available() >= sizeof(int))
  {
    static WDL_Queue s_q;
    osc->m_mutex.Enter();
    int sz=osc->m_recvq.Available();
    s_q.Add(osc->m_recvq.Get(), sz);
    osc->m_recvq.Clear();
    osc->m_mutex.Leave();

    while (s_q.Available() >= sizeof(int))
    {
      int len=*(int*)s_q.Get(sizeof(int));
      REAPER_MAKEBEINTMEM((char*)&len);

      if (len <= 0 || len > MAX_OSC_MSG_LEN || len > s_q.Available()) break;

      if (s_q.Available() > 20 && !strcmp((char*)s_q.Get(), "#bundle"))
      {
        s_q.Advance(16); // past "#bundle" and timestamp
        len=*(int*)s_q.Get(sizeof(int));
        REAPER_MAKEBEINTMEM((char*)&len);

        if (len <= 0 || len > MAX_OSC_MSG_LEN || len > s_q.Available()) break;
      }

      OscMessageRead rmsg((char*)s_q.Get(len), len);

#if OSC_DEBUG_INPUT
      char dump[MAX_OSC_MSG_LEN*2];
      rmsg.DebugDump("recv: ", dump, sizeof(dump));
#ifdef _WIN32
      strcat(dump, "\n");
      OutputDebugString(dump);
#else
      fprintf(stderr, "%s\n", dump);
#endif
#endif

      if (osc->m_recv_enable&2)
      {
        const char* msg=rmsg.GetMessage();
        const float* f=rmsg.PopFloatArg(true);
        CSurf_OnOscControlMessage(msg, f);
      }

      osc->m_handler(osc->m_obj, &rmsg);

      ++msgcnt;
    }    
    s_q.Clear();    
  }

  return msgcnt;
}
bool local_initNormalAndSpecialSkill(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	if(ch->m_evocationIndex > EVOCATION_NONE)
		ch->ChangeEvocationState(ch->m_evocationIndex);

	ch->InitSkill(&ch->m_activeSkillList);
	ch->InitSkill(&ch->m_passiveSkillList, true);
	ch->InitSSkill();
	if( ch->m_job != JOB_NIGHTSHADOW )
		ch->m_job2 = 0;
	ch->InitStat();

	ch->CalcStatus(true);
	
	int i, j;
	for (i=0; i < QUICKSLOT_PAGE_NUM; i++)
	{
		for (j=0; j < QUICKSLOT_MAXSLOT; j++)
		{
			if (ch->m_quickSlot[i].m_slotType[j] == QUICKSLOT_TYPE_SKILL)
			{
				ch->m_quickSlot[i].m_skillType[j] = -1;
				ch->m_quickSlot[i].m_slotType[j] = QUICKSLOT_TYPE_EMPTY;
			}
		}
	}

	ch->resetCoolTime(&ch->m_activeSkillList);
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::makeSkillListMsg(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::makeSSkillList(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}
	{
		CNetMsg::SP rmsg(new CNetMsg);
		ResponseClient::makeChangeJobReset(rmsg, ch);
		SEND_Q(rmsg, ch->m_desc);
	}
	return true;
}
bool local_squib(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	CNetMsg::SP rmsg(new CNetMsg);
	EffectEtcMsg(rmsg, ch, MSG_EFFECT_ETC_FIRECRACKER);
	SEND_Q( rmsg, ch->m_desc );
	ch->m_pArea->SendToCell(rmsg, ch, true);

	return true;
}
bool local_initSpecialSkill(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	ch->InitSSkill();
	ch->CalcStatus(true);
	CNetMsg::SP rmsg(new CNetMsg);
	ResponseClient::makeSSkillList(rmsg, ch);
	SEND_Q(rmsg, ch->m_desc);

	return true;
}
bool local_period_2348(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	int itemUseTime = usePeriodItem_7(&ch->m_memposTime, &bprolong );

	CNetMsg::SP rmsg(new CNetMsg);
	ItemProlongMsg(rmsg, item->m_itemProto->getItemIndex(), itemUseTime, bprolong);
	SEND_Q(rmsg, ch->m_desc);

	return !bprolong;
}
Пример #26
0
void CParty::SendToSameContinentPC(CNetMsg::SP& msg, int nExcludeCharIndex)
{
	CPC *pc = PCManager::instance()->getPlayerByCharIndex(nExcludeCharIndex);

	if (!pc)
		return ;

	int continent_no = -1;
	int i;
	if(!pc->m_pZone)
		return ;
	CPartyMember* pMember = NULL;
	bool IsPartyMemberinSameContinent = false;
	continent_no = pc->m_pZone->m_iContinent_no;
	for(i = 0; i < MAX_PARTY_MEMBER; i++)
	{
		if(m_listMember[i] != NULL)
		{
			pMember =  (CPartyMember*)m_listMember[i];
			if(pMember != NULL)
			{
				if(pMember->GetCharIndex() != nExcludeCharIndex)
				{
					CPC *pPC = pMember->GetMemberPCPtr();
					if(pPC != NULL)
					{
						if(pPC->m_pZone->m_iContinent_no == continent_no)
						{
							if( pPC->m_plusEffect & CLIENT_OPTION_WARP )
							{
								CNetMsg::SP rmsg(new CNetMsg);
								WarpErrorMsg(rmsg, MSG_WARP_ERROR_NOTALLOW, pPC->GetName());
								SEND_Q( rmsg, pc->m_desc );
								IsPartyMemberinSameContinent = true;
							}
							else
							{
								if(!pPC->m_pZone->IsGuildRoom() && !pPC->m_pZone->IsPartyRaidZone())
								{
									IsPartyMemberinSameContinent = true;
									SEND_Q(msg, pPC->m_desc);
								}
							}
						}
					}
				}
			}
		}
	}
	if(!IsPartyMemberinSameContinent) // 파티는 있으나 모든 파티원들이 같은 대륙에 없을 때..에러메세지 발송
	{
		PartyRecallErrorMsg(msg, MSG_EX_PARTY_RECALL_ERROR_NOT_FOUND_PARTY_PLAYER);
		SEND_Q(msg, pc->m_desc);
	}
}
void do_HighReform(CPC *ch_, CItem *reformerItem_, CItem *magnifierItem_, CItem *reformItem_, unsigned int count_)
{
	const int needReformerItem = 1;

	{
		CNetMsg::SP rmsg(new CNetMsg);
		useItemFromInventory(ch_, rmsg, reformerItem_, needReformerItem);
		SEND_Q(rmsg, ch_->m_desc);
	}

	{
		CNetMsg::SP rmsg(new CNetMsg);
		useItemFromInventory(ch_, rmsg, magnifierItem_, count_);
		SEND_Q(rmsg, ch_->m_desc);
	}

	reformerItem_ = NULL;
	magnifierItem_ = NULL;

	reformItem_->originReform(count_);

	ch_->m_inventory.sendOneItemInfo(reformItem_);

	GAMELOG << init("ORIGIN ITEM REFORM SUCCESS", ch_) << itemlog(reformItem_) << end;

	if (ch_->m_admin > 0)
	{
		char tmpBuf[1024] = {0,};
		sprintf(tmpBuf, "ITEM REFORM SUCCESS [OPTION IDX : OPTION VARIATION], [%d : %d], [%d : %d], [%d : %d], [%d : %d], [%d : %d], [%d : %d]",
				reformItem_->GetOriginIndex(0), reformItem_->getOriginVar(0),
				reformItem_->GetOriginIndex(1), reformItem_->getOriginVar(1),
				reformItem_->GetOriginIndex(2), reformItem_->getOriginVar(2),
				reformItem_->GetOriginIndex(3), reformItem_->getOriginVar(3),
				reformItem_->GetOriginIndex(4), reformItem_->getOriginVar(4),
				reformItem_->GetOriginIndex(5), reformItem_->getOriginVar(5));
		CNetMsg::SP rmsg(new CNetMsg);
		SayMsg(rmsg, MSG_CHAT_NOTICE, 0, "", "", tmpBuf);
		SEND_Q(rmsg, ch_->m_desc);

		LOG_INFO("%s", tmpBuf);
	}
}
// 미감정 초보자용 결합 아이템 감정
bool local_useCashItem_2664(CPC* ch, CItem* item, bool bprolong, RequestClient::doItemUse* packet)
{
	// 인벤토리에 최소 1개의 빈공간이 있어야 한다
	if (ch->m_inventory.getEmptyCount() < 1)
	{
		CNetMsg::SP rmsg(new CNetMsg);
		SysFullInventoryMsg(rmsg, 0);
		SEND_Q(rmsg, ch->m_desc);
		return false;
	}

	int nProb = GetRandom(1, 100);
	const int nNewItemIndex = 2665;
	int nNewItemPlus = 0;
	if (nProb <= 80)					nNewItemPlus = 1;
	else if (nProb <= 80 + 15)			nNewItemPlus = 2;
	else if (nProb <= 80 + 15 + 5)		nNewItemPlus = 3;
	if (nNewItemPlus == 0)
		return false;

	CItem* pNewItem = gserver->m_itemProtoList.CreateItem(nNewItemIndex, -1, nNewItemPlus, 0, 1);
	if (!pNewItem)
	{
		GAMELOG << init("USE CASHITEM 2664 ERROR CANT CREATE ITEM 2665", ch) << end;
		return false;
	}

	if (ch->m_inventory.addItem(pNewItem) == false)
	{
		GAMELOG << init("USE CASHITEM 2664 ERROR FULL INVENTORY", ch) << end;

		delete pNewItem;

		CNetMsg::SP rmsg(new CNetMsg);
		SysFullInventoryMsg(rmsg, 0);
		SEND_Q(rmsg, ch->m_desc);
		return false;
	}

	return true;
}
Пример #29
0
bool CParty::SetMemberRegister_AfterGoZone(CPC* pPC)
{
	if (!pPC || !pPC->m_desc)
		return false;

	SetMemberPCPtr(pPC->m_index, pPC);

	{
		//파티 타입 정보
		CNetMsg::SP rmsg(new CNetMsg);
		PartyTypeinfo(rmsg, GetPartyType(MSG_DIVITYPE_SP), GetPartyType(MSG_DIVITYPE_ITEM),GetPartyType(MSG_DIVITYPE_SPECIAL));
		SEND_Q(rmsg, pPC->m_desc);
	}

	// 처음 접속에 파티가 있으면
	for (int i = 0; i < MAX_PARTY_MEMBER; i++)
	{
		const CPartyMember* pMember = GetMemberByListIndex(i);

		if (pMember && pMember->GetCharIndex() != pPC->m_index)
		{
			CNetMsg::SP rmsg(new CNetMsg);
			PartyAddMsg(rmsg, pMember->GetCharIndex(), pMember->GetCharName(), pMember->GetMemberPCPtr(), ((GetBossIndex() == pMember->GetCharIndex()) ? 1 : 0));
			SEND_Q(rmsg, pPC->m_desc);
		}
	}

	{
		CNetMsg::SP rmsg(new CNetMsg);
		PartyAddMsg(rmsg, pPC->m_index, pPC->GetName(), pPC, ((GetBossIndex() == pPC->m_index) ? 1 : 0));
		SendToAllPC(rmsg, pPC->m_index);
	}

	{
		CNetMsg::SP rmsg(new CNetMsg);
		HelperPartyOnline( rmsg, GetBossIndex() , pPC->m_index , pPC->m_level );
		SEND_Q(rmsg, gserver->m_helper);
	}

	return true;
}
void MessengerInSubHelper::onConnect( rnSocketIOService* service )
{
	service_ = service;

	CNetMsg::SP rmsg(new CNetMsg);
	rmsg->Init(MSG_SUBHELPER_CONNECT);
	RefMsg(rmsg) << gserver.m_serverno;
	service_->deliver(rmsg);

	LOG_INFO("%%%%%%%%%% connected to Messenger server (%s : %d) %%%%%%%%%%\n\n",
			 host_.c_str(), port_);
}