Exemplo n.º 1
0
        public static void Start(Proxy proxy)
        {
            proxy.HookPacket <UpdatePacket>(OnUpdate);
            proxy.HookPacket <NewTickPacket>(OnNewTick);
            proxy.HookPacket <InvSwapPacket>(OnInvSwap);
            proxy.HookPacket <GotoAckPacket>(OnGotoAck);

            proxy.ClientDisconnected += (client) =>
            {
                Connections.Remove(client);
                if (client.PlayerData == null)
                {
                    return;
                }
                if (cPlayers.ToList().Select(x => x.Client.PlayerData != null ? x.Client.PlayerData.AccountId : null).Contains(client.PlayerData.AccountId))
                {                                                                                                           // Im kinda a linq boi so this is slightly unnessary but i like less lines
                    cPlayers.Remove(cPlayers.ToList().Single(x => x.Client.PlayerData != null && x.Client.PlayerData.AccountId == client.PlayerData.AccountId));
                }
            };

            proxy.ClientConnected += (client) =>
            {
                Connections.Add(client);
                cPlayers.Add(new cPlayer(client));
            };

            proxy.HookCommand("playerapi", (c, co, a) => c.SendToClient(PluginUtils.CreateNotification(c.ObjectId, "Yup im running")));
        }
Exemplo n.º 2
0
        private void OnAACommand(Client client, string command, string[] args)
        {
            if (args.Length == 0)
            {
                return;
            }

            if (args[0] == "on")
            {
                _enabled = true;
                client.SendToClient(
                    PluginUtils.CreateNotification(
                        client.ObjectId, "Auto Ability Enabled!"));
            }
            else if (args[0] == "off")
            {
                _enabled = false;
                client.SendToClient(
                    PluginUtils.CreateNotification(
                        client.ObjectId, "Auto Ability Disabled!"));
            }
            else if (args[0] == "settings")
            {
                PluginUtils.ShowGenericSettingsGUI(AutoAbilityConfig.Default, "Auto Ablity Settings");
            }
            else if (args[0] == "test")
            {
                SendUseItem(client);
            }
        }
Exemplo n.º 3
0
 public void OnCommand(Client client, string command, string[] args)
 {
     if (args.Length == 0)
     {
         return;
     }
     if (args[0] == "master")
     {
         master = client;
         listOfClients[client].SetMaster();
         client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Set as Master Client!"));
     }
     else if (args[0] == "slave")
     {
         listOfClients[client].SetSlave();
         client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Set as Slave Client!"));
     }
     else if (args[0] == "start")
     {
         _enabled = true;
         client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Follow Started!"));
     }
     else if (args[0] == "stop")
     {
         _enabled = false;
         client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Follow Stopped!"));
     }
 }
Exemplo n.º 4
0
 public static void Oof(this Client client)
 {
     if (client != null && client.Connected)
     {
         client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "oof"));
     }
 }
Exemplo n.º 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            TraderBot.SpamMsg[_c] = textBox1.Text;

            TraderBot.Selling[_c] = new List <ItemStruct>();
            TraderBot.Buying[_c]  = new List <ItemStruct>();

            foreach (ListViewItem lvi in listView1.Items)
            {
                ItemStruct tmp = new ItemStruct(lvi.SubItems[1].Text, Int32.Parse(lvi.Text));
                TraderBot.Selling[_c].Add(tmp);
            }

            foreach (ListViewItem lvi in listView2.Items)
            {
                if (lvi.SubItems.Count > 3)
                {
                    ItemStruct tmp = new ItemStruct(lvi.SubItems[1].Text, Int32.Parse(lvi.Text), lvi.SubItems[3].Text, Int32.Parse(lvi.SubItems[2].Text));
                    TraderBot.Buying[_c].Add(tmp);
                }
                else
                {
                    ItemStruct tmp = new ItemStruct(lvi.SubItems[1].Text, Int32.Parse(lvi.Text));
                    TraderBot.Buying[_c].Add(tmp);
                }
            }

            this.Close();

            _c.SendToClient(PluginUtils.CreateNotification(_c.ObjectId, "TraderBot Settings Saved!"));
        }
