Update of /cvsroot/wpdev/wolfpack/network
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22074/network
Modified Files:
uosocket.cpp
Log Message:
bugfixing session
Index: uosocket.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v
retrieving revision 1.423
retrieving revision 1.424
diff -C2 -d -r1.423 -r1.424
*** uosocket.cpp 6 Oct 2004 00:02:37 -0000 1.423
--- uosocket.cpp 8 Oct 2004 01:13:16 -0000 1.424
***************
*** 2689,2692 ****
--- 2689,2723 ----
}
+ static void walkSellItems(P_ITEM pCont, P_ITEM pPurchase, QPtrList<cItem> &items) {
+ cItem::ContainerContent container = pPurchase->content();
+ cItem::ContainerContent::const_iterator it( container.begin() );
+ cItem::ContainerContent::const_iterator end( container.end() );
+
+ cItem::ContainerContent packcont = pCont->content();
+ cItem::ContainerContent::const_iterator pit;
+
+ // For every pack item search for an equivalent sellitem
+ pit = packcont.begin();
+ while ( pit != packcont.end() ) {
+ P_ITEM pItem = *pit;
+
+ // Containers with content are walked and _not_ sold
+ if (pItem->type() == 1 && pItem->content().size() > 0) {
+ walkSellItems(pItem, pPurchase, items);
+ } else {
+ // Search all sellable items
+ for (it = container.begin(); it != container.end(); ++it) {
+ P_ITEM mItem = *it;
+ if ( pItem->baseid() == mItem->baseid() && pItem->scriptList() == mItem->scriptList() ) {
+ items.append(pItem);
+ break; // Break the inner loop
+ }
+ }
+ }
+
+ ++pit;
+ }
+ }
+
void cUOSocket::sendSellWindow( P_NPC pVendor, P_CHAR pSeller )
{
***************
*** 2700,2727 ****
itemContent.setSerial( pVendor->serial() );
! cItem::ContainerContent container = pPurchase->content();
! cItem::ContainerContent::const_iterator it( container.begin() );
! cItem::ContainerContent::const_iterator end( container.end() );
!
! cItem::ContainerContent packcont = pBackpack->content();
! cItem::ContainerContent::const_iterator pit;
!
! for ( Q_INT32 i = 0; it != end; ++it, ++i )
! {
! P_ITEM mItem = *it;
! if ( mItem )
! {
! pit = packcont.begin();
! while ( pit != packcont.end() )
! {
! if ( *pit && ( *pit )->baseid() == mItem->baseid() && ( *pit )->scriptList() == mItem->scriptList() )
! {
! unsigned int sellprice = mItem->getSellPrice(pVendor);
! itemContent.addItem( ( *pit )->serial(), ( *pit )->id(), ( *pit )->color(), ( *pit )->amount(), sellprice, ( *pit )->getName() );
! items.append( ( *pit ) );
! }
! ++pit;
! }
}
}
--- 2731,2744 ----
itemContent.setSerial( pVendor->serial() );
! walkSellItems(pBackpack, pPurchase, items);
! // Transfer the found items to the sell list
! P_ITEM pItem;
! unsigned int count = 0;
! for (pItem = items.first(); pItem; pItem = items.next()) {
! unsigned int sellprice = pItem->getSellPrice(pVendor);
! if (sellprice != 0) {
! itemContent.addItem( pItem->serial(), pItem->id(), pItem->color(), pItem->amount(), sellprice, pItem->getName() );
! ++count;
}
}
***************
*** 3104,3120 ****
// TODO: Add a XML option for this
! if ( !_player->owns( item ) && !_player->isGM() && _player->isInnocent() )
! {
// Innocent Corpse and not in the same party && party allowance for looting?
! if ( item->hasTag( "notoriety" ) && item->getTag( "notoriety" ).toInt() == 0x01 )
! {
P_PLAYER owner = dynamic_cast<P_PLAYER>( item->owner() );
bool allowed = false;
! if ( owner && owner->party() && owner->party() == _player->party() )
! {
// Check if the player allowed looting his corpse by party members
! if ( owner->party()->lootingAllowed().contains( owner ) )
! {
allowed = true;
}
--- 3121,3133 ----
// TODO: Add a XML option for this
! if ( !_player->owns( item ) && !_player->isGM() && _player->isInnocent() ) {
// Innocent Corpse and not in the same party && party allowance for looting?
! if ( item->hasTag( "notoriety" ) && item->getTag( "notoriety" ).toInt() == 0x01 ) {
P_PLAYER owner = dynamic_cast<P_PLAYER>( item->owner() );
bool allowed = false;
! if ( owner && owner->party() && owner->party() == _player->party() ) {
// Check if the player allowed looting his corpse by party members
! if ( owner->party()->lootingAllowed().contains( owner ) ) {
allowed = true;
}
***************
*** 3127,3130 ****
--- 3140,3150 ----
}
}
+
+ // Get the corpse owner
+ P_PLAYER owner = dynamic_cast<P_PLAYER>(item->owner());
+
+ if (owner && owner != _player) {
+ log(LOG_NOTICE, tr("Looking into corpse of player '%1' ('%2', 0x%3)").arg(owner->name()).arg(owner->account() ? owner->account()->login() : QString("unknown")).arg(owner->serial(), 0, 16));
+ }
}
|