Commit Graph

1200 Commits

Author SHA1 Message Date
Konrad Kuśnierz 7ea6c46b2c Add binary operations for lua
This is something I was always missing - posibbility to operate on
binary files or streams in pure lua. In most cases we do only need to
read simple variables from files such as integers with different amount
of bytes. This "class" will provide that ability.

It's a simple implementation of following C module for lua:
http://www.inf.puc-rio.br/~roberto/struct/

It has much less, though. Following elements have been implemented:

">" flag to set mode to big endian.
"<" flag to set mode to little endian.
"b" a signed char.
"B" an unsigned char.
"h" a signed short (2 bytes).
"H" an unsigned short (2 bytes).
"i" a signed int (4 bytes).
"I" an unsigned int (4 bytes).
"l" a signed long (8 bytes).
"L" an unsigned long (8 bytes).
"s" a zero-terminated string.

An example how to use it:

```lua
local packed = Struct.pack('<LIhBsb', 123456789123456789, 123456789,
-3200, 255, 'Test message', -1)
-- packed is now a lua string we can save to file as binary data
local L, I, h, B, s, b = Struct.unpack('<LIhBsb', packed)
print(L, I, h, B, s, b)
```

You can use g_resources.readFileContents as function to read binary
files and parse them via this class.
2015-05-18 21:38:05 +02:00
TheSumm fe98efdc21 Fix modal dialog auto sizing, fixes #556 2015-04-20 19:22:50 +02:00
TheSumm 8e5bbcd3a1 Add tab-spacing tag to MoveableTabBars 2015-04-20 03:32:32 +02:00
TheSumm 84f6cdec86 Fix #576, PopupMenus close when leaving the game 2015-04-19 13:56:03 +02:00
Łukasz Kurowski 01c107ba62 Market my offers 2015-04-07 01:24:39 +02:00
Łukasz Kurowski ff0947c270 NPC start talk 2015-03-31 10:37:49 +02:00
TheSumm b237b713ef Fix 10.76 login protocol, added missing lua consts 2015-03-09 16:46:26 +01:00
TheSumm 3bffa6b04a Terminal new line (Shift+Enter) functionality 2015-03-07 16:32:45 +01:00
TheSumm 83dc129f03 Protocol 10.76, fixed death window & death packet 2015-03-07 06:10:10 +01:00
Eduardo Bart 5387f8fe83 Merge pull request #632 from SuggestName/master
Minor change in statusLabel anchor for Ctrl + .
2015-02-23 11:49:05 -03:00
Suggest Name b5c7374890 Update textmessage.otui 2015-02-21 20:40:16 -02:00
TheSumm cbf70c1d63 Enable protocol 10.75 2015-02-15 03:25:43 +01:00
Mateusz Pawlica af0819f454 Changed rule violation window default focus 2015-01-31 22:31:58 +01:00
Mateusz Pawlica 27f7871a08 Minimap widget is now horizontally resizeable 2015-01-31 22:30:14 +01:00
TheSumm 6961492e00 Fix console tabs not blinking, closes #627 2015-01-30 19:56:56 +01:00
TheSumm 1c3cfddab0 Removed tr() from UIHeader 2015-01-28 00:01:53 +01:00
TheSumm 71931b961a Full protocol 10.74 support (session key), entergame style fixes 2015-01-27 23:44:37 +01:00
TheSumm 64e9406488 Fixed 'widget destroyed but still have 1 reference left' related to console module 2015-01-27 21:14:38 +01:00
TheSumm cb7cea6809 Tiny signalcall fix 2015-01-25 21:20:48 +01:00
TheSumm 4e2ded571e Fixed not being able to relog after reloading gamelib 2015-01-25 14:17:16 +01:00
TheSumm da2762dac3 Market now highlights offers which differ from the average price 2015-01-25 13:41:00 +01:00
TheSumm eb3c244023 More Market fixes
* Fixed NextButton and PreviousButton style
* Little update to SpinBox including dontSignal
* Market cleanup and more check to be safe
* Limit Market amountWindow by player balance
* Set proper maximum amount when creating offers
* Fixed fee label not calculating the correct fee sometimes
2015-01-25 02:28:53 +01:00
TheSumm 3157e7924f Market updates, now using showAs / tradeAs so every items works properly, some cleanup / bug fixing 2015-01-23 02:52:05 +01:00
TheSumm 92e2e8224f Added market message, reworked text messages a little 2015-01-22 20:38:28 +01:00
TheSumm 607dab01d6 Added Market column sorting (fixes #429), updated UITable and fixed not working methods 2015-01-21 23:40:15 +01:00
TheSumm 6edc73a8ba Fix Enter Game window not being centered on startup 2015-01-21 18:58:30 +01:00
TheSumm 596717bf32 Added locale number formatting to locale files 2015-01-20 16:18:04 +01:00
TheSumm b5cea41f87 Market fixes
- Market now works after reloading
- Fixed button / tab styles
- MarketRightTabBarButton now inherits the base style
- Fixed amountWindow buttons being hardly clickable
- "All" search filter is now on by default
2015-01-20 14:34:45 +01:00
TheSumm 8542f8bfd4 Protocol 10.73 support 2015-01-20 11:07:38 +01:00
TheSumm fc76ca4523 Updated advernturer blessing inventory style to be more robust 2015-01-19 01:52:49 +01:00
TheSumm a8f2bb19db Little polishing of Unjustified Points module 2015-01-18 23:56:44 +01:00
TheSumm ddec9627b8 Protocol 10.72 (Authenticator) Support, Unjustified Points diplay
- Unjustified Points (Better topbar icon would be nice)
![Unjustified Points](http://i.gyazo.com/81286f46d9b4d56b3fe864140173cf34.png)
- Authenticator token support
- adjusted 'can change pvp frame' to 1054
- ...
2015-01-18 15:14:07 +01:00
TheSumm 24b1526534 Fixed sending wrong OS 2015-01-11 18:50:58 +01:00
Konrad bf30fc0dc3 Add QEZC for diagonal walking as well as broadcast/red talk for gamemasters 2015-01-06 18:23:36 +01:00
TheSumm 50c36bb2ba Fix for adventurer blessing style 2014-12-30 16:40:20 +01:00
BenDol 16f6a0019c Fix dat loading issue with 10.00 & minor outfit window fix. 2014-12-30 17:27:53 +13:00
TheSumm 7f3f18f991 Support for Protocols up to 10.71, Adventurer Blessing 2014-12-29 18:08:33 +01:00
Konrad Kusnierz 5ada7eb5ec Fix #600 2014-11-20 21:14:25 +01:00
Konrad Kusnierz c49a6f3bf2 Fix for #596 2014-11-19 07:25:36 +01:00
BenDol 25e7b1d7a3 Fix logging in with 760 (until a better solution is found). 2014-11-04 13:27:21 +13:00
BenDol 9f3ebb0036 Fix #577 dash will now fire onWalk (with isDash parameter).
Also added missing client versions.
2014-11-03 12:23:00 +13:00
Sam 4e5707720b Merge pull request #574 from diath/patch-console
Support upper and lower case letters for hotkeys starting with #s, #y and #w
2014-10-05 20:50:29 +02:00
Kamil Chojnowski c8f9cdd6fa Support upper and lower case letters for hotkeys starting with #s, #y and #w 2014-10-05 19:27:02 +02:00
Kamil Chojnowski 7cfa9c38e0 Hide item image box when editing house lists 2014-10-05 19:24:34 +02:00
Ben Dol fa317c534d Merge pull request #548 from Shawak/master
string:contains()
2014-08-10 16:55:51 +12:00
BenDol ef7f94ac76 Some minor changes/additions. 2014-08-07 06:40:56 +12:00
BenDol 3343919c92 Added GameEnhancedAnimations to lua 2014-08-04 00:13:23 +12:00
BenDol c706dc12fe Update PIC_SIGNATURE can now access the character list. 2014-08-03 23:38:25 +12:00
BenDol 1f272b7aba Added preview state packet. 2014-08-03 23:22:06 +12:00
BenDol d7429c201c Started 1050 implementation and fix ups:
* Dat now loads (new animations aren't yet functional).
* Fixed the way we reference client versions.

TODO: Write new animation functionality & find out protocol changes.
2014-08-03 10:02:28 +12:00
Shawak 939e16c59a string:contains() 2014-07-31 20:25:31 +02:00
BenDol a52c938fef Added missing protocol versions & made some style fixes. 2014-07-30 19:58:34 +12:00
Sam 6b46370d1a 7.4 .dat support, playing an actual server might not work yet 2014-07-29 21:11:17 +02:00
BenDol c2ff89b2cf Some style fixes & menu-scroll to add server. 2014-07-26 21:56:51 +12:00
Sam 2a57a5f7d0 Browse field, locked & paginated container support 2014-07-15 23:27:44 +02:00
BenDol 9e0ddb08e3 More debug prints and avoid null pointer. 2014-07-14 01:56:17 +12:00
BenDol 74979ca16a Remove debug print and redundant checks. 2014-07-13 23:12:56 +12:00
BenDol 0c77179c46 Should check the menu category before creating a separator. 2014-07-13 22:57:45 +12:00
BenDol 935b9e4cd6 Forgot removeMenuHook function. 2014-07-13 22:39:56 +12:00
BenDol 0f362f80e3 Added easy menu hooking, fixed terminal default size/pos & more:
* Added autowalk style option to Minimap style.
* Added onCreate for setting up variables before styling is applied etc.
2014-07-13 22:27:09 +12:00
BenDol 0b5654f870 Style fixes and added dontSignal to UIRadioGroup. 2014-07-13 07:38:44 +12:00
Sam 4ec5048730 Remove test statement 2014-07-12 18:47:35 +02:00
Sam 6b8e810466 Merge branch 'master' of https://github.com/edubart/otclient 2014-07-12 18:44:15 +02:00
Sam 9b3e0a324c Color adjustments and fixes 2014-07-12 18:44:02 +02:00
BenDol f7531383f3 Fix an issue with the spinbox buttons. 2014-07-13 03:57:38 +12:00
BenDol 7724b8059d Forgot this from previous commit. 2014-07-13 02:10:30 +12:00
BenDol 2ada93db9c Should use the set minimum for these! 2014-07-13 02:08:33 +12:00
BenDol d070711409 When reaching max or min scroll allow other scroll areas to scroll. 2014-07-13 02:06:36 +12:00
BenDol 5909634837 Avoid ending mouse scroll chain when scroll bar is 'off'.
Also added mouse-scroll style to UISpinBox.
2014-07-13 01:46:47 +12:00
BenDol 9f7aafac0b Fix a crash issue when attempting to draw invalid item.
This can happen when using UIItem as interfaces etc.
2014-07-11 16:19:30 +12:00
BenDol 12b3bd4ee0 Fix table.equals 2014-07-09 17:00:10 +12:00
BenDol 9e30c39035 Pointless storing a reference to super. 2014-07-09 05:51:17 +12:00
BenDol 3dbcb1daee Added basic table.equals, dontSignal param to combobox calls & spell methods. 2014-07-09 04:07:02 +12:00
Sam a9d4fd5e1e Scrollmenu for Comboboxes, fixes #480 2014-07-03 18:15:38 +02:00
djayk1 9f8293a5a0 Update game.lua 2014-06-23 11:35:52 -03:00
BenDol ce9e443c60 Remove redundant classes & added some Position methods. 2014-06-10 01:44:03 +12:00
BenDol 99b1ddf44c Must change UIMap class checks to UIGameMap. 2014-06-07 05:05:57 +12:00
BenDol c083d02bef Some fixes for class names and queue (added base class). 2014-06-07 04:10:14 +12:00
BenDol 00253e46b3 Added Queue class for event queuing (see CandyBot for examples of this). 2014-06-04 02:17:49 +12:00
BenDol d2b7de3801 Will stick to basic isInRange check function. 2014-06-02 11:43:29 +12:00
BenDol adcf258551 Forgot to add this. 2014-06-02 10:05:26 +12:00
BenDol 2df51622ba Some improvements to some things. 2014-06-02 10:04:56 +12:00
BenDol a7d7667491 Added gamelib for Position functions. 2014-06-01 18:11:52 +12:00
Sam f23e70ff08 Fix battlelist square bug / Cleanup 2014-05-29 03:17:48 +02:00
Sam b96be291bb Fix use-with issue #508 2014-05-10 17:10:07 +02:00
BenDol 06855dd1de Added subType for Player:getItem/getItems. 2014-04-20 07:45:10 +12:00
BenDol 45b41b88bd Merge branch 'master' of https://github.com/edubart/otclient 2014-04-06 15:29:23 +12:00
BenDol 1baad726ae Just use g_configs.unload(config) to unload config files.
Avoids concurrent modification errors.
2014-04-06 15:29:02 +12:00
Nail 41b2f9b911 Per-pixel transparency. 2014-04-04 12:58:12 -03:00
BenDol 1074b6b787 Provide the option to suppress lua call in setText 2014-04-03 05:20:35 +13:00
BenDol d45fbcb10f Fixed terminal size bug 2014-04-02 20:50:36 +13:00
BenDol 3ce37dacbd Removed onUnload from corelib and added more lua bindings for resources. 2014-04-02 05:20:18 +13:00
BenDol 5204e3ac03 Proper termination and initialization of the ConfigManager. 2014-04-02 00:30:17 +13:00
BenDol 4b24c78f0f Fix to the makesingleton function. 2014-04-01 17:22:00 +13:00
BenDol 994f49b3c1 Better implementation for forming the singleton wrapper. 2014-04-01 17:08:07 +13:00
BenDol 79ee0e34ea Keep g_settings as a 'static' variable rather than a direct object. 2014-04-01 16:51:38 +13:00
BenDol b295053662 Finished stable implementation (as far as tested), still requires more testing. 2014-04-01 16:27:33 +13:00
BenDol 61059e66ec Started implementing ability to load custom config files (currently unstable).
Feel free to help out with this if you like :)
2014-04-01 05:43:31 +13:00
Sam 4f79a30689 Remove print from purse code 2014-03-13 00:13:39 +01:00
Sam a58a3e90c8 Implement purse slot (closes #208), add version 10.37 (could not find protocol changes) 2014-03-12 15:46:35 +01:00