-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-missions.sql
More file actions
84 lines (73 loc) · 4.43 KB
/
Copy pathexample-missions.sql
File metadata and controls
84 lines (73 loc) · 4.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
-- Example mission set for Progression.Database.
--
-- mysql -u user -p progression < docs/example-missions.sql
--
-- Run it AFTER starting the server once: the module creates its tables on load, and objectives are
-- only served for events a server has actually reported it can emit, so a mission inserted before
-- the first boot stays invisible until then.
--
-- Safe to re-run. Every insert matches on `key`, which is UNIQUE — that is what makes the mission
-- identity stable, so editing a row here updates the mission instead of creating a second one.
--
-- Titles are plain text here so this works out of the box. They can equally be locale keys: the UI
-- resolves a title through the localizer first and falls back to the literal, so a translated set is
-- a matter of putting these strings in <sharp>/locales/progression.json instead.
INSERT INTO progression_definition
(`key`, title, description, event_key, target_field, filter_json, amount, scope, gamemodes_json)
VALUES
('daily_kills', 'Daily marksman', 'Kill 15 players.',
'cs2.kill', 'attacker', '{}', 15, 'daily', '["*"]'),
('daily_headshots', 'Headhunter', 'Get 10 headshot kills.',
'cs2.kill', 'attacker', '{"headshot":true}', 10, 'daily', '["*"]'),
('daily_damage', 'Heavy hitter', 'Deal 2500 damage.',
-- amount_field counts a MAGNITUDE from the event instead of counting occurrences.
'cs2.damage', 'attacker', '{}', 2500, 'daily', '["*"]'),
('weekly_wallbang', 'Through the wall','Kill 5 players through a wall.',
'cs2.kill', 'attacker', '{"penetrated":1}', 5, 'weekly', '["*"]'),
('weekly_noscope', 'No scope needed', 'Get 3 no-scope kills.',
'cs2.kill', 'attacker', '{"noscope":true}', 3, 'weekly', '["*"]'),
('weekly_mirage', 'Mirage regular', 'Kill 50 players on Mirage.',
-- Map is a plain filter field, so "on this map" needs no special support.
'cs2.kill', 'attacker', '{"map":"de_mirage"}', 50, 'weekly', '["*"]'),
('monthly_bomb', 'Demolition', 'Plant the bomb 25 times.',
-- Bomb and MVP events name the earner 'userid'; kills name it 'attacker'.
'cs2.bomb_planted', 'userid', '{}', 25, 'monthly', '["*"]'),
('lifetime_kills', 'One thousand', 'Kill 1000 players. Once, ever.',
'cs2.kill', 'attacker', '{}', 1000, 'none', '["*"]')
ON DUPLICATE KEY UPDATE
title = VALUES(title),
description = VALUES(description),
amount = VALUES(amount),
filter_json = VALUES(filter_json),
-- Bumping the version is what tells running servers to re-pull; without it they keep the old
-- catalogue until their next backstop refresh.
row_version = row_version + 1;
-- The damage mission counts damage dealt, not damage events.
UPDATE progression_definition SET amount_field = 'damage' WHERE `key` = 'daily_damage';
-- Rewards. 'xp' and 'currency' are paid directly; 'command' is queued and run by a server, with
-- {steamid64} substituted. A command reward is how you pay out through another plugin — use the
-- command that plugin registers. These are ModSharp console commands: no sm_ prefix (SourceMod)
-- and no css_ prefix (CounterStrikeSharp).
-- ({steamid} is also accepted, but {steamid64} is the documented form and the one the website
-- backend's validator requires, so a reward written with it works against either storage.)
--
-- Cleared and re-inserted rather than merged: there is no unique key on (definition, ord), so this is
-- the honest way to make re-running this file idempotent. It only touches the missions defined above.
DELETE r FROM progression_definition_reward r
JOIN progression_definition d ON d.id = r.definition_id
WHERE d.`key` IN ('daily_kills','daily_headshots','daily_damage','weekly_wallbang',
'weekly_noscope','weekly_mirage','monthly_bomb','lifetime_kills');
INSERT INTO progression_definition_reward (definition_id, ord, kind, amount, command)
SELECT d.id, v.ord, v.kind, v.amount, ''
FROM progression_definition d
JOIN (
SELECT 'daily_kills' AS k, 0 AS ord, 'xp' AS kind, 120 AS amount
UNION SELECT 'daily_kills', 1, 'currency', 20
UNION SELECT 'daily_headshots', 0, 'xp', 150
UNION SELECT 'daily_damage', 0, 'xp', 100
UNION SELECT 'weekly_wallbang', 0, 'currency', 50
UNION SELECT 'weekly_noscope', 0, 'currency', 50
UNION SELECT 'weekly_mirage', 0, 'currency', 75
UNION SELECT 'monthly_bomb', 0, 'currency', 150
UNION SELECT 'lifetime_kills', 0, 'currency', 500
) v ON v.k = d.`key`;