Thread: [KT] Drop Tables 3 DSL

Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18
  1. #11  
    Extreme Donator

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    692
    Thanks given
    274
    Thanks received
    139
    Rep Power
    430
    2018/12/27

    I started on a next version of DropTable DSL because I was really inconvenienced that I limited myself to what I have with DT2. Don't get me wrong this shit is easy to write. But it is quite limited in terms of flexibility. Such as not being able to have the same weight for multiple brackets or only being limited to RandomTable for item ids and RandomRange for item amounts... That's why I am creating DS3. It will be more flexible. It will be more powerful. It will be more.

    DT2.7a (a for arbitrary because i didnt base this version on any measurable metric, not alpha) update brings some syntactic quality of life
    • Created util.Common
      • This is where objects and misc classes used throughout multiple files will go.
      • Best example is DO_NOTHING_X functions, they are functional types that can be used anywhere a functional type can, you just have to specify X, the amount of parameters. There are only 45 because kotlin 1.3's functional arity is 45.
        • These are better used than {_, _, ... _ ->} throughout your code, as these each only make 1 anonymous function and are much easier to check equality for default values while keeping your code non-nullable. {_, _ ->} is not equal (according to hashCode) to DO_NOTHING_2, despite doing the exact same thing, nothing.
    • Added default onAnnounce and default enableAnnounce from DT3
      • You can now define onAnnounce and enableAnnounce at the top level of a DropTable and all children created brackets will inherit these.
      • This is pure QOL syntactic sugar change. This is meant to minimize effort (assigning a bunch of onAnnounce and enableAnnounce with 1 definition) while keeping the same level of customizability (allowing you to override the suggested values inside the bracket).
      • These default values are only "suggested" to built brackets, and will not be used if the bracket has its own explicit onAnnounce or enableAnnounce.
      • If the "selected" enableAnnounce is false, neither the suggested nor defined onAnnounce will be used. DO_NOTHING_3 will be used.
      • Useful if you want to minimize typing in a case where say, one drop table you want all tables to announce with the same message. Except you don't want to announce the least rare one (-enableAnnounce). You also want the most rare one to have a unique message (onAnnounce { ... }).


    Inheritance\Suggestion example

    Attached image
    KT/JAVA - NBX 637 - HERE!
    KT - Drop table 4: Flexible, Powerful - HERE!
    KT - Command: Simplify writing commands - HERE
    KT - NbUtil: Make your kotlin easier - HERE
    KT - Hopping Islands: From Java to Kotlin - P1 - P2 - P3 - P4 - P5
    Reply With Quote  
     

  2. Thankful user:


  3. #12  
    Extreme Donator

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    692
    Thanks given
    274
    Thanks received
    139
    Rep Power
    430
    2019/01/03

    DT2 updates
    • Inlined a lot of stuff so less separate binary garbage files are produced and performance over extremely large unrealistic tests of hundreds of millions of item draws is increased around 5%


    Development on DT3 has started! Current version is 3.04b
    • Completely rewritten everything (RandomUtil and Components are the most notable)
    • New RandomUtil class and a few new extensions! (2 randTo 10) creates RandomIntRange(2, 10, inclusive=true), (RandomIntRange step 2) creates RandomIntProgression(range.start, range.stop, 2). RandomIntProgression has all the same values as the equivalent IntProgression, but you can get a random Int from it rather than having to map it to a list\array and get the random result from that.
    • Much higher level of abstraction compared to the quite rigid structure of DT2. You will be able to add BaseRandom<Int> as ItemProducer (previously ItemGenerator) ItemId AND ItemAmount, so if you really want to you can get really deep with this. You can also put multiple brackets in the same bracket.
    • Improved DSL Syntax, while still being very similar to (but not copypaste compatible with) DT2. Most notable change is no more un-wrapped ranges (ex: with amounts 2 to 10 step 2 -> with amounts (2 to 10 step 2))
    KT/JAVA - NBX 637 - HERE!
    KT - Drop table 4: Flexible, Powerful - HERE!
    KT - Command: Simplify writing commands - HERE
    KT - NbUtil: Make your kotlin easier - HERE
    KT - Hopping Islands: From Java to Kotlin - P1 - P2 - P3 - P4 - P5
    Reply With Quote  
     

  4. #13  
    Extreme Donator

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    692
    Thanks given
    274
    Thanks received
    139
    Rep Power
    430
    2019/01/04

    DT3.3 - Haven't found any bugs yet, here's to hoping lmao
    • Finished rewriting all components (ItemProducer, Bracket, DropTable) to DT3 spec (Flexible, Powerful, Customizable) and their builders. Very similar usage.
      • ItemProducer in DT3 is equivalent to ItemGenerator in DT2
      • Bracket in DT3 can now either be a SingleBracket (which can only produce anything that extends ProducesItem), or a MultiBracket (which can produce SingleBracket or anything that extends ProducesItem). This is good because it allows you to have multiple brackets for the same weight without fucking up the MemoWeightedTable's formula, as well as let you diversify what those brackets do onAnnounce! Multiple Brackets per weight with separate onAnnounce functions is why I created DT3. It was extremely beneficial to rewrite nearly everything from the ground up rather than rewrite everything from the inside out.
      • Nothing super notable about DropTable, its basically just a holder of Brackets.
    • Fixed bug in BaseRandom, not sure how I DIDNT have any compilation or runtime problems (BaseRandom was still extending ProducesWhenPicked<T> which didn't exist rather than Produces<T>)... fuck it
    • Removed a lot of vestigial reused DT2 code
    • Rewrote MorUlRek Gem Stall in DT3!


    This is rewritten to increment the weight in a Map every time the bracket is called
    Spoiler for Rewritten + Cherry picked results:

    Attached image
    Attached image


    Bitbucket: https://bitbucket.org/Nbness2/droptable/src/DT3/
    KT/JAVA - NBX 637 - HERE!
    KT - Drop table 4: Flexible, Powerful - HERE!
    KT - Command: Simplify writing commands - HERE
    KT - NbUtil: Make your kotlin easier - HERE
    KT - Hopping Islands: From Java to Kotlin - P1 - P2 - P3 - P4 - P5
    Reply With Quote  
     

  5. #14  
    Extreme Donator

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    692
    Thanks given
    274
    Thanks received
    139
    Rep Power
    430
    2019/01/06

    DT3.4
    • Fixed bug where Bracket would not inherit from DropTable using Builder syntax
    • MultiBracket now more truthful to its name, can hold multiple Brackets rather than only multiple SingleBrackets
    • Renamed and visually upgraded (better to look at) a bit of code
    KT/JAVA - NBX 637 - HERE!
    KT - Drop table 4: Flexible, Powerful - HERE!
    KT - Command: Simplify writing commands - HERE
    KT - NbUtil: Make your kotlin easier - HERE
    KT - Hopping Islands: From Java to Kotlin - P1 - P2 - P3 - P4 - P5
    Reply With Quote  
     

  6. #15  
    Extreme Donator

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    692
    Thanks given
    274
    Thanks received
    139
    Rep Power
    430
    2019/01/07
    DT3.5
    • You can now specify a custom weight calculation formula if you so wish. This way, you don't have to calculate it everywhere else in your code, just one place!
    • Removed pickItemList and pickItemMap from MemoWeightedTable and DropTable. I didn't see any real use for them.
    • Added DslMarker annotations to builders, this makes sure you can't do something weird like build an ItemProducer inside of an ItemProducer or DropTable unless explicitly stated using this@xxx


    Spoiler for custom calc:

    Attached image
    KT/JAVA - NBX 637 - HERE!
    KT - Drop table 4: Flexible, Powerful - HERE!
    KT - Command: Simplify writing commands - HERE
    KT - NbUtil: Make your kotlin easier - HERE
    KT - Hopping Islands: From Java to Kotlin - P1 - P2 - P3 - P4 - P5
    Reply With Quote  
     

  7. #16  
    Extreme Donator

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    692
    Thanks given
    274
    Thanks received
    139
    Rep Power
    430
    2019/01/10
    DT3.6
    • Added onSelect
      • onSelect is a function you can define to trigger every time a bracket is picked regardless of whether or not announceDrop is enabled
      • onSelect can be defined in both DropTable and Bracket
      • onSelect will be suggested to any children. Reminder that children will refuse the suggestion if the child already has an one already explicitly defined.
      • onSelect can be useful if you want to do something when, say, you get a pick from a specific table. An example would be firework graphics or maybe incrementing progress towards an achievement.
    • Reduced keystrokes required to create a DropTable
      • Added 'add producer {...}' as a shorter alternative to 'add itemProducer {...}'
      • You now don't have to type "add bracket {...}" or "add producer {...}", you can now remove the "add " part and just type "bracket {...}" or "producer {...}"
      • As a byproduct of basically calling a function now rather than using a variable and infix function, less stress is put on the IDE when using reduced keystroke builders.
      • This change is back-compat, i didnt remove the "add bracket" and "add producer" functions.
    • Added sub-bracket name inheritance using a String class similar to my StateBoolean
      • All sub brackets will inherit the name from their parent bracket and add on to it
      • The idea behind this is to have the parent bracket's name an adjective and the child bracket's name be the subject and the child's children any extra descriptor.
      • For example a parent bracket named "Glowing" that has has a child named "Swords" will result in the childs actual name being "Glowing Swords", and the child's child bracket being named "of Might" will result in the child's child's name being "Glowing Swords of Might"
    • Misc
      • Changed calculateWeights signature from ((Int) -> Double)? to (Int) -> Double and now the default is defaultWeightCalculation
      • Reorganized code
      • Removed BuilderCommon.Set objects. With things that should only be used once in the builder, you use With.


    DT 2.8
    • Added onSelect from DT3 (read above)
    • added reduced keystroke builders ("add producer {...}" -> "producer {...}") from DT3
    • Removed 2 empty lines from DropTable class file
    • added a space before +enableAnnounce in the test bracket in the builders file


    Spoiler for images:

    Reduced typing on bottom
    Everything in onSelect will happen regardless of announceDrop being enabled or disabled
    Attached image
    KT/JAVA - NBX 637 - HERE!
    KT - Drop table 4: Flexible, Powerful - HERE!
    KT - Command: Simplify writing commands - HERE
    KT - NbUtil: Make your kotlin easier - HERE
    KT - Hopping Islands: From Java to Kotlin - P1 - P2 - P3 - P4 - P5
    Reply With Quote  
     

  8. #17  
    Extreme Donator

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    692
    Thanks given
    274
    Thanks received
    139
    Rep Power
    430
    2019/07/02

    DT3.8
    • Put in a jar
    • Now in rspsUtil namespace
    • Made generic
      • Generic using the same thing I used for Container, the ItemAccessWrapper<T> where T is your item class.
      • If you are using the DSL, all you have to do is put (accessWrapperName) after DropTable (so DropTable(accessWrapperName)) and it should work the same as before


    Source not pushed yet, as I need to clean up this ugly poop.
    I will be adding support for my most recent RandomUtil sooner or later. This feels as though it is a more important release, as it previously locked people in to using my source code and Item class but now it does not, as it lets you use whatever you want for the item class.
    A new improved ItemAccessWrapper is coming as well, supports item attributes.

    JAR DOWNLOAD

    Spoiler for pic:

    AFTER the rewrite of internals, all I had to add to get the table working again was the stuff circled in red.
    Attached image


    2019/07/03

    DT3.9
    • You can now put an extra type which will be used as the new first parameter in onSelect and onAnnounce. I use it for player, personally.
    • Added a tutorial on main post
    KT/JAVA - NBX 637 - HERE!
    KT - Drop table 4: Flexible, Powerful - HERE!
    KT - Command: Simplify writing commands - HERE
    KT - NbUtil: Make your kotlin easier - HERE
    KT - Hopping Islands: From Java to Kotlin - P1 - P2 - P3 - P4 - P5
    Reply With Quote  
     

  9. #18  
    Extreme Donator

    nbness2's Avatar
    Join Date
    Aug 2011
    Posts
    692
    Thanks given
    274
    Thanks received
    139
    Rep Power
    430
    2021/06/18

    DropTable 4.0

    There is NO 3 to 4 changelist as DropTable has been re-written from the ground up! However, here's a list of features 
    • Separated in to 2 modules, one being the more generic ProducerUtil (of which is a dependency to the latter), and DropTable which is an elaborate Producer wrapper.
      • ProducerUtil essentially boils down to a single function, Producer<T>.produce(Arguments) -> T with some helpers to help you along the way in your journey.
    • No more named parameters and parameter clutter, I am now welcoming ArgumentKey<T> and Arguments in to the fold.
      • This means you can just... call the damn producer! While making sure you are setting the target, of course...
      • Modify arguments as they pass through the pipes
      • Check out your arguments when onSelect is called
    • Lighter weight! DropTable used to come with the full RandomUtil with it but now it only comes with what it needs (the random tables) and a few useful helpers (Like the random integral ranges and progressions)
    • Much much more flexible and powerful than DropTable 3 ever could even dream about approaching the level of.
    • Make whatever you want in to a Producer simply by calling .toProducer()
    • NO WRAPPERS REQUIRED, JUST SHAKE AND BAKE BABY!!
    • A brand new type of table: MultiRollTable
      • Every producer you put in has whatever chance you get it to be picked no matter what else is rolled on
      • You can have anywhere from 0 to size drops depending on how lucky you are!
      • This is generally a good spot to put exclusive tables, it's useful for stuff like dropping bones and a drop and maybe even something else all within 1 thing


    very quick and insufficient but FUNKY demonstration


    Spoiler for Exclusive Table Sample:

    Attached image


    Spoiler for Multi Roll Sample:

    Attached image


    Spoiler for How to call (including argument usage):

    Attached image


    KT/JAVA - NBX 637 - HERE!
    KT - Drop table 4: Flexible, Powerful - HERE!
    KT - Command: Simplify writing commands - HERE
    KT - NbUtil: Make your kotlin easier - HERE
    KT - Hopping Islands: From Java to Kotlin - P1 - P2 - P3 - P4 - P5
    Reply With Quote  
     

  10. Thankful user:


Page 2 of 2 FirstFirst 12

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [KT] Drop Tables 3 DSL
    By nbness2 in forum Snippets
    Replies: 17
    Last Post: 06-22-2021, 01:49 AM
  2. Replies: 23
    Last Post: 01-17-2014, 05:30 AM
  3. [PI] Underingstanding The Rare Drop Table
    By Merrow in forum Snippets
    Replies: 4
    Last Post: 04-06-2013, 04:59 AM
  4. perfect tormented demon drop table
    By Teemuzz in forum Configuration
    Replies: 21
    Last Post: 03-30-2010, 05:17 PM
  5. Drop Tables.
    By Bando in forum RS2 Server
    Replies: 21
    Last Post: 02-13-2010, 10:12 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •