Exemplo n.º 1
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;
 }
Exemplo n.º 2
0
 public GameServer(ref Config uc, ref GameData gd, ref Plugin[] plugs, ref ExtensionHandler ext)
 {
     UserConfig = uc;
     gameData = gd;
     Plugins = plugs;
     extensions = ext;
 }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
0
 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;
 }