当前位置: 首页>>代码示例>>C++>>正文


C++ PlayerCreature类代码示例

本文整理汇总了C++中PlayerCreature的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature类的具体用法?C++ PlayerCreature怎么用?C++ PlayerCreature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PlayerCreature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: throw

void CGSMSAddressListHandler::execute (CGSMSAddressList* pPacket , Player* pPlayer)
	 throw(ProtocolException, Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	Assert(pGamePlayer != NULL);

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
	Assert(pPC != NULL);

	SMSAddressBook* pBook = pPC->getAddressBook();
	if (pBook != NULL )
	{
		GCSMSAddressList* pPacket = pBook->getGCSMSAddressList();
		if (pPacket != NULL ) pGamePlayer->sendPacket(pPacket);
	}

#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:27,代码来源:CGSMSAddressListHandler.cpp

示例2: throw

void EffectIntimateGrail::unaffect(Creature* pCreature)
	throw(Error)
{
	__BEGIN_TRY

	//cout << "EffectIntimateGrail" << "unaffect BEGIN" << endl;

	Assert(pCreature != NULL);

	pCreature->removeFlag(Effect::EFFECT_CLASS_INTIMATE_GRAIL);

	if (pCreature->isPC() )
	{
		PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);
		pPC->initAllStatAndSend();
	}

//	pSlayer->initAllStatAndSend();

	Zone* pZone = pCreature->getZone();
	Assert(pZone != NULL);

	GCRemoveEffect gcRemoveEffect;
	gcRemoveEffect.setObjectID(pCreature->getObjectID());
	gcRemoveEffect.addEffectList(Effect::EFFECT_CLASS_INTIMATE_GRAIL);
	pZone->broadcastPacket(pCreature->getX(), pCreature->getY(), &gcRemoveEffect);

	//cout << "EffectIntimateGrail" << "unaffect END" << endl;

	__END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:31,代码来源:EffectIntimateGrail.cpp

示例3: throw

void CGFailQuestHandler::execute (CGFailQuest* pPacket , Player* pPlayer)
throw(Error)
{
    __BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

    GamePlayer* pGP = dynamic_cast<GamePlayer*>(pPlayer);
    Assert(pGP != NULL);

    PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGP->getCreature());

    pPC->getQuestManager()->adjustQuestStatus();

    QuestMessage code;
    if (pPacket->isFail() )
        code = pPC->getQuestManager()->failQuest();
    else
        code = pPC->getQuestManager()->cancelQuest();

    if (code == CANCEL_SUCCESS )
    {
        pPC->sendCurrentQuestInfo();

        //cout << "Quest 시작 " << pPC->getName() << " " << pPacket->getQuestID() << endl;
    }
    else
    {
        //cout << "Quest 시작 실패 " << pPC->getName() << " " << (int)code << endl;
    }

#endif	// __GAME_SERVER__

    __END_DEBUG_EX __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:35,代码来源:CGFailQuestHandler.cpp

示例4: throw

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionShowWarSchedule::execute (Creature * pCreature1 , Creature * pCreature2) 
	throw(Error)
{
	__BEGIN_TRY

	Assert(pCreature1 != NULL);
	Assert(pCreature2 != NULL);
	Assert(pCreature1->isNPC());
	Assert(pCreature2->isPC());

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);

	GCWarScheduleList gcWarScheduleList;

	if (g_pVariableManager->isWarActive()
		&& makeGCWarScheduleList(&gcWarScheduleList, m_ZoneID ) )
	{
		pPC->getPlayer()->sendPacket(&gcWarScheduleList);
	}
	else
	{
		GCNPCResponse gcNPCResponse;
		gcNPCResponse.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
	}

	__END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:31,代码来源:ActionShowWarSchedule.cpp

示例5: _locker

void ZonePacketHandler::handleUpdateTransformMessage(Message* pack) {
	BaseClient* client = (BaseClient*) pack->getClient();

	uint64 objid = pack->parseLong();

	float x = pack->parseSignedShort() / 4.f;
	float z = pack->parseSignedShort() / 4.f;
	float y = pack->parseSignedShort() / 4.f;

	uint32 counter = pack->parseInt();

	SceneObject* scno = zone->getObject(objid);

	if (scno != NULL) {
		Locker _locker(scno);
		scno->setPosition(x, z, y);
		//scno->info("updating position");

		_locker.release();

		PlayerCreature* player = zone->getSelfPlayer();

		Locker _playerLocker(player);

		if (player->getFollowObject() == scno) {
			player->updatePosition(x, z, y);
		}
	}
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:29,代码来源:ZonePacketHandler.cpp

示例6: throw

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionSelectBloodBible::execute (Creature * pCreature1 , Creature * pCreature2) 
	throw(Error)
{
	__BEGIN_TRY

	Assert(pCreature1 != NULL);
	Assert(pCreature1->isNPC());

	Assert(pCreature2 != NULL);
	Assert(pCreature2->isPC());

	NPC* pNPC = dynamic_cast<NPC*>(pCreature1);
	Assert(pNPC != NULL);

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
	Assert(pPC != NULL);

	Player* pPlayer = pCreature2->getPlayer();
	Assert(pPlayer != NULL);

	GCBloodBibleList gcPacket;
	g_pBloodBibleBonusManager->getBloodBibleByRace(pPC->getRace(), back_inserter(gcPacket.getList()));
	pPlayer->sendPacket(&gcPacket);

	__END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:29,代码来源:ActionSelectBloodBible.cpp

示例7: throw

void CGModifyGuildMemberIntroHandler::execute (CGModifyGuildMemberIntro* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	SYSTEM_ASSERT(SYSTEM_GUILD);

	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	Assert(pGamePlayer != NULL);

	Creature* pCreature = pGamePlayer->getCreature();
	Assert(pCreature != NULL);

	PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
	Assert(pPlayerCreature != NULL);

	// 길드를 가져온다.
	Guild* pGuild = g_pGuildManager->getGuild(pPlayerCreature->getGuildID());
	if (pGuild==NULL) return;

	// 길드 멤버 정보를 가져온다.
	GuildMember* pGuildMember  = pGuild->getMember(pPlayerCreature->getName());
	if (pGuildMember==NULL) return;

	pGuildMember->saveIntro(pPacket->getGuildMemberIntro());

#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:35,代码来源:CGModifyGuildMemberIntroHandler.cpp

示例8: if

// Mysterious Item 가격
// itemClass와 pCreature의 능력치에 따라서 가격이 달라진다.
Price_t PriceManager::getMysteriousPrice(Item::ItemClass itemClass, Creature* pCreature) const
{
	int multiplier = 1;

	if (pCreature->isSlayer())
	{
		Slayer* pSlayer = dynamic_cast<Slayer*>(pCreature);

		Attr_t CSTR = pSlayer->getSTR(ATTR_BASIC);
		Attr_t CDEX = pSlayer->getDEX(ATTR_BASIC);
		Attr_t CINT = pSlayer->getINT(ATTR_BASIC);
		Attr_t CSUM = CSTR + CDEX + CINT;

		// 0~20 사이
		multiplier = CSUM / 15;
	}
	else if (pCreature->isVampire())
	{
		Vampire* pVampire = dynamic_cast<Vampire*>(pCreature);

		Level_t CLevel = pVampire->getLevel();

		// 0~20 사이
		multiplier = CLevel / 5;
	}
	else if (pCreature->isOusters())
	{
		Ousters* pOusters = dynamic_cast<Ousters*>(pCreature);

		Level_t CLevel = pOusters->getLevel();

		// 0~20 사이
		multiplier = CLevel / 5;
	}

	// 1~20사이
	multiplier = max(1, multiplier);

	// 가격 평균을 알아온다.
	InfoClassManager* pInfoClass = g_pItemInfoManager->getInfoManager(itemClass);
	Assert(pInfoClass!=NULL);

	// 가격 평균 * 능력치 비율?
	int finalPrice = (int)pInfoClass->getAveragePrice() * multiplier;

	// Blood Bible 보너스 적용
	if (pCreature->isPC() )
	{
		PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);
		int ratio = pPC->getGamblePriceRatio();
		if (ratio != 0 )
		{
			// ratio 값은 마이너스 값이다.
			finalPrice += getPercentValue(finalPrice, ratio);
		}
	}

	return finalPrice;
}
开发者ID:hillwah,项目名称:darkeden,代码行数:61,代码来源:PriceManager.cpp

示例9: getSelfPlayer

void Zone::stopFollow() {
	PlayerCreature* player = getSelfPlayer();

	Locker _locker(player);

	player->setFollow(NULL);
	client->getClient()->info("stopped following", true);
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:8,代码来源:Zone.cpp

示例10: throw

void CGStashRequestBuyHandler::execute (CGStashRequestBuy* pPacket , Player* pPlayer)
	 throw(ProtocolException , Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
	__BEGIN_DEBUG

#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	GamePlayer*     pGamePlayer     = dynamic_cast<GamePlayer*>(pPlayer);
	Creature*       pPC             = pGamePlayer->getCreature();
	PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pPC);

	BYTE curStashNum = pPlayerCreature->getStashNum();

	// 가지고 있는 보관함이 맥스라면 리턴
	if (curStashNum >= STASH_RACK_MAX)
	{
		GCNPCResponse failpkt;
		failpkt.setCode(NPC_RESPONSE_STASH_SELL_FAIL_MAX);
		pPlayer->sendPacket(&failpkt);
		return;
	}

	Price_t price = g_pPriceManager->getStashPrice(curStashNum+1);

	// 돈이 모자라도 실패쥐.
	if (pPlayerCreature->getGold() < price)
	{
		GCNPCResponse failpkt;
		failpkt.setCode(NPC_RESPONSE_STASH_SELL_FAIL_MONEY);
		pPlayer->sendPacket(&failpkt);
		return;
	}

	// 보관함 갯수를 한 칸 늘려주고...
	pPlayerCreature->setStashNumEx(curStashNum+1);

	// 돈을 줄인다.
	//pPlayerCreature->setGoldEx(pPlayerCreature->getGold() - price);

	// by sigi. 2002.9.4
	pPlayerCreature->decreaseGoldEx(price);

	// 마지막으로 OK 패킷을 날려준다.
	GCNPCResponse okpkt;
	okpkt.setCode(NPC_RESPONSE_STASH_SELL_OK);
	pPlayer->sendPacket(&okpkt);

#endif

	__END_DEBUG
	__END_DEBUG_EX __END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:56,代码来源:CGStashRequestBuyHandler.cpp

示例11: throw

void CGSMSSendHandler::execute (CGSMSSend* pPacket , Player* pPlayer)
	 throw(ProtocolException , Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	Assert(pGamePlayer != NULL);

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
	Assert(pPC != NULL);

	filelog("SMS.log", "[%s:%s] %s", pGamePlayer->getID().c_str(), pPC->getName().c_str(), pPacket->toString().c_str());
	GCAddressListVerify gcVerify;

	if (pPC->getSMSCharge() < pPacket->getNumbersList().size() )
	{
		filelog("SMS.log", "[%s:%s] Charge가 모자랍니다.", pGamePlayer->getID().c_str(), pPC->getName().c_str());
		gcVerify.setCode(GCAddressListVerify::SMS_SEND_FAIL);
		gcVerify.setParameter(GCAddressListVerify::SMS_SEND_FAIL_NOT_ENOUGH_CHARGE);
		pGamePlayer->sendPacket(&gcVerify);
		return;
	}

	pPC->setSMSCharge(pPC->getSMSCharge() - pPacket->getNumbersList().size());

	char buffer[100];
	sprintf(buffer, "SMSCharge=%u", pPC->getSMSCharge());
	pPC->tinysave(buffer);

	list<string>::const_iterator itr = pPacket->getNumbersList().begin();
	list<string>::const_iterator endItr = pPacket->getNumbersList().end();

	for (; itr != endItr ; ++itr )
	{
		if (SMSServiceThread::Instance().isValidNumber(*itr ) )
		{
			SMSMessage* pMsg = new SMSMessage(pPC->getName(), *itr, pPacket->getCallerNumber(), pPacket->getMessage());
			SMSServiceThread::Instance().pushMessage(pMsg);
		}
	}

	gcVerify.setCode(GCAddressListVerify::SMS_SEND_OK);
	gcVerify.setParameter(pPC->getSMSCharge());
	pGamePlayer->sendPacket(&gcVerify);

#endif
	
	__END_DEBUG_EX __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:54,代码来源:CGSMSSendHandler.cpp

示例12: throw

//////////////////////////////////////////////////////////////////////////////
// 플레이어가 팔려고 하는 아이템을 가지고 있는지 확인한 다음에,
// 일반 아이템과 모터 사이클 처리 부분으로 분기한다.
//////////////////////////////////////////////////////////////////////////////
void CGShopRequestSellHandler::execute (CGShopRequestSell* pPacket , Player* pPlayer)
	 throw(ProtocolException , Error) {
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);
	
	ObjectID_t      ITEMOID     = pPacket->getItemObjectID();
	BYTE            OPCODE      = pPacket->getOpCode();
	GamePlayer*     pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	Creature*       pCreature   = pGamePlayer->getCreature();
	PlayerCreature* pPC         = dynamic_cast<PlayerCreature*>(pCreature);

	if (OPCODE == SHOP_REQUEST_SELL_NORMAL) {
		// 플레이어가 팔려고 하는 아이템을 가지고 있는지 검사
		Inventory* pInventory = pPC->getInventory();
		if (pInventory->hasItem(ITEMOID) == false) 
			throw ProtocolException("CGShopRequestSellHandler::execute() : No such item to sell!");

		Item* pItem = pInventory->getItemWithObjectID(ITEMOID);
		if (pItem == NULL || pPC->getStore()->hasItem(pItem))
			return sendFailPacket(pPacket, pPlayer);

		//ItemInfo* pItemInfo = g_pItemInfoManager->getItemInfo(pItem->getItemClass(), pItem->getItemType());
		//Assert(pItemInfo!=NULL);

		// 유니크 아이템은 못판다.
		// 특정 아이템 클래스는 팔 수 없다. by sigi. 2002.8.29
		// 선물 상자는 팔 수 있다. by bezz. 2002.12.13
		// 커플링은 팔 수 없다. by Sequoia. 2003. 3. 3
		// ItemUtil 안에 canSell 로 Extract 2003. 3. 3
		if (!canSell(pItem))
			return sendFailPacket(pPacket, pPlayer);
		else if (pItem->getItemClass() == Item::ITEM_CLASS_KEY && pItem->getItemType() == 2) 
			executeMotorcycle(pPacket, pPlayer);
		else 
			executeNormal(pPacket, pPlayer);
	}
	else if (OPCODE == SHOP_REQUEST_SELL_ALL_SKULL)
		executeOpAllSkull(pPacket, pPlayer);
	else if (OPCODE == SHOP_REQUEST_SWAP_ADVANCEMENT_ITEM)
		executeOpSwapAdvancementItem(pPacket, pPlayer);
	else
		throw ProtocolException("CGShopRequestSellHandler::execute() : unknown op code");
	
#endif

	__END_DEBUG_EX __END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:55,代码来源:CGShopRequestSellHandler.cpp

示例13: throw

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionGiveItem::execute (Creature * pCreature1 , Creature * pCreature2) 
	throw(Error)
{
	__BEGIN_TRY

	Assert(pCreature2 != NULL);
	Assert(pCreature2->isPC());

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
	Assert(pPC != NULL);

	Player* pPlayer = pCreature2->getPlayer();
	Assert(pPlayer != NULL);

	list<OptionType_t> optionTypeList;

	Item* pItem = g_pItemFactoryManager->createItem(m_ItemClass, m_ItemType, optionTypeList);
	Assert(pItem != NULL);
	
	_TPOINT pt;

	Inventory* pInventory = pPC->getInventory();
	Assert(pInventory != NULL);
	
	if (!pInventory->getEmptySlot(pItem, pt))
	{
		// ConditionHasInvenSpace 컨디션과 반드시 함께 써야만 한다.
		throw Error("ActionGiveItem: 제발 ConditionHasInvenSpace랑 같이 쓰자. 인벤토리에 자리없다.");
	}

	CoordInven_t X = pt.x;
	CoordInven_t Y = pt.y;

	pPC->getZone()->getObjectRegistry().registerObject(pItem);
	pInventory->addItem(X, Y, pItem);
	pItem->create(pPC->getName(), STORAGE_INVENTORY, 0, X, Y);

	if (pItem != NULL && pItem->isTraceItem() )
	{
		remainTraceLog(pItem, "ActionGiveItem", pCreature2->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
		remainTraceLogNew(pItem, pCreature2->getName(), ITL_GET, ITLD_EVENTNPC , pCreature2->getZone()->getZoneID());
	}

	// 클라이언트에 선물이 추가되었음을 알린다.
	GCCreateItem gcCreateItem;
	makeGCCreateItem(&gcCreateItem, pItem, X, Y);
	pPlayer->sendPacket(&gcCreateItem);

	__END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:53,代码来源:ActionGiveItem.cpp

示例14: Assert

bool DynamicZoneGateOfAlter::openGateToAlter()
{
	Assert(m_pZone != NULL);

	// 퀘스트를 진행시킨다.
	map<ObjectID_t, Creature*>::const_iterator itr = m_pZone->getPCManager()->getCreatures().begin();
	map<ObjectID_t, Creature*>::const_iterator endItr = m_pZone->getPCManager()->getCreatures().end();

	for (; itr != endItr; ++itr )
	{
		Assert(itr->second != NULL);
		
		if (itr->second->isPC() )
		{
			PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(itr->second);
			Assert(pPC != NULL);

			pPC->getGQuestManager()->clearDynamicZone(m_TemplateZoneID);
		}
	}

	// 포탈 위치를 찾아서 그 위에다 EffectTilePortal 을 보낸다.
	int tx = -1;
	int ty = -1;
	for (int x=0; x<m_pZone->getWidth(); x++)
	{
		for (int y=0; y<m_pZone->getHeight(); y++)
		{
			Tile& tile = m_pZone->getTile(x,y);

			if (tile.hasPortal())
			{
				tx = x;
				ty = y;
			}
		}
	}

	if (tx != -1 )
	{
		GCAddEffectToTile gcAddEffectToTile;
		gcAddEffectToTile.setEffectID(Effect::EFFECT_CLASS_TILE_PORTAL);
		gcAddEffectToTile.setDuration(999999);
		gcAddEffectToTile.setXY(tx, ty);

		m_pZone->broadcastPacket(&gcAddEffectToTile);
	}

	return true;
}
开发者ID:hillwah,项目名称:darkeden,代码行数:50,代码来源:DynamicZoneGateOfAlter.cpp

示例15: throw

////////////////////////////////////////////////////////////////////////////////
// is satisfied?
////////////////////////////////////////////////////////////////////////////////
bool ConditionNotGuildMember::isSatisfied (Creature * pCreature1 , Creature * pCreature2, void* pParam) const 
	throw() 
{ 
	Assert(pCreature2 != NULL);
	Assert(pCreature2->isPC());

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);

	// 길드 이름을 가져와서 없으면 길드원이 아니다
	if (pPC->getGuildName().size() == 0 )
		return true;

	return false;
}
开发者ID:hillwah,项目名称:darkeden,代码行数:17,代码来源:ConditionNotGuildMember.cpp


注:本文中的PlayerCreature类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。