Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv9169
Modified Files:
dragdrop.cpp player.cpp player.h pythonscript.h
Log Message:
tradewindow
Index: dragdrop.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dragdrop.cpp,v
retrieving revision 1.205
retrieving revision 1.206
diff -C2 -d -r1.205 -r1.206
*** dragdrop.cpp 23 Sep 2003 23:55:20 -0000 1.205
--- dragdrop.cpp 24 Nov 2003 20:27:27 -0000 1.206
***************
*** 527,532 ****
--- 527,534 ----
if( pOtherChar->objectType() == enPlayer && dynamic_cast<P_PLAYER>(pOtherChar)->socket() )
{
+ dynamic_cast<P_PLAYER>(pChar)->onTradeStart( dynamic_cast<P_PLAYER>(pOtherChar) );
// Check if we're already trading,
// if not create a new window
+ /*
P_ITEM tradeWindow = pChar->atLayer( cBaseChar::TradeWindow );
***************
*** 541,545 ****
--- 543,549 ----
pItem->removeFromView( false );
pItem->update();
+ */
return;
+
}
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** player.cpp 24 Nov 2003 03:14:52 -0000 1.48
--- player.cpp 24 Nov 2003 20:27:27 -0000 1.49
***************
*** 1270,1273 ****
--- 1270,1312 ----
}
+ bool cPlayer::onTradeStart( P_PLAYER partner )
+ {
+ cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_TRADESTART );
+ bool result = false;
+
+ if( scriptChain || global )
+ {
+ PyObject *args = Py_BuildValue( "(O&O&)", PyGetCharObject, this, PyGetCharObject, partner );
+
+ result = cPythonScript::callChainedEventHandler( EVENT_TRADESTART, scriptChain, args );
+
+ if( !result && global )
+ result = global->callEventHandler( EVENT_TRADESTART, args );
+
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
+
+ bool cPlayer::onTrade( unsigned int type, unsigned int buttonstate, SERIAL itemserial )
+ {
+ cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_TRADE );
+ bool result = false;
+
+ if( scriptChain || global )
+ {
+ PyObject *args = Py_BuildValue( "(O&iii)", PyGetCharObject, this, type, buttonstate, itemserial );
+
+ result = cPythonScript::callChainedEventHandler( EVENT_TRADE, scriptChain, args );
+
+ if( !result && global )
+ result = global->callEventHandler( EVENT_TRADE, args );
+
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
bool cPlayer::onPickup( P_ITEM pItem )
{
Index: player.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** player.h 14 Sep 2003 16:09:01 -0000 1.24
--- player.h 24 Nov 2003 20:27:27 -0000 1.25
***************
*** 114,117 ****
--- 114,119 ----
bool onUse( P_ITEM pItem );
bool onPickup( P_ITEM pItem );
+ bool onTrade( unsigned int type, unsigned int buttonstate, SERIAL itemserial );
+ bool onTradeStart( P_PLAYER partner );
// getters
Index: pythonscript.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** pythonscript.h 23 Sep 2003 12:40:18 -0000 1.10
--- pythonscript.h 24 Nov 2003 20:27:27 -0000 1.11
***************
*** 81,85 ****
EVENT_DAMAGE,
EVENT_CASTSPELL,
! EVENT_COUNT
};
--- 81,87 ----
EVENT_DAMAGE,
EVENT_CASTSPELL,
! EVENT_TRADE,
! EVENT_TRADESTART,
! EVENT_COUNT,
};
***************
*** 123,126 ****
--- 125,130 ----
"onDamage",
"onCastSpell",
+ "onTrade",
+ "onTradeStart",
0
};
|