Exemplo n.º 1
0
        public static void MenuResponse(NetState state, CircularBufferReader reader)
        {
            var serial = reader.ReadUInt32();
            int menuID = reader.ReadInt16(); // unused in our implementation
            int index  = reader.ReadInt16();
            int itemID = reader.ReadInt16();
            int hue    = reader.ReadInt16();

            index -= 1; // convert from 1-based to 0-based

            foreach (var menu in state.Menus)
            {
                if (menu.Serial == serial)
                {
                    state.RemoveMenu(menu);

                    if (index >= 0 && index < menu.EntryLength)
                    {
                        menu.OnResponse(state, index);
                    }
                    else
                    {
                        menu.OnCancel(state);
                    }

                    break;
                }
            }
        }
Exemplo n.º 2
0
		public static void MenuResponse( NetState state, PacketReader pvSrc ) {
			int serial = pvSrc.ReadInt32();
			int menuID = pvSrc.ReadInt16(); // unused in our implementation
			int index = pvSrc.ReadInt16();
			int itemID = pvSrc.ReadInt16();
			int hue = pvSrc.ReadInt16();

			index -= 1; // convert from 1-based to 0-based

			foreach ( IMenu menu in state.Menus ) {
				if ( menu.Serial == serial ) {
					state.RemoveMenu( menu );

					if ( index >= 0 && index < menu.EntryLength ) {
						menu.OnResponse( state, index );
					} else {
						menu.OnCancel( state );
					}

					break;
				}
			}
		}
		public static void MenuResponse( NetState state, PacketReader pvSrc )
		{
			int serial = pvSrc.ReadInt32();
			/*int menuID = */pvSrc.ReadInt16(); // unused in our implementation
			int index  = pvSrc.ReadInt16();
			/*int itemID = */pvSrc.ReadInt16();
			/*int hue    = */pvSrc.ReadInt16();

			MenuCollection menus = state.Menus;

			for ( int i = 0; i < menus.Count; ++i )
			{
				IMenu menu = menus[i];

				if ( menu.Serial == serial )
				{
					try {
						if ( index > 0 && index <= menu.EntryLength )
							menu.OnResponse( state, index - 1 );
						else
							menu.OnCancel( state );
					} catch (Exception e) {
						log.Fatal(String.Format("Exception disarmed in menu response {0} > {1}[index]",
												state.Mobile, menu), e);
					}

					state.RemoveMenu( i );

					return;
				}
			}
		}
Exemplo n.º 4
0
        public static void MenuResponse( NetState state, PacketReader pvSrc )
        {
            int serial = pvSrc.ReadInt32();
            int menuID = pvSrc.ReadInt16(); // unused in our implementation
            int index  = pvSrc.ReadInt16();
            int itemID = pvSrc.ReadInt16();
            int hue    = pvSrc.ReadInt16();

            MenuCollection menus = state.Menus;

            for ( int i = 0; i < menus.Count; ++i )
            {
                IMenu menu = menus[i];

                if ( menu.Serial == serial )
                {
                    if ( index > 0 && index <= menu.EntryLength )
                        menu.OnResponse( state, index - 1 );
                    else
                        menu.OnCancel( state );

                    state.RemoveMenu( i );

                    return;
                }
            }
        }