public void Reset() { foreach (PQuest_Spawn Spawn in Objective.Spawns) { //Log.Info("Creature", "npc = " + Name + " Oid = " + Oid + " X= " + Spawn.WorldX + " Y= " + Spawn.WorldY + " Z= " + Spawn.WorldZ); Log.Success("SENDING Spawn.Type", "STARTING Spawn.Type "); if (Spawn.Type == 1) { Creature_proto Proto = WorldMgr.GetCreatureProto(Spawn.Entry); if (Proto == null) { Log.Error("PQCreatue", "No Proto"); return; } Creature_spawn S = new Creature_spawn(); S.Guid = (uint)WorldMgr.GenerateCreatureSpawnGUID(); S.BuildFromProto(Proto); S.WorldO = Spawn.WorldO; S.WorldY = Spawn.WorldY; S.WorldZ = Spawn.WorldZ; S.WorldX = Spawn.WorldX; S.ZoneId = Spawn.ZoneId; S.Bytes = ""; PQuestCreature NewCreature = new PQuestCreature(S, this); this.ActiveCreatures.Add(NewCreature); Quest.Region.AddObject((Object)NewCreature, Spawn.ZoneId); } } }
public override void RezUnit() { Objective.ActiveCreatures.Remove(this); PQuestCreature NewCreatue = new PQuestCreature(Spawn, Objective); Objective.ActiveCreatures.Add(NewCreatue); Region.AddObject((Object)NewCreatue, Spawn.ZoneId); Dispose(); }
public override void OnDie(Object Obj) { if (!(Obj is PQuestCreature)) { return; } PQuestCreature Crea = Obj as PQuestCreature; Crea.Objective.Quest.Failed(); Crea.Say("You fools!", SystemData.ChatLogFilters.CHATLOGFILTERS_MONSTER_SAY); base.OnDie(Obj); }
public void NotifyReceivedPQuestMobHit(PQuestCreature mob, uint damageCount) { PublicQuest?.AddTrackedDamage((Player)_Owner, mob, damageCount); }
/// <summary> Attempts to initiate AI-controlled combat. </summary> public void ProcessCombatStart(Unit target) { #if DEBUG && NO_RESPOND if (!(_unit is Pet)) { return; } #endif if (_unit == null) { return; } if (target == null) { Log.Error("AIInterface for " + _unit, "ProcessCombatStart with NULL target"); return; } if (!CurrentBrain.StartCombat(target)) { return; } if (!(_unit is KeepNpcCreature.KeepCreature)) { _thinkInterval = 650; } bool processLink = State != AiState.FIGHTING && target is Player && _unit.Aggressive; State = AiState.FIGHTING; _unit.CbtInterface.RefreshCombatTimer(); // Social for PQuestCreatures if (processLink && _Owner is PQuestCreature) { if (IsInDungeon()) { foreach (Object obj in _Owner.ObjectsInRange) { PQuestCreature crea = obj as PQuestCreature; if (crea != null && _Owner.ObjectWithinRadiusFeet(crea, 40) && crea.Aggressive) { ((Creature)obj).AiInterface.ProcessLink(target); } } } else { uint playerCount = 0; foreach (Object obj in _Owner.ObjectsInRange) { if (obj is Player) { playerCount++; } } uint counter = 0; foreach (Object obj in _Owner.ObjectsInRange) { PQuestCreature crea = obj as PQuestCreature; if (crea != null && _Owner.ObjectWithinRadiusFeet(crea, 30) && crea.Aggressive) { counter++; if (playerCount < 6 && playerCount < counter) { break; } ((Creature)obj).AiInterface.ProcessLink(target); } } } } }