Ejemplo n.º 1
0
/*
	\method socket.hastag
	\description Check if the socket has a certain custom tag attached to it.
	\return True if the tag is present. False otherwise.
	\param name The name of the tag.
*/
static PyObject* wpSocket_hastag( wpSocket* self, PyObject* args )
{
	if ( !self->pSock )
		return PyFalse();

	if ( PyTuple_Size( args ) < 1 || !checkArgStr( 0 ) )
	{
		PyErr_BadArgument();
		return NULL;
	}

	QString key = getArgStr( 0 );

	return self->pSock->tags().has( key ) ? PyTrue() : PyFalse();
}
Ejemplo n.º 2
0
/*
	\method socket.resendplayer
	\description Resend the information about the player to this socket only.
*/
static PyObject* wpSocket_resendplayer( wpSocket* self, PyObject* args )
{
	Q_UNUSED( args );
	if ( !self->pSock )
		return PyFalse();
	self->pSock->resendPlayer( false );
	Py_RETURN_NONE;
}
Ejemplo n.º 3
0
/*
	\method socket.sendpaperdoll
	\description Sends the paperdoll of character to this client.
	\param char The character whose paperdoll should be sent to the client.

*/
static PyObject* wpSocket_sendpaperdoll( wpSocket* self, PyObject* args )
{
	if ( !self->pSock )
		return PyFalse();

	if ( !checkArgChar( 0 ) )
	{
		PyErr_BadArgument();
		return 0;
	}

	if ( !getArgChar( 0 ) )
		return PyFalse();

	self->pSock->sendPaperdoll( getArgChar( 0 ) );

	Py_RETURN_NONE;
}
Ejemplo n.º 4
0
/*
	\method socket.sendcontainer
	\description Sends the content and gump of a container to this socket.
	\param container The <object id="ITEM">item</object> object of the container
	that should be sent to the client.
*/
static PyObject* wpSocket_sendcontainer( wpSocket* self, PyObject* args )
{
	if ( !self->pSock )
		return PyFalse();

	if ( !checkArgItem( 0 ) )
	{
		PyErr_BadArgument();
		return 0;
	}

	if ( !getArgItem( 0 ) )
		return PyFalse();

	self->pSock->sendContainer( getArgItem( 0 ) );

	Py_RETURN_NONE;
}
Ejemplo n.º 5
0
static PyObject *wpDbResult_fetchrow(wpDbResult *self, PyObject *args)
{
	Q_UNUSED(args);
	bool result = self->result->fetchrow();

	if (result)
		return PyTrue();
	else
		return PyFalse();
}
Ejemplo n.º 6
0
/*
	\method socket.sendweblink
	\description Send an url to the client and open it in the players webbrowser.
	\param url The url that should be sent.
*/
static PyObject* wpSocket_sendweblink( wpSocket* self, PyObject* args )
{
	if ( !self->pSock )
		return PyFalse();

	if ( PyTuple_Size( args ) < 1 || !checkArgStr( 0 ) )
	{
		PyErr_BadArgument();
		return NULL;
	}

	QString url = getArgStr( 0 );
	self->pSock->sendWeblink( url );

	Py_RETURN_NONE;
}
Ejemplo n.º 7
0
/*
	\method socket.deltag
	\description Deletes a tag attached to the socket.
	\param name The name of the tag.
*/
static PyObject* wpSocket_deltag( wpSocket* self, PyObject* args )
{
	if ( !self->pSock )
		return PyFalse();

	if ( PyTuple_Size( args ) < 1 || !checkArgStr( 0 ) )
	{
		PyErr_BadArgument();
		return NULL;
	}

	QString key = getArgStr( 0 );
	self->pSock->tags().remove( key );

	Py_RETURN_NONE;
}
Ejemplo n.º 8
0
/*!
	Begins CH customization
*/
static PyObject* wpSocket_customize( wpSocket* self, PyObject* args )
{
	Q_UNUSED( args );
	if ( !self->pSock )
		return PyFalse();

	if ( !checkArgItem( 0 ) )
	{
		PyErr_BadArgument();
		return NULL;
	}
	P_ITEM signpost = getArgItem( 0 );

	cUOTxStartCustomHouse custom;
	custom.setSerial( signpost->getTag( "house" ).toInt() ); // Morex of signpost contain serial of house
	self->pSock->send( &custom );
	Py_RETURN_NONE;
}
Ejemplo n.º 9
0
/*
	\method account.checkpassword
	\param password The given password.
	\description Checks if the password of the account matches. Automatically takes MD5 hashing into account.
	\return True if the password is correct, false otherwise.
*/
static PyObject* wpAccount_checkpassword( wpAccount* self, PyObject* args )
{
	char* password;

	if ( !PyArg_ParseTuple( args, "es:account.checkpassword(password)", "utf-8", &password ) )
	{
		return 0;
	}

	bool authorized;

	if ( Config::instance()->hashAccountPasswords() )
	{
		authorized = cMd5::fastDigest( password ) == self->account->password();
	}
	else
	{
		authorized = password == self->account->password();
	}

	PyMem_Free( password );

	return authorized ? PyTrue() : PyFalse();
}
Ejemplo n.º 10
0
/*
	\method coord.validspawnspot
	\return A boolean value.
	\description This method returns true if this coordinate is a valid spawn spot for a monster, character or item.
	Otherwise it returns false. This method will also set the z component of the coordinate to the nearest
	item top a land creature can stand on.
*/
static PyObject* wpCoord_validspawnspot( wpCoord* self, PyObject* args )
{
	Q_UNUSED( args );
	return Movement::instance()->canLandMonsterMoveHere( self->coord ) ? PyTrue() : PyFalse();
}