Dungeoneering (sketches)

Discussion in 'Plugin Development' started by Ozsi, Mar 11, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Ozsi

    Hello everyone!
    This is my first post on these forums, and I'm writing this for two reasons: I want to introduce the concept of my plugin, and to ask a technical question.

    So, back in december I made a plugin called dungeoneering for one of my friends' server. If you know the MMO runescape, then you know what it is about, you can skip the next paragraph.

    Dungeoneering in runescape is a team-based minigame where you are teleported into a randomly-generated dungeon with square rooms and minimal amount of starting items, where you have to work your way up (mine stuff, create your equipment) to kill a boss, and win the dungeon. There are puzzle rooms where you have to solve riddles, and there are some rooms that require some tricky moves to advance.

    So, to make things flexible I wrote my own eventmanager back in december, which was a bit more efficient than calling every registered eventlistener when ie. a BlockBreakEvent happened, and also allowed to remove listeners from the list.

    I'll explain how it worked with an example:
    In the rooms, there were doors (made of obsidian), which would only open if some conditions were met (for example the puzzle solved, or all the monsters killed). I registered the listener which opened the door to the eventlistener of the room itself, and the eventlistener of the room into the eventlistener of the dungeon. So if an attempt to open the door happened, the dungeon's eventlistener would pass the event only to the room where the event happened, thus saving some precious CPU time.

    So my question is:
    With the new event system, is it possible to write this kind of eventmanager nicely and efficiently? Because I used to be able to get a generic event's type, which was a crucial part of being efficient and also because I could write a general code to handle all event types at the same time. But if you have some better solution to my problem, then I'll be happy to hear about it.

    Cheers!
     
  2. Offline

    nisovin

    The current event system is supposed to be pretty efficient, you probably wouldn't gain much by building your own, especially since your system would just be built on top of the existing one (thus adding overhead). The new system can also unregister events.
     
  3. Offline

    teenspirit7

    Is there a way (with plugins) to make everyone that spawns on the server, have a certain item?

    Thanks
     
  4. Offline

    Ozsi

    nisovin: Thanks for your reply, this will probably be the right way to do things.

    teenspirit7: I don't know how you came to this question here, but there is the onPlayerRespawn event, you can use that to give items when spawning, so they won't start empty handed.
     
  5. Offline

    Sir Savary

    Ozsi

    Incorrect, you can use the PlayerLoginEvent to listen for a player to login, then see if that player has played before. If so, give them the item.
     
  6. Offline

    Jaker232

    *facepalm*
    I was going to work on a similar plugin, until you tramped my plans.
     
  7. Offline

    Ozsi

    Sir Savary:

    Well, he said spawning, he just didn't define what he meant by spawning. But you are right, they should be given an item at first login, too.

    Jaker232: I'm sorry to hear that, but maybe you should giving it a try, for three reasons:
    • I'm not a professional at writing nice code,
    • because of that I probably won't make the plugin for the public,
    • I don't want to translate it to English from Hungarian.
     
  8. Offline

    ZNickq

    Trust me, jaker isn't either :/
     
    Jaker232 likes this.
  9. Offline

    Jaker232

    I, therefore, meow (approve) this post.
     
    ZNickq likes this.
Thread Status:
Not open for further replies.

Share This Page