Ejemplo n.º 1
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.º 2
0
static PyObject *wpTooltip_add(wpTooltip *self, PyObject *args) {
	char *params;
	unsigned int id;

	if (!PyArg_ParseTuple(args, "Ies:tooltip.add(id, params)", &id, "utf-8", &params)) {
		return 0;
	}

	self->list->addLine(id, QString::fromUtf8(params));
	PyMem_Free(params);
	return PyTrue();
}
Ejemplo n.º 3
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.º 4
0
static PyObject *wpParty_tellall(wpParty *self, PyObject *args)
{
	P_CHAR source;
	char *message;

	if (PyArg_ParseTuple(args, "O&es:party.tellsingle(source, message)", PyConvertChar, &source, "utf-8", &message)) {
		P_PLAYER psource = dynamic_cast<P_PLAYER>(source);

		if (psource)
			self->party->send(psource, QString::fromUtf8(message));

		PyMem_Free(message);

		return PyTrue();
	}

	return 0;
}
Ejemplo n.º 5
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.º 6
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();
}
Ejemplo n.º 7
0
static PyObject *wpTooltip_reset(wpTooltip *self, PyObject *args) {
	self->list->resize(19);
	self->list->setShort(1, 19);
	return PyTrue();
}