mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Add get_card_stylesheet script function
This commit is contained in:
@@ -680,6 +680,17 @@ SCRIPT_FUNCTION(get_card_styling) {
|
||||
throw ScriptError(_("invalid set or card argument"));
|
||||
}
|
||||
|
||||
SCRIPT_FUNCTION(get_card_stylesheet) {
|
||||
SCRIPT_PARAM_C(ScriptValueP, input);
|
||||
SCRIPT_PARAM_C(ScriptValueP, set);
|
||||
ScriptObject<CardP>* c = dynamic_cast<ScriptObject<CardP>*>(input.get());
|
||||
ScriptObject<Set*>* s = dynamic_cast<ScriptObject<Set*>*>(set.get());
|
||||
if (s && c) {
|
||||
return to_script(&s->getValue()->stylesheetFor(c->getValue()));
|
||||
}
|
||||
throw ScriptError(_("invalid set or card argument"));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Keywords
|
||||
|
||||
|
||||
@@ -768,6 +779,7 @@ void init_script_basic_functions(Context& ctx) {
|
||||
ctx.setVariable(_("to_code"), script_to_code);
|
||||
ctx.setVariable(_("type_name"), script_type_name);
|
||||
ctx.setVariable(_("get_card_styling"), script_get_card_styling);
|
||||
ctx.setVariable(_("get_card_stylesheet"), script_get_card_stylesheet);
|
||||
// math
|
||||
ctx.setVariable(_("abs"), script_abs);
|
||||
ctx.setVariable(_("random_real"), script_random_real);
|
||||
|
||||
Reference in New Issue
Block a user