本文整理汇总了C++中NXWCLIENT::toInt方法的典型用法代码示例。如果您正苦于以下问题:C++ NXWCLIENT::toInt方法的具体用法?C++ NXWCLIENT::toInt怎么用?C++ NXWCLIENT::toInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NXWCLIENT
的用法示例。
在下文中一共展示了NXWCLIENT::toInt方法的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
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 );
}
}
}
示例2: receive
void clPacketPartyTellAllMessage::receive( NXWCLIENT ps )
{
if( ps==NULL ) return;
NXWSOCKET s = ps->toInt();
this->offset = headerSize;
getUnicodeStringFromSocket( s, message );
}
示例3: send
void csPacketPartyInvite::send( NXWCLIENT ps )
{
if( ps==NULL )
return;
size=headerSize;
Xsend( ps->toInt(), getBeginValid(), headerSize );
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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() );
}
示例8: 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;
}
示例9: 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);
}
示例10: 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;*/
//.........这里部分代码省略.........
示例11: ItemDroppedOnChar
static bool ItemDroppedOnChar(NXWCLIENT ps, PKGx08 *pp, P_ITEM pi)
{
if (ps == NULL) return true;
VALIDATEPIR(pi, false);
NXWSOCKET s = ps->toInt();
// CHARACTER cc=ps->currCharIdx();
P_CHAR pTC = pointers::findCharBySerial(pp->Tserial); // the targeted character
VALIDATEPCR(pTC, false);
P_CHAR pc_currchar = ps->currChar(); //MAKE_CHAR_REF(cc);
VALIDATEPCR(pc_currchar, false);
Location charpos = pc_currchar->getPosition();
if (!pTC) return true;
if (pi->amxevents[EVENT_IDROPONCHAR]!=NULL)
{
g_bByPass = false;
pi->amxevents[EVENT_IDROPONCHAR]->Call( pi->getSerial32(), pc_currchar->getSerial32(), pTC->getSerial32() );
if (g_bByPass) {
pi->Refresh();
return true;
}
}
if (pc_currchar->getSerial32() != pTC->getSerial32() /*DEREF_P_CHAR(pTC)!=cc*/)
{
if (pTC->npc)
{
if(!pTC->HasHumanBody())
{
ItemDroppedOnPet( ps, pp, pi);
}
else // Item dropped on a Human character
{
// Item dropped on a Guard (possible bounty quest)
if( ( pTC->npc == 1 ) && ( pTC->npcaitype == NPCAI_TELEPORTGUARD ) )
{
ItemDroppedOnGuard( ps, pp, pi);
}
if ( pTC->npcaitype == NPCAI_BEGGAR )
{
ItemDroppedOnBeggar( ps, pp, pi);
}
//This crazy training stuff done by Anthracks ([email protected])
if(pc_currchar->isBeingTrained() )
{
if ( pc_currchar->trainer != pTC->getSerial32())
{
pTC->talk(s, TRANSLATE("Thank thee kindly, but I have done nothing to warrant a gift."),0);
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
}
return true;
}
else // The player is training from this NPC
{
ItemDroppedOnTrainer( ps, pp, pi);
}
}
if ( pTC->isHirable() )
{
// test if gold is enough
if ( pi->amount < pTC->getHireFee() )
{
pTC->talk(s, TRANSLATE("I need much more gold if i shall be working for you !"),0);
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
}
return true;
}
else if ( pi->amount >= pTC->getHireFee() )
{
if ( pi->amount > pTC->getHireFee() )
{
pi->amount=(UI16)(pi->amount - pTC->getHireFee());
pTC->talk(s, TRANSLATE("Thank thee kindly, but this is more than i need for the day."),0);
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce5(s,pi);
}
}
pTC->setOwner(pc_currchar);
tempfx::add(pTC,
pc_currchar,
tempfx::NPC_HIRECOST,
0,
0,
0,
0,
(UI16)(MY_CLOCKS_PER_SEC*secondsperuominute*60*24 )); // call callback every uo day
return true;
}
}
//.........这里部分代码省略.........
示例12: 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!"));
}
}
示例13: doubleclick
/*!
\brief Double click
\author Ripper, rewrite by Endymion
\param ps client of player dbclick
\note Completely redone by Morrolan 20-07-99
\warning I use a define CASE for make more readable the code, if you change name of P_ITEM pi chage also the macro
\todo los
*/
void doubleclick(NXWCLIENT ps)
{
if(ps==NULL) return;
P_CHAR pc = ps->currChar();
VALIDATEPC( pc );
NXWSOCKET s = ps->toInt();
// the 0x80 bit in the first byte is used later for "keyboard" and should be ignored
SERIAL serial = LongFromCharPtr(buffer[s] +1) & 0x7FFFFFFF;
if (isCharSerial(serial))
{
P_CHAR pd=pointers::findCharBySerial(serial);
if(ISVALIDPC(pd))
dbl_click_character(ps, pd);
return;
}
P_ITEM pi = pointers::findItemBySerial(serial);
VALIDATEPI(pi);
if (pi->amxevents[EVENT_IONDBLCLICK]!=NULL) {
g_bByPass = false;
pi->amxevents[EVENT_IONDBLCLICK]->Call( pi->getSerial32(), pc->getSerial32() );
if (g_bByPass==true)
return;
}
/*
g_bByPass = false;
pi->runAmxEvent( EVENT_IONDBLCLICK, pi->getSerial32(), s );
if (g_bByPass==true)
return;
*/
if (!checkItemUsability(pc , pi, ITEM_USE_DBLCLICK))
return;
Location charpos= pc->getPosition();
if (pc->IsHiddenBySpell()) return; //Luxor: cannot use items if under invisible spell
if ( !pc->IsGM() && pc->objectdelay >= uiCurrentTime )
{
pc->sysmsg(TRANSLATE("You must wait to perform another action."));
return;
}
else
pc->objectdelay = SrvParms->objectdelay * MY_CLOCKS_PER_SEC + uiCurrentTime;
///MODIFY, CANT CLICK ITEM AT DISTANCE >2/////
if ( (pc->distFrom(pi)>2) && !pc->IsGM() && !(pc->nxwflags[0] & cChar::flagSpellTelekinesys) ) //Luxor: let's check also for the telekinesys spell
{
pc->sysmsg( TRANSLATE("Must be closer to use this!"));
pc->objectdelay=0;
return;
}
//<Anthalir> VARIAIBLI
tile_st item;
P_ITEM pack= pc->getBackpack();
VALIDATEPI( pack );
data::seekTile( pi->getId(), item );
///FINEVARIABILI
if ( ServerScp::g_nEquipOnDclick )
{
// equip the item only if it is in the backpack of the player
if ((pi->getContSerial() == pack->getSerial32()) && (item.quality != 0) && (item.quality != LAYER_BACKPACK) && (item.quality != LAYER_MOUNT))
{
int drop[2]= {-1, -1}; // list of items to drop, there no reason for it to be larger
int curindex= 0;
NxwItemWrapper wea;
wea.fillItemWeared( pc, true, true, true );
for( wea.rewind(); !wea.isEmpty(); wea++ )
{
P_ITEM pj=wea.getItem();
if(!ISVALIDPI(pj))
continue;
if ((item.quality == LAYER_1HANDWEAPON) || (item.quality == LAYER_2HANDWEAPON))// weapons
{
if (pi->itmhand == 2) // two handed weapons or shield
{
if (pj->itmhand == 2)
drop[curindex++]= DEREF_P_ITEM(pj);
if ( (pj->itmhand == 1) || (pj->itmhand == 3) )
//.........这里部分代码省略.........
示例14: pack_item
void pack_item(NXWCLIENT ps, PKGx08 *pp) // Item is put into container
{
if (ps == NULL) 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
int serial/*, serhash*/;
tile_st tile;
// bool abort=false;
NXWSOCKET s=ps->toInt();
P_CHAR pc=ps->currChar();
VALIDATEPC(pc);
Location charpos= pc->getPosition();
P_ITEM pack;
P_ITEM pCont = pointers::findItemBySerial(pp->Tserial);
VALIDATEPI(pCont);
P_ITEM pItem = pointers::findItemBySerial(pp->Iserial);
VALIDATEPI(pItem);
if (pItem->getId() >= 0x4000)
{
// abort=true; // LB crashfix that prevents moving multi objcts in BP's
ps->sysmsg(TRANSLATE("Hey, putting houses in your pack crashes your back and client!"));
}
//ndEndy recurse only a time
P_ITEM contOutMost = pCont->getOutMostCont();
P_CHAR contOwner = ( !contOutMost->isInWorld() )? pointers::findCharBySerial( contOutMost->getContSerial() ) : NULL;
if( ISVALIDPC(contOwner) ) {
//if ((contOwner->npcaitype==NPCAI_PLAYERVENDOR) && (contOwner->npc) && (contOwner->getOwnerSerial32()!=pc->getSerial32()) )
if ( contOwner->getSerial32() != pc->getSerial32() && contOwner->getOwnerSerial32() != pc->getSerial32() && !pc->IsGM() ) { // Luxor
ps->sysmsg(TRANSLATE("This aint your backpack!"));
Sndbounce5(s);
if (ps->isDragging()) {
ps->resetDragging();
item_bounce3(pItem);
if (pCont->getId() >= 0x4000)
senditem(s, pCont);
}
return;
}
}
if (pCont->amxevents[EVENT_IONPUTITEM]!=NULL) {
g_bByPass = false;
pCont->amxevents[EVENT_IONPUTITEM]->Call( pCont->getSerial32(), pItem->getSerial32(), pc->getSerial32() );
if (g_bByPass)
{
item_bounce6(ps,pItem);
return;
}
}
/*
g_bByPass = false;
pCont->runAmxEvent( EVENT_IONPUTITEM, pCont->getSerial32(), pItem->getSerial32(), pc->getSerial32() );
if (g_bByPass)
{ //AntiChrist to preview item disappearing
item_bounce6(ps,pItem);
return;
}
*/
if (pCont->layer==0 && pCont->getId() == 0x1E5E &&
pCont->getContSerial()==pc->getSerial32())
{
// Trade window???
serial=calcserial(pCont->moreb1, pCont->moreb2, pCont->moreb3, pCont->moreb4);
if(serial==-1) return;
P_ITEM pi_z = pointers::findItemBySerial(serial);
if (ISVALIDPI(pi_z))
if ((pi_z->morez || pCont->morez))
{
pi_z->morez=0;
pCont->morez=0;
sendtradestatus( pi_z, pCont );
}
}
if(SrvParms->usespecialbank)//only if special bank is activated
{
if(pCont->morey==MOREY_GOLDONLYBANK && pCont->morex==MOREX_BANK && pCont->type==ITYPE_CONTAINER)
{
if ( pItem->getId() == ITEMID_GOLD )
{//if they're gold ok
pc->playSFX( goldsfx(2) );
} else
{//if they're not gold..bounce on ground
ps->sysmsg(TRANSLATE("You can only put golds in this bank box!"));
pItem->setContSerial(-1);
pItem->MoveTo( charpos );
pItem->Refresh();
//.........这里部分代码省略.........
示例15: checkauto
//.........这里部分代码省略.........
//
// Shoprestock
//
Restocks->doRestock();
//
// Prison release
//
prison::checkForFree();
//
// Temporary effects
//
if( TIMEOUT( checktempfx ) )
tempfx::checktempeffects();
//
// Characters & items
//
NxwSocketWrapper sw;
sw.fillOnline();
for( sw.rewind(); !sw.isEmpty(); sw++ )
{
NXWCLIENT ps = sw.getClient();
if( ps == NULL )
continue;
P_CHAR pc=ps->currChar();
if( !ISVALIDPC( pc ) )
continue;
if( lightChanged )
dolight(ps->toInt(),worldcurlevel);
pc->heartbeat();
if( TIMEOUT( checknpcs ) || TIMEOUT( checktamednpcs ) || TIMEOUT( checknpcfollow ) )
{
#ifdef SPAR_C_LOCATION_MAP
PCHAR_VECTOR *pCV = pointers::getNearbyChars( pc, VISRANGE, pointers::NPC );
PCHAR_VECTOR it( pCV->begin() ), end( pCV->end() );
P_CHAR pNpc = 0;
while( it != end )
{
pNpc = (*it);
if( pNpc->lastNpcCheck != uiCurrentTime &&
(TIMEOUT( checknpcs ) ||
(TIMEOUT( checktamednpcs ) && pNpc->tamed) ||
(TIMEOUT( checknpcfollow ) && pNpc->npcWander == WANDER_FOLLOW ) ) )
{
pNpc->heartbeat();
pNpc->lastNpcCheck = uiCurrentTime;
}
++it;
}
#else
NxwCharWrapper sc;
sc.fillCharsNearXYZ( pc->getPosition(), VISRANGE, true, false );
for( sc.rewind(); !sc.isEmpty(); sc++ )
{
P_CHAR npc=sc.getChar();
if(!ISVALIDPC(npc) || !npc->npc )
continue;
示例16: get_item
/*!
\brief Get an item
\author Unknow, revamped by Endymion
\param client the client
*/
void get_item( NXWCLIENT client ) // Client grabs an item
{
if ( client == NULL)
return;
P_CHAR pc_currchar = client->currChar();
VALIDATEPC( pc_currchar );
NXWSOCKET s = client->toInt();
P_ITEM pi = pointers::findItemBySerPtr(buffer[s]+1);
VALIDATEPI(pi);
//Luxor: not-movable items
/*if (pi->magic == 2 || (isCharSerial(pi->getContSerial()) && pi->getContSerial() != pc_currchar->getSerial32()) ) {
if (isCharSerial(pi->getContSerial())) {
P_CHAR pc_i = pointers::findCharBySerial(pi->getContSerial());
if (ISVALIDPC(pc_i))
pc_i->sysmsg("Warning, backpack bug located!");
}
if (client->isDragging()) {
client->resetDragging();
UpdateStatusWindow(s,pi);
}
pi->setContSerial( pi->getContSerial(true) );
pi->setPosition( pi->getOldPosition() );
pi->layer = pi->oldlayer;
pi->Refresh();
return;
}*/
pc_currchar->disturbMed(); // Meditation
tile_st item;
data::seekTile( pi->getId(), item );
// Check if item is equiped
if( pi->getContSerial() == pc_currchar->getSerial32() && pi->layer == item.quality )
{
if( pc_currchar->UnEquip( pi, 1 ) == 1 ) // bypass called
{
if( client->isDragging() )
{
UI08 cmd[1]= {0x29};
client->resetDragging();
Xsend(s, cmd, 1);
UpdateStatusWindow(s,pi);
//AoS/ Network->FlushBuffer(s);
}
return;
}
}
P_CHAR owner=NULL;
P_ITEM container=NULL;
if ( !pi->isInWorld() ) { // Find character owning item
if ( isCharSerial( pi->getContSerial()))
{
owner = pointers::findCharBySerial( pi->getContSerial());
}
else // its an item
{
//Endymion Bugfix:
//before check the container.. but if this cont is a subcont?
//so get the outmostcont and check it else:
//can loot without lose karma in subcont
//can steal in trade ecc
//not very good :P
container = pi->getOutMostCont();
if( isCharSerial( container->getContSerial() ) )
owner=pointers::findCharBySerial( container->getContSerial() );
}
if ( ISVALIDPC( owner ) && owner->getSerial32()!=pc_currchar->getSerial32() )
{
if ( !pc_currchar->IsGM() && owner->getOwnerSerial32() != pc_currchar->getSerial32() )
{// Own serial stuff by Zippy -^ Pack aniamls and vendors.
UI08 bounce[2]= { 0x27, 0x00 };
Xsend(s, bounce, 2);
//AoS/ Network->FlushBuffer(s);
if (client->isDragging())
{
client->resetDragging();
pi->setContSerial(pi->getContSerial(),true,false);
item_bounce3(pi);
UpdateStatusWindow(s,pi);
}
return;
}
}
}
if ( ISVALIDPI( container ) )
//.........这里部分代码省略.........
示例17: 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 {
//.........这里部分代码省略.........
示例18: wear_item
void wear_item(NXWCLIENT ps) // Item is dropped on paperdoll
{
if ( ps == NULL )
return;
NXWSOCKET s = ps->toInt();
if (s < 0)
return;
P_CHAR pc=ps->currChar();
VALIDATEPC( pc );
P_CHAR pck = pointers::findCharBySerPtr(buffer[s]+6);
VALIDATEPC( pck );
if( pck->dead ) //Exploit fix: Dead ppl can't equip anything.
return;
P_ITEM pi=pointers::findItemBySerPtr(buffer[s]+1);
VALIDATEPI(pi);
bool resetDragging = false;
if( (pi->getId()>>8) >= 0x40) // LB, client crashfix if multi-objects are moved to PD
resetDragging = true;
tile_st tile;
int serial/*, letsbounce=0*/; // AntiChrist (5) - new ITEMHAND system
data::seekTile(pi->getId(), tile);
if( ( clientDimension[s]==3 ) && (tile.quality==0) )
{
ps->sysmsg(TRANSLATE("You can't wear that"));
resetDragging = true;
}
else {
P_ITEM outmost = pi->getOutMostCont();
P_CHAR vendor = pointers::findCharBySerial( outmost->getContSerial() );
if( ISVALIDPC( vendor ) && ( vendor->getOwnerSerial32() != pc->getSerial32() ) )
{
resetDragging = true;
}
}
if( resetDragging ) {
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce4(s,pi);
UpdateStatusWindow(s,pi);
}
return;
}
if ( pck->getSerial32() == pc->getSerial32() || pc->IsGM() )
{
if ( !pc->IsGM() && pi->st > pck->getStrength() && !pi->isNewbie() ) // now you can equip anything if it's newbie
{
ps->sysmsg(TRANSLATE("You are not strong enough to use that."));
resetDragging = true;
}
else if ( !pc->IsGM() && !checkItemUsability(pc, pi, ITEM_USE_WEAR) )
{
resetDragging = true;
}
else if ( (pc->getId() == BODY_MALE) && ( pi->getId()==0x1c00 || pi->getId()==0x1c02 || pi->getId()==0x1c04 || pi->getId()==0x1c06 || pi->getId()==0x1c08 || pi->getId()==0x1c0a || pi->getId()==0x1c0c ) ) // Ripper...so males cant wear female armor
{
ps->sysmsg(TRANSLATE("You cant wear female armor!"));
resetDragging = true;
}
else if ((((pi->magic==2)||((tile.weight==255)&&(pi->magic!=1))) && !pc->canAllMove()) ||
( (pi->magic==3|| pi->magic==4) && !(pi->getOwnerSerial32()==pc->getSerial32())))
{
resetDragging = true;
}
if( resetDragging ) {
Sndbounce5(s);
if (ps->isDragging())
{
ps->resetDragging();
item_bounce4(s,pi);
UpdateStatusWindow(s,pi);
}
return;
}
// - AntiChrist (4) - checks for new ITEMHAND system
// - now you can't equip 2 hnd weapons with 1hnd weapons nor shields!!
serial= pck->getSerial32(); //xan -> k not cc :)
P_ITEM pj = NULL;
P_CHAR pc_currchar= pck;
// P_ITEM pack= pc_currchar->getBackpack();
//<Luxor>
P_ITEM pW = pc_currchar->getWeapon();
if (tile.quality == 1 || tile.quality == 2)
{ //weapons layers
//.........这里部分代码省略.........
示例19: drop_item
void drop_item(NXWCLIENT ps) // Item is dropped
{
if (ps == NULL) return;
NXWSOCKET s=ps->toInt();
// CHARACTER cc=ps->currCharIdx();
PKGx08 pkgbuf, *pp=&pkgbuf;
pp->Iserial=LongFromCharPtr(buffer[s]+1);
pp->TxLoc=ShortFromCharPtr(buffer[s]+5);
pp->TyLoc=ShortFromCharPtr(buffer[s]+7);
pp->TzLoc=buffer[s][9];
pp->Tserial=LongFromCharPtr(buffer[s]+10);
//#define debug_dragg
if (clientDimension[s]==3)
{
// UO:3D clients send SOMETIMES two dragg packets for a single dragg action.
// sometimes we HAVE to swallow it, sometimes it has to be interpreted
// if UO:3D specific item loss problems are reported, this is probably the code to blame :)
// LB
P_ITEM pi = pointers::findItemBySerial(pp->Iserial);
#ifdef debug_dragg
if (ISVALIDPI(pi)) { sprintf(temp, "%04x %02x %02x %01x %04x i-name: %s EVILDRAG-old: %i\n",pp->Iserial, pp->TxLoc, pp->TyLoc, pp->TzLoc, pp->Tserial, pi->name, clientInfo[s]->evilDrag); ConOut(temp); }
else { sprintf(temp, "blocked: %04x %02x %02x %01x %04x i-name: invalid item EVILDRAG-old: %i\n",pp->Iserial, pp->TxLoc, pp->TyLoc, pp->TzLoc, pp->Tserial, clientInfo[s]->evilDrag); ConOut(temp); }
#endif
if ( (pp->TxLoc==-1) && (pp->TyLoc==-1) && (pp->Tserial==0) && (clientInfo[s]->evilDrag) )
{
clientInfo[s]->evilDrag=false;
#ifdef debug_dragg
ConOut("Swallow only\n");
#endif
return;
} // swallow! note: previous evildrag !
else if ( (pp->TxLoc==-1) && (pp->TyLoc==-1) && (pp->Tserial==0) && (!clientInfo[s]->evilDrag) )
{
#ifdef debug_dragg
ConOut("Bounce & Swallow\n");
#endif
item_bounce6(ps, pi);
return;
}
else if ( ( (pp->TxLoc!=-1) && (pp->TyLoc!=-1) && ( pp->Tserial!=-1)) || ( (pp->Iserial>=0x40000000) && (pp->Tserial>=0x40000000) ) )
clientInfo[s]->evilDrag=true; // calc new evildrag value
else clientInfo[s]->evilDrag=false;
}
#ifdef debug_dragg
else
{
P_ITEM pi = pointers::findItemBySerial(pp->Iserial);
if (ISVALIDPI(pi)) { sprintf(temp, "blocked: %04x %02x %02x %01x %04x i-name: %s EVILDRAG-old: %i\n",pp->Iserial, pp->TxLoc, pp->TyLoc, pp->TzLoc, pp->Tserial, pi->name, clientInfo[s]->evilDrag); ConOut(temp); }
}
#endif
// if ( (buffer[s][10]>=0x40) && (buffer[s][10]!=0xff) )
if ( isItemSerial(pp->Tserial) && (pp->Tserial != INVALID) ) // Invalid target => invalid container => put inWorld !!!
pack_item(ps,pp);
else
dump_item(ps,pp);
}
示例20: 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 );
};
注:本文中的NXWCLIENT::toInt方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。