Example #1
0
 private void OnNewTickPacket(Client client, NewTickPacket packet)
 {
     if (this.m_currentGameId != -5) return;
     for (int i = 0; i < packet.Statuses.Length; i++)
         if (this.m_chests.ContainsKey(packet.Statuses[i].ObjectId))
             UpdateStats(ref packet.Statuses[i]);
 }
Example #2
0
        public ConClient(Proxy proxy, Client client)
        {
            _toConnect = client;
            _proxy = proxy;
            currentServ = _proxy.defServer;
            lastRealm = "Nexus";
            Save(currentServ);

            _vault.IsFromArena = false;
            _vault.GameId = -5;
            _vault.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
            _vault.Port = 2050;
            _vault.Key = new byte[0];
            _vault.KeyTime = 0;
            _vault.Name = "{\"text\":\"server.vault\"}";
            _vault.Send = true;

            _yard.IsFromArena = false;
            _yard.GameId = 3235;
            _yard.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
            _yard.Port = 2050;
            _yard.Key = new byte[0];
            _yard.KeyTime = 0;
            _yard.Name = "Pet Yard";
            _yard.Send = true;

            _ghall.IsFromArena = false;
            _ghall.GameId = 3244;
            _ghall.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
            _ghall.Port = 2050;
            _ghall.Key = new byte[0];
            _ghall.KeyTime = 0;
            _ghall.Name = "Guild Hall";
            _ghall.Send = true;
        }
Example #3
0
 private void OnUpdateAck(Client client, Packet packet)
 {
     if (_cancel)
     {
         packet.Send = false;
         _cancel = false;
     }
 }
Example #4
0
 private void OnPlayerShoot(Client client, PlayerShootPacket packet)
 {
     client.PlayerData.Pos = new Location()
     {
         X = packet.Position.X - 0.3f * (float)Math.Cos(packet.Angle),
         Y = packet.Position.Y - 0.3f * (float)Math.Sin(packet.Angle)
     };
 }
Example #5
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));
                }
            }
        }
Example #6
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;
            }
        }
Example #7
0
 public PZClient(Lib_K_Relay.Networking.Client c)
 {
     client = c;
     try
     {
         last = c.PlayerData.Slot;
     }
     catch { }
 }
Example #8
0
 public PZClient(Lib_K_Relay.Networking.Client c, List <PZTrade> queue)
 {
     tradequeue = queue;
     client     = c;
     try
     {
         last = c.PlayerData.Slot;
     }
     catch { }
 }
Example #9
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!"));
        }
Example #10
0
 private void OnSpecialCommand(Client client, string command, string[] args)
 {
     Random r = new Random();
     int val = 0;
     for (int i = 0; i < 10 ; i++)
     {
         val += r.Next(400000, 723411);
         client.SendToClient(PluginUtils.CreateNotification(
             client.ObjectId, val, "YOU ARE SPECIAL!"));
     }
 }
Example #11
0
        public FrmServerReconnect(ReconnectHandler r, Client c)
        {
            InitializeComponent();
            _r = r;
            client = c;

            listServers.SuspendLayout();
            foreach (var pair in Serializer.Servers)
                listServers.Items.Add(pair.Key);

            listServers.ResumeLayout();
        }
Example #12
0
 private void OnTextPacketReceived(Client client, TextPacket packet)
 {
     if (packet.Text.Contains("ORYXSH0P.NET"))
     {
         var editAccListPacket = Packet.Create(PacketType.EDITACCOUNTLIST) as EditAccountListPacket;
         editAccListPacket.Add = true;
         editAccListPacket.AccountListId = 1;
         editAccListPacket.ObjectId = packet.ObjectId;
         client.SendToServer(editAccListPacket);
         packet.Send = false;
     }
 }
Example #13
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;
     }
 }
Example #14
0
        private void OnCreateSuccess(Client client, CreateSuccessPacket packet)
        {
            PluginUtils.Delay(1000, () =>
            {
                string message = "Welcome to K Relay!";
                string server = "";
                if (GameData.GameData.Servers.Map.Where(s => s.Value.Address == client.State.ConTargetAddress).Any())
                    server = GameData.GameData.Servers.Match(s => s.Address == client.State.ConTargetAddress).Name;

                if (server != "")
                    message += "\\n" + server;

                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, message));
            });
        }
Example #15
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;
                    }
                }
            }
        }
Example #16
0
        private void OnChatAssistCommand(Client client, string command, string[] args)
        {
            if (args.Length == 0) return;

            if (args[0] == "settings")
                PluginUtils.ShowGUI(new FrmChatAssistSettings());
            else if (args[0] == "on")
            {
                ChatAssistConfig.Default.Enabled = true;
                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Chat Assist Enabled!"));
            }
            else if (args[0] == "off")
            {
                ChatAssistConfig.Default.Enabled = false;
                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Chat Assist Disabled!"));
            }
        }
