Esempio n. 1
0
 public FishingSpot(float x, float y, float z, float rotX, float rotY, float rotZ, float scale, FishingZoneType type, Loot[] loots)
 {
     this.type  = type;
     this.loots = loots;
     this.x     = x;
     this.y     = y;
     this.z     = z;
     this.rotX  = rotX;
     this.rotY  = rotY;
     this.rotZ  = rotZ;
     this.scale = scale;
 }
Esempio n. 2
0
        /// <summary>
        /// Initializes all fishing spots
        /// </summary>
        public void InitializeFishingSpots()
        {
            // Load loot tables from DB
            Dictionary <FishingZoneType, List <Loot> > loots = new Dictionary <FishingZoneType, List <Loot> >();

            foreach (FishingZoneType type in Enum.GetValues(typeof(FishingZoneType)))
            {
                loots[type] = new List <Loot>();
            }

            DBManager.SelectQuery("SELECT * FROM fishing_loot", (MySql.Data.MySqlClient.MySqlDataReader reader) =>
            {
                int itemId           = reader.GetInt32(0);
                int chance           = reader.GetInt32(1);
                FishingZoneType type = (FishingZoneType)reader.GetInt32(2);
                loots[type].Add(new Loot(itemId, chance));
            }).Execute();

            DBManager.SelectQuery("SELECT * FROM fishing_spots", (MySql.Data.MySqlClient.MySqlDataReader reader) =>
            {
                FishingZoneType type = (FishingZoneType)reader.GetInt32(1);
                List <Loot> loot     = loots[type];
                // edit
                if (type != FishingZoneType.NORMAL)
                {
                    loot.AddRange(loots[FishingZoneType.NORMAL]);
                }
                this.AddNewFishingZone(reader.GetInt32(0), reader.GetFloat(2), reader.GetFloat(3), reader.GetFloat(4), reader.GetFloat(5), reader.GetFloat(6), reader.GetFloat(7), reader.GetFloat(8), type, loot.ToArray());
            }).Execute();

            // After initialization spawn certain number of spots
            for (int i = 0; i < fishingZones.Count; i++)
            {
                if (i >= fishingZoneCount - 1)
                {
                    break;
                }
                fishingZones[i].Spawn();
            }
        }
Esempio n. 3
0
        public FishingZone(FishingZoneDepletedDelegate callback, int id, float x, float y, float z, float rotX, float rotY, float rotZ, float scale, FishingZoneType type, Loot[] loot)
        {
            this.fishingZoneDepletedMethod = callback;
            this.id = id;
            FishingSpot fishingSpot = new FishingSpot(x, y, z, rotX, rotY, rotZ, scale, type, loot);

            this.fishingSpot = fishingSpot;
            lootTable        = new LootTable(fishingSpot.loots);
        }
Esempio n. 4
0
 /// <summary>
 /// Adds a new fishing zone
 /// </summary>
 /// <param name="id">id</param>
 /// <param name="x">X</param>
 /// <param name="y">Y</param>
 /// <param name="z">Z</param>
 /// <param name="rotX">X rotation</param>
 /// <param name="rotY">Y rotation</param>
 /// <param name="scale">Scale</param>
 /// <param name="type">Type</param>
 /// <param name="loot">Loot</param>
 private void AddNewFishingZone(int id, float x, float y, float z, float rotX, float rotY, float rotZ, float scale, FishingZoneType type, Loot[] loot)
 {
     fishingZones.Add(new FishingZone(this.SpawnRandomFishingZone, id, x, y, z, rotX, rotY, rotZ, scale, type, loot));
 }