/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); IControlledBrain brain = GetPetBrain(Caster); m_pet = GetGamePet(template); //brain.WalkState = eWalkState.Stay; m_pet.SetOwnBrain(brain as AI.ABrain); int x, y, z; ushort heading; Region region; GetPetLocation(out x, out y, out z, out heading, out region); m_pet.X = x; m_pet.Y = y; m_pet.Z = z; m_pet.Heading = heading; m_pet.CurrentRegion = region; m_pet.CurrentSpeed = 0; m_pet.Realm = Caster.Realm; m_pet.Level = GetPetLevel(); if (m_isSilent) { m_pet.IsSilent = true; } m_pet.AddToWorld(); //Check for buffs if (brain is ControlledNpcBrain) { (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive); } AddHandlers(); SetBrainToOwner(brain); effect.Start(m_pet); Caster.OnPetSummoned(m_pet); }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { var template = NpcTemplateMgr.GetTemplate((int)Spell.Value); base.ApplyEffectOnTarget(target, effectiveness); if (template.ClassType == "") { Npc = new GameNPC(); } else { try { Npc = new GameNPC(); Npc = (GameNPC)Assembly.GetAssembly(typeof(GameServer)).CreateInstance(template.ClassType, false); } catch (Exception e) { } if (Npc == null) { try { Npc = (GameNPC)Assembly.GetExecutingAssembly().CreateInstance(template.ClassType, false); } catch (Exception e) { } } if (Npc == null) { MessageToCaster("There was an error creating an instance of " + template.ClassType + "!", eChatType.CT_System); return; } Npc.LoadTemplate(template); } int x, y; Caster.GetSpotFromHeading(64, out x, out y); Npc.X = x; Npc.Y = y; Npc.Z = Caster.Z; Npc.CurrentRegion = Caster.CurrentRegion; Npc.Heading = (ushort)((Caster.Heading + 2048) % 4096); Npc.Realm = Caster.Realm; Npc.CurrentSpeed = 0; Npc.Level = Caster.Level; Npc.Name = Caster.Name + " Buffbot " + ""; Npc.SetOwnBrain(new BlankBrain()); Npc.AddToWorld(); }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { NpcTemplate template = NpcTemplateMgr.GetTemplate((int)m_spell.Value); base.ApplyEffectOnTarget(target, effectiveness); if (template.ClassType == "") { npc = new GameNPC(); } else { try { npc = new GameNPC(); npc = (GameNPC)Assembly.GetAssembly(typeof(GameServer)).CreateInstance(template.ClassType, false); } catch (Exception e) { } if (npc == null) { try { npc = (GameNPC)Assembly.GetExecutingAssembly().CreateInstance(template.ClassType, false); } catch (Exception e) { } } if (npc == null) { MessageToCaster("There was an error creating an instance of " + template.ClassType + "!", DOL.GS.PacketHandler.eChatType.CT_System); return; } npc.LoadTemplate(template); } GameSpellEffect effect = CreateSpellEffect(npc, effectiveness); int x, y; m_caster.GetSpotFromHeading(64, out x, out y); npc.X = x; npc.Y = y; npc.Z = m_caster.Z; npc.CurrentRegion = m_caster.CurrentRegion; npc.Heading = (ushort)((m_caster.Heading + 2048) % 4096); npc.Realm = m_caster.Realm; npc.CurrentSpeed = 0; npc.Level = 1; npc.SetOwnBrain(new AI.Brain.BlankBrain()); npc.AddToWorld(); effect.Start(npc); }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { if (!(Caster is GamePlayer player)) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.Warn($"NPC template {Spell.LifeDrainReturn} not found! Spell: {Spell}"); } MessageToCaster($"NPC template {Spell.LifeDrainReturn} not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); TitanBrain controlledBrain = new TitanBrain(player) { IsMainPet = false, WalkState = eWalkState.Stay }; summoned = new GameNPC(template); summoned.SetOwnBrain(controlledBrain); // Suncheck: // Is needed, else it can cause error (i.e. /cast-command) if (x == 0 || y == 0) { CheckCastLocation(); } summoned.X = x; summoned.Y = y; summoned.Z = z; summoned.CurrentRegion = player.CurrentRegion; summoned.Heading = (ushort)((player.Heading + 2048) % 4096); summoned.Realm = player.Realm; summoned.CurrentSpeed = 0; summoned.Size = 10; summoned.Level = 100; summoned.Flags |= GameNPC.eFlags.PEACE; summoned.AddToWorld(); controlledBrain.AggressionState = eAggressionState.Aggressive; effect.Start(summoned); m_growTimer = new RegionTimer(Caster, new RegionTimerCallback(TitanGrows), C_GROWTIMER); }
public override void OnEffectStart(GameSpellEffect effect) { base.OnEffectStart(effect); if (Caster.TargetObject as GameLiving == null) { return; } GamePlayer player = Caster as GamePlayer; if (player == null) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { String errorMessage = String.Format("NPC template {0} is missing, spell ID = {1}", Spell.LifeDrainReturn, Spell.ID); if (log.IsWarnEnabled) { log.Warn(errorMessage); } if (player.Client.Account.PrivLevel > 1) { MessageToCaster(errorMessage, eChatType.CT_Skill); } return; } Point2D spawnPoint = Caster.GetPointFromHeading(Caster.Heading, 64); int i = 0; for (i = 0; i < 3; i++) { deamons[i] = new ZoarkatPet(template); deamons[i].SetOwnBrain(new ProcPetBrain(player)); deamons[i].X = spawnPoint.X + Util.Random(20, 40) - Util.Random(20, 40); deamons[i].Y = spawnPoint.Y + Util.Random(20, 40) - Util.Random(20, 40); deamons[i].Z = Caster.Z; deamons[i].CurrentRegion = Caster.CurrentRegion; deamons[i].Heading = (ushort)((Caster.Heading + 2048) % 4096); deamons[i].Realm = Caster.Realm; deamons[i].CurrentSpeed = 0; deamons[i].Level = 36; deamons[i].Flags |= GameNPC.eFlags.FLYING; deamons[i].AddToWorld(); (deamons[i].Brain as IOldAggressiveBrain).AddToAggroList(Caster.TargetObject as GameLiving, 1); (deamons[i].Brain as ProcPetBrain).Think(); } }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { // Template of the Illusionblade NPC INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.Warn($"NPC template {Spell.LifeDrainReturn} not found! Spell: {Spell}"); } MessageToCaster($"NPC template {(ushort) Spell.LifeDrainReturn} not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); IControlledBrain brain = GetPetBrain(Caster); m_pet = GetGamePet(template); m_pet.SetOwnBrain(brain as AI.ABrain); int x, y, z; ushort heading; Region region; GetPetLocation(out x, out y, out z, out heading, out region); m_pet.X = x; m_pet.Y = y; m_pet.Z = z; m_pet.Heading = heading; m_pet.CurrentRegion = region; // m_pet.CurrentSpeed = 0; m_pet.Realm = Caster.Realm; m_pet.Race = 0; m_pet.Level = 44; // lowered in patch 1109b m_pet.AddToWorld(); // Check for buffs (brain as ControlledNpcBrain)?.CheckSpells(StandardMobBrain.eCheckSpellType.Defensive); AddHandlers(); SetBrainToOwner(brain); m_pet.AutoSetStats(); effect.Start(m_pet); // Set pet infos & Brain }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GamePlayer player = Caster as GamePlayer; if (player == null) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } Point2D summonloc; beffect = CreateSpellEffect(target, effectiveness); { summonloc = target.GetPointFromHeading(target.Heading, 64); BrittleBrain controlledBrain = new BrittleBrain(player); controlledBrain.IsMainPet = false; summoned = new GameNPC(template); summoned.SetOwnBrain(controlledBrain); summoned.X = summonloc.X; summoned.Y = summonloc.Y; summoned.Z = target.Z; summoned.CurrentRegion = target.CurrentRegion; summoned.Heading = (ushort)((target.Heading + 2048) % 4096); summoned.Realm = target.Realm; summoned.CurrentSpeed = 0; summoned.Level = 1; summoned.Size = 10; summoned.AddToWorld(); controlledBrain.AggressionState = eAggressionState.Passive; GameEventMgr.AddHandler(summoned, GameLivingEvent.Dying, new DOLEventHandler(GuardDie)); beffect.Start(Caster); } }
public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { //Template of the Illusionblade NPC INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + (ushort)Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); IControlledBrain brain = GetPetBrain(Caster); m_pet = GetGamePet(template); m_pet.SetOwnBrain(brain as AI.ABrain); Vector3 pos; ushort heading; Region region; GetPetLocation(out pos, out heading, out region); m_pet.Position = pos; m_pet.Heading = heading; m_pet.CurrentRegion = region; // m_pet.CurrentSpeed = 0; m_pet.Realm = Caster.Realm; m_pet.Race = 0; m_pet.Level = 44; // lowered in patch 1109b, also calls AutoSetStats() m_pet.AddToWorld(); //Check for buffs if (brain is ControlledNpcBrain) { (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive); } AddHandlers(); SetBrainToOwner(brain); effect.Start(m_pet); //Set pet infos & Brain }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { if (!(Caster is GamePlayer player)) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.Warn($"NPC template {Spell.LifeDrainReturn} not found! Spell: {Spell}"); } MessageToCaster($"NPC template {Spell.LifeDrainReturn} not found!", eChatType.CT_System); return; } beffect = CreateSpellEffect(target, effectiveness); { var summonloc = target.GetPointFromHeading(target.Heading, 64); BrittleBrain controlledBrain = new BrittleBrain(player); controlledBrain.IsMainPet = false; summoned = new GameNPC(template); summoned.SetOwnBrain(controlledBrain); summoned.X = summonloc.X; summoned.Y = summonloc.Y; summoned.Z = target.Z; summoned.CurrentRegion = target.CurrentRegion; summoned.Heading = (ushort)((target.Heading + 2048) % 4096); summoned.Realm = target.Realm; summoned.CurrentSpeed = 0; summoned.Level = Caster.Level; summoned.Size = 50; summoned.AddToWorld(); controlledBrain.AggressionState = eAggressionState.Passive; beffect.Start(Caster); } }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { GamePlayer player = Caster as GamePlayer; if (player == null) { return; } INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } beffect = CreateSpellEffect(target, effectiveness); var summonloc = GameMath.GetPointFromHeading(target, 64); BrittleBrain controlledBrain = new BrittleBrain(player); controlledBrain.IsMainPet = false; summoned = new GameNPC(template); summoned.SetOwnBrain(controlledBrain); summoned.Position = new Vector3(summonloc, target.Position.Z); summoned.CurrentRegion = target.CurrentRegion; summoned.Heading = (ushort)((target.Heading + 2048) % 4096); summoned.Realm = target.Realm; summoned.CurrentSpeed = 0; summoned.Level = Caster.Level; summoned.Size = 50; summoned.AddToWorld(); controlledBrain.AggressionState = eAggressionState.Passive; beffect.Start(Caster); }
/// <summary> /// Override Add To World to Spawn Teleporters in Circle /// And start Timer. /// </summary> /// <returns></returns> public override bool AddToWorld() { if (!base.AddToWorld()) { return(false); } // Add the Item Pad m_worldObject.X = X; m_worldObject.Y = Y; m_worldObject.Z = Z; m_worldObject.Heading = Heading; m_worldObject.Model = PortalWorldObjectModel; m_worldObject.AddToWorld(); // Add the teleporters NpcTemplate teleporters = NpcTemplateMgr.GetTemplate(PortalTeleportersTemplateID); ushort divisor = (ushort)(4096 / PortalTeleporterCount); for (int cnt = 0; cnt < PortalTeleporterCount; cnt++) { GameNPC teleporter = new GameNPC(teleporters); var tgt = GameMath.GetPointFromHeading(Position, (ushort)((Heading + (cnt * divisor)) % 4096), PortalCeremonyRange); teleporter.X = tgt.X; teleporter.Y = tgt.Y; teleporter.Z = Z; teleporter.CurrentRegion = CurrentRegion; teleporter.Heading = (ushort)((Heading + (cnt * divisor) + 2048) % 4096); m_teleporters.Add(teleporter); teleporter.AddToWorld(); } // Start Timer. m_teleportTimer = new RegionTimer(this); m_teleportTimer.Callback = new RegionTimerCallback(TeleportTimerCallback); m_teleportTimer.Start((int)(PortalTeleportInterval >> 4)); return(true); }
public void OnCommand(GameClient client, string[] args) { if (client.Player == null) { return; } GamePlayer player = client.Player; string key = GetInstanceKey(player); if (args.Length < 2) { if (key != "") { SendMessage(client, "Current instance key is " + key); } DisplaySyntax(client); return; } if (key == "" && args[1] != "key") { SendMessage(client, "You must first assign an instance to work with using /instance key <ID>."); return; } switch (args[1].ToLower()) { #region SetInstanceID case "key": string newKey = string.Join(" ", args, 2, args.Length - 2); client.Player.TempProperties.setProperty(INSTANCE_KEY, newKey); SendMessage(client, "Instance key set to " + newKey); break; #endregion #region Create Entry case "entry": { try { if (args.Length < 3) { DisplaySyntax(client); return; } //Create the database entry... DBInstanceXElement element = new DBInstanceXElement(); element.Heading = client.Player.Heading; element.X = (int)client.Player.Position.X; element.Y = (int)client.Player.Position.Y; element.Z = (int)client.Player.Position.Z; element.InstanceID = key; element.ClassType = args[2]; int npctemplate = 0; try { npctemplate = int.Parse(args[3]); } catch { } element.NPCTemplate = npctemplate.ToString(); if (npctemplate > 0) { // reload all templates to grab any new ones NpcTemplateMgr.Reload(); } //Save the element to database! GameServer.Database.AddObject(element); GameServer.Database.SaveObject(element); //Dinberg: place a marker at this spot! string theType = args[2]; SendMessage(client, "Created an element here! Use your memory for now, I sure as hell dont have anything else to show you where it is ^^"); //Only create ones that have namespaces (signified by '.') if (theType.Contains(".")) { SendMessage(client, "theType suspected to be a ClassType - attempting to invoke a marker of this class."); GameObject obj = null; //Now we have the classtype to create, create it thus! //This is required to ensure we check scripts for the space aswell, such as quests! foreach (Assembly asm in ScriptMgr.GameServerScripts) { obj = (GameObject)(asm.CreateInstance(theType, false)); if (obj != null) { break; } } if (args.Length == 4) { int templateID = 0; try { templateID = int.Parse(args[3]); } catch { } //If its an npc, load from the npc template about now. //By default, we ignore npctemplate if its set to 0. if ((GameNPC)obj != null && templateID != 0) { INpcTemplate npcTemplate = NpcTemplateMgr.GetTemplate(templateID); //we only want to load the template if one actually exists, or there could be trouble! if (npcTemplate != null) { ((GameNPC)obj).LoadTemplate(npcTemplate); } } } //Add to world... obj.Name = element.ObjectId.Substring(0, 18); obj.GuildName = element.ObjectId.Substring(18); obj.Position = new Vector3(element.X, element.Y, element.Z); obj.Heading = element.Heading; obj.CurrentRegion = client.Player.CurrentRegion; // now make sure model is visible if (obj is GameNPC && obj.Model == 0) { obj.Model = 408; // red ball } else if (obj is GameStaticItem && obj.Model == 0) { obj.Model = 100; // bag } if (!obj.AddToWorld()) { client.Out.SendMessage("Error: Object not added to world correctly!", eChatType.CT_Important, eChatLoc.CL_SystemWindow); } else { client.Out.SendMessage("Object added!", eChatType.CT_Say, eChatLoc.CL_SystemWindow); } } } catch (Exception ex) { client.Out.SendMessage("An Exception has occurred when trying to add object, review server error logs! Exception: " + ex.Message, eChatType.CT_Important, eChatLoc.CL_SystemWindow); log.Error("Instance Entry Error", ex); } } break; #endregion #region remove case "remove": { GameObject obj = client.Player.TargetObject; if (obj == null) { return; } string ObjectId = obj.Name + obj.GuildName; DataObject o = GameServer.Database.FindObjectByKey <DBInstanceXElement>(ObjectId); if (o == null) { client.Out.SendMessage("Could not find the entry in the database! <key=" + ObjectId + ">", eChatType.CT_Say, eChatLoc.CL_SystemWindow); return; } GameServer.Database.DeleteObject(o); client.Out.SendMessage("Object removed!", eChatType.CT_Say, eChatLoc.CL_SystemWindow); //Remove object... obj.RemoveFromWorld(); obj.Delete(); obj.DeleteFromDatabase(); } break; #endregion #region create case "create": { if (player.CurrentRegion.IsInstance) { SendMessage(client, "You are already in an instance, use /instance exit to get out."); return; } try { if (args.Length < 3) { throw new Exception("You need to provide a skin id. A skin is the ID of the region you want this instance to look like."); } Instance newInstance = player.TempProperties.getProperty <object>(key, null) as Instance; if (newInstance != null) { throw new Exception("You already have an instance '" + key + "' created, please close it before creating another."); } ushort skinID = Convert.ToUInt16(args[2]); newInstance = (Instance)WorldMgr.CreateInstance(skinID, typeof(Instance)); if (newInstance == null) { SendMessage(client, "Instance creation failed."); } else { SendMessage(client, "Instance created, now loading elements for instance '" + key + "' from the DB."); newInstance.LoadFromDatabase(key); player.TempProperties.setProperty(key, newInstance); } } catch (Exception ex) { SendMessage(client, ex.Message); return; } } break; #endregion #region close case "close": { Instance newInstance = player.TempProperties.getProperty <object>(key, null) as Instance; if (newInstance == null) { SendMessage(client, "Can't find an instance to delete."); } else { player.TempProperties.removeProperty(key); newInstance.DestroyWhenEmpty = true; if (newInstance.NumPlayers == 0) { SendMessage(client, "Instance closed."); } else { SendMessage(client, "Instance will close once all players leave."); } } } break; #endregion #region test case "test": { if (player.CurrentRegion.IsInstance) { SendMessage(client, "You are already in an instance, use /instance exit to get out."); return; } Instance newInstance = player.TempProperties.getProperty <object>(key, null) as Instance; if (newInstance == null) { SendMessage(client, "Can't find an instance to test, you will need to create one first."); } else { // start with some generic coordinates that seem to work well in many instance zones var pos = new Vector3(32361, 31744, 16003); ushort heading = 1075; // If you're having trouble zoning into an instance then try adding an entrance element so it can be used here if (newInstance.InstanceEntranceLocation != null) { pos = newInstance.InstanceEntranceLocation.Position; heading = newInstance.InstanceEntranceLocation.Heading; } // save current position for use with /instance exit GameLocation saveLocation = new GameLocation(player.Name + "_exit", player.CurrentRegionID, player.Position, player.Heading); player.TempProperties.setProperty(saveLocation.Name, saveLocation); bool success = true; if (!player.MoveTo(newInstance.ID, pos, heading)) { SendMessage(client, "MoveTo to entrance failed, now trying to move to current location inside the instance."); if (!player.MoveTo(newInstance.ID, player.Position, player.Heading)) { SendMessage(client, "That failed as well. Either add an entrance to this instance or move in the world to a corresponding instance location."); success = false; } } if (success) { SendMessage(client, "Welcome to Instance ID " + newInstance.ID + ", Skin: " + newInstance.Skin + ", with " + newInstance.Zones.Count + " zones and " + newInstance.Objects.Length + " objects inside the region!"); SendMessage(client, "Use '/instance exit' to leave if you get stuck."); } } } break; #endregion #region exit case "exit": { if (!player.CurrentRegion.IsInstance) { SendMessage(client, "You need to be in an instance to use this command."); return; } GameLocation saveLocation = player.TempProperties.getProperty <object>(player.Name + "_exit", null) as GameLocation; if (saveLocation == null) { ushort sourceRegion = (player.CurrentRegion as BaseInstance).Skin; if (!player.MoveTo(sourceRegion, player.Position, player.Heading)) { player.MoveToBind(); } } else { player.MoveTo(saveLocation.RegionID, saveLocation.Position, saveLocation.Heading); } } break; #endregion } return; }
/// <summary> /// Apply effect on target or do spell action if non duration spell /// </summary> /// <param name="target">target that gets the effect</param> /// <param name="effectiveness">factor from 0..1 (0%-100%)</param> public override void ApplyEffectOnTarget(GameLiving target, double effectiveness) { INpcTemplate template = NpcTemplateMgr.GetTemplate(Spell.LifeDrainReturn); if (template == null) { if (log.IsWarnEnabled) { log.WarnFormat("NPC template {0} not found! Spell: {1}", Spell.LifeDrainReturn, Spell.ToString()); } MessageToCaster("NPC template " + Spell.LifeDrainReturn + " not found!", eChatType.CT_System); return; } GameSpellEffect effect = CreateSpellEffect(target, effectiveness); IControlledBrain brain = null; if (template.ClassType != null && template.ClassType.Length > 0) { Assembly asm = Assembly.GetExecutingAssembly(); brain = (IControlledBrain)asm.CreateInstance(template.ClassType, true); if (brain == null && log.IsWarnEnabled) { log.Warn($"ApplyEffectOnTarget(): ClassType {template.ClassType} on NPCTemplateID {template.TemplateId} not found, using default ControlledBrain"); } } if (brain == null) { brain = GetPetBrain(Caster); } m_pet = GetGamePet(template); //brain.WalkState = eWalkState.Stay; m_pet.SetOwnBrain(brain as AI.ABrain); m_pet.SummonSpellDamage = Spell.Damage; m_pet.SummonSpellValue = Spell.Value; int x, y, z; ushort heading; Region region; GetPetLocation(out x, out y, out z, out heading, out region); m_pet.X = x; m_pet.Y = y; m_pet.Z = z; m_pet.Heading = heading; m_pet.CurrentRegion = region; m_pet.CurrentSpeed = 0; m_pet.Realm = Caster.Realm; if (m_isSilent) { m_pet.IsSilent = true; } m_pet.AddToWorld(); //Check for buffs if (brain is ControlledNpcBrain) { (brain as ControlledNpcBrain).CheckSpells(StandardMobBrain.eCheckSpellType.Defensive); } AddHandlers(); SetBrainToOwner(brain); m_pet.SetPetLevel(); m_pet.Health = m_pet.MaxHealth; if (DOL.GS.ServerProperties.Properties.PET_SCALE_SPELL_MAX_LEVEL > 0) { m_pet.Spells = template.Spells; // Have to scale spells again now that the pet level has been assigned } effect.Start(m_pet); Caster.OnPetSummoned(m_pet); }