Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
195956e7
Commit
195956e7
authored
Mar 18, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Magic Workstation spoiler format export
parent
063e0347
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
117 additions
and
14 deletions
+117
-14
data/magic.mse-game/game
data/magic.mse-game/game
+2
-0
src/data/format/formats.hpp
src/data/format/formats.hpp
+3
-0
src/data/format/mtg_editor.cpp
src/data/format/mtg_editor.cpp
+7
-7
src/data/format/mws.cpp
src/data/format/mws.cpp
+97
-1
src/data/settings.cpp
src/data/settings.cpp
+5
-5
src/gui/set/window.cpp
src/gui/set/window.cpp
+2
-1
src/util/defaultable.hpp
src/util/defaultable.hpp
+1
-0
No files found.
data/magic.mse-game/game
View file @
195956e7
...
@@ -803,6 +803,8 @@ statistics category:
...
@@ -803,6 +803,8 @@ statistics category:
############################# Keyword rules
############################# Keyword rules
has keywords: true
keyword parameter type:
keyword parameter type:
name: no parameter
name: no parameter
keyword parameter type:
keyword parameter type:
...
...
src/data/format/formats.hpp
View file @
195956e7
...
@@ -91,5 +91,8 @@ void export_image(const SetP& set, const CardP& card, const String& filename);
...
@@ -91,5 +91,8 @@ void export_image(const SetP& set, const CardP& card, const String& filename);
/// Generate a bitmap image of a card
/// Generate a bitmap image of a card
Bitmap
export_bitmap
(
const
SetP
&
set
,
const
CardP
&
card
);
Bitmap
export_bitmap
(
const
SetP
&
set
,
const
CardP
&
card
);
/// Export a set to Magic Workstation format
void
export_mws
(
const
SetP
&
set
);
// ----------------------------------------------------------------------------- : EOF
// ----------------------------------------------------------------------------- : EOF
#endif
#endif
src/data/format/mtg_editor.cpp
View file @
195956e7
...
@@ -143,13 +143,13 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
...
@@ -143,13 +143,13 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
target
=
&
current_card
->
value
<
TextValue
>
(
_
(
"power"
)).
value
;
target
=
&
current_card
->
value
<
TextValue
>
(
_
(
"power"
)).
value
;
}
else
if
(
line
==
_
(
"#TOUGHNESS#####"
))
{
// toughness
}
else
if
(
line
==
_
(
"#TOUGHNESS#####"
))
{
// toughness
target
=
&
current_card
->
value
<
TextValue
>
(
_
(
"toughness"
)).
value
;
target
=
&
current_card
->
value
<
TextValue
>
(
_
(
"toughness"
)).
value
;
}
else
if
(
line
==
_
(
"#ILLUSTRATION##"
)
||
line
==
_
(
"#ILLUSTRATION8#"
))
{
// image
}
else
if
(
line
==
_
(
"#ILLUSTRATION##"
)
||
line
==
_
(
"#ILLUSTRATION8#"
))
{
// image
target
=
0
;
target
=
0
;
line
=
file
.
ReadLine
();
line
=
file
.
ReadLine
();
if
(
!
wxFileExists
(
line
))
{
if
(
!
wxFileExists
(
line
))
{
// based on card name and date
// based on card name and date
line
=
filter1
(
filename
)
+
set_date
+
_
(
"/"
)
+
line
=
filter1
(
filename
)
+
set_date
+
_
(
"/"
)
+
filter2
(
current_card
->
value
<
TextValue
>
(
_
(
"name"
)).
value
()
)
+
card_date
+
_
(
".jpg"
);
filter2
(
current_card
->
value
<
TextValue
>
(
_
(
"name"
)).
value
)
+
card_date
+
_
(
".jpg"
);
}
}
// copy image into set
// copy image into set
if
(
wxFileExists
(
line
))
{
if
(
wxFileExists
(
line
))
{
...
@@ -177,16 +177,16 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
...
@@ -177,16 +177,16 @@ SetP MtgEditorFileFormat::importSet(const String& filename) {
// set defaults for artist and copyright to that of the first card
// set defaults for artist and copyright to that of the first card
if
(
!
set
->
cards
.
empty
())
{
if
(
!
set
->
cards
.
empty
())
{
String
artist
=
set
->
cards
[
0
]
->
value
<
TextValue
>
(
_
(
"illustrator"
)).
value
()
;
String
artist
=
set
->
cards
[
0
]
->
value
<
TextValue
>
(
_
(
"illustrator"
)).
value
;
String
copyright
=
set
->
cards
[
0
]
->
value
<
TextValue
>
(
_
(
"copyright"
))
.
value
()
;
String
copyright
=
set
->
cards
[
0
]
->
value
<
TextValue
>
(
_
(
"copyright"
))
.
value
;
set
->
value
<
TextValue
>
(
_
(
"artist"
))
.
value
.
assign
(
artist
);
set
->
value
<
TextValue
>
(
_
(
"artist"
))
.
value
.
assign
(
artist
);
set
->
value
<
TextValue
>
(
_
(
"copyright"
)).
value
.
assign
(
copyright
);
set
->
value
<
TextValue
>
(
_
(
"copyright"
)).
value
.
assign
(
copyright
);
// which cards have this value?
// which cards have this value?
FOR_EACH
(
card
,
set
->
cards
)
{
FOR_EACH
(
card
,
set
->
cards
)
{
Defaultable
<
String
>&
card_artist
=
card
->
value
<
TextValue
>
(
_
(
"illustrator"
)).
value
;
Defaultable
<
String
>&
card_artist
=
card
->
value
<
TextValue
>
(
_
(
"illustrator"
)).
value
;
Defaultable
<
String
>&
card_copyright
=
card
->
value
<
TextValue
>
(
_
(
"copyright"
))
.
value
;
Defaultable
<
String
>&
card_copyright
=
card
->
value
<
TextValue
>
(
_
(
"copyright"
))
.
value
;
if
(
card_artist
()
==
artist
)
card_artist
.
makeDefault
();
if
(
card_artist
==
artist
)
card_artist
.
makeDefault
();
if
(
card_copyright
()
==
copyright
)
card_copyright
.
makeDefault
();
if
(
card_copyright
==
copyright
)
card_copyright
.
makeDefault
();
}
}
}
}
...
@@ -237,7 +237,7 @@ String MtgEditorFileFormat::filter2(const String& str) {
...
@@ -237,7 +237,7 @@ String MtgEditorFileFormat::filter2(const String& str) {
void
MtgEditorFileFormat
::
untag
(
const
CardP
&
card
,
const
String
&
field
)
{
void
MtgEditorFileFormat
::
untag
(
const
CardP
&
card
,
const
String
&
field
)
{
Defaultable
<
String
>&
value
=
card
->
value
<
TextValue
>
(
field
).
value
;
Defaultable
<
String
>&
value
=
card
->
value
<
TextValue
>
(
field
).
value
;
value
.
assignDontChangeDefault
(
untag_no_escape
(
value
()
));
value
.
assignDontChangeDefault
(
untag_no_escape
(
value
));
}
}
...
...
src/data/format/mws.cpp
View file @
195956e7
...
@@ -7,5 +7,101 @@
...
@@ -7,5 +7,101 @@
// ----------------------------------------------------------------------------- : Includes
// ----------------------------------------------------------------------------- : Includes
#include <data/format/formats.hpp>
#include <data/format/formats.hpp>
#include <data/game.hpp>
#include <data/set.hpp>
#include <data/card.hpp>
#include <data/field/text.hpp>
#include <data/field/choice.hpp>
#include <util/string.hpp>
#include <util/tagged_string.hpp>
#include <wx/wfstream.h>
// ----------------------------------------------------------------------------- :
DECLARE_TYPEOF_COLLECTION
(
CardP
);
// ----------------------------------------------------------------------------- : Utilities
/// Convert a tagged string to MWS format: \t\t before each line beyond the first
String
untag_mws
(
const
String
&
str
)
{
return
replace_all
(
untag
(
str
),
_
(
"
\n
"
),
_
(
"
\n\t\t
"
)
);
}
//String untag_mws(const Defaultable<String>& str) {
// str.
//}
/// Code for card color in MWS format
String
card_color_mws
(
const
String
&
col
)
{
if
(
col
==
_
(
"white"
))
return
_
(
"W"
);
if
(
col
==
_
(
"blue"
))
return
_
(
"U"
);
if
(
col
==
_
(
"black"
))
return
_
(
"B"
);
if
(
col
==
_
(
"red"
))
return
_
(
"R"
);
if
(
col
==
_
(
"green"
))
return
_
(
"G"
);
if
(
col
==
_
(
"colorless"
))
return
_
(
"Art"
);
if
(
col
.
find
(
_
(
"land"
))
!=
String
::
npos
)
{
return
_
(
"Lnd"
);
// land
}
else
{
return
_
(
"Gld"
);
// multicolor
}
}
/// Code for card rarity, used for MWS and Apprentice
String
card_rarity_code
(
const
String
&
rarity
)
{
if
(
rarity
==
_
(
"rare"
))
return
_
(
"R"
);
if
(
rarity
==
_
(
"uncommon"
))
return
_
(
"U"
);
else
return
_
(
"C"
);
}
// ----------------------------------------------------------------------------- : export_mws
void
export_mws
(
const
SetP
&
set
)
{
if
(
!
set
->
game
->
isMagic
())
{
throw
Error
(
_
(
"Can only export Magic sets to Magic Workstation"
));
}
// Select filename
String
name
=
wxFileSelector
(
_
(
"Export to file"
),
_
(
""
),
_
(
""
),
_
(
""
),
_
(
"Text files (*.txt)|*.txt|All Files|*.*"
),
wxSAVE
|
wxOVERWRITE_PROMPT
);
if
(
name
.
empty
())
return
;
wxBusyCursor
busy
;
// Open file
wxFileOutputStream
f
(
name
);
wxTextOutputStream
file
(
f
,
wxEOL_DOS
);
// Write header
file
.
WriteString
(
set
->
value
<
TextValue
>
(
_
(
"title"
)).
value
+
_
(
" Spoiler List
\n
"
));
file
.
WriteString
(
_
(
"Set exported using Magic Set Editor 2, version "
)
+
app_version
.
toString
()
+
_
(
"
\n\n
"
));
wxDateTime
now
=
wxDateTime
::
Now
();
file
.
WriteString
(
_
(
"Spoiler List created on "
)
+
now
.
FormatISODate
()
+
_
(
" "
)
+
now
.
FormatISOTime
());
file
.
WriteString
(
_
(
"
\n\n
"
));
// Write cards
FOR_EACH
(
card
,
set
->
cards
)
{
file
.
WriteString
(
_
(
"Card Name:
\t
"
));
file
.
WriteString
(
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"name"
)).
value
));
file
.
WriteString
(
_
(
"
\n
Card Color:
\t
"
));
file
.
WriteString
(
card_color_mws
(
card
->
value
<
ChoiceValue
>
(
_
(
"card color"
)).
value
));
file
.
WriteString
(
_
(
"
\n
Mana Cost:
\t
"
));
file
.
WriteString
(
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"casting cost"
)).
value
));
file
.
WriteString
(
_
(
"
\n
Type & Class:
\t
"
));
String
sup_type
=
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"super type"
)).
value
);
String
sub_type
=
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"sub type"
)).
value
);
if
(
sub_type
.
empty
())
{
file
.
WriteString
(
sup_type
);
}
else
{
file
.
WriteString
(
sup_type
+
_
(
" - "
)
+
sub_type
);
}
file
.
WriteString
(
_
(
"
\n
Pow/Tou:
\t
"
));
file
.
WriteString
(
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"pt"
)).
value
));
file
.
WriteString
(
_
(
"
\n
Card Text:
\t
"
));
file
.
WriteString
(
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"rule text"
)).
value
));
file
.
WriteString
(
_
(
"
\n
Flavor Text:
\t
"
));
file
.
WriteString
(
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"flavor text"
)).
value
));
file
.
WriteString
(
_
(
"
\n
Artist:
\t\t
"
));
file
.
WriteString
(
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"illustrator"
)).
value
));
file
.
WriteString
(
_
(
"
\n
Rarity:
\t\t
"
));
file
.
WriteString
(
card_rarity_code
(
card
->
value
<
ChoiceValue
>
(
_
(
"rarity"
)).
value
));
file
.
WriteString
(
_
(
"
\n
Card #:
\t\t
"
));
file
.
WriteString
(
untag_mws
(
card
->
value
<
TextValue
>
(
_
(
"card number"
)).
value
));
file
.
WriteString
(
_
(
"
\n\n
"
));
}
}
src/data/settings.cpp
View file @
195956e7
...
@@ -63,11 +63,11 @@ StyleSheetSettings::StyleSheetSettings()
...
@@ -63,11 +63,11 @@ StyleSheetSettings::StyleSheetSettings()
{}
{}
void
StyleSheetSettings
::
useDefault
(
const
StyleSheetSettings
&
ss
)
{
void
StyleSheetSettings
::
useDefault
(
const
StyleSheetSettings
&
ss
)
{
if
(
card_zoom
.
isDefault
())
card_zoom
.
assignDefault
(
ss
.
card_zoom
()
);
if
(
card_zoom
.
isDefault
())
card_zoom
.
assignDefault
(
ss
.
card_zoom
);
if
(
card_angle
.
isDefault
())
card_angle
.
assignDefault
(
ss
.
card_angle
()
);
if
(
card_angle
.
isDefault
())
card_angle
.
assignDefault
(
ss
.
card_angle
);
if
(
card_anti_alias
.
isDefault
())
card_anti_alias
.
assignDefault
(
ss
.
card_anti_alias
()
);
if
(
card_anti_alias
.
isDefault
())
card_anti_alias
.
assignDefault
(
ss
.
card_anti_alias
);
if
(
card_borders
.
isDefault
())
card_borders
.
assignDefault
(
ss
.
card_borders
()
);
if
(
card_borders
.
isDefault
())
card_borders
.
assignDefault
(
ss
.
card_borders
);
if
(
card_normal_export
.
isDefault
())
card_normal_export
.
assignDefault
(
ss
.
card_normal_export
()
);
if
(
card_normal_export
.
isDefault
())
card_normal_export
.
assignDefault
(
ss
.
card_normal_export
);
}
}
IMPLEMENT_REFLECTION
(
StyleSheetSettings
)
{
IMPLEMENT_REFLECTION
(
StyleSheetSettings
)
{
...
...
src/gui/set/window.cpp
View file @
195956e7
...
@@ -148,6 +148,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
...
@@ -148,6 +148,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
// note: this still sends events for menu and toolbar items!
// note: this still sends events for menu and toolbar items!
wxUpdateUIEvent
::
SetMode
(
wxUPDATE_UI_PROCESS_SPECIFIED
);
wxUpdateUIEvent
::
SetMode
(
wxUPDATE_UI_PROCESS_SPECIFIED
);
SetExtraStyle
(
wxWS_EX_PROCESS_UI_UPDATES
);
SetExtraStyle
(
wxWS_EX_PROCESS_UI_UPDATES
);
tabBar
->
SetExtraStyle
(
wxWS_EX_PROCESS_UI_UPDATES
);
setSet
(
set
);
setSet
(
set
);
current_panel
->
Layout
();
current_panel
->
Layout
();
...
@@ -456,7 +457,7 @@ void SetWindow::onFileExportApprentice(wxCommandEvent&) {
...
@@ -456,7 +457,7 @@ void SetWindow::onFileExportApprentice(wxCommandEvent&) {
}
}
void
SetWindow
::
onFileExportMWS
(
wxCommandEvent
&
)
{
void
SetWindow
::
onFileExportMWS
(
wxCommandEvent
&
)
{
// exportMWS
(set);
export_mws
(
set
);
}
}
void
SetWindow
::
onFilePrint
(
wxCommandEvent
&
)
{
void
SetWindow
::
onFilePrint
(
wxCommandEvent
&
)
{
...
...
src/util/defaultable.hpp
View file @
195956e7
...
@@ -39,6 +39,7 @@ class Defaultable {
...
@@ -39,6 +39,7 @@ class Defaultable {
}
}
/// Get access to the value
/// Get access to the value
inline
operator
const
T
&
()
const
{
return
value
;
}
inline
const
T
&
operator
()
()
const
{
return
value
;
}
inline
const
T
&
operator
()
()
const
{
return
value
;
}
/// Get access to the value, for changing it
/// Get access to the value, for changing it
inline
T
&
mutate
()
{
inline
T
&
mutate
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment