Update of /cvsroot/wpdev/wolfpack/python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28604/python
Modified Files:
pycoord.cpp
Log Message:
additions
Index: pycoord.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/python/pycoord.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** pycoord.cpp 16 Sep 2004 01:40:19 -0000 1.25
--- pycoord.cpp 5 Oct 2004 13:21:22 -0000 1.26
***************
*** 31,34 ****
--- 31,37 ----
#include "../items.h"
#include "../basechar.h"
+ #include "../player.h"
+ #include "../network/uosocket.h"
+ #include "../network/network.h"
/*
***************
*** 178,181 ****
--- 181,241 ----
}
+ /*
+ \method coord.effect
+ \param id The art id of the effect to play.
+ \param speed The speed of the effect.
+ \param duration The duration of the effect.
+ \description Shows a graphical effect at the given position.
+ */
+ static PyObject* wpCoord_effect( wpCoord* self, PyObject* args )
+ {
+ unsigned short id, duration, speed;
+ if (!PyArg_ParseTuple(args, "hhh:coord.effect(id, speed, duration)", &id, &speed, &duration)) {
+ return 0;
+ }
+
+ cUOTxEffect effect;
+ effect.setType( ET_STAYSOURCEPOS );
+ effect.setId( id );
+ effect.setSourcePos( self->coord );
+ effect.setDuration( duration );
+ effect.setSpeed( speed );
+
+ cUOSocket* mSock;
+ for ( mSock = Network::instance()->first(); mSock; mSock = Network::instance()->next() )
+ {
+ if ( mSock->player() && mSock->player()->pos().distance( self->coord ) <= mSock->player()->visualRange() )
+ mSock->send( &effect );
+ }
+
+ Py_RETURN_NONE;
+ }
+
+ /*
+ \method coord.soundeffect
+ \param id The id of the sound.
+ \description Plays a soundeffect at the position.
+ */
+ static PyObject* wpCoord_soundeffect( wpCoord* self, PyObject* args )
+ {
+ unsigned short id;
+ if (!PyArg_ParseTuple(args, "h:coord.soundeffect(id)", &id)) {
+ return 0;
+ }
+
+ cUOTxSoundEffect effect;
+ effect.setSound(id);
+ effect.setCoord(self->coord);
+
+ cUOSocket* mSock;
+ for ( mSock = Network::instance()->first(); mSock; mSock = Network::instance()->next() )
+ {
+ if ( mSock->player() && mSock->player()->pos().distance( self->coord ) <= mSock->player()->visualRange() )
+ mSock->send( &effect );
+ }
+
+ Py_RETURN_NONE;
+ }
+
static PyMethodDef wpCoordMethods[] =
{
***************
*** 184,187 ****
--- 244,249 ----
{ "validspawnspot", ( getattrofunc ) wpCoord_validspawnspot, METH_VARARGS, NULL },
{ "lineofsight", ( getattrofunc ) wpCoord_lineofsight, METH_VARARGS, NULL },
+ { "effect", (getattrofunc) wpCoord_effect, METH_VARARGS, NULL },
+ { "soundeffect", (getattrofunc) wpCoord_soundeffect, METH_VARARGS, NULL },
{ 0, 0, 0, 0 }
};
|