public override void OnResponse(NetState sender, RelayInfo info) { int val = (info.ButtonID - 1); if (val < 0) { CloseChildren(); _vendor.DisposeTrade(_client, false); return; } int type = (val % 10); int index = (val / 10); /** known types: * 0 = page switching (index 0-1 for vendor paging, 2-3 for client paging) * 1 = vendor item details (index is index in array) * 2 = client item details (index is index in array) **/ switch (type) { case 0: { switch (index) { case 0: { _client.SendGump(new BarterGump(_vendor, _client, (byte)(_vendorPage - 1), _clientPage)); break; } case 1: { _client.SendGump(new BarterGump(_vendor, _client, (byte)(_vendorPage + 1), _clientPage)); break; } case 2: { _client.SendGump(new BarterGump(_vendor, _client, _vendorPage, (byte)(_clientPage - 1))); break; } case 3: { _client.SendGump(new BarterGump(_vendor, _client, _vendorPage, (byte)(_clientPage + 1))); break; } } break; } case 1: case 2: { _client.CloseGump(typeof(BarterDetailGump)); _client.SendGump(this); Gump child = new BarterDetailGump(this, (type == 1 ? _vendorItems[index] : _clientItems[index]), (type == 1)); if (_client.SendGump(child)) { AddChild(child); } break; } } }
public override void OnResponse( NetState sender, RelayInfo info ) { int val = (info.ButtonID - 1); if( val < 0 ) { CloseChildren(); _vendor.DisposeTrade( _client, false ); return; } int type = (val % 10); int index = (val / 10); /** known types: * 0 = page switching (index 0-1 for vendor paging, 2-3 for client paging) * 1 = vendor item details (index is index in array) * 2 = client item details (index is index in array) **/ switch( type ) { case 0: { switch( index ) { case 0: { _client.SendGump( new BarterGump( _vendor, _client, (byte)(_vendorPage - 1), _clientPage ) ); break; } case 1: { _client.SendGump( new BarterGump( _vendor, _client, (byte)(_vendorPage + 1), _clientPage ) ); break; } case 2: { _client.SendGump( new BarterGump( _vendor, _client, _vendorPage, (byte)(_clientPage - 1) ) ); break; } case 3: { _client.SendGump( new BarterGump( _vendor, _client, _vendorPage, (byte)(_clientPage + 1) ) ); break; } } break; } case 1: case 2: { _client.CloseGump( typeof( BarterDetailGump ) ); _client.SendGump( this ); Gump child = new BarterDetailGump( this, (type == 1 ? _vendorItems[index] : _clientItems[index]), (type == 1) ); if( _client.SendGump( child ) ) AddChild( child ); break; } } }