Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv8092
Modified Files:
commands.cpp console_unix.cpp console_win.cpp items.cpp
npc.cpp npc.h player.cpp Trade.cpp
Log Message:
- Fixed console text not being captured for Remote Admin.
- Fixed vendors showing empty buy gumps
- Changed some vendor text to use cliloc
- Cleaned up dead code
- Fixed cItem::takeGold, returning wrong value
Index: commands.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v
retrieving revision 1.208
retrieving revision 1.209
diff -C2 -d -r1.208 -r1.209
*** commands.cpp 7 Jan 2004 05:01:30 -0000 1.208
--- commands.cpp 8 Jan 2004 08:33:38 -0000 1.209
***************
*** 125,128 ****
--- 125,129 ----
socket->sysMessage( tr("Unknown Command") );
+ return false;
}
Index: console_unix.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_unix.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** console_unix.cpp 26 Sep 2003 01:03:52 -0000 1.10
--- console_unix.cpp 8 Jan 2004 08:33:38 -0000 1.11
***************
*** 154,160 ****
void cConsole::setConsoleTitle( const QString& data )
{
- #if defined(Q_OS_WIN32)
- SetConsoleTitle( data.latin1() );
- #endif
}
--- 154,157 ----
***************
*** 163,218 ****
void cConsole::ChangeColor( WPC_ColorKeys Color )
{
! #if defined(Q_OS_UNIX)
! QString cb = "\e[0m";
! switch( Color )
! {
! case WPC_GREEN: cb = "\e[1;32m";
! break;
! case WPC_RED: cb = "\e[1;31m";
! break;
! case WPC_YELLOW:cb = "\e[1;33m";
! break;
! case WPC_NORMAL:cb = "\e[0m";
! break;
! case WPC_WHITE: cb = "\e[1;37m";
! break;
! case WPC_BROWN: cb = "\e[0;33m";
! break;
! default: cb = "\e[0m";
!
! }
! send( cb );
! #elif defined(Q_OS_WIN32)
! HANDLE ConsoleHandle = GetStdHandle( STD_OUTPUT_HANDLE );
! UI16 ColorKey = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE;
!
! switch( Color )
! {
! case WPC_GREEN:
! ColorKey = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
! break;
!
! case WPC_RED:
! ColorKey = FOREGROUND_RED | FOREGROUND_INTENSITY;
! break;
!
! case WPC_YELLOW:
! ColorKey = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
! break;
!
! case WPC_NORMAL:
! ColorKey = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE;
! break;
!
! case WPC_WHITE:
! ColorKey = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
! break;
!
! default:
! break;
! }
!
! SetConsoleTextAttribute( ConsoleHandle, ColorKey );
! #endif
}
--- 160,175 ----
void cConsole::ChangeColor( WPC_ColorKeys Color )
{
! QString cb = "\e[0m";
! switch( Color )
! {
! case WPC_GREEN: cb = "\e[1;32m"; break;
! case WPC_RED: cb = "\e[1;31m"; break;
! case WPC_YELLOW:cb = "\e[1;33m"; break;
! case WPC_NORMAL:cb = "\e[0m"; break;
! case WPC_WHITE: cb = "\e[1;37m"; break;
! case WPC_BROWN: cb = "\e[0;33m"; break;
! default: cb = "\e[0m"; break;
! }
! send( cb );
}
Index: console_win.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_win.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** console_win.cpp 7 Jan 2004 03:09:09 -0000 1.19
--- console_win.cpp 8 Jan 2004 08:33:38 -0000 1.20
***************
*** 613,616 ****
--- 613,633 ----
if( !GetCapture() )
SendMessage( logWindow, WM_VSCROLL, SB_BOTTOM, 0 );
+
+ // Update linebuffer_, so that web console works as well.
+ if( sMessage.contains( "\n" ) )
+ {
+ incompleteLine_.append( sMessage ); // Split by \n
+ QStringList lines = QStringList::split( "\n", incompleteLine_, true );
+
+ // Insert all except the last element
+ for( int i = 0; i < lines.count() - 1; ++i )
+ linebuffer_.push_back( lines[i] );
+
+ incompleteLine_ = lines[ lines.count() - 1 ];
+ }
+ else
+ {
+ incompleteLine_.append( sMessage );
+ }
}
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.362
retrieving revision 1.363
diff -C2 -d -r1.362 -r1.363
*** items.cpp 18 Dec 2003 16:13:28 -0000 1.362
--- items.cpp 8 Jan 2004 08:33:38 -0000 1.363
***************
*** 1353,1359 ****
--- 1353,1362 ----
if( element->hasAttribute( "id" ) )
{
+ cItem* nItem = cItem::createFromScript( element->getAttribute("id") );
+ addItem( nItem, true, false );
}
else if( element->hasAttribute( "list" ) )
{
+ qWarning("cItem::processContainerNode <item list=\"myList\"/> not implemented!!!");
}
else
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** npc.cpp 26 Nov 2003 01:12:20 -0000 1.52
--- npc.cpp 8 Jan 2004 08:33:38 -0000 1.53
***************
*** 344,353 ****
for( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
{
! if( mSock->player() && ( mSock->player()->dist( this ) < 18 ) )
! {
! mSock->send( new cUOTxUnicodeSpeech( *textSpeech ) );
! }
}
delete textSpeech;
}
}
--- 344,372 ----
for( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
{
! if( mSock->player() && ( mSock->player()->dist( this ) < 18 ) )
! {
! mSock->send( new cUOTxUnicodeSpeech( *textSpeech ) );
! }
}
delete textSpeech;
+ }
+ }
+
+ void cNPC::talk( const UINT32 MsgID, UI16 color /*= 0xFFFF*/, cUOSocket* socket /*= 0*/ )
+ {
+ if ( socket )
+ {
+ socket->clilocMessage( MsgID, 0, color, 3, this );
+ }
+ else
+ {
+ // Send to all clients in range
+ for( cUOSocket *mSock = cNetwork::instance()->first(); mSock; mSock = cNetwork::instance()->next() )
+ {
+ if( mSock->player() && ( mSock->player()->dist( this ) < 18 ) )
+ {
+ mSock->clilocMessage( MsgID, 0, color, 3, this );
+ }
+ }
}
}
Index: npc.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** npc.h 23 Sep 2003 11:53:31 -0000 1.27
--- npc.h 8 Jan 2004 08:33:38 -0000 1.28
***************
*** 93,96 ****
--- 93,97 ----
virtual void resend( bool clean = true, bool excludeself = false );
virtual void talk( const QString &message, UI16 color = 0xFFFF, UINT8 type = 0, bool autospam = false, cUOSocket* socket = NULL );
+ void talk( const UINT32 MsgID, UI16 color = 0xFFFF, cUOSocket* socket = 0 );
virtual UINT8 notority( P_CHAR pChar = NULL );
virtual void kill();
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** player.cpp 18 Dec 2003 16:13:28 -0000 1.53
--- player.cpp 8 Jan 2004 08:33:38 -0000 1.54
***************
*** 1064,1067 ****
--- 1064,1072 ----
}
+ /*!
+ Reduces the specified \a amount of gold from the user
+ and returns the amount reduced. If it was successfull, it will return
+ the same value passed on \a amount parameter.
+ */
UINT32 cPlayer::takeGold( UINT32 amount, bool useBank )
{
***************
*** 1073,1077 ****
dAmount = pPack->DeleteAmount( amount, 0xEED, 0 );
! if( ( dAmount < amount ) && useBank )
{
P_ITEM pBank = getBankBox();
--- 1078,1082 ----
dAmount = pPack->DeleteAmount( amount, 0xEED, 0 );
! if( ( dAmount > 0 ) && useBank )
{
P_ITEM pBank = getBankBox();
***************
*** 1083,1087 ****
goldSound( amount, false );
! return dAmount;
}
--- 1088,1092 ----
goldSound( amount, false );
! return amount - dAmount;
}
Index: Trade.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/Trade.cpp,v
retrieving revision 1.90
retrieving revision 1.91
diff -C2 -d -r1.90 -r1.91
*** Trade.cpp 22 Dec 2003 12:20:38 -0000 1.90
--- Trade.cpp 8 Jan 2004 08:33:38 -0000 1.91
***************
*** 43,46 ****
--- 43,47 ----
#include "basechar.h"
#include "player.h"
+ #include "npc.h"
#include "world.h"
#include "console.h"
***************
*** 74,78 ****
{
P_PLAYER pChar = socket->player();
! P_CHAR pVendor = FindCharBySerial( packet->serial() );
cUOTxClearBuy clearBuy;
--- 75,79 ----
{
P_PLAYER pChar = socket->player();
! P_NPC pVendor = dynamic_cast<P_NPC>( FindCharBySerial( packet->serial() ) );
cUOTxClearBuy clearBuy;
***************
*** 178,188 ****
totalValue += amount * pItem->buyprice();
! items.insert( make_pair( pItem->serial(), amount ) );
}
! if( totalValue > totalGold )
{
- pVendor->talk( tr( "Sorry but you do not possess enough gold." ) );
socket->send( &clearBuy );
return;
}
--- 179,209 ----
totalValue += amount * pItem->buyprice();
! if ( amount )
! items.insert( make_pair( pItem->serial(), amount ) );
}
! bool fromBank = false;
! if ( totalValue < 2000 )
! {
! if ( pChar->CountGold() < totalValue )
! {
! pVendor->talk( 500192, 0xFFFF, pChar->socket() ); //Begging thy pardon, but thou casnt afford that.
! return;
! }
! }
! else
! {
! if ( pChar->CountBankGold() < totalValue )
! {
! pVendor->talk( 500191, 0xFFFF, pChar->socket() ); //Begging thy pardon, but thy bank account lacks these funds.
! return;
! }
! fromBank = true;
! }
!
! if ( !items.size() )
{
socket->send( &clearBuy );
+ pVendor->talk( 500190, 0xFFFF, pChar->socket() ); // Thou hast bought nothing!
return;
}
***************
*** 215,226 ****
}
! socket->sysMessage( tr( "You put the %1 into your pack" ).arg( pItem->getName() ) );
}
socket->send( &clearBuy );
- pVendor->talk( tr( "Thank you %1, this makes %2 gold" ).arg( pChar->name() ).arg( totalValue ) );
! if( pChar->takeGold( totalValue, true ) < totalValue )
Console::instance()->send( QString( "Player 0x%1 payed less than he should have to vendor 0x%2" ).arg( pChar->serial(), 8, 16 ).arg( pVendor->serial(), 8, 16 ) );
}
--- 236,252 ----
}
! //socket->sysMessage( tr( "You put the %1 into your pack" ).arg( pItem->getName() ) );
}
socket->send( &clearBuy );
! if ( fromBank )
! pVendor->talk( tr("The total of thy purchase is %1 gold, which has been withdrawn from your bank account. My thanks for the patronage.").arg(totalValue), 0xFFFF, 0, false, pChar->socket() );
! else
! pVendor->talk( tr("The total of thy purchase is %1 gold. My thanks for the patronage.").arg(totalValue), 0xFFFF, 0, false, pChar->socket() );
!
! if( pChar->takeGold( totalValue, fromBank ) < totalValue )
Console::instance()->send( QString( "Player 0x%1 payed less than he should have to vendor 0x%2" ).arg( pChar->serial(), 8, 16 ).arg( pVendor->serial(), 8, 16 ) );
+ pChar->socket()->soundEffect( 0x32 );
}
|