Beispiel #1
0
 public GameServer(ref Config uc, ref GameData gd, ref Plugin[] plugs, ref ExtensionHandler ext)
 {
     UserConfig = uc;
     gameData = gd;
     Plugins = plugs;
     extensions = ext;
 }
Beispiel #2
0
 public LoginReader(byte[] inpacket, GameData gameData)
 {
     packet = inpacket;
     packetBufferStream = new MemoryStream(packet);
     packetBuffer = new BinaryReader(packetBufferStream);
     crypt = new LoginCrypt(gameData.Blowfish_Key);
 }
Beispiel #3
0
 public bool HandlePacket(PacketList.Server opcode, GameReader packet, GameData gameData, bool Handled, ExtensionHandler extensions)
 {
     InfoExt infoExt = (InfoExt)extensions.Get("InfoExt");
     switch (opcode)
     {
         case PacketList.Server.CreatureSay:
             Character toon = new Character();
             toon.ObjectID = packet.readD();
             ChatType type = (ChatType)packet.readD();
             toon.Name = packet.readS();
             ChatReceived(type, toon, packet.readS(), packet, gameData, extensions);
             break;
         case PacketList.Server.Die:
             Character toon2 = new Character();
             toon2.ObjectID = packet.readD();
             bool hideout = (packet.readD() == 0x00) ? false : true;
             bool castle = (packet.readD() == 0x00) ? false : true;
             bool siege = (packet.readD() == 0x00) ? false : true;
             bool sweep = (packet.readD() == 0x00) ? false : true;
             bool fixedresp = (packet.readD() == 0x00) ? false : true;
             bool fortress = (packet.readD() == 0x00) ? false : true;
             if (toon2.ObjectID == infoExt.User.ObjectID)
                 SelfDie(hideout, castle, siege, fortress, packet, gameData, extensions);
             else
                 OtherDie(hideout, castle, siege, fortress, sweep, fixedresp, packet, gameData, extensions);
             break;
     }
     return false;
 }
Beispiel #4
0
 public GameReader(byte[] inpacket, GameData gameData)
 {
     byte[] tmp = new byte[inpacket.Length - 2];
     for (int i = 2; i < inpacket.Length; i++)
         tmp[i - 2] = inpacket[i];
     packet = tmp;
     packetBufferStream = new MemoryStream(packet);
     packetBuffer = new BinaryReader(packetBufferStream);
     GameDataS = gameData;
 }
Beispiel #5
0
        public void ChatToDebug(ChatType type, Character sender, string message, GameReader packet, GameData gameData, ExtensionHandler extensions)
        {
            if (type == ChatType.Announcement)
                sender.Name = "";
            Debug.Information(type.ToString() + ":" + sender.Name + ": " + message);

            if (type == ChatType.Private && sender.Name == "Reporter")
            {
                gameData.commands.SendMessage(ChatType.Private, sender, "ECHO: " + message);
            }
        }
Beispiel #6
0
        public bool HandlePacket(PacketList.Server opcode, GameReader packet, GameData gameData, bool Handled, ExtensionHandler extensions)
        {
            InfoExt infoExt = (InfoExt)extensions.Get("InfoExt");
            if (infoExt.HandlePacket(opcode, packet, gameData, Handled, extensions))
                Handled = true;

            Events events = (Events)extensions.Get("Events");
            if (events.HandlePacket(opcode, packet, gameData, Handled, extensions))
                Handled = true;

            return Handled;
        }
 public bool HandlePacket(PacketList.Server opcode, GameReader packet, GameData gameData, bool Handled, ExtensionHandler extensions)
 {
     switch (opcode)
     {
         case PacketList.Server.UserInfo:
             User = Packets.UserInfo.parsePacket(packet);
             break;
         case PacketList.Server.CharInfo:
             Character temp = Packets.CharInfo.parsePacket(packet);
             if(!KnownUsers.ContainsKey(temp.ObjectID))
                 KnownUsers.Add(temp.ObjectID, temp);
             else
                 KnownUsers[temp.ObjectID] = temp;
             break;
         case PacketList.Server.NpcInfo:
             Character temp2 = Packets.NPCInfo.parsePacket(packet);
             if(!KnownNPCs.ContainsKey(temp2.ObjectID))
                 KnownNPCs.Add(temp2.ObjectID, temp2);
             else
                 KnownNPCs[temp2.ObjectID] = temp2;
             break;
         case PacketList.Server.TargetSelectedPacket:
             Int32 objectid = packet.readD();
             if (KnownUsers.ContainsKey(objectid))
             {
                 Targeted = KnownUsers[objectid];
             }
             else if (KnownNPCs.ContainsKey(objectid))
             {
                 Targeted = KnownNPCs[objectid];
             }
             break;
         case PacketList.Server.TargetUnselectedPacket:
             if(Targeted != null && Targeted.ObjectID == packet.readD())
                 Targeted = null;
             break;
     }
     return false;
 }
Beispiel #8
0
 public Commands(GameData gd)
 {
     gameData = gd;
 }
Beispiel #9
0
 public GameWriter(byte[] data, GameData gameData)
 {
     packetBufferStream = new MemoryStream(data);
     packetBuffer = new BinaryWriter(packetBufferStream);
     GameDataS = gameData;
 }
Beispiel #10
0
 public LoginWriter(byte[] data, GameData gameData)
 {
     packetBufferStream = new MemoryStream(data);
     packetBuffer = new BinaryWriter(packetBufferStream);
     crypt = new LoginCrypt(gameData.Blowfish_Key);
 }