Hello,
Well since ive started getting back into C#.net coding and learning the Hellmouth source i decided to give something back. So here it is just a simple broadcast system that brodcasts a new message every 50 seconds(can easily be changed).
Before we start i just want to say thanks to Pro4Never for releasing his source and making me want to brush up on my c# and wanting to learn again :).
Also please give feedback as i want to see improvments that can be made.
OPEN: Extras/Dictionary.cs
FIND:
UNDER ADD:
OPEN: Structures/ChatType.cs
FIND:
REPLACE WITH:
OPEN: Program.cs
FIND:
UNDER ADD:
OPEN: Tools.cs
FIND:
ABOVE ADD:
CREATE FILE: Objects/Broadcast.cs
OPEN: Packet/PacketHandler.cs
FIND:
FIND IN:
REPLACE CASE WITH:
END
Well since ive started getting back into C#.net coding and learning the Hellmouth source i decided to give something back. So here it is just a simple broadcast system that brodcasts a new message every 50 seconds(can easily be changed).
Before we start i just want to say thanks to Pro4Never for releasing his source and making me want to brush up on my c# and wanting to learn again :).
Also please give feedback as i want to see improvments that can be made.
OPEN: Extras/Dictionary.cs
FIND:
Code:
public static Dictionary<uint, Client> Waiting = new Dictionary<uint, Client>();
Code:
public static SortedList<int, Broadcast> Broadcasts = new SortedList<int, Broadcast>();
FIND:
Code:
Broadcast = 2050,
Code:
Broadcast = 2500,
FIND:
Code:
EffT.Start();
Code:
BroadcastQueue Brd = new BroadcastQueue(); Thread BrdT = new Thread(new ThreadStart(Brd.Run)); BrdT.Start();
FIND:
Code:
public class Effects
Code:
public class BroadcastQueue { public void Run() { while (true) { if (Dictionary.Clients.Count > 0) { if (Dictionary.Broadcasts.Count > 0) { int id = Dictionary.Broadcasts.Keys[0]; Packets.ToServer(Packets.Chat(Dictionary.Broadcasts[id].Message, Dictionary.Broadcasts[id].Name, "ALL", Struct.ChatType.Broadcast)); Dictionary.Broadcasts.Remove(id); Thread.Sleep(50000); } } } } }
Code:
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Hellmouth { public class Broadcast { public string Name; public string Message; public byte Place; } }
FIND:
Code:
case 2050:
Code:
case 3:
Code:
case 3: { if (Client.CP >= 5) { if (Dictionary.Broadcasts.Count <= 100) { Client.CP -= 5; Broadcast B = new Broadcast(); B.Name = Client.Name; B.Message = Message; B.Place = (byte)Dictionary.Broadcasts.Count; Dictionary.Broadcasts.Add((Dictionary.Broadcasts.Count), B); } } } break;