public void RunDeathEvent() { MapInstance.InstanceBag.NpcsKilled++; OnDeathEvents.ForEach(e => { if (e.EventActionType == EventActionType.THROWITEMS) { Tuple <int, short, byte, int, int> evt = (Tuple <int, short, byte, int, int>)e.Parameter; e.Parameter = new Tuple <int, short, byte, int, int>(MapNpcId, evt.Item2, evt.Item3, evt.Item4, evt.Item5); } EventHelper.Instance.RunEvent(e); }); if (OnDeathEvents.Any(s => s.EventActionType == EventActionType.SPAWNMONSTERS) && (List <MonsterToSummon>)OnDeathEvents.FirstOrDefault(e => e.EventActionType == EventActionType.SPAWNMONSTERS).Parameter is List <MonsterToSummon> summonParameters) { Parallel.ForEach(summonParameters, npcMonster => { npcMonster.SpawnCell.X = MapX; npcMonster.SpawnCell.Y = MapY; }); } if (OnDeathEvents.Any(s => s.EventActionType == EventActionType.SPAWNNPC) && (NpcToSummon)OnDeathEvents.FirstOrDefault(e => e.EventActionType == EventActionType.SPAWNNPC).Parameter is NpcToSummon npcMonsterToSummon) { npcMonsterToSummon.SpawnCell.X = MapX; npcMonsterToSummon.SpawnCell.Y = MapY; } OnDeathEvents.RemoveAll(s => s != null); }
public void RunDeathEvent() { MapInstance.InstanceBag.NpcsKilled++; OnDeathEvents.ForEach(e => { EventHelper.Instance.RunEvent(e); }); OnDeathEvents.RemoveAll(s => s != null); }
public void RunDeathEvent() { MapInstance.InstanceBag.NpcsKilled++; OnDeathEvents.ToList().ForEach(e => { if (e.EventActionType == EventActionType.THROWITEMS) { Tuple <int, short, byte, int, int> evt = (Tuple <int, short, byte, int, int>)e.Parameter; e.Parameter = new Tuple <int, short, byte, int, int>(MapNpcId, evt.Item2, evt.Item3, evt.Item4, evt.Item5); } EventHelper.Instance.RunEvent(e); }); OnDeathEvents.Clear(); }
public void RunDeathEvent() { MapInstance.InstanceBag.NpcsKilled++; OnDeathEvents.ForEach(e => { if (e.EventActionType == EventActionType.ThrowItems) { Tuple <int, short, byte, int, int> evt = (Tuple <int, short, byte, int, int>)e.Parameter; e.Parameter = new Tuple <int, short, byte, int, int>(MapNpcId, evt.Item2, evt.Item3, evt.Item4, evt.Item5); } EventHelper.Instance.RunEvent(e); }); OnDeathEvents.RemoveAll(s => s != null); }
public void RunDeathEvent() { Buff.ClearAll(); _noMove = false; _noAttack = false; if (IsBonus) { MapInstance.InstanceBag.Combo++; MapInstance.InstanceBag.Point += EventHelper.Instance.CalculateComboPoint(MapInstance.InstanceBag.Combo + 1); } else { MapInstance.InstanceBag.Combo = 0; MapInstance.InstanceBag.Point += EventHelper.Instance.CalculateComboPoint(MapInstance.InstanceBag.Combo); } MapInstance.InstanceBag.MonstersKilled++; OnDeathEvents.ForEach(e => EventHelper.Instance.RunEvent(e, monster: this)); }
public void RunDeathEvent() { if (IsBonus) { MapInstance.InstanceBag.Combo++; MapInstance.InstanceBag.Point += EventHelper.Instance.CalculateComboPoint(MapInstance.InstanceBag.Combo + 1); } else { MapInstance.InstanceBag.Combo = 0; MapInstance.InstanceBag.Point += EventHelper.Instance.CalculateComboPoint(MapInstance.InstanceBag.Combo); } MapInstance.InstanceBag.MonstersKilled++; OnDeathEvents.ForEach(e => { EventHelper.Instance.RunEvent(e, monster: this); }); }
public void RunDeathEvent() { if (IsBonus) { MapInstance.InstanceBag.Combo++; MapInstance.InstanceBag.Point += EventHelper.Instance.CalculateComboPoint(MapInstance.InstanceBag.Combo + 1); } else { MapInstance.InstanceBag.Combo = 0; MapInstance.InstanceBag.Point += EventHelper.Instance.CalculateComboPoint(MapInstance.InstanceBag.Combo); } MapInstance.InstanceBag.MonstersKilled++; OnDeathEvents.ForEach(e => { if (e.EventActionType == EventActionType.THROWITEMS) { Tuple <int, short, byte, int, int> evt = (Tuple <int, short, byte, int, int>)e.Parameter; e.Parameter = new Tuple <int, short, byte, int, int>(MapMonsterId, evt.Item2, evt.Item3, evt.Item4, evt.Item5); } EventHelper.Instance.RunEvent(e); }); }
public void Initialize() { if (MapInstance.MapInstanceType == MapInstanceType.BaseMapInstance && ServerManager.Instance.MapBossVNums.Contains(NpcVNum)) { MapCell randomCell = MapInstance.Map.GetRandomPosition(); if (randomCell != null) { if (MapInstance.Portals.Any(s => Map.GetDistance(new MapCell { X = s.SourceX, Y = s.SourceY }, new MapCell { X = randomCell.X, Y = randomCell.Y }) < 5)) { randomCell = MapInstance.Map.GetRandomPosition(); } MapX = randomCell.X; MapY = randomCell.Y; } } _random = new Random(MapNpcId); Npc = ServerManager.GetNpcMonster(NpcVNum); MaxHp = Npc.MaxHP; MaxMp = Npc.MaxMP; if (MapInstance?.MapInstanceType == MapInstanceType.TimeSpaceInstance) { if (IsProtected) { MaxHp *= 8; MaxMp *= 8; } } IsAlive = true; CurrentHp = MaxHp; CurrentMp = MaxMp; LastEffect = DateTime.Now; LastProtectedEffect = DateTime.Now; LastMove = DateTime.Now; LastSkill = DateTime.Now; IsHostile = Npc.IsHostile; ShouldRespawn = ShouldRespawn ?? true; FirstX = MapX; FirstY = MapY; EffectActivated = true; _movetime = ServerManager.RandomNumber(500, 3000); Path = new List <Node>(); Recipes = ServerManager.Instance.GetRecipesByMapNpcId(MapNpcId); Target = -1; Teleporters = ServerManager.Instance.GetTeleportersByNpcVNum(MapNpcId); Shop shop = ServerManager.Instance.GetShopByMapNpcId(MapNpcId); if (shop != null) { shop.Initialize(); Shop = shop; } Skills = new List <NpcMonsterSkill>(); foreach (NpcMonsterSkill ski in Npc.Skills) { Skills.Add(new NpcMonsterSkill { SkillVNum = ski.SkillVNum, Rate = ski.Rate }); } BattleEntity = new BattleEntity(this); if (AliveTime > 0) { Thread AliveTimeThread = new Thread(() => AliveTimeCheck()); AliveTimeThread.Start(); } if (NpcVNum == 1408) { OnDeathEvents.Add(new EventContainer(MapInstance, EventActionType.SPAWNMONSTER, new MonsterToSummon(621, new MapCell { X = MapX, Y = MapY }, null, move: true))); } if (NpcVNum == 1409) { OnDeathEvents.Add(new EventContainer(MapInstance, EventActionType.SPAWNMONSTER, new MonsterToSummon(622, new MapCell { X = MapX, Y = MapY }, null, move: true))); } if (NpcVNum == 1410) { OnDeathEvents.Add(new EventContainer(MapInstance, EventActionType.SPAWNMONSTER, new MonsterToSummon(623, new MapCell { X = MapX, Y = MapY }, null, move: true))); } if (OnSpawnEvents.Any()) { OnSpawnEvents.ToList().ForEach(e => { EventHelper.Instance.RunEvent(e, npc: this); }); OnSpawnEvents.Clear(); } }