本文整理汇总了C++中P_CHAR::IsInnocent方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::IsInnocent方法的具体用法?C++ P_CHAR::IsInnocent怎么用?C++ P_CHAR::IsInnocent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::IsInnocent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: target_randomSteal
//.........这里部分代码省略.........
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;
victim->amxevents[EVENT_CHR_ONSTOLEN]->Call(victim->getSerial32(), thief->getSerial32());
if (g_bByPass==true)
return;
}
/*
victim->runAmxEvent( EVENT_CHR_ONSTOLEN, victim->getSerial32(), s);
if (g_bByPass==true)
return;
*/
P_ITEM thiefpack = thief->getBackpack();
VALIDATEPI(thiefpack);
pi->setContSerial( thiefpack->getSerial32() );
thief->sysmsg(TRANSLATE("... and you succeed."));
pi->Refresh();
//all_items(s);
}
}
else
thief->sysmsg(TRANSLATE(".. and fail because you're not good enough."));
if ( thief->skill[STEALING] < rand()%1001 )
{
thief->unHide();
thief->sysmsg(TRANSLATE("You have been caught!"));
thief->IncreaseKarma( ServerScp::g_nStealKarmaLoss);
thief->modifyFame( ServerScp::g_nStealFameLoss);
if (victim->IsInnocent() && thief->attackerserial!=victim->getSerial32() && Guilds->Compare(thief,victim)==0)//AntiChrist
setCrimGrey(thief, ServerScp::g_nStealWillCriminal);//Blue and not attacker and not guild
std::string itmname = "";
if ( pi->getCurrentName() != "#" )
itmname = pi->getCurrentName();
else
{
pi->getName( temp );
itmname = temp;
}
sprintf(temp,TRANSLATE("You notice %s trying to steal %s from you!"), thief->getCurrentNameC(), itmname.c_str());
sprintf(temp2,TRANSLATE("You notice %s trying to steal %s from %s!"), thief->getCurrentNameC(), itmname.c_str(), victim->getCurrentNameC());
if ( victim->npc)
victim->talkAll(TRANSLATE( "Guards!! A thief is amoung us!"),0);
else
victim->sysmsg(temp);
//send to all player temp2 = thief are stealing victim if are more intelligent and a bonus of luck :D
//
//
NxwSocketWrapper sw;
sw.fillOnline( thief, true );
for( sw.rewind(); !sw.isEmpty(); sw++ ) {
NXWCLIENT ps_i=sw.getClient();
if( ps_i==NULL ) continue;
P_CHAR pc_i=ps_i->currChar();
if ( ISVALIDPC(pc_i) )
if( (rand()%10+10==17) || ( (rand()%2==1) && (pc_i->in>=thief->in)))
sysmessage(ps_i->toInt(),temp2);
}
}
}
else
{
thief->sysmsg( TRANSLATE("... and realise you're too far away."));
}
}
示例2: AttackStuff
void AttackStuff(NXWSOCKET s, P_CHAR victim)
{
if ( s < 0 || s >= now )
return;
P_CHAR attacker = MAKE_CHAR_REF( currchar[s] );
VALIDATEPC( attacker );
VALIDATEPC( victim );
if( attacker->getSerial32() == victim->getSerial32() )
return;
if ( attacker->amxevents[EVENT_CHR_ONBEGINATTACK]) {
g_bByPass = false;
attacker->amxevents[EVENT_CHR_ONBEGINATTACK]->Call( attacker->getSerial32(), victim->getSerial32() );
if (g_bByPass==true) return;
}
if ( victim->amxevents[EVENT_CHR_ONBEGINDEFENSE]) {
g_bByPass = false;
victim->amxevents[EVENT_CHR_ONBEGINDEFENSE]->Call( victim->getSerial32(), attacker->getSerial32() );
if (g_bByPass==true) return;
}
/*
attacker->runAmxEvent( EVENT_CHR_ONBEGINATTACK, attacker->getSerial32(), victim->getSerial32() );
if (g_bByPass==true)
return;
victim->runAmxEvent( EVENT_CHR_ONBEGINDEFENSE, victim->getSerial32(), attacker->getSerial32() );
if (g_bByPass==true)
return;
*/
attacker->targserial=victim->getSerial32();
attacker->unHide();
attacker->disturbMed();
if( victim->dead || victim->hp <= 0 )//AntiChrist
{
attacker->sysmsg( TRANSLATE("That person is already dead!") );
return;
}
if ( victim->npcaitype==NPCAI_PLAYERVENDOR)
{
attacker->sysmsg( TRANSLATE("%s cannot be harmed."), victim->getCurrentNameC() );
return;
}
SndAttackOK(s, victim->getSerial32()); //keep the target highlighted
if (!( victim->targserial== INVALID))
{
victim->attackerserial=attacker->getSerial32();
victim->ResetAttackFirst();
}
attacker->SetAttackFirst();
attacker->attackerserial=victim->getSerial32();
if( victim->guarded )
{
NxwCharWrapper sc;
sc.fillOwnedNpcs( victim, false, false );
for ( sc.rewind(); !sc.isEmpty(); sc++ )
{
P_CHAR guard = sc.getChar();
if ( ISVALIDPC( guard ) )
if ( guard->npcaitype == NPCAI_PETGUARD && ( attacker->distFrom( guard )<= 10 ) )
npcattacktarget(attacker, guard);
}
}
if ((region[ victim->region].priv & RGNPRIV_GUARDED) && (SrvParms->guardsactive))
{
if (victim->IsGrey())
attacker->SetGrey();
if (victim->npc==0 && victim->IsInnocent() && (!victim->IsGrey()) && Guildz.compareGuilds( attacker->getGuild(), victim->getGuild() )==0) //REPSYS
{
criminal( attacker );
if (ServerScp::g_nInstantGuard==1)
npcs::SpawnGuard(attacker, victim,attacker->getPosition() );
}
else if( victim->npc && victim->IsInnocent() && !victim->HasHumanBody() && victim->npcaitype!=NPCAI_TELEPORTGUARD )
{
criminal( attacker );
if (ServerScp::g_nInstantGuard==1)
npcs::SpawnGuard(attacker, victim, attacker->getPosition() );
}
else if( victim->npc && victim->IsInnocent() && victim->HasHumanBody() && victim->npcaitype!=NPCAI_TELEPORTGUARD )
{
victim->talkAll( TRANSLATE("Help! Guards! I've been attacked!"), 1);
criminal( victim );
callguards(DEREF_P_CHAR(victim)); // Sparhawk must check if npcs can call guards
}
else if( victim->npc && victim->npcaitype==NPCAI_TELEPORTGUARD)
{
criminal( attacker );
npcattacktarget(victim, attacker);
}
else if ((victim->npc || victim->tamed) && !victim->war && victim->npcaitype!=NPCAI_TELEPORTGUARD)
{
//.........这里部分代码省略.........
示例3: target_stealing
//.........这里部分代码省略.........
return;
}
if (pi->amxevents[EVENT_IONSTOLEN]!=NULL)
{
g_bByPass = false;
pi->amxevents[EVENT_IONSTOLEN]->Call(pi->getSerial32(), thief->getSerial32(), victim->getSerial32());
if (g_bByPass==true)
return;
}
if (victim->amxevents[EVENT_CHR_ONSTOLEN])
{
g_bByPass = false;
victim->amxevents[EVENT_CHR_ONSTOLEN]->Call(victim->getSerial32(), thief->getSerial32());
if (g_bByPass==true)
return;
}
/*
pi->runAmxEvent( EVENT_IONSTOLEN, pi->getSerial32(), s, victim->getSerial32() );
if (g_bByPass==true)
return;
victim->runAmxEvent( EVENT_CHR_ONSTOLEN, victim->getSerial32(), s );
if (g_bByPass==true)
return;
*/
P_ITEM pack= thief->getBackpack();
VALIDATEPI(pack);
pi->setContSerial( pack->getSerial32() );
thief->sysmsg(TRANSLATE("You successfully steal the item."));
pi->Refresh();
result=+200;
//all_items(s); why all item?
}
else
{
thief->sysmsg( TRANSLATE("You failed to steal the item."));
result=-200;
//Only onhide when player is caught!
}
if ( rand()%1000 > ( thief->skill[STEALING] + result ) )
{
thief->unHide();
thief->sysmsg(TRANSLATE("You have been caught!"));
thief->IncreaseKarma(ServerScp::g_nStealKarmaLoss);
thief->modifyFame(ServerScp::g_nStealFameLoss);
if ( victim->IsInnocent() && thief->attackerserial != victim->getSerial32() && Guilds->Compare(thief,victim)==0)
setCrimGrey(thief, ServerScp::g_nStealWillCriminal); //Blue and not attacker and not same guild
std::string itmname ( "" );
char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
char temp2[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
if ( pi->getCurrentName() != "#" )
itmname = pi->getCurrentName();
else
{
pi->getName( temp );
itmname = temp;
}
sprintf(temp,TRANSLATE("You notice %s trying to steal %s from you!"), thief->getCurrentNameC(), itmname.c_str());
sprintf(temp2,TRANSLATE("You notice %s trying to steal %s from %s!"), thief->getCurrentNameC(), itmname.c_str(), victim->getCurrentNameC());
if ( victim->npc )
if( victim->HasHumanBody() )
victim->talkAll(TRANSLATE( "Guards!! A thief is amoung us!"),0);
else
victim->sysmsg(temp);
//send to all player temp2 = thief are stealing victim if are more intelligent and a bonus of luck :D
NxwSocketWrapper sw;
sw.fillOnline( thief, true );
for( sw.rewind(); !sw.isEmpty(); sw++ ) {
NXWCLIENT ps_i=sw.getClient();
if(ps_i==NULL ) continue;
P_CHAR pc_i=ps_i->currChar();
if ( ISVALIDPC(pc_i) )
if( (rand()%10+10==17) || ( (rand()%2==1) && (pc_i->in>=thief->in)))
pc_i->sysmsg(temp2);
}
}
}
else
{
thief->sysmsg(TRANSLATE("You are too far away to steal that item."));
}
AMXEXECSVTARGET( thief->getSerial32(),AMXT_SKITARGS,STEALING,AMX_AFTER);
}