本文整理汇总了C++中P_CHAR::IsGMorCounselor方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::IsGMorCounselor方法的具体用法?C++ P_CHAR::IsGMorCounselor怎么用?C++ P_CHAR::IsGMorCounselor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::IsGMorCounselor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: target_randomSteal
/*!
\brief Steal random
\author Unknow, updated by Endymion
\param ps the client
\todo add string because it's locked contanier into translate
*/
void Skills::target_randomSteal( NXWCLIENT ps, P_TARGET t )
{
P_CHAR thief=ps->currChar();
VALIDATEPC(thief);
P_CHAR victim = pointers::findCharBySerial( t->getClicked() );
VALIDATEPC(victim);
if (thief->getSerial32() == victim->getSerial32() || thief->getSerial32()==victim->getOwnerSerial32())
{
thief->sysmsg(TRANSLATE("You catch yourself red handed."));
return;
}
if (victim->npcaitype == NPCAI_PLAYERVENDOR)
{
thief->sysmsg(TRANSLATE("You cannot steal from player vendors."));
return;
}
if (victim->IsGMorCounselor() )
{
thief->sysmsg( TRANSLATE("You can't steal from gods."));
return;
}
P_ITEM pack= victim->getBackpack();
if ( !ISVALIDPI(pack))
{
thief->sysmsg(TRANSLATE("bad luck, your victim doesn't have a backpack"));
return;
}
char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
char temp2[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
sprintf(temp, TRANSLATE("You reach into %s's pack to steal something ..."), victim->getCurrentNameC() );
thief->sysmsg(temp);
if ( char_inRange(thief,victim,1) )
{
P_ITEM pi = NULL;
NxwItemWrapper si;
si.fillItemsInContainer( pack, false );
if( si.size()>0 ) {
int ra=rand()%si.size();
int c=0;
for( si.rewind(); !si.isEmpty(); si++ ) {
c++;
if( c==ra ) {
pi=si.getItem();
break;
}
}
}
if( pi==NULL ) {
thief->sysmsg(TRANSLATE("... and discover your victim doesn't have any posessions"));
return;
}
//Endy can't be not valid after this -^ loop, else error
VALIDATEPI(pi);
if( pi->isNewbie() )
{//newbie
thief->sysmsg(TRANSLATE("... and fail because it is of no value to you."));
return;
}
if(pi->isSecureContainer())
{
thief->sysmsg(TRANSLATE("... and fail because it's a locked container."));
return;
}
if ( thief->checkSkill( STEALING,0,999) )
{
// 0 stealing 2 stones, 10 3 stones, 99.9 12 stones, 100 17 stones !!!
int cansteal = thief->skill[STEALING] > 999 ? 1700 : thief->skill[STEALING] + 200;
if ( ((pi->getWeightActual())>cansteal) && !pi->isContainer())//Containers
thief->sysmsg(TRANSLATE("... and fail because it is too heavy."));
else
if(pi->isContainer() && (weights::RecursePacks(pi)>cansteal))
thief->sysmsg(TRANSLATE("... and fail because it is too heavy."));
else
{
if (victim->amxevents[EVENT_CHR_ONSTOLEN])
{
g_bByPass = false;
//.........这里部分代码省略.........
示例2: doubleclick
//.........这里部分代码省略.........
}
Location charPos = pc->getPosition();
charPos.z = dst.z;
charPos.dispz = dst.dispz;
if ( !pc->IsGM() && !lineOfSight( charPos, dst ) && !(pc->nxwflags[0] & cChar::flagSpellTelekinesys) ) {
pc->sysmsg( TRANSLATE( "You cannot reach the item" ) );
return;
}
//</Luxor>
P_CHAR itmowner = pi->getPackOwner();
if(!pi->isInWorld()) {
if (isItemSerial(pi->getContSerial()) && pi->type != ITYPE_CONTAINER)
{// Cant use stuff that isn't in your pack.
if ( ISVALIDPC(itmowner) && (itmowner->getSerial32()!=pc->getSerial32()) )
return;
}
else
if (isCharSerial(pi->getContSerial()) && pi->type!=(UI32)INVALID)
{// in a character.
P_CHAR wearedby = pointers::findCharBySerial(pi->getContSerial());
if (ISVALIDPC(wearedby))
if (wearedby->getSerial32()!=pc->getSerial32() && pi->layer!=LAYER_UNUSED_BP && pi->type!=ITYPE_CONTAINER)
return;
}
}
if ((pi->magic==4) && (pi->secureIt==1))
{
if (!pc->isOwnerOf(pi) || !pc->IsGMorCounselor())
{
pc->sysmsg( TRANSLATE("That is a secured chest!"));
return;
}
}
if (pi->magic == 4)
{
pc->sysmsg( TRANSLATE("That item is locked down."));
return;
}
if (pc->dead && pi->type!=ITYPE_RESURRECT) // if you are dead and it's not an ankh, FORGET IT!
{
pc->sysmsg(TRANSLATE("You may not do that as a ghost."));
return;
}
else if (!pc->IsGMorCounselor() && pi->layer!=0 && !pc->IsWearing(pi))
{// can't use other people's things!
if (!(pi->layer==LAYER_BACKPACK && SrvParms->rogue==1)) // bugfix for snooping not working, LB
{
pc->sysmsg(TRANSLATE("You cannot use items equipped by other players."));
return;
}
}
// Begin checking objects that we force an object delay for (std objects)
// start trigger stuff
if (pi->trigger > 0)
{
if (pi->trigtype == 0)
示例3: 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!"));
}
}