d303Fix

d303Fix

63.3k Downloads

Description

Patch 3.0.3 added many good things, but also broke many others - addons dependend on Lua's os object. For last few days (from 2010-08-11) I was trying to make all addons work without changes and updates to them (including pbInfo).

Version v0.3 adds additional tool needed to create small lua file containing system time stamp at boot time. Lite versions are without this tool. Version v0.5 permanently removes executable file.

This addon replaces all os functions, including proper formatting and behavior.

Importatnt

  • Curse has long delays when it gets to approving new packages, it is common that you see new description but there is no file yet. Please verify version that you download, if it isn't latest then you can visit Polish project page. You might also check repository if you are interested.
  • There is a rumor that this addon do not work in US. It works, but due to alack of testers it get's a long time to catch all errors and incompatibilities. Please read Change Log.
  • Before installing any version please read installation instructions.
  • If you don't like it don't use it, or be helpful and describe your problem.
  • If you want to include this addon in your addon, please, you can do what you want, but try to load it only when user do not have a separate instance of this addon and hook up to your frame events (OnLoad, OnEvent, OnUpdate). You might brake a few things if you brake that rule.
  • Befor you post an error read Bug Reports.

Repository

I use my own SVN repository server. You may find current working copy here.

Thanks

I would want to thank some people here for contributing to this project in different ways. First of all I would like to thank anonymous contributor which posted changes and fixes to addon on my website. Next is one of the users of US forum which pointed out one of Item Shop functions which is capable of returning item description including promotion times from which date and time is set.

I would also want to thank authors of FunctionWatch and InGameScripts addons. Without them I would explore Item Shop functions for a week.

Thank you all for testing especially for those which reported problems and described them very well.

Development

Attention

First of all I would like to ask all developers to check for os object existence before overriding it.

Checking

If you want to check if current os object implementation is created by this addon you might try this method:

if os and d303Fix then
    -- This is d303Fix
end

Additional Functions

All os functions are available through both os and d303Fix objects. d303Fix object allows you to use few more functions:

  • IsAnyNil(param) - Check if param or any of element (if param is a table) is nil. If so function will return true and name of key in table (if element has name) or nil if param was not a table. In other case function returns false and nil.
  • IsLeapYear(year) - Function will return true if year is a leap year and false if not.
  • print(string) - Function will display passed string in default chat window. This function is a exception and is defined also in os object.
  • SafeLoadFile(filename) - Will try to load file by first checking if it exist. If not chat message will be displayed and return value will be false, otherwise file will be loaded and terurn value will be true.
  • SetTime(param) - Allows to set current time by using parameter in one of three types:
    • number - time in seconds from 1970-01-01
    • string - Date and time in standard ISO format yyyy-MM-dd HH:mm:ss
    • table - Date and time in form of standard lua time table.
  • Reset() - Reset date and time base to 1970-01-01 and clear all variables, this will force probing Item Shop for current date (if this feature is enabled)
  • Version - d303Fix version string.

Change Log

v0.9

  • Suggestions from comments on my site and here.
    • Elements in date and time table aren't mandatory.
    • Automatic screenshot after logon (disabled as default).
    • Automatic screenshot after Item Shop probing fails (disabled as default).
    • Second parameter in date function allows to pass date and time which will be formatted.
    • Two new parameters to */dtss command.
    • Few other small suggestions.
  • Improvements allowing to make code shorter.
  • Extended configuration window to include new configuration options.
  • Russian translation, without configuration by tasquer

v0.8

  • Settings save is fixed.
  • Few minor fixes
  • New command opening configuration window.
  • Integration with AddonManager.

v0.7

  • Compatibility fixes (ntBuff).
  • Fixed error reported by matif. Now negative time values are parsed when reading from Item Shop.

v0.6

  • Fixes to time shift issues.
  • Added slash commands to regulate time shift and enable or disable time gathering methods. (See Usage)
  • Added chat message if os object exists, but still it is redeclared.
  • New useful functions.
  • Strings extracted to table for easy translation.

