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


C++ NXWCLIENT类代码示例

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


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

示例1: item_bounce6

static void item_bounce6(const NXWCLIENT client, const P_ITEM pi)
{
	if ( client != NULL )
	{
		VALIDATEPI(pi);
		Sndbounce5( client->toInt() );
		if ( client->isDragging() )
		{
			client->resetDragging();
			item_bounce4( client->toInt(), pi );
		}
	}
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:13,代码来源:dragdrop.cpp

示例2: ItemDroppedOnGuard

static bool ItemDroppedOnGuard(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
	if (ps == NULL)
		return false;
	VALIDATEPIR(pi, false);
	char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
	NXWSOCKET  s=ps->toInt();
	P_CHAR pc = ps->currChar();
	VALIDATEPCR(pc,false);

	P_CHAR pc_t=pointers::findCharBySerial(pp->Tserial); //the guard
	VALIDATEPCR(pc_t,false);
	// Search for the key word "the head of"
	if( strstr( pi->getCurrentNameC(), "the head of" ) ) //!!! Wrong! it must check the ItemID, not the name :(
	{
		// This is a head of someone, see if the owner has a bounty on them
		P_CHAR own=pointers::findCharBySerial(pi->getOwnerSerial32());
		VALIDATEPCR(own,false);

		if( own->questBountyReward > 0 )
		{
			// Give the person the bounty assuming that they are not the
			// same person as the reward is for
			if( pc->getSerial32() != own->getSerial32() )
			{
				// give them the gold for bringing the villan to justice
				addgold( s, own->questBountyReward );
				pc->playSFX( goldsfx( own->questBountyReward ) );

				// Now thank them for their hard work
				sprintf( temp, TRANSLATE("Excellent work! You have brought us the head of %s. Here is your reward of %d gold coins."),
					own->getCurrentNameC(), own->questBountyReward );
				pc_t->talk( s, temp, 0);

				// Delete the Bounty from the bulletin board
				BountyDelete(own );

				// xan : increment fame & karma :)
				pc->modifyFame( ServerScp::g_nBountyFameGain );
				pc->IncreaseKarma(ServerScp::g_nBountyKarmaGain);
			}
			else
				pc_t->talk( s, TRANSLATE("You can not claim that prize scoundrel. You are lucky I don't strike you down where you stand!"),0);

			// Delete the item
			pi->Delete();
		}
	}
	return true;
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:50,代码来源:dragdrop.cpp

示例3: profileStuff

void profileStuff( NXWCLIENT ps, cPacketCharProfileReq& p )
{
	
	if( ps==NULL ) return;
	P_CHAR pc= ps->currChar();
	VALIDATEPC( pc );
	
	P_CHAR who=pointers::findCharBySerial( p.chr.get() );
	VALIDATEPC( who );

	if( p.update ) { //update profile
		if( ( who->getSerial32()!=pc->getSerial32() ) && !pc->IsGMorCounselor() ) 
			return; //lamer fix
		who->profile = p.profile;
	}
	else { //only send
		cPacketCharProfile resp;
		resp.chr=p.chr;
		resp.title+= who->getCurrentName();
		resp.staticProfile = who->staticProfile;
		resp.profile = &who->profile;
		resp.send( ps );

	}
					
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:26,代码来源:rcvpkg.cpp

示例4: receive

void clPacketPartyDecline::receive( NXWCLIENT ps )
{
	if( ps==NULL ) return;
	NXWSOCKET s = ps->toInt();
	
	this->offset = headerSize;
	this->getFromSocket( s, (char*)&this->leader, sizeof(eSERIAL) );
}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:8,代码来源:packets.cpp

示例5: send

void csPacketPartyInvite::send( NXWCLIENT ps )
{
	if( ps==NULL )
		return;

	size=headerSize;
	Xsend( ps->toInt(), getBeginValid(), headerSize );
}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:8,代码来源:packets.cpp

示例6: ItemDroppedOnPet

static bool ItemDroppedOnPet(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
	if (ps == NULL) return false;
	VALIDATEPIR(pi, false);
	P_CHAR pet = pointers::findCharBySerial(pp->Tserial);
	VALIDATEPCR(pet, false);
	NXWSOCKET  s = ps->toInt();
	P_CHAR pc = ps->currChar();
	VALIDATEPCR(pc, false);

	if((pet->hunger<6) && (pi->type==ITYPE_FOOD))//AntiChrist new hunger code for npcs
	{
		pc->playSFX( (UI16)(0x3A+(rand()%3)) );	//0x3A - 0x3C three different sounds

		if(pi->poisoned)
		{
			pet->applyPoison(PoisonType(pi->poisoned));
		}

		std::string itmname;
		if( pi->getCurrentName() == "#" )
		{
			char temp2[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
			pi->getName(temp2);
			itmname = temp2;
		}
		else itmname = pi->getCurrentName();

		pet->emotecolor = 0x0026;
		pet->emoteall(TRANSLATE("* You see %s eating %s *"), 1, pet->getCurrentNameC(), itmname.c_str() );
		pet->hunger++;
	} else
	{
		ps->sysmsg(TRANSLATE("It doesn't appear to want the item"));
		Sndbounce5(s);
		if (ps->isDragging())
		{
			ps->resetDragging();
			item_bounce5(s,pi);

		}
	}
	return true;
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:44,代码来源:dragdrop.cpp

示例7: ItemDroppedOnSelf

static bool ItemDroppedOnSelf(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
	if (ps == NULL) return false;
	VALIDATEPIR(pi, false);
//	NXWSOCKET  s=ps->toInt();
//	CHARACTER cc=ps->currCharIdx();
	P_CHAR pc = ps->currChar(); // MAKE_CHAR_REF(cc);
	VALIDATEPCR(pc, false);

	Location charpos = pc->getPosition();

	if (pi->getId() >= 0x4000 ) // crashfix , prevents putting multi-objects ni your backback
	{
		ps->sysmsg(TRANSLATE("Hey, putting houses in your pack crashes your back and client !"));
		pi->MoveTo( charpos );
		pi->Refresh();//AntiChrist
		return true;
	}

//	if (pi->glow>0) // glowing items
//	{
//		pc->addHalo(pi);
//		pc->glowHalo(pi);
//	}

	P_ITEM pack = pc->getBackpack();
	if (pack==NULL) // if player has no pack, put it at its feet
	{
		pi->MoveTo( charpos );
		pi->Refresh();
	}
	else
	{
		pack->AddItem(pi); // player has a pack, put it in there

		weights::NewCalc(pc);//AntiChrist bugfixes
		statwindow(pc,pc);
		pc->playSFX( itemsfx(pi->getId()) );
	}
	return true;
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:41,代码来源:dragdrop.cpp

示例8: RcvAttack

void RcvAttack(NXWCLIENT ps)
{

	if ( ps == NULL )
			return;
	NXWSOCKET  s=ps->toInt();
	P_CHAR pc = ps->currChar();
	VALIDATEPC( pc );
	P_CHAR victim=pointers::findCharBySerPtr(buffer[s] +1);
	VALIDATEPC( victim );

	if( pc->dead )
			deadattack( s, DEREF_P_CHAR(victim) );
	else
		if( pc->jailed )
			sysmessage(s,TRANSLATE("There is no fighting in the jail cells!"));
		else
			AttackStuff(s,victim);



}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:22,代码来源:rcvpkg.cpp

示例9: ItemDroppedOnTrainer

static bool ItemDroppedOnTrainer(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
	if (ps == NULL) return false;
	VALIDATEPIR(pi, false);
	NXWSOCKET  s = ps->toInt();
	P_CHAR pc = ps->currChar();
	VALIDATEPCR(pc,false);
	P_CHAR pc_t = pointers::findCharBySerial(pp->Tserial);
	VALIDATEPCR(pc_t,false);

	if( pi->getId() == ITEMID_GOLD )
	{ // They gave the NPC gold
		UI08 sk=pc_t->trainingplayerin;
		pc_t->talk( s, TRANSLATE("I thank thee for thy payment. That should give thee a good start on thy way. Farewell!"),0);

		int sum = pc->getSkillSum();
		int delta = pc_t->getTeachingDelta(pc, sk, sum);

		if(pi->amount>delta) // Paid too much
		{
			pi->amount-=delta;

			Sndbounce5(s);
			if (ps->isDragging())
			{
				ps->resetDragging();
				item_bounce5(s,pi);
			}
		}
		else
		{
			if(pi->amount < delta)		// Gave less gold
				delta = pi->amount;		// so adjust skillgain
			pi->Delete();
		}
		pc->baseskill[sk]+=delta;
		Skills::updateSkillLevel(pc, sk);
		updateskill(s,sk);

		pc->trainer=-1;
		pc_t->trainingplayerin=0xFF;
		pc->playSFX( itemsfx(pi->getId()) );
	}
	else // Did not give gold
	{
		pc_t->talk( s, TRANSLATE("I am sorry, but I can only accept gold."),0);
		Sndbounce5(s);
		if (ps->isDragging())
		{
			ps->resetDragging();
			item_bounce5(s,pi);
		}
	}//if items[i]=gold
	return true;
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:55,代码来源:dragdrop.cpp

示例10: PickPocketTarget

/*!
\brief Steal from a pickpocket, a stealing training dummy
\author Ripper, updated by Endymion
\param ps the client
*/
void Skills::PickPocketTarget(NXWCLIENT ps)
{
	if( ps == 0 ) return;
	P_CHAR Me = ps->currChar();
	VALIDATEPC(Me);

	if (Me->skill[STEALING] < 300)
	// check if under 30 in stealing
	{
		Me->checkSkill( STEALING, 0, 1000);
		// check their skill
		Me->playSFX(0x0249);
		// rustling sound..dont know if right but it works :)
	}
	else
        Me->sysmsg(TRANSLATE("You learn nothing from practicing here"));
        	// if over 30 Stealing..dont learn.
}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:23,代码来源:thievery.cpp

示例11: handleButton

void cAddMenu::handleButton( NXWCLIENT ps, cClientPacket* pkg  )
{
	
	SERIAL button;
	if( isIconList( pkg->cmd ) )
		button = ((cPacketResponseToDialog*)pkg)->index.get();
	else {
		button = ((cPacketMenuSelection*)pkg)->buttonId.get();
		if( button!=MENU_CLOSE )
			button = ((cMenu*)oldmenu->type)->getButton( button );
	}

	if( button<=MENU_CLOSE )
		return;

	commands[button-1].execute( ps->toInt() );
	
}
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:18,代码来源:addmenu.cpp

示例12: ItemDroppedOnBeggar

static bool ItemDroppedOnBeggar(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
	if (ps == NULL)
		return false;

	VALIDATEPIR(pi, false);

	char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var

	NXWSOCKET  s=ps->toInt();
	P_CHAR pc=ps->currChar();
	VALIDATEPCR(pc,false);

	P_CHAR pc_t=pointers::findCharBySerial(pp->Tserial); //beggar
	VALIDATEPCR(pc_t,false);

	if(pi->getId()!=ITEMID_GOLD)
	{
		sprintf(temp,TRANSLATE("Sorry %s i can only use gold"), pc->getCurrentNameC());
		pc_t->talk( s,temp,0);
		Sndbounce5(s);
		if (ps->isDragging())
		{
			ps->resetDragging();
			item_bounce5(s,pi);
			return true;
		}
	}
	else
	{
		sprintf(temp,TRANSLATE("Thank you %s for the %i gold!"), pc->getCurrentNameC(), pi->amount);
		pc_t->talk( s,temp,0);
		if(pi->amount<=100)
		{
			pc->IncreaseKarma(10);
			ps->sysmsg(TRANSLATE("You have gain a little karma!"));
		}
		else if(pi->amount>100)
		{
			pc->IncreaseKarma(50);
			ps->sysmsg(TRANSLATE("You have gain some karma!"));
		}
		pi->Delete();
		return true;
	}
	return true;
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:47,代码来源:dragdrop.cpp

示例13: execMake

/*!
\brief executes a "MAKE" command
\author Xanathar
\param pc player who do make
\param n item number
*/
void cMakeMenu::execMake( NXWCLIENT ps, UI32 item )
{
    
	P_CHAR pc = ps->currChar();

    if( pc->dead ) {
        pc->sysmsg(TRANSLATE("Ever thought an ethereal soul can't really do some actions ?"));
        return;
    }

	cMakeItem* mi = makeItems[item];

	if( ( mi==NULL ) || ( mi->command==NULL ) )
		return;

	if( mi->command->command=="MAKEMENU" ) {
		Skills::MakeMenu( pc, str2num( mi->command->param ), skill, mat[0].id, mat[0].color, mat[1].id, mat[1].color );
		return;
	}

	if( pc->IsGM() ) {
		mi->command->execute( ps->toInt() );
		return;
	}

	if( !mi->checkReq( pc ) )
		return;

    
	bool failed = false;
    if( !pc->checkSkill((Skill)mi->skillToCheck, mi->minskill, mi->maxskill) ) {
		failed = true;
    }

	for( int j=0; j<2; ++j ) {
		cRawItem& raw = mi->reqitems[j];
		if( raw.id!=0 ) {

			UI16 matToDel = raw.number;
			if( failed )
				matToDel = ( matToDel/2>0 )? matToDel/2 : 1;

	        pc->delItems( raw.id, matToDel, raw.color );
		}
	}


	switch( skill )
	{
       	case MINING	:
			pc->playSFX(0x0054);
			break;
       	case BLACKSMITHING	:
			pc->playSFX(0x002A);
			break;
       	case CARPENTRY :
			pc->playSFX(0x023D);
			break;
       	case INSCRIPTION :
			pc->playSFX(0x0249);
			break;
       	case TAILORING :
			pc->playSFX(0x0248);
			break;
       	case TINKERING :
			pc->playSFX(0x002A);
			break;
       	case CARTOGRAPHY :
			pc->playSFX(0x0249);
		break;
	}

	pc->setObjectDelay();

	std::string script;
	std::string amount;
	splitLine( mi->command->param, script, amount );

	if( !failed ) {
		P_ITEM pi = item::CreateFromScript( str2num( script ), pc->getBackpack(), (amount!="")? str2num( amount ) : INVALID );
		VALIDATEPI(pi);

		ps->sysmsg(TRANSLATE("You create the item and place it in your backpack."));

		pi->magic = 1;

        pi->creator = pc->getCurrentName(); // Memorize Name of the creator
        if (pc->skill[skill]>950)
            pi->madewith=skill+1; // Memorize Skill used
        else
            pi->madewith=0-skill-1; // Memorize Skill used ( negative not shown )

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

示例14: target_mine

void Skills::target_mine( NXWCLIENT ps, P_TARGET t )
{

	P_CHAR pc = ps->currChar();
	VALIDATEPC( pc );

	NXWSOCKET s = ps->toInt();
	
	P_ITEM weapon = pc->GetItemOnLayer(1);
	
	if( !canMine( pc, weapon ) )
		return;

	Location target = t->getLocation();

	pc->facexy( target.x, target.y );

	AMXEXECSVTARGET( pc->getSerial32(),AMXT_SKITARGS,MINING,AMX_BEFORE);
	
	if ( pc->hidden )
		pc->unHide();

	LOGICAL floor = false;
	LOGICAL mountain= false;

	map_st map;
	land_st land;

	pc->stm+=ores.stamina;
	if(pc->stm<0) 
		pc->stm=0;
	if(pc->stm>pc->dx) 
		pc->stm=pc->dx;
	pc->updateStats(2);

	

	int cx = abs( (int) (pc->getPosition().x - target.x) );
	int cy = abs( (int) (pc->getPosition().y - target.y) );

	if( (cx>5) || (cy>5) )
	{
		pc->sysmsg(TRANSLATE("You are to far away to reach that"));
		return;
	}

	UI32 id = t->getModel();

	if( SrvParms->minecheck > 0 && !id )
	{
		// mountains are "map0's" and no statics !!!

		data::seekMap( target.x, target.y, map );
		data::seekLand( map.id, land );

		if ( !strcmp(land.name,"rock") || !(strcmp(land.name, "mountain")) || !(strcmp(land.name, "cave")))
			mountain = true;
	}

	data::seekMap( target.x, target.y, map );
	if( !id )
		id= map.id;

	switch( id )
	{
		case 0x0ED3:
		case 0x0EDF:
		case 0x0EE0:
		case 0x0EE1:
		case 0x0EE2:
		case 0x0EE8:
			Skills::GraveDig( s );
			return;
		default:
			break;
	}

	//
	// Caves (Walls & Floors)
	//
	if( (id >= 0x025C && id <= 0x0276) ||
		(id >= 0x027D && id <= 0x0280) ||
		(id >= 0x053B && id <= 0x0553) ||
		(id == 0x056A))
		floor = true;

	// sand (Anthalir)
	if( (id>=0x0017) && (id<=0x0019) )
		floor = true;


	// check if cave floor ENDYMION USE THIS BUT SEE VALUES IN OLD CODE
	/*if ( 
		( (targetData.getModel( s )>>8)==0x05 && ( ((targetData.getModel( s )%256)>=0x3b && (targetData.getModel( s )%256)<=0x4f ) || ((targetData.getModel( s )%256)>=0x51 && (targetData.getModel( s )%256)<=0x53) || (targetData.getModel( s )%256)==0x6a ))&&
		(!( ((targetData.getModel( s )>>8)==0x02)&&
        ( ( ((targetData.getModel( s )%256)>=0x5c) && ((targetData.getModel( s )%256)<=0x76))||(((targetData.getModel( s )%256)>=0x7d)&&((targetData.getModel( s )%256)<=0x80))))))
		
		 floor=1;*/
	

//.........这里部分代码省略.........
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:101,代码来源:extractionskills.cpp

示例15: sendBasic

void cPacketStatWindow::sendBasic( NXWCLIENT ps, UI08 flag  ) {
	if( ps == NULL ) return; //after error here
	this->flag = flag;
	Xsend( ps->toInt(), this->getBeginValid(), this->headerSize );
};
开发者ID:BackupTheBerlios,项目名称:hypnos-svn,代码行数:5,代码来源:packets.cpp


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