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
96533516
Commit
96533516
authored
Jul 11, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed Pack structures
parent
d6b3bbaa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
169 additions
and
57 deletions
+169
-57
data/magic.mse-game/game
data/magic.mse-game/game
+40
-42
src/data/game.cpp
src/data/game.cpp
+1
-0
src/data/game.hpp
src/data/game.hpp
+2
-0
src/data/pack.cpp
src/data/pack.cpp
+31
-3
src/data/pack.hpp
src/data/pack.hpp
+31
-9
src/gui/set/random_pack_panel.cpp
src/gui/set/random_pack_panel.cpp
+63
-3
src/gui/set/random_pack_panel.hpp
src/gui/set/random_pack_panel.hpp
+1
-0
No files found.
data/magic.mse-game/game
View file @
96533516
...
...
@@ -1831,68 +1831,66 @@ auto replace:
############################################################## Card packs
pack type:
name: Starter pack
pack item:
name: Common
filter: card.rarity == "common"
pack item:
name: Uncommon
filter: card.rarity == "uncommon"
pack item:
name: Rare
filter: card.rarity == "rare"
pack item:
name: Basic Land
filter: card.type == "Plains"
filter: card.type == "Island"
filter: card.type == "Swamp"
filter: card.type == "Mountain"
filter: card.type == "Forest"
# TODO: support something like this:
#type: cyclic
pack type:
name: Tournament pack
card type
:
item
:
name: Rare
amount: 3
filter: card.rarity == "rare"
card type:
item:
name: Uncommon
amount: 9
filter: card.rarity == "uncommon"
card type:
item:
name: Common
amount: 33
filter: card.rarity == "common"
card type:
name: Plains
amount: 6
filter: card.type == "Plains"
card type:
name: Island
amount: 6
filter: card.type == "Island"
card type:
name: Swamp
amount: 6
filter: card.type == "Swamp"
card type:
name: Mountain
amount: 6
filter: card.type == "Mountain"
card type:
name: Forest
amount: 6
filter: card.type == "Forest"
item:
name: Basic Land
amount: 30
pack type:
name: Booster pack
card type
:
item
:
name: Rare
amount: 1
filter: card.rarity == "rare"
card type:
item:
name: Uncommon
amount: 3
filter: card.rarity == "uncommon"
card type:
item:
name: Common
amount: 11
filter: card.rarity == "common"
pack type:
name: Additional common
item:
name: Common
pack type:
name: Additional uncommon
item:
name: Uncommon
pack type:
name: Additional rare
card type
:
item
:
name: Rare
amount: 1
filter: card.rarity == "rare"
pack type:
name: Additional common
card type:
name: Rare
amount: 1
filter: card.rarity == "rare"
name: Additional special
item:
name: Special
...
...
src/data/game.cpp
View file @
96533516
...
...
@@ -53,6 +53,7 @@ IMPLEMENT_REFLECTION(Game) {
REFLECT_NO_SCRIPT
(
card_list_color_script
);
REFLECT_NO_SCRIPT
(
statistics_dimensions
);
REFLECT_NO_SCRIPT
(
statistics_categories
);
REFLECT_NO_SCRIPT
(
pack_items
);
REFLECT_NO_SCRIPT
(
pack_types
);
REFLECT_NO_SCRIPT
(
keyword_match_script
);
REFLECT
(
has_keywords
);
...
...
src/data/game.hpp
View file @
96533516
...
...
@@ -20,6 +20,7 @@ DECLARE_POINTER_TYPE(Style);
DECLARE_POINTER_TYPE
(
Game
);
DECLARE_POINTER_TYPE
(
StatsDimension
);
DECLARE_POINTER_TYPE
(
StatsCategory
);
DECLARE_POINTER_TYPE
(
PackItem
);
DECLARE_POINTER_TYPE
(
PackType
);
DECLARE_POINTER_TYPE
(
KeywordParam
);
DECLARE_POINTER_TYPE
(
KeywordMode
);
...
...
@@ -44,6 +45,7 @@ class Game : public Packaged {
OptionalScript
card_list_color_script
;
///< Script that determines the color of items in the card list
vector
<
StatsDimensionP
>
statistics_dimensions
;
///< (Additional) statistics dimensions
vector
<
StatsCategoryP
>
statistics_categories
;
///< (Additional) statistics categories
vector
<
PackItemP
>
pack_items
;
///< Types of cards in packs
vector
<
PackTypeP
>
pack_types
;
///< Types of random card packs to generate
vector
<
WordListP
>
word_lists
;
///< Word lists for editing with a drop down list
vector
<
AutoReplaceP
>
auto_replaces
;
///< Things to autoreplace in textboxes
...
...
src/data/pack.cpp
View file @
96533516
...
...
@@ -18,13 +18,41 @@ PackType::PackType()
IMPLEMENT_REFLECTION
(
PackType
)
{
REFLECT
(
name
);
REFLECT
(
enabled
);
REFLECT
(
card_type
s
);
REFLECT
(
item
s
);
}
// ----------------------------------------------------------------------------- : CardType
void
PackType
::
generate
(
Set
&
set
,
vector
<
CardP
>&
out
)
const
{
//%FOR_EACH(card_type, card_types) {
//% card_type->generate(set,out);
//%}
}
// ----------------------------------------------------------------------------- : PackItemRef
PackItemRef
::
PackItemRef
()
:
amount
(
1
)
{}
IMPLEMENT_REFLECTION
(
CardType
)
{
IMPLEMENT_REFLECTION
(
PackItemRef
)
{
REFLECT
(
name
);
REFLECT
(
amount
);
}
bool
PackItemRef
::
update
(
Context
&
ctx
)
{
return
amount
.
update
(
ctx
);
}
// ----------------------------------------------------------------------------- : PackItem
IMPLEMENT_REFLECTION
(
PackItem
)
{
REFLECT
(
name
);
REFLECT
(
filter
);
}
void
PackItem
::
generate
(
Set
&
set
,
vector
<
CardP
>&
out
)
const
{
//%Context& ctx = set.getContext();
//%amount.update(ctx);
//%FOR_EACH(card_type, card_types) {
//% card_type->generate(set,out);
//%}
}
src/data/pack.hpp
View file @
96533516
...
...
@@ -13,7 +13,7 @@
#include <util/reflect.hpp>
#include <script/scriptable.hpp>
DECLARE_POINTER_TYPE
(
CardType
);
DECLARE_POINTER_TYPE
(
PackItemRef
);
DECLARE_POINTER_TYPE
(
Card
);
class
Set
;
...
...
@@ -24,25 +24,47 @@ class PackType : public IntrusivePtrBase<PackType> {
public:
PackType
();
String
name
;
///< Name of this pack
vector
<
CardTypeP
>
card_types
;
///< Cards in this pack
Scriptable
<
bool
>
enabled
;
///< Is this pack enabled?
String
name
;
///< Name of this pack
Scriptable
<
bool
>
enabled
;
///< Is this pack enabled?
vector
<
PackItemRefP
>
items
;
///< Cards in this pack
/// Generate a random pack of cards
void
generate
(
Set
&
set
,
vector
<
CardP
>&
out
);
/// Generate a random pack of cards
, add them to out
void
generate
(
Set
&
set
,
vector
<
CardP
>&
out
)
const
;
private:
DECLARE_REFLECTION
();
};
// ----------------------------------------------------------------------------- :
CardType
// ----------------------------------------------------------------------------- :
PackItemRef
/// A card type description for playtesting
class
CardType
:
public
IntrusivePtrBase
<
CardType
>
{
class
PackItemRef
:
public
IntrusivePtrBase
<
PackItemRef
>
{
public:
PackItemRef
();
String
name
;
///< Name of this type of cards
Scriptable
<
int
>
amount
;
///< Number of cards of this type
/// Update scripts, returns true if there is a change
bool
update
(
Context
&
ctx
);
/// Generate random cards, add them to out
void
generate
(
Set
&
set
,
vector
<
CardP
>&
out
)
const
;
private:
DECLARE_REFLECTION
();
};
// ----------------------------------------------------------------------------- : PackItem
/// A card type description for playtesting
class
PackItem
:
public
IntrusivePtrBase
<
PackItem
>
{
public:
String
name
;
///< Name of this type of cards
OptionalScript
filter
;
///< Filter to select this type of cards
/// Generate random cards, add them to out
void
generate
(
Set
&
set
,
vector
<
CardP
>&
out
)
const
;
private:
DECLARE_REFLECTION
();
};
...
...
src/gui/set/random_pack_panel.cpp
View file @
96533516
...
...
@@ -15,6 +15,51 @@
#include <wx/spinctrl.h>
DECLARE_TYPEOF_COLLECTION
(
PackTypeP
);
DECLARE_TYPEOF_COLLECTION
(
CardP
);
// ----------------------------------------------------------------------------- : RandomCardList
/// A card list that contains the
class
RandomCardList
:
public
CardListBase
{
public:
RandomCardList
(
Window
*
parent
,
int
id
,
long
style
=
0
);
/// Reset the list
void
reset
();
/// Add a pack of cards
void
add
(
PackType
&
pack
);
protected:
virtual
void
getItems
(
vector
<
VoidP
>&
out
)
const
;
virtual
void
onChangeSet
();
private:
vector
<
CardP
>
cards
;
};
RandomCardList
::
RandomCardList
(
Window
*
parent
,
int
id
,
long
style
)
:
CardListBase
(
parent
,
id
,
style
)
{}
void
RandomCardList
::
reset
()
{
cards
.
clear
();
}
void
RandomCardList
::
add
(
PackType
&
pack
)
{
pack
.
generate
(
*
set
,
cards
);
}
void
RandomCardList
::
onChangeSet
()
{
reset
();
CardListBase
::
onChangeSet
();
}
void
RandomCardList
::
getItems
(
vector
<
VoidP
>&
out
)
const
{
out
.
reserve
(
cards
.
size
());
FOR_EACH_CONST
(
c
,
cards
)
{
out
.
push_back
(
c
);
}
}
// ----------------------------------------------------------------------------- : RandomPackPanel
...
...
@@ -25,6 +70,9 @@ RandomPackPanel::RandomPackPanel(Window* parent, int id)
preview
=
new
CardViewer
(
this
,
wxID_ANY
);
card_list
=
new
FilteredCardList
(
this
,
wxID_ANY
);
wxButton
*
generate
=
new
wxButton
(
this
,
wxID_ANY
,
_BUTTON_
(
"generate pack"
));
wxRadioButton
*
seed_random
=
new
wxRadioButton
(
this
,
wxID_ANY
,
_BUTTON_
(
"random seed"
));
wxRadioButton
*
seed_fixed
=
new
wxRadioButton
(
this
,
wxID_ANY
,
_BUTTON_
(
"fixed seed"
));
seed
=
new
wxTextCtrl
(
this
,
wxID_ANY
);
// init sizer
wxSizer
*
s
=
new
wxBoxSizer
(
wxHORIZONTAL
);
s
->
Add
(
preview
,
0
,
wxRIGHT
,
2
);
...
...
@@ -33,11 +81,22 @@ RandomPackPanel::RandomPackPanel(Window* parent, int id)
wxSizer
*
s4
=
new
wxStaticBoxSizer
(
wxHORIZONTAL
,
this
,
_LABEL_
(
"pack selection"
));
packsSizer
=
new
wxFlexGridSizer
(
0
,
2
,
4
,
8
);
packsSizer
->
AddGrowableCol
(
0
);
s4
->
Add
(
packsSizer
,
1
,
wxEXPAND
|
wxALL
,
4
);
s4
->
AddSpacer
(
2
);
s4
->
Add
(
packsSizer
,
1
,
wxEXPAND
|
wxALL
&
~
wxTOP
,
4
);
s3
->
Add
(
s4
,
1
,
wxEXPAND
,
8
);
wxSizer
*
s5
=
new
wxStaticBoxSizer
(
wxHORIZONTAL
,
this
,
_LABEL_
(
"pack totals"
));
s3
->
Add
(
s5
,
1
,
wxEXPAND
|
wxLEFT
,
8
);
s3
->
Add
(
generate
,
0
,
wxALIGN_BOTTOM
|
wxLEFT
,
8
);
wxSizer
*
s6
=
new
wxBoxSizer
(
wxVERTICAL
);
wxSizer
*
s7
=
new
wxStaticBoxSizer
(
wxVERTICAL
,
this
,
_LABEL_
(
"seed"
));
s7
->
Add
(
seed_random
,
0
,
wxALL
,
4
);
s7
->
Add
(
seed_fixed
,
0
,
wxALL
,
4
);
wxSizer
*
s8
=
new
wxBoxSizer
(
wxHORIZONTAL
);
s8
->
Add
(
seed
,
1
,
wxLEFT
,
20
);
s7
->
Add
(
s8
,
0
,
wxALL
&
~
wxTOP
,
4
);
s6
->
Add
(
s7
,
0
,
0
,
8
);
s6
->
AddStretchSpacer
();
s6
->
Add
(
generate
,
0
,
wxTOP
|
wxALIGN_RIGHT
,
8
);
s3
->
Add
(
s6
,
0
,
wxEXPAND
|
wxLEFT
,
8
);
s2
->
Add
(
s3
,
0
,
wxEXPAND
|
wxALL
&
~
wxTOP
,
4
);
s2
->
Add
(
card_list
,
1
,
wxEXPAND
);
s
->
Add
(
s2
,
1
,
wxEXPAND
,
8
);
...
...
@@ -49,17 +108,18 @@ void RandomPackPanel::onChangeSet() {
preview
->
setSet
(
set
);
card_list
->
setSet
(
set
);
// TODO: remove or reuse old pack controls if there are any.
// add pack controls
FOR_EACH
(
pack
,
set
->
game
->
pack_types
)
{
PackItem
i
;
i
.
pack
=
pack
;
i
.
label
=
new
wxStaticText
(
this
,
wxID_ANY
,
pack
->
name
);
i
.
value
=
new
wxSpinCtrl
(
this
,
wxID_ANY
,
_
(
"0"
),
wxDefaultPosition
,
wxSize
(
50
,
-
1
));
//i.value->SetSizeHints(0,0,50,100);
packsSizer
->
Add
(
i
.
label
,
0
,
wxALIGN_CENTER_VERTICAL
);
packsSizer
->
Add
(
i
.
value
,
0
,
wxEXPAND
|
wxALIGN_CENTER
);
packs
.
push_back
(
i
);
}
Layout
();
}
...
...
src/gui/set/random_pack_panel.hpp
View file @
96533516
...
...
@@ -40,6 +40,7 @@ class RandomPackPanel : public SetWindowPanel {
private:
CardViewer
*
preview
;
///< Card preview
FilteredCardList
*
card_list
;
///< The list of cards
wxTextCtrl
*
seed
;
///< Seed value
wxFlexGridSizer
*
packsSizer
;
wxFlexGridSizer
*
totalsSizer
;
...
...
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