예제 #1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 1))
            {
                from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
            }
            else if (Controller != null)
            {
                PrivateOverheadMessage(MessageType.Regular, 0x47E, 1159341, from.NetState, Note); // *You strum the lute, it is tuned to ~1_NOTE~*

                if (Controller._List.ContainsKey(from))
                {
                    if (Controller._List.Any(x => x.Key == from && x.Value.Contains(Note)))
                    {
                        from.PlaySound(0x4C);
                        Controller._List.Remove(from);
                    }
                    else
                    {
                        var temp = Controller._List[from].ToList();
                        temp.Add(Note);

                        bool correct = false;

                        int i;

                        for (i = 0; i < temp.Count; i++)
                        {
                            if (temp[i] == Controller.Notes[i].Note)
                            {
                                correct = true;
                            }
                            else
                            {
                                correct = false;
                            }
                        }

                        if (correct)
                        {
                            Controller._List[from] = temp.ToArray();
                            from.PlaySound(Sound);
                        }
                        else
                        {
                            Controller._List.Remove(from);
                            from.PlaySound(0x4D);
                        }

                        if (i == 8)
                        {
                            from.PlaySound(511);
                            from.PrivateOverheadMessage(MessageType.Regular, 0x47E, 1159342, from.NetState); // *You hear a click as the chest in the corner unlocks!*
                            from.PlaySound(1048);
                            SherryStrongBox.AddPermission(from);
                            Controller._List.Remove(from);
                            Controller.ChangeNotes();
                        }
                    }
                }
                else if (Controller.Notes[0].Note == Note)
                {
                    Controller._List.Add(from, new[] { Note });
                    from.PlaySound(Sound);
                }
                else
                {
                    from.PlaySound(0x4D);
                }
            }
        }