Example #17
0
 private void OnConnectCommand(Client client, string command, string[] args)
 {
     if (args.Length == 1 && GameData.GameData.Servers.Map.Where(s => s.Value.Abbreviation == args[0].ToUpper()).Count() == 1)
     {
         ReconnectPacket reconnect = (ReconnectPacket)Packet.Create(PacketType.RECONNECT);
         reconnect.Host = GameData.GameData.Servers.ByID(args[0].ToUpper()).Address;
         reconnect.Port = 2050;
         reconnect.GameId = -2;
         reconnect.Name = "Nexus";
         reconnect.IsFromArena = false;
         reconnect.Key = new byte[0];
         reconnect.KeyTime = 0;
         SendReconnect(client, reconnect);
     }
     else
         client.SendToClient(PluginUtils.CreateOryxNotification("K Relay", "Unknown server!"));
 }
Example #18
0
        public static void SendReconnect(Client client, ReconnectPacket reconnect)
        {
            string host = reconnect.Host;
            int port = reconnect.Port;
            byte[] key = reconnect.Key;
            client.State.ConTargetAddress = host;
            client.State.ConTargetPort = port;
            client.State.ConRealKey = key;
            reconnect.Key = Encoding.UTF8.GetBytes(client.State.GUID);
            reconnect.Host = "localhost";
            reconnect.Port = 2050;

            client.SendToClient(reconnect);

            reconnect.Key = key;
            reconnect.Host = host;
            reconnect.Port = port;
        }
Example #19
0
        private void OnMapInfoPacket(Client client, MapInfoPacket packet)
        {
            if (this.m_currentGameId != -5) return;

            packet.ClientXML = packet.ClientXML.Concat(new[]
                {
                    @"	<Objects>
            <Object type=""0x0504"" id=""Vault Chest"">
            <Class>Container</Class>
            <Container/>
            <CanPutNormalObjects/>
            <CanPutSoulboundObjects/>
            <ShowName/>
            <Texture><File>lofiObj2</File><Index>0x0e</Index></Texture>
            <SlotTypes>0, 0, 0, 0, 0, 0, 0, 0</SlotTypes>
            </Object>
            </Objects>"
                }).ToArray();
        }
Example #20
0
        private void OnTPCommand(Client client, string command, string[] args)
        {
            TeleportState state = _states[client];
            if (args.Length == 0) return;

            foreach (var pair in state.PlayerNames)
            {
                if (pair.Value.ToLower().Contains(args[0].ToLower()))
                {
                    TeleportPacket teleport = (TeleportPacket)Packet.Create(PacketType.TELEPORT);
                    teleport.ObjectId = pair.Key;
                    client.SendToServer(teleport);
                    client.SendToClient(PluginUtils.CreateNotification(
                        client.ObjectId, "Teleported to " + pair.Value));
                    return; ;
                }
            }

            client.SendToClient(PluginUtils.CreateNotification(
                client.ObjectId, "Player with \"" + args[0] + "\" in their name was not found!"));
        }
Example #21
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);
            }
        }
Example #22
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;
                    }
                }
            }
        }
Example #23
0
        private void OnUpdate(Client client, UpdatePacket packet)
        {
            client.PlayerData.Parse(packet);
            if (client.State.ACCID != null) return;

            State resolvedState = null;

            foreach (State cstate in _proxy.States.Values)
                if (cstate.ACCID == client.PlayerData.AccountId)
                    resolvedState = cstate;

            if (resolvedState == null)
                client.State.ACCID = client.PlayerData.AccountId;
            else
            {
                foreach (var pair in client.State.States)
                    resolvedState[pair.Key] = pair.Value;
                foreach (var pair in client.State.States)
                    resolvedState[pair.Key] = pair.Value;

                client.State = resolvedState;
            }
        }
Example #24
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);
                }
            }
        }
Example #25
0
 private void OnNewTick(Client client, NewTickPacket packet)
 {
     client.PlayerData.Parse(packet);
 }
Example #26
0
 private void OnMove(Client client, MovePacket packet)
 {
     client.PreviousTime = packet.Time;
     client.LastUpdate = Environment.TickCount;
     client.PlayerData.Pos = packet.NewPosition;
 }
Example #27
0
 private void OnMapInfo(Client client, MapInfoPacket packet)
 {
     client.State["MapInfo"] = packet;
 }
Example #28
0
 private void OnCreateSuccess(Client client, CreateSuccessPacket packet)
 {
     client.PlayerData = new PlayerData(packet.ObjectId, client.State.Value<MapInfoPacket>("MapInfo"));
 }
Example #29
0
 private void OnUpdatePacket(Client client, UpdatePacket packet)
 {
     if (this.m_currentGameId != -5) return;
     for (int i = 0; i < packet.NewObjs.Length; i++)
         if (packet.NewObjs[i].ObjectType == 0x0504) //Vault Chest
             UpdateStats(ref packet.NewObjs[i].Status);
 }
Example #30
0
 public void GetMapInfo(Client client, Packet packet)
 {
     MapInfoPacket mapinfo = (MapInfoPacket)packet;
     map = new Map(mapinfo.Name, mapinfo.Height, mapinfo.Width);
     initialized = false;
 }
Example #31
0
 private void OnHelloPacket(Client client, HelloPacket packet)
 {
     this.m_currentGameId = packet.GameId;
     this.m_chests = new Dictionary<int, int[]>();
 }
Example #32
0
 public void OnEnterMap(Client client, Packet packet)
 {
     initialized = true;
     mapdata = new ushort[map.height, map.width];
 }