public void SendRoomKill(int roomID, ulong ownerID) { if (killedRooms.Contains(roomID)) { return; } if (activatedRooms.Contains(roomID)) { activatedRooms.Remove(roomID); } MonklandSteamManager.DataPacket dataPacket = MonklandSteamManager.instance.GetNewPacket(GAMEMANAGEMENT_CHANNEL, RoomHandler); BinaryWriter writer = MonklandSteamManager.instance.GetWriterForPacket(dataPacket); //Writes the message type writer.Write(RoomKillID); //Send room ID that we want to activate writer.Write(roomID); writer.Write(ownerID); MonklandSteamManager.instance.FinalizeWriterToPacket(writer, dataPacket); MonklandSteamManager.instance.SendPacketToAll(dataPacket, false, EP2PSend.k_EP2PSendReliable); requestedActivateRooms.Add(roomID); MonklandUI.AddMessage("Sending killing of room " + roomID); Debug.Log("Sending killing of room " + roomID); killedRooms.Add(roomID); }
public static void Log(object message) { if (DEBUG) { if (MonklandSteamManager.GameManager != null && MonklandSteamManager.isInGame) { MonklandUI.AddMessage(message.ToString()); } Debug.Log("[MONKLAND] " + message.ToString()); Debug.LogError("[MONKLAND] " + message.ToString()); } }
public void SendRoomKillRequest(AbstractRoom absRoom) { if (requestedKillRooms.Contains(absRoom.index)) { return; } MonklandSteamManager.DataPacket dataPacket = MonklandSteamManager.instance.GetNewPacket(GAMEMANAGEMENT_CHANNEL, RoomHandler); BinaryWriter writer = MonklandSteamManager.instance.GetWriterForPacket(dataPacket); //Writes the message type writer.Write(RoomKillRequestID); //Send room ID that we want to activate writer.Write(absRoom.index); MonklandSteamManager.instance.FinalizeWriterToPacket(writer, dataPacket); MonklandSteamManager.instance.SendPacket(dataPacket, (CSteamID)NetworkGameManager.managerID, EP2PSend.k_EP2PSendReliable); requestedKillRooms.Add(absRoom.index); MonklandUI.AddMessage("Requested realization of room " + absRoom.index); Debug.Log("Requested killing of room " + absRoom.index); }
public void RoomKillMessage(BinaryReader reader, CSteamID sentPlayer, bool isRequest) { if (isRequest) { if (NetworkGameManager.isManager) { int roomID = reader.ReadInt32(); if (!killRequests.ContainsKey(roomID)) { killRequests[roomID] = new List <ulong>(); } MonklandUI.AddMessage("Recieved Request to kill room " + roomID); killRequests[roomID].Add(sentPlayer.m_SteamID); } } else { int roomId = reader.ReadInt32(); ulong ownerID = reader.ReadUInt64(); if (requestedActivateRooms.Contains(roomId)) { requestedActivateRooms.Remove(roomId); } patch_World world = patch_RainWorldGame.mainGame.world as patch_World; patch_RoomRealizer realizer = patch_RainWorldGame.mainGame.roomRealizer as patch_RoomRealizer; patch_AbstractRoom room = world.GetAbstractRoom(roomId) as patch_AbstractRoom; room.ownerID = ownerID; realizer.RemoteKill(room); MonklandUI.AddMessage("Killed room " + roomId); } }
private void ReadViolence(BinaryReader br, CSteamID sentPlayer) { // Message type // Damage type Creature.DamageType type = (Creature.DamageType)br.ReadByte(); // Lethal bool lethal = br.ReadBoolean(); // Source Template CreatureTemplate.Type sourceTemplate = (CreatureTemplate.Type)br.ReadByte(); // Source ID ulong sourceID = (ulong)br.ReadUInt64(); if (lethal) { string message = MonklandUI.BuildDeathMessage(sentPlayer, type, sourceTemplate, sourceID); Debug.Log(message); MonklandUI.AddMessage(message, 10); } MonklandSteamManager.Log($"[GameMNG] Reading Player Violence: Damage type {type}, Source Template {sourceTemplate}, Source ID {sourceID}"); }