示例#1
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     level = Content.Load<Map>("tester");
     // TODO: use this.Content to load your game content here
 }
示例#2
0
 public MapEngine(string conString, string providerName, Map map)
 {
     mapManager = new MapManager(conString, providerName);
     itemDataManager = new ItemDataManager(conString, providerName);
     mapItemManager = new MapItemManager(conString, providerName);
     this.Map = map;
     mapItems = new List<MapItem>();
     gameEngine = new GameEngine(conString, providerName);
     ActiveClientEntities = new List<BaseEntity>();
     monsterEngine = new MonsterEngine(map.Monsters, ActiveClientEntities);
     monsterEngine.MonsterMove += new EventHandler<MonsterMoveInfoEventArgs>(monsterEngine_MonsterMove);
     monsterEngine.MonsterAttack += new EventHandler<MonsterAttackInfoEventArgs>(monsterEngine_MonsterAttack);
     monsterEngine.StartEngine();
 }
示例#3
0
 public static byte[] SendMap(Map mh)
 {
     Packet p = new Packet(200);
     p.WriteByte(0);
     p.WriteInt(mh.MapID);
     p.WriteByte(0);
     p.WriteShort(mh.MultiplyValue);
     p.WriteByte(mh.MultiplyValue);
     p.WriteByte(1);
     p.WriteByte(mh.Portals.Count);
     foreach (Portal portal in mh.Portals)
     {
         p.WriteInt(portal.ToMapID);
         p.WriteShort(portal.FromX);
         p.WriteShort(portal.FromY);
         p.WriteShort(portal.Width);
         p.WriteShort(portal.Height);
         p.WriteByte(1); // type
     }
     //  p.WriteHexString("01 02 01 00 00 00 21 03 2A 03 40 00 40 00 01 0B 00 00 00 91 00 75 00 20 00 20 00 01");
     return p.GetWrittenBuffer(PacketIds.SendMap);
 }
示例#4
0
 if (map.MapID != 9 && map.MapID != 10 && map.MapID != 13 && map.MapID != 14) // maps we dont have maskes for yet..
     map.WalkableTiles = GetWalkableTiles(map.Name);
            }
            

            return maps.ToArray();
        }

        public Map GetMapById(int mapId)
        {
            DbParameter mapIdParameter = _db.CreateParameter(DbNames.GETMAPBYID_ID_PARAMETER, mapId);

            mapIdParameter.DbType = System.Data.DbType.Int32;

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETMAPBYID_STOREDPROC, System.Data.CommandType.StoredProcedure, mapIdParameter);

            int ordinalId = reader.GetOrdinal(DbNames.MAP_ID);
            int ordinalName = reader.GetOrdinal(DbNames.MAP_NAME);
            int ordinalMultiplyValue = reader.GetOrdinal(DbNames.MAP_MULTIPLYVALUE);
            int ordinalSpawnX = reader.GetOrdinal(DbNames.MAP_SPAWNX);
            int ordinalSpawnY = reader.GetOrdinal(DbNames.MAP_SPAWNY);

            Map m = null;

            while (reader.Read())
            {
                m = new Map
                {
                    MapID = reader.GetInt32(ordinalId),
                    Name = reader.GetString(ordinalName),
                    MultiplyValue = reader.GetInt32(ordinalMultiplyValue),
                    SpawnX = reader.GetInt32(ordinalSpawnX),
                    SpawnY = reader.GetInt32(ordinalSpawnY)
                };
            }

            reader.Close();
            _db.Close();

            m.Portals = portalManager.GetPortalsByMapId(mapId);
            m.Npcs = npcManager.GetNpcsByMapId(mapId);

            return m;
        }
