Jump to content

[WIP] xMods - Making mods easier


Guest xeross155

Recommended Posts

  • Replies 50
  • Created
  • Last Reply

Top Posters In This Topic

the changes done in tc are from using-perspective only syntax changes.

As far as I understood the original intention of Xeross it is not about being able to add new hooks, but to be able to use hooks in a more generic way.

So this needs a fresh concept - and not simple a port from some tc changes...

Link to comment
Share on other sites

this is the question :P

https://github.com/DasBlub/mangos/tree/eventsystem is some very generic way for some more modern design ideas - which then also would make supporiting libs more generic.

At the moment all I can see here is to do what sd2 does, and perhaps add a few new hooks - especially I cannot see any idea how to genericly add something that "skipps" the adding of new hooks,

if you really need something new and powerfull, you won't find this in some other core or just by adding some new hooks..

The basic goal was to prevent merge-conflicts, and I cannot see any real way to prevent them except for basicly trivial stuff.. - but ofc I am curious for real ideas :)

Link to comment
Share on other sites

Well, the most easy way to do it would be to make it kinda like trinitycore (with hooks) and then add kick-ass many hooks with as many arguments as it is possible to get from that piece of code (im sure you get what i mean)

EDIT: I'm on to port over the "script hooks system" to mangos, it would be good if it were added to master, so people could add their own changes without having to suecide with the merging of new commits affecting their modified files i also like having "my own place" for non blizzlike contents, in my opinion you shall not bloat out your core with mods everywhere, it will be much cleaner customizations with script hooks, so xeross tell me how your idea really is :), i think i could port over the hooks system on a day or less when i get home to my loved codeblocks :)

- LilleCarl

Link to comment
Share on other sites

I don't understand how the Event system DasBlub has is really a big advantage over this. Hooks are replaced by events, but regardless the core would have to be changed to add or remove an event/hook.

Either way, I just think it should be #DEFINEd so that the people who want to use all sorts of mods can enable it and those who don't can leave it out and avoid the overhead of checking all the hooks.

Link to comment
Share on other sites

Just looked into scriptdev2's source a bit, and they got a few hooks (see https://github.com/scriptdev2/scriptdev2/blob/master/ScriptMgr.h)

   bool (*pGossipHello )(Player*, Creature*);
   bool (*pGossipHelloGO )(Player*, GameObject*);
   bool (*pGossipSelect )(Player*, Creature*, uint32, uint32);
   bool (*pGossipSelectGO )(Player*, GameObject*, uint32, uint32);
   bool (*pGossipSelectWithCode )(Player*, Creature*, uint32, uint32, const char*);
   bool (*pGossipSelectGOWithCode )(Player*, GameObject*, uint32, uint32, const char*);
   uint32 (*pDialogStatusNPC )(Player*, Creature*);
   uint32 (*pDialogStatusGO )(Player*, GameObject*);
   bool (*pQuestAcceptNPC )(Player*, Creature*, Quest const*);
   bool (*pQuestAcceptGO )(Player*, GameObject*, Quest const*);
   bool (*pQuestAcceptItem )(Player*, Item*, Quest const*);
   bool (*pQuestRewardedNPC )(Player*, Creature*, Quest const*);
   bool (*pQuestRewardedGO )(Player*, GameObject*, Quest const*);
   bool (*pGOUse )(Player*, GameObject*);
   bool (*pItemUse )(Player*, Item*, SpellCastTargets const&);
   bool (*pAreaTrigger )(Player*, AreaTriggerEntry const*);
   bool (*pProcessEventId )(uint32, Object*, Object*, bool);
   bool (*pEffectDummyNPC )(Unit*, uint32, SpellEffectIndex, Creature*);
   bool (*pEffectDummyGO )(Unit*, uint32, SpellEffectIndex, GameObject*);
   bool (*pEffectDummyItem )(Unit*, uint32, SpellEffectIndex, Item*);
   bool (*pEffectAuraDummy )(const Aura*, bool);

that is some kind of hooks, if i get it correct so it would just be to modify scriptdev2 a bit and then its done :)

Link to comment
Share on other sites

you better look at cipherCOMs eventsystem: https://github.com/cipherCOM/mangos/commits/eventsystem

my version was just some playing-around while he completely developed it and added many hooks.

the idea behind is, that you fire all the events in the core, no matter if there's any hook for it set up. so a first step would be to add the basic eventsystem to the core and then add all events and fire them inside the core. as of then, anyone can write his hooks and hook them up to any event(s).

i haven't looked at cipherCOMs eventsystem, but i think i remember correctly that he also had the m:n connection for events&hooks. so basically you can write a hook and hook it up to as many events as you want. on the other turn you can also hook up several hooks to the same event.

Link to comment
Share on other sites

Dasblub, how would that work with arguments of the event? like players killing eachother (need attacker and victim as pointers) i mean you cannot hook a event like that on another hook etc..? In my eyes this is a really Difficult way of writing something simple?, but sure its good that you can hook up the same hook to trigger evens with same arguments etc....

Link to comment
Share on other sites

you only pass one argument: the event. all events are based on the same base-class. that way, a hook can check what kind of event it is and then do something different with it.

also, this is the only clean way how to do it with the UNORDERED_SET (we added it to mangos a while ago: https://github.com/mangos/mangos/blob/master/src/framework/Utilities/UnorderedMapSet.h)

just have a look at cipherCOM's commit, you'll find examples for triggering events and for creating hooks for those. cipherCOM moved most of the output to events too, from what i can see.

and why are you using my avatar? it makes reading the forum very hard, i always think that it was me who wrote a post when i see one of yours :(

Link to comment
Share on other sites

Xeross when you say "disabling a mod" you just mean stop it from running anymore right? i mean that could be made with just one public variable that you change with a gm command, but if you wanna make each script in its own "application extention" (.so, .dll) etc... and unload it from ram and such for later loading again, you should look at Xenos Scripts for tc2 :)

Link to comment
Share on other sites

Xeross when you say "disabling a mod" you just mean stop it from running anymore right? i mean that could be made with just one public variable that you change with a gm command, but if you wanna make each script in its own "application extention" (.so, .dll) etc... and unload it from ram and such for later loading again, you should look at Xenos Scripts for tc2 :)

For now it will simply be a toggle in the mod yes m_enabled (It's already implemented just not with commands), and once we move to .so/.dll based stuff I indeed want to look into actual reloading of the .so/.dll.

Link to comment
Share on other sites

What I also wanted to do was make an easy way to disable mods during runtime, so they can be disabled with an in-game command, and then the ModMgr will check if a mod is enabled before firing its hooks or before calling its timer for example.

that should also be pretty easy to do with cipherCOMs eventsystem. just drop the hook from an event (-> remove it from the unordered_set) and you're done. creating a command for doing that shouldn't be too hard.

Link to comment
Share on other sites

What I also wanted to do was make an easy way to disable mods during runtime, so they can be disabled with an in-game command, and then the ModMgr will check if a mod is enabled before firing its hooks or before calling its timer for example.

that should also be pretty easy to do with cipherCOMs eventsystem. just drop the hook from an event (-> remove it from the unordered_set) and you're done. creating a command for doing that shouldn't be too hard.

I know it isn't that hard, just stating it, but thanks for the reply anyway.

Link to comment
Share on other sites

Eh just found out that mangos already got a damn scripting system xD, its just so uncomment it in cmake and then correct like 4 lines in the cmake file to get it working ;) already started implenting some hooks and shit to it, its the old simple way ive always wanted it to be ;)

- LilleCarl

Link to comment
Share on other sites

uh, i don't understand what you mean, lillecarl. yes, we do already have hooks and an example implementation of a library is here: https://github.com/mangos/mangos/tree/master/src/bindings/universal

the idea of this thread here is to implement a new way for the hooks, because the current one is more c-like than c++-like (using function-pointers and other such stuff) and it's only usable for a few things (creatures and stuff). the new way will allow us to create hooks for anything in mangos, not just player-interactions.

Link to comment
Share on other sites

this won't happen.

If you need new hooks, you can add them now as good as with any system currently out-there in use

Yes, but if the system would have been internal it is easier to code imo, since its a part of the core so you can access all classes and so on..... or am i wrong?

Link to comment
Share on other sites

If someone just made this on mangos:

https://github.com/TrinityCore/TrinityCore/commit/0cc053ea4d42ce405a915857f75ee00f0f65666b

Then i could begin working on my 2.4.3 project again and add more hooks as i feel for it, i could "hook up" the entire cores events i suppose ;P

- LilleCarl

This could really be the "thing" that we need :)

It would add much MUCH more flexibility and maybe, easier way of fixing/adding things.

Link to comment
Share on other sites

If someone just made this on mangos:

https://github.com/TrinityCore/TrinityCore/commit/0cc053ea4d42ce405a915857f75ee00f0f65666b

Then i could begin working on my 2.4.3 project again and add more hooks as i feel for it, i could "hook up" the entire cores events i suppose ;P

- LilleCarl

This could really be the "thing" that we need :)

It would add much MUCH more flexibility and maybe, easier way of fixing/adding things.

Good that someone indeed, but we need someone with a lil bit more skill to do it ;)

So i would love if a mangos developer could make a fork or just add it to the master, the only question is, will it work with multiple scripting libraries? Must be possible to solve in some way( maby its even easier, just add SD2's script to the cmake "project" and maby patch in some hooks and there we got SD2 in the core.

Also i prefer to "work near the core" since that extends the possibilities ermh..... ALOT

- LilleCarl

Link to comment
Share on other sites

yes, really, adding MANGOS_DLL_EXPORT in front of a class you for some reason need is really way too much effort -_-

There are legal reasons why scripting library is not included in mangos (as well as a content db)

There are working reasons why scripting is not included in mangos (different team-members - different knowledge)

There is no reason to change a fine(1) working system for something entirely useless.

(1) actually I am sure there can be made improvements in "syntax" or "style", but like most progress, it is about improving existing things, and not replacing..

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use