Jump to content

Recommended Posts

How would I go about doing this.
My plan is this.
Advertise in Trade.
When someone Whispers me with a keyword I invite them to party

When they say City name in Party I summon portal.

Then auto leave party after 30 secs after Portal Summoned.

 

Wouldnt mind being able to accept payments (just by donation) so auto trade would be nice

 

ty

Link to comment
https://wrobot.eu/forums/topic/4802-mage-portal-bot/
Share on other sites

  • 4 weeks later...

You need to write a plugin for it. There is still one that reacts at chat messages, you could take a look at it.
It should be not that complicated.
1. Trade can be detected by event + name filter
2. A text parser(Regex) should do the rest

Here is a sample how i did it in one of my projects.

        public void Pulse(WaitChatCommand task)
        {
            // Log
            Log.WriteDebug($"Waiting for chat command \"{task.ChatCommand}\" from {task.UserName}.");

            // Create channel
            Channel chat = new Channel();

            // Proceed until we have a match
            bool match = false;
            while (!match)
            {
                try
                {
                    // Read chat
                    while (chat.ActuelRead != Channel.GetMsgActuelInWow && Products.IsStarted)
                    {
                        // Get message
                        Channel.Message message = chat.ReadMsg();

                        if (!string.IsNullOrWhiteSpace(message.Msg)
                            && message.Channel == task.ChatType
                            && message.UserName == task.UserName
                            )
                        {
                            // Is a known command?
                            if (message.Msg == task.ChatCommand)
                            {
                                // Set
                                match = true;
                            }
                        }

                        // Wait
                        Thread.Sleep(100);
                    }
                }
                catch (Exception e)
                {
                    // Log
                    Logging.WriteError("[DungeonRobotActionCommand]: " + e);
                }
            }
        }

I also took the existing one from @Droidz as sample.

About the invite.

        public void Pulse(InviteToParty task)
        {
            // Still in the party?
            if (Party.GetParty().Any(p => p.Name == task.UserName))
            {
                // Log
                Log.WriteDebug($"Skip invite player, because {task.UserName} is in the party.");
                return;
            }

            if ((Party.IsInGroup() && Party.CurrentPlayerIsLeader()) || !Party.IsInGroup())
            {
                // Log
                Log.WriteDebug($"Invite {task.UserName} into the party.");

                // Invite player
                Lua.LuaDoString($"InviteUnit(\"{task.UserName}\");");
            }
            else
            {
                // Log
                Log.WriteDebug($"Skip invite player, because we are not the leader.");
                return;
            }

            // Log
            Log.WriteDebug($"Wait until {task.UserName} is in the party.");

            // Wait until the player is in the party
            while (!Party.GetParty().Any(p => p.Name == task.UserName))
            {
                // Wait
                Thread.Sleep(3000);

                // Invite player
                Lua.LuaDoString($"InviteUnit(\"{task.UserName}\");");
            }
        }

There is some more stuff in it that you don't need but its just an example and I was to lazy and just copied some of my code :ph34r:
Hope that helps a bit.

Link to comment
https://wrobot.eu/forums/topic/4802-mage-portal-bot/#findComment-23818
Share on other sites

On 2/18/2017 at 5:26 PM, iMod said:

You need to write a plugin for it. There is still one that reacts at chat messages, you could take a look at it.
It should be not that complicated.
1. Trade can be detected by event + name filter
2. A text parser(Regex) should do the rest

Here is a sample how i did it in one of my projects.


        public void Pulse(WaitChatCommand task)
        {
            // Log
            Log.WriteDebug($"Waiting for chat command \"{task.ChatCommand}\" from {task.UserName}.");

            // Create channel
            Channel chat = new Channel();

            // Proceed until we have a match
            bool match = false;
            while (!match)
            {
                try
                {
                    // Read chat
                    while (chat.ActuelRead != Channel.GetMsgActuelInWow && Products.IsStarted)
                    {
                        // Get message
                        Channel.Message message = chat.ReadMsg();

                        if (!string.IsNullOrWhiteSpace(message.Msg)
                            && message.Channel == task.ChatType
                            && message.UserName == task.UserName
                            )
                        {
                            // Is a known command?
                            if (message.Msg == task.ChatCommand)
                            {
                                // Set
                                match = true;
                            }
                        }

                        // Wait
                        Thread.Sleep(100);
                    }
                }
                catch (Exception e)
                {
                    // Log
                    Logging.WriteError("[DungeonRobotActionCommand]: " + e);
                }
            }
        }

I also took the existing one from @Droidz as sample.

About the invite.


        public void Pulse(InviteToParty task)
        {
            // Still in the party?
            if (Party.GetParty().Any(p => p.Name == task.UserName))
            {
                // Log
                Log.WriteDebug($"Skip invite player, because {task.UserName} is in the party.");
                return;
            }

            if ((Party.IsInGroup() && Party.CurrentPlayerIsLeader()) || !Party.IsInGroup())
            {
                // Log
                Log.WriteDebug($"Invite {task.UserName} into the party.");

                // Invite player
                Lua.LuaDoString($"InviteUnit(\"{task.UserName}\");");
            }
            else
            {
                // Log
                Log.WriteDebug($"Skip invite player, because we are not the leader.");
                return;
            }

            // Log
            Log.WriteDebug($"Wait until {task.UserName} is in the party.");

            // Wait until the player is in the party
            while (!Party.GetParty().Any(p => p.Name == task.UserName))
            {
                // Wait
                Thread.Sleep(3000);

                // Invite player
                Lua.LuaDoString($"InviteUnit(\"{task.UserName}\");");
            }
        }

There is some more stuff in it that you don't need but its just an example and I was to lazy and just copied some of my code :ph34r:
Hope that helps a bit.

Damn, thank you for the explanation! Unfortunately idk how to code :(

Link to comment
https://wrobot.eu/forums/topic/4802-mage-portal-bot/#findComment-24065
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...