Skip to content
Snippets Groups Projects
Commit 3d4f91a2 authored by dg's avatar dg
Browse files

Achievements are now classified in three kinds (important, first time, others)...

Achievements are now classified in three kinds (important, first time, others) which can be filtered independantly
Achievements filtering config reseted to account for the new classification


git-svn-id: http://svn.net-core.org/repos/t-engine4@6740 51575b47-30f0-44d4-a5cc-537603b46e54
parent 66855382
No related branches found
No related tags found
No related merge requests found
Showing
with 78 additions and 61 deletions
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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.]],
}
......
......@@ -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.]],
}
......@@ -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.]],
}
......@@ -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
......
......@@ -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",
}
......@@ -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)
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment