private void OnPerceptionHeardObject(uint PerceivedObjectId,
bool InitialDetection)
{
if (Script.GetObjectType(PerceivedObjectId) != CLRScriptBase.OBJECT_TYPE_CREATURE) return;
CreatureObject SeenObject = Server.ObjectManager.GetCreatureObject(PerceivedObjectId, true);
//===== If we just started hearing this person again, we need to process memberships. ====//
if (InitialDetection)
{
int nReputation = Script.GetReputation(this.ObjectId, PerceivedObjectId);
if (nReputation < 11 && nReputation > -1)
{
if (Party.EnemiesLost.Contains(SeenObject))
{
Party.EnemiesLost.Remove(SeenObject);
Party.AddPartyEnemy(SeenObject);
HasCombatRoundProcess = true;
if (!UsingEndCombatRound)
{
Script.DelayCommand(3.0f, delegate() { SelectCombatRoundAction(false); });
}
}
}
else if (Script.GetFactionEqual(this.ObjectId, PerceivedObjectId) == CLRScriptBase.TRUE)
{
// Might as well try to recover if we've messed up party memberships.
if (SeenObject.Party == null && Script.GetIsPC(SeenObject.ObjectId) == CLRScriptBase.FALSE)
{
if (Party == null) OnSpawn();
Party.AddPartyMember(SeenObject);
}
}
}
else
{
if (!HasCombatRoundProcess)
{
HasCombatRoundProcess = true;
Script.DelayCommand(3.0f, delegate() { SelectCombatRoundAction(false); });
}
}
}