Group Forums

Central

Imagination is more important than knowledge.
Feb 22, 2015
709
107


I used this in order to add Group Forums, but brings up this when I go to Group Forums and buy the forum, it sticks:
You must be registered for see images attach
 

Ghost

Legacy, it's all anyone leaves behind.
Jun 8, 2012
1,640
503
\Communication\Packets\Incoming\Groups\GetForumsListDataEvent.cs
Code:
using Plus.Communication.Packets.Outgoing;
using Plus.Communication.Packets.Outgoing.Groups;
using Plus.HabboHotel.GameClients;
using Plus.HabboHotel.Groups.Forums;
using System;
using Plus.Database.Interfaces;
using System.Collections.Generic;
using System.Data;

namespace Plus.Communication.Packets.Incoming.Groups
{
    class GetForumsListDataEvent : IPacketEvent
    {
        public void Parse(GameClient Session, ClientPacket Packet)
        {
            var int1 = Packet.PopInt();
            var int2 = Packet.PopInt();
            int int3 = Packet.PopInt();

            var forums = new List<GroupForum>();
            DataTable table;

            switch (int1)
            {
                case 2:
                    var Forums = PlusEnvironment.GetGame().GetGroupForumManager().GetForumsByUserId(Session.GetHabbo().Id);

                    if (Forums.Count - 1 >= int2)
                    {
                        Forums = Forums.GetRange(int2, Math.Min(int3, Forums.Count));
                    }

                    Session.SendPacket(new ForumsListDataComposer(Forums, Session, int1, int2, int3));
                    return;

                case 0:
                    using (IQueryAdapter adap = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        adap.SetQuery("SELECT g.id FROM groups as g INNER JOIN group_forums_thread_posts as posts, group_forums_threads as threads WHERE posts.thread_id = threads.id AND @now - posts.`timestamp`<=  @Sdays AND threads.forum_id = g.id GROUP BY g.id ORDER BY posts.`timestamp` DESC LIMIT  @Index,  @LiMiT");
                        adap.AddParameter("limit", int3);
                        adap.AddParameter("index", int2);
                        adap.AddParameter("now", (int)PlusEnvironment.GetUnixTimestamp());
                        adap.AddParameter("sdays", (60 * 60 * 24 * 7));
                        table = adap.GetTable();
                    }

                    foreach (DataRow Row in table.Rows)
                    {
                        GroupForum forum;
                        if (PlusEnvironment.GetGame().GetGroupForumManager().TryGetForum(Convert.ToInt32(Row["id"]), out forum))
                            forums.Add(forum);
                    }

                    break;

                case 1:
                    using (IQueryAdapter adap = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                    {
                        adap.SetQuery("SELECT g.id FROM groups as g INNER JOIN group_forums_thread_views as v, group_forums_threads as threads WHERE v.thread_id = threads.id AND threads.forum_id = g.id AND  @now - v.`timestamp` <=  @Sdays GROUP BY g.id ORDER BY v.`timestamp` DESC LIMIT  @Index,  @LiMiT");
                        adap.AddParameter("limit", int3);
                        adap.AddParameter("index", int2);
                        adap.AddParameter("now", (int)PlusEnvironment.GetUnixTimestamp());
                        adap.AddParameter("sdays", (60 * 60 * 24 * 7));

                        table = adap.GetTable();
                    }

                    foreach (DataRow Row in table.Rows)
                    {
                        GroupForum forum;

                        if (PlusEnvironment.GetGame().GetGroupForumManager().TryGetForum(Convert.ToInt32(Row["id"]), out forum))
                            forums.Add(forum);
                    }

                    break;
            }

            Session.SendPacket(new ForumsListDataComposer(forums, Session, int1, int2, int3));
        }

    }

}
Does your GetForumsListDataEvent.cs Look like that?
 

Damien

Don't need glasses if you can C#
Feb 26, 2012
434
647
Oh Jesus, if you have no idea what you're doing please don't bother replying.

The problem is located in the purchase event. I'm going to take a guess and say you haven't defined the extradata for the group forums interaction type, thus having it reset to an empty string by default. This causes an error due to the fact the extradata is used for the groupId, since the extradate is being reset that's why it's giving you the nasty error. But how do I go about fixing this? Simple. In PurchaseFromCatalogEvent.cs look for where the other group interactions are located, and add the group forums one into the case.

mF2NyJKmSva_rT_HURFffA.png


should be InteractionType.GUILD_FORUM:
 

eakz

New Member
Nov 22, 2017
1
0
Date/Time: 2019-03-07 15:09:52,126
Thread: 26
Exception:
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Convert.ToInt32(String value)
at Plus.Communication.Packets.Incoming.Catalog.PurchaseFromCatalogEvent.Parse(GameClient Session, ClientPacket Packet) in C:\Users\Sledmore\Desktop\PlusEMU\Communication\Packets\Incoming\Catalog\PurchaseFromCatalogEvent.cs:line 269
at Plus.Communication.Packets.PacketManager.TryExecutePacket(GameClient Session, ClientPacket Packet) in C:\Users\Sledmore\Desktop\PlusEMU\Communication\Packets\PacketManager.cs:line 154
at Plus.HabboHotel.GameClients.GameClient.parser_onNewPacket(ClientPacket Message) in C:\Users\Sledmore\Desktop\PlusEMU\HabboHotel\GameClients\GameClient.cs:line 65
 

Users who are viewing this thread

Top