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


C++ P_CHAR::getClient方法代码示例

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


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

示例1: snooping

/*!
\brief Snoop into container
\author Unknow, completly rewritten by Endymion
\param snooper the snooper
\param cont the contanier
*/
void snooping( P_CHAR snooper, P_ITEM cont )
{
	VALIDATEPC(snooper);
	NXWCLIENT ps = snooper->getClient();
	if( ps == NULL ) return;
	NXWSOCKET s = ps->toInt();
	VALIDATEPI(cont);
	P_CHAR owner = cont->getPackOwner();
	VALIDATEPC(owner);
	char temp[TEMP_STR_SIZE];

	if (snooper->getSerial32() == owner->getSerial32())
		snooper->showContainer(cont);
	else if (snooper->IsGMorCounselor())
		snooper->showContainer(cont);
	else
	if ((char_inRange(snooper, owner, 2)) ||(item_inRange(snooper, cont, 2)))
	{
		if ( owner->HasHumanBody() && ( owner->getOwnerSerial32()==snooper->getSerial32()))
			snooper->showContainer(cont);
		else if ( owner->npcaitype == NPCAI_PLAYERVENDOR)
				snooper->showContainer(cont);
		else
		{
			if ((cont->getContSerial()>1) && (cont->getContSerial() != snooper->getSerial32()) )
			{
				
				if ( owner->amxevents[EVENT_CHR_ONSNOOPED])
				{
					g_bByPass = false;
					owner->amxevents[EVENT_CHR_ONSNOOPED]->Call( owner->getSerial32(), snooper->getSerial32());
					if (g_bByPass==true) return;
				}
				/*
				owner->runAmxEvent( EVENT_CHR_ONSNOOPED, owner->getSerial32(), s);
				if (g_bByPass==true)
					return;
				*/
				snooper->objectdelay=SrvParms->snoopdelay * MY_CLOCKS_PER_SEC + uiCurrentTime;
				if ( owner->IsGMorCounselor())
				{
					snooper->sysmsg( TRANSLATE("You can't peek into that container or you'll be jailed."));// AntiChrist
					sprintf( temp, TRANSLATE("%s is trying to snoop you!"), snooper->getCurrentNameC());
					owner->sysmsg(temp);
					return;
				}
				else if (snooper->checkSkill( SNOOPING, 0, 1000))
				{
					snooper->showContainer(cont);
					snooper->sysmsg( TRANSLATE("You successfully peek into that container."));
				}
				else
				{
					snooper->sysmsg( TRANSLATE("You failed to peek into that container."));
					if ( owner->npc )
						owner->talk(s, TRANSLATE("Art thou attempting to disturb my privacy?"), 0);
					else {
						sprintf( temp, TRANSLATE("You notice %s trying to peek into your pack!"), snooper->getCurrentNameC());
						owner->sysmsg( temp );
					}
					snooper->IncreaseKarma(-ServerScp::g_nSnoopKarmaLoss);//AntiChrist
					snooper->modifyFame(-ServerScp::g_nSnoopFameLoss);//AntiChrist
					setCrimGrey(snooper, ServerScp::g_nSnoopWillCriminal);
				}
			}
		}
	}
	else {
		snooper->sysmsg(TRANSLATE("You are too far away!"));
	}
}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:77,代码来源:thievery.cpp

示例2: loadFromScript

