Esempio n. 1
0
//--------------------------------------------------------------
//		CShieldingEffect::removed()
//--------------------------------------------------------------
void CShieldingEffect::removed()
{
	CEntityId creatorId;
	CEntityId targetId;	

	if (TheDataset.isAccessible(_CreatorRowId))
		creatorId = TheDataset.getEntityId(_CreatorRowId);

	if (TheDataset.isAccessible(_TargetRowId))
		targetId = TheDataset.getEntityId(_TargetRowId);

	// returns if target already dead
	CEntityBase *target = CEntityBaseManager::getEntityBasePtr(targetId);
	if (!target || target->isDead())
		return;
	
	// send messages
	SM_STATIC_PARAMS_1(params, STRING_MANAGER::power_type);
	params[0].Type = STRING_MANAGER::power_type;
	params[0].Enum = POWERS::Shielding;

	// for actor
	if (creatorId.getType() == RYZOMID::player)
	{		
		PHRASE_UTILITIES::sendDynamicSystemMessage(TheDataset.getDataSetRow(creatorId), "POWER_EFFECT_ENDS", params);
	}
	
	// for target
	if (targetId.getType() == RYZOMID::player)
	{
		PHRASE_UTILITIES::sendDynamicSystemMessage(TheDataset.getDataSetRow(targetId), "POWER_EFFECT_ENDS", params);
	}
	
	// for spectators : nothing to send (?)
/*	CEntityId senderId;
	if (creatorId.getType() == RYZOMID::player || creatorId.getType() == RYZOMID::npc)
	{
		senderId = creatorId;
	}
	else if (targetId.getType() == RYZOMID::player || targetId.getType() == RYZOMID::npc)
	{
		senderId = targetId;
	}
	
	if (senderId != CEntityId::Unknown)
	{
		vector<CEntityId> excluded;
		excluded.push_back(creatorId);
		excluded.push_back(targetId);
		PHRASE_UTILITIES::sendDynamicGroupSystemMessage(senderId, excluded, "POWER_EFFECT_ENDS", params);
	}
*/
} // removed //
//--------------------------------------------------------------
//		CCombatStunEffect::removed()
//--------------------------------------------------------------
void CCombatStunEffect::removed()
{
	if (!_StunnedEntity) return;

	// returns if entity already dead
	if (_StunnedEntity->isDead())
		return;

	DEBUGLOG("COMBAT EFFECT: stun effect ends on entity %s", _StunnedEntity->getId().toString().c_str());

	// if this is the last STUN effect on target, then wake it
	const std::vector<CSEffect*>& effects = _StunnedEntity->getSEffects();
	for (uint i = 0 ; i < effects.size() ; ++i)
	{
		if (effects[i] && effects[i] != this && (effects[i]->getFamily() == EFFECT_FAMILIES::Stun || effects[i]->getFamily() == EFFECT_FAMILIES::CombatStun) )
		{
			DEBUGLOG("COMBAT EFFECT : entity is still stunned (has another stun effect)");
			return;
		}
	}

	// wake entity
	_StunnedEntity->wake();
	DEBUGLOG("COMBAT EFFECT : was last stun effects on this entity, wake it");

	CEntityId actorId;
	if (TheDataset.isDataSetRowStillValid(_CreatorRowId))
		actorId = TheDataset.getEntityId(_CreatorRowId);

	// send message
//	PHRASE_UTILITIES::sendSimpleMessage( _TargetRowId, "OPS_EFFECT_STUN_END" );
//	PHRASE_UTILITIES::sendMessage( _CreatorRowId, "OPS_EFFECT_STUN_END_E", _TargetRowId );

	TVectorParamCheck params;

	if (_StunnedEntity->getId().getType() == RYZOMID::player)
	{
		PHRASE_UTILITIES::sendDynamicSystemMessage(_StunnedEntity->getEntityRowId(), "EFFECT_STUN_END_TARGET");
	}

	if ( actorId.getType() == RYZOMID::player)
	{
		params.resize(1);
		params[0].Type = STRING_MANAGER::entity;
		params[0].EId = _StunnedEntity->getId();

		PHRASE_UTILITIES::sendDynamicSystemMessage(_CreatorRowId, "EFFECT_STUN_END_ACTOR", params);
	}
	// todo spectators and self stun
} // removed //
Esempio n. 3
0
/****************************************************************\
						init
\****************************************************************/
void	CWorldEntity::init( const CEntityId& id, const TDataSetRow &index )
{
	Id = id;
	Index = index;

	// Keep properties local for invisible group entities (aiVision).
	// This is obsolete, as aiVision are not used anymore. Because these entities were not
	// in mirror, their property values always stayed in temp storage. All the code was
	// the same for aiVision and visible entities, i.e. we used the CMirrorPropValueAlice.
	// Now the 'Alice' version is not needed anymore, because all entities go into
	// registerEntityProperty().
//	if ( Id.getType() != RYZOMID::aiVision )
//	{

	registerEntityProperty("X", &X, id);
	registerEntityProperty("Y", &Y, id);
	registerEntityProperty("Z", &Z, id);
	registerEntityProperty("LocalX", &LocalX, id);
	registerEntityProperty("LocalY", &LocalY, id);
	registerEntityProperty("LocalZ", &LocalZ, id);
	registerEntityProperty("Theta", &Theta, id);
	registerEntityProperty("Sheet", &Sheet, id);
	registerEntityProperty("TickPos", &Tick, id);
	registerEntityProperty("Cell", &Cell, id);
	registerEntityProperty("VisionCounter", &VisionCounter, id);
	registerEntityProperty("WhoSeesMe", &WhoSeesMe, id);
	if (Cell > 0)
	{
		nlwarning("Entity %s Cell is preset to %d which should be 0 or negative, forced to 0", id.toString().c_str(), Cell());
		Cell = 0;
	}
//	}
//	else
//		Cell = -1;

	//IsStaticObject = false;
	//IsInvisible = false;
	//IsAgent = false;
	//IsTrigger = false;
	//IsInvisibleToPlayer = false;

	RefCounter = 0;
	TickLock = 0;

	TempVisionState = false;
	TempControlInVision = false;
	TempParentInVision = false;

	HasVision = false;

	Previous = NULL;
	Next = NULL;

	PlayerInfos = NULL;

	Parent = NULL;
	Control = NULL;

	PosInitialised = false;
	Continent = INVALID_CONTINENT_INDEX;
	MoveContainer = NULL;
	Primitive = NULL;
	UsePrimitive = false;
	ForceUsePrimitive = false;
	ForceDontUsePrimitive = false;

	VisionCounter = (uint8)0x0;
	PlayersSeeingMe = 0;
	ClosestPlayer = NULL;

	CellPtr = NULL;

	PatatEntryIndex = 0;

	if (id.getType() == RYZOMID::object )
	{
		_Type = Object;
	}
	else if (id.getType() == RYZOMID::player)
	{
		_Type = Player;
	}
	else if (id.getType() == RYZOMID::trigger)
	{
		_Type = Trigger;
	}
	else if ( (id.getType() >= RYZOMID::npc ) || ( id.getType() <= RYZOMID::flora)  )
	{
		_Type = AI;
	}
	else
	{
		_Type = Unknown;
	}


	// commented, now set by the EGS
	//WhoSeesMe = 0xffffffff;

	CheckMotion = true;

} // CWorldEntity constructor