Adding today changes:

- Adding devota
- Adding event loop
- Adding explore attributes to teams
This commit is contained in:
Sergiotarxz 2023-06-20 01:48:55 +02:00
parent 18eec2058e
commit 3340a78fc4
15 changed files with 3900 additions and 3 deletions

View File

@ -0,0 +1,295 @@
--
-- Created by SQL::Translator::Producer::PostgreSQL
-- Created on Mon Jun 19 20:01:37 2023
--
;
--
-- Table: equipment
--
CREATE TABLE "equipment" (
"uuid" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
;
--
-- Table: inventories
--
CREATE TABLE "inventories" (
"uuid" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
;
--
-- Table: players
--
CREATE TABLE "players" (
"uuid" uuid NOT NULL,
"username" text NOT NULL,
"encrypted_password" text NOT NULL,
"email" text NOT NULL,
"verified" boolean NOT NULL,
"verification_token" text,
"register_date" timestamp DEFAULT NOW() NOT NULL,
"last_activity" timestamp DEFAULT NOW() NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "unique_constraint_email" UNIQUE ("email"),
CONSTRAINT "unique_constraint_username" UNIQUE ("username")
);
;
--
-- Table: skill_like_lists
--
CREATE TABLE "skill_like_lists" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
PRIMARY KEY ("uuid")
);
;
--
-- Table: stats
--
CREATE TABLE "stats" (
"uuid" uuid NOT NULL,
"health" integer NOT NULL,
"mana" integer NOT NULL,
"strength" integer NOT NULL,
"resistance" integer NOT NULL,
"magic" integer NOT NULL,
"speed" integer NOT NULL,
"intelligence" integer NOT NULL,
PRIMARY KEY ("uuid")
);
;
--
-- Table: equipment_items
--
CREATE TABLE "equipment_items" (
"kind" text NOT NULL,
"equipment" uuid NOT NULL,
"identifier" text NOT NULL,
"quantity" integer NOT NULL,
PRIMARY KEY ("kind", "equipment")
);
CREATE INDEX "equipment_items_idx_equipment" on "equipment_items" ("equipment");
;
--
-- Table: inventory_items
--
CREATE TABLE "inventory_items" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"inventory" uuid NOT NULL,
"identifier" text NOT NULL,
"quantity" integer NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "inventory_items_unique_item" UNIQUE ("inventory", "identifier")
);
CREATE INDEX "inventory_items_idx_inventory" on "inventory_items" ("inventory");
;
--
-- Table: skill_like_items
--
CREATE TABLE "skill_like_items" (
"identifier" text NOT NULL,
"owner_list" uuid NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
PRIMARY KEY ("identifier", "owner_list")
);
CREATE INDEX "skill_like_items_idx_owner_list" on "skill_like_items" ("owner_list");
;
--
-- Table: teams
--
CREATE TABLE "teams" (
"uuid" uuid NOT NULL,
"is_exploring" boolean DEFAULT false NOT NULL,
"explore_frame" integer DEFAULT 0 NOT NULL,
"leader" uuid,
"name" text NOT NULL,
"planet" text NOT NULL,
"super_area" text NOT NULL,
"area" text NOT NULL,
"location" text NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "u_name" UNIQUE ("name")
);
CREATE INDEX "teams_idx_leader" on "teams" ("leader");
;
--
-- Table: player_pjs
--
CREATE TABLE "player_pjs" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"owner" uuid NOT NULL,
"full_name" text NOT NULL,
"short_name" text NOT NULL,
"nick" text NOT NULL,
"race" text NOT NULL,
"team" uuid NOT NULL,
"creation_date" timestamp DEFAULT NOW() NOT NULL,
"last_activity" timestamp DEFAULT NOW() NOT NULL,
"experience" integer DEFAULT 1 NOT NULL,
"equipment" uuid NOT NULL,
"born_stats" uuid NOT NULL,
"training_stats" uuid NOT NULL,
"skills" uuid NOT NULL,
"spells" uuid NOT NULL,
"inventory" uuid NOT NULL,
"health" integer NOT NULL,
"mana" integer NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_pjs_idx_born_stats" on "player_pjs" ("born_stats");
CREATE INDEX "player_pjs_idx_equipment" on "player_pjs" ("equipment");
CREATE INDEX "player_pjs_idx_inventory" on "player_pjs" ("inventory");
CREATE INDEX "player_pjs_idx_owner" on "player_pjs" ("owner");
CREATE INDEX "player_pjs_idx_skills" on "player_pjs" ("skills");
CREATE INDEX "player_pjs_idx_spells" on "player_pjs" ("spells");
CREATE INDEX "player_pjs_idx_team" on "player_pjs" ("team");
CREATE INDEX "player_pjs_idx_training_stats" on "player_pjs" ("training_stats");
;
--
-- Table: player_companion_npcs
--
CREATE TABLE "player_companion_npcs" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"owner" uuid NOT NULL,
"identifier" text NOT NULL,
"nick" text,
"race" text NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
"exp" integer DEFAULT 1 NOT NULL,
"equipment" uuid NOT NULL,
"stats" uuid NOT NULL,
"skills" uuid NOT NULL,
"spells" uuid NOT NULL,
"inventory" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_companion_npcs_idx_equipment" on "player_companion_npcs" ("equipment");
CREATE INDEX "player_companion_npcs_idx_inventory" on "player_companion_npcs" ("inventory");
CREATE INDEX "player_companion_npcs_idx_owner" on "player_companion_npcs" ("owner");
CREATE INDEX "player_companion_npcs_idx_skills" on "player_companion_npcs" ("skills");
CREATE INDEX "player_companion_npcs_idx_spells" on "player_companion_npcs" ("spells");
CREATE INDEX "player_companion_npcs_idx_stats" on "player_companion_npcs" ("stats");
;
--
-- Table: player_pjs_flags
--
CREATE TABLE "player_pjs_flags" (
"name" text NOT NULL,
"owner" uuid NOT NULL,
PRIMARY KEY ("name", "owner")
);
CREATE INDEX "player_pjs_flags_idx_owner" on "player_pjs_flags" ("owner");
CREATE INDEX "index_flag" on "player_pjs_flags" ("owner", "name");
;
--
-- Table: player_pjs_log
--
CREATE TABLE "player_pjs_log" (
"uuid" uuid NOT NULL,
"content" jsonb NOT NULL,
"owner" uuid NOT NULL,
"date" timestamp DEFAULT NOW() NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_pjs_log_idx_owner" on "player_pjs_log" ("owner");
CREATE INDEX "index_log" on "player_pjs_log" ("owner", "date");
;
--
-- Foreign Key Definitions
--
;
ALTER TABLE "equipment_items" ADD CONSTRAINT "equipment_items_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "inventory_items" ADD CONSTRAINT "inventory_items_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "skill_like_items" ADD CONSTRAINT "skill_like_items_fk_owner_list" FOREIGN KEY ("owner_list")
REFERENCES "skill_like_lists" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "teams" ADD CONSTRAINT "teams_fk_leader" FOREIGN KEY ("leader")
REFERENCES "player_pjs" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_born_stats" FOREIGN KEY ("born_stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_owner" FOREIGN KEY ("owner")
REFERENCES "players" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_skills" FOREIGN KEY ("skills")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_spells" FOREIGN KEY ("spells")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_team" FOREIGN KEY ("team")
REFERENCES "teams" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_training_stats" FOREIGN KEY ("training_stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_skills" FOREIGN KEY ("skills")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_spells" FOREIGN KEY ("spells")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_stats" FOREIGN KEY ("stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs_flags" ADD CONSTRAINT "player_pjs_flags_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs_log" ADD CONSTRAINT "player_pjs_log_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;

View File

@ -0,0 +1,295 @@
--
-- Created by SQL::Translator::Producer::PostgreSQL
-- Created on Mon Jun 19 20:00:51 2023
--
;
--
-- Table: equipment
--
CREATE TABLE "equipment" (
"uuid" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
;
--
-- Table: inventories
--
CREATE TABLE "inventories" (
"uuid" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
;
--
-- Table: players
--
CREATE TABLE "players" (
"uuid" uuid NOT NULL,
"username" text NOT NULL,
"encrypted_password" text NOT NULL,
"email" text NOT NULL,
"verified" boolean NOT NULL,
"verification_token" text,
"register_date" timestamp DEFAULT NOW() NOT NULL,
"last_activity" timestamp DEFAULT NOW() NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "unique_constraint_email" UNIQUE ("email"),
CONSTRAINT "unique_constraint_username" UNIQUE ("username")
);
;
--
-- Table: skill_like_lists
--
CREATE TABLE "skill_like_lists" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
PRIMARY KEY ("uuid")
);
;
--
-- Table: stats
--
CREATE TABLE "stats" (
"uuid" uuid NOT NULL,
"health" integer NOT NULL,
"mana" integer NOT NULL,
"strength" integer NOT NULL,
"resistance" integer NOT NULL,
"magic" integer NOT NULL,
"speed" integer NOT NULL,
"intelligence" integer NOT NULL,
PRIMARY KEY ("uuid")
);
;
--
-- Table: equipment_items
--
CREATE TABLE "equipment_items" (
"kind" text NOT NULL,
"equipment" uuid NOT NULL,
"identifier" text NOT NULL,
"quantity" integer NOT NULL,
PRIMARY KEY ("kind", "equipment")
);
CREATE INDEX "equipment_items_idx_equipment" on "equipment_items" ("equipment");
;
--
-- Table: inventory_items
--
CREATE TABLE "inventory_items" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"inventory" uuid NOT NULL,
"identifier" text NOT NULL,
"quantity" integer NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "inventory_items_unique_item" UNIQUE ("inventory", "identifier")
);
CREATE INDEX "inventory_items_idx_inventory" on "inventory_items" ("inventory");
;
--
-- Table: skill_like_items
--
CREATE TABLE "skill_like_items" (
"identifier" text NOT NULL,
"owner_list" uuid NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
PRIMARY KEY ("identifier", "owner_list")
);
CREATE INDEX "skill_like_items_idx_owner_list" on "skill_like_items" ("owner_list");
;
--
-- Table: teams
--
CREATE TABLE "teams" (
"uuid" uuid NOT NULL,
"is_exploring" boolean DEFAULT false NOT NULL,
"explore_frame" integer DEFAULT 0 NOT NULL,
"leader" uuid,
"name" text NOT NULL,
"planet" text NOT NULL,
"super_area" text NOT NULL,
"area" text NOT NULL,
"location" text NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "u_name" UNIQUE ("name")
);
CREATE INDEX "teams_idx_leader" on "teams" ("leader");
;
--
-- Table: player_pjs
--
CREATE TABLE "player_pjs" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"owner" uuid NOT NULL,
"full_name" text NOT NULL,
"short_name" text NOT NULL,
"nick" text NOT NULL,
"race" text NOT NULL,
"team" uuid NOT NULL,
"creation_date" timestamp DEFAULT NOW() NOT NULL,
"last_activity" timestamp DEFAULT NOW() NOT NULL,
"experience" integer DEFAULT 1 NOT NULL,
"equipment" uuid NOT NULL,
"born_stats" uuid NOT NULL,
"training_stats" uuid NOT NULL,
"skills" uuid NOT NULL,
"spells" uuid NOT NULL,
"inventory" uuid NOT NULL,
"health" integer NOT NULL,
"mana" integer NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_pjs_idx_born_stats" on "player_pjs" ("born_stats");
CREATE INDEX "player_pjs_idx_equipment" on "player_pjs" ("equipment");
CREATE INDEX "player_pjs_idx_inventory" on "player_pjs" ("inventory");
CREATE INDEX "player_pjs_idx_owner" on "player_pjs" ("owner");
CREATE INDEX "player_pjs_idx_skills" on "player_pjs" ("skills");
CREATE INDEX "player_pjs_idx_spells" on "player_pjs" ("spells");
CREATE INDEX "player_pjs_idx_team" on "player_pjs" ("team");
CREATE INDEX "player_pjs_idx_training_stats" on "player_pjs" ("training_stats");
;
--
-- Table: player_companion_npcs
--
CREATE TABLE "player_companion_npcs" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"owner" uuid NOT NULL,
"identifier" text NOT NULL,
"nick" text,
"race" text NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
"exp" integer DEFAULT 1 NOT NULL,
"equipment" uuid NOT NULL,
"stats" uuid NOT NULL,
"skills" uuid NOT NULL,
"spells" uuid NOT NULL,
"inventory" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_companion_npcs_idx_equipment" on "player_companion_npcs" ("equipment");
CREATE INDEX "player_companion_npcs_idx_inventory" on "player_companion_npcs" ("inventory");
CREATE INDEX "player_companion_npcs_idx_owner" on "player_companion_npcs" ("owner");
CREATE INDEX "player_companion_npcs_idx_skills" on "player_companion_npcs" ("skills");
CREATE INDEX "player_companion_npcs_idx_spells" on "player_companion_npcs" ("spells");
CREATE INDEX "player_companion_npcs_idx_stats" on "player_companion_npcs" ("stats");
;
--
-- Table: player_pjs_flags
--
CREATE TABLE "player_pjs_flags" (
"name" text NOT NULL,
"owner" uuid NOT NULL,
PRIMARY KEY ("name", "owner")
);
CREATE INDEX "player_pjs_flags_idx_owner" on "player_pjs_flags" ("owner");
CREATE INDEX "index_flag" on "player_pjs_flags" ("owner", "name");
;
--
-- Table: player_pjs_log
--
CREATE TABLE "player_pjs_log" (
"uuid" uuid NOT NULL,
"content" jsonb NOT NULL,
"owner" uuid NOT NULL,
"date" timestamp DEFAULT NOW() NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_pjs_log_idx_owner" on "player_pjs_log" ("owner");
CREATE INDEX "index_log" on "player_pjs_log" ("owner", "date");
;
--
-- Foreign Key Definitions
--
;
ALTER TABLE "equipment_items" ADD CONSTRAINT "equipment_items_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "inventory_items" ADD CONSTRAINT "inventory_items_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "skill_like_items" ADD CONSTRAINT "skill_like_items_fk_owner_list" FOREIGN KEY ("owner_list")
REFERENCES "skill_like_lists" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "teams" ADD CONSTRAINT "teams_fk_leader" FOREIGN KEY ("leader")
REFERENCES "player_pjs" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_born_stats" FOREIGN KEY ("born_stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_owner" FOREIGN KEY ("owner")
REFERENCES "players" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_skills" FOREIGN KEY ("skills")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_spells" FOREIGN KEY ("spells")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_team" FOREIGN KEY ("team")
REFERENCES "teams" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_training_stats" FOREIGN KEY ("training_stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_skills" FOREIGN KEY ("skills")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_spells" FOREIGN KEY ("spells")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_stats" FOREIGN KEY ("stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs_flags" ADD CONSTRAINT "player_pjs_flags_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs_log" ADD CONSTRAINT "player_pjs_log_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;

View File

@ -0,0 +1,18 @@
-- Convert schema '/home/sergio/LasTres/script/../dbicdh/_source/deploy/5/001-auto.yml' to '/home/sergio/LasTres/script/../dbicdh/_source/deploy/6/001-auto.yml':;
;
BEGIN;
;
ALTER TABLE inventory_items ADD CONSTRAINT inventory_items_unique_item UNIQUE (inventory, identifier);
;
ALTER TABLE teams ADD COLUMN is_exploring boolean DEFAULT false NOT NULL;
;
ALTER TABLE teams ADD COLUMN explore_frame integer DEFAULT 0 NOT NULL;
;
COMMIT;

View File

@ -0,0 +1,255 @@
-- Convert schema '/home/sergio/LasTres/script/../dbicdh/_source/deploy/6/001-auto.yml' to '/home/sergio/LasTres/script/../dbicdh/_source/deploy/7/001-auto.yml':;
;
BEGIN;
;
CREATE TABLE "equipment" (
"uuid" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
;
CREATE TABLE "equipment_items" (
"kind" text NOT NULL,
"equipment" uuid NOT NULL,
"identifier" text NOT NULL,
"quantity" integer NOT NULL,
PRIMARY KEY ("kind", "equipment")
);
CREATE INDEX "equipment_items_idx_equipment" on "equipment_items" ("equipment");
;
CREATE TABLE "inventories" (
"uuid" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
;
CREATE TABLE "inventory_items" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"inventory" uuid NOT NULL,
"identifier" text NOT NULL,
"quantity" integer NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "inventory_items_unique_item" UNIQUE ("inventory", "identifier")
);
CREATE INDEX "inventory_items_idx_inventory" on "inventory_items" ("inventory");
;
CREATE TABLE "player_companion_npcs" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"owner" uuid NOT NULL,
"identifier" text NOT NULL,
"nick" text,
"race" text NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
"exp" integer DEFAULT 1 NOT NULL,
"equipment" uuid NOT NULL,
"stats" uuid NOT NULL,
"skills" uuid NOT NULL,
"spells" uuid NOT NULL,
"inventory" uuid NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_companion_npcs_idx_equipment" on "player_companion_npcs" ("equipment");
CREATE INDEX "player_companion_npcs_idx_inventory" on "player_companion_npcs" ("inventory");
CREATE INDEX "player_companion_npcs_idx_owner" on "player_companion_npcs" ("owner");
CREATE INDEX "player_companion_npcs_idx_skills" on "player_companion_npcs" ("skills");
CREATE INDEX "player_companion_npcs_idx_spells" on "player_companion_npcs" ("spells");
CREATE INDEX "player_companion_npcs_idx_stats" on "player_companion_npcs" ("stats");
;
CREATE TABLE "player_pjs" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
"owner" uuid NOT NULL,
"full_name" text NOT NULL,
"short_name" text NOT NULL,
"nick" text NOT NULL,
"race" text NOT NULL,
"team" uuid NOT NULL,
"creation_date" timestamp DEFAULT NOW() NOT NULL,
"last_activity" timestamp DEFAULT NOW() NOT NULL,
"experience" integer DEFAULT 1 NOT NULL,
"equipment" uuid NOT NULL,
"born_stats" uuid NOT NULL,
"training_stats" uuid NOT NULL,
"skills" uuid NOT NULL,
"spells" uuid NOT NULL,
"inventory" uuid NOT NULL,
"health" integer NOT NULL,
"mana" integer NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_pjs_idx_born_stats" on "player_pjs" ("born_stats");
CREATE INDEX "player_pjs_idx_equipment" on "player_pjs" ("equipment");
CREATE INDEX "player_pjs_idx_inventory" on "player_pjs" ("inventory");
CREATE INDEX "player_pjs_idx_owner" on "player_pjs" ("owner");
CREATE INDEX "player_pjs_idx_skills" on "player_pjs" ("skills");
CREATE INDEX "player_pjs_idx_spells" on "player_pjs" ("spells");
CREATE INDEX "player_pjs_idx_team" on "player_pjs" ("team");
CREATE INDEX "player_pjs_idx_training_stats" on "player_pjs" ("training_stats");
;
CREATE TABLE "player_pjs_flags" (
"name" text NOT NULL,
"owner" uuid NOT NULL,
PRIMARY KEY ("name", "owner")
);
CREATE INDEX "player_pjs_flags_idx_owner" on "player_pjs_flags" ("owner");
CREATE INDEX "index_flag" on "player_pjs_flags" ("owner", "name");
;
CREATE TABLE "player_pjs_log" (
"uuid" uuid NOT NULL,
"content" jsonb NOT NULL,
"owner" uuid NOT NULL,
"date" timestamp DEFAULT NOW() NOT NULL,
PRIMARY KEY ("uuid")
);
CREATE INDEX "player_pjs_log_idx_owner" on "player_pjs_log" ("owner");
CREATE INDEX "index_log" on "player_pjs_log" ("owner", "date");
;
CREATE TABLE "players" (
"uuid" uuid NOT NULL,
"username" text NOT NULL,
"encrypted_password" text NOT NULL,
"email" text NOT NULL,
"verified" boolean NOT NULL,
"verification_token" text,
"register_date" timestamp DEFAULT NOW() NOT NULL,
"last_activity" timestamp DEFAULT NOW() NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "unique_constraint_email" UNIQUE ("email"),
CONSTRAINT "unique_constraint_username" UNIQUE ("username")
);
;
CREATE TABLE "skill_like_items" (
"identifier" text NOT NULL,
"owner_list" uuid NOT NULL,
"level" integer DEFAULT 1 NOT NULL,
PRIMARY KEY ("identifier", "owner_list")
);
CREATE INDEX "skill_like_items_idx_owner_list" on "skill_like_items" ("owner_list");
;
CREATE TABLE "skill_like_lists" (
"uuid" uuid DEFAULT uuid_generate_v4() NOT NULL,
PRIMARY KEY ("uuid")
);
;
CREATE TABLE "stats" (
"uuid" uuid NOT NULL,
"health" integer NOT NULL,
"mana" integer NOT NULL,
"strength" integer NOT NULL,
"resistance" integer NOT NULL,
"magic" integer NOT NULL,
"speed" integer NOT NULL,
"intelligence" integer NOT NULL,
PRIMARY KEY ("uuid")
);
;
CREATE TABLE "teams" (
"uuid" uuid NOT NULL,
"is_exploring" boolean DEFAULT false NOT NULL,
"explore_frame" integer DEFAULT 0 NOT NULL,
"leader" uuid,
"name" text NOT NULL,
"planet" text NOT NULL,
"super_area" text NOT NULL,
"area" text NOT NULL,
"location" text NOT NULL,
PRIMARY KEY ("uuid"),
CONSTRAINT "u_name" UNIQUE ("name")
);
CREATE INDEX "teams_idx_leader" on "teams" ("leader");
;
ALTER TABLE "equipment_items" ADD CONSTRAINT "equipment_items_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "inventory_items" ADD CONSTRAINT "inventory_items_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_skills" FOREIGN KEY ("skills")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_spells" FOREIGN KEY ("spells")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_companion_npcs" ADD CONSTRAINT "player_companion_npcs_fk_stats" FOREIGN KEY ("stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_born_stats" FOREIGN KEY ("born_stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_equipment" FOREIGN KEY ("equipment")
REFERENCES "equipment" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_inventory" FOREIGN KEY ("inventory")
REFERENCES "inventories" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_owner" FOREIGN KEY ("owner")
REFERENCES "players" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_skills" FOREIGN KEY ("skills")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_spells" FOREIGN KEY ("spells")
REFERENCES "skill_like_lists" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_team" FOREIGN KEY ("team")
REFERENCES "teams" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs" ADD CONSTRAINT "player_pjs_fk_training_stats" FOREIGN KEY ("training_stats")
REFERENCES "stats" ("uuid") DEFERRABLE;
;
ALTER TABLE "player_pjs_flags" ADD CONSTRAINT "player_pjs_flags_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "player_pjs_log" ADD CONSTRAINT "player_pjs_log_fk_owner" FOREIGN KEY ("owner")
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "skill_like_items" ADD CONSTRAINT "skill_like_items_fk_owner_list" FOREIGN KEY ("owner_list")
REFERENCES "skill_like_lists" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
;
ALTER TABLE "teams" ADD CONSTRAINT "teams_fk_leader" FOREIGN KEY ("leader")
REFERENCES "player_pjs" ("uuid") DEFERRABLE;
;
COMMIT;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -77,7 +77,7 @@ export default function Game (props: GameProps): JSX.Element {
}
return websocket
})
}, 500)
}, 100)
return (
<>
<UpperPanel teamPJs={teamPJs}

View File

@ -78,6 +78,7 @@ export default class InputPackets {
return
}
if (logPresentationRef.current === null) {
console.log('Not defined')
return
}
const logPresentation = logPresentationRef.current

View File

@ -1,5 +1,10 @@
package LasTres;
use v5.36.0;
use strict;
use warnings;
use Mojo::Base 'Mojolicious', -signatures;
# This method will run once at server start
@ -46,6 +51,10 @@ sub startup ($self) {
$r->post('/player/check_login')->to('Player#check_login');
$r->post('/pj/create')->to('PJ#create');;
$r->websocket('/ws')->to('Websocket#ws');
$self->hook(before_server_start => sub ($server, $self) {
require LasTres::EventLoop;
LasTres::EventLoop->new->loop;
});
}
1;

75
lib/LasTres/EventLoop.pm Normal file
View File

@ -0,0 +1,75 @@
package LasTres::EventLoop;
use v5.36.0;
use strict;
use warnings;
use feature 'signatures';
use Moo;
has _app => (
is => 'lazy'
);
has _schema => (
is => 'lazy'
);
has _redis => (
is => 'lazy'
);
sub _build__app {
require LasTres;
return LasTres->new;
}
sub _build__schema {
require LasTres::Schema;
return LasTres::Schema->Schema;
}
sub _build__redis {
require LasTres::Redis;
return LasTres::Redis->new;
}
sub _exit_the_program {
exit 0;
}
$SIG{CHLD} = 'IGNORE';
$SIG{INT} = \&_exit_the_program;
$SIG{QUIT} = \&_exit_the_program;
$SIG{TERM} = \&_exit_the_program;
sub loop($self) {
my $child_pid = fork;
if ($child_pid) {
$self->_real_loop;
}
}
sub _work_frame($self) {
my $schema = $self->_schema;
say 'Starting frame work.';
sleep int(rand(30));
say 'Ending frame work.';
}
sub _real_loop($self) {
my $redis = $self->_redis;
while (1) {
if (!defined $redis->db->get($redis->executing_frame_key)) {
$redis->db->setex($redis->executing_frame_key, 10, 1);
$self->_work_frame;
}
my $ttl = $redis->db->ttl($redis->executing_frame_key);
if ($ttl > 0) {
sleep $ttl;
}
}
}
1;

View File

@ -40,4 +40,7 @@ sub publish($self, $topic, $message) {
sub pj_subscription($class, $pj) {
return prefix() . '::Subscriptions::PJ::' . $pj->uuid;
}
sub executing_frame_key($class) {
return prefix() . '::Key::Frame';
}
1;

View File

@ -16,6 +16,16 @@ __PACKAGE__->add_columns(
data_type => 'uuid',
is_nullable => 0,
},
is_exploring => {
data_type => 'boolean',
is_nullable => 0,
default_value => \'false',
},
explore_frame => {
data_type => 'integer',
is_nullable => 0,
default_value => \'0',
},
leader => {
data_type => 'uuid',
is_nullable => 1,

BIN
public/img/devota.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,7 @@
#!/usr/bin/env perl
use v5.36.0;
use strict;
use warnings;