Class: GamesAndRpgParadise::Antamar::ConvertRandomEncounterIntoXML

Inherits:
Base
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/games/antamar/convert_random_encounter_into_XML.rb

Overview

GamesAndRpgParadise::Antamar::ConvertRandomEncounterIntoXML

Constant Summary collapse

N =
#

N

#
"\n"

Constants included from Base::Extensions::Colours

Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Constants included from CommonExtensions

CommonExtensions::CONTROL_C_CODE

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::Extensions::Colours

ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow

Methods included from Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ ConvertRandomEncounterIntoXML

#

initialize

#


30
31
32
33
34
35
36
37
38
39
# File 'lib/games_and_rpg_paradise/games/antamar/convert_random_encounter_into_XML.rb', line 30

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

GamesAndRpgParadise::Antamar::ConvertRandomEncounterIntoXML[]

#


120
121
122
# File 'lib/games_and_rpg_paradise/games/antamar/convert_random_encounter_into_XML.rb', line 120

def self.[](i = ARGV)
  new(i)
end

Instance Method Details

#do_generate_the_XML_fileObject

#

do_generate_the_XML_file

This method is incomplete. It was originally based on:

https://wiki.antamar.eu/index.php/ZB_Editor_naifor_Eine_Handvoll_Beeren

But a few things are still missing. At any rate, this was the first prototype, written in March 2023.

#


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/games_and_rpg_paradise/games/antamar/convert_random_encounter_into_XML.rb', line 60

def do_generate_the_XML_file
  _ = '<?xml version="1.0" encoding="UTF-8"?>
<scene xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://eisentrutz.antamar.eu/aoqml.xsd">

<!-- Humor=Nein; Gegend= Waldrand, Nordhalbkugel; Häufigkeit=selten; GZB=nein -->
<!-- Autor: xyz; Titel: '+@title+' -->'
  _ = _.dup
  _ << '<switch attribute="monat">
<case val="Erdenmond|Heilungsmond">
  <!-- Reifezeit für Brombeeren auf der Nordhalbkugel-->'
  @dataset = YAML.load_file('example.yml')
  _ << return_paragraph(@dataset['p1'].to_s)
  skill = @dataset['skill']
  _ << return_challenge_talent_line(skill)
  success = @dataset['success']
  _ << N+'<success>'+N
  _ << return_paragraph(success['p1'])
  _ << N+'</success>'+N
  _ << N+'<take item="#326" count="'+success['take_item'].split(' ').first+'"/>'+
       '<!-- '+success['take_item'].split(' ').last.to_s+' -->'+N
  _ << N+'</challenge>'+N
  _ << N+'</case>'+N
  _ << ' <else>
  <!-- Keine Erntezeit -->
 <p>Etwas abseits des Pfades im Halbschatten entdeckst du eine
 Brombeerhecke. <q>Schade, nicht die richtige Jahreszeit für
 reife Beeren</q>, denkst du und wanderst weiter deinem Ziel
 entgegen.</p>
</else>
</switch>
</scene>'
  into = '/Depot/j/example.xml'
  e 'Storing into '+into+'.'
  ::SaveFile.write_what_into(_, into)
end

#resetObject

#

reset (reset tag)

#


44
45
46
47
48
# File 'lib/games_and_rpg_paradise/games/antamar/convert_random_encounter_into_XML.rb', line 44

def reset
  super()
  infer_the_namespace
  @title = 'naifor_Eine Handvoll Beeren'
end

#return_challenge_talent_line(array) ⇒ Object

#

return_challenge_talent_line

#


106
107
108
# File 'lib/games_and_rpg_paradise/games/antamar/convert_random_encounter_into_XML.rb', line 106

def return_challenge_talent_line(array)
  N+'<challenge talent="'+array[0]+'" mod="'+array[1].to_s+'">'+N
end

#return_paragraph(i) ⇒ Object

#

return_paragraph (p tag)

#


99
100
101
# File 'lib/games_and_rpg_paradise/games/antamar/convert_random_encounter_into_XML.rb', line 99

def return_paragraph(i)
  "#{N}<p>#{i}</p>#{N}"
end

#runObject

#

run (run tag)

#


113
114
115
# File 'lib/games_and_rpg_paradise/games/antamar/convert_random_encounter_into_XML.rb', line 113

def run
  do_generate_the_XML_file
end