public QuestKillTask ParseKill(string line) { if (line.Length < 1) { return(null); } string[] split = line.Split(' '); int count = 1; string message = ""; MonsterInfo mInfo = Envir.GetMonsterInfo(split[0]); if (split.Length > 1) { int.TryParse(split[1], out count); } var match = _regexMessage.Match(line); if (match.Success) { message = match.Groups[1].Captures[0].Value; } return(mInfo == null ? null : new QuestKillTask() { Monster = mInfo, Count = count, Message = message }); }
private void ParseGoods(IList<string> lines) { for (int i = 0; i < lines.Count; i++) { if (!lines[i].ToUpper().StartsWith(TradeKey)) continue; while (++i < lines.Count) { if (lines[i].StartsWith("[")) return; if (String.IsNullOrEmpty(lines[i])) continue; var data = lines[i].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); ItemInfo info = Envir.GetItemInfo(data[0]); if (info == null) continue; UserItem goods = Envir.CreateShopItem(info, (uint)i); if (goods == null || Goods.Contains(goods)) { MessageQueue.Enqueue(string.Format("Could not find Item: {0}, File: {1}", lines[i], FileName)); continue; } ushort count = 1; if (data.Length == 2) ushort.TryParse(data[1], out count); goods.Count = count; Goods.Add(goods); } } }
private void ParseCrafting(IList<string> lines) { for (int i = 0; i < lines.Count; i++) { if (!lines[i].ToUpper().StartsWith(RecipeKey)) continue; while (++i < lines.Count) { if (lines[i].StartsWith("[")) return; if (String.IsNullOrEmpty(lines[i])) continue; var data = lines[i].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); ItemInfo info = Envir.GetItemInfo(data[0]); if (info == null) continue; RecipeInfo recipe = Envir.RecipeInfoList.SingleOrDefault(x => x.MatchItem(info.Index)); if (recipe == null) { MessageQueue.Enqueue(string.Format("Could not find recipe: {0}, File: {1}", lines[i], FileName)); continue; } if (recipe.Ingredients.Count == 0) { MessageQueue.Enqueue(string.Format("Could not find ingredients: {0}, File: {1}", lines[i], FileName)); continue; } CraftGoods.Add(recipe); } } }
private void SpawnSlaves() { _SpawnedSlaves = true; ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; for (int i = 0; i < 3; i++) { MonsterObject mob = GetMonster(Envir.GetMonsterInfo(Settings.SnowWolfKingMob)); if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Target.Back)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
private void SpawnBomb() { int distance = Envir.Random.Next(_bombSpreadMin, _bombSpreadMax); for (int j = 0; j < CurrentMap.Players.Count; j++) { Point playerLocation = CurrentMap.Players[j].CurrentLocation; Point location = new Point(playerLocation.X + Envir.Random.Next(-distance, distance + 1), playerLocation.Y + Envir.Random.Next(-distance, distance + 1)); MonsterObject mob = null; switch (Envir.Random.Next(3)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellBomb3)); break; } if (mob == null) { return; } mob.Spawn(CurrentMap, location); } }
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); }
protected void SpawnSlave() { ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; MonsterObject mob = GetMonster(Envir.GetMonsterInfo(Name)); if (mob == null) { base.ProcessAI(); return; } Yimoogi childmob = (Yimoogi)mob; if (!childmob.Spawn(CurrentMap, Front)) { childmob.Spawn(CurrentMap, CurrentLocation); } if (Target != null) { childmob.Target = Target; childmob.NoAttack = false; } childmob.IsChild = true; childmob.SisterMob = this; childmob.ActionTime = Envir.Time + 2000; SisterMob = childmob; ChildSpawned = true; }
//召唤冰狼 private void SpawnWolf() { SpawnWolfTime = Envir.Time + 10000; byte count = (byte)RandomUtils.Next(2, 7); SpawnWolfCount += count; for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (RandomUtils.Next(7)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.KingGuardName)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.KingGuardName1)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.KingGuardName2)); break; } if (mob == null) { return; } mob.Target = Target; mob.ActionTime = Envir.Time + 1000; CurrentMap.ActionList.Add(new DelayedAction(DelayedType.Spawn, Envir.Time + 500, mob, CurrentMap.RandomValidPoint(CurrentLocation.X, CurrentLocation.Y, 5), this)); } }
private void SpawnBoulder() { if (Functions.InRange(CurrentLocation, _MapCentre, 20)) { Teleport(CurrentMap, _MapCentre, true, 10); } _CalledBoulders = true; for (int i = 0; i < 8; i++) { var mob = GetMonster(Envir.GetMonsterInfo(Settings.HornedCommanderBombMob)); var odd = i % 2 != 0; var point = Functions.PointMove(CurrentLocation, (MirDirection)i, odd ? 7 : 9); if (mob == null) { continue; } mob.Direction = Functions.DirectionFromPoint(point, CurrentLocation); if (mob.Spawn(CurrentMap, point)) { mob.Target = Target; mob.ActionTime = Envir.Time; SlaveList.Add(mob); } } }
private void SpawnSlaves() { int count = Math.Min(3, 6 - SlaveList.Count); for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (Envir.Random.Next(4)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.GeneralMeowMeowMob1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.GeneralMeowMeowMob2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.GeneralMeowMeowMob3)); break; case 3: mob = GetMonster(Envir.GetMonsterInfo(Settings.GeneralMeowMeowMob4)); break; } if (mob == null) continue; if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
public QuestItemTask ParseItem(string line) { if (line.Length < 1) { return(null); } string[] split = line.Split(' '); uint count = 1; string message = ""; ItemInfo mInfo = Envir.GetItemInfo(split[0]); if (split.Length > 1) { uint.TryParse(split[1], out count); } var match = _regexMessage.Match(line); if (match.Success) { message = match.Groups[1].Captures[0].Value; } //if (mInfo.StackSize <= 1) //{ // //recursively add item if cant stack??? //} return(mInfo == null ? null : new QuestItemTask { Item = mInfo, Count = count, Message = message }); }
private void SpawnSlaves() { int count = Math.Min(6, 40 - SlaveList.Count); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; for (int i = 0; i < count; i++) { MonsterObject mob = null; mob = GetMonster(Envir.GetMonsterInfo(Settings.AncientBatName)); if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Target.CurrentLocation)) { mob.Spawn(CurrentMap, Target.CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
/// <summary> /// Method to spawn other monsters /// </summary> /// <returns></returns> public bool SpawnMinion() { MonsterObject mob = null; // Get the monster to spawn as slave by name defined mob = GetMonster(Envir.GetMonsterInfo(SlaveName)); // Ensure we're not trying to spawn an invalid monster if (mob == null) { return(false); } // Get a random point on the map within 6 spots from current location Point randomLocation = GetRandomPoint(14, 6, CurrentMap); // Spawn the monster at the random location if (!mob.Spawn(CurrentMap, randomLocation)) { // If we can't spawn the monster at the random location, spawn it on the CrystalBeast mob.Spawn(CurrentMap, CurrentLocation); } // Ensure the target isn't null or dead if (Target == null || Target.Dead) { // Find a new target if the conditions are met FindTarget(); } // Slaves will target the CrystalBeasts target. mob.Target = Target; mob.ActionTime = Envir.Time + 2000; // Add the Slave the the custom slave list so we can destroy it if the CrystalBeast dies (see the Die override) slaves.Add(mob); return(true); }
protected override void Attack() { ShockTime = 0; if (!Target.IsAttackTarget(this)) { Target = null; return; } if (SlaveList.Count >= 20) { return; } MonsterObject spawn = GetMonster(Envir.GetMonsterInfo(Settings.BugBatName)); if (spawn == null) { return; } Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + 3000; spawn.Target = Target; spawn.ActionTime = Envir.Time + 1000; CurrentMap.ActionList.Add(new DelayedAction(DelayedType.Spawn, Envir.Time + 500, spawn, CurrentLocation, this)); }
public void StartWar(ConquestGame type) { WarIsOn = true; Envir.Broadcast(new S.Chat { Message = string.Format("{0} War has started!", Info.Name), Type = ChatType.System }); }
//是否召唤冰狼 //如果身边有超过5个冰狼,则不召唤冰狼 //10秒内不重复召唤 private bool CanSpawnWolf() { if (SpawnWolfTime > Envir.Time) { return(false); } if (SpawnWolfCount > 20) { return(false); } MonsterObject mob = GetMonster(Envir.GetMonsterInfo(Settings.SnowWolfName)); if (mob == null) { return(false); } //周围5格的血狼不超过3个 List <MapObject> Friends = FindFriendsNearby(5); if (Friends.Count > 3) { return(false); } return(true); }
public override Packet GetInfo() { sbyte tmpSByte = 0; if (Item != null) { ItemInfo tmp = Envir.GetItemInfo(Item.ItemIndex); if (tmp != null) { switch (Item.Info.Grade) { default: case ItemGrade.None: tmpSByte = 0; break; case ItemGrade.Common: tmpSByte = 1; break; case ItemGrade.Rare: tmpSByte = 2; break; case ItemGrade.Legendary: tmpSByte = 3; break; case ItemGrade.Mythical: tmpSByte = 4; break; case ItemGrade.Quest: tmpSByte = 5; break; } } // Code after for overriding the grade effect if (Item.IsAdded) { tmpSByte = 6; } return(new S.ObjectItem { ObjectID = ObjectID, Name = Item.Count > 1 ? string.Format("{0} ({1})", Name, Item.Count) : Name, NameColour = NameColour, Location = CurrentLocation, Image = Item.Image, floorColor = tmpSByte }); } return(new S.ObjectGold { ObjectID = ObjectID, Gold = Gold, Location = CurrentLocation, }); }
private void ParseQuests(IList <string> lines) { for (int i = 0; i < lines.Count; i++) { if (!lines[i].ToUpper().StartsWith(QuestKey)) { continue; } var loadedNPC = NPCObject.Get(LoadedObjectID); if (loadedNPC == null) { return; } while (++i < lines.Count) { if (lines[i].StartsWith("[")) { return; } if (String.IsNullOrEmpty(lines[i])) { continue; } int.TryParse(lines[i], out int index); if (index == 0) { continue; } QuestInfo info = Envir.GetQuestInfo(Math.Abs(index)); if (info == null) { return; } if (index > 0) { info.NpcIndex = LoadedObjectID; } else { info.FinishNpcIndex = LoadedObjectID; } if (loadedNPC.Quests.All(x => x != info)) { loadedNPC.Quests.Add(info); } } } }
public void Show() { TargetLocation = Target.CurrentLocation; Visible = true; CellTime = ChildRock ? ParentRock.CellTime : Envir.Time + 500; Broadcast(GetInfo()); Broadcast(new S.ObjectShow { ObjectID = ObjectID }); if (!ChildRock) { Target.ApplyPoison(new Poison { PType = PoisonType.Paralysis, Duration = 3, TickSpeed = 1000 }, this, true); Target.InTrapRock = true; MonsterObject mob = null; TrapRock childmob = null; for (byte i = 0; i <= 6; i += 2) { if (i == SpawnCorner) { continue; } mob = GetMonster(Envir.GetMonsterInfo(Name)); if (mob == null) { return; } childmob = (TrapRock)mob; if (childmob.Spawn(CurrentMap, Functions.PointMove(Target.CurrentLocation, (MirDirection)i, 1))) { if (Target != null) { childmob.Target = Target; } childmob.ChildRock = true; childmob.ParentRock = this; SlaveList.Add(childmob); childmob.Show(); childmob.ActionTime = this.ActionTime; childmob.AttackTime = this.AttackTime; } else { continue; } } } }
protected override void ProcessAI() { if (Dead) { return; } if (!IsChild && HP <= MaxHP / 10 && !FinalTeleport) { Point teleportlocation = CurrentLocation; if (TeleportRandom(40, 0)) { FinalTeleport = true; MonsterObject mob = null; for (int i = 0; i < WhiteSnakeCount; i++) { mob = GetMonster(Envir.GetMonsterInfo(Settings.WhiteSnake)); if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, teleportlocation)) { continue; } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; } Target = null; } } if (!IsChild && !ChildSpawned && Envir.Time > SpawnTime) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 }); SpawnSlave(); return; } if (IsChild && SisterMobReady()) { if (Functions.InRange(CurrentLocation, SisterMob.CurrentLocation, 2) && Target == null && Functions.MaxDistance(CurrentLocation, SisterMob.CurrentLocation) < 10) { MoveTo(SisterMob.CurrentLocation); return; } } base.ProcessAI(); }
public static DropInfo FromLine(string s) { string[] parts = s.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length < 2) { return(null); } DropInfo info = new DropInfo(); if (!int.TryParse(parts[0].Substring(2), out info.Chance)) { return(null); } if (string.Compare(parts[1], "Gold", StringComparison.OrdinalIgnoreCase) == 0) { if (parts.Length < 3) { return(null); } if (!uint.TryParse(parts[2], out info.Gold) || info.Gold == 0) { return(null); } } else if (parts[1].ToUpper().StartsWith("GROUP")) { info.GroupedDrop = new GroupDropInfo { Random = parts[1].EndsWith("*"), First = parts[1].EndsWith("^") }; } else { info.Item = Envir.GetItemInfo(parts[1]); if (info.Item == null) { return(null); } if (parts.Length > 2) { string dropRequirement = parts[2]; if (dropRequirement.ToUpper() == "Q") { info.QuestRequired = true; } } } return(info); }
private void SpawnSlaves() { //一次召唤8个帮手 int count = Math.Min(8, 40 - SlaveList.Count); for (int i = 0; i < count; i++) { MonsterObject mob = null; switch (RandomUtils.Next(7)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma3)); break; case 3: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma4)); break; case 4: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma5)); break; case 5: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma6)); break; case 6: mob = GetMonster(Envir.GetMonsterInfo(Settings.Zuma7)); break; } if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, CurrentLocation); } mob.Target = Target; mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
protected override void Attack() { ShockTime = 0; if (!Target.IsAttackTarget(this)) { Target = null; return; } if (SlaveList.Count >= 20) { return; } MonsterObject spawn = GetMonster(Envir.GetMonsterInfo(Settings.BombSpiderName)); if (spawn == null) { return; } Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + 3000; spawn.Target = Target; spawn.ActionTime = Envir.Time + 1000; Point spawnlocation = Point.Empty; switch (Direction) { case MirDirection.Up: spawnlocation = Back; break; case MirDirection.UpRight: spawnlocation = Functions.PointMove(CurrentLocation, MirDirection.DownRight, 1); break; case MirDirection.Right: spawnlocation = Functions.PointMove(CurrentLocation, MirDirection.DownLeft, 1); break; } CurrentMap.ActionList.Add(new DelayedAction(DelayedType.Spawn, Envir.Time + 500, spawn, spawnlocation, this)); }
public RecipeInfo(string name) { ItemInfo itemInfo = Envir.GetItemInfo(name); if (itemInfo == null) { MessageQueue.Enqueue(string.Format("找不到物品合成配方: {0}", name)); return; } Item = Envir.CreateShopItem(itemInfo, ++Envir.NextRecipeID); LoadIngredients(name); }
private void SpawnSlaves() { int count = Math.Min(1, 4 - SlaveList.Count); for (int i = 0; i < count; i++) { MonsterObject mob = null; if (slaves1 == true) { switch (Envir.Random.Next(2)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.ScrollMob1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.ScrollMob2)); break; } } if (slaves2 == true) { switch (Envir.Random.Next(2)) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.ScrollMob3)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.ScrollMob4)); break; } } if (mob == null) { continue; } if (!mob.Spawn(CurrentMap, Front)) { mob.Spawn(CurrentMap, Target.CurrentLocation); } mob.ActionTime = Envir.Time + 2000; SlaveList.Add(mob); } }
public RecipeInfo(string name) { ItemInfo itemInfo = Envir.GetItemInfo(name); if (itemInfo == null) { MessageQueue.Enqueue(string.Format("Could not find Item: {0}", name)); return; } Item = Envir.CreateShopItem(itemInfo); LoadIngredients(name); }
public void NewBuff(int Id, bool charge = true) { GuildBuffInfo info = Envir.FindGuildBuffInfo(Id); if (info == null) { return; } GuildBuff buff = new GuildBuff() { Id = Id, Info = info, Active = true, }; buff.ActiveTimeRemaining = buff.Info.TimeLimit; if (charge) { ChargeForBuff(buff); } BuffList.Add(buff); List <GuildBuff> NewBuff = new List <GuildBuff> { buff }; SendServerPacket(new ServerPackets.GuildBuffList { ActiveBuffs = NewBuff }); //now tell everyone our new sparepoints for (int i = 0; i < Ranks.Count; i++) { for (int j = 0; j < Ranks[i].Members.Count; j++) { if (Ranks[i].Members[j].Player != null) { SendGuildStatus((PlayerObject)Ranks[i].Members[j].Player); } } } NeedSave = true; RefreshAllStats(); }
private void SpawnKnight() { MonsterObject mob = null; switch (_stage) { case 0: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellKnight1)); break; case 1: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellKnight2)); break; case 2: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellKnight3)); break; case 3: mob = GetMonster(Envir.GetMonsterInfo(Settings.HellKnight4)); break; } if (mob == null || !(mob is HellKnight)) { return; } HellKnight knight = (HellKnight)mob; knight.Owner = this; knight.Lord = this; Point front = Functions.PointMove(CurrentLocation, MirDirection.DownLeft, 12); for (int i = 0; i < 50; i++) { Point location = new Point(front.X + Envir.Random.Next(-10, 10), front.Y + Envir.Random.Next(-10, 10)); if (CurrentMap.ValidPoint(location)) { DelayedAction action = new DelayedAction(DelayedType.Spawn, Envir.Time + 500, knight, location); CurrentMap.ActionList.Add(action); break; } } }
private void ParseGoods(IList <string> lines) { for (int i = 0; i < lines.Count; i++) { if (!lines[i].ToUpper().StartsWith(TradeKey)) { continue; } while (++i < lines.Count) { if (lines[i].StartsWith("[")) { return; } if (String.IsNullOrEmpty(lines[i])) { continue; } var data = lines[i].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); ItemInfo info = Envir.GetItemInfo(data[0]); if (info == null) { continue; } UserItem goods = new UserItem(info) { CurrentDura = info.Durability, MaxDura = info.Durability }; if (goods == null || Goods.Contains(goods)) { MessageQueue.Enqueue(string.Format("Could not find Item: {0}, File: {1}", lines[i], FileName)); continue; } uint count = 1; if (data.Length == 2) { uint.TryParse(data[1], out count); } goods.Count = count; goods.UniqueID = (ulong)i; Goods.Add(goods); } } }
public bool DeleteEnvir(Envir env) { if (MCell[env.Location.X, env.Location.Y].LEnvir != null) { MCell[env.Location.X, env.Location.Y].LEnvir = null; if (!MChunk[env.Location.X / 16, env.Location.Y / 16].Envirs.Remove(env)) { System.Console.WriteLine("Не найден envir в чанке"); } return(true); } else { return(false); } }