Exemplo n.º 1
0
        //
        // GameEncounterPoint
        //
        public EncounterPoint(World world, GameClient client, Type monsterType, int numMonsters, Vector3D position)
        {
            ObjectIdsSpawned = new List<Monster>();
            _client = client;

            numMonsters += RandomHelper.Next(3);

            for (int i = 0; i < numMonsters; i++)
            {
                // Allocate the monster with the world.
                Monster monster = (Monster)world.SpawnNPC(monsterType);

                // Random spawn offset.
                float xpos = (float)(RandomHelper.NextDouble() * 20);
                float ypos = (float)(RandomHelper.NextDouble() * 20);
                
                // Init the monster and set the position with the randomized coordinates.
                monster.Init(_client.GetNextValidObjectID(), ref client);
                monster.SetPosition(position.Field0 + xpos, position.Field1 + ypos, position.Field2);

                // Spawn the monster.
                world.SpawnMob(client, monster.Position, monster);

                System.Threading.Thread.Sleep(15); // Required to not generate the same random value twice...

                ObjectIdsSpawned.Add(monster);
            }
        }
Exemplo n.º 2
0
        World GetWorld(int WorldID)
        {
            for (int x = 0; x < Worlds.Count; x++)
                if (Worlds[x].WorldID == WorldID) return Worlds[x];

            World w = new World(WorldID);
            Worlds.Add(w);
            return w;
        }
Exemplo n.º 3
0
        public World GetWorld(int WorldID)
        {
            for (int x = 0; x < _worlds.Count; x++)
                if (_worlds[x].WorldID == WorldID) return _worlds[x];

            var world = new World(WorldID);
            _worlds.Add(world);
            return world;
        }       
Exemplo n.º 4
0
 public GameClient(IConnection connection)
 {
     this.Connection = connection;
     _outgoingBuffer.WriteInt(32, 0);
     GameWorld = new World(this);
 }