本文整理汇总了C++中P_CHAR::getCurrentNameC方法的典型用法代码示例。如果您正苦于以下问题:C++ P_CHAR::getCurrentNameC方法的具体用法?C++ P_CHAR::getCurrentNameC怎么用?C++ P_CHAR::getCurrentNameC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P_CHAR
的用法示例。
在下文中一共展示了P_CHAR::getCurrentNameC方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例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: doubleclick
//.........这里部分代码省略.........
pi->type = ITYPE_POLYMORPH;
return;
case ITYPE_ARMY_ENLIST:
enlist(s, pi->morex);
pi->Delete();
return;
case ITYPE_TELEPORT:
pc->MoveTo( pi->morex,pi->morey,pi->morez );
pc->teleport();
return;
case ITYPE_DRINK:
switch (rand()%2)
{
case 0: pc->playSFX(0x0031); break;
case 1: pc->playSFX(0x0030); break;
}
pi->ReduceAmount(1);
pc->sysmsg( TRANSLATE("Gulp !"));
return;
case ITYPE_GUILDSTONE:
if ( pi->getId() == 0x14F0 || pi->getId() == 0x1869 ) // Check for Deed/Teleporter + Guild Type
{
pc->fx1 = DEREF_P_ITEM(pi);
Guilds->StonePlacement(s);
return;
}
else if (pi->getId() == 0x0ED5) // Check for Guildstone + Guild Type
{
pc->fx1 = DEREF_P_ITEM(pi);
Guilds->Menu(s, 1);
return;
}
else
WarnOut("Unhandled guild item type named: %s with ID of: %X\n", pi->getCurrentNameC(), pi->getId());
return;
case ITYPE_PLAYER_VENDOR_DEED: // PlayerVendors deed
{
P_CHAR vendor = npcs::AddNPCxyz(-1, 2117, charpos.x, charpos.y, charpos.z);
if ( !ISVALIDPC(vendor) )
{
WarnOut("npc-script couldnt find vendor !\n");
return;
}
los = 0;
vendor->npcaitype = NPCAI_PLAYERVENDOR;
vendor->MakeInvulnerable();
vendor->unHide();
vendor->stealth=INVALID;
vendor->dir = pc->dir;
vendor->npcWander = WANDER_NOMOVE;
vendor->SetInnocent();
vendor->setOwnerSerial32( pc->getSerial32() );
vendor->tamed = false;
pi->Delete();
vendor->teleport();
char temp[TEMP_STR_SIZE]; //xan -> this overrides the global temp var
sprintf( temp, TRANSLATE("Hello sir! My name is %s and i will be working for you."), vendor->getCurrentNameC());
vendor->talk(s, temp, 0);
return;
}
case ITYPE_TREASURE_MAP:
Skills::Decipher(pi, s);
return;
示例4: 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;
//.........这里部分代码省略.........
示例5: 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!"));
}
}
示例6: 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);
}