public bool SpawnMinion() { if (Pets.Count >= MaxMinions) { return(false); } MonsterInfo info = Envir.GetMonsterInfo(Settings.SnakesName); if (info == null) { return(false); } MonsterObject monster; monster = MonsterObject.GetMonster(info); monster.PetLevel = PetLevel; monster.Master = this; monster.MaxPetLevel = (byte)(1 + PetLevel * 2); monster.Direction = Direction; monster.ActionTime = Envir.Time + 1000; ((Monsters.CharmedSnake)monster).AliveTime = Envir.Time + ((PetLevel * 2000) + 10000); ((Monsters.CharmedSnake)monster).MasterTotem = this; SlaveList.Add(monster); monster.Spawn(CurrentMap, CurrentLocation); return(true); }
private void CreateGuards() { foreach (GuardInfo info in Info.Guards) { MonsterObject mob = MonsterObject.GetMonster(info.Monster); mob.Direction = info.Direction; if (!mob.Spawn(this, new Point(info.X, info.Y))) { SEnvir.Log($"Failed to spawn Guard Map:{Info.Description}, Location: {info.X}, {info.Y}"); continue; } } }
public void Spawn() { if (Gate != null) { Gate.Despawn(); } MonsterInfo monsterInfo = Envir.GetMonsterInfo(Info.MobIndex); if (monsterInfo == null) { return; } if (monsterInfo.AI != 72) { return; } if (monsterInfo.AI == 72) { Gate = (Gate)MonsterObject.GetMonster(monsterInfo); } else if (monsterInfo.AI == 73) { //Gate = (GateWest)MonsterObject.GetMonster(monsterInfo); } if (Gate == null) { return; } Gate.Conquest = Conquest; Gate.GateIndex = Index; Gate.Spawn(Conquest.ConquestMap, Info.Location); if (Health == 0) { Gate.Die(); } else { Gate.SetHP(Health); } Gate.CheckDirection(); }
public void Spawn(bool repair) { if (Wall != null) { Wall.Despawn(); } MonsterInfo monsterInfo = Envir.GetMonsterInfo(Info.MobIndex); if (monsterInfo == null) { return; } if (monsterInfo.AI != 82) { return; } Wall = (Wall)MonsterObject.GetMonster(monsterInfo); if (Wall == null) { return; } Wall.Conquest = Conquest; Wall.WallIndex = Index; Wall.Spawn(Conquest.ConquestMap, Info.Location); if (repair) { Health = Wall.Stats[Stat.HP]; } if (Health == 0) { Wall.Die(); } else { Wall.SetHP(Health); } Wall.CheckDirection(); }
public void Spawn(bool repair) { if (Gate != null) { Gate.Despawn(); } MonsterInfo monsterInfo = Envir.GetMonsterInfo(Info.MobIndex); if (monsterInfo == null) { return; } if (monsterInfo.AI != 81) { return; } Gate = (Gate)MonsterObject.GetMonster(monsterInfo); if (Gate == null) { return; } Gate.Conquest = Conquest; Gate.GateIndex = Index; Gate.Spawn(Conquest.ConquestMap, Info.Location); if (repair) { Health = Gate.Stats[Stat.HP]; } if (Health == 0) { Gate.Die(); } else { Gate.SetHP(Health); } Gate.CheckDirection(); }
public void Spawn(bool Revive = false) { if (Revive) { Alive = true; } MonsterInfo monsterInfo = Envir.GetMonsterInfo(Info.MobIndex); if (monsterInfo == null) { return; } if (monsterInfo.AI != 80) { return; } ArcherMonster = (ConquestArcher)MonsterObject.GetMonster(monsterInfo); if (ArcherMonster == null) { return; } ArcherMonster.Conquest = Conquest; ArcherMonster.ArcherIndex = Index; if (Alive) { ArcherMonster.Spawn(Conquest.ConquestMap, Info.Location); } else { ArcherMonster.Spawn(Conquest.ConquestMap, Info.Location); ArcherMonster.Die(); ArcherMonster.DeadTime = Envir.Time; } }
public bool Load() { try { MonsterInfo info = Envir.GetMonsterInfo(Info.MonsterName); if (info == null) { MessageQueue.Enqueue("加载龙失败(错误怪物名): " + Info.MonsterName); return(false); } LinkedMonster = MonsterObject.GetMonster(info); Map map = Envir.GetMapByNameAndInstance(Info.MapFileName); if (map == null) { MessageQueue.Enqueue("加载龙失败(错误的地图名): " + Info.MapFileName); return(false); } if (Info.Location.X > map.Width || Info.Location.Y > map.Height) { MessageQueue.Enqueue("加载龙失败(错误地图XY): " + Info.MapFileName); return(false); } if (LinkedMonster.Spawn(map, Info.Location)) { if (LinkedMonster is EvilMir) { EvilMir mob = (EvilMir)LinkedMonster; if (mob != null) { mob.DragonLink = true; } } MonsterInfo bodyinfo = Envir.GetMonsterInfo(Info.BodyName); if (bodyinfo != null) { MonsterObject bodymob; Point spawnlocation = Point.Empty; for (int i = 0; i <= BodyLocations.Length - 1; i++) { bodymob = MonsterObject.GetMonster(bodyinfo); spawnlocation = new Point(LinkedMonster.CurrentLocation.X + BodyLocations[i].X, LinkedMonster.CurrentLocation.Y + BodyLocations[i].Y); if (bodymob != null) { bodymob.Spawn(LinkedMonster.CurrentMap, spawnlocation); } } } DropArea = new Rectangle(Info.DropAreaTop.X, Info.DropAreaTop.Y, Info.DropAreaBottom.X - Info.DropAreaTop.X, Info.DropAreaBottom.Y - Info.DropAreaTop.Y); Loaded = true; return(true); } } catch (Exception ex) { MessageQueue.Enqueue(ex); } MessageQueue.Enqueue("加载龙失败"); return(false); }
public void DoSpawn(bool eventSpawn) { if (!eventSpawn) { if (Info.EventSpawn || SEnvir.Now < NextSpawn) { return; } if (Info.Delay >= 1000000) { TimeSpan timeofDay = TimeSpan.FromMinutes(Info.Delay - 1000000); if (LastCheck.TimeOfDay >= timeofDay || SEnvir.Now.TimeOfDay < timeofDay) { LastCheck = SEnvir.Now; return; } LastCheck = SEnvir.Now; } else { if (Info.Announce) { NextSpawn = SEnvir.Now.AddSeconds(Info.Delay * 60); } else { NextSpawn = SEnvir.Now.AddSeconds(SEnvir.Random.Next(Info.Delay * 60) + Info.Delay * 30); } } } for (int i = AliveCount; i < Info.Count; i++) { MonsterObject mob = MonsterObject.GetMonster(Info.Monster); if (!Info.Monster.IsBoss) { if (SEnvir.Now > CurrentMap.HalloweenEventTime && SEnvir.Now <= Config.HalloweenEventEnd) { mob = new HalloweenMonster { MonsterInfo = Info.Monster, HalloweenEventMob = true }; CurrentMap.HalloweenEventTime = SEnvir.Now.AddHours(1); } else if (SEnvir.Now > CurrentMap.ChristmasEventTime && SEnvir.Now <= Config.ChristmasEventEnd) { mob = new ChristmasMonster { MonsterInfo = Info.Monster, ChristmasEventMob = true }; CurrentMap.ChristmasEventTime = SEnvir.Now.AddMinutes(20); } } mob.SpawnInfo = this; if (!mob.Spawn(Info.Region, CurrentMap.Instance, CurrentMap.InstanceIndex)) { mob.SpawnInfo = null; continue; } if (Info.Announce) { if (Info.Delay >= 1000000) { foreach (SConnection con in SEnvir.Connections) { con.ReceiveChat($"{mob.MonsterInfo.MonsterName} has appeared.", MessageType.System); } } else { foreach (SConnection con in SEnvir.Connections) { con.ReceiveChat(string.Format(con.Language.BossSpawn, CurrentMap.Info.Description), MessageType.System); } } } mob.DropSet = Info.DropSet; AliveCount++; } }
public void StartRaid() { if (CurrentMap == null || LobbyMap == null) { return; } // Get the Mob info for sub0 MonsterInfo mInfo = Envir.GetMonsterInfo(Info.Sub0Index); // Check it's not null if (mInfo != null) { // Get a Monster object MonsterObject mob = MonsterObject.GetMonster(mInfo); // Check it's not null if (mob != null) { // Set a default direction mob.Direction = MirDirection.DownRight; // Set it's action time mob.ActionTime = Envir.Time + 1000; mob.Raid = this; mob.IsRaidBoss = true; // Inital attempt to spawn bool spawned = mob.Spawn(CurrentMap, Info.BossAreas[0]); // Check if it's not been spawned if (!spawned) { // Loop through locations in a 10x10 square area for (int x = Info.BossAreas[0].X - 5; x < Info.BossAreas[0].X + 5; x++) { // Stop if it's spawned already if (spawned) { continue; } for (int y = Info.BossAreas[0].Y - 5; y < Info.BossAreas[0].Y; y++) { // Attempt to spawn the sub0 if (mob.Spawn(CurrentMap, new Point(x, y))) { // It successfully spawned. spawned = true; } } } } if (spawned) { // Loop through the players on the lobby map for (int i = LobbyMap.Players.Count - 1; i >= 0; i--) { // Notify how logn they have. LobbyMap.Players[i].ReceiveChat(string.Format("You have {0} minutes to complete the raid!", Info.Duration), ChatType.Announcement); LobbyMap.Players[i].ReceiveChat(string.Format("You must defeat {0} located at X:{1} Y:{2} before proceeding to the next boss.", mob.Info.GameName, mob.CurrentLocation.X, mob.CurrentLocation.Y), ChatType.Hint); // Teleport them in within a distance of 12 LobbyMap.Players[i].TeleportRandom(100, 12, CurrentMap); } Envir.Broadcast(new ServerPackets.Chat { Message = string.Format("{0} raid has started!", Info.Title), Type = ChatType.Announcement }); Started = true; } } } }