inspircd / inspircd-contrib

Third-party InspIRCd module repository.
https://www.inspircd.org
66 stars 72 forks source link

Feature Request: Port m_rpg* modules to 3 #231

Closed KlaasT closed 3 years ago

KlaasT commented 4 years ago

It would be really great if the m_rpg modules would be ported to version 3. I tried it myself but I'm not getting them to compile.

Thanks very much.

SadieCat commented 4 years ago

cc: @CyberBotX

CyberBotX commented 4 years ago

I'll look into it this weekend most likely. If not this weekend, though, I'm not sure when, my free time is in flux lately.

KlaasT commented 4 years ago

That would be really great. Thanks.

CyberBotX commented 4 years ago

So I've only taken a cursory look at this, but the first error that comes up (maybe the only one?) is that it seems that the WriteChannelWithServ function no longer exists on the Channel class. I don't know what to replace that with.

SadieCat commented 4 years ago

Assuming you're sending a PRIVMSG:

ClientProtocol::Messages::Privmsg privmsg(ServerInstance->FakeClient, chan, "your message here", MSG_PRIVMSG);
Write(ServerInstance->GetRFCEvents().privmsg, privmsg);
ServerInstance->PI->SendMessage(channel, prefixChar, "your message here");
KlaasT commented 4 years ago

Stupid question. How would I create that FakeClient which is referenced here?

ServerInstance->FakeClient

genius3000 commented 4 years ago

Stupid question. How would I create that FakeClient which is referenced here?

ServerInstance->FakeClient

You don't, it will already exist as it's used for a few other server messages already. Are you getting an error related to this (that'd be strange)? If you're just looking into creating fake clients, I'm not sure at the moment on that. I think I looked into it before for an old module and it seemed not so nice to handle.

KlaasT commented 4 years ago

I haven't had a chance to try it yet. The reason I'm asking is that the module actually sends messages to the channel with fake Nicknames such as "Ambiance" or "NPC-1". Currently I don't understand how to set these fake names.

genius3000 commented 4 years ago

Ah okay. I haven't had to use much of these myself yet but looking at the available ClientProtocol::Messages::Privmsg constructors, there is one available for a string source (instead of User) and channel target. Should be able to use what @SaberUK said above but replace the ServerInstance->FakeClient User with a string, just like the original Write() was using.

Elizafox commented 3 years ago

I did a total rewrite of this module in pull #244.