本文整理汇总了C++中NXWCLIENT::resetDragging方法的典型用法代码示例。如果您正苦于以下问题:C++ NXWCLIENT::resetDragging方法的具体用法?C++ NXWCLIENT::resetDragging怎么用?C++ NXWCLIENT::resetDragging使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NXWCLIENT
的用法示例。
在下文中一共展示了NXWCLIENT::resetDragging方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2:
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 );
}
}
}
示例3: 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;
}
示例4: 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;
}
示例5: 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
//.........这里部分代码省略.........
示例6: 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 ) )
//.........这里部分代码省略.........
示例7: 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();
//.........这里部分代码省略.........
示例8: dump_item
void dump_item(NXWCLIENT ps, PKGx08 *pp) // Item is dropped on ground or a character
{
if (ps == NULL) return;
tile_st tile;
NXWSOCKET s=ps->toInt();
P_CHAR pc=ps->currChar();
VALIDATEPC(pc);
P_ITEM pi=pointers::findItemBySerial(pp->Iserial);
if (!ISVALIDPI(pi))
{
LogError("client sent bad itemserial %d",pp->Iserial);
return;
}
if ( isCharSerial(pi->getContSerial()) && pi->getContSerial() != pc->getSerial32() ) {
P_CHAR pc_i = pointers::findCharBySerial(pi->getContSerial());
if (ISVALIDPC(pc_i))
pc_i->sysmsg("Warning, backpack disappearing bug located!");
if (ps->isDragging()) {
ps->resetDragging();
UpdateStatusWindow(s,pi);
}
pi->setContSerial( pi->getContSerial(true) );
pi->setPosition( pi->getOldPosition() );
pi->layer = pi->oldlayer;
pi->Refresh();
}
if (pi->magic == 2) { //Luxor -- not movable objects
if (ps->isDragging()) {
ps->resetDragging();
UpdateStatusWindow(s,pi);
}
pi->setContSerial( pi->getContSerial(true) );
pi->MoveTo( pi->getOldPosition() );
pi->layer = pi->oldlayer;
pi->Refresh();
return;
}
if(pi!=NULL)
{
weights::NewCalc(pc);
statwindow(pc,pc);
}
//Ripper...so order/chaos shields disappear when on ground.
if( pi->getId()==0x1BC3 || pi->getId()==0x1BC4 )
{
pc->playSFX( 0x01FE);
staticeffect(DEREF_P_CHAR(pc), 0x37, 0x2A, 0x09, 0x06);
pi->Delete();
return;
}
//test UOP blocking Tauriel 1-12-99
if (!pi->isInWorld())
{
item_bounce6(ps,pi);
return;
}
data::seekTile(pi->getId(), tile);
if (!pc->IsGM() && ((pi->magic==2 || (tile.weight==255 && pi->magic!=1))&&!pc->canAllMove()) ||
( (pi->magic==3 || pi->magic==4) && !(pi->getOwnerSerial32()==pc->getSerial32())))
{
item_bounce6(ps,pi);
return;
}
if (buffer[s][5]!=(unsigned char)'\xFF')
{
if (pi->amxevents[EVENT_IDROPINLAND]!=NULL)
{
g_bByPass = false;
pi->MoveTo(pp->TxLoc,pp->TyLoc,pp->TzLoc);
pi->amxevents[EVENT_IDROPINLAND]->Call( pi->getSerial32(), pc->getSerial32() );
if (g_bByPass) {
pi->Refresh();
return;
}
}
/*
//.........这里部分代码省略.........
示例9: 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;
}
}
//.........这里部分代码省略.........