/// <param name="creator">Can be null</param> static BaseInstance SetupInstance(Character creator, BaseInstance instance, InstanceTemplate template, uint difficultyIndex = 0u) { if (instance != null) { instance.difficulty = template.MapTemplate.GetDifficulty(difficultyIndex) ?? template.MapTemplate.Difficulties[0]; if (creator != null) { // set faction & leader instance.m_OwningFaction = creator.FactionGroup; instance.Owner = creator.InstanceLeader; instance.IsActive = true; } instance.InitMap(template.MapTemplate); Instances.AddInstance(instance.MapId, instance); } return(instance); }
public void FinalizeDataHolder() { //if (NormalResetDelay > 0 && HeroicResetDelay == 0) //{ // HeroicResetDelay = NormalResetDelay; //} if (RepopPosition == default(Vector3)) { RepopRegionId = MapId.End; } if (IsInstance) { InstanceTemplate = new InstanceTemplate(this); InstanceMgr.InstanceInfos.Add(this); } //ArrayUtil.Set(ref World.s_regionInfos, (uint)Id, this); }
/// <param name="creator">Can be null</param> public static BaseInstance CreateInstance(Character creator, InstanceTemplate template, uint difficultyIndex) { BaseInstance instance = template.Create(); return(SetupInstance(creator, instance, template, difficultyIndex)); }
/// <param name="creator">Can be null</param> public static I CreateInstance <I>(Character creator, InstanceTemplate template, uint difficultyIndex) where I : BaseInstance, new() { return((I)SetupInstance(creator, Activator.CreateInstance <I>(), template, difficultyIndex)); }