Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tales of MajEyal Borked
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Simon André Curtis
Tales of MajEyal Borked
Commits
2257b3c0
Commit
2257b3c0
authored
11 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
Gaining a high difficulty achievement also grants lower achievements
parent
d6e12f93
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
game/engines/default/engine/interface/WorldAchievements.lua
+11
-0
11 additions, 0 deletions
game/engines/default/engine/interface/WorldAchievements.lua
game/modules/tome/class/interface/WorldAchievements.lua
+71
-48
71 additions, 48 deletions
game/modules/tome/class/interface/WorldAchievements.lua
with
82 additions
and
48 deletions
game/engines/default/engine/interface/WorldAchievements.lua
+
11
−
0
View file @
2257b3c0
...
...
@@ -158,6 +158,17 @@ function _M:gainAchievement(id, src, ...)
return
true
end
--- Force achievement
-- Does not broadcast, does not tell, does not check reqs
function
_M
:
setAchievement
(
id
,
src
)
local
a
=
self
.
achiev_defs
[
id
]
if
not
a
then
error
(
"Unknown achievement "
..
id
)
return
end
print
(
"[ACHIEVEMENT] forcing "
,
a
.
name
)
self
.
achieved
[
id
]
=
{
turn
=
game
.
turn
,
who
=
self
:
achievementWho
(
src
),
when
=
os.date
(
"%Y-%m-%d %H:%M:%S"
)}
if
not
config
.
settings
.
cheat
then
profile
:
saveModuleProfile
(
"achievements"
,
{
id
=
id
,
turn
=
game
.
turn
,
who
=
self
:
achievementWho
(
src
),
gained_on
=
os.date
(
"%Y-%m-%d %H:%M:%S"
)})
end
end
--- Show an achievement gain dialog
function
_M
:
showAchievement
(
title
,
a
)
if
not
config
.
settings
.
cheat
then
...
...
This diff is collapsed.
Click to expand it.
game/modules/tome/class/interface/WorldAchievements.lua
+
71
−
48
View file @
2257b3c0
...
...
@@ -60,67 +60,79 @@ function _M:newAchievement(t)
WA
.
newAchievement
(
self
,
t2
)
-- Exploration
local
t2
=
table
.
clone
(
t
)
t2
.
id
=
"EXPLORATION_"
..
t2
.
id
t2
.
name
=
t2
.
name
..
" (Exploration mode)"
t2
.
permadeath
=
PERMADEATH_INFINITE
findTile
(
t2
)
WA
.
newAchievement
(
self
,
t2
)
local
t3
=
table
.
clone
(
t
)
t3
.
id
=
"EXPLORATION_"
..
t3
.
id
t3
.
name
=
t3
.
name
..
" (Exploration mode)"
t3
.
permadeath
=
PERMADEATH_INFINITE
findTile
(
t3
)
WA
.
newAchievement
(
self
,
t3
)
-- Add autogrant
t
.
autogrant
=
{
t3
.
id
}
t2
.
autogrant
=
{
t
.
id
,
t3
.
id
}
-- Nightmare
local
t2
=
table
.
clone
(
t
)
t2
.
id
=
"NIGHTMARE_ADVENTURE_"
..
t2
.
id
t2
.
name
=
t2
.
name
..
" (Nightmare (Adventure) difficulty)"
t2
.
difficulty
=
DIFFICULTY_NIGHTMARE
t2
.
permadeath
=
PERMADEATH_MANY
findTile
(
t2
)
WA
.
newAchievement
(
self
,
t2
)
local
t4
=
table
.
clone
(
t
)
t4
.
id
=
"NIGHTMARE_ADVENTURE_"
..
t4
.
id
t4
.
name
=
t4
.
name
..
" (Nightmare (Adventure) difficulty)"
t4
.
difficulty
=
DIFFICULTY_NIGHTMARE
t4
.
permadeath
=
PERMADEATH_MANY
t4
.
autogrant
=
{
t
.
id
}
findTile
(
t4
)
WA
.
newAchievement
(
self
,
t4
)
local
t2
=
table
.
clone
(
t
)
t2
.
id
=
"NIGHTMARE_"
..
t2
.
id
t2
.
name
=
t2
.
name
..
" (Nightmare (Roguelike) difficulty)"
t2
.
difficulty
=
DIFFICULTY_NIGHTMARE
t2
.
permadeath
=
PERMADEATH_ONE
findTile
(
t2
)
WA
.
newAchievement
(
self
,
t2
)
local
t5
=
table
.
clone
(
t
)
t5
.
id
=
"NIGHTMARE_"
..
t5
.
id
t5
.
name
=
t5
.
name
..
" (Nightmare (Roguelike) difficulty)"
t5
.
difficulty
=
DIFFICULTY_NIGHTMARE
t5
.
permadeath
=
PERMADEATH_ONE
t5
.
autogrant
=
{
t4
.
id
,
t2
.
id
}
findTile
(
t5
)
WA
.
newAchievement
(
self
,
t5
)
-- Insane
local
t2
=
table
.
clone
(
t
)
t2
.
id
=
"INSANE_ADVENTURE_"
..
t2
.
id
t2
.
name
=
t2
.
name
..
" (Insane (Adventure) difficulty)"
t2
.
difficulty
=
DIFFICULTY_INSANE
t2
.
permadeath
=
PERMADEATH_MANY
findTile
(
t2
)
WA
.
newAchievement
(
self
,
t2
)
local
t6
=
table
.
clone
(
t
)
t6
.
id
=
"INSANE_ADVENTURE_"
..
t6
.
id
t6
.
name
=
t6
.
name
..
" (Insane (Adventure) difficulty)"
t6
.
difficulty
=
DIFFICULTY_INSANE
t6
.
permadeath
=
PERMADEATH_MANY
t6
.
autogrant
=
{
t4
.
id
}
findTile
(
t6
)
WA
.
newAchievement
(
self
,
t6
)
local
t2
=
table
.
clone
(
t
)
t2
.
id
=
"INSANE_"
..
t2
.
id
t2
.
name
=
t2
.
name
..
" (Insane (Roguelike) difficulty)"
t2
.
difficulty
=
DIFFICULTY_INSANE
t2
.
permadeath
=
PERMADEATH_ONE
findTile
(
t2
)
WA
.
newAchievement
(
self
,
t2
)
local
t7
=
table
.
clone
(
t
)
t7
.
id
=
"INSANE_"
..
t7
.
id
t7
.
name
=
t7
.
name
..
" (Insane (Roguelike) difficulty)"
t7
.
difficulty
=
DIFFICULTY_INSANE
t7
.
permadeath
=
PERMADEATH_ONE
t7
.
autogrant
=
{
t6
.
id
,
t5
.
id
}
findTile
(
t7
)
WA
.
newAchievement
(
self
,
t7
)
-- Madness
local
t2
=
table
.
clone
(
t
)
t2
.
id
=
"MADNESS_ADVENTURE_"
..
t2
.
id
t2
.
name
=
t2
.
name
..
" (Madness (Adventure) difficulty)"
t2
.
difficulty
=
DIFFICULTY_MADNESS
t2
.
permadeath
=
PERMADEATH_MANY
findTile
(
t2
)
WA
.
newAchievement
(
self
,
t2
)
local
t8
=
table
.
clone
(
t
)
t8
.
id
=
"MADNESS_ADVENTURE_"
..
t8
.
id
t8
.
name
=
t8
.
name
..
" (Madness (Adventure) difficulty)"
t8
.
difficulty
=
DIFFICULTY_MADNESS
t8
.
permadeath
=
PERMADEATH_MANY
t8
.
autogrant
=
{
t6
.
id
}
findTile
(
t8
)
WA
.
newAchievement
(
self
,
t8
)
local
t2
=
table
.
clone
(
t
)
t2
.
id
=
"MADNESS_"
..
t2
.
id
t2
.
name
=
t2
.
name
..
" (Madness (Roguelike) difficulty)"
t2
.
difficulty
=
DIFFICULTY_MADNESS
t2
.
permadeath
=
PERMADEATH_ONE
findTile
(
t2
)
WA
.
newAchievement
(
self
,
t2
)
local
t9
=
table
.
clone
(
t
)
t9
.
id
=
"MADNESS_"
..
t9
.
id
t9
.
name
=
t9
.
name
..
" (Madness (Roguelike) difficulty)"
t9
.
difficulty
=
DIFFICULTY_MADNESS
t9
.
permadeath
=
PERMADEATH_ONE
t9
.
autogrant
=
{
t8
.
id
,
t7
.
id
}
findTile
(
t9
)
WA
.
newAchievement
(
self
,
t9
)
end
end
function
_M
:
gainAchievement
(
id
,
src
,
...
)
local
a
=
self
.
achiev_defs
[
id
]
-- Redirect achievements to the main player, always
src
=
game
.
party
:
findMember
{
main
=
true
}
local
ret
=
WA
.
gainAchievement
(
self
,
id
,
src
,
...
)
...
...
@@ -129,6 +141,17 @@ function _M:gainAchievement(id, src, ...)
game
:
onTickEnd
(
function
()
game
:
playSound
(
"actions/achievement"
)
end
,
"achievementsound"
)
game
.
state
:
checkDonation
(
true
)
-- They gained someting nice, they could be more receptive
local
function
subgrant
(
a
)
if
a
.
autogrant
then
for
_
,
sid
in
ipairs
(
a
.
autogrant
)
do
local
sa
=
self
.
achiev_defs
[
sid
]
if
self
:
setAchievement
(
sid
,
src
)
then
if
core
.
steam
and
not
config
.
settings
.
cheat
then
core
.
steam
.
forwardAchievement
(
"TOME_"
..
sid
)
end
end
subgrant
(
sa
)
end
end
end
subgrant
(
a
)
if
core
.
steam
and
not
config
.
settings
.
cheat
then
core
.
steam
.
forwardAchievement
(
"TOME_"
..
id
)
end
end
return
ret
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment