Adding preliminar Chaman.
This commit is contained in:
parent
f124fcd2f8
commit
8690a94b3a
351
dbicdh/PostgreSQL/deploy/14/001-auto.sql
Normal file
351
dbicdh/PostgreSQL/deploy/14/001-auto.sql
Normal file
@ -0,0 +1,351 @@
|
||||
--
|
||||
-- Created by SQL::Translator::Producer::PostgreSQL
|
||||
-- Created on Sat Jul 22 15:00:23 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,
|
||||
"action_frame" integer DEFAULT 0 NOT NULL,
|
||||
"is_moving" boolean DEFAULT false NOT NULL,
|
||||
"last_spawn" jsonb DEFAULT 'null' NOT NULL,
|
||||
"moving_to" jsonb DEFAULT 'null' 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,
|
||||
"current_battle" uuid,
|
||||
PRIMARY KEY ("uuid")
|
||||
);
|
||||
CREATE INDEX "teams_idx_leader" on "teams" ("leader");
|
||||
|
||||
;
|
||||
--
|
||||
-- Table: player_pjs
|
||||
--
|
||||
CREATE TABLE "player_pjs" (
|
||||
"uuid" uuid 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,
|
||||
"combat_target" uuid,
|
||||
"combat_action" text,
|
||||
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_known_places
|
||||
--
|
||||
CREATE TABLE "player_pjs_known_places" (
|
||||
"owner" uuid NOT NULL,
|
||||
"planet" text NOT NULL,
|
||||
"super_area" text NOT NULL,
|
||||
"area" text NOT NULL,
|
||||
"location" text NOT NULL,
|
||||
PRIMARY KEY ("owner", "planet", "super_area", "area", "location")
|
||||
);
|
||||
CREATE INDEX "player_pjs_known_places_idx_owner" on "player_pjs_known_places" ("owner");
|
||||
|
||||
;
|
||||
--
|
||||
-- Table: player_pjs_known_words
|
||||
--
|
||||
CREATE TABLE "player_pjs_known_words" (
|
||||
"identifier" text NOT NULL,
|
||||
"owner" uuid NOT NULL,
|
||||
PRIMARY KEY ("identifier", "owner")
|
||||
);
|
||||
CREATE INDEX "player_pjs_known_words_idx_owner" on "player_pjs_known_words" ("owner");
|
||||
CREATE INDEX "index_known_word" on "player_pjs_known_words" ("owner", "identifier");
|
||||
|
||||
;
|
||||
--
|
||||
-- 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");
|
||||
|
||||
;
|
||||
--
|
||||
-- Table: player_pjs_vars
|
||||
--
|
||||
CREATE TABLE "player_pjs_vars" (
|
||||
"name" text NOT NULL,
|
||||
"owner" uuid NOT NULL,
|
||||
"value" text NOT NULL,
|
||||
PRIMARY KEY ("name", "owner")
|
||||
);
|
||||
CREATE INDEX "player_pjs_vars_idx_owner" on "player_pjs_vars" ("owner");
|
||||
CREATE INDEX "index_var" on "player_pjs_vars" ("owner", "name");
|
||||
|
||||
;
|
||||
--
|
||||
-- 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_known_places" ADD CONSTRAINT "player_pjs_known_places_fk_owner" FOREIGN KEY ("owner")
|
||||
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
|
||||
|
||||
;
|
||||
ALTER TABLE "player_pjs_known_words" ADD CONSTRAINT "player_pjs_known_words_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 "player_pjs_vars" ADD CONSTRAINT "player_pjs_vars_fk_owner" FOREIGN KEY ("owner")
|
||||
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
|
||||
|
||||
;
|
23
dbicdh/PostgreSQL/upgrade/13-14/001-auto.sql
Normal file
23
dbicdh/PostgreSQL/upgrade/13-14/001-auto.sql
Normal file
@ -0,0 +1,23 @@
|
||||
-- Convert schema '/var/lib/las_tres/LasTres/script/../dbicdh/_source/deploy/13/001-auto.yml' to '/var/lib/las_tres/LasTres/script/../dbicdh/_source/deploy/14/001-auto.yml':;
|
||||
|
||||
;
|
||||
BEGIN;
|
||||
|
||||
;
|
||||
CREATE TABLE "player_pjs_vars" (
|
||||
"name" text NOT NULL,
|
||||
"owner" uuid NOT NULL,
|
||||
"value" text NOT NULL,
|
||||
PRIMARY KEY ("name", "owner")
|
||||
);
|
||||
CREATE INDEX "player_pjs_vars_idx_owner" on "player_pjs_vars" ("owner");
|
||||
CREATE INDEX "index_var" on "player_pjs_vars" ("owner", "name");
|
||||
|
||||
;
|
||||
ALTER TABLE "player_pjs_vars" ADD CONSTRAINT "player_pjs_vars_fk_owner" FOREIGN KEY ("owner")
|
||||
REFERENCES "player_pjs" ("uuid") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE;
|
||||
|
||||
;
|
||||
|
||||
COMMIT;
|
||||
|
1749
dbicdh/_source/deploy/14/001-auto.yml
Normal file
1749
dbicdh/_source/deploy/14/001-auto.yml
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,4 +14,11 @@ sub TALKED_WITH_OLD_MAN_AND_LEARNED_TO_SAY_DEVOTA {
|
||||
sub TALKED_FIRST_TIME_VETERANO_CALIZOR {
|
||||
return 'TALKED_FIRST_TIME_VETERANO_CALIZOR';
|
||||
}
|
||||
sub ASKED_FOR_DEVOTA_VETERANO_CALIZOR {
|
||||
return 'ASKED_FOR_DEVOTA_VETERANO_CALIZOR';
|
||||
}
|
||||
|
||||
sub TEMPORAL_HAS_PRAYED {
|
||||
return 'TEMPORAL_HAS_PRAYED';
|
||||
}
|
||||
1;
|
||||
|
@ -135,10 +135,19 @@ sub show_intro ( $self, $pj ) {
|
||||
$pj->append_log_line( [ { text => $pj->location->description }, ] );
|
||||
}
|
||||
|
||||
## OVERRIDE (Always use $self->SUPER)
|
||||
sub on_leave($self, $team) {
|
||||
require LasTres::Vars;
|
||||
for my $member ($team->members) {
|
||||
$member->clear_var(LasTres::Vars::LOCATION_TEMPORAL());
|
||||
}
|
||||
}
|
||||
|
||||
## DO NOT EXTEND NOT SUPPORTED.
|
||||
sub move ( $self, $team ) {
|
||||
$team = $team->get_from_storage;
|
||||
my $current_location = $team->location;
|
||||
$current_location->on_leave($team);
|
||||
my $json_array_until_area_current_location =
|
||||
to_json( [ $current_location->to_array->@[ 0 .. 2 ] ] );
|
||||
my $json_array_until_area_destination =
|
||||
|
54
lib/LasTres/PJAction/RezarAyazelTribuDeLaLima.pm
Normal file
54
lib/LasTres/PJAction/RezarAyazelTribuDeLaLima.pm
Normal file
@ -0,0 +1,54 @@
|
||||
package LasTres::PJAction::RezarAyazelTribuDeLaLima;
|
||||
|
||||
use v5.36.0;
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
use feature 'signatures';
|
||||
|
||||
use Moo;
|
||||
|
||||
with 'LasTres::PJAction';
|
||||
|
||||
## DO NOT EXTEND NOT SUPPORTED.
|
||||
|
||||
sub name {
|
||||
return 'Rezar a Ayazel en la estatua.';
|
||||
}
|
||||
|
||||
sub identifier {
|
||||
return 'rezar_a_ayazel_tribu_de_la_lima';
|
||||
}
|
||||
|
||||
sub is_disabled ( $self, $pj ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub disabled_reason ( $self, $pj ) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub callback ( $self, $pj ) {
|
||||
$pj = $pj->get_from_storage;
|
||||
my $team = $pj->team;
|
||||
$pj->mana($pj->max_mana);
|
||||
$pj->update;
|
||||
$team->append_log_line(
|
||||
[
|
||||
{
|
||||
text => $pj->nick,
|
||||
color => 'green',
|
||||
},
|
||||
{
|
||||
text => ' ha rezado y ya puede hablar con el chamán.'
|
||||
}
|
||||
]
|
||||
);
|
||||
$pj->set_location_flag(LasTres::Flags::TEMPORAL_HAS_PRAYED());
|
||||
for my $member ($team->members) {
|
||||
$member->update_team_sprites;
|
||||
$member->update_actions;
|
||||
}
|
||||
}
|
||||
1;
|
@ -0,0 +1,69 @@
|
||||
package LasTres::Planet::Bahdder::BosqueDelHeroe::TribuDeLaLima::TemploDeAyazel;
|
||||
|
||||
use v5.36.0;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use feature 'signatures';
|
||||
|
||||
use utf8;
|
||||
|
||||
use Moo;
|
||||
|
||||
use LasTres::Planet::Bahdder::BosqueDelHeroe::TribuDeLaLima;
|
||||
use LasTres::TalkingNPC::Chaman;
|
||||
use LasTres::PJAction::RezarAyazelTribuDeLaLima;
|
||||
|
||||
with 'LasTres::Location';
|
||||
|
||||
sub identifier {
|
||||
return 'templo_de_ayazel';
|
||||
}
|
||||
|
||||
sub name {
|
||||
return 'Templo de Ayazel';
|
||||
}
|
||||
|
||||
sub description ( $self, $pj = undef ) {
|
||||
return $self->first_description;
|
||||
}
|
||||
|
||||
sub first_description ($self) {
|
||||
return
|
||||
'En este templo construido en piedra se venera a Ayazel.'
|
||||
. ' Es el segundo edificio que se construyo en piedra en la tribu,'
|
||||
. ' una estatua de Ayazel con sus alas de ángel y su famoso báculo preside la única sala del templo.'
|
||||
. ' En el báculo se encuentra una pequeña piedra blanca metálica luminosa de la que emana un gran poder mágico.';
|
||||
}
|
||||
|
||||
sub parent {
|
||||
return LasTres::Planet::Bahdder::BosqueDelHeroe::TribuDeLaLima->instance;
|
||||
}
|
||||
|
||||
sub actions ( $self, $pj ) {
|
||||
return [ LasTres::PJAction::RezarAyazelTribuDeLaLima->new ];
|
||||
}
|
||||
|
||||
sub npcs ( $self, $pj ) {
|
||||
return [ LasTres::TalkingNPC::Chaman->instance ];
|
||||
}
|
||||
|
||||
sub connected_places {
|
||||
return [];
|
||||
}
|
||||
|
||||
my $singleton;
|
||||
|
||||
sub instance {
|
||||
my $class = shift;
|
||||
if ( !defined $singleton ) {
|
||||
$singleton = $class->new(@_);
|
||||
}
|
||||
return $singleton;
|
||||
}
|
||||
|
||||
sub is_spawn {
|
||||
return 0;
|
||||
}
|
||||
1;
|
@ -5,7 +5,7 @@ use v5.36.0;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $VERSION = 13;
|
||||
our $VERSION = 14;
|
||||
|
||||
use feature 'signatures';
|
||||
|
||||
|
@ -14,7 +14,7 @@ use UUID::URandom qw/create_uuid_string/;
|
||||
use List::AllUtils;
|
||||
use Data::Dumper;
|
||||
|
||||
use JSON qw/to_json/;
|
||||
use JSON qw/to_json from_json/;
|
||||
|
||||
use Moo;
|
||||
|
||||
@ -125,6 +125,7 @@ __PACKAGE__->has_many( 'logs', 'LasTres::Schema::Result::PJLog', 'owner' );
|
||||
__PACKAGE__->has_many( 'known_places',
|
||||
'LasTres::Schema::Result::PJKnownPlaces', 'owner' );
|
||||
__PACKAGE__->has_many( 'flags', 'LasTres::Schema::Result::PJFlag', 'owner' );
|
||||
__PACKAGE__->has_many( 'vars', 'LasTres::Schema::Result::PJVar', 'owner' );
|
||||
__PACKAGE__->has_many( 'known_words', 'LasTres::Schema::Result::PJKnownWord',
|
||||
'owner' );
|
||||
__PACKAGE__->belongs_to( 'born_stats', 'LasTres::Schema::Result::Stats' );
|
||||
@ -158,7 +159,7 @@ sub known_words_hash ($self) {
|
||||
return \%result_words;
|
||||
}
|
||||
|
||||
sub get_word($self, $word_identifier) {
|
||||
sub get_word ( $self, $word_identifier ) {
|
||||
return $self->known_words_hash->{$word_identifier};
|
||||
}
|
||||
|
||||
@ -469,6 +470,55 @@ sub location ($self) {
|
||||
return $self->team->location;
|
||||
}
|
||||
|
||||
sub get_var_json ( $self, $name ) {
|
||||
my $value_raw = $self->get_var($name);
|
||||
if ( !defined $value_raw ) {
|
||||
return;
|
||||
}
|
||||
my $value;
|
||||
eval { $value = from_json($value_raw); };
|
||||
if ($@) {
|
||||
warn $@;
|
||||
return;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
sub set_var_json ( $self, $name, $value ) {
|
||||
my $value_raw = to_json($value);
|
||||
$self->set_var( $name, $value_raw );
|
||||
}
|
||||
|
||||
sub _temporal_var_retrieve ( $self, $name ) {
|
||||
my $temporal = $self->get_var_json($name);
|
||||
if ( !defined $temporal ) {
|
||||
$temporal = {
|
||||
flags => {},
|
||||
vars => {}
|
||||
};
|
||||
}
|
||||
return $temporal;
|
||||
}
|
||||
|
||||
sub set_location_flag ( $self, $name ) {
|
||||
require LasTres::Vars;
|
||||
my $location_temporal =
|
||||
$self->_temporal_var_retrieve( LasTres::Vars::LOCATION_TEMPORAL() );
|
||||
$location_temporal->{flags}{$name} = $JSON::true;
|
||||
$self->set_var_json( LasTres::Vars::LOCATION_TEMPORAL(),
|
||||
$location_temporal );
|
||||
}
|
||||
|
||||
sub get_location_flag ( $self, $name ) {
|
||||
require LasTres::Vars;
|
||||
my $location_temporal =
|
||||
$self->_temporal_var_retrieve( LasTres::Vars::LOCATION_TEMPORAL() );
|
||||
if ( defined $location_temporal->{flags}{$name} ) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub set_flag ( $self, $name ) {
|
||||
require LasTres::Schema;
|
||||
my $schema = LasTres::Schema->Schema;
|
||||
@ -477,6 +527,25 @@ sub set_flag ( $self, $name ) {
|
||||
->update_or_insert;
|
||||
}
|
||||
|
||||
sub set_var ( $self, $name, $value ) {
|
||||
require LasTres::Schema;
|
||||
my $schema = LasTres::Schema->Schema;
|
||||
my $result_set_vars = $schema->resultset('PJVar');
|
||||
|
||||
my $var = $result_set_vars->new(
|
||||
{ name => $name, owner => $self->uuid, value => $value } );
|
||||
eval {
|
||||
$var->insert;
|
||||
};
|
||||
if ($@ && $@ =~ /duplicate/) {
|
||||
$var->update;
|
||||
undef $@;
|
||||
}
|
||||
if ($@) {
|
||||
warn $@;
|
||||
}
|
||||
}
|
||||
|
||||
sub get_flag ( $self, $name ) {
|
||||
my @flags = $self->flags->search( { name => $name } );
|
||||
if ( scalar @flags ) {
|
||||
@ -485,8 +554,20 @@ sub get_flag ( $self, $name ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub get_var ( $self, $name ) {
|
||||
my @vars = $self->vars->search( { name => $name } );
|
||||
if ( scalar @vars ) {
|
||||
return $vars[0]->value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sub clear_flag ( $self, $name ) {
|
||||
$self->flags->search( name => $name )->delete;
|
||||
$self->flags->search( { name => $name } )->delete;
|
||||
}
|
||||
|
||||
sub clear_var ( $self, $name ) {
|
||||
$self->vars->search( { name => $name } )->delete;
|
||||
}
|
||||
|
||||
sub health {
|
||||
|
40
lib/LasTres/Schema/Result/PJVar.pm
Normal file
40
lib/LasTres/Schema/Result/PJVar.pm
Normal file
@ -0,0 +1,40 @@
|
||||
package LasTres::Schema::Result::PJVar;
|
||||
|
||||
use v5.36.0;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use feature 'signatures';
|
||||
|
||||
use parent 'DBIx::Class::Core';
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
use Moo;
|
||||
|
||||
__PACKAGE__->table('player_pjs_vars');
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
name => {
|
||||
data_type => 'text',
|
||||
is_nullable => 0,
|
||||
},
|
||||
owner => {
|
||||
data_type => 'uuid',
|
||||
is_nullable => 0,
|
||||
is_foreign_key => 1,
|
||||
},
|
||||
value => {
|
||||
data_type => 'text',
|
||||
is_nullable => 0,
|
||||
},
|
||||
);
|
||||
|
||||
__PACKAGE__->set_primary_key( 'owner', 'name' );
|
||||
|
||||
__PACKAGE__->belongs_to( 'owner', 'LasTres::Schema::Result::PJ' );
|
||||
|
||||
sub sqlt_deploy_hook ( $self, $sqlt_table ) {
|
||||
$sqlt_table->add_index( name => 'index_var', fields => [qw/owner name/] );
|
||||
}
|
||||
1;
|
105
lib/LasTres/TalkingNPC/Chaman.pm
Normal file
105
lib/LasTres/TalkingNPC/Chaman.pm
Normal file
@ -0,0 +1,105 @@
|
||||
package LasTres::TalkingNPC::Chaman;
|
||||
|
||||
use v5.36.0;
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
use feature 'signatures';
|
||||
|
||||
use Moo;
|
||||
|
||||
use LasTres::Flags;
|
||||
use LasTres::Word::Devota;
|
||||
use LasTres::Word::Ayazel;
|
||||
|
||||
use parent 'LasTres::TalkingNPC';
|
||||
|
||||
sub talk ( $self, $pj, $word = undef ) {
|
||||
$self->SUPER::talk( $pj, $word );
|
||||
if (!$pj->get_flag(LasTres::Flags::ASKED_FOR_DEVOTA_VETERANO_CALIZOR)) {
|
||||
$self->send_response_dialog($pj, [
|
||||
{
|
||||
text => 'No tengo tiempo para esto, estoy preparando el '
|
||||
. 'ritual de esta noche.'
|
||||
}
|
||||
]);
|
||||
return;
|
||||
}
|
||||
if (!$pj->get_location_flag(LasTres::Flags::TEMPORAL_HAS_PRAYED)) {
|
||||
$self->send_response_dialog($pj, [
|
||||
{
|
||||
text => 'Recuerda que lo primero que tienes que hacer al entrar a'
|
||||
. ' este sitio sagrado es rezar a la diosa Ayazel.'
|
||||
. ' Lo que me quieras decir puede esperar hasta entonces.'
|
||||
}
|
||||
]);
|
||||
return;
|
||||
}
|
||||
if ( !defined $word ) {
|
||||
$self->wordlessly_talk($pj);
|
||||
return;
|
||||
}
|
||||
$self->word_talk($pj, $word);
|
||||
}
|
||||
|
||||
sub word_talk($self, $pj, $word) {
|
||||
require LasTres::Word::Devota;
|
||||
if ($word->identifier eq LasTres::Word::Devota->instance->identifier) {
|
||||
$self->word_devota($pj);
|
||||
return;
|
||||
}
|
||||
if ($word->identifier eq LasTres::Word::Ayazel->instance->identifier) {
|
||||
$self->word_ayazel($pj);
|
||||
return;
|
||||
}
|
||||
$self->word_unknown($pj);
|
||||
|
||||
}
|
||||
|
||||
sub word_devota($self, $pj) {
|
||||
...
|
||||
}
|
||||
|
||||
sub word_ayazel($self, $pj) {
|
||||
...
|
||||
}
|
||||
|
||||
sub word_unknown($self, $pj) {
|
||||
$self->send_response_dialog(
|
||||
$pj,
|
||||
[
|
||||
{
|
||||
text => 'Solo Ayazel sabe a que te refieres con eso.'
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
sub identifier {
|
||||
return 'chaman_tribu_de_la_lima';
|
||||
}
|
||||
|
||||
# sub icon {
|
||||
# return '/img/anciano.png';
|
||||
# }
|
||||
|
||||
sub name {
|
||||
return 'Chamán de Ayazel';
|
||||
}
|
||||
|
||||
sub verb ( $self, $pj ) {
|
||||
return 'susurra';
|
||||
}
|
||||
|
||||
sub wordlessly_talk ( $self, $pj ) {
|
||||
$self->send_response_dialog(
|
||||
$pj,
|
||||
[
|
||||
{
|
||||
text => 'Ayazel te protegerá en tu viaje por el bosque, me lo dijo en sueños hace 2 noches.'
|
||||
}
|
||||
]
|
||||
);
|
||||
}
|
||||
1;
|
@ -52,6 +52,7 @@ sub word_devota($self, $pj) {
|
||||
]
|
||||
);
|
||||
$pj->teach_word( LasTres::Word::Ayazel->instance );
|
||||
$pj->set_flag(LasTres::Flags::ASKED_FOR_DEVOTA_VETERANO_CALIZOR);
|
||||
}
|
||||
|
||||
sub word_ayazel($self, $pj) {
|
||||
|
11
lib/LasTres/Vars.pm
Normal file
11
lib/LasTres/Vars.pm
Normal file
@ -0,0 +1,11 @@
|
||||
package LasTres::Vars;
|
||||
|
||||
use v5.36.0;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub LOCATION_TEMPORAL {
|
||||
return 'LOCATION_TEMPORAL';
|
||||
}
|
||||
1;
|
Loading…
Reference in New Issue
Block a user