v0.5

  • Current date and time is extracted without user interaction.
  • Reimplemented time calculations.
  • os object is now only a wrapper of d303Fix object.
  • Executable file is permanently removed.

v0.4 Lite

  • Removed executable file (source code for tool is still attached).

v0.4

  • Ability to set time by taking a screen shot.
  • Code clean up.

v0.3

  • Current local system date and time support. (See installation notes on main page)
  • Localization (English/Polish)
  • New helper function (os.settime). (See code for details).
  • Correct week day name and value.
  • Current version adds additional tool (with source code) needed to create small lua file containing system time stamp at boot time.

v0.2

  • ! not ignored in os.date(). It takes game time into formatting.
  • Using os.date("!*t") you will get game time struct (hour and min are correct, game time has minute precision)
  • %% string is changed to % sign like in original implementation.
  • Extended tests.
  • Day and month names have a long name.

v0.1

  • Remove all os related bugs from addons.
  • Complete list of os functions.
  • Simple tests when invoking os.test()

Installation

  • Backup your settings. Many people complained that this addon broke other addons, it shouldn't, but backing up stuff is always a good idea.
  • Uninstall versions older than v0.7. Just remove addon folder (%ROM%\Interface\AddOns\_d303Fix)
  • Extract package to AddOns folder (%ROM%\Interface\AddOns\)

Continue only for version v0.3 and v0.4

At this point all game AddOns problems are solved, except for valid date time. But if you want to have correct date and tame, proceed:

  • Go into AddOn folder (%ROM%\Interface\AddOns\_d303Fix)
  • Create shortcut in autostart to _d303Fix.prepare.exe.
  • If you want to play the game before restart you may launch _d303Fix.prepare.exe now.

Usage

Addon provides two slash commands allowing to manipulate it's behavior (all changes are saved):

  • /dt (/os) - is related to configuration window.
    • /dt - Show configuration window.
    • /dt hide - Hide configuration window.
  • /dtis (/osis) - is related to Item Shop time retrial feature. Usage:
    • /dtis help - Displays short help message.
    • /dtis off - Disable date and time info retrial from Item Shop.
    • /dtis on - Enable date and time info retrial from Item Shop.
    • /dtis [hours] - Change time shift value (default 2) and reset time in order to read it again from Item Shop. Use this to adjust your clock.
    • /dtis - Reset time in order to read it again from Item Shop.
  • /dtss (/osss) - is related to extracting date info from screenshot name. Usage:
    • /dtss help - Displays short help message.
    • /dtss off - Disable date and time info retrial from screenshot name.
    • /dtss on - Enable date and time info retrial from screenshot name.
    • /dtss auto - Toggle ability to set time from Screenshot name on login.
    • /dtss fail - Toggle ability to set time from Screenshot name when ItemShop probing fails.
    • /dtss - Take a screen shot (regardless of above setting).

Bug Reports

Please do not post comments or send messages telling that it doesn't work. If you want to complain then go get a glass of watter, but if you want to help, post a comment or send a message with as detailed description as you can. It doesn't hurt and can make work much faster. Once again I want to thank all people that were sending their feedback, suggestions and error reports.

  • Before posting an error check if:
    • You have latest described version (Change log)
    • Addon loads first (check chat messages, top one should be fenerated by d303Fix)
    • Addon which brakes do not override os object. (In that case contact it's author)
    • Is message related to os or d303Fix object.

Patches

If you develop a patch which you want to share, you can send it to me and if I like it I will include it.

About external tool (v0.3 / v0.4 only):

  • _d303Fix.prepare.exe must be started after each reboot inside AddOn directory.
  • _d303Fix.prepare.exe only creates a file (in current directory - see above) and exits.
  • _d303Fix.prepare.exe source is available in package (_d303Fix.prepare.c), if you wish to use your own compilation.

Things that do not work or need fixing:

  • Saving time flag is constant.

Polish project page.

Please leave a comment on Curse or on my page with suggestions/fixes/solutions.