public static MobBreedLocation CreateLocationFromPlayer(ZoneCharacter pCharacter, ushort mobID) { MobBreedLocation mbl = new MobBreedLocation(); mbl.MobID = mobID; mbl.MapID = pCharacter.MapID; mbl.InstanceID = pCharacter.Map.InstanceID; mbl.Position = new Vector2(pCharacter.Position); return mbl; }
public static MobBreedLocation CreateLocationFromPlayer(ZoneCharacter pCharacter, ushort mobID) { MobBreedLocation mbl = new MobBreedLocation(); mbl.MobID = mobID; mbl.MapID = pCharacter.MapID; mbl.InstanceID = pCharacter.Map.InstanceID; mbl.Position = new Vector2(pCharacter.Position); return(mbl); }
public Mob(MobBreedLocation mbl) { ID = mbl.MobID; Init(); // Make random location if (!mbl.Map.AssignObjectID(this)) { Log.WriteLine(LogLevel.Warn, "Couldn't spawn mob, out of ID's"); return; } Map = mbl.Map; spawnplace = mbl; while (true) { Position = Vector2.GetRandomSpotAround(Program.Randomizer, mbl.Position, 30); if (Map.Block != null) { if (Map.Block.CanWalk(Position.X, Position.Y)) { break; } } else { Map = mbl.Map; // Map.Block = spawnplace = mbl; break; } } SetBoundriesFromPointAndRange(Position, 100); spawnplace.CurrentMobs++; }
private void LoadMobBreeds() { MobBreeds = new List<MobBreedLocation>(); DataTable data = null; using (DatabaseClient dbClient = Program.DatabaseManager.GetClient()) { data = dbClient.ReadDataTable("SELECT *FROM `"+Settings.Instance.zoneMysqlDatabase+"`.`Mobspawn` WHERE MapID='" + this.MapInfo.ID + "'"); } if (data != null) { if (data.Rows.Count > 0) { foreach (DataRow row in data.Rows) { MobBreedLocation locationInfo = new MobBreedLocation() { MapID = GetDataTypes.GetUshort(row["MapID"]), MobID = GetDataTypes.GetUshort(row["MobID"]), //InstanceID = GetDataTypes.Getshort(row["InstanceID"]), //NOTE from db throws; InstanceID = 0, Position = new Vector2(), }; locationInfo.Position.X = GetDataTypes.GetInt(row["PosX"]); locationInfo.Position.Y = GetDataTypes.GetInt(row["PosY"]); MobBreeds.Add(locationInfo); } } else { MobBreeds = new List<MobBreedLocation>(); } } }
private void Init() { Info = DataProvider.Instance.GetMobInfo(ID); MobInfoServer temp; DataProvider.Instance.MobData.TryGetValue(Info.Name, out temp); InfoServer = temp; Moving = false; Target = null; spawnplace = null; nextUpdate = Program.CurrentTime; deathTriggered = false; HP = MaxHP; SP = MaxSP; Level = Info.Level; }