Ejemplo n.º 1
0
        public void SendToClient(Packet packet)
        {
            lock (ClientLock)
            {
                try
                {
                    MemoryStream ms = new MemoryStream();
                    using (PacketWriter w = new PacketWriter(ms))
                    {
                        w.Write((int)0);
                        w.Write(packet.Id);
                        packet.Write(w);
                    }

                    byte[] data = ms.ToArray();
                    PacketWriter.BlockCopyInt32(data, data.Length);
                    ClientSendKey.Cipher(data);

                    NetworkStream local = _localConnection.GetStream();
                    //local.BeginWrite(data, 0, data.Length, (ar) => local.EndWrite(ar), null);
                    local.Write(data, 0, data.Length);
                }
                catch (Exception ex) { Close(ex); }
            }
        }
Ejemplo n.º 2
0
 private void OnUpdateAck(Client client, Packet packet)
 {
     if (_cancel)
     {
         packet.Send = false;
         _cancel = false;
     }
 }
Ejemplo n.º 3
0
        private void OnMove(Client client, Packet packet)
        {
            if (!_states.ContainsKey(client)) return;
            LootState state = _states[client];

            foreach (int bagId in state.LootBagItems.Keys)
            {
                float distance = state.LootBagLocations[bagId].DistanceTo(client.PlayerData.Pos);
                if (LootHelperConfig.Default.AutoLoot && Environment.TickCount - state.LastLoot > 900 && distance <= 1)
                {
                    for (int bi = 0; bi < state.LootBagItems[bagId].Length; bi++)
                    {
                        if (state.LootBagItems[bagId][bi] == -1)
                            continue;

                        if (!LootHelperConfig.Default.AutoLootList.Contains(ReverseLookup(state.LootBagItems[bagId][bi])))
                            continue;

                        state.LastLoot = Environment.TickCount;
                        for (int i = 4; i < client.PlayerData.Slot.Length; i++)
                        {
                            if (client.PlayerData.Slot[i] == -1)
                            {
                                InvSwapPacket invSwap = (InvSwapPacket)Packet.Create(PacketType.INVSWAP);
                                invSwap.Time = client.Time + 10;
                                invSwap.Position = client.PlayerData.Pos;

                                invSwap.SlotObject1 = new SlotObject();
                                invSwap.SlotObject1.ObjectId = bagId;
                                invSwap.SlotObject1.SlotId = (byte)bi;
                                invSwap.SlotObject1.ObjectType = (short)state.LootBagItems[bagId][bi];

                                invSwap.SlotObject2 = new SlotObject();
                                invSwap.SlotObject2.ObjectId = client.ObjectId;
                                invSwap.SlotObject2.SlotId = (byte)(i);
                                invSwap.SlotObject2.ObjectType = -1;

                                client.SendToServer(invSwap);
                                break;
                            }
                        }
                    }
                }

                if (LootHelperConfig.Default.LootNotifications && Environment.TickCount - state.LastNotif > 2000 && distance < 15)
                {
                    state.LastNotif = Environment.TickCount;
                    string message = "";

                    foreach (int item in state.LootBagItems[bagId])
                        if (item != -1) message += ReverseLookup(item) + "\\n";

                    if (message.Length > 3)
                        client.SendToClient(PluginUtils.CreateNotification(
                            bagId, LootHelperConfig.Default.NotificationColor.ToArgb(), message));
                }
            }
        }
Ejemplo n.º 4
0
        public void OnUpdate(Client client, Packet packet)
        {
            UpdatePacket update = (UpdatePacket)packet;

            foreach (Tile tile in update.Tiles)
            {
                mapdata[tile.Y, tile.X] = (ushort)tile.Type;
            }
        }
Ejemplo n.º 5
0
        private void OnUpdate(Client client, Packet packet)
        {
            int fame = _fame[client];
            _fame[client] = client.PlayerData.CharacterFame;

            if (fame != -1 && client.PlayerData.CharacterFame != fame)
                client.SendToClient(
                    PluginUtils.CreateNotification(
                        client.ObjectId, "+" + (client.PlayerData.CharacterFame - fame) + " fame!"));
        }
Ejemplo n.º 6
0
 private void OnNewTick(Client client, Packet packet)
 {
     // Update player positions
     NewTickPacket newTick = (NewTickPacket)packet;
     TeleportState state = _states[client];
     foreach (Status status in newTick.Statuses)
     {
         if (state.PlayerLocations.ContainsKey(status.ObjectId))
             state.PlayerLocations[status.ObjectId] = status.Position;
         else if (status.ObjectId == state.QuestId)
             state.QuestLocation = status.Position;
     }
 }
Ejemplo n.º 7
0
        private void OnUpdate(Client client, Packet packet)
        {
            UpdatePacket update = (UpdatePacket)packet;

            for (int i = 0; i < update.NewObjs.Length; i++)
            {
                if (update.NewObjs[i].Status.ObjectId == client.ObjectId)
                {
                    for (int j = 0; j < update.NewObjs[i].Status.Data.Length; j++)
                    {
                        if (update.NewObjs[i].Status.Data[j].Id == 59)
                            update.NewObjs[i].Status.Data[j].IntValue = 100;
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void OnUseItem(Client client, Packet packet)
        {
            if (Editing && !_cancel)
            {
                UseItemPacket useItem = (UseItemPacket)packet;
                useItem.Send = false;

                UpdatePacket update = (UpdatePacket)Packet.Create(PacketType.UPDATE);
                update.Drops = new int[0];
                update.NewObjs = new Entity[0];
                update.Tiles = new Tile[1];

                Tile paintedTile = new Tile();
                paintedTile.X = (short)Math.Floor(useItem.ItemUsePos.X);
                paintedTile.Y = (short)Math.Floor(useItem.ItemUsePos.Y);
                paintedTile.Type = GameData.Tiles.ByName(SelectedTile).ID;
                update.Tiles[0] = paintedTile;

                _cancel = true;
                client.SendToClient(update);
            }
        }
Ejemplo n.º 9
0
        private void OnText(Client client, Packet packet)
        {
            if (!ChatAssistConfig.Default.Enabled) return;
            //TextPacket text = (TextPacket)packet;
            TextPacket text = packet.To<TextPacket>();

            if (ChatAssistConfig.Default.DisableMessages && text.Recipient == "")
            {
                text.Send = false;
                return;
            }

            foreach (string filter in ChatAssistConfig.Default.Blacklist)
            {
                if (text.Text.ToLower().Contains(filter.ToLower()))
                {
                    // Is spam
                    if (ChatAssistConfig.Default.CensorSpamMessages)
                    {
                        text.Text = "...";
                        text.CleanText = "...";
                        return;
                    }

                    text.Send = false;

                    if (ChatAssistConfig.Default.AutoIgnoreSpamMessage ||
                       (ChatAssistConfig.Default.AutoIgnoreSpamPM && text.Recipient != ""))
                    {
                        // Ignore
                        PlayerTextPacket playerText = new PlayerTextPacket();
                        playerText.Text = "/ignore " + text.Name;
                        client.SendToServer(playerText);
                        return;
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private void OnUpdate(Client client, Packet packet)
        {
            UpdatePacket update = (UpdatePacket)packet;

            // New Objects
            foreach (Entity entity in update.NewObjs)
            {
                bool inc = false;

                foreach (StatData statData in entity.Status.Data)
                {
                    if (!statData.IsStringData() && (statData.Id >= 8 && statData.Id <= 19) || (statData.Id >= 71 && statData.Id <= 78))
                        if (statData.IntValue == INC_ID) inc = true;

                    if (inc && statData.Id == StatsType.Name && statData.StringValue != client.PlayerData.Name)
                    {
                        if (!_incHolders.ContainsKey(entity.Status.ObjectId))
                            _incHolders.Add(entity.Status.ObjectId, statData.StringValue);

                        client.SendToClient(PluginUtils.CreateOryxNotification(
                            "Inc Finder", statData.StringValue + " has an Incantation!"));
                    }
                }
            }

            // Removed Objects
            foreach (int drop in update.Drops)
            {
                if (_incHolders.ContainsKey(drop))
                {
                    client.SendToClient(PluginUtils.CreateOryxNotification(
                            "Inc Finder", _incHolders[drop] + " has left!"));
                    _incHolders.Remove(drop);
                }
            }
        }
Ejemplo n.º 11
0
        private void OnReconnect(Client client, Packet packet)
        {
            ReconnectPacket reconnect = packet as ReconnectPacket;

            if (reconnect.Host.Contains(".com"))
                reconnect.Host = Dns.GetHostEntry(reconnect.Host).AddressList[0].ToString();

            if (reconnect.Name.ToLower().Contains("nexusportal"))
            {
                _recon.IsFromArena = false;
                _recon.GameId = reconnect.GameId;
                _recon.Host = (reconnect.Host == "" ? _proxy.RemoteAddress : reconnect.Host);
                _recon.Port = (reconnect.Port == -1 ? _proxy.Port : reconnect.Port);
                _recon.Key = reconnect.Key;
                _recon.KeyTime = reconnect.KeyTime;
                _recon.Name = reconnect.Name;
            }
            else if (reconnect.Name != "" && !reconnect.Name.Contains("vault") && reconnect.GameId != -2)
            {
                _drecon.IsFromArena = false;
                _drecon.GameId = reconnect.GameId;
                _drecon.Host = (reconnect.Host == "" ? _proxy.RemoteAddress : reconnect.Host);
                _drecon.Port = (reconnect.Port == -1 ? _proxy.Port : reconnect.Port);
                _drecon.Key = reconnect.Key;
                _drecon.KeyTime = reconnect.KeyTime;
                _drecon.Name = reconnect.Name;
            }

            if (reconnect.Port != -1)
                _proxy.Port = reconnect.Port;

            if (reconnect.Host != "")
                _proxy.RemoteAddress = reconnect.Host;

            // Tell the client to connect to the proxy
            reconnect.Host = "localhost";
            reconnect.Port = 2050;
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Sends a packet to the client's server.
 /// </summary>
 /// <param name="packet">Packet to be sent</param>
 public void SendToServer(Packet packet)
 {
     Send(packet, false);
 }
Ejemplo n.º 13
0
 // TODO: Add more hooks
 private void HandlePacketInternal(Packet packet)
 {
     if (packet.Type == PacketType.CREATESUCCESS)
     {
         ObjectId = (packet as CreateSuccessPacket).ObjectId;
         PlayerData = new PlayerData(ObjectId);
         PlayerData.MapName = _mapInfo.Name;
         PlayerData.TeleportAllowed = _mapInfo.AllowPlayerTeleport;
         PlayerData.MapWidth = _mapInfo.Width;
         PlayerData.MapHeight = _mapInfo.Height;
     }
     else if (packet.Type == PacketType.MAPINFO)
     {
         _mapInfo = (MapInfoPacket)packet;
     }
     else if (packet.Type == PacketType.UPDATE)
     {
         PlayerData.Parse(packet as UpdatePacket);
     }
     else if (packet.Type == PacketType.NEWTICK)
     {
         PlayerData.Parse(packet as NewTickPacket);
     }
     else if (packet.Type == PacketType.PONG)
     {
         Time = (packet as PongPacket).Time;
     }
     else if (packet.Type == PacketType.MOVE)
     {
         Time = (packet as MovePacket).Time;
         PlayerData.Pos = (packet as MovePacket).NewPosition;
     }
     else if (packet.Type == PacketType.PLAYERSHOOT)
     {
         PlayerData.Pos = (packet as PlayerShootPacket).Position;
     }
 }
Ejemplo n.º 14
0
        private void OnCreateSuccess(Client client, Packet packet)
        {
            // Send welcome message to player
            string message = "Welcome to K Relay!";
            foreach (var pair in Serializer.Servers)
                if (pair.Value == _proxy.RemoteAddress)
                    message += "\\n" + pair.Key;

            PluginUtils.Delay(1500, () => client.SendToClient(
                PluginUtils.CreateNotification(client.ObjectId, message)));
        }
Ejemplo n.º 15
0
 void OnPacket(Client client, Packet p)
 {
     if (clients.ContainsKey(client)) {
         ClientState state = clients[client];
         switch (p.Type) {
             case PacketType.UPDATE:
                 state.Update(p as UpdatePacket);
                 break;
             case PacketType.NEWTICK:
                 state.Tick(p as NewTickPacket);
                 break;
             case PacketType.ENEMYSHOOT:
                 state.EnemyShoot(p as EnemyShootPacket);
                 break;
             case PacketType.PLAYERHIT:
                 state.PlayerHit(p as PlayerHitPacket);
                 break;
             case PacketType.AOE:
                 state.AoE(p as AoEPacket);
                 break;
             case PacketType.MAPINFO:
                 state.MapInfo(p as MapInfoPacket);
                 break;
             case PacketType.GROUNDDAMAGE:
                 state.GroundDamage(p as GroundDamagePacket);
                 break;
         }
     }
 }
Ejemplo n.º 16
0
        private void OnUpdate(Client client, Packet packet)
        {
            if (!MapFilterConfig.Default.Enabled) return;
            UpdatePacket update = (UpdatePacket)packet;

            // New Objects
            foreach (Entity entity in update.NewObjs)
            {
                if (ObjectFilters.ContainsKey((ushort)entity.ObjectType))
                    entity.ObjectType = (short)ObjectFilters[(ushort)entity.ObjectType];
            }

            // New Tiles
            foreach (Tile tile in update.Tiles)
            {
                if (TileFilters.ContainsKey(tile.Type))
                    tile.Type = TileFilters[tile.Type];
            }
        }
Ejemplo n.º 17
0
        private void OnClientStat(Client client, Packet packet)
        {
            ClientStatPacket clientStat = (ClientStatPacket)packet;

            string toDisplay = clientStat.Name + "  has increased to  " + clientStat.Value;

            if (clientStat.Name.Equals("Shots")) //0: 'Shots',
            {
                toDisplay = "Bullets shot : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("ShotsThatDamage")) //1: 'ShotsThatDamage',
            {
                toDisplay = "Bullets that damaged : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("SpecialAbilityUses")) //2: 'SpecialAbilityUses',
            {
                toDisplay = "Ability uses : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("TilesUncovered")) //3: 'TilesUncovered',
            {
                toDisplay = "Tiles uncovered : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("Teleports")) //4: 'Teleports',
            {
                toDisplay = "Teleports : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("PotionsDrunk")) //5: 'PotionsDrunk',
            {
                toDisplay = "Potions drank : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("MonsterKills")) //6: 'MonsterKills',
            {
                toDisplay = "Monster kills : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("MonsterAssists")) //7: 'MonsterAssists',
            {
                toDisplay = "Monster assists : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("GodKills")) //8: 'GodKills',
            {
                toDisplay = "God kills : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("GodAssists")) //9: 'GodAssists',
            {
                toDisplay = "God assists : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("CubeKills")) //10: 'CubeKills',
            {
                toDisplay = "Cube kills : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("OryxKills")) //11: 'OryxKills',
            {
                toDisplay = "Oryx kills : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("QuestsCompleted")) //12: 'QuestsCompleted',
            {
                toDisplay = "Quests completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("PirateCavesCompleted")) //13: 'PirateCavesCompleted',
            {
                toDisplay = "Pirate Cave(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("UndeadLairsCompleted")) //14: 'UndeadLairsCompleted',
            {
                toDisplay = "Undead Lair(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("AbyssOfDemonsCompleted")) //15: 'AbyssOfDemonsCompleted',
            {
                toDisplay = "Abyss of Demon(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("SnakePitsCompleted")) //16: 'SnakePitsCompleted',
            {
                toDisplay = "Snake Pit(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("SpiderDensCompleted")) //17: 'SpiderDensCompleted',
            {
                toDisplay = "Spider Den(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("SpriteWorldsCompleted")) //18: 'SpriteWorldsCompleted',
            {
                toDisplay = "Sprite World(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("LevelUpAssists")) //19: 'LevelUpAssists',
            {
                toDisplay = "Level-up assist(s) : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("MinutesActive")) //20: 'MinutesActive',
            {
                toDisplay = "Minute(s) active : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("TombsCompleted")) //21: 'TombsCompleted',
            {
                toDisplay = "Tomb(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("TrenchesCompleted")) //22: 'TrenchesCompleted',
            {
                toDisplay = "Trenche(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("JunglesCompleted")) //23: 'JunglesCompleted',
            {
                toDisplay = "Jungle(s) completed : " + clientStat.Value;
            }
            else if (clientStat.Name.Equals("ManorsCompleted")) //24: 'ManorsCompleted',
            {
                toDisplay = "Manor(s) completed : " + clientStat.Value;
            }
            else
            {
                //print(toDisplay = "Unknown -> Name :" + clientStat.Name + " Value :" + clientStat.Value);
            }

            client.SendToClient(
                PluginUtils.CreateOryxNotification(
                    "ClientStat Announcer", toDisplay));
        }
Ejemplo n.º 18
0
        public void SendToServer(Packet packet)
        {
            lock (ServerLock)
            {
                try
                {
                    MemoryStream ms = new MemoryStream();
                    using (PacketWriter w = new PacketWriter(ms))
                    {
                        w.Write((int)0);
                        w.Write(packet.Id);
                        packet.Write(w);
                    }

                    byte[] data = ms.ToArray();
                    PacketWriter.BlockCopyInt32(data, data.Length);
                    ServerSendKey.Cipher(data);

                    NetworkStream remote = _remoteConnection.GetStream();
                    //remote.BeginWrite(data, 0, data.Length, (ar) => remote.EndWrite(ar), null);
                    remote.Write(data, 0, data.Length);
                }
                catch (Exception ex) { Close(ex); }
            }
        }
Ejemplo n.º 19
0
 private void OnQuestObjId(Client client, Packet packet)
 {
     _states[client].QuestId = (packet as QuestObjIdPacket).ObjectId;
 }
Ejemplo n.º 20
0
 public void GetMapInfo(Client client, Packet packet)
 {
     MapInfoPacket mapinfo = (MapInfoPacket)packet;
     map = new Map(mapinfo.Name, mapinfo.Height, mapinfo.Width);
     initialized = false;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Sends a packet to the client.
 /// </summary>
 /// <param name="packet">Packet to be sent</param>
 public void SendToClient(Packet packet)
 {
     Send(packet, true);
 }
Ejemplo n.º 22
0
        private void OnUpdate(Client client, Packet packet)
        {
            LootState state = _states[client];
            UpdatePacket update = (UpdatePacket)packet;
            // New Objects
            foreach (Entity entity in update.NewObjs)
            {
                short type = entity.ObjectType;
                if (_desiredBags.Contains(type))
                {
                    if (LootHelperConfig.Default.LootQuests)
                    {
                        state.CustomQuest = entity.Status.ObjectId;
                        QuestObjIdPacket questObjId = (QuestObjIdPacket)Packet.Create(PacketType.QUESTOBJID);
                        questObjId.ObjectId = entity.Status.ObjectId;
                        client.SendToClient(questObjId);
                    }

                    int bagId = entity.Status.ObjectId;
                    if (!state.LootBagItems.ContainsKey(bagId))
                        state.LootBagItems.Add(bagId, new int[] { -1, -1, -1, -1, -1, -1, -1, -1 });
                    else
                        state.LootBagItems[bagId] = new int[] { -1, -1, -1, -1, -1, -1, -1, -1 };

                    if (!state.LootBagLocations.ContainsKey(bagId))
                        state.LootBagLocations.Add(bagId, entity.Status.Position);
                    else
                        state.LootBagLocations[bagId] = entity.Status.Position;

                    foreach (StatData statData in entity.Status.Data)
                    {
                        if (statData.Id >= 8 && statData.Id <= 15)
                            state.LootBagItems[bagId][statData.Id - 8] = statData.IntValue;
                    }
                }
            }

            // Removed Objects
            foreach (int drop in update.Drops)
            {
                if (drop == state.CustomQuest && state.OriginalQuest != -1)
                {
                    QuestObjIdPacket questObjId = (QuestObjIdPacket)Packet.Create(PacketType.QUESTOBJID);
                    questObjId.ObjectId = state.OriginalQuest;
                    client.SendToClient(questObjId);

                    state.OriginalQuest = -1;
                    state.CustomQuest = -1;
                }

                if (state.LootBagItems.ContainsKey(drop))
                {
                    state.LootBagItems.Remove(drop);
                    state.LootBagLocations.Remove(drop);
                }
            }
        }
Ejemplo n.º 23
0
        private void OnNewTick(Client client, Packet packet)
        {
            LootState state = _states[client];
            NewTickPacket newTick = (NewTickPacket)packet;

            // Updated Objects
            foreach (Status status in newTick.Statuses)
            {
                if (state.LootBagItems.ContainsKey(status.ObjectId))
                {
                    foreach (StatData statData in status.Data)
                    {
                        if (statData.Id >= 8 && statData.Id <= 15)
                            state.LootBagItems[status.ObjectId][statData.Id - 8] = statData.IntValue;
                    }
                }
            }
        }
Ejemplo n.º 24
0
 private void OnPacket(Client client, Packet packet)
 {
     if (_reportId.Contains(packet.Type)) Console.WriteLine("[Packet Debugger] Received {0} packet.", packet.Type);
     if (_printString.Contains(packet.Type)) Console.WriteLine("[Packet Debugger] {0}", packet);
 }
Ejemplo n.º 25
0
 public void OnEnterMap(Client client, Packet packet)
 {
     initialized = true;
     mapdata = new ushort[map.height, map.width];
 }
Ejemplo n.º 26
0
        private void Send(Packet packet, bool client)
        {
            lock (client ? _clientLock : _serverLock)
            {
                bool success = PluginUtils.ProtectedInvoke(() =>
                {
                    MemoryStream ms = new MemoryStream();
                    using (PacketWriter w = new PacketWriter(ms))
                    {
                        w.Write((int)0);
                        w.Write(packet.Id);
                        packet.Write(w);
                    }

                    byte[] data = ms.ToArray();
                    PacketWriter.BlockCopyInt32(data, data.Length);

                    if (client)
                    {
                        _clientSendState.Cipher(data);
                        _clientStream.Write(data, 0, data.Length);
                    }
                    else
                    {
                        _serverSendState.Cipher(data);
                        _serverStream.Write(data, 0, data.Length);
                    }
                }, "PacketSend (packet = " + packet?.Type + ")", typeof(IOException));

                if (!success) Dispose();
            }
        }
Ejemplo n.º 27
0
        private void OnUpdate(Client client, Packet packet)
        {
            UpdatePacket update = (UpdatePacket)packet;
            TeleportState state = _states[client];
            // New Objects
            foreach (Entity entity in update.NewObjs)
            {
                if (_classes.Contains(entity.ObjectType))
                {
                    state.PlayerLocations.Add(entity.Status.ObjectId, entity.Status.Position);
                    foreach (StatData statData in entity.Status.Data)
                    {
                        if (statData.Id == 31)
                            state.PlayerNames.Add(entity.Status.ObjectId, statData.StringValue);
                    }
                }
                else if (entity.Status.ObjectId == state.QuestId)
                {
                    state.QuestLocation = entity.Status.Position;
                }
            }

            // Removed Objects
            foreach (int drop in update.Drops)
            {
                if (state.PlayerLocations.ContainsKey(drop))
                {
                    state.PlayerLocations.Remove(drop);
                    state.PlayerNames.Remove(drop);
                }
            }
        }
Ejemplo n.º 28
0
 private void T(Client client, Packet packet)
 {if (enabled == true) { 
     TextPacket t = (TextPacket)packet;
     bool found = false;
     string foundname = "NaN";
     int founddifficulty = 69;
     foreach (var Entry in Data.Entries.ToArray())
     {if (Entry.Enabled){
         foreach (var KeyWord in Entry.KeyWords)
         {
             if (t.Text.ToLower().Contains(KeyWord.ToLower()) || t.Text.ToLower().Contains(Entry.Name))
             while (foundname == "NaN") { foundname = Entry.Name; founddifficulty = Entry.Difficulty; } found = true;
         }
     }}
     if (found)
     {
         if (foundname != "NaN")
         {
             client.SendToClient(PluginUtils.CreateNotification(client.ObjectId,GetColor(founddifficulty), foundname + " called!"));
             client.SendToClient(PluginUtils.CreateOryxNotification(t.Name, t.Text)); found = true;
             if (t.Name != client.PlayerData.Name) t.Send = false;
             System.Media.SystemSounds.Exclamation.Play();
             if (autotp)
             {
                 PlayerTextPacket p = (PlayerTextPacket)Packet.Create(PacketType.PLAYERTEXT);
                 p.Text = "/teleport " + t.Name;
                 client.SendToServer(p);
             }
         }
     }
 }}