Beispiel #1
0
 private void CreateMobSpawn(ZoneCharacter character, params string[] param)
 {
     if (param.Length == 2)
     {
         character.Map.MobBreeds.Add(MobBreedLocation.CreateLocationFromPlayer(character, ushort.Parse(param[1])));
     }
 }
Beispiel #2
0
        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.CanWalk(Position.X, Position.Y))
                {
                    break;
                }
            }
            SetBoundriesFromPointAndRange(Position, 100);

            Spawnplace.CurrentMobs++;
        }
Beispiel #3
0
        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;
        }
Beispiel #4
0
        private void LoadMobBreeds()
        {
            MobBreeds = new List <MobBreedLocation>();

            DataTable data = null;

            using (var dbClient = Program.DatabaseManager.GetClient())
            {
                data = dbClient.ReadDataTable("SELECT  *FROM `" + Settings.Instance.zoneMysqlDatabase +
                                              "`.`Mobspawn` WHERE MapID='" + MapInfo.ID + "'");
            }

            if (data != null)
            {
                if (data.Rows.Count > 0)
                {
                    foreach (DataRow row in data.Rows)
                    {
                        var 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>();
                }
            }
        }