NBRune Port

Datum: 27/07/2011 13:19:43

Staženo: 591x

Popis:

,nbruna "0x40033BBB" <- ID ovsem vase RUNY


Hodnocení: 3.9/10 (149 hlasy)

Download file:cs

Příkazy:

  • ,nbruna "serial runicka"

Kód:

    using System;
    using Phoenix;
    using Phoenix.Communication;
    using Phoenix.WorldData;

    namespace Scripts.DarkParadise
    {

        public class nbrunakopanesccc
        {
            private DateTime requestTime;
            private uint? buttonId;

            [Command("nbruna")]
            public void Use(Serial runicka)
            {
                UO.AddObject("nb_runa_kop_id", runicka);
                UOItem  rune = new UOItem(Aliases.GetObject("nb_runa_kop_id"));
                if (!rune.Exist)
                    throw new ScriptErrorException("NB Rune not found.");

                // Wait for gump
                buttonId = 1;
                requestTime = DateTime.Now;
                rune.Use();
            }

            [ServerMessageHandler(0xB0)]
            public CallbackResult OnGenericGump(byte[] data, CallbackResult prevResult)
            {
                if (prevResult != CallbackResult.Normal)
                    return prevResult;

                if (buttonId != null && DateTime.Now - requestTime < TimeSpan.FromSeconds(6)) {
                    // Respond automatically
                    uint gumpSerial = ByteConverter.BigEndian.ToUInt32(data, 7);

                    PacketWriter reply = new PacketWriter(0xB1);
                    reply.WriteBlockSize();
                    reply.Write(World.Player.Serial);
                    reply.Write(gumpSerial);
                    reply.Write(buttonId.Value);
                    reply.Write(0); // Switches count
                    reply.Write(0); // Entries count

                    Core.SendToServer(reply.GetBytes());

                    // Do not pass gump further
                    buttonId = null;
                    return CallbackResult.Sent;
                }

                return CallbackResult.Normal;
            }
        }
    }



Zde ještě není žádný komentář.

Nový komentář