diff --git a/game/engines/default/engine/UserChat.lua b/game/engines/default/engine/UserChat.lua index 87728b970526a46a61145a1a9c7fc37a987099a9..7f61e3c9bfecb1e5e78c82d0503421a2e56c170c 100644 --- a/game/engines/default/engine/UserChat.lua +++ b/game/engines/default/engine/UserChat.lua @@ -114,6 +114,7 @@ local urlfind = (lpeg.P"http://" + lpeg.P"https://") * (1-lpeg.P" ")^0 local urlmatch = lpeg.anywhere(lpeg.C(urlfind)) function _M:addMessage(kind, channel, login, name, msg, extra_data, no_change) + if not self.channels[channel] then return end local color_name = colors.WHITE if type(name) == "table" then name, color_name = name[1], name[2] end @@ -202,11 +203,22 @@ function _M:event(e) elseif e.donator == "oneshot" then color = colors.LIGHT_GREEN elseif e.donator == "recurring" then color = colors.ROYAL_BLUE end + local kind = "achievement_other" + if e.first then kind = "achievement_first" + elseif e.huge then kind = "achievement_huge" + end + + local acolor = "LIGHT_BLUE" + if e.huge then acolor = "GOLD" end + + local first = "" + if e.first then first = " for the #FIREBRICK#first time!" end + self.channels[e.channel] = self.channels[e.channel] or {users={}, log={}} - self:addMessage("achievement", e.channel, e.login, {e.name, color}, "#{italic}##LIGHT_BLUE#has earned the achievement <"..e.msg..">#{normal}#", nil, true) + self:addMessage(kind, e.channel, e.login, {e.name, color}, "#{italic}##"..acolor.."#has earned the achievement <"..e.msg..">"..first.."#{normal}#", nil, true) if type(game) == "table" and game.logChat and self.cur_channel == e.channel then - game.logChat("#LIGHT_BLUE#%s has earned the achievement <%s>", e.name, e.msg) + game.logChat("#"..acolor.."#%s has earned the achievement <%s>%s", e.name, e.msg, first) end elseif e.se == "SerialData" then local color = colors.WHITE @@ -351,9 +363,9 @@ function _M:reportUser(to, msg) if type(game) == "table" and game.logChat then game.logChat("#VIOLET#Report for %s sent.#LAST#", to) end end -function _M:achievement(name) +function _M:achievement(name, huge, first) if not profile.auth then return end - core.profile.pushOrder(string.format("o='ChatAchievement' channel=%q msg=%q", self.cur_channel, name)) + core.profile.pushOrder(string.format("o='ChatAchievement' channel=%q msg=%q huge=%s first=%s", self.cur_channel, name, tostring(huge), tostring(first))) end --- Request a line to send diff --git a/game/engines/default/engine/dialogs/ChatFilter.lua b/game/engines/default/engine/dialogs/ChatFilter.lua index 9335101ad06b37e61c7e89cebb202ffdf89736b3..cf4a75724bef90590c1d8a060bff8f6a9f12d878 100644 --- a/game/engines/default/engine/dialogs/ChatFilter.lua +++ b/game/engines/default/engine/dialogs/ChatFilter.lua @@ -31,7 +31,9 @@ function _M:init(adds) {name = "Public chat", kind = "talk"}, {name = "Private whispers", kind = "whisper"}, {name = "Join/part messages", kind = "join"}, - {name = "Achievements", kind = "achievement"}, + {name = "First time achievements (recommanded to keep them on)", kind = "achievement_first"}, + {name = "Important achievements (recommanded to keep them on)", kind = "achievement_huge"}, + {name = "Other achievements", kind = "achievement_other"}, } for i, l in ipairs(adds or {}) do list[#list+1] = l end diff --git a/game/engines/default/engine/interface/WorldAchievements.lua b/game/engines/default/engine/interface/WorldAchievements.lua index c116a6baa23836cf0f6ed9c198df8d3b7ab5bbad..bcb07fb1e70b722d4c80853bcfe7c7f43cb042a3 100644 --- a/game/engines/default/engine/interface/WorldAchievements.lua +++ b/game/engines/default/engine/interface/WorldAchievements.lua @@ -90,9 +90,10 @@ function _M:gainPersonalAchievement(silent, id, src, ...) src.achievements[id] = {turn=game.turn, who=self:achievementWho(src), when=os.date("%Y-%m-%d %H:%M:%S")} if not silent then - game.log("#LIGHT_GREEN#Personal New Achievement: %s!", a.name) - self:showAchievement("Personal New Achievement: #LIGHT_GREEN#"..a.name, a) - profile.chat:achievement(a.name) + local color = a.huge and "GOLD" or "LIGHT_GREEN" + game.log("#"..color.."#Personal New Achievement: %s!", a.name) + self:showAchievement("Personal New Achievement: #"..color.."#"..a.name, a) + profile.chat:achievement(a.name, a.huge, false) end if a.on_gain then a:on_gain(src, true) end return true @@ -131,9 +132,10 @@ function _M:gainAchievement(id, src, ...) self.achieved[id] = {turn=game.turn, who=self:achievementWho(src), when=os.date("%Y-%m-%d %H:%M:%S")} profile:saveModuleProfile("achievements", {id=id, turn=game.turn, who=self:achievementWho(src), gained_on=os.date("%Y-%m-%d %H:%M:%S")}) - game.log("#LIGHT_GREEN#New Achievement: %s!", a.name) - self:showAchievement("New Achievement: #LIGHT_GREEN#"..a.name, a) - profile.chat:achievement(a.name) + local color = a.huge and "GOLD" or "LIGHT_GREEN" + game.log("#"..color.."#New Achievement: %s!", a.name) + self:showAchievement("New Achievement: #"..color.."#"..a.name, a) + profile.chat:achievement(a.name, a.huge, true) if a.on_gain then a:on_gain(src) end return true @@ -142,7 +144,8 @@ end --- Show an achievement gain dialog function _M:showAchievement(title, a) if not config.settings.cheat then - game:registerDialog(Achievement.new("New Achievement: #LIGHT_GREEN#"..a.name, a)) + local color = a.huge and "GOLD" or "LIGHT_GREEN" + game:registerDialog(Achievement.new("New Achievement: #"..color.."#"..a.name, a)) end end diff --git a/game/modules/tome/data/achievements/arena.lua b/game/modules/tome/data/achievements/arena.lua index efb7aee942538ebf0379b6135494ceea8ee09c07..2135504f1973b61f48ddabd996ba9d852e9242b0 100644 --- a/game/modules/tome/data/achievements/arena.lua +++ b/game/modules/tome/data/achievements/arena.lua @@ -37,13 +37,13 @@ newAchievement{ newAchievement{ name = "Almost Master of Arena", - show = "full", + show = "full", huge=true, desc = [[Became the new master of the arena in 30-wave mode.]], } newAchievement{ name = "Master of Arena", - show = "full", + show = "full", huge=true, desc = [[Became the new master of the arena in 60-wave mode.]], } diff --git a/game/modules/tome/data/achievements/events.lua b/game/modules/tome/data/achievements/events.lua index c3ab65e5d358e6458f7723f19c5f6e8aed7195c3..6090e1d066ea90906f18ac1d04122867918fadfb 100644 --- a/game/modules/tome/data/achievements/events.lua +++ b/game/modules/tome/data/achievements/events.lua @@ -43,7 +43,7 @@ newAchievement{ newAchievement{ name = "The Rat Lich", id = "EVENT_RATLICH", - show = "name", + show = "name", huge=true, desc = [[Killed the terrible Rat Lich.]], } @@ -61,6 +61,6 @@ newAchievement{ newAchievement{ name = "A living one!", id = "CALDIZAR", - show = "name", + show = "name", huge=true, desc = [[Was teleported into Caldizar's Fortress, far into the void between the stars.]], } diff --git a/game/modules/tome/data/achievements/infinite-dungeon.lua b/game/modules/tome/data/achievements/infinite-dungeon.lua index efb6873ee9a87cd37ba95d4e28f78d52f8a1ed1c..9d3e66833e95ebdcfd3a0cf1da16ab9a9f5d017c 100644 --- a/game/modules/tome/data/achievements/infinite-dungeon.lua +++ b/game/modules/tome/data/achievements/infinite-dungeon.lua @@ -64,31 +64,31 @@ newAchievement{ } newAchievement{ name = "Infinite x100", - show = "full", + show = "full", huge=true, desc = [[Got to level 100 of the infinite dungeon.]], } newAchievement{ name = "Infinite x150", - show = "full", + show = "full", huge=true, desc = [[Got to level 150 of the infinite dungeon.]], } newAchievement{ name = "Infinite x200", - show = "full", + show = "full", huge=true, desc = [[Got to level 200 of the infinite dungeon.]], } newAchievement{ name = "Infinite x300", - show = "full", + show = "full", huge=true, desc = [[Got to level 300 of the infinite dungeon.]], } newAchievement{ name = "Infinite x400", - show = "full", + show = "full", huge=true, desc = [[Got to level 400 of the infinite dungeon.]], } newAchievement{ name = "Infinite x500", - show = "full", + show = "full", huge=true, desc = [[Got to level 500 of the infinite dungeon.]], } diff --git a/game/modules/tome/data/achievements/items.lua b/game/modules/tome/data/achievements/items.lua index 559d91ecc3ccee4ce554d593ba7b7dbd9410ddf0..db566ba611ede1eead0b46ee1768ffe3d4ed6263 100644 --- a/game/modules/tome/data/achievements/items.lua +++ b/game/modules/tome/data/achievements/items.lua @@ -51,7 +51,7 @@ newAchievement{ newAchievement{ id = "DRAGON_GREED", name = "Dragon's Greed", image = "object/money_large.png", - show = "name", + show = "name", huge=true, desc = [[Amassed 8000 gold pieces.]], can_gain = function(self, who) return who.money >= 8000 diff --git a/game/modules/tome/data/achievements/kills.lua b/game/modules/tome/data/achievements/kills.lua index 801eb9e276ba186e0f099aeb1f424e1ae398bd74..2c10b76e5a5c51564259b9dd13b09860772de734 100644 --- a/game/modules/tome/data/achievements/kills.lua +++ b/game/modules/tome/data/achievements/kills.lua @@ -19,7 +19,7 @@ newAchievement{ name = "That was close", - show = "full", + show = "full", huge=true, desc = [[Killed your target while having only 1 life left.]], } newAchievement{ @@ -34,17 +34,17 @@ newAchievement{ } newAchievement{ name = "Size is everything", id = "DAMAGE_1500", - show = "full", + show = "full", huge=true, desc = [[Did over 1500 damage in one attack.]], } newAchievement{ name = "The bigger the better!", id = "DAMAGE_3000", - show = "full", + show = "full", huge=true, desc = [[Did over 3000 damage in one attack.]], } newAchievement{ name = "Overpowered!", id = "DAMAGE_6000", - show = "full", + show = "full", huge=true, desc = [[Did over 6000 damage in one attack.]], } newAchievement{ @@ -137,7 +137,7 @@ newAchievement{ newAchievement{ name = "Kill Bill!", id = "KILL_BILL", image = "object/artifact/bill_treestump.png", - show = "full", + show = "full", huge=true, desc = [[Killed Bill in the Trollmire with a level one character.]], mode = "player", } @@ -145,7 +145,7 @@ newAchievement{ newAchievement{ name = "Atamathoned!", id = "ATAMATHON", image = "npc/atamathon.png", - show = "name", + show = "name", huge=true, desc = [[Killed the giant golem Atamathon after foolishly reactivating it.]], mode = "player", } @@ -165,7 +165,7 @@ newAchievement{ newAchievement{ name = "Headbanger", id = "HEADBANG", - show = "full", + show = "full", huge=true, desc = [[Headbanged 20 bosses to death.]], mode = "player", can_gain = function(self, who, target) @@ -179,7 +179,7 @@ newAchievement{ newAchievement{ name = "Are you out of your mind?!", id = "UBER_WYRMS_OPEN", image = "npc/dragon_multihued_multi_hued_drake.png", - show = "name", + show = "name", huge=true, desc = [[Caught the attention of overpowered greater multi-hued wyrms in Vor Armoury. Perhaps fleeing is in order.]], mode = "player", } @@ -187,7 +187,7 @@ newAchievement{ newAchievement{ name = "I cleared the room of death and all I got was this lousy achievement!", id = "UBER_WYRMS", image = "npc/dragon_multihued_multi_hued_drake.png", - show = "name", + show = "name", huge=true, desc = [[Killed the seven overpowered wyrms in the "Room of Death" in Vor Armoury.]], mode = "player", can_gain = function(self, who) @@ -199,7 +199,7 @@ newAchievement{ newAchievement{ name = "I'm a cool hero", id = "NO_DERTH_DEATH", image = "npc/humanoid_human_human_farmer.png", - show = "name", + show = "name", huge=true, desc = [[Saved Derth without a single inhabitant dying.]], mode = "player", } @@ -207,7 +207,7 @@ newAchievement{ newAchievement{ name = "Kickin' it old-school", id = "FIRST_BOSS_URKIS", image = "npc/humanoid_human_urkis__the_high_tempest.png", - show = "full", + show = "full", huge=true, desc = [[Killed Urkis, the Tempest, causing him to drop the Rod of Recall.]], mode = "player", } @@ -215,7 +215,7 @@ newAchievement{ newAchievement{ name = "Leave the big boys alone", id = "FIRST_BOSS_MASTER", image = "npc/the_master.png", - show = "full", + show = "full", huge=true, desc = [[Killed The Master, causing him to drop the Rod of Recall.]], mode = "player", } @@ -223,7 +223,7 @@ newAchievement{ newAchievement{ name = "You know who's to blame", id = "FIRST_BOSS_GRAND_CORRUPTOR", image = "npc/humanoid_shalore_grand_corruptor.png", - show = "full", + show = "full", huge=true, desc = [[Killed the Grand Corruptor, causing him to drop the Rod of Recall.]], mode = "player", } @@ -231,7 +231,7 @@ newAchievement{ newAchievement{ name = "You know who's to blame (reprise)", id = "FIRST_BOSS_MYSSIL", image = "npc/humanoid_halfling_protector_myssil.png", - show = "full", + show = "full", huge=true, desc = [[Killed Myssil, causing her to drop the Rod of Recall.]], mode = "player", } diff --git a/game/modules/tome/data/achievements/player.lua b/game/modules/tome/data/achievements/player.lua index 45da50bb2143a0bcc19f1380656a41b326ff35cf..d8f7b53b42f9ceb021221507b25e0fafbb244c03 100644 --- a/game/modules/tome/data/achievements/player.lua +++ b/game/modules/tome/data/achievements/player.lua @@ -34,12 +34,12 @@ newAchievement{ } newAchievement{ name = "Level 40", - show = "full", + show = "full", huge=true, desc = [[Got a character to level 40.]], } newAchievement{ name = "Level 50", - show = "full", + show = "full", huge=true, desc = [[Got a character to level 50.]], } @@ -67,7 +67,7 @@ newAchievement{ newAchievement{ name = "Emancipation", id = "EMANCIPATION", image = "npc/alchemist_golem.png", - show = "name", + show = "name", huge=true, desc = [[Had the golem kill a boss while its master was already dead.]], mode = "player", can_gain = function(self, who, target) @@ -84,7 +84,7 @@ newAchievement{ newAchievement{ name = "Take you with me", id = "BOSS_REVENGE", - show = "full", + show = "full", huge=true, desc = [[Killed a boss while already dead.]], mode = "player", can_gain = function(self, who, target) diff --git a/game/modules/tome/data/achievements/quests.lua b/game/modules/tome/data/achievements/quests.lua index 5b330e4d76cbfefb2d6834fea4679f27eb49a14f..cb4777e604029379cbaec0a6337b8106f5e6a68e 100644 --- a/game/modules/tome/data/achievements/quests.lua +++ b/game/modules/tome/data/achievements/quests.lua @@ -32,7 +32,7 @@ newAchievement{ newAchievement{ name = "Vampire crusher", image = "npc/the_master.png", - show = "name", + show = "name", huge=true, desc = [[Destroyed the Master in its lair of the Dreadfell.]], } newAchievement{ @@ -52,7 +52,7 @@ newAchievement{ } newAchievement{ name = "Against all odds", id = "KILL_UKRUK", - show = "name", + show = "name", huge=true, desc = [[Killed Ukruk in the ambush.]], } newAchievement{ @@ -88,47 +88,47 @@ newAchievement{ --------------- Wins newAchievement{ name = "Evil denied", id = "WIN_FULL", - show = "name", + show = "name", huge=true, desc = [[Won ToME by preventing the Void portal from opening.]], } newAchievement{ name = "The High Lady's destiny", id = "WIN_AERYN", - show = "name", + show = "name", huge=true, desc = [[Won ToME by closing the Void portal using Aeryn as a sacrifice.]], } newAchievement{ name = "Selfless", id = "WIN_SACRIFICE", - show = "name", + show = "name", huge=true, desc = [[Won ToME by closing the Void portal using yourself as a sacrifice.]], } newAchievement{ name = "Triumph of the Way", id = "YEEK_SACRIFICE", - show = "name", + show = "name", huge=true, desc = [[Won ToME by sacrificing yourself to forcefully spread the Way to every other sentient being on Eyal.]], } newAchievement{ name = "Tactical master", id = "SORCERER_NO_PORTAL", - show = "name", + show = "name", huge=true, desc = [[Fought the two Sorcerers without closing any invocation portals.]], } newAchievement{ name = "Portal destroyer", id = "SORCERER_ONE_PORTAL", - show = "name", + show = "name", huge=true, desc = [[Fought the two Sorcerers and closed one invocation portal.]], } newAchievement{ name = "Portal reaver", id = "SORCERER_TWO_PORTAL", - show = "name", + show = "name", huge=true, desc = [[Fought the two Sorcerers and closed two invocation portals.]], } newAchievement{ name = "Portal ender", id = "SORCERER_THREE_PORTAL", - show = "name", + show = "name", huge=true, desc = [[Fought the two Sorcerers and closed three invocation portals.]], } newAchievement{ name = "Portal master", id = "SORCERER_FOUR_PORTAL", - show = "name", + show = "name", huge=true, desc = [[Fought the two Sorcerers and closed four invocation portals.]], } @@ -160,7 +160,7 @@ newAchievement{ } newAchievement{ name = "Gem of the Moon", id = "MASTER_JEWELER", - show = "name", + show = "name", huge=true, desc = [[Completed the Master Jeweler quest with Limmir.]], } newAchievement{ @@ -190,12 +190,12 @@ newAchievement{ } newAchievement{ name = "There and back again", id = "WEST_PORTAL", - show = "name", + show = "name", huge=true, desc = [[Opened a portal to Maj'Eyal from the Far East.]], } newAchievement{ name = "Back and there again", id = "EAST_PORTAL", - show = "name", + show = "name", huge=true, desc = [[Opened a portal to the Far East from Maj'Eyal.]], } newAchievement{ @@ -220,7 +220,7 @@ newAchievement{ } newAchievement{ name = "Genocide", id = "GREATMOTHER_DEAD", - show = "name", + show = "name", huge=true, desc = [[Killed the Orc Greatmother in the breeding pits, thus dealing a terrible blow to the orc race.]], } newAchievement{ @@ -266,7 +266,7 @@ newAchievement{ } newAchievement{ name = "Matrix style!", id = "ABASHED_EXPANSE_NO_BLAST", - show = "full", + show = "full", huge=true, desc = [[Finished the whole Abashed Expanse zone without being hit by a single void blast or manaworm. Dodging's fun!]], can_gain = function(self, who, zone) if not who:isQuestStatus("start-archmage", engine.Quest.DONE) then return false end diff --git a/game/profile-thread/Client.lua b/game/profile-thread/Client.lua index e0387410334c4df04eda102843371c01ba043652..35a3e9ba9f0371f359016db9af0840c71d032065 100644 --- a/game/profile-thread/Client.lua +++ b/game/profile-thread/Client.lua @@ -23,7 +23,7 @@ local UserChat = require "profile-thread.UserChat" module(..., package.seeall, class.make) -local debug = false +local debug = true local mport = debug and 2259 or 2257 local pport = debug and 2260 or 2258 @@ -406,7 +406,7 @@ function _M:orderReportUser(o) end function _M:orderChatAchievement(o) - self:command("ACHV", o.channel, o.msg) + self:command("ACH2", o.huge and "1" or "0", o.first and "1" or "0", o.channel, o.msg) self:read("200") end diff --git a/game/profile-thread/UserChat.lua b/game/profile-thread/UserChat.lua index 58021b6bfd7b0b4fa73b13c260f128f705333a48..37d928b808f1d434a3808edb44a88fe4b14e2bd7 100644 --- a/game/profile-thread/UserChat.lua +++ b/game/profile-thread/UserChat.lua @@ -36,8 +36,8 @@ function _M:event(e) cprofile.pushEvent(string.format("e='Chat' se='Whisper' login=%q name=%q donator=%q status=%q msg=%q", e.login, e.name, e.donator, e.status, e.msg)) print("[USERCHAT] whisper", e.login, e.msg) elseif e.e == "ChatAchievement" then - cprofile.pushEvent(string.format("e='Chat' se='Achievement' channel=%q login=%q name=%q donator=%q status=%q msg=%q", e.channel, e.login, e.name, e.donator, e.status, e.msg)) - print("[USERCHAT] channel achievement", e.login, e.channel, e.msg) + cprofile.pushEvent(string.format("e='Chat' se='Achievement' channel=%q login=%q name=%q donator=%q status=%q msg=%q huge=%s first=%s", e.channel, e.login, e.name, e.donator, e.status, e.msg, tostring(e.huge), tostring(e.first))) + print("[USERCHAT] channel achievement", e.login, e.channel, e.msg, e.huge, e.first) elseif e.e == "ChatSerialData" then local data = self.client.psock:receive(e.size) if data then