Пример #1
0
    //몬스터 스텟 데이터 요청
    public void RequestMonsterStatusData(DataPacket packet)
    {
        Console.WriteLine(packet.client.RemoteEndPoint.ToString() + "몬스터 스텟 데이터 요청");

        RequestDungeonDataPacket requestDungeonDataPacket = new RequestDungeonDataPacket(packet.msg);
        RequestDungeonData       requestDungeonData       = requestDungeonDataPacket.GetData();

        DungeonLevelData dungeonLevelData = dungeonDatabase.GetDungeonBaseData(requestDungeonData.DungeonId).GetLevelData(requestDungeonData.DungeonLevel);

        int monsterNum = dungeonLevelData.GetMonsterNum();

        MonsterBaseData[] monsterBaseData = new MonsterBaseData[monsterNum];
        int dataIndex = 0;

        for (int stageIndex = 0; stageIndex < dungeonLevelData.Stages.Count; stageIndex++)
        {
            for (int monsterIndex = 0; monsterIndex < dungeonLevelData.Stages[stageIndex].MonsterSpawnData.Count; monsterIndex++)
            {
                int monsterId    = dungeonLevelData.Stages[stageIndex].MonsterSpawnData[monsterIndex].MonsterId;
                int monsterLevel = dungeonLevelData.Stages[stageIndex].MonsterSpawnData[monsterIndex].MonsterLevel;

                monsterBaseData[dataIndex] = new MonsterBaseData(monsterDatabase.GetBaseData(monsterId));
                MonsterLevelData monsterLevelData = new MonsterLevelData(monsterDatabase.GetBaseData(monsterId).GetLevelData(monsterLevel));
                monsterBaseData[dataIndex].MonsterLevelData.Clear();
                monsterBaseData[dataIndex].AddLevelData(monsterLevelData);
                dataIndex++;
            }
        }

        MonsterStatusData   monsterStatusData   = new MonsterStatusData((byte)monsterNum, monsterBaseData);
        MonsterStatusPacket monsterStatusPacket = new MonsterStatusPacket(monsterStatusData);

        monsterStatusPacket.SetPacketId((int)ServerPacketId.MonsterStatusData);

        byte[] msg = CreatePacket(monsterStatusPacket);

        packet = new DataPacket(msg, packet.client);

        lock (sendLock)
        {
            sendMsgs.Enqueue(packet);
        }
    }
Пример #2
0
    //몬스터 소환 리스트 요청
    public void RequestMonsterSpawnList(DataPacket packet)
    {
        Console.WriteLine(packet.client.RemoteEndPoint.ToString() + "몬스터 소환 리스트 요청");

        RequestDungeonDataPacket requestDungeonDataPacket = new RequestDungeonDataPacket(packet.msg);
        RequestDungeonData       requestDungeonData       = requestDungeonDataPacket.GetData();

        DungeonLevelData dungeonLevelData = dungeonDatabase.GetDungeonBaseData(requestDungeonData.DungeonId).GetLevelData(requestDungeonData.DungeonLevel);

        MonsterSpawnListPacket monsterSpawnListPacket = new MonsterSpawnListPacket(dungeonLevelData);

        monsterSpawnListPacket.SetPacketId((int)ServerPacketId.MonsterSpawnList);

        byte[] msg = CreatePacket(monsterSpawnListPacket);

        packet = new DataPacket(msg, packet.client);

        lock (sendLock)
        {
            sendMsgs.Enqueue(packet);
        }
    }