void cMakeMenu::loadFromScript( P_CHAR pc )
{
	VALIDATEPC(pc);

	NXWCLIENT ps = pc->getClient();
	if( ps==NULL ) return;

    cScpIterator* iter = Scripts::Create->getNewIterator("SECTION MAKEMENU %i", section);
    if (iter==NULL) return;

	std::vector<std::string> names; //name
	std::vector<std::string> models; //models
    
	this->mat[0].number = ( mat[0].id!=0 )? pc->CountItems( mat[0].id, mat[0].color ) : 0;
	this->mat[1].number = ( mat[1].id!=0 )? pc->CountItems( mat[1].id, mat[1].color ) : 0;

	//da passare a checkReq PDPD
	

	cMakeItem* imk = NULL;
    pc->making=skill;

	oldmenu->style=MENUTYPE_ICONLIST;

/* makemenu menu
SECTION MAKEMENU 1
{
    Blacksmithing
    1416 Armor
    RESOURCE 10
    SKILL 500
    MAKEMENU 3
    13BA Weapons
    RESOURCE 3
    SKILL 100
    MAKEMENU 4
    1BC3 Shields
    RESOURCE 8
    SKILL 250
    MAKEMENU 2
    09ed Misc
    RESOURCE 6
    SKILL 150
    MAKEMENU 105
}
*/
/* makemenu item
SECTION MAKEMENU 2002
{
    Golden Ring Mail
    13F2 Gloves
    RESOURCE 10
    SKILL 338
    ADDITEM $item_golden_ringmail_gloves
    13EF Sleeves
    RESOURCE 14
    SKILL 385
    ADDITEM $item_golden_ringmail_sleeves
    13F1 Leggings
    RESOURCE 16
    SKILL 408
    ADDITEM $item_golden_ringmail_leggings
    13ED Tunic
    RESOURCE 18
    SKILL 432
    ADDITEM $item_golden_ringmail_tunic
}
*/

enum MakeParamType {
MAKE_NEED_NAME = 0, //Blacksmithing
MAKE_NEED_INFO, //1416 Armor
MAKE_NEED_RESOURCE, //RESOURCE 10
MAKE_NEED_SKILL, //SKILL 500
MAKE_NEED_MENUORITEM, //MAKEMENU 3  or ADDITEM $item_golden_ringmail_tunic
};

	MakeParamType type = MAKE_NEED_NAME;
	bool error=false;
	bool canSee = true;
	int item = INVALID;

    int loopexit=0;
    do
    {
		std::string lha;
		std::string rha;
        
	    iter->parseLine(lha, rha);

		if( lha[0]=='{' )
			continue;

		if( lha[0]=='}' )
			break;

		switch( type ) {

			case MAKE_NEED_NAME: //Blacksmithing
				string2wstring( lha, oldmenu->title );
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:101,代码来源:addmenu.cpp

示例3: newbieitems

void newbieitems(P_CHAR pc)
{

	VALIDATEPC(pc);
	
	NXWCLIENT ps=pc->getClient();
	if(ps==NULL)
		return;

	int first, second, third, storeval, itemaddperskill, loopexit = 0;
	char sect[512];
	char whichsect[105];
	cScpIterator* iter = NULL;

	first = bestskill(pc);
	second = nextbestskill(pc, first);
	third = nextbestskill(pc, second);
	if (pc->baseskill[third] < 190)
		third = 46;

	for (itemaddperskill = 1; itemaddperskill <= 5; itemaddperskill++)
	{
		switch (itemaddperskill)
		{
			// first of all the general section with the backpack, else where we put items?
			case 1: strcpy(whichsect, "SECTION ALLNEWBIES");		break;
			case 2:
				if ( (pc->getId() == BODY_MALE) && (pc->getOldId() == BODY_MALE) )
					strcpy(whichsect, "SECTION MALENEWBIES");
				else
					strcpy(whichsect, "SECTION FEMALENEWBIES");
				break;
			case 3: sprintf(whichsect, "SECTION BESTSKILL %i", first);	break;
			case 4: sprintf(whichsect, "SECTION BESTSKILL %i", second);	break;
			case 5: sprintf(whichsect, "SECTION BESTSKILL %i", third);	break;
			default:
				ErrOut("Switch fallout. newbie.cpp, newbieitems()/n"); // Morrolan
		}

		sprintf(sect, whichsect);
		char script1[1000], script2[1000];
		safedelete(iter);
		iter = Scripts::Newbie->getNewIterator(sect);
		if (iter==NULL) return;

		do
		{
			iter->parseLine(script1,script2);

			if (script1[0] == '@') pc->loadEventFromScript(script1, script2); 	// Sparhawk: Huh loading character events 
												// from newbie item scripts????

			if (script1[0] != '}')
			{
				if (!(strcmp("PACKITEM", script1)))
				{
					std::string itemnum, amount;
					splitLine( script2, itemnum, amount );
					int amt = ( amount != "" )? str2num( amount ) : INVALID; //ndEndy defined amount
					P_ITEM pi_n = item::CreateFromScript( str2num( itemnum ), pc->getBackpack(), amt );
					if (ISVALIDPI(pi_n)) {
						pi_n->priv |= 0x02; // Mark as a newbie item
					}
					strcpy(script1, "DUMMY");
				}
				else if (!strcmp("BANKITEM", script1))
				{
					std::string itemnum, amount;
					splitLine( script2, itemnum, amount );
					int amt= (amount!="")? str2num( amount ) : INVALID;
					P_ITEM pi = item::CreateFromScript( str2num( itemnum ), pc->GetBankBox(), amt );
					if (ISVALIDPI(pi)) {
						pi->priv |= 0x02; // Mark as a newbie item
					}
					strcpy(script1, "DUMMY");
				}
				else if (!strcmp("EQUIPITEM", script1))
				{
					P_ITEM pi = item::CreateFromScript( script2 );
					if (ISVALIDPI(pi))
					{
						pi->priv |= 0x02; // Mark as a newbie item
						pi->setCont(pc);
						storeval = pi->getScriptID();
					}
					strcpy(script1, "DUMMY");
				}
			}
		}
		while ((script1[0] != '}') &&(++loopexit < MAXLOOPS));
	
		safedelete(iter);
	}
	
	// Give the character some gold
	if ( goldamount > 0 )
	{
		item::CreateFromScript( "$item_gold_coin", pc->getBackpack(), goldamount );
	}

//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:101,代码来源:newbie.cpp

示例4: send

/*!
\brief Send packet to player
\author Endymion
\since 0.83a
\param pc the player who send to
*/
void cServerPacket::send( P_CHAR pc ) {
	VALIDATEPC( pc )
	send( pc->getClient() );
};
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:10,代码来源:packets.cpp


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