void cDragItems::dropItem( cUOSocket *socket, cUORxDropItem *packet ) { P_PLAYER pChar = socket->player(); if( !pChar ) return; // Get the data SERIAL contId = packet->cont(); Coord_cl dropPos = pChar->pos(); // plane dropPos.x = packet->x(); dropPos.y = packet->y(); dropPos.z = packet->z(); // Get possible containers P_ITEM pItem = FindItemBySerial( packet->serial() ); if( !pItem ) return; P_ITEM iCont = FindItemBySerial( packet->cont() ); P_CHAR cCont = FindCharBySerial( packet->cont() ); // >> SEE LORD BINARIES DROPFIX << // A completely invalid Drop packet if( !iCont && !cCont && ( dropPos.x == 0xFFFF ) && ( dropPos.y == 0xFFFF ) && ( (unsigned char)dropPos.z == 0xFF ) ) { socket->bounceItem( pItem, BR_NO_REASON ); return; } UINT32 weight = pChar->weight(); // Item dropped on Ground if( !iCont && !cCont ) dropOnGround( socket, pItem, dropPos ); // Item dropped on another item else if( iCont ) dropOnItem( socket, pItem, iCont, dropPos ); // Item dropped on char else if( cCont ) dropOnChar( socket, pItem, cCont ); // Handle the sound-effect if( pItem->id() == 0xEED ) goldsfx( socket, pItem->amount(), true ); // Update our weight. if( weight != pChar->weight() ) socket->sendStatWindow(); }
void Destroyable::processDropRules() { for( DropRule& rule : _dropRules ) { if ( rule.chance > (dices::roll(dices::D100) / 100.0f) ) { ActorPtr toDrop = createActor(rule); dropOnGround( toDrop ); } } }
void DieAction::dropItemsFromBody() { WearerPtr wearer = _performer->getFeature<Wearer>(); if ( wearer ) { for ( auto slot : ItemSlotType() ) { ActorPtr item = wearer->unequip(slot); if ( item ) { dropOnGround( item ); } } } }
void Destroyable::dropInventory() { ActorPtr owner = getOwner().lock(); if (owner) { InventoryPtr inventory = owner->getFeature<Inventory>(); if ( inventory ) { for ( ActorPtr item : inventory->items() ) { inventory->remove(item); dropOnGround(item); } } } }
void cDragItems::dropItem( P_CLIENT client ) { P_CHAR pChar = client->player(); // Get the data SERIAL itemId = LongFromCharPtr( &buffer[ client->socket() ][ 1 ] ); SERIAL contId = LongFromCharPtr( &buffer[ client->socket() ][ 10 ] ); Coord_cl dropPos = pChar->pos; // plane+map dropPos.x = ShortFromCharPtr( &buffer[ client->socket() ][ 5 ] ); dropPos.y = ShortFromCharPtr( &buffer[ client->socket() ][ 7 ] ); dropPos.z = buffer[ client->socket() ][ 9 ]; // Get possible containers P_ITEM pItem = FindItemBySerial( itemId ); if( !pItem ) return; P_ITEM iCont = FindItemBySerial( contId ); P_CHAR cCont = FindCharBySerial( contId ); /* >> SEE LORD BINARIES DROPFIXBUGFIXBUG << */ // A completely invalid Drop packet if( !iCont && !cCont && ( dropPos.x == 0xFFFF ) && ( dropPos.y == 0xFFFF ) && ( dropPos.z == 0xFF ) ) { bounceItem( client, pItem ); return; } // Item dropped on Ground if( !iCont && !cCont ) dropOnGround( client, pItem, dropPos ); // Item dropped on another item else if( iCont ) dropOnItem( client, pItem, iCont, dropPos ); // Item dropped on char else if( cCont ) dropOnChar( client, pItem, cCont ); }