Commit ea410524 authored by DailyShana's avatar DailyShana

move opening lua libs after their implements

parent 86b2cb09
This diff is collapsed.
This diff is collapsed.
......@@ -203,3 +203,22 @@ int32 scriptlib::debug_show_hint(lua_State *L) {
pduel->write_buffer8(0);
return 0;
}
static const struct luaL_Reg debuglib[] = {
{ "Message", scriptlib::debug_message },
{ "AddCard", scriptlib::debug_add_card },
{ "SetPlayerInfo", scriptlib::debug_set_player_info },
{ "PreSummon", scriptlib::debug_pre_summon },
{ "PreEquip", scriptlib::debug_pre_equip },
{ "PreSetTarget", scriptlib::debug_pre_set_target },
{ "PreAddCounter", scriptlib::debug_pre_add_counter },
{ "ReloadFieldBegin", scriptlib::debug_reload_field_begin },
{ "ReloadFieldEnd", scriptlib::debug_reload_field_end },
{ "SetAIName", scriptlib::debug_set_ai_name },
{ "ShowHint", scriptlib::debug_show_hint },
{ NULL, NULL }
};
void scriptlib::open_debuglib(lua_State *L) {
luaL_newlib(L, debuglib);
lua_setglobal(L, "Debug");
}
This diff is collapsed.
......@@ -561,3 +561,65 @@ int32 scriptlib::effect_use_count_limit(lua_State *L) {
}
return 0;
}
static const struct luaL_Reg effectlib[] = {
{ "CreateEffect", scriptlib::effect_new },
{ "GlobalEffect", scriptlib::effect_newex },
{ "Clone", scriptlib::effect_clone },
{ "Reset", scriptlib::effect_reset },
{ "GetFieldID", scriptlib::effect_get_field_id },
{ "SetDescription", scriptlib::effect_set_description },
{ "SetCode", scriptlib::effect_set_code },
{ "SetRange", scriptlib::effect_set_range },
{ "SetTargetRange", scriptlib::effect_set_target_range },
{ "SetAbsoluteRange", scriptlib::effect_set_absolute_range },
{ "SetCountLimit", scriptlib::effect_set_count_limit },
{ "SetReset", scriptlib::effect_set_reset },
{ "SetType", scriptlib::effect_set_type },
{ "SetProperty", scriptlib::effect_set_property },
{ "SetLabel", scriptlib::effect_set_label },
{ "SetLabelObject", scriptlib::effect_set_label_object },
{ "SetCategory", scriptlib::effect_set_category },
{ "SetHintTiming", scriptlib::effect_set_hint_timing },
{ "SetCondition", scriptlib::effect_set_condition },
{ "SetTarget", scriptlib::effect_set_target },
{ "SetCost", scriptlib::effect_set_cost },
{ "SetValue", scriptlib::effect_set_value },
{ "SetOperation", scriptlib::effect_set_operation },
{ "SetOwnerPlayer", scriptlib::effect_set_owner_player },
{ "GetDescription", scriptlib::effect_get_description },
{ "GetCode", scriptlib::effect_get_code },
{ "GetType", scriptlib::effect_get_type },
{ "GetProperty", scriptlib::effect_get_property },
{ "GetLabel", scriptlib::effect_get_label },
{ "GetLabelObject", scriptlib::effect_get_label_object },
{ "GetCategory", scriptlib::effect_get_category },
{ "GetOwner", scriptlib::effect_get_owner },
{ "GetHandler", scriptlib::effect_get_handler },
{ "GetCondition", scriptlib::effect_get_condition },
{ "GetTarget", scriptlib::effect_get_target },
{ "GetCost", scriptlib::effect_get_cost },
{ "GetValue", scriptlib::effect_get_value },
{ "GetOperation", scriptlib::effect_get_operation },
{ "GetActiveType", scriptlib::effect_get_active_type },
{ "IsActiveType", scriptlib::effect_is_active_type },
{ "GetOwnerPlayer", scriptlib::effect_get_owner_player },
{ "GetHandlerPlayer", scriptlib::effect_get_handler_player },
{ "IsHasProperty", scriptlib::effect_is_has_property },
{ "IsHasCategory", scriptlib::effect_is_has_category },
{ "IsHasType", scriptlib::effect_is_has_type },
{ "IsActivatable", scriptlib::effect_is_activatable },
{ "IsActivated", scriptlib::effect_is_activated },
{ "GetActivateLocation", scriptlib::effect_get_activate_location },
{ "GetActivateSequence", scriptlib::effect_get_activate_sequence },
{ "CheckCountLimit", scriptlib::effect_check_count_limit },
{ "UseCountLimit", scriptlib::effect_use_count_limit },
{ NULL, NULL }
};
void scriptlib::open_effectlib(lua_State *L) {
luaL_newlib(L, effectlib);
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_rawset(L, -3);
lua_setglobal(L, "Effect");
}
......@@ -845,3 +845,54 @@ int32 scriptlib::group_meta_bxor(lua_State* L) {
interpreter::group2value(L, pgroup);
return 1;
}
static const struct luaL_Reg grouplib[] = {
{ "CreateGroup", scriptlib::group_new },
{ "KeepAlive", scriptlib::group_keep_alive },
{ "DeleteGroup", scriptlib::group_delete },
{ "Clone", scriptlib::group_clone },
{ "FromCards", scriptlib::group_from_cards },
{ "Clear", scriptlib::group_clear },
{ "AddCard", scriptlib::group_add_card },
{ "RemoveCard", scriptlib::group_remove_card },
{ "GetNext", scriptlib::group_get_next },
{ "GetFirst", scriptlib::group_get_first },
{ "GetCount", scriptlib::group_get_count },
{ "__len", scriptlib::group_get_count },
{ "ForEach", scriptlib::group_for_each },
{ "Filter", scriptlib::group_filter },
{ "FilterCount", scriptlib::group_filter_count },
{ "FilterSelect", scriptlib::group_filter_select },
{ "Select", scriptlib::group_select },
{ "SelectUnselect", scriptlib::group_select_unselect },
{ "RandomSelect", scriptlib::group_random_select },
{ "IsExists", scriptlib::group_is_exists },
{ "CheckWithSumEqual", scriptlib::group_check_with_sum_equal },
{ "SelectWithSumEqual", scriptlib::group_select_with_sum_equal },
{ "CheckWithSumGreater", scriptlib::group_check_with_sum_greater },
{ "SelectWithSumGreater", scriptlib::group_select_with_sum_greater },
{ "GetMinGroup", scriptlib::group_get_min_group },
{ "GetMaxGroup", scriptlib::group_get_max_group },
{ "GetSum", scriptlib::group_get_sum },
{ "GetClassCount", scriptlib::group_get_class_count },
{ "Remove", scriptlib::group_remove },
{ "Merge", scriptlib::group_merge },
{ "Sub", scriptlib::group_sub },
{ "Equal", scriptlib::group_equal },
{ "IsContains", scriptlib::group_is_contains },
{ "SearchCard", scriptlib::group_search_card },
{ "GetBinClassCount", scriptlib::group_get_bin_class_count },
{ "__add", scriptlib::group_meta_add },
{ "__bor", scriptlib::group_meta_add },
{ "__sub", scriptlib::group_meta_sub },
{ "__band", scriptlib::group_meta_band },
{ "__bxor", scriptlib::group_meta_bxor },
{ NULL, NULL }
};
void scriptlib::open_grouplib(lua_State *L) {
luaL_newlib(L, grouplib);
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_rawset(L, -3);
lua_setglobal(L, "Group");
}
......@@ -269,6 +269,7 @@ public:
static int32 card_reset_negate_effect(lua_State *L);
static int32 card_assume_prop(lua_State *L);
static int32 card_set_spsummon_once(lua_State *L);
static void open_cardlib(lua_State *L);
//Effect functions
static int32 effect_new(lua_State *L);
......@@ -322,6 +323,7 @@ public:
static int32 effect_get_activate_sequence(lua_State *L);
static int32 effect_check_count_limit(lua_State *L);
static int32 effect_use_count_limit(lua_State *L);
static void open_effectlib(lua_State *L);
//Group functions
static int32 group_new(lua_State *L);
......@@ -358,6 +360,7 @@ public:
static int32 group_is_contains(lua_State *L);
static int32 group_search_card(lua_State *L);
static int32 group_get_bin_class_count(lua_State *L);
static void open_grouplib(lua_State *L);
//Duel functions
static int32 duel_enable_global_flag(lua_State *L);
......@@ -577,6 +580,8 @@ public:
static int32 duel_swap_deck_and_grave(lua_State *L);
static int32 duel_majestic_copy(lua_State *L);
static void open_duellib(lua_State *L);
//group metamethods
//__len is in the group lib, which is same as group_get_count
static int32 group_meta_add(lua_State *L);
......@@ -596,6 +601,7 @@ public:
static int32 debug_reload_field_end(lua_State *L);
static int32 debug_set_ai_name(lua_State *L);
static int32 debug_show_hint(lua_State *L);
static void open_debuglib(lua_State *L);
};
#endif /* SCRIPTLIB_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment