Forum Moderator VegaS™ 10264 Posted March 26, 2019 Forum Moderator Share Posted March 26, 2019 M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) This is the hidden content, please Sign In or Sign Up ( GitHub ) There's just a smart python module which i did for fun, for a friend, no support for implementation. Enjoy. Github repository: This is the hidden content, please Sign In or Sign Up 198 3 4 4 1 3 4 1 1 81 17 141 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10264 Posted March 27, 2019 Author Forum Moderator Share Posted March 27, 2019 Thanks to @Mithras01 that he reminded me about bisection years. (i'll update the repository when i'll have a bit more free time) Leap Year A normal year has 365 days. A Leap Year has 366 days (the extra day is the 29th of February). Leap Years are any year that can be exactly divided by 4 (such as 2012, 2016, etc) except if it can be exactly divided by 100, then it isn't (such as 2100, 2200, etc) except if it can be exactly divided by 400, then it is (such as 2000, 2400) def GetRangeDaysMonth(calendarMonth): def GetBisectionYear(year): """ Provides support for maintaining a list in sorted order without having to sort the list after each insertion. Return True for leap years, False for non-leap years. """ return year % 4 == 0 and (year % 100 <> 0 or year % 400 == 0) """ TODO-DONE: Fix the calendar range days-month if month is February and is a bisection year like 2016, 2020, 2024 ... """ return Math.OFFSETS_MONTH_RANGE_TUPLE[calendarMonth - 1] + (calendarMonth == 2 and GetBisectionYear(Math.GetCurrentYear())) Output-test: Spoiler print DBG_GetRangeDaysMonth(2, 2018) # February 2018 print DBG_GetRangeDaysMonth(2, 2019) # February 2019 print DBG_GetRangeDaysMonth(2, 2020) # February 2020 print DBG_GetRangeDaysMonth(2, 2024) # February 2024 <<<< 28 <<<< 28 <<<< 29 <<<< 29 2 1 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Matteo 46 Posted March 27, 2019 Share Posted March 27, 2019 Thanks Vegas! Is it possible to read the events from database? System Administrator @ Hungarian Government System Administrator @ Vibestro Freelancer Developer @ Various projects Link to comment Share on other sites More sharing options...
Active Member Helia01 2125 Posted March 27, 2019 Active Member Share Posted March 27, 2019 Oh my..... Why are you don't use DB? Link to comment Share on other sites More sharing options...
Forum Moderator VegaS™ 10264 Posted March 27, 2019 Author Forum Moderator Share Posted March 27, 2019 (edited) Why u guys don't read text-informations from Git? Spoiler EVENTS_CALENDAR_DICT is just a configuration for <Python-Live-Test>. The struct of the dictionary need to get it like EVENTS_CALENDAR_DICT = calendar.GetEventsData() << Source Client < Server Also i'm sure you didn't understand how's work too, check with careful, you don't need to add events for each day/week etc, all are automatic. 'WEEKLY' - 1 event = 48 objects (1 * 4 * 12) << Insert the event by a specific day of week for each month. 'DAILY' - 1 event = 336-372 objects (1 * 28-31 * 12) << Insert the event for all days in each month. 'MONTHLY' = 1 event = 1 object << Insert the event by a specific day of month. 'ANNUALLY' - 1 event = 1 object << Insert the event by a specific month, week from month and day from week. I said in the main post, this is just the python module part, the dictionary with config is just for live-test-debug, you've to parser how you want, from source client which is sended by a packet from server bla bla, is ur business how you want to do it, not mine, there's missing some things, you can get the classes/funcs and extend with your features/design etc. PS: This module is for people who know what they've to do and know to read the code and make it work as they want, not for beginners. As i said, don't ask for support implementation, the module doesn't contain all resources, is just for "developers". Edited August 21, 2022 by Metin2 Dev Core X - External 2 Internal 1 2 Check my GitHub Profile Click to find all the threads started by me [TOOL] Text file loader + JSON Link to comment Share on other sites More sharing options...
Forum Moderator Raylee 656 Posted March 27, 2019 Forum Moderator Share Posted March 27, 2019 Amazing as always Best regards Raylee Link to comment Share on other sites More sharing options...
Recommended Posts