Patron's Grace buff system prep

This commit is contained in:
Kaan Soral
2025-09-21 16:37:57 +03:00
parent 3588ab6e71
commit 639e88248b
7 changed files with 84 additions and 12 deletions
+1
View File
@@ -1389,6 +1389,7 @@ def stop_character_api(**args):
def sync_character_api(**args):
self,domain,user,server,id,data,user_data,unmount=gdmuld(args,"self","domain","user","server","character","data","user_data","unmount"); retries=3
#logging.info(data.keys())
if unmount:
logging.info("Unmount mode")
retries=16
+6 -6
View File
@@ -117,12 +117,12 @@ if is_production:
game_version=822
SALES=4+5+388+5101+125/20 #donation+manual+macos+steam+sales
update_notes=[
"Last Update [June 8th]",
"Monsters with the stationary flag no longer move",
"added the npcs's to the bank_u floor #177",
"Resist orbs #178",
"moved gpurplepro spawn area #180",
"make xmage stages humanoid #182",
"Last Update [August 7th]",
"PR: Fix display of Orb of Adventures #183",
"PR: Fix Sanguine Amulet #185",
"PR: Fix display of Frozen to correctly show speed reduction, fix value in G.conditions.poisoned to reflect actual frequency multiplier #188",
"PR: Explanations for all conditions #189",
"PR: Stop orbs from spamming game events #190",
]
ip_to_subdomain={ #IMPORTANT: SPECIAL PAGE RULES ARE NEEDED: https://dash.cloudflare.com/b6f5a13bded5fdd273e4a1cd3777162d/adventure.land/page-rules - uss1 / eus1 was best
"35.187.255.184":"asia1",
+12
View File
@@ -269,6 +269,18 @@ conditions={
"ui":True,
"persistent":True,
},
"patronsgrace":{
"skin":"patronsgrace",
"name":"Patron's Grace",
"explanation":"This server has been graced by a patron's support!",
"luck":5,
"gold":5,
"xp":20,
"speed":1,
"duration":60*60*1000,
"buff":True,
"ui":True,
},
"notverified":{
"skin":"notverified",
"name":"Not Verified",
File diff suppressed because one or more lines are too long
+4
View File
@@ -1330,6 +1330,10 @@ function init_socket(args)
$(".saferespawn").show();
}
else add_log("Note: Game dynamics and drops aren't final, they are evolving with every update","gray");
if(data.blessed_by)
{
add_log("This server has been blessed by "+data.blessed_by,"#8F70D8");
}
// add_log("Warning: A Chrome bug is causing memory leaks, very small but it adds up. They patched the bug, however, that patch didn't make it to our browsers yet","#E08583");
$(".charactername").html(character.name);
page.title=character.name;
+53 -2
View File
@@ -578,6 +578,7 @@ function player_to_server(player, place) {
"width",
"height",
"u",
"user",
])
) {
char[prop] = player[prop];
@@ -6998,6 +6999,37 @@ function init_io() {
);
success_response({ success: false, in_progress: true });
});
socket.on("bless_server", function (data) {
var player = players[socket.id];
if (!player || player.user || gameplay == "hardcore" || gameplay == "test") {
return fail_response("cant_in_bank");
}
var cost = 1200;
if (player.blessing) return fail_response("in_progress");
player.blessing = true;
appengine_call(
"bill_user",
{ auth: player.auth, amount: cost, reason: "blessing", name: player.name },
function (result) {
player.blessing = false;
server_log("buy_with_cash: " + JSON.stringify(result));
if (result.failed || !result.done) {
socket.emit("game_log", "Purchase failed");
return;
}
player.cash = result.cash;
S.blessed_minutes = 60 * 24 * 7;
S.blessed_by = player.name;
socket.emit("game_log", "Spent " + to_pretty_num(cost) + " shells");
resend(player, "reopen+nc+inv");
bless_loop();
},
);
success_response({ success: false, in_progress: true });
});
socket.on("sbuy", function (data) {
var player = players[socket.id];
var done = false;
@@ -9833,6 +9865,11 @@ function init_io() {
cdata.base_gold = D.base_gold;
broadcast_e(true);
cdata.s_info = E;
if (S.blessed_minutes) {
cdata.blessed_by = S.blessed_by;
cdata.blessed_minutes = S.blessed_minutes;
player.s.patronsgrace = { ms: G.conditions.patronsgrace.duration, f: S.blessed_by };
}
if (result.code) {
cdata.code = result.code;
cdata.code_slot = result.code_slot;
@@ -12425,7 +12462,7 @@ function update_instance(instance) {
response: "compound_success",
stale: ref.stale,
level: item.level,
num: data.num,
num: ref.num,
up: item.extra || undefined,
},
]);
@@ -12449,7 +12486,7 @@ function update_instance(instance) {
var def = G.items[item.name];
player.hitchhikers.push([
"game_response",
{ response: "compound_fail", level: item.level, num: data.num, stale: ref.stale },
{ response: "compound_fail", level: item.level, num: ref.num, stale: ref.stale },
]);
if (calculate_item_value(item) + (def.edge || 0) * 2000000 > 920000 && !player.stealth) {
broadcast("server_message", {
@@ -13042,6 +13079,20 @@ function npc_loop() {
setTimeout(npc_loop, max(28, min(1000, ms_since * 2 + 2))); // originally 24
}
function bless_loop() {
if (S.blessed_minutes) S.blessed_minutes--;
if (!S.blessed_minutes) return;
for (var id in players) {
var player = players[id],
rs = false;
if (!player.s.patronsgrace) rs = true;
player.s.patronsgrace = { ms: G.conditions.patronsgrace.duration, f: S.blessed_by };
if (rs) resend(player, "u+cid");
}
}
setInterval(bless_loop, 60 * 1000);
function game_loop() {
// back in the day pretty much everything was in here [11/08/22]
if (!server.live) {
+7 -3
View File
@@ -3191,7 +3191,8 @@ function xy_upush_logic(element) {
}
function appengine_call(method, args, on_success, on_error) {
var api_path = "/api/" + method;
var api_path = "/api/" + method,
suffix = "";
if (
mode.prevent_external &&
!in_arr(method, ["create_server", "update_server", "stop_server", "start_character", "send_mail"])
@@ -3222,14 +3223,17 @@ function appengine_call(method, args, on_success, on_error) {
}
if (args.suffix) {
api_path += args.suffix;
suffix = args.suffix;
delete args.suffix;
}
data = {
var arguments = JSON.stringify(args);
var data = {
method: method,
arguments: JSON.stringify(args),
arguments: arguments,
server_auth: server_id + "-" + server_auth,
auth: args.auth,
};
if (suffix.includes("unmount")) console.log(arguments.length);
try {
request.post({ url: base_url + api_path, form: data }, function (err, response, body) {
try {