diff --git a/game/engines/default/engine/Module.lua b/game/engines/default/engine/Module.lua index d376b8413c90a17ad2ba3f6511aeaa5693d25816..c62ad1020734f64bb11129aa2995198f6c259dcf 100644 --- a/game/engines/default/engine/Module.lua +++ b/game/engines/default/engine/Module.lua @@ -272,6 +272,7 @@ function _M:instanciate(mod, name, new_game, no_reboot) -- Add user chat if needed if mod.allow_userchat and _G.game.key then profile.chat:setupOnGame() + profile.chat:join("global") profile.chat:join(mod.short_name) end diff --git a/game/engines/default/engine/UserChat.lua b/game/engines/default/engine/UserChat.lua index 62c11546078b2abbaf871b353781217ea7235180..5ed3c3b0acf5f7c3e56066709e7b9875f44cf3c2 100644 --- a/game/engines/default/engine/UserChat.lua +++ b/game/engines/default/engine/UserChat.lua @@ -54,9 +54,9 @@ function _M:setupOnGame() } end -function _M:addMessage(channel, user, msg) +function _M:addMessage(channel, login, name, msg) local log = self.channels[channel].log - table.insert(log, 1, {user=user, msg=msg}) + table.insert(log, 1, {login=login, name=name, msg=msg}) while #log > self.max do table.remove(log) end self.changed = true end @@ -66,18 +66,18 @@ function _M:event(e) e.msg = e.msg:removeColorCodes() self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} - self:addMessage(e.channel, e.user, e.msg) + self:addMessage(e.channel, e.login, e.name, e.msg) - if type(game) == "table" and game.log then game.log("#YELLOW#<%s> %s", e.user, e.msg) end + if type(game) == "table" and game.log then game.log("#YELLOW#<%s> %s", e.name, e.msg) end elseif e.se == "Join" then self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} - self.channels[e.channel].users[e.user] = {name=e.user} + self.channels[e.channel].users[e.login] = {name=e.name, login=e.login} self.channels_changed = true self:addMessage(e.channel, e.user, "#{italic}##FIREBRICK#has joined the channel#{normal}#") if type(game) == "table" and game.log and e.channel == self.cur_channel then game.log("#{italic}##FIREBRICK#%s has joined channel %s (press space to talk).#{normal}#", e.user, e.channel) end elseif e.se == "Part" then self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} - self.channels[e.channel].users[e.user] = nil + self.channels[e.channel].users[e.login] = nil self.channels_changed = true self:addMessage(e.channel, e.user, "#{italic}##FIREBRICK#has left the channel#{normal}#") if type(game) == "table" and game.log and e.channel == self.cur_channel then game.log("#{italic}##FIREBRICK#%s has left channel %s.#{normal}#", e.user, e.channel) end @@ -89,7 +89,8 @@ function _M:event(e) if not info then return end self.channels[e.channel].users = {} for _, user in ipairs(info.users) do - self.channels[e.channel].users[user.name] = { + self.channels[e.channel].users[user.login] = { + login=user.login, name=user.name, cur_char=user.cur_char and user.cur_char.title or "unknown", module=user.cur_char and user.cur_char.module or "unknown", @@ -211,8 +212,8 @@ function _M:resize(x, y, w, h, fontname, fontsize, color, bgcolor) local item = self.dlist[i] if item.dh and y >= item.dh - self.mouse.delegate_offset_y then citem = item break end end - if citem and citem.user and self.channels[self.cur_channel].users[citem.user] then - self.on_mouse(self.channels[self.cur_channel].users[citem.user], button, event) + if citem and citem.login and self.channels[self.cur_channel].users[citem.login] then + self.on_mouse(self.channels[self.cur_channel].users[citem.login], button, event) end end end) @@ -265,10 +266,10 @@ function _M:display() local old_style = self.font:getStyle() for z = 1 + self.scroll, #log do local stop = false - local tstr = ("<%s> %s"):format(log[z].user, log[z].msg):toTString() + local tstr = ("<%s> %s"):format(log[z].name, log[z].msg):toTString() local gen = tstring.makeLineTextures(tstr, self.w, self.font_mono) for i = #gen, 1, -1 do - gen[i].user = log[z].user + gen[i].login = log[z].login self.dlist[#self.dlist+1] = gen[i] h = h + self.fh if h > self.h - self.fh - ls_h then stop=true break end diff --git a/game/engines/default/modules/boot/class/Game.lua b/game/engines/default/modules/boot/class/Game.lua index 06b67f5e49fb14133a8022383b4d3391ab3bda6f..fc608acf40c4af4b4c6e1ae271863fe929288ea8 100644 --- a/game/engines/default/modules/boot/class/Game.lua +++ b/game/engines/default/modules/boot/class/Game.lua @@ -325,7 +325,7 @@ function _M:checkFirstTime() end function _M:createProfile(loginItem) - if loginItem.justlogin then + if not loginItem.create then self.auth_tried = nil profile:performlogin(loginItem.login, loginItem.pass) profile:waitFirstAuth() diff --git a/game/engines/default/modules/boot/dialogs/ProfileLogin.lua b/game/engines/default/modules/boot/dialogs/ProfileLogin.lua index 686b9741ad115da126ebdd920183f672832055a3..a84ff853b28355529deb4b19ac76d37c0bca9c06 100644 --- a/game/engines/default/modules/boot/dialogs/ProfileLogin.lua +++ b/game/engines/default/modules/boot/dialogs/ProfileLogin.lua @@ -104,7 +104,7 @@ function _M:okclick() end game:unregisterDialog(self) - game:createProfile({justlogin=self.c_email and false or true, login=self.c_login.text, pass=self.c_pass.text, email=self.c_email and self.c_email.text}) + game:createProfile({create=self.c_email and true or false, login=self.c_login.text, pass=self.c_pass.text, email=self.c_email and self.c_email.text}) end function _M:cancelclick() diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index e4af4217b3295539d805ec7e57b3c5cf6b080cbc..b0743c3688b4c0482562c6800c6c473ba51b823a 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -865,7 +865,8 @@ function _M:setupCommands() end end, [{"_g","ctrl"}] = function() if config.settings.cheat then -- self.nicer_tiles:postProcessLevelTiles(self.level) - game:registerDialog(require("mod.dialogs.Donation").new()) +-- game:registerDialog(require("mod.dialogs.Donation").new()) + error("plop") end end, } diff --git a/game/profile-thread/Client.lua b/game/profile-thread/Client.lua index 895baa1c73eea885a6264cacad2fec8001b75bd0..7f6be97c812856bc6609f3324f544170d4d7461d 100644 --- a/game/profile-thread/Client.lua +++ b/game/profile-thread/Client.lua @@ -29,7 +29,7 @@ end function _M:connected() if self.sock then return true end - self.sock = socket.connect("te4.org", 2259) + self.sock = socket.connect("te4.org", 2257) if not self.sock then return false end -- self.sock:settimeout(10) print("[PROFILE] Thread connected to te4.org") @@ -40,7 +40,7 @@ end --- Connects the second tcp channel to receive data function _M:connectedPull() if self.psock then return true end - self.psock = socket.connect("te4.org", 2260) + self.psock = socket.connect("te4.org", 2258) if not self.psock then return false end -- self.psock:settimeout(10) print("[PROFILE] Pull socket connected to te4.org") diff --git a/game/profile-thread/UserChat.lua b/game/profile-thread/UserChat.lua index b7a099fd553145b5ffd6cc341a73a0e7c6215566..55531850a93242fda0f19999a95cd3a22336763e 100644 --- a/game/profile-thread/UserChat.lua +++ b/game/profile-thread/UserChat.lua @@ -29,17 +29,17 @@ end function _M:event(e) if e.e == "ChatTalk" then - cprofile.pushEvent(string.format("e='Chat' se='Talk' channel=%q user=%q msg=%q", e.channel, e.user, e.msg)) + cprofile.pushEvent(string.format("e='Chat' se='Talk' channel=%q login=%q name=%q msg=%q", e.channel, e.login, e.name, e.msg)) print("[USERCHAT] channel talk", e.user, e.channel, e.msg) elseif e.e == "ChatJoin" then self.channels[e.channel] = self.channels[e.channel] or {} self.channels[e.channel][e.user] = true - cprofile.pushEvent(string.format("e='Chat' se='Join' channel=%q user=%q", e.channel, e.user)) + cprofile.pushEvent(string.format("e='Chat' se='Join' channel=%q login=%q name=%q ", e.channel, e.login, e.name)) print("[USERCHAT] channel join", e.user, e.channel) elseif e.e == "ChatPart" then self.channels[e.channel] = self.channels[e.channel] or {} self.channels[e.channel][e.user] = nil - cprofile.pushEvent(string.format("e='Chat' se='Part' channel=%q user=%q", e.channel, e.user)) + cprofile.pushEvent(string.format("e='Chat' se='Part' channel=%q login=%q name=%q ", e.channel, e.login, e.name)) print("[USERCHAT] channel part", e.user, e.channel) end end