Exemplo n.º 6
0
        private void OnTQCommand(Client client, string command, string[] args)
        {
            TeleportState state = _states[client];

            if (state.QuestId != -1 && state.QuestLocation != null)
            {
                float minDistance = state.QuestLocation.DistanceSquaredTo(client.PlayerData.Pos);
                int   target      = client.ObjectId;

                foreach (var pair in state.PlayerLocations)
                {
                    float distance = pair.Value.DistanceSquaredTo(state.QuestLocation);
                    if (distance < minDistance)
                    {
                        minDistance = distance;
                        target      = pair.Key;
                    }
                }

                if (target != client.ObjectId)
                {
                    TeleportPacket teleport = (TeleportPacket)Packet.Create(PacketType.TELEPORT);
                    teleport.ObjectId = target;
                    client.SendToServer(teleport);
                    client.SendToClient(PluginUtils.CreateNotification(
                                            client.ObjectId, "Teleported to " + state.PlayerNames[target]));
                }
                else
                {
                    client.SendToClient(PluginUtils.CreateNotification(
                                            client.ObjectId, "You're the closest to your quest!"));
                }
            }
        }
Exemplo n.º 7
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!"));
        }
Exemplo n.º 8
0
 private void OnUseItem(Client client, Packet packet)
 {
     if (_useItemMap[client] == null && _validClasses.Contains(client.PlayerData.Class))
     {
         client.SendToClient(PluginUtils.CreateNotification(
                                 client.ObjectId, "Auto Ability Activated!"));
     }
     _useItemMap[client] = packet as UseItemPacket;
 }
Exemplo n.º 9
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!"));
            }
        }
Exemplo n.º 10
0
        public void OnQuestFetch(Client client, Packet packet)
        {
            if (!_dQuest.ContainsKey(client))
            {
                return;
            }

            QuestFetchResponsePacket qfrp = (QuestFetchResponsePacket)packet;

            client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Current Daily Quest: " + GameData.Objects.ByID((ushort)qfrp.Goal.ParseInt()).Name));
            _dQuest[client].goal = qfrp.Goal.ParseInt();
        }
Exemplo n.º 11
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!"));
            }
        }
Exemplo n.º 12
0
        public void OnQuestRedeem(Client client, Packet packet)
        {
            if (!_dQuest.ContainsKey(client))
            {
                return;
            }
            QuestRedeemResponsePacket qrrp = (QuestRedeemResponsePacket)packet;

            if (qrrp.Success)
            {
                _dQuest[client].goal = 0;
                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Quest Turned In!"));
            }
        }
Exemplo n.º 13
0
 private void OnCommand(Client client, string command, string[] args)
 {
     if (args.Length == 0 || args[0] == "settings" || args[0] == "config")
     {
         PluginUtils.ShowGenericSettingsGUI(AntiLagConfig.Default, "AntiLag Settings");
     }
     else
     {
         if (args[0] == "effects" && args[1] == "all")
         {
             allEffects[client] = !allEffects[client];
             client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "AntiLag ALL Particles " + allEffects[client]));
         }
     }
 }
Exemplo n.º 14
0
        private void SendUseItem(Client client)
        {
            _cooldown = AutoAbilityConfig.Default.RetryDelay;

            UseItemPacket useItem = _useItemMap[client];

            useItem.Time       = client.Time;
            useItem.ItemUsePos = client.PlayerData.Pos;
            client.SendToServer(useItem);

            if (AutoAbilityConfig.Default.ShowBuffNotifications)
            {
                client.SendToClient(PluginUtils.CreateNotification(
                                        client.ObjectId, "Auto-Buff Triggered!"));
            }
        }
Exemplo n.º 15
0
 private void onCommand(Client client, string command, string[] args)
 {
     if (args[0] == "on")
     {
         _hidePlayers = true;
     }
     else if (args[0] == "off")
     {
         _hidePlayers = false;
     }
     else
     {
         return;
     }
     client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "HidePlayers: Size = " + args[0]));
 }
Exemplo n.º 16
0
        public void OnMove(Client client, Packet packet)
        {
            if (!_dQuest.ContainsKey(client))
            {
                return;
            }

            foreach (int bagId in _dQuest[client].bagLocations.Keys)
            {
                float distance = _dQuest[client].bagLocations[bagId].DistanceTo(client.PlayerData.Pos);

                if (DailyQuestConfig.Default.BagNotifications && Environment.TickCount - _dQuest[client].lastNotif > 2000 && distance < 15)
                {
                    _dQuest[client].lastNotif = Environment.TickCount;
                    client.SendToClient(PluginUtils.CreateNotification(bagId, "Current Daily Quest: " + GameData.Objects.ByID((ushort)_dQuest[client].goal).Name));
                }
            }
        }
Exemplo n.º 17
0
 private void onCommand(Client client, string command, string[] args)
 {
     _client = client;
     if (command == "hotkeys")
     {
         if (args[0] == "on")
         {
             gui?.Close();
             gui = new Settings(this);
             PluginUtils.ShowGUI(gui);
             client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Text Hotkeys: on"));
         }
         else if (args[0] == "off")
         {
             gui?.Close();
             client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Text Hotkeys: off"));
         }
     }
 }
Exemplo n.º 18
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));
            });
        }
Exemplo n.º 19
0
        private void SendUseItem(Client client)
        {
            UseItemPacket useItem = (UseItemPacket)UseItemPacket.Create(PacketType.USEITEM);

            useItem.Time                  = client.Time;
            useItem.ItemUsePos            = new Location();
            useItem.ItemUsePos.X          = client.PlayerData.Pos.X;
            useItem.ItemUsePos.Y          = client.PlayerData.Pos.Y;
            useItem.SlotObject            = new SlotObject();
            useItem.SlotObject.SlotId     = 1;
            useItem.SlotObject.ObjectType = (short)client.PlayerData.Slot[1];
            useItem.SlotObject.ObjectId   = client.ObjectId;
            useItem.UseType               = 1;
            client.SendToServer(useItem);

            client.SendToClient(
                PluginUtils.CreateNotification(client.ObjectId, "Auto-Buff Triggered!")
                );
        }
Exemplo n.º 20
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!"));
            }
        }
Exemplo n.º 21
0
        public void OnCommand(Client client, string command, string[] args)
        {
            if (args.Length == 0)
            {
                return;
            }

            if (args[0] == "enable")
            {
                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "TraderBot Enabled!"));
                _Enabled[client] = true;
            }
            else if (args[0] == "disable")
            {
                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "TraderBot Disabled!"));
                _Enabled[client] = false;
                //idelTimer[client].Reset();
            }
            else if (args[0] == "settings")
            {
                PluginUtils.ShowGUI(new FrmTraderBot(client));
            }
            else if (args[0] == "start")
            {
                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "TraderBot Started!"));
                if (_Enabled[client])
                {
                    _Started[client] = true;
                    //idelTimer[client].Start();
                }
            }
            else if (args[0] == "stop")
            {
                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "TraderBot Stopped!"));
                if (_Enabled[client])
                {
                    _Started[client] = false;
                    //idelTimer[client].Reset();
                }
            }
            else if (args[0] == "preset")
            {
                if (args[1] == "1")
                {
                    Selling[client].Add(new ItemStruct("Potion of Speed", 8));
                    Buying[client].Add(new ItemStruct("Potion of Life", 1));
                    SpamMsg[client] = "B> LIFE 1:8 SPD :name:";
                    client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "TraderBot Using Preset 1!"));
                }
                else if (args[1] == "2")
                {
                    Selling[client].Add(new ItemStruct("Potion of Defense", 6));
                    Buying[client].Add(new ItemStruct("Potion of Life", 1));
                    SpamMsg[client] = "B> LIFE (6 DEF) :name:";
                    client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "TraderBot Using Preset 2!"));
                }
                else if (args[1] == "3")
                {
                    Selling[client].Add(new ItemStruct("Potion of Attack", 6));
                    Buying[client].Add(new ItemStruct("Potion of Life", 1));
                    SpamMsg[client] = "B> LIFE (6 ATK) :name:";
                    client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "TraderBot Using Preset 3!"));
                }
            }
            else if (args[0] == "login")
            {
            }
        }
Exemplo n.º 22
0
        private void OnMove(Client client, Packet packet)
        {
            if (!_states.ContainsKey(client))
            {
                return;
            }
            LootState state = _states[client];

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

                            bool next = true;
                            if (LootHelperConfig.Default.AutoLootList.Contains(ReverseLookup(state.LootBagItems[bagId][bi])))
                            {
                                next = false;
                            }
                            else if (CheckLootTier(state.LootBagItems[bagId][bi]))
                            {
                                next = false;
                            }

                            if (next)
                            {
                                continue;
                            }

                            state.LastLoot = Environment.TickCount;

                            if (state.LootBagItems[bagId][bi] == 2594 && client.PlayerData.HealthPotionCount < 6)
                            {
                                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)(state.LootBagItems[bagId][bi] - 2340);
                                invSwap.SlotObject2.ObjectType = -1;

                                //state.LastLoot = Environment.TickCount;
                                client.SendToServer(invSwap);
                                continue;
                            }
                            else if (state.LootBagItems[bagId][bi] == 2595 && client.PlayerData.MagicPotionCount < 6)
                            {
                                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)(state.LootBagItems[bagId][bi] - 2340);
                                invSwap.SlotObject2.ObjectType = -1;

                                //state.LastLoot = Environment.TickCount;
                                client.SendToServer(invSwap);
                                continue;
                            }
                            else
                            {
                                for (int i = 4; i < 20; i++)
                                {
                                    if (i < 12)
                                    {
                                        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 = state.LootBagItems[bagId][bi];

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

                                            //state.LastLoot = Environment.TickCount;
                                            client.SendToServer(invSwap);
                                            continue;
                                        }
                                    }
                                    else
                                    {
                                        if (client.PlayerData.HasBackpack)
                                        {
                                            if (client.PlayerData.BackPack[i - 12] == -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 = state.LootBagItems[bagId][bi];

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

                                                //state.LastLoot = Environment.TickCount;
                                                client.SendToServer(invSwap);
                                                continue;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (LootHelperConfig.Default.NotifBags.Contains(state.LootBagTypes[bagId], StringComparison.OrdinalIgnoreCase))
                {
                    if (!state.BagLastNotif.ContainsKey(bagId))
                    {
                        state.BagLastNotif.Add(bagId, 0);
                    }

                    if (LootHelperConfig.Default.LootNotifications && Environment.TickCount - state.BagLastNotif[bagId] > 2000 && distance < 15)
                    {
                        state.BagLastNotif[bagId] = 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));
                        }
                    }
                }
            }
        }
Exemplo n.º 23
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!"));
            }
            else if (args[0] == "add")
            {
                if (args.Length > 1)
                {
                    // This is needed because args are seperated by whitespaces and the string to filter coud contain whitespaces so we concatenate them together
                    string toFilter = "";
                    for (int i = 1; i < args.Length; ++i)
                    {
                        toFilter += args[i] + " ";
                    }

                    toFilter = toFilter.Remove(toFilter.Length - 1); // Remove the trailing space

                    ChatAssistConfig.Default.Blacklist.Add(toFilter);
                    client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, toFilter + " added to spam filter!"));

                    ChatAssistConfig.Default.Save(); // Save our changes
                }
                else
                {
                    client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Missing message to filter!"));
                }
            }
            else if (args[0] == "remove" || args[0] == "rem")
            {
                if (args.Length > 1)
                {
                    string toRemove = "";
                    for (int i = 1; i < args.Length; ++i)
                    {
                        toRemove += args[i] + " ";
                    }

                    toRemove = toRemove.Remove(toRemove.Length - 1); // Remove the trailing space

                    if (ChatAssistConfig.Default.Blacklist.Contains(toRemove))
                    {
                        ChatAssistConfig.Default.Blacklist.Remove(toRemove);
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, toRemove + " removed from spam filter!"));

                        ChatAssistConfig.Default.Save(); // Save our changes
                    }
                    else
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Couldn't find " + toRemove + " in spam filter!"));
                    }
                }
                else
                {
                    client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Missing message to remove!"));
                }
            }
            else if (args[0] == "list")
            {
                if (ChatAssistConfig.Default.Blacklist.Count == 0)
                {
                    client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Spam filter is empty!"));
                    return;
                }

                string message = "Spam filter contains: ";

                // Construct our list
                foreach (string filter in ChatAssistConfig.Default.Blacklist)
                {
                    message += filter + ", ";
                }

                message = message.Remove(message.Length - 2);

                client.SendToClient(PluginUtils.CreateOryxNotification("ChatAssist", message));
            }
        }
Exemplo n.º 24
0
        private void OnText(Client client, Packet packet)
        {
            if (!ChatAssistConfig.Default.Enabled)
            {
                return;
            }
            //TextPacket text = (TextPacket)packet;
            TextPacket text = packet.To <TextPacket>();

            if (text.Text == "{\"key\":\"server.oryx_closed_realm\"}")
            {
                client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Realm has Closed!"));
            }

            if (text.Name.Contains("#Oryx") || text.Name.Contains("Mysterious"))
            {
                if (text.Text.Contains("Hermit_God"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Hermit God Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Hermit God Died!"));
                    }
                }
                else if (text.Text.Contains("Lord_of_the_Lost_Lands"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Lord of the Lost Lands Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Lord of the Lost Lands Died!"));
                    }
                }
                else if (text.Text.Contains("Grand_Sphinx"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Grand Sphinx Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Grand Sphinx Died!"));
                    }
                }
                else if (text.Text.Contains("Pentaract"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Pentaract Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Pentaract Died!"));
                    }
                }
                else if (text.Text.Contains("shtrs_Defense_System"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Avatar Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Avatar Died!"));
                    }
                }
                else if (text.Text.Contains("Ghost_Ship"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Ghost Ship Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Ghost Ship Died!"));
                    }
                }
                else if (text.Text.Contains("Dragon_Head_Leader"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Rock Dragon Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Rock Dragon Died!"));
                    }
                }
                else if (text.Text.Contains("Cube_God"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Cube God Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Cube God Died!"));
                    }
                }
                else if (text.Text.Contains("Skull_Shrine"))
                {
                    if (text.Text.Contains("new"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Skull Shrine Spawned!"));
                    }
                    else if (text.Text.Contains("killed") || text.Text.Contains("death"))
                    {
                        client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Skull Shrine Died!"));
                    }
                }
                else
                {
                    client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, "Unknown New: " + text.Text));
                }
            }

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

            foreach (string filter in ChatAssistConfig.Default.Blacklist)
            {
                if (filter.ToLower().Trim() == "")
                {
                    continue;
                }

                if (text.Text.ToLower().Contains(filter.ToLower().Trim()))
                {
                    // Is spam
                    if (ChatAssistConfig.Default.CensorSpamMessages)
                    {
                        text.Text      = "...";
                        text.CleanText = "...";
                        return;
                    }
                    text.Send = false;
                }
            }
        }
Exemplo n.º 25
0
 public static void DisplayInGameNotification(this Client client, string text)
 {
     // Send a notification to the client
     // The notification will be displayed on top of the character's head
     client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, text));
 }
Exemplo n.º 26
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 = 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));
                    }
                }
            }
        }
Exemplo n.º 27
0
 public static void Notify(this Client client, string text)
 {
     client.SendToClient(PluginUtils.CreateNotification(client.ObjectId, text));
 }