Exemplo n.º 1
0
        public static void BeginInteractionHandler(ZoneClient client, Packet packet)
        {
            ushort entityid;
            if (!packet.TryReadUShort(out entityid))
            {
                Log.WriteLine(LogLevel.Warn, "Error reading interaction attempt.");
                return;
            }
            ZoneCharacter character = client.Character;

            MapObject obj;
            if (character.Map.Objects.TryGetValue(entityid, out obj))
            {

                Npc npc = obj as Npc;
                client.Character.CharacterInTarget = obj;
                if (npc != null)
                {
                    if (npc.Gate != null)
                    {

                        MapInfo mi = null;
                        if (DataProvider.Instance.MapsByName.TryGetValue(npc.Gate.MapServer, out mi))
                        {
                            Question q = new Question(string.Format("Do you want to move to {0} field?", mi.FullName), new QuestionCallback(AnswerOnGateQuestion), npc);
                            q.Add("Yes", "No");
                            q.Send(character, 500);
                            character.Question = q;
                        }
                        else
                        {
                            character.DropMessage("You can't travel to this place.");
                        }
                    }
                    else
                    {
                        SendNpcInteraction(client, npc);
                    }
                }
            }
            else Log.WriteLine(LogLevel.Warn, "{0} selected invalid object.", character.Name);
        }
Exemplo n.º 2
0
        public void DropItemRequest(byte slot)
        {
            Item item;
            if (!this.Inventory.InventoryItems.TryGetValue(slot, out item))
            {
                //TODO: send client 'item not found'
                Log.WriteLine(LogLevel.Warn, "Client tried to drop non-existing object.");
                return;
            }

            if (Question != null)
            {
                Log.WriteLine(LogLevel.Debug, "Client is answering another question. Cannot proceed drop.");
                return;
            }

            Question = new Question("Do you want to discard the item?", OnDropResponse, item);
            Question.Add("Yes", "No");
            Question.Send(this, 500);
        }
Exemplo n.º 3
0
        private void IsGay(ZoneCharacter character, params string[] param)
        {
            ZoneClient otherclient = ClientManager.Instance.GetClientByName(param[1]);
            if (otherclient == null || otherclient.Character == null)
            {
                character.DropMessage("Character not found.");
            }
            ZoneCharacter other = otherclient.Character;

            Question question = new Question("Are you gay?", new QuestionCallback(AnswerGay), character);
            question.Add("Yes", "No", "Boobs!");
            other.Question = question;
            question.Send(other);
        }