# Installs the rewards system into the open place via Studio MCP (Config, PlayerData, LangRU edits + 2 new scripts) import json, os, subprocess, sys HERE = os.path.dirname(os.path.abspath(__file__)); TOOLS = os.path.dirname(HERE) SID = "0411fa4a-b0e9-4eb3-8d9b-e8e08277ee91" def call(tool, args): a = os.path.join(TOOLS, "args_rw.json"); json.dump({**args, "studio_id": SID, "datamodel_type": "Edit"}, open(a, "w", encoding="utf-8"), ensure_ascii=False) r = subprocess.run([sys.executable, os.path.join(TOOLS, "rbx.py"), tool, a], capture_output=True, text=True, encoding="utf-8") print(tool, args.get("file_path"), "->", ((r.stdout or "") + (r.stderr or "")).strip()[:300]) E = lambda o, n: {"old_string": o, "new_string": n} CONFIG = '''---------------------------------------------------------------- rewards: daily login + playtime (OrnamentRewardsServer) -- LOGIN: a 7-day cycle, one gift per UTC day (a missed day does not reset it). PLAYTIME: per UTC day, Minutes played. Config.REWARDS = { LOGIN = { { Shards = 30 }, { Boosters = { Luck2 = 1 } }, { Shards = 60 }, { Boosters = { Luck2 = 2 } }, { Shards = 100, XP = 50 }, { Boosters = { Luck3 = 1 } }, { Shards = 200, Boosters = { Luck3 = 1 }, XP = 100 }, }, PLAYTIME = { { Minutes = 15, Shards = 15 }, { Minutes = 30, Shards = 25 }, { Minutes = 45, Boosters = { Luck2 = 1 } }, { Minutes = 60, Shards = 50 }, { Minutes = 90, Boosters = { Luck2 = 2 } }, { Minutes = 120, Shards = 80, XP = 50 }, { Minutes = 150, Boosters = { Luck3 = 1 } }, { Minutes = 180, Shards = 120 }, { Minutes = 240, Shards = 200, Boosters = { Luck3 = 1 }, XP = 100 }, }, } ---------------------------------------------------------------- premium shop (Robux, Developer Products)''' PD_FUN = '''---------------------------------------------------------------- daily login / playtime rewards (OrnamentRewardsServer) function PlayerData.Rewards(player) local p = profiles[player] if not p then return nil end local r = p.data.Rewards if type(r) ~= "table" then r = {}; p.data.Rewards = r end r.LoginDay = tonumber(r.LoginDay) or 0 r.LoginDate = type(r.LoginDate) == "string" and r.LoginDate or "" r.PlayDate = type(r.PlayDate) == "string" and r.PlayDate or "" r.PlaySec = tonumber(r.PlaySec) or 0 r.PlayClaimed = tonumber(r.PlayClaimed) or 0 return r end -- marks the profile for saving without re-publishing every attribute (playtime ticks) function PlayerData.MarkDirty(player) local p = profiles[player] if p then p.dirty = true end end ---------------------------------------------------------------- settings''' RU = [("Rewards", "Награды"), ("🎁 Rewards", "🎁 Награды"), ("Daily login", "Вход каждый день"), ("Playtime", "Время в игре"), ("Day %d", "День %s"), ("%d min", "%s мин"), ("%d h", "%s ч"), ("%d h %d min", "%s ч %s мин"), ("+%d shards", "+%s осколков"), ("+%d Luck x2", "+%s Удача x2"), ("+%d Luck x3", "+%s Удача x3"), ("+%d XP", "+%s опыта"), ("Claim", "Забрать"), ("Claimed", "Получено"), ("Tomorrow", "Завтра"), ("in %d:%02d", "через %s:%s"), ("in %d:%02d:%02d", "через %s:%s:%s"), ("Come in every day for a gift! Missing a day doesn't reset your progress.", "Заходи каждый день за подарком! Пропуск дня не сбрасывает прогресс."), ("Today's playtime: %d:%02d · resets at 00:00 UTC", "Сегодня в игре: %s:%s · обнуляется в 03:00 МСК")] call("multi_edit", {"file_path": "game.ReplicatedStorage.OrnamentMachine.Config", "edits": [ E("---------------------------------------------------------------- premium shop (Robux, Developer Products)", CONFIG)]}) call("multi_edit", {"file_path": "game.ServerScriptService.OrnamentPlayerData", "edits": [ E('\t\tSettings = { Master = 1, Music = 1, Effects = 1, UI = 1, MusicOn = true, Lang = "auto" },\n\t}\nend', '\t\tSettings = { Master = 1, Music = 1, Effects = 1, UI = 1, MusicOn = true, Lang = "auto" },\n' '\t\tRewards = { LoginDay = 0, LoginDate = "", PlayDate = "", PlaySec = 0, PlayClaimed = 0 }, -- OrnamentRewardsServer\n\t}\nend'), E("---------------------------------------------------------------- settings\n-- partial update", PD_FUN.replace("---------------------------------------------------------------- settings", "---------------------------------------------------------------- settings\n-- partial update"))]}) call("multi_edit", {"file_path": "game.ReplicatedStorage.OrnamentMachine.LangRU", "edits": [ E('return {\n\t{ "Common", "Обычная" },', 'return {\n' + "".join('\t{ "%s", "%s" },\n' % p for p in RU) + '\t{ "Common", "Обычная" },')]}) for path, cls, fn in (("game.ServerScriptService.OrnamentRewardsServer", "Script", "RewardsServer.server.luau"), ("game.StarterPlayer.StarterPlayerScripts.RewardsUI", "LocalScript", "RewardsUI.client.luau")): call("multi_edit", {"file_path": path, "className": cls, "edits": [E("", open(os.path.join(HERE, fn), encoding="utf-8").read())]})