void ScriptMethodsPlayerQuestNamespace::openPlayerQuestRecipe(JNIEnv * env, jobject self, jlong player, jlong recipe)
{
	UNREF(env);
	UNREF(self);

	CreatureObject * playerCreature = NULL;
	if (!JavaLibrary::getObject(player, playerCreature))
	{
		DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid creature object with OID %d", player));
		return;
	}

	ServerObject * recipeObj = NULL;
	if (!JavaLibrary::getObject(recipe, recipeObj))
	{
		DEBUG_WARNING(true, ("openPlayerQuestRecipe: Failed to get valid recipe object with OID %d", player));
		return;
	}

	if (playerCreature->isPlayerControlled() && playerCreature->getController() != NULL)
	{
		playerCreature->getController()->appendMessage(
			static_cast<int>(CM_openRecipe),
			0,
			new MessageQueueGenericValueType< NetworkId >( recipeObj->getNetworkId() ),
			GameControllerMessageFlags::SEND |
			GameControllerMessageFlags::RELIABLE |
			GameControllerMessageFlags::DEST_AUTH_CLIENT);
	}

	return;
}
예제 #2
0
	void setCreatureObjVars (CreatureObject & creature, const Vector & pos_w, float radius)
	{
		const bool isPlayer = creature.isPlayerControlled ();

		creature.setObjVarItem (ObjVars::moveSim,       int(1));
		creature.setObjVarItem (ObjVars::moveSimPlayer, int(isPlayer ? 1 : 0));
		creature.setObjVarItem (ObjVars::moveSimPosX,   pos_w.x);
		creature.setObjVarItem (ObjVars::moveSimPosZ,   pos_w.z);
		creature.setObjVarItem (ObjVars::moveSimRadius, radius);
	}
예제 #3
0
bool BuildingObject::isAllowed(CreatureObject const &who) const
{
	if (who.getMasterId() != NetworkId::cms_invalid)
	{
		ServerObject const *master = ServerWorld::findObjectByNetworkId(who.getMasterId());
		if (master && master != &who && master->asCreatureObject())
			return isAllowed(*master->asCreatureObject());
	}

	if (!playersWithAlignedEnemyFlagsAllowed() && (Pvp::hasAnyAlignedTimedEnemyFlag(who) || Pvp::hasAnyBountyDuelEnemyFlag(who)))
		return false;

	if (getIsPublic())
		return !CellPermissions::isOnList(m_banned.get(), who);
	else
	{
		// allow non-player-controlled creatures in private buildings with no owner
		if (!who.isPlayerControlled() && getOwnerId() == NetworkId::cms_invalid)
			return true;
		// allow vendor-creatures to be placed in the building
		if (who.hasCondition(static_cast<int>(ServerTangibleObjectTemplate::C_vendor)))
			return true;
		// JU_TODO: test
#if 1
		// allow non-player-controlled creatures in private buildings if the *creature* has no owner
		if (!who.isPlayerControlled() 
			&& who.getMasterId() == NetworkId::cms_invalid 
			&& who.getLevel() < 10 // temp change to < 0 after testing holo item
			)
		{
			return true;
		}
#endif
		// JU_TODO: end test
		return CellPermissions::isOnList(m_allowed.get(), who);
	}
}