コード例 #1
0
bool CellPermissions::isOnList(PermissionList const &permList, CreatureObject const &who) // static
{
	const int guildId = who.getGuildId();

	// if either their name or their guild is on the list, consider them on the list
	for (PermissionList::const_iterator i = permList.begin(); i != permList.end(); ++i)
	{
		const std::string& name = (*i).getName();

		// objectId
		if (name == who.getNetworkId().getValueString())
			return true;

		// first name
		if (!_stricmp(name.c_str(), Unicode::wideToNarrow(who.getAssignedObjectFirstName()).c_str()))
			return true;

		// guilds
		if (guildId && !_strnicmp(name.c_str(), "Guild:", 6))
		{
			std::string checkStr(Unicode::getTrim((name).substr(6)));
			if (   !_stricmp(checkStr.c_str(), GuildInterface::getGuildAbbrev(guildId).c_str())
			    || !_stricmp(checkStr.c_str(), GuildInterface::getGuildName(guildId).c_str()))
				return true;
		}
	}
	return false;
}
コード例 #2
0
jint JNICALL ScriptMethodsGuildNamespace::getGuildId(JNIEnv *env, jobject self, jlong target)
{
	CreatureObject *targetObj = 0;
	if (!JavaLibrary::getObject(target, targetObj))
	{
		DEBUG_WARNING(true, ("JavaLibrary::getGuildId: called with invalid target"));
		return 0;
	}
	return targetObj->getGuildId();
}