Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24680
Modified Files:
ChangeLog contextmenu.cpp dragdrop.cpp pythonscript.cpp
pythonscript.h
Log Message:
housing updates
Index: contextmenu.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/contextmenu.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** contextmenu.cpp 5 Sep 2004 21:54:07 -0000 1.24
--- contextmenu.cpp 17 Oct 2004 01:20:19 -0000 1.25
***************
*** 53,57 ****
ushort color = Tag->getAttribute( "color" ).toUShort( &ok );
if ( !ok )
! color = 0x7FE0; // Default
bool checkenabled = Tag->getAttribute( "checkenabled", "false" ).lower() == "true";
bool checkvisible = Tag->getAttribute( "checkvisible", "false" ).lower() == "true";
--- 53,57 ----
ushort color = Tag->getAttribute( "color" ).toUShort( &ok );
if ( !ok )
! color = 0; // Default
bool checkenabled = Tag->getAttribute( "checkenabled", "false" ).lower() == "true";
bool checkvisible = Tag->getAttribute( "checkvisible", "false" ).lower() == "true";
Index: pythonscript.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** pythonscript.h 26 Sep 2004 21:36:23 -0000 1.43
--- pythonscript.h 17 Oct 2004 01:20:19 -0000 1.44
***************
*** 89,92 ****
--- 89,93 ----
EVENT_SHOWVIRTUEGUMP,
EVENT_RESURRECT,
+ EVENT_CHECKSECURITY,
EVENT_COUNT,
};
Index: dragdrop.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dragdrop.cpp,v
retrieving revision 1.247
retrieving revision 1.248
diff -C2 -d -r1.247 -r1.248
*** dragdrop.cpp 12 Oct 2004 12:55:05 -0000 1.247
--- dragdrop.cpp 17 Oct 2004 01:20:19 -0000 1.248
***************
*** 32,35 ****
--- 32,36 ----
#include "serverconfig.h"
#include "skills.h"
+ #include "multi.h"
#include "muls/maps.h"
#include "network/network.h"
***************
*** 80,83 ****
--- 81,99 ----
}
+ P_ITEM outmostCont = pItem->getOutmostItem();
+
+ cMulti *multi = outmostCont->multi();
+ // Check security if using items within a multi
+ if (multi && multi->canHandleEvent(EVENT_CHECKSECURITY)) {
+ PyObject *args = Py_BuildValue("(NNN)", pChar->getPyObject(), multi->getPyObject(), outmostCont->getPyObject());
+ bool result = multi->callEventHandler(EVENT_CHECKSECURITY, args);
+ Py_DECREF(args);
+
+ if (result) {
+ socket->bounceItem( pItem, BR_NO_REASON );
+ return; // Access Denied
+ }
+ }
+
if ( pItem->onPickup( pChar ) )
return;
***************
*** 117,122 ****
}*/
- P_ITEM outmostCont = pItem->getOutmostItem();
-
// If the top-most container ( thats important ) is a corpse
// and looting is a crime, flag the character criminal.
--- 133,136 ----
***************
*** 651,654 ****
--- 665,682 ----
}
+ P_ITEM outmostCont = pCont->getOutmostItem();
+ cMulti *multi = outmostCont->multi();
+ // Check security if using items within a multi
+ if (multi && multi->canHandleEvent(EVENT_CHECKSECURITY)) {
+ PyObject *args = Py_BuildValue("(NNN)", pChar->getPyObject(), multi->getPyObject(), outmostCont->getPyObject());
+ bool result = multi->callEventHandler(EVENT_CHECKSECURITY, args);
+ Py_DECREF(args);
+
+ if (result) {
+ socket->bounceItem( socket->dragging(), BR_NO_REASON );
+ return; // Access Denied
+ }
+ }
+
if ( pItem->onDropOnItem( pCont ) )
{
Index: pythonscript.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** pythonscript.cpp 9 Oct 2004 14:28:59 -0000 1.54
--- pythonscript.cpp 17 Oct 2004 01:20:19 -0000 1.55
***************
*** 547,550 ****
--- 547,561 ----
"onResurrect",
+ /*
+ \event onCheckSecurity
+ \param player The player who is seeking access to an item.
+ \param multi The multi the object or the object is in.
+ \param item The item the player is seeking access to.
+ \condition Triggered when a player tries to use an item that is within a multi, tries to drop an item into a container that is within a multi or tries to grab
+ an item that is in a container that is in a multi.
+ \notes Return True to deny access to the item.
+ */
+ "onCheckSecurity",
+
0
};
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.117
retrieving revision 1.118
diff -C2 -d -r1.117 -r1.118
*** ChangeLog 16 Oct 2004 19:42:55 -0000 1.117
--- ChangeLog 17 Oct 2004 01:20:19 -0000 1.118
***************
*** 60,63 ****
--- 60,65 ----
- Added AI Monster_Mage.
- Hitpoints are now unsigned.
+ - Empty context menus are no longer send to the client.
+ - Added the onCheckSecurity event for housing.
Wolfpack 12.9.11 Beta (26. September 2004)
|