BCStorm - Show Join Date of Group Members
This is a little fix that was requested by someone.
It will show the group members join dates.
http://hubbahubba.no-ip.biz/downloads/screens/jd.png
First in MyGuilds.cs find:
PHP Code:
public List<int> Members;
Ater that put:
PHP Code:
public List<string> JoinDates;
Now find:
PHP Code:
public MyGuild(int id, string name, int ownerid, string ownername, string description, int roomid, string image, int customcolor1, int customcolor2, int guildbase, int guildbasecolor, List<int> guildstates, string htmlcolor1, string htmlcolor2, string datecreated, List<int> members, List<int> petitions, int type, int rightstype, Dictionary<int, int> guildranks
Replace that entire void with:
PHP Code:
public MyGuild(int id, string name, int ownerid, string ownername, string description, int roomid, string image, int customcolor1, int customcolor2, int guildbase, int guildbasecolor, List<int> guildstates, string htmlcolor1, string htmlcolor2, string datecreated, List<int> members, List<int> petitions, int type, int rightstype, Dictionary<int, int> guildranks, List<string> joindates)
{
this.Id = id;
this.Name = name;
this.OwnerId = ownerid;
this.OwnerName = ownername;
this.Description = description;
this.RoomId = roomid;
this.Image = image;
this.CustomColor1 = customcolor1;
this.CustomColor2 = customcolor2;
this.GuildBase = guildbase;
this.GuildBaseColor = guildbasecolor;
this.GuildStates = guildstates;
this.HtmlColor1 = htmlcolor1;
this.HtmlColor2 = htmlcolor2;
this.DateCreated = datecreated;
this.Members = members;
this.Petitions = petitions;
this.Type = type;
this.RightsType = rightstype;
this.GuildRanks = guildranks;
this.JoinDates = joindates;
}
Now open Guilds.cs
Replace the content with
PHP Code:
namespace Butterfly.HabboHotel.Habbo.Guilds
{
using Butterfly;
using Butterfly.HabboHotel;
using Database_Manager.Database.Session_Details.Interfaces;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
internal class Guilds
{
public Queue deleteGuild = new Queue();
public Dictionary<int, MyGuild> loadedGuilds = new Dictionary<int, MyGuild>();
public Queue loadGuild = new Queue();
public MyGuild AddGuild(int id, string name, int ownerid, string ownername, string description, int roomid, string image, int customcolor1, int customcolor2, int guildbase, int guildbasecolor, List<int> guildstates, string htmlcolor1, string htmlcolor2, string datecreated, List<int> members, List<int> petitions, int type, int rightstype, List<string> joindates)
{
Game game = ButterflyEnvironment.GetGame();
game.LastGuildId++;
id = ButterflyEnvironment.GetGame().LastGuildId;
MyGuild g = new MyGuild(id, ButterflyEnvironment.FilterInjectionChars(name), ownerid, ownername, ButterflyEnvironment.FilterInjectionChars(description), roomid, image, customcolor1, customcolor2, guildbase, guildbasecolor, guildstates, htmlcolor1, htmlcolor2, datecreated, members, petitions, type, rightstype, new Dictionary<int, int>(), joindates);
string str = "";
foreach (int num in guildstates)
{
str = str + num + ";";
}
str = str.Substring(0, str.Length - 1);
using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("INSERT INTO groups (Id, Name, OwnerId, OwnerName, Description, RoomId, Image, CustomColor1, CustomColor2, GuildBase, GuildBaseColor, GuildStates, HtmlColor1, HtmlColor2, DateCreated) VALUES (@id, @name, @ownerid, @ownername, @description, @roomid, @image, @color1, @color2, @guildbase, @guildbasecolor, @guildstates, @htmlcolor1, @htmlcolor2, @datecreated)");
adapter.addParameter("id", id);
adapter.addParameter("name", ButterflyEnvironment.FilterInjectionChars(name));
adapter.addParameter("ownerid", ownerid);
adapter.addParameter("ownername", ownername);
adapter.addParameter("description", ButterflyEnvironment.FilterInjectionChars(description));
adapter.addParameter("roomid", roomid);
adapter.addParameter("image", image);
adapter.addParameter("color1", customcolor1);
adapter.addParameter("color2", customcolor2);
adapter.addParameter("guildbase", guildbase);
adapter.addParameter("guildbasecolor", guildbasecolor);
adapter.addParameter("guildstates", str);
adapter.addParameter("htmlcolor1", htmlcolor1);
adapter.addParameter("htmlcolor2", htmlcolor2);
adapter.addParameter("datecreated", datecreated);
adapter.runQuery();
adapter.runFastQuery(string.Concat(new object[] { "UPDATE rooms SET GroupId = '", id, "' WHERE Id = '", roomid, "'" }));
}
this.QueueAddGuild(g);
return g;
}
public string GenerateGuildImage(int GuildBase, int GuildBaseColor, List<int> GStates)
{
List<int> list = GStates;
string str = "";
int num = 0;
string str2 = "b";
if (GuildBase.ToString().Length >= 2)
{
str2 = str2 + GuildBase;
}
else
{
str2 = str2 + "0" + GuildBase;
}
str = GuildBaseColor.ToString();
if (str.Length >= 2)
{
str2 = str2 + str;
}
else if (str.Length <= 1)
{
str2 = str2 + "0" + str;
}
int num2 = 0;
if (list[9] != 0)
{
num2 = 4;
}
else if (list[6] != 0)
{
num2 = 3;
}
else if (list[3] != 0)
{
num2 = 2;
}
else if (list[0] != 0)
{
num2 = 1;
}
int num3 = 0;
for (int i = 0; i < num2; i++)
{
str2 = str2 + "s";
num = list[num3] - 20;
if (num.ToString().Length >= 2)
{
str2 = str2 + num;
}
else
{
str2 = str2 + "0" + num;
}
int num5 = list[1 + num3];
str = num5.ToString();
if (str.Length >= 2)
{
str2 = str2 + str;
}
else if (str.Length <= 1)
{
str2 = str2 + "0" + str;
}
str2 = str2 + list[2 + num3].ToString();
switch (num3)
{
case 0:
num3 = 3;
break;
case 3:
num3 = 6;
break;
case 6:
num3 = 9;
break;
}
}
return str2;
}
public MyGuild GetGuild(int GuildId)
{
if (this.loadedGuilds.ContainsKey(GuildId))
{
return this.loadedGuilds[GuildId];
}
return this.LoadGuild(GuildId);
}
public string GetHtmlColor(int Color)
{
using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("SELECT ExtraData1 FROM groups_elements WHERE Id = '" + Color + "' AND Type = 'Color3'");
return adapter.getString();
}
}
public MyGuild LoadGuild(int GuildId)
{
using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("SELECT * FROM groups WHERE Id = '" + GuildId + "' LIMIT 1");
DataRow row = adapter.getRow();
if (row == null)
{
return null;
}
List<int> guildstates = new List<int>();
foreach (string str in row["GuildStates"].ToString().Split(new char[] { ';' }))
{
try
{
guildstates.Add(int.Parse(str));
}
catch
{
}
}
List<int> petitions = new List<int>();
foreach (string str2 in row["Petitions"].ToString().Split(new char[] { ';' }))
{
try
{
petitions.Add(int.Parse(str2));
}
catch
{
}
}
Dictionary<int, int> guildranks = new Dictionary<int, int>();
List<int> members = new List<int>();
List<string> joindates = new List<string>();
adapter.setQuery("SELECT * FROM user_groups WHERE GroupId = '" + GuildId + "'");
DataTable table = adapter.getTable();
foreach (DataRow row2 in table.Rows)
{
members.Add((int)row2["UserId"]);
guildranks.Add((int)row2["UserId"], (int)row2["Rank"]);
joindates.Add((string)row2["GroupDate"]);
}
MyGuild g = new MyGuild(GuildId, ButterflyEnvironment.FilterInjectionChars(row["Name"].ToString()), (int)row["OwnerId"], row["OwnerName"].ToString(), ButterflyEnvironment.FilterInjectionChars(row["Description"].ToString()), (int)row["RoomId"], row["Image"].ToString(), (int)row["CustomColor1"], (int)row["CustomColor2"], (int)row["GuildBase"], (int)row["GuildBaseColor"], guildstates, row["HtmlColor1"].ToString(), row["HtmlColor2"].ToString(), row["DateCreated"].ToString(), members, petitions, (int)row["Typee"], (int)row["RightsType"], guildranks,joindates);
this.QueueAddGuild(g);
return g;
}
}
public void OnCycle()
{
this.WorkAddGuildQueue();
this.WorkGuildRemoveQueue();
}
public void QueueAddGuild(MyGuild G)
{
lock (this.loadGuild.SyncRoot)
{
this.loadGuild.Enqueue(G);
}
}
public void QueueDeleteGuild(MyGuild G)
{
lock (this.deleteGuild.SyncRoot)
{
this.deleteGuild.Enqueue(G);
}
}
public void UnloadGuild(int GuildId)
{
MyGuild g = this.GetGuild(GuildId);
if (g != null)
{
this.QueueDeleteGuild(g);
}
}
private void WorkAddGuildQueue()
{
try
{
if (this.loadGuild.Count > 0)
{
lock (this.loadGuild.SyncRoot)
{
while (this.loadGuild.Count > 0)
{
MyGuild guild = (MyGuild)this.loadGuild.Dequeue();
if (!this.loadedGuilds.ContainsValue(guild))
{
this.loadedGuilds.Add(guild.Id, guild);
}
else
{
this.loadedGuilds[guild.Id] = guild;
}
}
}
}
}
catch
{
}
}
private void WorkGuildRemoveQueue()
{
if (this.deleteGuild.Count > 0)
{
lock (this.deleteGuild.SyncRoot)
{
while (this.deleteGuild.Count > 0)
{
MyGuild guild = (MyGuild)this.deleteGuild.Dequeue();
this.loadedGuilds.Remove(guild.Id);
}
}
}
}
}
}
Open GameClientMessageHandler.cs
Find
PHP Code:
List<int> members = new List<int> {
(int) this.Session.GetHabbo().Id
};
After that put
PHP Code:
List<string> joindates = new List<string> {
DateTime.Now.Day + " - " + DateTime.Now.Month + " - " + DateTime.Now.Year
};
Find
PHP Code:
MyGuild guild = ButterflyEnvironment.GetGame().GetGuilds().AddGuild(0, name, id, username, description, roomid, image, color, num3, guildBase, guildBaseColor, gStates, htmlColor, str5, datecreated, members, new List<int>(), 0, 0);
Replace that with
PHP Code:
MyGuild guild = ButterflyEnvironment.GetGame().GetGuilds().AddGuild(0, name, id, username, description, roomid, image, color, num3, guildBase, guildBaseColor, gStates, htmlColor, str5, datecreated, members, new List<int>(), 0, 0, joindates);
Find
PHP Code:
public void LoadMembersPetitions()
Replace that entire method with this one
PHP Code:
public void LoadMembersPetitions()
{
int guildId = this.Request.PopWiredInt32();
int num2 = this.Request.PopWiredInt32();
string str = this.Request.PopFixedString();
int num3 = this.Request.PopWiredInt32();
MyGuild guild = ButterflyEnvironment.GetGame().GetGuilds().GetGuild(guildId);
if (guild != null)
{
ServerMessage message;
Habbo habbo;
int memberCounter = 0;
if (num3 == 0)
{
message = new ServerMessage(Outgoing.SendMembersAndPetitions);
message.AppendInt32(guild.Id);
message.AppendString(guild.Name);
message.AppendInt32(guild.RoomId);
message.AppendString(guild.Image);
message.AppendInt32(guild.Members.Count);
message.AppendInt32((guild.Members.Count > 13) ? 14 : guild.Members.Count);
foreach (int num4 in guild.Members)
{
habbo = ButterflyEnvironment.getHabboForId((uint)num4);
if (guild.OwnerId == habbo.Id)
{
message.AppendInt32(0);
}
else
{
message.AppendInt32((guild.GuildRanks.ContainsKey(num4) && guild.GuildRanks.ContainsValue(1)) ? 1 : 2);
}
message.AppendInt32(num4);
message.AppendString(habbo.Username);
message.AppendString(habbo.Look);
message.AppendString(guild.JoinDates[memberCounter]);
memberCounter++;
}
message.AppendBoolean(false);
message.AppendInt32(14);
message.AppendInt32(0);
message.AppendInt32(0);
message.AppendString("");
this.Session.SendMessage(message);
}
else
{
message = new ServerMessage(Outgoing.SendMembersAndPetitions);
message.AppendInt32(guild.Id);
message.AppendString(guild.Name);
message.AppendInt32(guild.RoomId);
message.AppendString(guild.Image);
message.AppendInt32(guild.Petitions.Count);
message.AppendInt32((guild.Petitions.Count > 13) ? 14 : guild.Petitions.Count);
foreach (int num4 in guild.Petitions)
{
habbo = ButterflyEnvironment.getHabboForId((uint)num4);
message.AppendInt32(3);
message.AppendInt32(num4);
message.AppendString(habbo.Username);
message.AppendString(habbo.Look);
message.AppendString(guild.JoinDates[memberCounter]);
memberCounter++;
}
message.AppendBoolean(true);
message.AppendInt32(14);
message.AppendInt32(0);
message.AppendInt32(2);
message.AppendString("");
this.Session.SendMessage(message);
}
}
}
That should do it.
Re: BCStorm - Show Join Date of Group Members
Thanks for this, would've got round to it myself if it wasn't for the endless amount of other bugs :)
Re: BCStorm - Show Join Date of Group Members
Quote:
Originally Posted by
Joshuwar
Thanks for this, would've got round to it myself if it wasn't for the endless amount of other bugs :)
I know... there are lots..... But its nice to see many people fixing them...
What kind of bums me out is that I released all the snowstorm images. As soon as I did that a bunch of people stopped releasing fixes.... I'm sure there is a big race on the go. "Who will fix snowstorm first". I just hope the will share like they should.
Re: BCStorm - Show Join Date of Group Members
Soo leenster, why you don't fix the Petitions of Groups? And the buy too !
@Sorry, You fixed too! Thanks ^^
Re: BCStorm - Show Join Date of Group Members
Quote:
Originally Posted by
leenster
I know... there are lots..... But its nice to see many people fixing them...
What kind of bums me out is that I released all the snowstorm images. As soon as I did that a bunch of people stopped releasing fixes.... I'm sure there is a big race on the go. "Who will fix snowstorm first". I just hope the will share like they should.
I'd rather the community work on fixing bugs then adding features such as Snowstorm etc. Just my personal opinion though.
Btw, you got the packet id and structure for buying groups? If you make two rooms, you're in room 1 and make a group putting the homeroom as room 2, you can constantly spam the Purchase button.
Re: BCStorm - Show Join Date of Group Members
Quote:
Originally Posted by
Joshuwar
I'd rather the community work on fixing bugs then adding features such as Snowstorm etc. Just my personal opinion though.
Btw, you got the packet id and structure for buying groups? If you make two rooms, you're in room 1 and make a group putting the homeroom as room 2, you can constantly spam the Purchase button.
Oh yeah ... almost forgot about that one. Yeah that needs to be fixed still.
Re: BCStorm - Show Join Date of Group Members
Re: BCStorm - Show Join Date of Group Members
can someone please send me the files they are needed for this fix, the files with the fix aready in them ;p-im getting errors debugging, i asked leen but hes at work and i dont wanna wait ;s
Re: BCStorm - Show Join Date of Group Members
rafa95123 pointed out that there is a query missing in the group creation . This would cause the group not showing up after a server restart.
in guilds.cs find
PHP Code:
public MyGuild AddGuild
Replace that entire method with
PHP Code:
public MyGuild AddGuild(int id, string name, int ownerid, string ownername, string description, int roomid, string image, int customcolor1, int customcolor2, int guildbase, int guildbasecolor, List<int> guildstates, string htmlcolor1, string htmlcolor2, string datecreated, List<int> members, List<int> petitions, int type, int rightstype, List<string> joindates)
{
Game game = ButterflyEnvironment.GetGame();
game.LastGuildId++;
id = ButterflyEnvironment.GetGame().LastGuildId;
MyGuild g = new MyGuild(id, ButterflyEnvironment.FilterInjectionChars(name), ownerid, ownername, ButterflyEnvironment.FilterInjectionChars(description), roomid, image, customcolor1, customcolor2, guildbase, guildbasecolor, guildstates, htmlcolor1, htmlcolor2, datecreated, members, petitions, type, rightstype, new Dictionary<int, int>(), joindates);
string str = "";
foreach (int num in guildstates)
{
str = str + num + ";";
}
str = str.Substring(0, str.Length - 1);
using (IQueryAdapter adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
adapter.setQuery("INSERT INTO groups (Id, Name, OwnerId, OwnerName, Description, RoomId, Image, CustomColor1, CustomColor2, GuildBase, GuildBaseColor, GuildStates, HtmlColor1, HtmlColor2, DateCreated) VALUES (@id, @name, @ownerid, @ownername, @description, @roomid, @image, @color1, @color2, @guildbase, @guildbasecolor, @guildstates, @htmlcolor1, @htmlcolor2, @datecreated)");
adapter.addParameter("id", id);
adapter.addParameter("name", ButterflyEnvironment.FilterInjectionChars(name));
adapter.addParameter("ownerid", ownerid);
adapter.addParameter("ownername", ownername);
adapter.addParameter("description", ButterflyEnvironment.FilterInjectionChars(description));
adapter.addParameter("roomid", roomid);
adapter.addParameter("image", image);
adapter.addParameter("color1", customcolor1);
adapter.addParameter("color2", customcolor2);
adapter.addParameter("guildbase", guildbase);
adapter.addParameter("guildbasecolor", guildbasecolor);
adapter.addParameter("guildstates", str);
adapter.addParameter("htmlcolor1", htmlcolor1);
adapter.addParameter("htmlcolor2", htmlcolor2);
adapter.addParameter("datecreated", datecreated);
adapter.runQuery();
adapter.runFastQuery(string.Concat(new object[] { "UPDATE rooms SET GroupId = '", id, "' WHERE Id = '", roomid, "'" }));
}
this.QueueAddGuild(g);
return g;
}
I updated the main post.
Re: BCStorm - Show Join Date of Group Members
if group members are superior 14 client disconnection ??
Re: BCStorm - Show Join Date of Group Members
there is a bug if group members are superior 14 client disconnection ??
BCStorm - Show Join Date of Group Members
Quote:
Originally Posted by
Dovis
there is a bug if group members are superior 14 client disconnection ??
I know where the bug is and know how to fix it. I am fixing the group windows. Show all members/ show all admins and show all requests. Give rights / remove rights and what ever else is on there. Ill probably have this done tonight.
Sent from my BlackBerry 9800 using Tapatalk
Re: BCStorm - Show Join Date of Group Members
Quote:
Originally Posted by
leenster
I know where the bug is and know how to fix it. I am fixing the group windows. Show all members/ show all admins and show all requests. Give rights / remove rights and what ever else is on there. Ill probably have this done tonight.
Sent from my BlackBerry 9800 using Tapatalk
Would that mean you can give users admin rights? ;)
BCStorm - Show Join Date of Group Members
Yes
Sent from my BlackBerry 9800 using Tapatalk
Re: BCStorm - Show Join Date of Group Members
Thanks Good job :thumbup: