From 8a11825963dfbfa75a1d3f227913565392f77f2b Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 23 Oct 2011 13:58:55 +0100 Subject: ritocchi da Marco --- incantesimi/incantesimi.cmd.tex | 34 ++-- incantesimi/incantesimi.example.tex | 35 ++-- incantesimi/incantesimi.prep.tex | 340 ++++++++++++++++++------------------ 3 files changed, 205 insertions(+), 204 deletions(-) diff --git a/incantesimi/incantesimi.cmd.tex b/incantesimi/incantesimi.cmd.tex index b2e6146..3ceb4b9 100644 --- a/incantesimi/incantesimi.cmd.tex +++ b/incantesimi/incantesimi.cmd.tex @@ -29,7 +29,9 @@ %\fontseries{c}\fontshape{sc} -\tikzstyle{carta}=[rectangle,minimum width=4.8cm,minimum height=7cm,outer sep=0,use as bounding box] +\tikzstyle{carta}=[rectangle,minimum width=4.8cm,minimum height=7cm,outer sep=0,use as bounding box +% ,ultra thin,draw %uncomment to show card boxes! +] \tikzstyle{title label}=[rectangle,text=blue!80!green!75!black,minimum height=2\baselineskip,font={\small},inner sep=1mm,text width=4.6cm,align=flush center] @@ -45,7 +47,7 @@ \tikzstyle{angles label}=[rectangle split,rectangle split parts=2,rectangle split part align=left,text=blue!50!black,font=\tiny,align=justify] -\tikzstyle{prep label}=[rectangle split,rectangle split parts=2,rectangle split part align=left,draw,ultra thin,minimum width=0.333*4.8cm,text=yellow!10!black,inner xsep=0.1em,inner ysep=0.29em,font={\it\tiny}]%inner ysep is set to have 7mm overall heigh +\tikzstyle{prep label}=[rectangle split,rectangle split parts=2,rectangle split part align=left,draw,ultra thin,minimum width=0.333*4.8cm,text=yellow!10!black,inner xsep=0.1em,inner ysep=0.293em,font={\it\tiny}]%inner ysep is set to have 7mm overall heigh %%%% @@ -69,7 +71,7 @@ \newcommand{\incantesimo}[1]{% %\begin{scope}[every node/.style={draw,ultra thin},/spells/.cd,#1] \begin{scope}[/spells/.cd,#1] -\node[carta,ultra thin,draw] (card) {}; +\node[carta] (card) {}; % titolo \node [anchor=north,title label] (name) at (card.north) @@ -83,26 +85,26 @@ \node [anchor=south,prep label] (prep) at (card.south) {Prep:\nodepart{two}Used:}; -%angolo sud ovest -\node [anchor=south west,angles label] - (st) at (card.south west) - {\textsc{ST:}\nodepart{two}\textsc{\pgfkeysvalueof{/spells/st}}}; - +%lato sud ovest \node [anchor=south west,above angles label] (durata) at (card.west |- prep.north) {\textsf{Duration: \pgfkeysvalueof{/spells/durata}}}; -%angolo sud est -\node [anchor=south east,angles label] (sr) at (card.south east) - {\textsc{SR:}\nodepart{two}\textsc{\pgfkeysvalueof{/spells/sr}}}; - +%lato sud est \node [anchor=south east,above angles label] (tempo) at (card.east |- prep.north) {\textsf{CT: \pgfkeysvalueof{/spells/tempo}}}; -%lato sud est \node [anchor=north east,side label] (ref) at ($(tempo.north east) + (0,3mm)$) {\pgfkeysvalueof{/spells/ref}}; +%angolo sud ovest +\node [anchor=south west,angles label] (sr) at (card.south west) + {\textsc{SR:}\nodepart{two}\textsc{\pgfkeysvalueof{/spells/sr}}}; + +%angolo sud est +\node [anchor=south east,angles label] (st) at (card.south east) + {\textsc{ST:}\nodepart{two}\textsc{\pgfkeysvalueof{/spells/st}}}; + %sottotitoli \node [anchor=north east,align=flush right,rectangle,subt label] (scuola) at (type.south west) @@ -122,14 +124,14 @@ % sopra il centro \node [anchor=south west,trg label=flush left] (target) at ($(description.north west) + (0,1mm)$) - {{\scriptsize{}Target/Effect/Area:}\\{\slshape\pgfkeysvalueof{/spells/target}}}; + {{\tiny{}Target/Effect/Area:}\\{\slshape\pgfkeysvalueof{/spells/target}}}; \node [anchor=south east,trg label=flush right] (range) at (target.north -| type.south) - {{\scriptsize{}Range:} \textnormal{\itshape\pgfkeysvalueof{/spells/range}}}; + {{\tiny{}Range:} \textnormal{\itshape\pgfkeysvalueof{/spells/range}}}; %lato est \node [anchor=north west,side label] (lvl) at ($0.8*(card.east)+0.2*(card.north east)$) - {\textsc{lvl \pgfkeysvalueof{/spells/level}}}; + {\textbf{LVL \pgfkeysvalueof{/spells/level}}}; \end{scope}% diff --git a/incantesimi/incantesimi.example.tex b/incantesimi/incantesimi.example.tex index 91a5811..009e1b7 100644 --- a/incantesimi/incantesimi.example.tex +++ b/incantesimi/incantesimi.example.tex @@ -1,5 +1,4 @@ \input{incantesimi.cmd} -%\input{incantesimi.cmd.other} \begin{document} % @@ -10,41 +9,41 @@ \incantesimo{type=spell-like, scuola={Enchantment (Charm) [LD, MA, Sonic]}, st={Fort half (HO)}, - tempo=15m, + tempo=15 m, name=Regenerate Moderate Wounds, level=9, sr={Yes (HO)}, - durata={30m / disch}, + durata={30 m or until disch.}, ref=PH289, range=medium, - target={Well shaft 10ft. diam 100 ft. deep}, + target={Well shaft 10ft.\ diam 100ft.\ deep}, components={V,S,M,F,DF,XP}, specialcomp={M: Incense; F: Payer beads (500~MO); XP: 0 or 500}, - descrizione={Fully repairs an obj. up to 5\%/2L mass loss; cures 1d4 dmg to magical obj.}, - note={Reasonable command may give -1 to -4 pen. to S. T.} + descrizione={Fully repairs an object up to 5\%/2L mass loss; cures 1d4 damage to magical object.}, + note={Reasonable command may give -1 to -4 pen.\ to ST.} } & \incantesimo{type=spell-like, name={Death touch}, - %level=0, - scuola={Death domain}, + level=-, + scuola={Death domain [Death]}, components={Once per day}, %tempo=1a, range=Touch, - target={1 living creat. touched}, + target={1 living creat.\ touched}, durata=Instantaneous, %st, sr=Yes, - descrizione={If touched creat. has less than 1d6/CL hp dies.}, + descrizione={If touched creature has less than 1d6 per cleric level hit points dies.}, ref=PH163, % note } & \incantesimo{type=Supernatural,scuola=scuola a caso più altra roba in giro,name=Incantesimo col nome lungooooooo,level=3, durata=1/L m,range=Touch,target=you,components={V,S,M},specialcomp={M:tanta roba costosa da accendere (5000~MO)}, descrizione={+2 Defl AC/Resist. saves, counter mind control, hedge out elemental/outsiders.}} & -\incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo a a a a,level=1, +\incantesimo{scuola=scuola a caso,name=Incantesimo col nome l u n g o o o o,level=1, durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}, - note={Bigger ones can pass after Will save with 2d6 dmg.}} & + note={Bigger ones can pass after Will save with 2d6 damage.}} & \incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}}& @@ -52,13 +51,13 @@ durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}} \\ -\incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, +\incantesimo{scuola=scuola a caso,name=Insect Plague,level=1, durata=Inst,range=touch,target=you,components={V,S},specialcomp={M: Incense; F: Prayer bead (500~MO)}, descrizione={blah blah blah}} & -\incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, +\incantesimo{scuola=scuola a caso,name=Disintegrate,level=1, durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}} & -\incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, +\incantesimo{scuola=scuola a caso,name=Lesser Planar Ally,level=1, durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}} & \incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, @@ -71,13 +70,13 @@ durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}} \\ -\incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, +\incantesimo{scuola=scuola a caso,name=Undetectable Alignment,%level=1, durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}} & -\incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, +\incantesimo{scuola=scuola a caso,name=Magic Circle against Law,level=1, durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}} & -\incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, +\incantesimo{scuola=scuola a caso,name=Remove Blindness/Deafness,level=1, durata=Inst,range=touch,target=you,components={V,S}, descrizione={blah blah blah}} & \incantesimo{scuola=scuola a caso,name=Incantesimo col nome lungo,level=1, diff --git a/incantesimi/incantesimi.prep.tex b/incantesimi/incantesimi.prep.tex index 9df1015..b7b3aeb 100644 --- a/incantesimi/incantesimi.prep.tex +++ b/incantesimi/incantesimi.prep.tex @@ -1,170 +1,170 @@ - -\documentclass[a4paper,10pt,landscape]{article} -\usepackage[empty,cm]{fullpage} -\usepackage[latin1]{inputenc} -\usepackage[italian,english]{babel} -\usepackage[OT1]{fontenc} -\usepackage{pgfkeys} -\usepackage{tikz} -\usetikzlibrary{calc} -\usetikzlibrary{matrix} -\usetikzlibrary{shapes.multipart} - -%%%% fullpage -\setlength{\headheight}{0pt} -\setlength{\headsep}{0pt} -\setlength{\footskip}{0pt} -\setlength{\textwidth}{\paperwidth} -\setlength{\oddsidemargin}{-2.68cm} -\setlength{\evensidemargin}{\oddsidemargin} -\setlength{\textheight}{1.1\paperheight} -\setlength{\topmargin}{0pt} -\addtolength{\topmargin}{-2.68cm} -\addtolength{\oddsidemargin}{0.45cm} % per centrare le etichette -\addtolength{\evensidemargin}{0.45cm} % per centrare le etichette -%%%% -\setlength{\parindent}{0pt} - -%%%% -\newlength{\cardtextwidth} -\setlength{\cardtextwidth}{4.33cm} - -\newcounter{lvl} - -%\fontseries{c}\fontshape{sc} - -\tikzstyle{carta}=[rectangle,minimum width=4.8cm,minimum height=7cm,inner sep=0pt,outer sep=0,use as bounding box] - -\tikzstyle{prep label}=[rectangle split,rectangle split parts=2,rectangle split part align=left,draw,ultra thin,minimum width=0.333*4.8cm,text=yellow!10!black,inner xsep=0.1em,inner ysep=0.293em,font={\it\tiny},outer sep=0pt]%inner ysep is set to have 7mm overall heigh - -\tikzstyle{spells}=[rectangle,anchor=center,minimum width=1.5cm,minimum height=5mm,font={\footnotesize},text=#1] - -\tikzstyle{ranges}=[anchor=south,rectangle split,rectangle split parts=2,rectangle split part align=center,% - /pgf/number format/int detect,font={\sffamily\footnotesize},text=red!70!blue!90!yellow,] - -\newcommand{\preptext}[1]{% - \node[anchor=north west,prep label] at #1 {Prep:\nodepart{two}Used:};% -} - -\newcommand{\prepcard}{% - % - \node[carta] (card) {}; - % - \foreach \x in {0,1,2} - \foreach \y in {0,...,9} - { - \preptext{($(card.north west)+(\x*1.6cm,-\y*0.7cm)$)} - } - % - \draw[white,thin] (card.north west) rectangle (card.south east); - % -} - -\newcommand{\printRoman}{ - \ifnum \value{lvl} = 0 - \textsc{Orisons} - \else - \Roman{lvl} - \fi -} - -\newcommand{\closerange}[1]{ - \pgfmathparse{25+5*floor(#1/2)} - \pgfmathprintnumber{\pgfmathresult} -} -% -\newcommand{\mediumrange}[1]{ - \pgfmathparse{100+(10*#1)} - \pgfmathprintnumber{\pgfmathresult} -} -\newcommand{\longrange}[1]{ - \pgfmathparse{400+(40*#1)} - \pgfmathprintnumber{\pgfmathresult} -} - -\newcommand{\mydepth}{\rule[-0.2em]{0pt}{1mm}} - -\newcommand{\spellatlvl}[5]{% - \setcounter{lvl}{#1} - \path #2 - node[spells=red!#5!black] {\printRoman} - ++(1.5cm,0) - node[spells=green!75!black!#5!black] {#3} - ++(1.5cm,0) - node[spells=blue!#5!black] {\pgfmathprintnumber{#4}}; -} - -\newcommand{\spellscard}[3]{% takes rel ability bonus, castel lvl, and a list of 10 spells_per_day -\begin{scope} - % - \node[carta] (card) {}; - % titles - \path (card.north west) ++(0.9cm,-0.5cm) - node[spells=blue!80!green!75!black,font={\scshape\footnotesize}] (lvltl) {Level} - ++(1.5cm,0) - node[spells=blue!80!green!75!black,font={\scshape\footnotesize}] {Per day} - ++(1.5cm,0) - node[spells=blue!80!green!75!black,font={\scshape\footnotesize}] {ST DC}; - % spells - \foreach \n [count=\x from 0,evaluate=\x as \dc using 10+#1+\x,evaluate=\x as \shd using 85-7*\x,/pgf/number format/int detect] in #3 - { - \spellatlvl{\x}{($(lvltl.center)-(0,6mm+\x*5mm)$)}{\n}{\dc}{\shd} - } - % ranges - \path (card.south -| lvltl.center) - node[ranges] (close) - {Close:\mydepth\nodepart{two}\closerange{#2} ft.\mydepth} - ++(1.5cm,0) - node[ranges] (medium) - {Medium:\mydepth\nodepart{two}\mediumrange{#2} ft.\mydepth} - ++(1.5cm,0) - node[ranges] (long) - {Long:\mydepth\nodepart{two}\longrange{#2} ft.\mydepth}; - % - \draw[thin,green!20!black] (close.north) ++(2mm,2pt) -- ++(1.1cm,0) ++(4mm,0) -- ++(1.1cm,0); - % - % \draw[red,thin] (card.north west) rectangle (card.south east); - % -\end{scope} -} - -\begin{document} -% -\begin{tikzpicture} -\matrix[ampersand replacement=\&] { - % Necrist current - \spellscard{4}{12}{{6,4+1+1,4+1+1,3+1+1,3+1+1,2+0+1,-,-,-,-}}\& - % - \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ - % Necrist next - \spellscard{4}{13}{{6,5+1+1,4+1+1,4+1+1,3+1+1,2+0+1,1+0+1,-,-,-}}\& - % - \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ - % Necrist plus - \spellscard{5}{13}{{6,5+1+1,4+1+1,4+1+1,3+1+1,2+0+1,1+0+1,-,-,-}}\& - % - \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ -}; -% -\end{tikzpicture} -\pagebreak - -\begin{tikzpicture} -\matrix[ampersand replacement=\&] { - % Ariel current - \spellscard{4}{9}{{6,4+1+1,4+1+1,3+1+1,2+1+1,1+0+1,-,-,-,-}}\& - % - \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ - % Ariel next - \spellscard{4}{10}{{6,4+1+1,4+1+1,3+1+1,3+1+1,2+0+1,-,-,-,-}}\& - % - \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ - % Ariel plus - \spellscard{5}{10}{{6,4+1+1,4+1+1,3+1+1,3+1+1,2+0+1,-,-,-,-}}\& - % - \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ -}; -% -\end{tikzpicture} -% -\end{document} + +\documentclass[a4paper,10pt,landscape]{article} +\usepackage[empty,cm]{fullpage} +\usepackage[latin1]{inputenc} +\usepackage[italian,english]{babel} +\usepackage[OT1]{fontenc} +\usepackage{pgfkeys} +\usepackage{tikz} +\usetikzlibrary{calc} +\usetikzlibrary{matrix} +\usetikzlibrary{shapes.multipart} + +%%%% fullpage +\setlength{\headheight}{0pt} +\setlength{\headsep}{0pt} +\setlength{\footskip}{0pt} +\setlength{\textwidth}{\paperwidth} +\setlength{\oddsidemargin}{-2.68cm} +\setlength{\evensidemargin}{\oddsidemargin} +\setlength{\textheight}{1.1\paperheight} +\setlength{\topmargin}{0pt} +\addtolength{\topmargin}{-2.68cm} +\addtolength{\oddsidemargin}{0.45cm} % per centrare le etichette +\addtolength{\evensidemargin}{0.45cm} % per centrare le etichette +%%%% +\setlength{\parindent}{0pt} + +%%%% +\newlength{\cardtextwidth} +\setlength{\cardtextwidth}{4.33cm} + +\newcounter{lvl} + +%\fontseries{c}\fontshape{sc} + +\tikzstyle{carta}=[rectangle,minimum width=4.8cm,minimum height=7cm,inner sep=0pt,outer sep=0,use as bounding box] + +\tikzstyle{prep label}=[rectangle split,rectangle split parts=2,rectangle split part align=left,draw,ultra thin,minimum width=0.333*4.8cm,text=yellow!10!black,inner xsep=0.1em,inner ysep=0.293em,font={\it\tiny},outer sep=0pt]%inner ysep is set to have 7mm overall heigh + +\tikzstyle{spells}=[rectangle,anchor=center,minimum width=1.5cm,minimum height=5mm,font={\footnotesize},text=#1] + +\tikzstyle{ranges}=[anchor=south,rectangle split,rectangle split parts=2,rectangle split part align=center,% + /pgf/number format/int detect,font={\sffamily\footnotesize},text=red!70!blue!90!yellow,] + +\newcommand{\preptext}[1]{% + \node[anchor=north west,prep label] at #1 {Prep:\nodepart{two}Used:};% +} + +\newcommand{\prepcard}{% + % + \node[carta] (card) {}; + % + \foreach \x in {0,1,2} + \foreach \y in {0,...,9} + { + \preptext{($(card.north west)+(\x*1.6cm,-\y*0.7cm)$)} + } + % + \draw[white,thin] (card.north west) rectangle (card.south east); + % +} + +\newcommand{\printRoman}{ + \ifnum \value{lvl} = 0 + \textsc{Orisons} + \else + \Roman{lvl} + \fi +} + +\newcommand{\closerange}[1]{ + \pgfmathparse{25+5*floor(#1/2)} + \pgfmathprintnumber{\pgfmathresult} +} +% +\newcommand{\mediumrange}[1]{ + \pgfmathparse{100+(10*#1)} + \pgfmathprintnumber{\pgfmathresult} +} +\newcommand{\longrange}[1]{ + \pgfmathparse{400+(40*#1)} + \pgfmathprintnumber{\pgfmathresult} +} + +\newcommand{\mydepth}{\rule[-0.2em]{0pt}{1mm}} + +\newcommand{\spellatlvl}[5]{% + \setcounter{lvl}{#1} + \path #2 + node[spells=red!#5!black] {\printRoman} + ++(1.5cm,0) + node[spells=green!75!black!#5!black] {#3} + ++(1.5cm,0) + node[spells=blue!#5!black] {\pgfmathprintnumber{#4}}; +} + +\newcommand{\spellscard}[3]{% takes rel ability bonus, castel lvl, and a list of 10 spells_per_day +\begin{scope} + % + \node[carta] (card) {}; + % titles + \path (card.north west) ++(0.9cm,-0.5cm) + node[spells=blue!80!green!75!black,font={\scshape\footnotesize}] (lvltl) {Level} + ++(1.5cm,0) + node[spells=blue!80!green!75!black,font={\scshape\footnotesize}] {Per day} + ++(1.5cm,0) + node[spells=blue!80!green!75!black,font={\scshape\footnotesize}] {ST DC}; + % spells + \foreach \n [count=\x from 0,evaluate=\x as \dc using 10+#1+\x,evaluate=\x as \shd using 85-7*\x,/pgf/number format/int detect] in #3 + { + \spellatlvl{\x}{($(lvltl.center)-(0,6mm+\x*5mm)$)}{\n}{\dc}{\shd} + } + % ranges + \path (card.south -| lvltl.center) + node[ranges] (close) + {Close:\mydepth\nodepart{two}\closerange{#2} ft.\mydepth} + ++(1.5cm,0) + node[ranges] (medium) + {Medium:\mydepth\nodepart{two}\mediumrange{#2} ft.\mydepth} + ++(1.5cm,0) + node[ranges] (long) + {Long:\mydepth\nodepart{two}\longrange{#2} ft.\mydepth}; + % + \draw[thin,green!20!black] (close.north) ++(2mm,2pt) -- ++(1.1cm,0) ++(4mm,0) -- ++(1.1cm,0); + % + % \draw[red,thin] (card.north west) rectangle (card.south east); + % +\end{scope} +} + +\begin{document} +% +\begin{tikzpicture} +\matrix[ampersand replacement=\&] { + % Necrist current + \spellscard{4}{12}{{6,4+1+1,4+1+1,3+1+1,3+1+1,2+0+1,-,-,-,-}}\& + % + \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ + % Necrist next + \spellscard{4}{13}{{6,5+1+1,4+1+1,4+1+1,3+1+1,2+0+1,1+0+1,-,-,-}}\& + % + \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ + % Necrist plus + \spellscard{5}{13}{{6,5+1+1,4+1+1,4+1+1,3+1+1,2+0+1,1+0+1,-,-,-}}\& + % + \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ +}; +% +\end{tikzpicture} +\pagebreak + +\begin{tikzpicture} +\matrix[ampersand replacement=\&] { + % Ariel current + \spellscard{4}{9}{{6,4+1+1,4+1+1,3+1+1,2+1+1,1+0+1,-,-,-,-}}\& + % + \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ + % Ariel next + \spellscard{4}{10}{{6,4+1+1,4+1+1,3+1+1,3+1+1,2+0+1,-,-,-,-}}\& + % + \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ + % Ariel plus + \spellscard{5}{10}{{6,4+1+1,4+1+1,3+1+1,3+1+1,2+0+1,-,-,-,-}}\& + % + \prepcard\&\prepcard\&\prepcard\&\prepcard\&\prepcard\\ +}; +% +\end{tikzpicture} +% +\end{document} -- cgit v1.2.3 From 530eac25f94b14bcfcf8519023206af2fd386887 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 23 Oct 2011 14:01:13 +0100 Subject: mostra livello 0 ovvero, non saltare stringhe false, solo stringhe vuote --- incantesimi/excel_to_incantesimi.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/incantesimi/excel_to_incantesimi.pl b/incantesimi/excel_to_incantesimi.pl index e2d1899..95e0c95 100644 --- a/incantesimi/excel_to_incantesimi.pl +++ b/incantesimi/excel_to_incantesimi.pl @@ -113,7 +113,7 @@ __DATA__ [% FOREACH spell IN spells %] \incantesimo{type=spell, -[%- FOREACH field IN fieldmap; IF spell.item(field.key) %] +[%- FOREACH field IN fieldmap; IF spell.item(field.key) != '' %] [% field.value %]={[% lt(spell.item(field.key)) %]}, [%- END; END %] } [% IF (loop.count() % 6) %]& [% ELSE %] \\ [% END -%] -- cgit v1.2.3 From b0f883f8b8b29265b3a2d8a5577b4e6d9e1357cf Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 23 Oct 2011 14:10:51 +0100 Subject: =?UTF-8?q?gestisci=20incantesimi=20di=20dominio=20(2=C2=BA=20fogl?= =?UTF-8?q?io)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- incantesimi/excel_to_incantesimi.pl | 65 ++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/incantesimi/excel_to_incantesimi.pl b/incantesimi/excel_to_incantesimi.pl index 95e0c95..674d0b1 100644 --- a/incantesimi/excel_to_incantesimi.pl +++ b/incantesimi/excel_to_incantesimi.pl @@ -9,6 +9,7 @@ use Data::Printer; # excel => latex my %fieldmap = ( spellname => 'name', + name => 'name', level => 'level', school => 'scuola', comp => 'components', @@ -18,7 +19,7 @@ my %fieldmap = ( duration => 'durata', st => 'st', sr => 'sr', - spell => 'descrizione', + description => 'descrizione', special => 'specialcomp', page => 'ref', notes => 'note', @@ -33,25 +34,56 @@ my $parser = Spreadsheet::ParseExcel->new(); my $wb = $parser->parse($input_filename) or die $parser->error; -my $spells = parse_table($wb->worksheet('Incantesimi') - // $wb->worksheet(0)); +sheet_2_latex( + sheet_name => 'Incantesimi', + output_filename => "${output_filename}.incantesimi.tex", +); +sheet_2_latex( + sheet_name => 'Domini', + sheet_idx => 1, + output_filename => "${output_filename}.domini.tex", + skip_col => 1, +); + +{ +my $template; +sub template { + $template //= do {local $/;}; + return $template; +} +} -munge($spells); -p $spells; -my $template = Template->new(); -$template->process( - \*DATA, - { - spells => $spells, +sub sheet_2_latex { + my %opts = ( + sheet_idx => 0, fieldmap => \%fieldmap, - lt => \&latexise, - }, - $output_filename, -) + @_, + ); + + my $spells = parse_table( + $wb->worksheet($opts{sheet_name}) + // $wb->worksheet($opts{sheet_idx}), + $opts{skip_col}, + ); + + munge($spells); + + my $template = Template->new(); + $template->process( + \template(), + { + spells => $spells, + fieldmap => $opts{fieldmap}, + lt => \&latexise, + }, + $opts{output_filename}, + ) or die $template->error; +} sub parse_table { - my ($ws) = @_; + my ($ws,$skip_col) = @_; + $skip_col //= 0; my ($min_col,$max_col) = $ws->col_range(); my ($min_row,$max_row) = $ws->row_range(); @@ -59,6 +91,7 @@ sub parse_table { $min_col .. $max_col; for my $h (@headings) { + $h =~ s{^spell\W}{}i; $h =~ s{\W.*$}{}; $h = lc($h); } @@ -67,7 +100,7 @@ sub parse_table { for my $row ((1+$min_row) .. $max_row) { # allow and skip empty rows - next unless eval { $ws->get_cell($row,$min_col)->value }; + next unless eval { $ws->get_cell($row,$min_col+$skip_col)->value }; my %record; keys @headings; -- cgit v1.2.3 From 3a845849d6d63dbfc363c0d34a4acdf1c975124d Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 23 Oct 2011 15:10:57 +0100 Subject: fattorizzazione, e poteri --- incantesimi/excel_to_incantesimi.pl | 18 +++++++++++++++++- incantesimi/incantesimi.cmd.tex | 31 +++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/incantesimi/excel_to_incantesimi.pl b/incantesimi/excel_to_incantesimi.pl index 674d0b1..d1c82cf 100644 --- a/incantesimi/excel_to_incantesimi.pl +++ b/incantesimi/excel_to_incantesimi.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl use strict; use warnings; +use utf8; use Spreadsheet::ParseExcel; use LaTeX::Encode; use Template; @@ -10,10 +11,16 @@ use Data::Printer; my %fieldmap = ( spellname => 'name', name => 'name', + ability => 'name', level => 'level', + equiv => 'level', school => 'scuola', + source => 'source', + uses => 'uses', + type => 'type', comp => 'components', ct => 'tempo', + at => 'tempo', range => 'range', target => 'target', duration => 'durata', @@ -44,6 +51,13 @@ sheet_2_latex( output_filename => "${output_filename}.domini.tex", skip_col => 1, ); +sheet_2_latex( + sheet_name => 'Abilità speciali', + sheet_idx => 2, + output_filename => "${output_filename}.special.tex", + command => 'potere', + skip_col => 1, +); { my $template; @@ -57,6 +71,7 @@ sub sheet_2_latex { my %opts = ( sheet_idx => 0, fieldmap => \%fieldmap, + command => 'incantesimo', @_, ); @@ -74,6 +89,7 @@ sub sheet_2_latex { { spells => $spells, fieldmap => $opts{fieldmap}, + command => $opts{command}, lt => \&latexise, }, $opts{output_filename}, @@ -145,7 +161,7 @@ __DATA__ \matrix { [% FOREACH spell IN spells %] -\incantesimo{type=spell, +\[% command %]{ [%- FOREACH field IN fieldmap; IF spell.item(field.key) != '' %] [% field.value %]={[% lt(spell.item(field.key)) %]}, [%- END; END %] diff --git a/incantesimi/incantesimi.cmd.tex b/incantesimi/incantesimi.cmd.tex index 3ceb4b9..d4c09f1 100644 --- a/incantesimi/incantesimi.cmd.tex +++ b/incantesimi/incantesimi.cmd.tex @@ -5,6 +5,7 @@ \usepackage[OT1]{fontenc} \usepackage{pgfkeys} \usepackage{tikz} +\usepackage{ifthen} \usetikzlibrary{calc} \usetikzlibrary{shapes.multipart} @@ -59,16 +60,20 @@ \tikzset{/spells/note/.initial={}} \tikzset{/spells/ref/.initial={}} \tikzset{/spells/tempo/.initial={1 a}} +\tikzset{/spells/tempostr/.initial={}} \tikzset{/spells/level/.initial={Must be passed in}} +\tikzset{/spells/levelstr/.initial={}} \tikzset{/spells/name/.initial={Must be passed in}} \tikzset{/spells/scuola/.initial={Must be passed in}} +\tikzset{/spells/source/.initial={Must be passed in}} \tikzset{/spells/durata/.initial={Must be passed in}} \tikzset{/spells/components/.initial={Must be passed in}} +\tikzset{/spells/uses/.initial={Must be passed in}} \tikzset{/spells/descrizione/.initial={Must be passed in}} \tikzset{/spells/target/.initial={Must be passed in}} \tikzset{/spells/range/.initial={Must be passed in}} -\newcommand{\incantesimo}[1]{% +\newcommand{\spellcard}[1]{% %\begin{scope}[every node/.style={draw,ultra thin},/spells/.cd,#1] \begin{scope}[/spells/.cd,#1] \node[carta] (card) {}; @@ -91,7 +96,7 @@ %lato sud est \node [anchor=south east,above angles label] (tempo) at (card.east |- prep.north) - {\textsf{CT: \pgfkeysvalueof{/spells/tempo}}}; + {\pgfkeysvalueof{/spells/tempostr}}; \node [anchor=north east,side label] (ref) at ($(tempo.north east) + (0,3mm)$) {\pgfkeysvalueof{/spells/ref}}; @@ -107,11 +112,11 @@ %sottotitoli -\node [anchor=north east,align=flush right,rectangle,subt label] (scuola) at (type.south west) - {\emph{\pgfkeysvalueof{/spells/scuola}}}; +\node [anchor=north east,align=flush right,rectangle,subt label] (source) at (type.south west) + {\emph{\pgfkeysvalueof{/spells/source}}}; \node [anchor=north west,rectangle split,rectangle split parts=2,rectangle split part align={left,flushright},subt label] - (components) at ($(scuola.south -| card.west) - (0mm,0mm)$) + (components) at ($(source.south -| card.west) - (0mm,0mm)$) {\textsc{\pgfkeysvalueof{/spells/components}}\nodepart{two}{\tiny\pgfkeysvalueof{/spells/specialcomp}}}; @@ -131,8 +136,22 @@ %lato est \node [anchor=north west,side label] (lvl) at ($0.8*(card.east)+0.2*(card.north east)$) - {\textbf{LVL \pgfkeysvalueof{/spells/level}}}; + {\textbf{\pgfkeysvalueof{/spells/levelstr}}}; \end{scope}% } + +\newcommand{\incantesimo}[1]{% +\pgfkeys{/spells/.cd,#1}\spellcard{type=spell, + tempostr={CT: \pgfkeysvalueof{/spells/tempo}}, + source={\pgfkeysvalueof{scuola}}, + levelstr={LVL \pgfkeysvalueof{/spells/level}}, +}} + +\newcommand{\potere}[1]{% +\pgfkeys{/spells/.cd,level={},type=special,#1}\spellcard{ + tempostr={AT: \pgfkeysvalueof{/spells/tempo}}, + components={\pgfkeysvalueof{/spells/uses}}, + levelstr={\ifthenelse{\equal{\pgfkeysvalueof{/spells/level}}{}}{}{EqvLvl~\pgfkeysvalueof{/spells/level}}} +}} -- cgit v1.2.3 From de3f5ebae3dcd86e7441aa69f70f5eccfad525f3 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 23 Oct 2011 15:26:25 +0100 Subject: allinea a destra specialcomp a quanto pare, "rectangle split", "align" e "text width" non vanno troppo d'accordo --- incantesimi/incantesimi.cmd.tex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/incantesimi/incantesimi.cmd.tex b/incantesimi/incantesimi.cmd.tex index d4c09f1..b294498 100644 --- a/incantesimi/incantesimi.cmd.tex +++ b/incantesimi/incantesimi.cmd.tex @@ -115,9 +115,12 @@ \node [anchor=north east,align=flush right,rectangle,subt label] (source) at (type.south west) {\emph{\pgfkeysvalueof{/spells/source}}}; -\node [anchor=north west,rectangle split,rectangle split parts=2,rectangle split part align={left,flushright},subt label] +\node [anchor=north west,subt label,align=left] (components) at ($(source.south -| card.west) - (0mm,0mm)$) - {\textsc{\pgfkeysvalueof{/spells/components}}\nodepart{two}{\tiny\pgfkeysvalueof{/spells/specialcomp}}}; + {\textsc{\pgfkeysvalueof{/spells/components}}}; +\node [anchor=north west,subt label,align=flush right] + (specialcomp) at (components.south west) + {\tiny\pgfkeysvalueof{/spells/specialcomp}}; %centro -- cgit v1.2.3