ежедневная и крафты

This commit is contained in:
heyshawtyy committed 2026-11-19 13:46:05 +05:00
1 parent 828297cc6a
commit ce8184576e
31 files changed
+3371

No files matched your search

+137
View File
@@ -0,0 +1,137 @@
# Adds 10 craftable plot items with small passive bonuses (Config / PlayerData / servers / UI / LangRU) via Studio MCP.
import json, subprocess, sys, os
HERE = os.path.dirname(os.path.abspath(__file__))
BON = { # key: (english, russian)
"Luck": ("generator luck", "к удаче генератора"),
"Regen": ("generator speed (shard regen)", "к скорости генератора (реген осколков)"),
"Shredder": ("shards from the shredder", "к осколкам из шредера"),
"XP": ("experience", "к опыту"),
}
# id, name, name_ru, model, icon, xp, bonus key, value, desc_en, desc_ru, half(x,z), recipe [(toy, rarity, count, comment)]
CRAFTS = [
("Snowman", "Frosty Snowman", "Снеговик Фрости", "FrostySnowman", "⛄", 30, "Regen", 0.003,
"A jolly snowman in a top hat and a red scarf.", "Весёлый снеговик в цилиндре и красном шарфе.",
[("020", "Rare", 1, "Snowman"), ("049", "Rare", 1, "Snowball"), ("061", "Rare", 1, "Top Hat Snowman"),
("031", "Uncommon", 1, "Santa Hat"), ("117", "Uncommon", 1, "Blue Hat Snowman")]),
("GingerHouse", "Gingerbread House", "Пряничный домик", "GingerbreadHouse", "🏠", 35, "Shredder", 0.003,
"A sweet little house with icing on the roof and gumdrops round the door.", "Сладкий домик с глазурью на крыше и мармеладками у двери.",
[("025", "Rare", 1, "Gingerbread"), ("060", "Rare", 1, "Ginger House"), ("069", "Rare", 1, "Bowtie Gingerbread"),
("024", "Uncommon", 1, "Cookie"), ("124", "Uncommon", 1, "Ginger House")]),
("CandyArch", "Candy Cane Arch", "Арка из леденцов", "CandyCaneArch", "🍭", 35, "XP", 0.003,
"A striped candy arch with a big red bow on top.", "Полосатая арка из леденцов с большим красным бантом.",
[("014", "Rare", 1, "Candy Cane"), ("058", "Rare", 1, "Crossed Canes"), ("081", "Rare", 1, "Peppermint"),
("111", "Uncommon", 1, "Ruby Cane"), ("112", "Uncommon", 1, "Blue Cane")]),
("Reindeer", "Reindeer Statue", "Статуя оленя", "ReindeerStatue", "🦌", 45, "Luck", 0.003,
"A proud reindeer with a glowing red nose on a golden stand.", "Гордый олень со светящимся красным носом на золотой подставке.",
[("039", "Epic", 1, "Reindeer Face"), ("088", "Rare", 1, "Red Nose Reindeer"), ("109", "Rare", 1, "White Reindeer"),
("110", "Rare", 1, "Gold Reindeer"), ("065", "Rare", 1, "Reindeer Bell")]),
("IceLantern", "Ice Lantern Post", "Ледяной фонарь", "IceLanternPost", "🏮", 50, "Regen", 0.004,
"A street lantern with a warm light and a holly wreath.", "Уличный фонарь с тёплым светом и венком из остролиста.",
[("047", "Epic", 1, "Lantern"), ("079", "Epic", 1, "Frost Lantern"), ("131", "Rare", 1, "Ice Lantern"),
("132", "Rare", 1, "Aurora Lantern"), ("036", "Epic", 1, "Candle")]),
("GiftPile", "Pile of Gifts", "Гора подарков", "GiftPile", "🎁", 55, "Shredder", 0.004,
"A big pile of wrapped presents with ribbons and bows.", "Большая гора подарков в лентах и бантах.",
[("015", "Epic", 1, "White Gift"), ("016", "Epic", 1, "Blue Gift"), ("059", "Epic", 1, "Green Gift"),
("113", "Rare", 1, "Sparkle Gift"), ("149", "Rare", 1, "Ice Gift")]),
("Sleigh", "Santa's Sleigh", "Сани Санты", "SantaSleigh", "🛷", 70, "Luck", 0.005,
"Santa's red sleigh on golden runners, loaded with a sack of gifts.", "Красные сани Санты на золотых полозьях с мешком подарков.",
[("095", "Epic", 1, "Sled"), ("040", "Epic", 1, "Santa"), ("145", "Epic", 1, "Golden Sleigh"),
("110", "Epic", 1, "Gold Reindeer"), ("194", "Rare", 1, "Gold Sleigh")]),
("SnowGlobe", "Giant Snow Globe", "Огромный снежный шар", "GiantSnowGlobe", "🔮", 70, "XP", 0.005,
"A huge glass globe with a tiny snowy tree and a star inside.", "Огромный стеклянный шар с маленькой ёлочкой и звездой внутри.",
[("062", "Epic", 1, "House Globe"), ("115", "Epic", 1, "Castle Globe"), ("116", "Epic", 1, "Aurora Globe"),
("167", "Rare", 1, "Clock Globe"), ("168", "Rare", 1, "Aurora Castle Globe")]),
("Nutcracker", "Nutcracker Guard", "Щелкунчик-страж", "NutcrackerGuard", "💂", 90, "Regen", 0.006,
"A tall nutcracker soldier standing guard over your plot.", "Высокий солдат-щелкунчик охраняет твой участок.",
[("074", "Legendary", 1, "Nutcracker"), ("120", "Epic", 1, "Nutcracker"), ("173", "Epic", 1, "Blue Nutcracker"),
("029", "Legendary", 1, "Drum"), ("076", "Epic", 1, "Marching Drum")]),
("IceCastle", "Frozen Castle", "Ледяной замок", "FrozenCastle", "🏰", 120, "Luck", 0.008,
"A glittering ice castle with glowing windows. The rarest craft of all!", "Сверкающий ледяной замок со светящимися окнами. Самый редкий крафт!",
[("143", "Legendary", 1, "Ice Castle"), ("192", "Epic", 1, "Ice Castle"), ("240", "Epic", 1, "Ice Castle"),
("170", "Epic", 1, "Snow Queen"), ("223", "Rare", 1, "Ice Crown"), ("209", "Rare", 1, "Frost Crown Bell")]),
]
def pct(v): return ("%.1f" % (v * 100)).rstrip("0").rstrip(".")
def bonus_en(k, v): return "Bonus while on your plot: +%s%% %s." % (pct(v), BON[k][0])
def bonus_ru(k, v): return "Бонус, пока стоит на участке: +%s%% %s." % (pct(v), BON[k][1])
def tier(t): return (int(t) - 1) // 50 + 1
shop_lua, craft_lua, ru = "", "", []
for (cid, name, name_ru, model, icon, xp, bk, bv, den, dru, rec) in CRAFTS:
shop_lua += ('\t{ Id = "%s", Name = "%s", Price = 0, Model = "%s", Craft = true, Offset = CFrame.new(),\n'
'\t Desc = "%s" },\n') % (cid, name, model, den)
lines = "".join('\t\t{ Toy = "%s", Tier = %d, Rarity = "%s", Count = %d }, -- %s\n' % (t, tier(t), r, c, cm) for t, r, c, cm in rec)
full_en = den + " " + bonus_en(bk, bv)
craft_lua += ('\t{ Id = "%s", Name = "%s", Icon = "%s", Xp = %d, Bonus = { %s = %s },\n\t Desc = "%s",\n\t Recipe = {\n%s\t } },\n'
% (cid, name, icon, xp, bk, bv, full_en, lines))
ru += [(name, name_ru), (den, dru), (full_en, dru + " " + bonus_ru(bk, bv))]
TRAIN_OLD = "A steam engine with two gift wagons. It runs round its track — put it around your Christmas tree!"
TRAIN_NEW = TRAIN_OLD + " " + bonus_en("Luck", 0.002)
ru.append((TRAIN_NEW, "Паровоз с двумя вагонами подарков. Ездит по кругу — поставь его вокруг своей ёлки! " + bonus_ru("Luck", 0.002)))
E = lambda o, n, all_=False: {"old_string": o, "new_string": n, **({"replace_all": True} if all_ else {})}
EDITS = {
"game.ReplicatedStorage.OrnamentMachine.Config": [
E('\t Half = { 6.3, 6.3 }, -- footprint of the round track (the mesh boxes overestimate it)\n'
'\t Desc = "A little steam train that runs round its track. Put it around your tree!" },\n',
'\t Half = { 6.3, 6.3 }, -- footprint of the round track (the mesh boxes overestimate it)\n'
'\t Desc = "A little steam train that runs round its track. Put it around your tree!" },\n'
'\t-- crafted plot items with a small passive bonus (Config.CRAFTS[..].Bonus) while they stand on the plot\n' + shop_lua),
E('\t{ Id = "Train", Name = "Christmas Train", Icon = "🚂", Xp = 60,\n\t Desc = "%s",' % TRAIN_OLD,
'\t{ Id = "Train", Name = "Christmas Train", Icon = "🚂", Xp = 60, Bonus = { Luck = 0.002 },\n\t Desc = "%s",' % TRAIN_NEW),
E('\t\t{ Toy = "095", Tier = 2, Rarity = "Legendary", Count = 1 }, -- Sled\n\t } },\n}\n',
'\t\t{ Toy = "095", Tier = 2, Rarity = "Legendary", Count = 1 }, -- Sled\n\t } },\n' + craft_lua + '}\n'
'-- passive bonuses of crafted items standing on the plot: Bonus = { Luck / Regen / Shredder / XP = fraction }.\n'
'-- The server sums them into player attributes CB_<key> (OrnamentPlayerData.publish); formulas take them as `bonus`.\n'
'Config.CRAFT_BONUS_KEYS = { "Luck", "Regen", "Shredder", "XP" }\n'),
E('function Config.RegenSeconds(level) return Config.REGEN_SECONDS * (0.95 ^ (level or 0)) end',
'function Config.RegenSeconds(level, bonus) return Config.REGEN_SECONDS * (0.95 ^ (level or 0)) / (1 + (bonus or 0)) end'),
E('function Config.Luck(cells, boosterId, luckLevel, patternMult, isVip)\n\tif cells < Config.MIN_SHARDS then return 0 end\n'
'\tlocal luck = (1 + (cells - Config.MIN_SHARDS) * Config.LUCK_PER_SHARD) * Config.LuckMult(luckLevel) * (patternMult or 1) * Config.VipMult(isVip, "Luck")',
'function Config.Luck(cells, boosterId, luckLevel, patternMult, isVip, bonus)\n\tif cells < Config.MIN_SHARDS then return 0 end\n'
'\tlocal luck = (1 + (cells - Config.MIN_SHARDS) * Config.LUCK_PER_SHARD) * Config.LuckMult(luckLevel) * (patternMult or 1) * Config.VipMult(isVip, "Luck") * (1 + (bonus or 0))'),
E('function Config.RecycleYield(items, shredderLevel, isVip)', 'function Config.RecycleYield(items, shredderLevel, isVip, bonus)'),
E('\treturn math.floor(shards * Config.ShredderMult(shredderLevel) * Config.VipMult(isVip, "Shredder") + 0.5)',
'\treturn math.floor(shards * Config.ShredderMult(shredderLevel) * Config.VipMult(isVip, "Shredder") * (1 + (bonus or 0)) + 0.5)'),
],
"game.ServerScriptService.OrnamentPlayerData": [
E('\tlocal cap, every = Config.RegenCap(d.Upgrades.Regen), Config.RegenSeconds(d.Upgrades.Regen)\n\tplayer:SetAttribute("TutorialDone"',
'\t-- passive bonuses of crafted items standing on the plot -> CB_<key> attributes (read by the formulas)\n'
'\tlocal cb = {}\n\tfor _, c in Config.CRAFTS do\n\t\tif c.Bonus and type(d.Decor[c.Id]) == "table" then\n'
'\t\t\tfor k, v in c.Bonus do cb[k] = (cb[k] or 0) + v end\n\t\tend\n\tend\n'
'\tfor _, k in Config.CRAFT_BONUS_KEYS do player:SetAttribute("CB_" .. k, cb[k] or 0) end\n'
'\tlocal cap, every = Config.RegenCap(d.Upgrades.Regen), Config.RegenSeconds(d.Upgrades.Regen, cb.Regen)\n\tplayer:SetAttribute("TutorialDone"'),
E('\tlocal now = os.time()\n\tlocal cap, every = Config.RegenCap(d.Upgrades.Regen), Config.RegenSeconds(d.Upgrades.Regen)',
'\tlocal now = os.time()\n\tlocal cap, every = Config.RegenCap(d.Upgrades.Regen), Config.RegenSeconds(d.Upgrades.Regen, player:GetAttribute("CB_Regen"))'),
E('\tif amount > 0 and player:GetAttribute("VIP") == true then amount = math.floor(amount * Config.VIP.XP + 0.5) end -- VIP pass',
'\tif amount > 0 and player:GetAttribute("VIP") == true then amount = math.floor(amount * Config.VIP.XP + 0.5) end -- VIP pass\n'
'\tlocal cbXp = player:GetAttribute("CB_XP") or 0 -- crafted items on the plot: small % bonus, fractions carried over\n'
'\tif amount > 0 and cbXp > 0 then\n\t\tlocal exact = amount * (1 + cbXp) + (p.xpFrac or 0)\n'
'\t\tamount = math.floor(exact); p.xpFrac = exact - amount\n\tend'),
],
"game.ServerScriptService.OrnamentMachineServer": [
E('patternLuck, player:GetAttribute("VIP") == true)', 'patternLuck, player:GetAttribute("VIP") == true, player:GetAttribute("CB_Luck"))'),
E('PlayerData.UpgradeLevel(player, "Shredder"), player:GetAttribute("VIP") == true)',
'PlayerData.UpgradeLevel(player, "Shredder"), player:GetAttribute("VIP") == true, player:GetAttribute("CB_Shredder"))'),
],
"game.StarterPlayer.StarterPlayerScripts.OrnamentCraftUI.GeneratorWindow": [
E('pLuck, attr("VIP", false) == true)', 'pLuck, attr("VIP", false) == true, attr("CB_Luck", 0))')],
"game.StarterPlayer.StarterPlayerScripts.OrnamentCraftUI.ShredderWindow": [
E('attr("Upg_Shredder", 0), attr("VIP", false) == true)', 'attr("Upg_Shredder", 0), attr("VIP", false) == true, attr("CB_Shredder", 0))')],
"game.StarterPlayer.StarterPlayerScripts.OrnamentCraftUI.HudView": [
E('Config.RegenSeconds(lvl)', 'Config.RegenSeconds(lvl, game.Players.LocalPlayer:GetAttribute("CB_Regen"))', True)],
"game.ReplicatedStorage.OrnamentMachine.LangRU": [
E('\t{ "%s", "Паровоз с двумя вагонами подарков. Ездит по кругу — поставь его вокруг своей ёлки!" },' % TRAIN_OLD,
'\t{ "%s", "Паровоз с двумя вагонами подарков. Ездит по кругу — поставь его вокруг своей ёлки!" },\n' % TRAIN_OLD
+ "".join('\t{ "%s", "%s" },\n' % (a, b) for a, b in ru).rstrip("\n"))],
}
if __name__ == "__main__":
for path, edits in EDITS.items():
a = os.path.join(HERE, "args.json")
json.dump({"file_path": path, "edits": edits, "datamodel_type": "Edit", "studio_id": sys.argv[1]},
open(a, "w", encoding="utf-8"), ensure_ascii=False)
r = subprocess.run([sys.executable, os.path.join(HERE, "rbx.py"), "multi_edit", a], capture_output=True, text=True, encoding="utf-8")
print("==", path, "->", (r.stdout or r.stderr).strip()[:300])