Games-Axmud
view release on metacpan or search on metacpan
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
foreach my $winmapObj (values %hash) {
$client->add_winmap($winmapObj);
}
}
# Incorporate colour schemes
%hash = %{$loadHash{'colour_scheme_hash'}};
if (%hash) {
foreach my $obj (values %hash) {
$client->add_colourScheme($obj);
}
}
# (Calls to accessors will have set the right ->modifyFlag values)
}
} elsif ($self->fileType eq 'tts') {
# 'tts'
# (T) All existing data in memory replaced by loaded data
# (F) Loaded data incorporated into memory
if ($overWriteFlag) {
# Replace the data in memory
$client->ivPoke('ttsObjHash', %{$loadHash{'tts_obj_hash'}});
# The data in memory matches saved data files
$self->set_modifyFlag(FALSE, $self->_objClass . '->extractData');
} else {
# We are loading one or more global TTS objects that have been exported and
# must be re-incorporated into memory
# Incorporate TTS objects
%hash = %{$loadHash{'tts_obj_hash'}};
if (%hash) {
foreach my $ttsObj (values %hash) {
$client->add_ttsObj($ttsObj);
}
}
# (Calls to accessors will have set the right ->modifyFlag values)
}
}
# Update the loaded data from previous versions of Axmud to conform to the current version
# of Axmud
$self->updateExtractedData();
# Return the file type
return $loadHash{'file_type'};
}
sub updateExtractedData {
# Called by $self->extractData (also called by GA::Profile::World->mergeData at the end of
# an ';updateworld' operation)
# Data loaded from previous versions of Axmud may be incompatible with the present version.
# Update the loaded data, as and where necessary
# NB Some data is also updated by $self->updateDataAfterRename
#
# Expected arguments
# (none besides $self)
#
# Optional arguments
# $version - When called by $self->extractData, the extracted data belongs to the Axmud
# version stored in $self->scriptConvertVersion, and this argument is
# 'undef'. When called by GA::Profile::World->mergeData, this argument is
# set to the Axmud version of the imported data's file (in the same
# format)
#
# Return values
# 'undef' on improper arguments
# 1 otherwise
my ($self, $version, $check) = @_;
# Local variables
my $wmObj;
# Check for improper arguments
if (defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->updateExtractedData', @_);
}
if (! defined $version) {
# This function called by $self->extractData
$version = $self->scriptConvertVersion;
}
### worldprof / otherprof #################################################################
if ($self->fileType eq 'worldprof' || $self->fileType eq 'otherprof') {
if ($version < 1_000_029 && $self->session) {
# Update every command cage with new standard commands
foreach my $cage ($self->session->ivValues('cageHash')) {
if ($cage->{cageType} eq 'cmd') {
if (! $cage->ivExists('cmdHash', 'short_look')) {
$cage->ivAdd('cmdHash', 'short_look', 'l');
}
if (! $cage->ivExists('cmdHash', 'short_glance')) {
$cage->ivAdd('cmdHash', 'short_glance', 'gl');
}
}
}
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
} elsif (ref ($item) eq 'ARRAY') {
$result = $self->globTest_list($count, $item);
} else {
$result = TRUE;
}
if (! $result) {
return undef;
}
}
return 1;
}
sub globTest_hash {
# Called by $self->globTest or recursively by this function and/or $self->globTest_list
my ($self, $count, $hashRef) = @_;
$count++;
if ($count >= 50) {
# Likely infinite recursion; give up
return undef;
}
foreach my $key (keys %$hashRef) {
my ($value, $column, $result);
$value = $$hashRef{$key};
$column = " " x $count;
if (defined $value) {
print "$column key $key value $value\n";
} else {
print "$column key $key value <undef>\n";
}
if (ref ($value) eq 'HASH' || ref ($value) =~ m/Axmud\:\:/) {
$result = $self->globTest_hash($count, $value);
} elsif (ref ($value) eq 'ARRAY') {
$result = $self->globTest_list($count, $value);
} else {
$result = TRUE;
}
if (! $result) {
return undef;
}
}
return 1;
}
# Client-renaming operations
sub updateHeaderAfterRename {
# In version v1.0.868, the client was renamed to Axmud, and ABasic was renamed to Axbasic.
# Some internal data structures were also renamed
# This function is called by $self->loadDataFile and ->importDataFile to update the file's
# header data (the remaining data is update by the call to $self->updateDataAfterRename
# Also called by GA::Client->copyPreConfigWorlds
#
# This code will probably be moved to an optional plugin at some point in the future
#
# Expected arguments
# %loadHash - A hash of data that's just been loaded from this data file, before it has
# been extracted and stored in memory
#
# Return values
# %loadHash, which has been updated (or not) as required
my ($self, %loadHash) = @_;
# (no improper arguments to check)
if (exists $loadHash{'file_type'}) {
if ($loadHash{'file_type'} eq 'worlddefn') {
$loadHash{'file_type'} = 'worldprof';
} elsif ($loadHash{'file_type'} eq 'otherdefn') {
$loadHash{'file_type'} = 'otherprof';
}
}
if (exists $loadHash{'assoc_world_defn'}) {
$loadHash{'assoc_world_prof'} = $loadHash{'assoc_world_defn'};
delete $loadHash{'assoc_world_defn'};
}
return %loadHash;
}
sub updateDataAfterRename {
# In version v1.0.868, the client was renamed to Axmud, and ABasic was renamed to Axbasic.
# Some internal data structures were also renamed
# This function is called by $self->extractData to update the file's data (not including the
# header data, which was updated in the earlier call to $self->updateHeaderAfterRename)
# This code will probably be moved to an optional plugin at some point in the future
#
# Expected arguments
# %loadHash - A hash of data that's just been loaded from this data file, before it has
# been extracted and stored in memory
#
# Return values
# %loadHash, which has been updated (or not) as required
my ($self, %loadHash) = @_;
# Local variables
my ($obj, $hashRef, $subHashRef);
# (no improper arguments to check)
if ($self->fileType eq 'worldprof') {
if (exists $loadHash{'world_defn'}) {
$loadHash{'world_prof'} = $loadHash{'world_defn'};
delete $loadHash{'world_defn'};
}
if (exists $loadHash{'world_prof'}) {
$loadHash{'world_prof'} = $self->update_profile_world($loadHash{'world_prof'});
}
} elsif ($self->fileType eq 'otherprof') {
if (exists $loadHash{'defn_priority_list'}) {
$loadHash{'prof_priority_list'} = $loadHash{'defn_priority_list'};
delete $loadHash{'defn_priority_list'};
}
if (exists $loadHash{'defn_hash'}) {
$loadHash{'prof_hash'} = $loadHash{'defn_hash'};
delete $loadHash{'defn_hash'};
}
# no update required for 'prof_priority_list'
if (exists $loadHash{'skeleton_hash'}) {
$hashRef = $loadHash{'skeleton_hash'};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_profile_template($$hashRef{$key});
}
$loadHash{'template_hash'} = $hashRef;
delete $loadHash{'skeleton_hash'};
lib/Games/Axmud/Obj/File.pm view on Meta::CPAN
if (exists $loadHash{'winmap_hash'}) {
$hashRef = $loadHash{'winmap_hash'};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_winmap($$hashRef{$key});
}
$loadHash{'winmap_hash'} = $hashRef;
}
# ($subHashRef represents a subset of key-value pairs in $hashRef)
if (exists $loadHash{'standard_winmap_hash'}) {
$subHashRef = $loadHash{'standard_winmap_hash'};
foreach my $key (keys %$subHashRef) {
# If the winmap is missing from GA::Client->winmapHash (for some reason),
# don't let it be added to GA::Client->standardWinmapHash
if (exists $$hashRef{$key}) {
$$subHashRef{$key} = $$hashRef{$key};
}
}
$loadHash{'standard_winmap_hash'} = $subHashRef;
}
if (exists $loadHash{'colour_scheme_hash'}) {
$hashRef = $loadHash{'colour_scheme_hash'};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_colourscheme($$hashRef{$key});
}
$loadHash{'colour_scheme_hash'} = $hashRef;
}
} elsif ($self->fileType eq 'tts') {
if (exists $loadHash{'tts_obj_hash'}) {
$hashRef = $loadHash{'tts_obj_hash'};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_tts($$hashRef{$key});
}
$loadHash{'tts_obj_hash'} = $hashRef;
}
}
# Mark this data file as needing to be saved, whether the data it contains has actually been
# updated or not
$self->ivPoke('modifyFlag', TRUE);
return %loadHash;
}
sub update_cage_all {
# Called by $self->updateDataAfterRename
# Converts AMud::Templ::XXX > Games::Axmud::Cage::XXX
# Converts AMud::MaskTempl::XXX > Games::Axmud::CageMask::XXX
my ($self, $obj) = @_;
# Local variables
my ($class, $flag, $hashRef);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Templ\:\:/) {
$class =~ s/^AMud\:\:Templ/Games::Axmud::Cage/;
$flag = TRUE;
} elsif ($class =~ m/^AMud\:\:MaskTempl\:\:/) {
$class =~ s/^AMud\:\:MaskTempl/Games::Axmud::CageMask/;
$flag = TRUE;
}
# Updated ->_objName
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
if ($flag) {
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'otherprof')
if ($obj->{_parentFile} && $obj->{_parentFile} eq 'otherdefn') {
$obj->{_parentFile} = 'otherprof';
}
# Update IVs
if ($class =~ m/Route$/) {
$hashRef = $obj->{routeHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_route($$hashRef{$key});
}
$obj->{routeHash} = $hashRef;
} elsif ($class =~ m/(Trigger|Alias|Macro|Timer|Hook)$/) {
$hashRef = $obj->{interfaceHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_interface_all($$hashRef{$key});
}
$obj->{interfaceHash} = $hashRef;
}
$obj->{cageType} = $obj->{templType};
delete $obj->{templType};
$obj->{profName} = $obj->{defnName};
delete $obj->{defnName};
$obj->{profCategory} = $obj->{defnCategory};
delete $obj->{defnCategory};
# Update @ISA
if ($class =~ m/(Cmd|Route)$/) {
@obj::ISA = qw(Games::Axmud::Generic::Cage Games::Axmud);
} else {
@obj::ISA = qw(
Games::Axmud::Generic::InterfaceCage Games::Axmud::Generic::Cage
Games::Axmud
);
}
}
return $obj;
}
sub update_interface_all {
# Called by $self->updateDataAfterRename
# Converts AMud::Interface::XXX > Games::Axmud::Interface:::XXX
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Interface\:\:/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'undef')
# Update IVs
$obj->{assocProf} = $obj->{assocDefn};
delete $obj->{assocDefn};
$obj->{assocProfCategory} = $obj->{assocDefnCategory};
delete $obj->{assocDefnCategory};
# Update @ISA
@obj::ISA = qw(Games::Axmud::Generic::Interface Games::Axmud);
}
return $obj;
}
sub update_modelobj_all {
# Called by $self->updateDataAfterRename
# Converts AMud::ModelObj::Region > Games::Axmud::ModelObj::Region, etc
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:ModelObj\:\:/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'undef' or 'worldmodel')
# (No IVs to update)
# Games::Axmud::ModelObj::Region->regionmapObj is handled by ->update_obj_world_model
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_chat_contact {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::ChatContact > Games::Axmud::Obj::ChatContact
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:ChatContact/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'contacts')
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_component {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Component > Games::Axmud::Obj::Component
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Component/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is world name)
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_colourscheme {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::ColourScheme > Games::Axmud::Obj::ColourScheme
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:ColourScheme/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'winmaps')
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_dict {
# Called by $self->updateDataAfterRename (and also by GA::Client->copyPreConfigWorlds)
# Converts AMud::Obj::Dict > Games::Axmud::Obj::Dict
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Dict/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'dicts')
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_exit {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Exit > Games::Axmud::Obj::Exit
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Exit/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'undef' or 'worldmodel')
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_maplabel {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::MapLabel > Games::Axmud::Obj::MapLabel
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:MapLabel/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'worldmodel')
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_mission {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Mission > Games::Axmud::Obj::Mission
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Mission/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is world name)
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_monitor {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Monitor > Games::Axmud::Obj::Monitor
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Monitor/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'otherprof')
if ($obj->{_parentFile} && $obj->{_parentFile} eq 'otherdefn') {
$obj->{_parentFile} = 'otherprof';
}
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_protect {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Protect > Games::Axmud::Obj::Protect
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Protect/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'otherprof')
if ($obj->{_parentFile} && $obj->{_parentFile} eq 'otherdefn') {
$obj->{_parentFile} = 'otherprof';
}
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_quest {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Quest > Games::Axmud::Obj::Quest
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Quest/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is world name)
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_regionmap {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Regionmap > Games::Axmud::Obj::Regionmap
my ($self, $obj) = @_;
# Local variables
my ($class, $hashRef, $pathHashRef);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Regionmap/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'worldmodel')
# Update IVs
$hashRef = $obj->{gridLabelHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_maplabel($$hashRef{$key});
}
$obj->{gridLabelHash} = $hashRef;
$pathHashRef = $obj->{regionPathHash};
foreach my $key (keys %$pathHashRef) {
$$pathHashRef{$key} = $self->update_obj_regionpath($$pathHashRef{$key});
}
$obj->{regionPathHash} = $pathHashRef;
$hashRef = $obj->{safeRegionPathHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $$pathHashRef{$key};
}
$obj->{safeRegionPathHash} = $pathHashRef;
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_regionpath {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::RegionPath > Games::Axmud::Obj::RegionPath
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:RegionPath/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'worldmodel')
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_route {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Route > Games::Axmud::Obj::Route
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Route/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'otherprof')
if ($obj->{_parentFile} && $obj->{_parentFile} eq 'otherdefn') {
$obj->{_parentFile} = 'otherprof';
}
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_skillhistory {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::SkillHistory > Games::Axmud::Obj::SkillHistory
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:SkillHistory/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'otherprof')
if ($obj->{_parentFile} && $obj->{_parentFile} eq 'otherdefn') {
$obj->{_parentFile} = 'otherprof';
}
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_toolbar {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Toolbar > Games::Axmud::Obj::Toolbar
my ($self, $obj) = @_;
# Local variables
my ($class, $instruct);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Toolbar/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'toolbar')
# Update IVs. Many ->instruct values are client commands; convert any client commands
# that are used with a default Axmud installation
$instruct = $obj->{instruct};
$instruct =~ s/^\;edittemplate\s/;editcage/;
$obj->{instruct} = $instruct;
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_tts {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Tts > Games::Axmud::Obj::Tts
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Tts/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'tts')
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_winmap {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Winmap > Games::Axmud::Obj::Winmap
my ($self, $obj) = @_;
# Local variables
my (
$class, $listRef, $hashRef,
@list,
);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Winmap/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'winmaps')
# Update IVs
$hashRef = $obj->{zoneHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_winzone($$hashRef{$key}, $obj);
}
$obj->{zoneHash} = $hashRef;
$listRef = $obj->{stripInitList};
if (@$listRef) {
do {
my ($string, $hashRef);
$string = shift @$listRef;
$hashRef = shift @$listRef;
$string =~ s/^AMud/Games::Axmud/;
push (@list, $string, $hashRef);
} until (! @$listRef);
$obj->{stripInitList} = \@list;
}
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_winzone {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Winzone > Games::Axmud::Obj::Winzone
my ($self, $obj, $parent) = @_;
# Local variables
my ($class, $string);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Winzone/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'winmaps')
# Update IVs
if (defined $parent) {
$obj->{winmapObj} = $parent;
}
if (defined $obj->{packageName}) {
$string = $obj->{packageName};
$string =~ s/^AMud/Games::Axmud/;
$obj->{packageName} = $string;
}
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_world_model {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::WorldModel > Games::Axmud::Obj::WorldModel
my ($self, $obj) = @_;
# Local variables
my ($class, $flag, $hashRef, $modelHashRef, $mapHashRef);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud:\:WorldModel/) {
$class =~ s/^AMud/Games::Axmud::Obj/;
$flag = TRUE;
} elsif ($class =~ m/^AMud\:\:Obj\:\:WorldModel/) {
$class =~ s/^AMud/Games::Axmud/;
$flag = TRUE;
}
if ($flag) {
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'worldmodel')
# Update IVs
$modelHashRef = $obj->{model};
foreach my $key (keys %$modelHashRef) {
$$modelHashRef{$key} = $self->update_modelobj_all($$modelHashRef{$key});
}
$obj->{model} = $modelHashRef;
my @ivList = qw(
regionModel roomModel weaponModel armourModel garmentModel charModel minionModel
sentientModel creatureModel portableModel decorationModel customModel
);
foreach my $iv (@ivList) {
my $subHashRef = $obj->{$iv};
foreach my $key (keys %$subHashRef) {
$$subHashRef{$key} = $$modelHashRef{$key};
}
$obj->{$iv} = $subHashRef;
}
$hashRef = $obj->{exitModel};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_exit($$hashRef{$key});
}
$obj->{exitModel} = $hashRef;
$mapHashRef = $obj->{regionmapHash};
foreach my $key (keys %$mapHashRef) {
$$mapHashRef{$key} = $self->update_obj_regionmap($$mapHashRef{$key});
}
$obj->{regionmapHash} = $mapHashRef;
# (We can now do Games::Axmud::ModelObj::Room->regionmapObj)
$hashRef = $obj->{regionModel};
foreach my $thisObj (values %$hashRef) {
$thisObj->{regionmapObj} = $$mapHashRef{$thisObj->{name}};
}
$hashRef = $obj->{knownCharHash};
foreach my $key (keys %$hashRef) {
my $oldObj = $$hashRef{$key};
$$hashRef{$key} = $$modelHashRef{$oldObj->{number}};
}
$obj->{knownCharHash} = $hashRef;
$hashRef = $obj->{minionStringHash};
foreach my $key (keys %$hashRef) {
my $oldObj = $$hashRef{$key};
# Values in this hash can be model or non-model objects
if (defined $oldObj->{number}) {
# Model object
$$hashRef{$key} = $$modelHashRef{$oldObj->{number}};
} else {
# Non-model object
$$hashRef{$key} = $self->update_modelobj_all($oldObj);
}
}
$obj->{minionStringHash} = $hashRef;
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_obj_zone_model {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::ZoneModel > Games::Axmud::Obj::ZoneModel
my ($self, $obj, $parent) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:ZoneModel/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'zonemaps')
# Update IVs
if (defined $parent) {
$obj->{zonemapObj} = $parent;
}
}
# Update @ISA
@obj::ISA = qw(Games::Axmud);
return $obj;
}
sub update_obj_zonemap {
# Called by $self->updateDataAfterRename
# Converts AMud::Obj::Zonemap > Games::Axmud::Obj::Zonemap
my ($self, $obj) = @_;
# Local variables
my ($class, $hashRef);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Obj\:\:Zonemap/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'zonemaps')
# Update IVs
$hashRef = $obj->{modelHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_zone_model($$hashRef{$key}, $obj);
}
$obj->{modelHash} = $hashRef;
# Just to be safe
$obj->{tempSession} = undef;
# Update @ISA
@obj::ISA = qw(Games::Axmud);
}
return $obj;
}
sub update_profile_world {
# Called by $self->updateDataAfterRename
# Converts Converts AMud::Defn::World > Games::Axmud::Profile::World
my ($self, $obj) = @_;
# Local variables
my ($class, $hashRef);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Defn\:\:World/) {
$class =~ s/^AMud\:\:Defn/Games::Axmud::Profile/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is world name)
# Update IVs
$hashRef = $obj->{initTaskHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_task_all($$hashRef{$key});
}
$obj->{initTaskHash} = $hashRef;
$hashRef = $obj->{missionHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_mission($$hashRef{$key});
}
$obj->{missionHash} = $hashRef;
$hashRef = $obj->{questHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_quest($$hashRef{$key});
}
$obj->{questHash} = $hashRef;
$hashRef = $obj->{componentHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_obj_component($$hashRef{$key});
}
$obj->{componentHash} = $hashRef;
$obj->{profName} = $obj->{defnName};
delete $obj->{defnName};
$obj->{profCategory} = $obj->{defnCategory};
delete $obj->{defnCategory};
$obj->{profSensitivityFlag} = $obj->{defnSensitivityFlag};
delete $obj->{defnSensitivityFlag};
$obj->{profHash} = $obj->{defnHash};
delete $obj->{defnHash};
# Update @ISA
@obj::ISA = qw(Games::Axmud::Generic::Profile Games::Axmud);
}
return $obj;
}
sub update_profile_other {
# Called by $self->updateDataAfterRename
# Converts AMud::Defn::XXX > Games::Axmud::Profile::XXX
my ($self, $obj) = @_;
# Local variables
my (
$class, $listRef, $hashRef,
@list, @list2, @list3,
);
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Defn\:\:/) {
$class =~ s/^AMud\:\:Defn/Games::Axmud::Profile/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'otherprof')
if ($obj->{_parentFile} && $obj->{_parentFile} eq 'otherdefn') {
$obj->{_parentFile} = 'otherprof';
}
# Update IVs
$hashRef = $obj->{initTaskHash};
foreach my $key (keys %$hashRef) {
$$hashRef{$key} = $self->update_task_all($$hashRef{$key});
}
$obj->{initTaskHash} = $hashRef;
if ($class =~ m/Char$/) {
$listRef = $obj->{skillHistoryList};
foreach my $thisObj (@$listRef) {
push (@list, $self->update_obj_skillhistory($thisObj));
}
$obj->{skillHistoryList} = \@list;
$listRef = $obj->{protectObjList};
foreach my $thisObj (@$listRef) {
push (@list2, $self->update_obj_protect($thisObj));
}
$obj->{protectObjList} = \@list2;
$listRef = $obj->{monitorObjList};
foreach my $thisObj (@$listRef) {
push (@list3, $self->update_obj_monitor($thisObj));
}
$obj->{monitorObjList} = \@list3;
}
$obj->{profName} = $obj->{defnName};
delete $obj->{defnName};
$obj->{profCategory} = $obj->{defnCategory};
delete $obj->{defnCategory};
$obj->{profSensitivityFlag} = $obj->{defnSensitivityFlag};
delete $obj->{defnSensitivityFlag};
if ($class =~ m/Char$/) {
$obj->{customProfHash} = $obj->{customDefnHash};
delete $obj->{customDefnHash};
}
# Update @ISA
@obj::ISA = qw(Games::Axmud::Generic::Profile Games::Axmud);
}
return $obj;
}
sub update_profile_template {
# Called by $self->updateDataAfterRename
# Converts AMud::Defn::Skeleton > Games::Axmud::Profile::Template
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Defn\:\:Skeleton/) {
$class =~ s/^AMud\:\:Defn\:\:Skeleton/Games::Axmud::Profile::Template/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'otherprof')
if ($obj->{_parentFile} && $obj->{_parentFile} eq 'otherdefn') {
$obj->{_parentFile} = 'otherprof';
}
# (No IVs to update)
# Update @ISA
@obj::ISA = qw(Games::Axmud::Generic::Profile Games::Axmud);
}
return $obj;
}
sub update_task_all {
# Called by $self->updateDataAfterRename
# Converts AMud::Task::XXX > Games::Axmud::Task::XXX
my ($self, $obj) = @_;
# Local variables
my $class;
# (no improper arguments to check)
# Update class
$class = ref $obj;
if ($class =~ m/^AMud\:\:Task\:\:/) {
$class =~ s/^AMud/Games::Axmud/;
bless $obj, $class;
$obj->{_objClass} = $class;
$obj->{_objName} = $obj->{_name};
delete $obj->{_name};
# (->_parentFile is 'undef')
# Update IVs
if (exists $obj->{ttsProfile}) {
$obj->{ttsConfig} = $obj->{ttsProfile};
delete $obj->{ttsProfile};
}
if ($obj->{name} eq 'notepad_task') {
$obj->{profNoteHash} = $obj->{defnNoteHash};
delete $obj->{defnNoteHash};
}
# Update @ISA
@obj::ISA = qw(Games::Axmud::Generic::Task Games::Axmud);
}
return $obj;
}
##################
# Accessors - set
sub set_modifyFlag {
# NB The calling function, $func, is disregarded if specified
my ($self, $flag, $func, $check) = @_;
# Check for improper arguments
if (! defined $flag || defined $check) {
return $axmud::CLIENT->writeImproper($self->_objClass . '->set_modifyFlag', @_);
}
if ($flag) {
( run in 1.516 second using v1.01-cache-2.11-cpan-d8267643d1d )