public MonsterLevelData(MonsterLevelData newMonsterLevelData) { level = newMonsterLevelData.Level; attack = newMonsterLevelData.Attack; defense = newMonsterLevelData.Defense; healthPoint = newMonsterLevelData.HealthPoint; moveSpeed = newMonsterLevelData.MoveSpeed; }
public bool AddLevelData(MonsterLevelData newMonsterLevelData) { try { monsterLevelData.Add(newMonsterLevelData); return(true); } catch { return(false); } }
//몬스터 스텟 데이터 요청 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); } }