示例#5
0
 monsterManager = new MonsterManager(conString, providerName);
        }

        public Map[] GetAllMaps()
        {
            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLMAPS_STOREDPROC, System.Data.CommandType.StoredProcedure, null);

            int ordinalId = reader.GetOrdinal(DbNames.MAP_ID);
            int ordinalName = reader.GetOrdinal(DbNames.MAP_NAME);
            int ordinalMultiplyValue = reader.GetOrdinal(DbNames.MAP_MULTIPLYVALUE);
            int ordinalSpawnX = reader.GetOrdinal(DbNames.MAP_SPAWNX);
            int ordinalSpawnY = reader.GetOrdinal(DbNames.MAP_SPAWNY);

            List<Map> maps = new List<Map>();

            while (reader.Read())
            {
                Map m = new Map()
                {
                    MapID = reader.GetInt32(ordinalId),
                    Name = reader.GetString(ordinalName),
                    MultiplyValue = reader.GetInt32(ordinalMultiplyValue),
                    SpawnX = reader.GetInt32(ordinalSpawnX),
                    SpawnY = reader.GetInt32(ordinalSpawnY)
                };

                maps.Add(m);
            }

            reader.Close();
            _db.Close();

            foreach (Map map in maps)
            {
                map.Portals = portalManager.GetPortalsByMapId(map.MapID);
                map.Npcs = npcManager.GetNpcsByMapId(map.MapID);
     map.Monsters = monsterManager.GetMonstersByMapId(map.MapID);
     if (map.MapID != 9 && map.MapID != 10 && map.MapID != 13 && map.MapID != 14) // maps we dont have maskes for yet..
         map.WalkableTiles = GetWalkableTiles(map.Name);
            }
            

            return maps.ToArray();
        }

        public Map GetMapById(int mapId)
        {
            DbParameter mapIdParameter = _db.CreateParameter(DbNames.GETMAPBYID_ID_PARAMETER, mapId);

            mapIdParameter.DbType = System.Data.DbType.Int32;

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETMAPBYID_STOREDPROC, System.Data.CommandType.StoredProcedure, mapIdParameter);

            int ordinalId = reader.GetOrdinal(DbNames.MAP_ID);
            int ordinalName = reader.GetOrdinal(DbNames.MAP_NAME);
            int ordinalMultiplyValue = reader.GetOrdinal(DbNames.MAP_MULTIPLYVALUE);
            int ordinalSpawnX = reader.GetOrdinal(DbNames.MAP_SPAWNX);
            int ordinalSpawnY = reader.GetOrdinal(DbNames.MAP_SPAWNY);

            Map m = null;

            while (reader.Read())
            {
                m = new Map
                {
                    MapID = reader.GetInt32(ordinalId),
                    Name = reader.GetString(ordinalName),
                    MultiplyValue = reader.GetInt32(ordinalMultiplyValue),
                    SpawnX = reader.GetInt32(ordinalSpawnX),
                    SpawnY = reader.GetInt32(ordinalSpawnY)
                };
            }

            reader.Close();
            _db.Close();

            m.Portals = portalManager.GetPortalsByMapId(mapId);
            m.Npcs = npcManager.GetNpcsByMapId(mapId);

            return m;
        }
示例#6
0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
using System.Data.Common;

namespace XiahBLL
{
    public class MapManager : ManagerBase
    {
        PortalManager portalManager;
        NpcManager npcManager;

        public MapManager(string conString, string providerName)
            : base(conString, providerName)
        {
            portalManager = new PortalManager(conString, providerName);
            npcManager = new NpcManager(conString, providerName);
        }

        public Map[] GetAllMaps()
        {
            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETALLMAPS_STOREDPROC, System.Data.CommandType.StoredProcedure, null);

            int ordinalId = reader.GetOrdinal(DbNames.MAP_ID);
            int ordinalName = reader.GetOrdinal(DbNames.MAP_NAME);
            int ordinalMultiplyValue = reader.GetOrdinal(DbNames.MAP_MULTIPLYVALUE);
            int ordinalSpawnX = reader.GetOrdinal(DbNames.MAP_SPAWNX);
            int ordinalSpawnY = reader.GetOrdinal(DbNames.MAP_SPAWNY);

            List<Map> maps = new List<Map>();

            while (reader.Read())
            {
                Map m = new Map()
                {
                    MapID = reader.GetInt32(ordinalId),
                    Name = reader.GetString(ordinalName),
                    MultiplyValue = reader.GetInt32(ordinalMultiplyValue),
                    SpawnX = reader.GetInt32(ordinalSpawnX),
                    SpawnY = reader.GetInt32(ordinalSpawnY)
                };

                maps.Add(m);
            }

            reader.Close();
            _db.Close();

            foreach (Map map in maps)
            {
                map.Portals = portalManager.GetPortalsByMapId(map.MapID);
                map.Npcs = npcManager.GetNpcsByMapId(map.MapID);
            }
            

            return maps.ToArray();
        }

        public Map GetMapById(int mapId)
        {
            DbParameter mapIdParameter = _db.CreateParameter(DbNames.GETMAPBYID_ID_PARAMETER, mapId);

            mapIdParameter.DbType = System.Data.DbType.Int32;

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETMAPBYID_STOREDPROC, System.Data.CommandType.StoredProcedure, mapIdParameter);

            int ordinalId = reader.GetOrdinal(DbNames.MAP_ID);
            int ordinalName = reader.GetOrdinal(DbNames.MAP_NAME);
            int ordinalMultiplyValue = reader.GetOrdinal(DbNames.MAP_MULTIPLYVALUE);
            int ordinalSpawnX = reader.GetOrdinal(DbNames.MAP_SPAWNX);
            int ordinalSpawnY = reader.GetOrdinal(DbNames.MAP_SPAWNY);

            Map m = null;

            while (reader.Read())
            {
                m = new Map
                {
                    MapID = reader.GetInt32(ordinalId),
                    Name = reader.GetString(ordinalName),
                    MultiplyValue = reader.GetInt32(ordinalMultiplyValue),
                    SpawnX = reader.GetInt32(ordinalSpawnX),
                    SpawnY = reader.GetInt32(ordinalSpawnY)
                };
            }

            reader.Close();
            _db.Close();

            m.Portals = portalManager.GetPortalsByMapId(mapId);
            m.Npcs = npcManager.GetNpcsByMapId(mapId);

            return m;
        }

        

        

        
        
    }
}