1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Operator blah blah cannot be applied to operands of type ___

Discussion in 'Script Support' started by tass23, Apr 13, 2014.

  1. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    Since my C# experience is self-taught from using RunUO libraries, would someone mind explaining to me exactly why this works sometimes and not others?

    Code (C#):
    1. Item[] Gold = m_From.Backpack.FindItemsByType( typeof( Gold ) ) || m_From.BankBox.FindItemsByType( typeof( Gold ) );
    Error: Operator || cannot be applied to operands of type Server.Item[][/code]
     
    #1 tass23, Apr 13, 2014
    Last edited: Apr 14, 2014
  2. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,155
    Likes Received:
    125
    Try it without the []. This is a guess, but I think its not liking the fact that you are creating a list but trying to give it a choice of two things using an or.
     
  3. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    That's a negative, same error. I'm trying to fix the Yard Wand so it'll take gold out of a player's backpack or bankbox. This is where I'm stuck....just this one line :|
     
  4. Ravenwolfe
    Offline

    Moderator ServUO Developer

    Joined:
    Sep 7, 2013
    Messages:
    1,155
    Likes Received:
    125
    Ok, your code stores what it finds into a variable. What you need to do is check for the container (bankbox or backpack) and then do a Consume of the gold amount. Like this from BaseVendor:

    Code (C#):
    1.  
    2.             cont = buyer.Backpack;
    3.             if (!bought && cont != null)
    4.             {
    5.                 if (cont.ConsumeTotal(typeof(Gold), totalCost))
    6.                 {
    7.                     bought = true;
    8.                 }
    9.                 else if (totalCost < 2000)
    10.                 {
    11.                     SayTo(buyer, 500192); //Begging thy pardon, but thou casnt afford that.
    12.                 }
    13.             }
    14.  
    15.             if (!bought && totalCost >= 2000)
    16.             {
    17.                 cont = buyer.FindBankNoCreate();
    18.                 if (cont != null && cont.ConsumeTotal(typeof(Gold), totalCost))
    19.                 {
    20.                     bought = true;
    21.                     fromBank = true;
    22.                 }
    23.                 else
    24.                 {
    25.                     SayTo(buyer, 500191); //Begging thy pardon, but thy bank account lacks these funds.
    26.                 }
    27.             }
    28.  
    If you want to post the YardWand, I can give you a bit more specific guidance.
     
  5. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    This isn't the original, but you can probably see what I was trying to do here....
    I created a section for the backpack and one for the bankbox.
     

    Attached Files:

  6. Toriad
    Offline

    Toriad Shard Owner

    Joined:
    Mar 4, 2013
    Messages:
    86
    Likes Received:
    35
    Also if you really want to do it in one line, then you need to
    Code (C#):
    1. Item[] Gold = m_From.Backpack.FindItemsByType(typeof(Gold)).Length > 0 ? m_From.Backpack.FindItemsByType(typeof(Gold)) : m_From.BankBox.FindItemsByType(typeof(Gold))
    EDIT: || operator returns a true or false, not anything else. If you wanted to do something like what you were doing you want the ?? operator, which will return the left side if it's not null or the right side if the left is. However the things have to be the same type, and they have to be null. FindItemsByType returns an empty array, not a null value.
     
  7. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    Ah, now that makes more sense Tor, thanks :)

    EDIT:
    The code compiles ( no surprise ;) ), but it's not looking in the player's bankbox if there isn't any gold in their backpack. Logically, this code looks like it would work, but it doesn't.

    Code (C#):
    1.  
    2.         public void EndPlace( Point3D loc )
    3.         {
    4.             Item[] Gold = m_From.Backpack.FindItemsByType(typeof(Gold)).Length > 0 ? m_From.Backpack.FindItemsByType(typeof(Gold)) : m_From.BankBox.FindItemsByType(typeof(Gold));
    5.            
    6.             if ( m_Price < 3000 )
    7.             {
    8.                 if( m_From.Backpack.ConsumeTotal( typeof( Gold ), m_Price ) )
    9.                 {
    10.                     switch (m_ItemID)
    11.                     {
    12.                         case 2084:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    13.                         case 2085:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    14.                         case 2086:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    15.                         case 2087:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    16.                         case 2088:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    17.                         case 2090:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    18.                         case 2124:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    19.                         case 2125:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    20.                         case 2126:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    21.                         case 2127:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    22.                         case 2128:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    23.                         case 2130:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    24.                         case 2105:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    25.                         case 2106:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    26.                         case 2107:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    27.                         case 2108:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    28.                         case 2109:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    29.                         case 2111:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    30.                         case 2150:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    31.                         case 2151:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    32.                         case 2152:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    33.                         case 2153:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    34.                         case 2154:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    35.                         case 2156:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    36.  
    37.                         case 5952:{new YardFountain( m_From, m_Price, TypeOfFountain.Stone, loc );break;}
    38.                         case 6610:{new YardFountain( m_From, m_Price, TypeOfFountain.Sand, loc );break;}
    39.  
    40.                         case 3395:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 1, loc );break;}
    41.                         case 3401:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 4, 3, loc );break;}
    42.                         case 3408:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    43.                         case 3417:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 2, loc );break;}
    44.                         case 3423:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    45.                         case 3430:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    46.                         case 3440:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 2, loc );break;}
    47.                         case 3446:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    48.                         case 3453:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 2, loc );break;}
    49.                         case 3461:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 1, 1, loc );break;}
    50.                         case 3465:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    51.                         case 3470:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    52.                         case 4793:{new YardTreeMulti( m_From, "Yew Tree", m_Price, m_ItemID, 3, 4, loc );break;}
    53.                         case 7802:{new YardTreeMulti( m_From, "Yew Leaves", m_Price, m_ItemID, 4, 5, loc );break;}
    54.                         case 3413:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 1, loc );break;}
    55.                         case 3436:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, -2, -1, loc );break;}
    56.                         case 3457:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 2, loc );break;}
    57.                         case 3474:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 1, loc );break;}
    58.  
    59.                         //Stairs
    60.                         case 1006:{new YardStair( m_From, 1006, 1006, 1006, 1006, loc, m_Price ); break;}
    61.                         case 1007:{new YardStair( m_From, 1007, 1008, 1009, 1010, loc, m_Price ); break;}
    62.                         case 1011:{new YardStair( m_From, 1011, 1012, 1013, 1014, loc, m_Price ); break;}
    63.                         case 1015:{new YardStair( m_From, 1015, 1016, 1017, 1018, loc, m_Price ); break;}
    64.                         case 1019:{new YardStair( m_From, 1019, 1020, 1021, 1022, loc, m_Price ); break;}
    65.                         case 1023:{new YardStair( m_From, 1023, 1024, 1025, 1026, loc, m_Price ); break;}
    66.                         case 1801:{new YardStair( m_From, 1801, 1801, 1801, 1801, loc, m_Price ); break;}
    67.                         case 1802:{new YardStair( m_From, 1802, 1803, 1804, 1805, loc, m_Price ); break;}
    68.                         case 1806:{new YardStair( m_From, 1806, 1807, 1808, 1809, loc, m_Price ); break;}
    69.                         case 1810:{new YardStair( m_From, 1810, 1811, 1812, 1813, loc, m_Price ); break;}
    70.                         case 1814:{new YardStair( m_From, 1814, 1815, 1816, 1817, loc, m_Price ); break;}
    71.                         case 1818:{new YardStair( m_From, 1818, 1819, 1820, 1821, loc, m_Price ); break;}
    72.                         case 1822:{new YardStair( m_From, 1822, 1822, 1822, 1822, loc, m_Price ); break;}
    73.                         case 1823:{new YardStair( m_From, 1823, 1846, 1847, 1865, loc, m_Price ); break;}
    74.                         case 1866:{new YardStair( m_From, 1866, 1867, 1868, 1869, loc, m_Price ); break;}
    75.                         case 1870:{new YardStair( m_From, 1870, 1871, 1922, 1923, loc, m_Price ); break;}
    76.                         case 1952:{new YardStair( m_From, 1952, 1953, 1954, 2010, loc, m_Price ); break;}
    77.                         case 2015:{new YardStair( m_From, 2015, 2016, 2100, 2166, loc, m_Price ); break;}
    78.                         case 1825:{new YardStair( m_From, 1825, 1825, 1825, 1825, loc, m_Price ); break;}
    79.                         case 1826:{new YardStair( m_From, 1826, 1827, 1828, 1829, loc, m_Price ); break;}
    80.                         case 1830:{new YardStair( m_From, 1830, 1831, 1832, 1833, loc, m_Price ); break;}
    81.                         case 1834:{new YardStair( m_From, 1834, 1835, 1836, 1837, loc, m_Price ); break;}
    82.                         case 1838:{new YardStair( m_From, 1838, 1839, 1840, 1841, loc, m_Price ); break;}
    83.                         case 1842:{new YardStair( m_From, 1842, 1843, 1844, 1845, loc, m_Price ); break;}
    84.  
    85.                         case 1848:{new YardStair( m_From, 1848, 1848, 1848, 1848, loc, m_Price ); break;}
    86.                         case 1849:{new YardStair( m_From, 1849, 1850, 1851, 1852, loc, m_Price ); break;}
    87.                         case 1853:{new YardStair( m_From, 1853, 1854, 1855, 1856, loc, m_Price ); break;}
    88.                         case 1861:{new YardStair( m_From, 1861, 1862, 1863, 1864, loc, m_Price ); break;}
    89.                         case 1857:{new YardStair( m_From, 1857, 1858, 1859, 1860, loc, m_Price ); break;}
    90.                         case 2170:{new YardStair( m_From, 2170, 2171, 2172, 2173, loc, m_Price ); break;}
    91.                         case 1872:{new YardStair( m_From, 1872, 1872, 1872, 1872, loc, m_Price ); break;}
    92.                         case 1873:{new YardStair( m_From, 1873, 1874, 1875, 1876, loc, m_Price ); break;}
    93.                         case 1877:{new YardStair( m_From, 1877, 1878, 1879, 1880, loc, m_Price ); break;}
    94.                         case 1881:{new YardStair( m_From, 1881, 1882, 1883, 1884, loc, m_Price ); break;}
    95.                         case 1885:{new YardStair( m_From, 1885, 1886, 1887, 1888, loc, m_Price ); break;}
    96.                         case 1889:{new YardStair( m_From, 1889, 1890, 1891, 1892, loc, m_Price ); break;}
    97.                         case 1900:{new YardStair( m_From, 1900, 1900, 1900, 1900, loc, m_Price ); break;}
    98.                         case 1901:{new YardStair( m_From, 1901, 1902, 1903, 1904, loc, m_Price ); break;}
    99.                         case 1905:{new YardStair( m_From, 1905, 1906, 1907, 1908, loc, m_Price ); break;}
    100.                         case 1909:{new YardStair( m_From, 1909, 1910, 1911, 1912, loc, m_Price ); break;}
    101.                         case 1913:{new YardStair( m_From, 1913, 1914, 1915, 1916, loc, m_Price ); break;}
    102.                         case 1917:{new YardStair( m_From, 1917, 1918, 1919, 1920, loc, m_Price ); break;}
    103.                         case 1928:{new YardStair( m_From, 1928, 1928, 1928, 1928, loc, m_Price ); break;}
    104.                         case 1929:{new YardStair( m_From, 1929, 1930, 1931, 1932, loc, m_Price ); break;}
    105.                         case 1933:{new YardStair( m_From, 1933, 1934, 1935, 1936, loc, m_Price ); break;}
    106.                         case 1937:{new YardStair( m_From, 1937, 1938, 1939, 1940, loc, m_Price ); break;}
    107.                         case 1941:{new YardStair( m_From, 1941, 1942, 1943, 1944, loc, m_Price ); break;}
    108.                         case 1945:{new YardStair( m_From, 1945, 1946, 1947, 1948, loc, m_Price ); break;}
    109.  
    110.                         case 1955:{new YardStair( m_From, 1955, 1955, 1955, 1955, loc, m_Price ); break;}
    111.                         case 1956:{new YardStair( m_From, 1956, 1957, 1958, 1959, loc, m_Price ); break;}
    112.                         case 1960:{new YardStair( m_From, 1960, 1961, 1962, 1963, loc, m_Price ); break;}
    113.                         case 1964:{new YardStair( m_From, 1964, 1965, 1966, 1967, loc, m_Price ); break;}
    114.                         case 1978:{new YardStair( m_From, 1978, 1978, 1978, 1978, loc, m_Price ); break;}
    115.                         case 1979:{new YardStair( m_From, 1979, 1980, 1979, 1980, loc, m_Price ); break;}
    116.                         case 1991:{new YardStair( m_From, 1991, 1992, 1991, 1992, loc, m_Price ); break;}
    117.                         case 1981:{new YardStair( m_From, 1981, 1982, 1981, 1982, loc, m_Price ); break;}
    118.                         case 1983:{new YardStair( m_From, 1983, 1984, 1985, 1986, loc, m_Price ); break;}
    119.                         case 1987:{new YardStair( m_From, 1987, 1988, 1989, 1990, loc, m_Price ); break;}
    120.                         case 1993:{new YardStair( m_From, 1993, 1994, 1995, 1996, loc, m_Price ); break;}
    121.                         case 1997:{new YardStair( m_From, 1997, 1998, 1999, 2000, loc, m_Price ); break;}
    122.                         case 1173:{new YardStair( m_From, 1173, 1179, 1180, 1181, loc, m_Price ); break;}
    123.                         case 1193:{new YardStair( m_From, 1193, 1194, 1205, 1206, loc, m_Price ); break;}
    124.                         case 1250:{new YardStair( m_From, 1250, 1276, 1317, 1327, loc, m_Price ); break;}
    125.                         case 1289:{new YardStair( m_From, 1289, 1290, 1291, 1292, loc, m_Price ); break;}
    126.                         case 1294:{new YardStair( m_From, 1294, 1295, 1297, 1299, loc, m_Price ); break;}
    127.                         case 1301:{new YardStair( m_From, 1301, 1374, 1397, 1401, loc, m_Price ); break;}
    128.                         case 1035:{new YardStair( m_From, 1035, 1036, 1037, 1038, loc, m_Price ); break;}
    129.                         case 1039:{new YardStair( m_From, 1039, 1040, 1041, 1042, loc, m_Price ); break;}
    130.                         case 1043:{new YardStair( m_From, 1043, 1044, 1045, 1046, loc, m_Price ); break;}
    131.                         case 1047:{new YardStair( m_From, 1047, 1048, 1049, 1051, loc, m_Price ); break;}
    132.                         case 1051:{new YardStair( m_From, 1051, 1052, 1053, 1054, loc, m_Price ); break;}
    133.                         case 12789:{new YardStair( m_From, 12789, 12793, 12794, 12795, loc, m_Price ); break;}
    134.  
    135.                         default:  {new YardItem( m_From, m_ItemID, loc, m_Price);break;}
    136.                     }
    137.                     GumpUp();
    138.                 }
    139.                 else
    140.                 {
    141.                     m_From.SendMessage( "You do not have enough gold in your backpack for that." );
    142.                     GumpUp();
    143.                 }
    144.             }
    145.             if ( m_Price > 2999 )
    146.             {
    147.                 if( m_From.BankBox.ConsumeTotal( typeof( Gold ), m_Price ) )
    148.                 {
    149.                     switch (m_ItemID)
    150.                     {
    151.                         case 2084:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    152.                         case 2085:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    153.                         case 2086:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    154.                         case 2087:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    155.                         case 2088:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    156.                         case 2090:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    157.                         case 2124:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    158.                         case 2125:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    159.                         case 2126:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    160.                         case 2127:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    161.                         case 2128:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    162.                         case 2130:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    163.                         case 2105:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    164.                         case 2106:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    165.                         case 2107:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    166.                         case 2108:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    167.                         case 2109:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    168.                         case 2111:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    169.                         case 2150:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    170.                         case 2151:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    171.                         case 2152:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    172.                         case 2153:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    173.                         case 2154:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    174.                         case 2156:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    175.  
    176.                         case 5952:{new YardFountain( m_From, m_Price, TypeOfFountain.Stone, loc );break;}
    177.                         case 6610:{new YardFountain( m_From, m_Price, TypeOfFountain.Sand, loc );break;}
    178.  
    179.                         case 3395:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 1, loc );break;}
    180.                         case 3401:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 4, 3, loc );break;}
    181.                         case 3408:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    182.                         case 3417:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 2, loc );break;}
    183.                         case 3423:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    184.                         case 3430:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    185.                         case 3440:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 2, loc );break;}
    186.                         case 3446:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    187.                         case 3453:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 2, loc );break;}
    188.                         case 3461:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 1, 1, loc );break;}
    189.                         case 3465:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    190.                         case 3470:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    191.                         case 4793:{new YardTreeMulti( m_From, "Yew Tree", m_Price, m_ItemID, 3, 4, loc );break;}
    192.                         case 7802:{new YardTreeMulti( m_From, "Yew Leaves", m_Price, m_ItemID, 4, 5, loc );break;}
    193.                         case 3413:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 1, loc );break;}
    194.                         case 3436:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, -2, -1, loc );break;}
    195.                         case 3457:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 2, loc );break;}
    196.                         case 3474:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 1, loc );break;}
    197.  
    198.                         //Stairs
    199.                         case 1006:{new YardStair( m_From, 1006, 1006, 1006, 1006, loc, m_Price ); break;}
    200.                         case 1007:{new YardStair( m_From, 1007, 1008, 1009, 1010, loc, m_Price ); break;}
    201.                         case 1011:{new YardStair( m_From, 1011, 1012, 1013, 1014, loc, m_Price ); break;}
    202.                         case 1015:{new YardStair( m_From, 1015, 1016, 1017, 1018, loc, m_Price ); break;}
    203.                         case 1019:{new YardStair( m_From, 1019, 1020, 1021, 1022, loc, m_Price ); break;}
    204.                         case 1023:{new YardStair( m_From, 1023, 1024, 1025, 1026, loc, m_Price ); break;}
    205.                         case 1801:{new YardStair( m_From, 1801, 1801, 1801, 1801, loc, m_Price ); break;}
    206.                         case 1802:{new YardStair( m_From, 1802, 1803, 1804, 1805, loc, m_Price ); break;}
    207.                         case 1806:{new YardStair( m_From, 1806, 1807, 1808, 1809, loc, m_Price ); break;}
    208.                         case 1810:{new YardStair( m_From, 1810, 1811, 1812, 1813, loc, m_Price ); break;}
    209.                         case 1814:{new YardStair( m_From, 1814, 1815, 1816, 1817, loc, m_Price ); break;}
    210.                         case 1818:{new YardStair( m_From, 1818, 1819, 1820, 1821, loc, m_Price ); break;}
    211.                         case 1822:{new YardStair( m_From, 1822, 1822, 1822, 1822, loc, m_Price ); break;}
    212.                         case 1823:{new YardStair( m_From, 1823, 1846, 1847, 1865, loc, m_Price ); break;}
    213.                         case 1866:{new YardStair( m_From, 1866, 1867, 1868, 1869, loc, m_Price ); break;}
    214.                         case 1870:{new YardStair( m_From, 1870, 1871, 1922, 1923, loc, m_Price ); break;}
    215.                         case 1952:{new YardStair( m_From, 1952, 1953, 1954, 2010, loc, m_Price ); break;}
    216.                         case 2015:{new YardStair( m_From, 2015, 2016, 2100, 2166, loc, m_Price ); break;}
    217.                         case 1825:{new YardStair( m_From, 1825, 1825, 1825, 1825, loc, m_Price ); break;}
    218.                         case 1826:{new YardStair( m_From, 1826, 1827, 1828, 1829, loc, m_Price ); break;}
    219.                         case 1830:{new YardStair( m_From, 1830, 1831, 1832, 1833, loc, m_Price ); break;}
    220.                         case 1834:{new YardStair( m_From, 1834, 1835, 1836, 1837, loc, m_Price ); break;}
    221.                         case 1838:{new YardStair( m_From, 1838, 1839, 1840, 1841, loc, m_Price ); break;}
    222.                         case 1842:{new YardStair( m_From, 1842, 1843, 1844, 1845, loc, m_Price ); break;}
    223.  
    224.                         case 1848:{new YardStair( m_From, 1848, 1848, 1848, 1848, loc, m_Price ); break;}
    225.                         case 1849:{new YardStair( m_From, 1849, 1850, 1851, 1852, loc, m_Price ); break;}
    226.                         case 1853:{new YardStair( m_From, 1853, 1854, 1855, 1856, loc, m_Price ); break;}
    227.                         case 1861:{new YardStair( m_From, 1861, 1862, 1863, 1864, loc, m_Price ); break;}
    228.                         case 1857:{new YardStair( m_From, 1857, 1858, 1859, 1860, loc, m_Price ); break;}
    229.                         case 2170:{new YardStair( m_From, 2170, 2171, 2172, 2173, loc, m_Price ); break;}
    230.                         case 1872:{new YardStair( m_From, 1872, 1872, 1872, 1872, loc, m_Price ); break;}
    231.                         case 1873:{new YardStair( m_From, 1873, 1874, 1875, 1876, loc, m_Price ); break;}
    232.                         case 1877:{new YardStair( m_From, 1877, 1878, 1879, 1880, loc, m_Price ); break;}
    233.                         case 1881:{new YardStair( m_From, 1881, 1882, 1883, 1884, loc, m_Price ); break;}
    234.                         case 1885:{new YardStair( m_From, 1885, 1886, 1887, 1888, loc, m_Price ); break;}
    235.                         case 1889:{new YardStair( m_From, 1889, 1890, 1891, 1892, loc, m_Price ); break;}
    236.                         case 1900:{new YardStair( m_From, 1900, 1900, 1900, 1900, loc, m_Price ); break;}
    237.                         case 1901:{new YardStair( m_From, 1901, 1902, 1903, 1904, loc, m_Price ); break;}
    238.                         case 1905:{new YardStair( m_From, 1905, 1906, 1907, 1908, loc, m_Price ); break;}
    239.                         case 1909:{new YardStair( m_From, 1909, 1910, 1911, 1912, loc, m_Price ); break;}
    240.                         case 1913:{new YardStair( m_From, 1913, 1914, 1915, 1916, loc, m_Price ); break;}
    241.                         case 1917:{new YardStair( m_From, 1917, 1918, 1919, 1920, loc, m_Price ); break;}
    242.                         case 1928:{new YardStair( m_From, 1928, 1928, 1928, 1928, loc, m_Price ); break;}
    243.                         case 1929:{new YardStair( m_From, 1929, 1930, 1931, 1932, loc, m_Price ); break;}
    244.                         case 1933:{new YardStair( m_From, 1933, 1934, 1935, 1936, loc, m_Price ); break;}
    245.                         case 1937:{new YardStair( m_From, 1937, 1938, 1939, 1940, loc, m_Price ); break;}
    246.                         case 1941:{new YardStair( m_From, 1941, 1942, 1943, 1944, loc, m_Price ); break;}
    247.                         case 1945:{new YardStair( m_From, 1945, 1946, 1947, 1948, loc, m_Price ); break;}
    248.  
    249.                         case 1955:{new YardStair( m_From, 1955, 1955, 1955, 1955, loc, m_Price ); break;}
    250.                         case 1956:{new YardStair( m_From, 1956, 1957, 1958, 1959, loc, m_Price ); break;}
    251.                         case 1960:{new YardStair( m_From, 1960, 1961, 1962, 1963, loc, m_Price ); break;}
    252.                         case 1964:{new YardStair( m_From, 1964, 1965, 1966, 1967, loc, m_Price ); break;}
    253.                         case 1978:{new YardStair( m_From, 1978, 1978, 1978, 1978, loc, m_Price ); break;}
    254.                         case 1979:{new YardStair( m_From, 1979, 1980, 1979, 1980, loc, m_Price ); break;}
    255.                         case 1991:{new YardStair( m_From, 1991, 1992, 1991, 1992, loc, m_Price ); break;}
    256.                         case 1981:{new YardStair( m_From, 1981, 1982, 1981, 1982, loc, m_Price ); break;}
    257.                         case 1983:{new YardStair( m_From, 1983, 1984, 1985, 1986, loc, m_Price ); break;}
    258.                         case 1987:{new YardStair( m_From, 1987, 1988, 1989, 1990, loc, m_Price ); break;}
    259.                         case 1993:{new YardStair( m_From, 1993, 1994, 1995, 1996, loc, m_Price ); break;}
    260.                         case 1997:{new YardStair( m_From, 1997, 1998, 1999, 2000, loc, m_Price ); break;}
    261.                         case 1173:{new YardStair( m_From, 1173, 1179, 1180, 1181, loc, m_Price ); break;}
    262.                         case 1193:{new YardStair( m_From, 1193, 1194, 1205, 1206, loc, m_Price ); break;}
    263.                         case 1250:{new YardStair( m_From, 1250, 1276, 1317, 1327, loc, m_Price ); break;}
    264.                         case 1289:{new YardStair( m_From, 1289, 1290, 1291, 1292, loc, m_Price ); break;}
    265.                         case 1294:{new YardStair( m_From, 1294, 1295, 1297, 1299, loc, m_Price ); break;}
    266.                         case 1301:{new YardStair( m_From, 1301, 1374, 1397, 1401, loc, m_Price ); break;}
    267.                         case 1035:{new YardStair( m_From, 1035, 1036, 1037, 1038, loc, m_Price ); break;}
    268.                         case 1039:{new YardStair( m_From, 1039, 1040, 1041, 1042, loc, m_Price ); break;}
    269.                         case 1043:{new YardStair( m_From, 1043, 1044, 1045, 1046, loc, m_Price ); break;}
    270.                         case 1047:{new YardStair( m_From, 1047, 1048, 1049, 1051, loc, m_Price ); break;}
    271.                         case 1051:{new YardStair( m_From, 1051, 1052, 1053, 1054, loc, m_Price ); break;}
    272.                         case 12789:{new YardStair( m_From, 12789, 12793, 12794, 12795, loc, m_Price ); break;}
    273.  
    274.                         default:  {new YardItem( m_From, m_ItemID, loc, m_Price);break;}
    275.                     }
    276.                     GumpUp();
    277.                 }
    278.                 else
    279.                 {
    280.                     m_From.SendMessage( "You do not have enough gold in your bank box for that." );
    281.                     GumpUp();
    282.                 }
    283.             }
    284.         }
     
    #7 tass23, Apr 17, 2014
    Last edited: Apr 17, 2014
  8. Toriad
    Offline

    Toriad Shard Owner

    Joined:
    Mar 4, 2013
    Messages:
    86
    Likes Received:
    35
    Based on the code above that makes sense, it will only ever check the bank box. if the cost is > 2999, what if the cost is 300 coins? also the Item[] Gold thing that you have is never used.
     
  9. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    *sigh* NOW I get it! The code needs to see if there is ANY gold in the player's backpack first, then fall back to the bankbox if the backpack is empty. Let me see if I can fix this.

    EDIT:
    Yeah, it's hating the fact that I'm trying to use <, > for determining where to take the gold from. All because it's using Item[] Gold.
     
    #9 tass23, Apr 17, 2014
    Last edited: Apr 17, 2014
  10. Toriad
    Offline

    Toriad Shard Owner

    Joined:
    Mar 4, 2013
    Messages:
    86
    Likes Received:
    35
    Try this out.

    Code (C#):
    1.  
    2. public void EndPlace( Point3D loc )
    3. {  
    4.    
    5.       if( m_From.Backpack.ConsumeTotal( typeof( Gold ), m_Price ) || m_From.BankBox.ConsumeTotal( typeof( Gold ), m_Price ) )
    6.       {
    7.           switch (m_ItemID)
    8.           {
    9.               case 2084:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    10.               case 2085:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    11.               case 2086:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    12.               case 2087:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    13.               case 2088:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    14.               case 2090:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    15.               case 2124:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    16.               case 2125:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    17.               case 2126:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    18.               case 2127:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    19.               case 2128:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    20.               case 2130:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    21.               case 2105:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    22.               case 2106:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    23.               case 2107:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    24.               case 2108:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    25.               case 2109:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    26.               case 2111:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    27.               case 2150:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    28.               case 2151:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    29.               case 2152:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    30.               case 2153:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    31.               case 2154:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    32.               case 2156:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    33.  
    34.               case 5952:{new YardFountain( m_From, m_Price, TypeOfFountain.Stone, loc );break;}
    35.               case 6610:{new YardFountain( m_From, m_Price, TypeOfFountain.Sand, loc );break;}
    36.  
    37.               case 3395:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 1, loc );break;}
    38.               case 3401:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 4, 3, loc );break;}
    39.               case 3408:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    40.               case 3417:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 2, loc );break;}
    41.               case 3423:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    42.               case 3430:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    43.               case 3440:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 2, loc );break;}
    44.               case 3446:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    45.               case 3453:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 2, loc );break;}
    46.               case 3461:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 1, 1, loc );break;}
    47.               case 3465:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    48.               case 3470:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    49.               case 4793:{new YardTreeMulti( m_From, "Yew Tree", m_Price, m_ItemID, 3, 4, loc );break;}
    50.               case 7802:{new YardTreeMulti( m_From, "Yew Leaves", m_Price, m_ItemID, 4, 5, loc );break;}
    51.               case 3413:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 1, loc );break;}
    52.               case 3436:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, -2, -1, loc );break;}
    53.               case 3457:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 2, loc );break;}
    54.               case 3474:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 1, loc );break;}
    55.  
    56.               //Stairs
    57.               case 1006:{new YardStair( m_From, 1006, 1006, 1006, 1006, loc, m_Price ); break;}
    58.               case 1007:{new YardStair( m_From, 1007, 1008, 1009, 1010, loc, m_Price ); break;}
    59.               case 1011:{new YardStair( m_From, 1011, 1012, 1013, 1014, loc, m_Price ); break;}
    60.               case 1015:{new YardStair( m_From, 1015, 1016, 1017, 1018, loc, m_Price ); break;}
    61.               case 1019:{new YardStair( m_From, 1019, 1020, 1021, 1022, loc, m_Price ); break;}
    62.               case 1023:{new YardStair( m_From, 1023, 1024, 1025, 1026, loc, m_Price ); break;}
    63.               case 1801:{new YardStair( m_From, 1801, 1801, 1801, 1801, loc, m_Price ); break;}
    64.               case 1802:{new YardStair( m_From, 1802, 1803, 1804, 1805, loc, m_Price ); break;}
    65.               case 1806:{new YardStair( m_From, 1806, 1807, 1808, 1809, loc, m_Price ); break;}
    66.               case 1810:{new YardStair( m_From, 1810, 1811, 1812, 1813, loc, m_Price ); break;}
    67.               case 1814:{new YardStair( m_From, 1814, 1815, 1816, 1817, loc, m_Price ); break;}
    68.               case 1818:{new YardStair( m_From, 1818, 1819, 1820, 1821, loc, m_Price ); break;}
    69.               case 1822:{new YardStair( m_From, 1822, 1822, 1822, 1822, loc, m_Price ); break;}
    70.               case 1823:{new YardStair( m_From, 1823, 1846, 1847, 1865, loc, m_Price ); break;}
    71.               case 1866:{new YardStair( m_From, 1866, 1867, 1868, 1869, loc, m_Price ); break;}
    72.               case 1870:{new YardStair( m_From, 1870, 1871, 1922, 1923, loc, m_Price ); break;}
    73.               case 1952:{new YardStair( m_From, 1952, 1953, 1954, 2010, loc, m_Price ); break;}
    74.               case 2015:{new YardStair( m_From, 2015, 2016, 2100, 2166, loc, m_Price ); break;}
    75.               case 1825:{new YardStair( m_From, 1825, 1825, 1825, 1825, loc, m_Price ); break;}
    76.               case 1826:{new YardStair( m_From, 1826, 1827, 1828, 1829, loc, m_Price ); break;}
    77.               case 1830:{new YardStair( m_From, 1830, 1831, 1832, 1833, loc, m_Price ); break;}
    78.               case 1834:{new YardStair( m_From, 1834, 1835, 1836, 1837, loc, m_Price ); break;}
    79.               case 1838:{new YardStair( m_From, 1838, 1839, 1840, 1841, loc, m_Price ); break;}
    80.               case 1842:{new YardStair( m_From, 1842, 1843, 1844, 1845, loc, m_Price ); break;}
    81.  
    82.               case 1848:{new YardStair( m_From, 1848, 1848, 1848, 1848, loc, m_Price ); break;}
    83.               case 1849:{new YardStair( m_From, 1849, 1850, 1851, 1852, loc, m_Price ); break;}
    84.               case 1853:{new YardStair( m_From, 1853, 1854, 1855, 1856, loc, m_Price ); break;}
    85.               case 1861:{new YardStair( m_From, 1861, 1862, 1863, 1864, loc, m_Price ); break;}
    86.               case 1857:{new YardStair( m_From, 1857, 1858, 1859, 1860, loc, m_Price ); break;}
    87.               case 2170:{new YardStair( m_From, 2170, 2171, 2172, 2173, loc, m_Price ); break;}
    88.               case 1872:{new YardStair( m_From, 1872, 1872, 1872, 1872, loc, m_Price ); break;}
    89.               case 1873:{new YardStair( m_From, 1873, 1874, 1875, 1876, loc, m_Price ); break;}
    90.               case 1877:{new YardStair( m_From, 1877, 1878, 1879, 1880, loc, m_Price ); break;}
    91.               case 1881:{new YardStair( m_From, 1881, 1882, 1883, 1884, loc, m_Price ); break;}
    92.               case 1885:{new YardStair( m_From, 1885, 1886, 1887, 1888, loc, m_Price ); break;}
    93.               case 1889:{new YardStair( m_From, 1889, 1890, 1891, 1892, loc, m_Price ); break;}
    94.               case 1900:{new YardStair( m_From, 1900, 1900, 1900, 1900, loc, m_Price ); break;}
    95.               case 1901:{new YardStair( m_From, 1901, 1902, 1903, 1904, loc, m_Price ); break;}
    96.               case 1905:{new YardStair( m_From, 1905, 1906, 1907, 1908, loc, m_Price ); break;}
    97.               case 1909:{new YardStair( m_From, 1909, 1910, 1911, 1912, loc, m_Price ); break;}
    98.               case 1913:{new YardStair( m_From, 1913, 1914, 1915, 1916, loc, m_Price ); break;}
    99.               case 1917:{new YardStair( m_From, 1917, 1918, 1919, 1920, loc, m_Price ); break;}
    100.               case 1928:{new YardStair( m_From, 1928, 1928, 1928, 1928, loc, m_Price ); break;}
    101.               case 1929:{new YardStair( m_From, 1929, 1930, 1931, 1932, loc, m_Price ); break;}
    102.               case 1933:{new YardStair( m_From, 1933, 1934, 1935, 1936, loc, m_Price ); break;}
    103.               case 1937:{new YardStair( m_From, 1937, 1938, 1939, 1940, loc, m_Price ); break;}
    104.               case 1941:{new YardStair( m_From, 1941, 1942, 1943, 1944, loc, m_Price ); break;}
    105.               case 1945:{new YardStair( m_From, 1945, 1946, 1947, 1948, loc, m_Price ); break;}
    106.  
    107.               case 1955:{new YardStair( m_From, 1955, 1955, 1955, 1955, loc, m_Price ); break;}
    108.               case 1956:{new YardStair( m_From, 1956, 1957, 1958, 1959, loc, m_Price ); break;}
    109.               case 1960:{new YardStair( m_From, 1960, 1961, 1962, 1963, loc, m_Price ); break;}
    110.               case 1964:{new YardStair( m_From, 1964, 1965, 1966, 1967, loc, m_Price ); break;}
    111.               case 1978:{new YardStair( m_From, 1978, 1978, 1978, 1978, loc, m_Price ); break;}
    112.               case 1979:{new YardStair( m_From, 1979, 1980, 1979, 1980, loc, m_Price ); break;}
    113.               case 1991:{new YardStair( m_From, 1991, 1992, 1991, 1992, loc, m_Price ); break;}
    114.               case 1981:{new YardStair( m_From, 1981, 1982, 1981, 1982, loc, m_Price ); break;}
    115.               case 1983:{new YardStair( m_From, 1983, 1984, 1985, 1986, loc, m_Price ); break;}
    116.               case 1987:{new YardStair( m_From, 1987, 1988, 1989, 1990, loc, m_Price ); break;}
    117.               case 1993:{new YardStair( m_From, 1993, 1994, 1995, 1996, loc, m_Price ); break;}
    118.               case 1997:{new YardStair( m_From, 1997, 1998, 1999, 2000, loc, m_Price ); break;}
    119.               case 1173:{new YardStair( m_From, 1173, 1179, 1180, 1181, loc, m_Price ); break;}
    120.               case 1193:{new YardStair( m_From, 1193, 1194, 1205, 1206, loc, m_Price ); break;}
    121.               case 1250:{new YardStair( m_From, 1250, 1276, 1317, 1327, loc, m_Price ); break;}
    122.               case 1289:{new YardStair( m_From, 1289, 1290, 1291, 1292, loc, m_Price ); break;}
    123.               case 1294:{new YardStair( m_From, 1294, 1295, 1297, 1299, loc, m_Price ); break;}
    124.               case 1301:{new YardStair( m_From, 1301, 1374, 1397, 1401, loc, m_Price ); break;}
    125.               case 1035:{new YardStair( m_From, 1035, 1036, 1037, 1038, loc, m_Price ); break;}
    126.               case 1039:{new YardStair( m_From, 1039, 1040, 1041, 1042, loc, m_Price ); break;}
    127.               case 1043:{new YardStair( m_From, 1043, 1044, 1045, 1046, loc, m_Price ); break;}
    128.               case 1047:{new YardStair( m_From, 1047, 1048, 1049, 1051, loc, m_Price ); break;}
    129.               case 1051:{new YardStair( m_From, 1051, 1052, 1053, 1054, loc, m_Price ); break;}
    130.               case 12789:{new YardStair( m_From, 12789, 12793, 12794, 12795, loc, m_Price ); break;}
    131.  
    132.               default:  {new YardItem( m_From, m_ItemID, loc, m_Price);break;}
    133.           }
    134.           GumpUp();
    135.       }
    136.       else
    137.       {
    138.           m_From.SendMessage( "You do not have enough gold for that." );
    139.           GumpUp();
    140.       }
    141.    
    142. }
     
  11. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    Removing Item[] Gold helps so now the operators can be used, however, it's not taking the gold from the bank.
     
  12. Toriad
    Offline

    Toriad Shard Owner

    Joined:
    Mar 4, 2013
    Messages:
    86
    Likes Received:
    35
    Is it taking them from your backpack.
     
  13. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    Yes, just not from my bankbox.
    Perhaps the code should be setup to verify if the Price is <= the gold in the backpack and if not, take it from the bank instead. Let me try that.
     
  14. Toriad
    Offline

    Toriad Shard Owner

    Joined:
    Mar 4, 2013
    Messages:
    86
    Likes Received:
    35
    If you don't have enough gold in your backpack what happens?
     
  15. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    It still places the item, but doesn't remove the gold from the bank.
     
  16. Toriad
    Offline

    Toriad Shard Owner

    Joined:
    Mar 4, 2013
    Messages:
    86
    Likes Received:
    35
    So what exactly is in the function right now, cause what I just sent to you should be working.
     
  17. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    I'm thinking I need to get the Price first and see if the Price is greater than or less than the amount of gold in a player's backpack. Of course they also need to have enough gold in their bankbox. I'm thinking something like:
    if m_Price < m_From.Backpack( typeof( Gold )) then place the item(s) and subtract the gold from the player's backpack.
    else if m_Price > m_From.Backpack( typeof( Gold )) then m_From.BankBox.ConsumeTotal( typeof( Gold )) and place the item(s).
    else m_From.SendMessage ("You do not have enough gold in your backpack or bank.");
    I believe a setup like that would satisfy all the options.

    Here is the whole EndPlace function:
    Code (C#):
    1.  
    2.         public void EndPlace( Point3D loc )
    3.         {  
    4.             if( m_From.Backpack.ConsumeTotal( typeof( Gold ), m_Price ) || m_From.BankBox.ConsumeTotal( typeof( Gold ), m_Price ) )
    5.             {
    6.                 switch (m_ItemID)
    7.                 {
    8.                     case 2084:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    9.                     case 2085:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    10.                     case 2086:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    11.                     case 2087:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    12.                     case 2088:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    13.                     case 2090:{new YardIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    14.                     case 2124:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    15.                     case 2125:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    16.                     case 2126:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    17.                     case 2127:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    18.                     case 2128:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    19.                     case 2130:{new YardShortIronGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    20.                     case 2105:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    21.                     case 2106:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    22.                     case 2107:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    23.                     case 2108:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    24.                     case 2109:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    25.                     case 2111:{new YardLightWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    26.                     case 2150:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCCW, loc );break;}
    27.                     case 2151:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCCW, loc );break;}
    28.                     case 2152:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCW, loc );break;}
    29.                     case 2153:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.NorthCW, loc );break;}
    30.                     case 2154:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.WestCW, loc );break;}
    31.                     case 2156:{new YardDarkWoodGate(m_From, m_Price, Server.Items.DoorFacing.EastCCW, loc );break;}
    32.          
    33.                     case 5952:{new YardFountain( m_From, m_Price, TypeOfFountain.Stone, loc );break;}
    34.                     case 6610:{new YardFountain( m_From, m_Price, TypeOfFountain.Sand, loc );break;}
    35.          
    36.                     case 3395:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 1, loc );break;}
    37.                     case 3401:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 4, 3, loc );break;}
    38.                     case 3408:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    39.                     case 3417:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 2, loc );break;}
    40.                     case 3423:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    41.                     case 3430:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 3, loc );break;}
    42.                     case 3440:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 2, 2, loc );break;}
    43.                     case 3446:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    44.                     case 3453:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 3, 2, loc );break;}
    45.                     case 3461:{new YardTreeMulti( m_From, "Tree", m_Price, m_ItemID, 1, 1, loc );break;}
    46.                     case 3465:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    47.                     case 3470:{new YardTreeMulti( m_From, "Leaves", m_Price, m_ItemID, 2, 2, loc );break;}
    48.                     case 4793:{new YardTreeMulti( m_From, "Yew Tree", m_Price, m_ItemID, 3, 4, loc );break;}
    49.                     case 7802:{new YardTreeMulti( m_From, "Yew Leaves", m_Price, m_ItemID, 4, 5, loc );break;}
    50.                     case 3413:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 1, loc );break;}
    51.                     case 3436:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, -2, -1, loc );break;}
    52.                     case 3457:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 2, loc );break;}
    53.                     case 3474:{new YardTreeMulti( m_From, "Vines", m_Price, m_ItemID, 1, 1, loc );break;}
    54.          
    55.                     //Stairs
    56.                     case 1006:{new YardStair( m_From, 1006, 1006, 1006, 1006, loc, m_Price ); break;}
    57.                     case 1007:{new YardStair( m_From, 1007, 1008, 1009, 1010, loc, m_Price ); break;}
    58.                     case 1011:{new YardStair( m_From, 1011, 1012, 1013, 1014, loc, m_Price ); break;}
    59.                     case 1015:{new YardStair( m_From, 1015, 1016, 1017, 1018, loc, m_Price ); break;}
    60.                     case 1019:{new YardStair( m_From, 1019, 1020, 1021, 1022, loc, m_Price ); break;}
    61.                     case 1023:{new YardStair( m_From, 1023, 1024, 1025, 1026, loc, m_Price ); break;}
    62.                     case 1801:{new YardStair( m_From, 1801, 1801, 1801, 1801, loc, m_Price ); break;}
    63.                     case 1802:{new YardStair( m_From, 1802, 1803, 1804, 1805, loc, m_Price ); break;}
    64.                     case 1806:{new YardStair( m_From, 1806, 1807, 1808, 1809, loc, m_Price ); break;}
    65.                     case 1810:{new YardStair( m_From, 1810, 1811, 1812, 1813, loc, m_Price ); break;}
    66.                     case 1814:{new YardStair( m_From, 1814, 1815, 1816, 1817, loc, m_Price ); break;}
    67.                     case 1818:{new YardStair( m_From, 1818, 1819, 1820, 1821, loc, m_Price ); break;}
    68.                     case 1822:{new YardStair( m_From, 1822, 1822, 1822, 1822, loc, m_Price ); break;}
    69.                     case 1823:{new YardStair( m_From, 1823, 1846, 1847, 1865, loc, m_Price ); break;}
    70.                     case 1866:{new YardStair( m_From, 1866, 1867, 1868, 1869, loc, m_Price ); break;}
    71.                     case 1870:{new YardStair( m_From, 1870, 1871, 1922, 1923, loc, m_Price ); break;}
    72.                     case 1952:{new YardStair( m_From, 1952, 1953, 1954, 2010, loc, m_Price ); break;}
    73.                     case 2015:{new YardStair( m_From, 2015, 2016, 2100, 2166, loc, m_Price ); break;}
    74.                     case 1825:{new YardStair( m_From, 1825, 1825, 1825, 1825, loc, m_Price ); break;}
    75.                     case 1826:{new YardStair( m_From, 1826, 1827, 1828, 1829, loc, m_Price ); break;}
    76.                     case 1830:{new YardStair( m_From, 1830, 1831, 1832, 1833, loc, m_Price ); break;}
    77.                     case 1834:{new YardStair( m_From, 1834, 1835, 1836, 1837, loc, m_Price ); break;}
    78.                     case 1838:{new YardStair( m_From, 1838, 1839, 1840, 1841, loc, m_Price ); break;}
    79.                     case 1842:{new YardStair( m_From, 1842, 1843, 1844, 1845, loc, m_Price ); break;}
    80.          
    81.                     case 1848:{new YardStair( m_From, 1848, 1848, 1848, 1848, loc, m_Price ); break;}
    82.                     case 1849:{new YardStair( m_From, 1849, 1850, 1851, 1852, loc, m_Price ); break;}
    83.                     case 1853:{new YardStair( m_From, 1853, 1854, 1855, 1856, loc, m_Price ); break;}
    84.                     case 1861:{new YardStair( m_From, 1861, 1862, 1863, 1864, loc, m_Price ); break;}
    85.                     case 1857:{new YardStair( m_From, 1857, 1858, 1859, 1860, loc, m_Price ); break;}
    86.                     case 2170:{new YardStair( m_From, 2170, 2171, 2172, 2173, loc, m_Price ); break;}
    87.                     case 1872:{new YardStair( m_From, 1872, 1872, 1872, 1872, loc, m_Price ); break;}
    88.                     case 1873:{new YardStair( m_From, 1873, 1874, 1875, 1876, loc, m_Price ); break;}
    89.                     case 1877:{new YardStair( m_From, 1877, 1878, 1879, 1880, loc, m_Price ); break;}
    90.                     case 1881:{new YardStair( m_From, 1881, 1882, 1883, 1884, loc, m_Price ); break;}
    91.                     case 1885:{new YardStair( m_From, 1885, 1886, 1887, 1888, loc, m_Price ); break;}
    92.                     case 1889:{new YardStair( m_From, 1889, 1890, 1891, 1892, loc, m_Price ); break;}
    93.                     case 1900:{new YardStair( m_From, 1900, 1900, 1900, 1900, loc, m_Price ); break;}
    94.                     case 1901:{new YardStair( m_From, 1901, 1902, 1903, 1904, loc, m_Price ); break;}
    95.                     case 1905:{new YardStair( m_From, 1905, 1906, 1907, 1908, loc, m_Price ); break;}
    96.                     case 1909:{new YardStair( m_From, 1909, 1910, 1911, 1912, loc, m_Price ); break;}
    97.                     case 1913:{new YardStair( m_From, 1913, 1914, 1915, 1916, loc, m_Price ); break;}
    98.                     case 1917:{new YardStair( m_From, 1917, 1918, 1919, 1920, loc, m_Price ); break;}
    99.                     case 1928:{new YardStair( m_From, 1928, 1928, 1928, 1928, loc, m_Price ); break;}
    100.                     case 1929:{new YardStair( m_From, 1929, 1930, 1931, 1932, loc, m_Price ); break;}
    101.                     case 1933:{new YardStair( m_From, 1933, 1934, 1935, 1936, loc, m_Price ); break;}
    102.                     case 1937:{new YardStair( m_From, 1937, 1938, 1939, 1940, loc, m_Price ); break;}
    103.                     case 1941:{new YardStair( m_From, 1941, 1942, 1943, 1944, loc, m_Price ); break;}
    104.                     case 1945:{new YardStair( m_From, 1945, 1946, 1947, 1948, loc, m_Price ); break;}
    105.          
    106.                     case 1955:{new YardStair( m_From, 1955, 1955, 1955, 1955, loc, m_Price ); break;}
    107.                     case 1956:{new YardStair( m_From, 1956, 1957, 1958, 1959, loc, m_Price ); break;}
    108.                     case 1960:{new YardStair( m_From, 1960, 1961, 1962, 1963, loc, m_Price ); break;}
    109.                     case 1964:{new YardStair( m_From, 1964, 1965, 1966, 1967, loc, m_Price ); break;}
    110.                     case 1978:{new YardStair( m_From, 1978, 1978, 1978, 1978, loc, m_Price ); break;}
    111.                     case 1979:{new YardStair( m_From, 1979, 1980, 1979, 1980, loc, m_Price ); break;}
    112.                     case 1991:{new YardStair( m_From, 1991, 1992, 1991, 1992, loc, m_Price ); break;}
    113.                     case 1981:{new YardStair( m_From, 1981, 1982, 1981, 1982, loc, m_Price ); break;}
    114.                     case 1983:{new YardStair( m_From, 1983, 1984, 1985, 1986, loc, m_Price ); break;}
    115.                     case 1987:{new YardStair( m_From, 1987, 1988, 1989, 1990, loc, m_Price ); break;}
    116.                     case 1993:{new YardStair( m_From, 1993, 1994, 1995, 1996, loc, m_Price ); break;}
    117.                     case 1997:{new YardStair( m_From, 1997, 1998, 1999, 2000, loc, m_Price ); break;}
    118.                     case 1173:{new YardStair( m_From, 1173, 1179, 1180, 1181, loc, m_Price ); break;}
    119.                     case 1193:{new YardStair( m_From, 1193, 1194, 1205, 1206, loc, m_Price ); break;}
    120.                     case 1250:{new YardStair( m_From, 1250, 1276, 1317, 1327, loc, m_Price ); break;}
    121.                     case 1289:{new YardStair( m_From, 1289, 1290, 1291, 1292, loc, m_Price ); break;}
    122.                     case 1294:{new YardStair( m_From, 1294, 1295, 1297, 1299, loc, m_Price ); break;}
    123.                     case 1301:{new YardStair( m_From, 1301, 1374, 1397, 1401, loc, m_Price ); break;}
    124.                     case 1035:{new YardStair( m_From, 1035, 1036, 1037, 1038, loc, m_Price ); break;}
    125.                     case 1039:{new YardStair( m_From, 1039, 1040, 1041, 1042, loc, m_Price ); break;}
    126.                     case 1043:{new YardStair( m_From, 1043, 1044, 1045, 1046, loc, m_Price ); break;}
    127.                     case 1047:{new YardStair( m_From, 1047, 1048, 1049, 1051, loc, m_Price ); break;}
    128.                     case 1051:{new YardStair( m_From, 1051, 1052, 1053, 1054, loc, m_Price ); break;}
    129.                     case 12789:{new YardStair( m_From, 12789, 12793, 12794, 12795, loc, m_Price ); break;}
    130.          
    131.                     default:  {new YardItem( m_From, m_ItemID, loc, m_Price);break;}
    132.                 }
    133.                 GumpUp();
    134.             }
    135.             else
    136.             {
    137.                 m_From.SendMessage( "You do not have enough gold for that." );
    138.                 GumpUp();
    139.             }
    140.          
    141.         }
     
  18. Milva
    Offline

    Admin Moderator

    Joined:
    Mar 3, 2013
    Messages:
    3,637
    Likes Received:
    398
    tass have you thought of the idea of just removing the gold from their bank- I would think that most would want this over needing to have the gold in their pack? :) just a thought
     
  19. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    Yeah, that was my next step ;)