Pre-combat-refactor: current state with PvP sync, boss setup scripts, combat fixes

This commit is contained in:
Joan
2026-02-25 12:00:06 +01:00
parent bd27404941
commit 540df02ae7
11 changed files with 1825 additions and 5 deletions

45
setup_boss.sql Normal file
View File

@@ -0,0 +1,45 @@
-- Buff player and get location into temporary variable
DO $$
DECLARE
player_id INT;
loc_id VARCHAR;
start_ts FLOAT;
end_ts FLOAT;
BEGIN
SELECT id, location_id INTO player_id, loc_id FROM characters WHERE name ILIKE 'Jocaru';
IF NOT FOUND THEN
RAISE NOTICE 'Player Jocaru not found';
RETURN;
END IF;
UPDATE characters SET level = 50, xp = 50000, max_hp = 500, hp = 500, max_stamina = 200, stamina = 200 WHERE id = player_id;
-- Give items
INSERT INTO inventory (character_id, item_id, quantity) VALUES (player_id, 'reinforced_pack', 1);
INSERT INTO inventory (character_id, item_id, quantity) VALUES (player_id, 'reinforced_bat', 1);
INSERT INTO inventory (character_id, item_id, quantity) VALUES (player_id, 'combat_knife', 1);
INSERT INTO inventory (character_id, item_id, quantity) VALUES (player_id, 'first_aid_kit', 10);
INSERT INTO inventory (character_id, item_id, quantity) VALUES (player_id, 'mystery_pills', 5);
INSERT INTO inventory (character_id, item_id, quantity) VALUES (player_id, 'energy_bar', 10);
-- Spawn enemies
start_ts := extract(epoch from now());
end_ts := start_ts + 86400;
-- 5 Raider Scouts
FOR i IN 1..5 LOOP
INSERT INTO wandering_enemies (npc_id, location_id, spawn_timestamp, despawn_timestamp) VALUES ('raider_scout', loc_id, start_ts, end_ts);
END LOOP;
-- 5 Feral Dogs
FOR i IN 1..5 LOOP
INSERT INTO wandering_enemies (npc_id, location_id, spawn_timestamp, despawn_timestamp) VALUES ('feral_dog', loc_id, start_ts, end_ts);
END LOOP;
-- 5 Mutant Rats
FOR i IN 1..5 LOOP
INSERT INTO wandering_enemies (npc_id, location_id, spawn_timestamp, despawn_timestamp) VALUES ('mutant_rat', loc_id, start_ts, end_ts);
END LOOP;
-- 2 Test Bosses
FOR i IN 1..2 LOOP
INSERT INTO wandering_enemies (npc_id, location_id, spawn_timestamp, despawn_timestamp) VALUES ('test_boss', loc_id, start_ts, end_ts);
END LOOP;
END $$;