Beispiel #1
0
        private void Trigger()
        {
            int option = (int)Math.Floor(GetLocalMousePosition().Y / 32);

            if (option >= 0 && option < _options.Count)
            {
                MapClickOption clickOption = _options[option];
                ClientCommand  command;
                switch (clickOption.Option)
                {
                case MapClickOption.OptionType.PickupItem:
                    MapItem item = (MapItem)clickOption.Parameters["MapItem"];
                    command = new ClientCommand(ClientCommand.CommandType.PickupItem);
                    command.SetParameter("ItemIndex", clickOption.Parameters["ItemIndex"]);
                    command.SetParameter("Signature", item.GetSignature());
                    RpgClientConnection.Instance.AddClientCommand(command);
                    break;

                case MapClickOption.OptionType.AttackPlayer:
                    command = new ClientCommand(ClientCommand.CommandType.AttackPlayer);
                    command.SetParameter("PlayerID", clickOption.Parameters["PlayerID"]);
                    RpgClientConnection.Instance.AddClientCommand(command);
                    break;

                case MapClickOption.OptionType.AttackEnemy:
                    command = new ClientCommand(ClientCommand.CommandType.AttackEnemy);
                    command.SetParameter("EnemyID", clickOption.Parameters["EnemyID"]);
                    RpgClientConnection.Instance.AddClientCommand(command);
                    break;

                case MapClickOption.OptionType.Trade:
                    command = new ClientCommand(ClientCommand.CommandType.TradeRequest);
                    command.SetParameter("PlayerID", clickOption.Parameters["PlayerID"]);
                    RpgClientConnection.Instance.AddClientCommand(command);
                    break;
                }
            }

            this.Close();
        }