From 0a979b69a261846bc858fd9f437e497a88a8cb25 Mon Sep 17 00:00:00 2001 From: Manuel Blanc Date: Tue, 24 Nov 2020 10:05:21 +0100 Subject: [PATCH] [Network] Update module for patch 3.4 --- .luacheckrc | 1 + vmf/scripts/mods/vmf/modules/core/chat.lua | 15 +++++---------- vmf/scripts/mods/vmf/modules/core/network.lua | 8 +++----- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index b21b60b..cfd0416 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -417,5 +417,6 @@ stds["VT1"] = { stds["VT2"] = { read_globals = { "IngameViewLayoutLogic", "HeroWindowIngameView", + "PEER_ID_TO_CHANNEL", "CHANNEL_TO_PEER_ID", "Irc", }, } diff --git a/vmf/scripts/mods/vmf/modules/core/chat.lua b/vmf/scripts/mods/vmf/modules/core/chat.lua index ba9d72f..3d5e4ae 100644 --- a/vmf/scripts/mods/vmf/modules/core/chat.lua +++ b/vmf/scripts/mods/vmf/modules/core/chat.lua @@ -21,11 +21,9 @@ local function send_system_message(peer_id, message) RPC.rpc_chat_message(peer_id, CHANNEL_ID, MESSAGE_SENDER, message, LOCALIZATION_PARAM, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV) else - local major_version, minor_version = VersionSettings.version:match("^(%d+)%.(%d+)") - if major_version == 3 and minor_version < 4 then - RPC.rpc_chat_message(peer_id, CHANNEL_ID, MESSAGE_SENDER, LOCAL_PLAYER_ID, message, LOCALIZATION_PARAMETERS, - LOCALIZE, LOCALIZE_PARAMETERS, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV) - end + RPC.rpc_chat_message(PEER_ID_TO_CHANNEL[peer_id], CHANNEL_ID, MESSAGE_SENDER, LOCAL_PLAYER_ID, message, + LOCALIZATION_PARAMETERS, LOCALIZE, LOCALIZE_PARAMETERS, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV, + Irc.PARTY_MSG) end end @@ -33,11 +31,8 @@ local function add_system_message_to_chat(chat_manager, message) if VT1 then chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, message, IS_SYSTEM_MESSAGE, POP_CHAT, IS_DEV) else - local major_version, minor_version = VersionSettings.version:match("^(%d+)%.(%d+)") - if major_version == 3 and minor_version < 4 then - chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, LOCAL_PLAYER_ID, message, IS_SYSTEM_MESSAGE, POP_CHAT, - IS_DEV) - end + chat_manager:_add_message_to_list(CHANNEL_ID, MESSAGE_SENDER, LOCAL_PLAYER_ID, message, IS_SYSTEM_MESSAGE, POP_CHAT, + IS_DEV) end end diff --git a/vmf/scripts/mods/vmf/modules/core/network.lua b/vmf/scripts/mods/vmf/modules/core/network.lua index 3f23da8..be6bfda 100644 --- a/vmf/scripts/mods/vmf/modules/core/network.lua +++ b/vmf/scripts/mods/vmf/modules/core/network.lua @@ -137,11 +137,8 @@ local function rpc_chat_message(member, channel_id, message_sender, message, loc RPC.rpc_chat_message(member, channel_id, message_sender, message, localization_param, is_system_message, pop_chat, is_dev) else - local major_version, minor_version = VersionSettings.version:match("^(%d+)%.(%d+)") - if major_version == 3 and minor_version < 4 then - RPC.rpc_chat_message(member, channel_id, message_sender, 0, message, {localization_param}, false, false, - is_system_message, pop_chat, is_dev) - end + RPC.rpc_chat_message(PEER_ID_TO_CHANNEL[member], channel_id, message_sender, 0, message, {localization_param}, + false, false, is_system_message, pop_chat, is_dev, 0) end end @@ -247,6 +244,7 @@ vmf:hook("ChatManager", "rpc_chat_message", if channel_id == VERMINTIDE_CHANNEL_ID then func(self, sender, channel_id, message_sender, arg1, arg2, arg3, ...) else + sender = CHANNEL_TO_PEER_ID[sender] if not _network_module_is_initialized then return