Thread: [#181] RS Mod - Let's Do This Together

Page 5 of 13 FirstFirst ... 34567 ... LastLast
Results 41 to 50 of 128
  1. #41  
    Registered Member
    Join Date
    Dec 2018
    Posts
    14
    Thanks given
    0
    Thanks received
    3
    Rep Power
    11
    Looks great! Best of luck.
    Reply With Quote  
     

  2. #42  
    Renown Programmer

    Join Date
    Oct 2017
    Posts
    198
    Thanks given
    167
    Thanks received
    302
    Rep Power
    1567
    Added support to add custom item containers via plugins

    Code:
    val CUSTOM_ITEM_CONTAINER = ContainerKey("custom_container", capacity = 28, stackType = ContainerStackType.NORMAL)
    
    /**
     * Register the container key so the player de-serializer knows the capacity
     * and stack type when loading the container.
     */
    register_container_key(CUSTOM_ITEM_CONTAINER)
    
    on_command("add") {
        add_item_to_container(player, Item(Items.ABYSSAL_WHIP))
    }
    
    fun add_item_to_container(p: Player, item: Item) {
        val container = p.containers.computeIfAbsent(CUSTOM_ITEM_CONTAINER) { ItemContainer(p.world.definitions, CUSTOM_ITEM_CONTAINER) }
        container.add(item)
    }
    The register_container_key is something I didn't want to require when a plugin wants to serialize/deserialize a custom item container, however I thought of several issues that could come with serializing the capacity/stack type on the item containers themselves in player data (apart from not belonging there in the first place).

    This is then saved as (using JSON in this example):

    Code:
    "itemContainers": [
      {
        "name": "custom_container",
        "items": {
          "0": {
            "id": 4151,
            "amount": 1
          }
        }
      },
      {
        "name": "inventory",
        "items": {
          "0": {
            "id": 4151,
            "amount": 1
          },
          "1": {
            "id": 11941,
            "amount": 1
          }
        }
      }
    ],
    Reply With Quote  
     

  3. Thankful users:


  4. #43  
    WhiteDownMb | HYBRID JEFE
    Brett the Don's Avatar
    Join Date
    Dec 2009
    Posts
    2,117
    Thanks given
    349
    Thanks received
    556
    Rep Power
    2540
    Looking good mate I'm steady following this, keep up the good work!

    All of humanity's problems stem from man's
    inability to sit quietly in a room by himself




    Reply With Quote  
     

  5. Thankful user:


  6. #44  
    Registered Member
    JeztC's Avatar
    Join Date
    Jul 2016
    Age
    24
    Posts
    136
    Thanks given
    212
    Thanks received
    65
    Rep Power
    303
    Looking good!
    Reply With Quote  
     

  7. #45  
    (Official) Thanksgiver

    Arham's Avatar
    Join Date
    Jan 2013
    Age
    23
    Posts
    3,415
    Thanks given
    7,254
    Thanks received
    1,938
    Rep Power
    3905
    I absolutely adore the thread. Your code formatting with the colors made me have heart eyes. I also love the entire idea, and its been a dream of mine to make a server like this to be honest. Why isn't this server open source at the moment?
    Attached image
    Attached image
    Quote Originally Posted by MrClassic View Post
    Arham is the official thanker!
    List of my work here!
    Reply With Quote  
     

  8. Thankful user:


  9. #46  
    Renown Programmer

    Join Date
    Oct 2017
    Posts
    198
    Thanks given
    167
    Thanks received
    302
    Rep Power
    1567
    Quote Originally Posted by Arham View Post
    I absolutely adore the thread. Your code formatting with the colors made me have heart eyes. I also love the entire idea, and its been a dream of mine to make a server like this to be honest. Why isn't this server open source at the moment?
    appreciate the kind words brother!

    i'd like to integrate a few things before making it public, some things being required for a proper server like adding the position multiplier for gpi and others are implementing things such as Dagger 2 into the framework. i do have a time estimate of when i'd like to make it public though, so if i don't get to these things i'll still put it on github
    Reply With Quote  
     

  10. Thankful user:


  11. #47  
    Donator
    snurf's Avatar
    Join Date
    Oct 2015
    Posts
    582
    Thanks given
    70
    Thanks received
    92
    Rep Power
    0
    Very interesting, could shake up the whole RSPS scene! epic!
    Attached image
    Reply With Quote  
     

  12. #48  
    (Official) Thanksgiver

    Arham's Avatar
    Join Date
    Jan 2013
    Age
    23
    Posts
    3,415
    Thanks given
    7,254
    Thanks received
    1,938
    Rep Power
    3905
    Quote Originally Posted by Indova View Post
    appreciate the kind words brother!

    i'd like to integrate a few things before making it public, some things being required for a proper server like adding the position multiplier for gpi and others are implementing things such as Dagger 2 into the framework. i do have a time estimate of when i'd like to make it public though, so if i don't get to these things i'll still put it on github
    I really want to see your usage of Dagger 2. I personally tried using it for a project of mine (not RSPS) and failed tbh. Quite excited to see this open sourced.
    Attached image
    Attached image
    Quote Originally Posted by MrClassic View Post
    Arham is the official thanker!
    List of my work here!
    Reply With Quote  
     

  13. #49  
    Renown Programmer

    Join Date
    Oct 2017
    Posts
    198
    Thanks given
    167
    Thanks received
    302
    Rep Power
    1567
    added ScriptCompilationConfiguration for our KotlinPlugins which allow us to use something called defaultImports which will import all the packages we specify, behind-the-scenes. this saves us from having to manually import commonly-used packages/functions over and over.

    for example:

    Spoiler for previous:


    Code:
    package gg.rsmod.plugins.content.areas.edgeville.chat
    
    import gg.rsmod.game.model.entity.Player 
    import gg.rsmod.game.plugin.Plugin
    import gg.rsmod.plugins.api.Skills
    import gg.rsmod.plugins.api.cfg.Npcs
    import gg.rsmod.plugins.api.ext.*
    
    on_npc_option(npc = Npcs.ABBOT_LANGLEY, option = "talk-to") {
        player.queue { dialog(this) }
    }
    
    suspend fun dialog(it: Plugin) {
        it.chatNpc("Greetings traveller.", animation = 588)
        when (it.options("Can you heal me? I'm injured.", "Isn't this place built a bit out of the way?")) {
            1 -> {
                it.chatPlayer("Can you heal me? I'm injured.", animation = 554)
                it.chatNpc("Ok.", animation = 588)
                heal(it.player)
                it.messageBox("Abbot Langley places his hands on your head. You feel a little better.")
            }
            2 -> {
                it.chatPlayer("Isn't this place built a bit out of the way?", animation = 554)
                it.chatNpc("We like it that way actually! We get disturbed less. We<br>still get rather a large amount of travellers looking for<br>sanctuary and healing here as it is!", animation = 590)
            }
        }
    }
    
    fun heal(p: Player) {
        if (p.getSkills().getCurrentLevel(Skills.HITPOINTS) < p.getSkills().getMaxLevel(Skills.HITPOINTS)) {
            p.getSkills().setCurrentLevel(Skills.HITPOINTS, p.getSkills().getMaxLevel(Skills.HITPOINTS))
        }
    }


    Spoiler for now:

    Code:
    package gg.rsmod.plugins.content.areas.edgeville.chat
    
    on_npc_option(npc = Npcs.ABBOT_LANGLEY, option = "talk-to") {
        player.queue { dialog(this) }
    }
    
    suspend fun dialog(it: Plugin) {
        it.chatNpc("Greetings traveller.", animation = 588)
        when (it.options("Can you heal me? I'm injured.", "Isn't this place built a bit out of the way?")) {
            1 -> {
                it.chatPlayer("Can you heal me? I'm injured.", animation = 554)
                it.chatNpc("Ok.", animation = 588)
                heal(it.player)
                it.messageBox("Abbot Langley places his hands on your head. You feel a little better.")
            }
            2 -> {
                it.chatPlayer("Isn't this place built a bit out of the way?", animation = 554)
                it.chatNpc("We like it that way actually! We get disturbed less. We<br>still get rather a large amount of travellers looking for<br>sanctuary and healing here as it is!", animation = 590)
            }
        }
    }
    
    fun heal(p: Player) {
        if (p.getSkills().getCurrentLevel(Skills.HITPOINTS) < p.getSkills().getMaxLevel(Skills.HITPOINTS)) {
            p.getSkills().setCurrentLevel(Skills.HITPOINTS, p.getSkills().getMaxLevel(Skills.HITPOINTS))
        }
    }
    Reply With Quote  
     

  14. Thankful users:


  15. #50  
    Renown Programmer

    Join Date
    Oct 2017
    Posts
    198
    Thanks given
    167
    Thanks received
    302
    Rep Power
    1567
    been working on some behind-the-scene stuff like how external item data (bonuses, examines, render animations, etc) are saved/loaded onto server - just decided to move all this data onto the ItemDef which holds the data that's read from the cache, however the data I previously stated is loaded externally. decided to store it in the same place because at some point we will be packing this data onto the cache itself - which won't be transmitted to clients but still read on the server.

    content wise, finished up looting bag since I started it to test the item container plugin functionality where we can save custom containers and use it for content:

    Attached image

    from that gif u can also see that we now have wilderness overlay which isn't something we had before (added it for the 'can only store items in looting bag while in the wilderness' effect).
    Reply With Quote  
     

  16. Thankful users:


Page 5 of 13 FirstFirst ... 34567 ... LastLast

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. Would you let your girl do this?
    By Rukin1 in forum Videos
    Replies: 3
    Last Post: 02-20-2012, 04:20 AM
  2. Why/How does RS do this?
    By relex lawl in forum Help
    Replies: 3
    Last Post: 01-19-2012, 06:32 PM
  3. Replies: 1
    Last Post: 01-06-2012, 05:08 PM
  4. Replies: 12
    Last Post: 12-26-2009, 11:28 AM
  5. how can i do this?
    By Joe in forum General
    Replies: 2
    Last Post: 12-30-2007, 02:11 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •