예제 #1
0
 private void btnAddLocation_Click(object sender, EventArgs e)
 {
     using (TeleportLocationForm locationForm = new TeleportLocationForm())
     {
         if (locationForm.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(locationForm.LocationName))
         {
             helper.AddCurrentLocation(locationForm.LocationName);
             UpdateLocationList();
         }
     }
 }
예제 #2
0
        private void ClientHooks_Chat(ref string msg, HandledEventArgs e)
        {
            if (helper != null)
            {
                ChatCommand chat = ChatCommand.Parse(msg);

                if (chat != null)
                {
                    switch (chat.Command.ToLowerInvariant())
                    {
                    case "tp":
                    case "teleport":
                        if (!string.IsNullOrEmpty(chat.Parameter))
                        {
                            helper.TeleportToLocation(chat.Parameter);
                        }
                        else
                        {
                            helper.TeleportToLastLocation();
                        }

                        e.Handled = true;
                        break;

                    case "settp":
                    case "setteleport":
                        if (!string.IsNullOrEmpty(chat.Parameter))
                        {
                            helper.AddCurrentLocation(chat.Parameter);
                            UpdateForm();
                        }

                        e.Handled = true;
                        break;

                    case "tplist":
                    case "teleportlist":
                    case "locationlist":
                        string locationList = string.Join(", ", helper.GetCurrentWorldLocations());
                        Main.NewText("Locations: " + locationList, 0, 255, 0);

                        e.Handled = true;
                        break;

                    case "ptp":
                    case "playerteleport":
                    case "partyteleport":
                        if (!string.IsNullOrEmpty(chat.Parameter))
                        {
                            helper.TeleportToPlayer(chat.Parameter);
                        }
                        else
                        {
                            helper.TeleportToLastPlayer();
                        }

                        e.Handled = true;
                        break;

                    case "plist":
                    case "playerlist":
                        List <string> players    = helper.GetPlayerList();
                        string        playerList = string.Join(", ", players);
                        Main.NewText("Players: " + playerList, 0, 255, 0);

                        e.Handled = true;
                        break;

                    case "home":
                        helper.TeleportToHome();

                        e.Handled = true;
                        break;

                    case "sethome":
                        // TODO: Sethome not working correctly yet

                        e.Handled = true;
                        break;

                    case "tpinfo":
                        helper.ShowInfoText = !helper.ShowInfoText;
                        UpdateForm();

                        e.Handled = true;
                        break;

                    case "tphelp":
                        ShowHelp(chat.Parameter);

                        e.Handled = true;
                        break;
                    }
                }
            }
        }