public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && !m_House.Deleted)
            {
                if (m_House.IsOwner(m_Mobile))
                {
                    if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
                    {
                        return;
                    }
                    else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null)
                    {
                        m_Mobile.SendMessage("Voce nao pode fazer isto com uma GuildStone dentro.");                           // You cannot redeed a house with a guildstone inside.
                        return;
                    }

                    /*else if ( m_House.PlayerVendors.Count > 0 )
                     * {
                     *      m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
                     *      return;
                     * }*/
                    else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendMessage("Voce nao pode fazer isto com vendedores na casa."); // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                        return;
                    }
                    else if (m_House.HasRentedVendors)
                    {
                        m_Mobile.SendMessage("Voce nao pode fazer isto com vendedores na casa."); // You cannot do that that while you still have contract vendors in your house.
                        return;
                    }
                    else if (m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendMessage("Voce nao pode fazer isto com vendedores na casa."); // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }


                    if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
                    {
                        //m_Mobile.SendMessage( "You do not get a refund for your house as you are not a player" );
                        m_House.RemoveKeys(m_Mobile);
                        m_House.Delete();
                    }
                    else
                    {
                        Item toGive = null;

                        if (m_House.IsAosRules)
                        {
                            if (m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                            else
                            {
                                toGive = m_House.GetDeed();
                            }
                        }
                        else
                        {
                            toGive = m_House.GetDeed();

                            if (toGive == null && m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                        }

                        if (toGive != null)
                        {
                            BankBox box = m_Mobile.BankBox;

                            if (box.TryDropItem(m_Mobile, toGive, false))
                            {
                                if (toGive is BankCheck)
                                {
                                    m_Mobile.SendMessage(string.Format("Voce recebeu {0} de gold pela transacao. O valor foi depositado em seu banco.", ((BankCheck)toGive).Worth.ToString()));                                         // ~1_AMOUNT~ gold has been deposited into your bank box.
                                }
                                m_House.RemoveKeys(m_Mobile);
                                m_House.Delete();
                            }
                            else
                            {
                                toGive.Delete();
                                m_Mobile.SendMessage("Seu banco está cheio!"); // Your bank box is full.
                            }
                        }
                        else
                        {
                            m_Mobile.SendMessage("Voce nao pode fazer isto ..");
                        }
                    }
                }
                else
                {
                    m_Mobile.SendMessage("Apenas o dono da casa pode fazer isto"); // Only the house owner may do this.
                }
            }
        }
예제 #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID != 1 || m_House.Deleted)
            {
                return;
            }

            if (m_House.IsOwner(m_Mobile))
            {
                if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
                {
                    return;
                }

                if (!Guild.NewGuildSystem && m_House.FindGuildstone() != null)
                {
                    m_Mobile.SendLocalizedMessage(501389);                     // You cannot redeed a house with a guildstone inside.
                    return;
                }

                /*
                 * if ( m_House.PlayerVendors.Count > 0 )
                 * {
                 *      m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
                 *      return;
                 * }
                 */
                if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
                {
                    m_Mobile.SendLocalizedMessage(1062679);
                    // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                    return;
                }

                if (m_House.HasRentedVendors)
                {
                    m_Mobile.SendLocalizedMessage(1062680);
                    // You cannot do that that while you still have contract vendors in your house.
                    return;
                }

                if (m_House.VendorInventories.Count > 0)
                {
                    m_Mobile.SendLocalizedMessage(1062681);
                    // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                    return;
                }

                if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
                {
                    m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
                    m_House.RemoveKeys(m_Mobile);
                    m_House.Delete();
                }
                else
                {
                    Item toGive = m_House.GetDeed();

                    if (toGive == null && m_House.Price > 0)
                    {
                        toGive = new BankCheck(m_House.Price);
                    }

                    if (toGive != null)
                    {
                        BankBox box = m_Mobile.FindBank(m_House.Expansion) ?? m_Mobile.BankBox;

                        if (box != null)
                        {
                            box.AddItem(toGive);

                            if (toGive is BankCheck)
                            {
                                m_Mobile.LocalOverheadMessage(
                                    MessageType.Regular,
                                    0x38,
                                    false,
                                    "A check for " + ((BankCheck)toGive).Worth + " gold has been placed in your bank.");
                            }
                            else                             // it's a deed
                            {
                                m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x38, false, "A deed has been placed in your bank.");
                            }
                        }
                        else if (m_Mobile.Backpack != null)
                        {
                            m_Mobile.Backpack.AddItem(toGive);
                            m_Mobile.SendMessage(
                                38,
                                "The house deed was placed IN YOUR BACKPACK because there was an error accessing your bank. Contact staff asap!");
                        }
                        else
                        {
                            LoggingCustom.Log("ERROR_HouseDemolish.txt", DateTime.Now + "\t" + m_Mobile + "\t" + m_House);
                        }
                        m_House.RemoveKeys(m_Mobile);
                        m_House.Delete();
                    }
                    else
                    {
                        m_Mobile.SendMessage("Unable to refund house.");
                    }
                }
            }
            else
            {
                m_Mobile.SendLocalizedMessage(501320);                 // Only the house owner may do this.
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && !m_House.Deleted)
            {
                if (m_House.IsOwner(m_Mobile))
                {
                    if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
                    {
                        return;
                    }
                    else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null)
                    {
                        m_Mobile.SendLocalizedMessage(501389);                           // You cannot redeed a house with a guildstone inside.
                        return;
                    }

                    /*else if ( m_House.PlayerVendors.Count > 0 )
                     * {
                     *      m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
                     *      return;
                     * }*/
                    else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062679);                           // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                        return;
                    }
                    else if (m_House.HasRentedVendors)
                    {
                        m_Mobile.SendLocalizedMessage(1062680);                           // You cannot do that that while you still have contract vendors in your house.
                        return;
                    }
                    else if (m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062681);                           // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }


                    if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
                    {
                        m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
                    }
                    else
                    {
                        Item toGive = null;

                        if (m_House.IsAosRules)
                        {
                            if (m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                            else
                            {
                                toGive = m_House.GetDeed();
                            }
                        }
                        else
                        {
                            toGive = m_House.GetDeed();

                            if (toGive == null && m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                        }

                        if (toGive != null)
                        {
                            BankBox box = m_Mobile.BankBox;

                            if (box.TryDropItem(m_Mobile, toGive, false))
                            {
                                if (toGive is BankCheck)
                                {
                                    m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString());                                         // ~1_AMOUNT~ gold has been deposited into your bank box.
                                }
                                m_House.RemoveKeys(m_Mobile);
                                m_House.Delete();
                            }
                            else
                            {
                                toGive.Delete();
                                m_Mobile.SendLocalizedMessage(500390);                                   // Your bank box is full.
                            }
                        }
                        else
                        {
                            m_Mobile.SendMessage("Unable to refund house.");
                        }
                    }
                }
                else
                {
                    m_Mobile.SendLocalizedMessage(501320);                       // Only the house owner may do this.
                }
            }
        }
예제 #4
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_House.Deleted)
            {
                return;
            }

            Mobile from = sender.Mobile;

            bool isOwner   = m_House.IsOwner(from);
            bool isCoOwner = isOwner || m_House.IsCoOwner(from);
            bool isFriend  = isCoOwner || m_House.IsFriend(from);

            if (!isFriend || !from.Alive)
            {
                return;
            }

            Item sign = m_House.Sign;

            if (sign == null || from.Map != sign.Map || !from.InRange(sign.GetWorldLocation(), 18))
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // Rename sign
            {
                from.Prompt = new RenamePrompt(m_House);
                from.SendLocalizedMessage(501302);                           // What dost thou wish the sign to say?

                break;
            }

            case 2:                     // List of co-owners
            {
                from.CloseGump <HouseGump>();;
                from.CloseGump <HouseListGump>();;
                from.CloseGump <HouseRemoveGump>();;
                from.SendGump(new HouseListGump(1011275, m_House.CoOwners, m_House, false));

                break;
            }

            case 3:                     // Add co-owner
            {
                if (isOwner)
                {
                    from.SendLocalizedMessage(501328);                               // Target the person you wish to name a co-owner of your household.
                    from.Target = new CoOwnerTarget(true, m_House);
                }
                else
                {
                    from.SendLocalizedMessage(501327);                               // Only the house owner may add Co-owners.
                }

                break;
            }

            case 4:                     // Remove co-owner
            {
                if (isOwner)
                {
                    from.CloseGump <HouseGump>();;
                    from.CloseGump <HouseListGump>();;
                    from.CloseGump <HouseRemoveGump>();;
                    from.SendGump(new HouseRemoveGump(1011274, m_House.CoOwners, m_House, false));
                }
                else
                {
                    from.SendLocalizedMessage(501329);                               // Only the house owner may remove co-owners.
                }

                break;
            }

            case 5:                     // Clear co-owners
            {
                if (isOwner)
                {
                    if (m_House.CoOwners != null)
                    {
                        m_House.CoOwners.Clear();
                    }

                    from.SendLocalizedMessage(501333);                               // All co-owners have been removed from this house.
                }
                else
                {
                    from.SendLocalizedMessage(501330);                               // Only the house owner may remove co-owners.
                }

                break;
            }

            case 6:                     // List friends
            {
                from.CloseGump <HouseGump>();;
                from.CloseGump <HouseListGump>();;
                from.CloseGump <HouseRemoveGump>();;
                from.SendGump(new HouseListGump(1011273, m_House.Friends, m_House, false));

                break;
            }

            case 7:                     // Add friend
            {
                if (isCoOwner)
                {
                    from.SendLocalizedMessage(501317);                               // Target the person you wish to name a friend of your household.
                    from.Target = new HouseFriendTarget(true, m_House);
                }
                else
                {
                    from.SendLocalizedMessage(501316);                               // Only the house owner may add friends.
                }

                break;
            }

            case 8:                     // Remove friend
            {
                if (isCoOwner)
                {
                    from.CloseGump <HouseGump>();;
                    from.CloseGump <HouseListGump>();;
                    from.CloseGump <HouseRemoveGump>();;
                    from.SendGump(new HouseRemoveGump(1011272, m_House.Friends, m_House, false));
                }
                else
                {
                    from.SendLocalizedMessage(501318);                               // Only the house owner may remove friends.
                }

                break;
            }

            case 9:                     // Clear friends
            {
                if (isCoOwner)
                {
                    if (m_House.Friends != null)
                    {
                        m_House.Friends.Clear();
                    }

                    from.SendLocalizedMessage(501332);                               // All friends have been removed from this house.
                }
                else
                {
                    from.SendLocalizedMessage(501319);                               // Only the house owner may remove friends.
                }

                break;
            }

            case 10:                               // Ban
            {
                from.SendLocalizedMessage(501325); // Target the individual to ban from this house.
                from.Target = new HouseBanTarget(true, m_House);

                break;
            }

            case 11:                               // Eject
            {
                from.SendLocalizedMessage(501326); // Target the individual to eject from this house.
                from.Target = new HouseKickTarget(m_House);

                break;
            }

            case 12:                     // List bans
            {
                from.CloseGump <HouseGump>();;
                from.CloseGump <HouseListGump>();;
                from.CloseGump <HouseRemoveGump>();;
                from.SendGump(new HouseListGump(1011271, m_House.Bans, m_House, true));

                break;
            }

            case 13:                     // Remove ban
            {
                from.CloseGump <HouseGump>();;
                from.CloseGump <HouseListGump>();;
                from.CloseGump <HouseRemoveGump>();;
                from.SendGump(new HouseRemoveGump(1011269, m_House.Bans, m_House, true));

                break;
            }

            case 14:                     // Transfer ownership
            {
                if (isOwner)
                {
                    from.SendLocalizedMessage(501309);                               // Target the person to whom you wish to give this house.
                    from.Target = new HouseOwnerTarget(m_House);
                }
                else
                {
                    from.SendLocalizedMessage(501310);                               // Only the house owner may do this.
                }

                break;
            }

            case 15:                     // Demolish house
            {
                if (isOwner)
                {
                    if (m_House.FindGuildstone() != null)
                    {
                        from.SendLocalizedMessage(501389);                                   // You cannot redeed a house with a guildstone inside.
                    }
                    else
                    {
                        Item toGive = m_House.GetDeed();

                        Container backpack = from.Backpack;


                        if (backpack.TryDropItem(from, toGive, false))
                        {
                            from.SendLocalizedMessage(501391);         // You place the deed in your backpack.

                            m_House.RemoveKeys(from);
                            m_House.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(501294);         // Redeeding the house has failed.
                            from.SendLocalizedMessage(501390);         // You do not have room in your backpack for a house deed.

                            toGive.Delete();
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501320);                               // Only the house owner may do this.
                }

                break;
            }

            case 16:                     // Change locks
            {
                if (m_House.Public)
                {
                    from.SendLocalizedMessage(501669);                              // Public houses are always unlocked.
                }
                else
                {
                    if (isOwner)
                    {
                        m_House.RemoveKeys(from);
                        m_House.ChangeLocks(from);

                        from.SendLocalizedMessage(501306);                                   // The locks on your front door have been changed, and new master keys have been placed in your bank and your backpack.
                    }
                    else
                    {
                        from.SendLocalizedMessage(501303);                                   // Only the house owner may change the house locks.
                    }
                }

                break;
            }

            case 17:                     // Declare public/private
            {
                if (isOwner)
                {
                    if (m_House.Public && m_House.PlayerVendors.Count > 0)
                    {
                        from.SendLocalizedMessage(501887);                                   // You have vendors working out of this building. It cannot be declared private until there are no vendors in place.
                        break;
                    }

                    m_House.Public = !m_House.Public;
                    if (!m_House.Public)
                    {
                        m_House.ChangeLocks(from);

                        from.SendLocalizedMessage(501888);                                   // This house is now private.
                        from.SendLocalizedMessage(501306);                                   // The locks on your front door have been changed, and new master keys have been placed in your bank and your backpack.
                    }
                    else
                    {
                        m_House.RemoveKeys(from);
                        m_House.RemoveLocks();
                        from.SendLocalizedMessage(501886);                                  //This house is now public. Friends of the house my now have vendors working out of this building.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501307);                               // Only the house owner may do this.
                }

                break;
            }

            case 18:                     // Change type
            {
                if (isOwner)
                {
                    if (m_House.Public && info.Switches.Length > 0)
                    {
                        int index = info.Switches[0] - 1;

                        if (index >= 0 && index < 53)
                        {
                            m_House.ChangeSignType(2980 + index * 2);
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501307);                               // Only the house owner may do this.
                }

                break;
            }
            }
        }
예제 #5
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_House.Deleted)
            {
                return;
            }

            Mobile from = state.Mobile;

            if (m_List != null && info.ButtonID == 1) // Remove now
            {
                if (m_House.IsOwner(from))
                {
                    if (m_House.InternalizedVendors.Count > 0)
                    {
                        return;
                    }
                    else if (m_House.FindGuildstone() != null)
                    {
                        from.SendLocalizedMessage(501389); // You cannot redeed a house with a guildstone inside.
                        return;
                    }
                    else if (m_House.PlayerVendors.Count > 0)
                    {
                        from.SendLocalizedMessage(503236); // You need to collect your vendor's belongings before moving.
                        return;
                    }
                    else if (m_House.VendorInventories.Count > 0)
                    {
                        from.SendLocalizedMessage(1062681); // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }

                    Item toGive = m_House.GetDeed();

                    if (toGive != null)
                    {
                        Container backpack = from.Backpack;

                        if (backpack == null)
                        {
                            from.SendLocalizedMessage(501393); // You do not seem to have a backpack.
                        }
                        else if (backpack.TryDropItem(from, toGive, false))
                        {
                            from.SendLocalizedMessage(501391); // You place the deed in your backpack.
                            m_House.RemoveKeys(from);
                            m_House.Delete();
                        }
                        else
                        {
                            from.SendLocalizedMessage(501390); // You do not have room in your backpack for a house deed.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(501294); // Redeeding the house has failed.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(501320); // Only the house owner may do this.
                }
            }

            int[] switches = info.Switches;

            if (switches.Length > 0)
            {
                for (int i = 0; i < switches.Length; ++i)
                {
                    int index = switches[i];

                    if (index >= 0 && index < m_Copy.Count)
                    {
                        m_List.Remove(m_Copy[index]);
                    }
                }

                if (m_List.Count > 0)
                {
                    from.CloseGump(typeof(HouseGump));
                    from.CloseGump(typeof(HouseListGump));
                    from.CloseGump(typeof(HouseRemoveGump));
                    from.SendGump(new HouseRemoveGump(m_Number, m_List, m_House, m_AccountOf));
                    return;
                }
            }

            from.SendGump(new HouseGump(from, m_House));
        }
예제 #6
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && !m_House.Deleted)
            {
                if (m_House.IsOwner(m_Mobile))
                {
                    if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1080455);                           // You can not resize your house at this time. Please remove all items fom the moving crate and try again.
                        return;
                    }

                    /*else if ( m_House.PlayerVendors.Count > 0 )
                     * {
                     *      m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
                     *      return;
                     * }*/
                    else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062679);                           // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                        return;
                    }
                    else if (m_House.HasRentedVendors)
                    {
                        m_Mobile.SendLocalizedMessage(1062680);                           // You cannot do that that while you still have contract vendors in your house.
                        return;
                    }
                    else if (m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062681);                           // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }

                    if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
                    {
                        m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
                        m_House.RemoveKeys(m_Mobile);
                        new TempNoHousingRegion(m_House, m_Mobile);
                        m_House.Delete();
                    }
                    else
                    {
                        Item toGive = null;

                        if (m_House.IsAosRules)
                        {
                            if (m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                            else
                            {
                                toGive = m_House.GetDeed();
                            }
                        }
                        else
                        {
                            toGive = m_House.GetDeed();

                            if (toGive == null && m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                        }

                        if (toGive != null)
                        {
                            BankBox box = m_Mobile.BankBox;

                            if (box.TryDropItem(m_Mobile, toGive, false))
                            {
                                if (toGive is BankCheck)
                                {
                                    m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString());                                         // ~1_AMOUNT~ gold has been deposited into your bank box.
                                }
                                m_House.RemoveKeys(m_Mobile);
                                new TempNoHousingRegion(m_House, m_Mobile);
                                m_House.Delete();
                            }
                            else
                            {
                                toGive.Delete();
                                m_Mobile.SendLocalizedMessage(500390);                                   // Your bank box is full.
                            }
                        }
                        else
                        {
                            m_Mobile.SendMessage("Unable to refund house.");
                        }
                    }
                }
                else
                {
                    m_Mobile.SendLocalizedMessage(501320);                       // Only the house owner may do this.
                }
            }
            else if (info.ButtonID == 0)
            {
                m_Mobile.CloseGump(typeof(ConfirmHouseResize));
                m_Mobile.SendGump(new HouseGumpAOS(HouseGumpPageAOS.Customize, m_Mobile, m_House));
            }
        }
예제 #7
0
        private static void OnCalculateAndWrite(Mobile cmdmob, int maxtoprint, bool bSupressNames, bool bSupressStaff, bool bIndicateBanned)
        {
            if (bInProcess == true)
            {
                System.Console.WriteLine("Got GoldTracker call when already processing.");
                return;
            }

            bInProcess = true;

            DateTime startDateTime = DateTime.Now;

            if (!Directory.Exists(OUTPUT_DIRECTORY))
            {
                Directory.CreateDirectory(OUTPUT_DIRECTORY);
            }

            try
            {
                string initmsg = string.Format("Tracking Gold...outputing top {0}", maxtoprint);
                System.Console.WriteLine(initmsg);
                SM(cmdmob, initmsg);

#if false
                using (StreamWriter op = new StreamWriter(OUTPUT_DIRECTORY + "/" + OUTPUT_FILE))
                {
                    op.WriteLine("<HTML><BODY>");
                    op.WriteLine("<TABLE BORDER=1 WIDTH=90%><TR>");
                    op.WriteLine("<TD>Account</TD><TD>Character</TD><TD>Total Worth</TD><TD>Backpack Gold</TD><TD>Bank Gold</TD><TD>House Gold</TD><TD>Number of Houses</TD><TD>Vendor Gold</TD>");
                    op.WriteLine("</TR>");

                    foreach (Account acct in Accounts.Table.Values)
                    {
                        string acctname = acct.Username;
                        //System.Console.WriteLine(acctname);

                        //iterate through characters:
                        for (int i = 0; i < 5; ++i)
                        {
                            if (acct[i] != null)
                            {
                                PlayerMobile player = (PlayerMobile)acct[i];

                                op.WriteLine("<TR><TD><B>" + acctname + "</B></TD>");
                                op.WriteLine("<TD>" + player.Name + "</TD>");

                                Container backpack     = player.Backpack;
                                BankBox   bank         = player.BankBox;
                                int       backpackgold = 0;
                                int       bankgold     = 0;

                                //BACKPACK
                                backpackgold = GetGoldInContainer(backpack);

                                //BANK
                                bankgold = GetGoldInContainer(bank);

                                //house?
                                int       housetotal = 0;
                                ArrayList list       = Multis.BaseHouse.GetHouses(player);
                                for (int j = 0; j < list.Count; ++j)
                                {
                                    if (list[j] is BaseHouse)
                                    {
                                        BaseHouse house = (BaseHouse)list[j];
                                        housetotal += GetGoldInHouse(house);
                                    }
                                }

                                //vendors
                                int       vendortotal = 0;
                                ArrayList vendors     = GetVendors(player);
                                for (int j = 0; j < vendors.Count; j++)
                                {
                                    if (vendors[j] is PlayerVendor)
                                    {
                                        PlayerVendor pv = vendors[j] as PlayerVendor;
                                        vendortotal += pv.HoldGold;
                                    }
                                }

                                op.WriteLine("<TD>" + (backpackgold + bankgold + housetotal + vendortotal) + "</TD>");

                                op.WriteLine("<TD>" + backpackgold + "</TD>");
                                op.WriteLine("<TD>" + bankgold + "</TD>");
                                op.WriteLine("<TD>" + housetotal + "</TD>");
                                op.WriteLine("<TD>" + list.Count + "</TD>");
                                op.WriteLine("<TD>" + vendortotal + " (" + vendors.Count + " vendors)" + "</TD>");

                                op.WriteLine("</TR>");
                            }
                        }
                    }

                    op.WriteLine("</BODY></HTML>");
                    op.Flush();
                    op.Close();
                }
#else
                Hashtable table = new Hashtable(Accounts.Table.Values.Count);

                System.Console.WriteLine("GT: building hashtable");
                SM(cmdmob, "GT: building hashtable");
                foreach (Account acct in Accounts.Table.Values)
                {
                    if (acct == null)
                    {
                        continue;
                    }

                    if ((bSupressStaff && acct.GetAccessLevel() > AccessLevel.Player) == false)
                    {
                        table.Add(acct, new GoldTotaller());
                    }
                }

                System.Console.WriteLine("GT: looping through accounts");
                SM(cmdmob, "GT: looping through accounts");
                foreach (Account acct in Accounts.Table.Values)
                {
                    if (acct == null)
                    {
                        continue;
                    }

                    if ((bSupressStaff && acct.GetAccessLevel() > AccessLevel.Player) == false)
                    {
                        //iterate through characters:
                        for (int i = 0; i < 5; ++i)
                        {
                            if (acct[i] != null)
                            {
                                PlayerMobile player       = (PlayerMobile)acct[i];
                                Container    backpack     = player.Backpack;
                                BankBox      bank         = player.BankBox;
                                int          backpackgold = 0;
                                int          bankgold     = 0;

                                int housedeedcount = 0;
                                int housedeedworth = 0;

                                int housesworth = 0;

                                //BACKPACK
                                backpackgold   = GetGoldInContainer(backpack);
                                housedeedworth = GetHouseDeedsInContainer(backpack, ref housedeedcount);

                                //BANK
                                bankgold        = GetGoldInContainer(bank);
                                housedeedworth += GetHouseDeedsInContainer(bank, ref housedeedcount);

                                //house?
                                int       housetotal = 0;
                                ArrayList list       = Multis.BaseHouse.GetHouses(player);
                                for (int j = 0; j < list.Count; ++j)
                                {
                                    if (list[j] is BaseHouse)
                                    {
                                        BaseHouse house = (BaseHouse)list[j];
                                        housesworth += (int)house.UpgradeCosts;
                                        HouseDeed hd = house.GetDeed();
                                        if (hd != null && hd is SiegeTentBag == false && hd is TentBag == false)
                                        {
                                            housesworth += RealEstateBroker.ComputePriceFor(hd);
                                            hd.Delete();
                                        }

                                        housetotal     += GetGoldInHouse(house);
                                        housedeedworth += GetHouseDeedWorthInHouse(house, ref housedeedcount);
                                    }
                                }

                                ((GoldTotaller)table[acct]).BackpackGold   += backpackgold;
                                ((GoldTotaller)table[acct]).BankGold       += bankgold;
                                ((GoldTotaller)table[acct]).HouseGold      += housetotal;
                                ((GoldTotaller)table[acct]).HouseCount     += list.Count;
                                ((GoldTotaller)table[acct]).CharacterCount += 1;
                                ((GoldTotaller)table[acct]).HouseDeedCount += housedeedcount;
                                ((GoldTotaller)table[acct]).HouseDeedWorth += housedeedworth;
                                ((GoldTotaller)table[acct]).HousesWorth    += housesworth;
                            }
                        }
                    }
                }

                System.Console.WriteLine("GT: Searching mobiles for PlayerVendors");
                SM(cmdmob, "GT: Searching mobiles for PlayerVendors");
                foreach (Mobile wm in World.Mobiles.Values)
                {
                    if (wm == null)
                    {
                        continue;
                    }

                    if (wm is PlayerVendor)
                    {
                        PlayerVendor pv = wm as PlayerVendor;
                        if (pv != null && pv.Owner != null)
                        {
                            Account thisacct = pv.Owner.Account as Account;
                            if (thisacct != null)
                            {
                                if ((bSupressStaff && thisacct.GetAccessLevel() > AccessLevel.Player) == false)
                                {
                                    ((GoldTotaller)table[thisacct]).VendorCount += 1;
                                    ((GoldTotaller)table[thisacct]).VendorGold  += pv.HoldGold;
                                }
                            }
                        }
                    }
                }

                System.Console.WriteLine("GT: sorting");
                SM(cmdmob, "GT: sorting");
                ArrayList keys = new ArrayList(table.Keys);
                keys.Sort(new GTComparer(table));

                System.Console.WriteLine("GT: Outputting html");
                SM(cmdmob, "GT: Outputting html");

                using (StreamWriter op = new StreamWriter(OUTPUT_DIRECTORY + "/" + OUTPUT_FILE))
                {
                    op.WriteLine("<HTML><BODY>");
                    op.WriteLine("<TABLE BORDER=1 WIDTH=90%><TR>");
                    if (bSupressNames)
                    {
                        op.WriteLine("<TD>=(char count)</TD>");
                    }
                    else
                    {
                        op.WriteLine("<TD>Account (char count)</TD>");
                    }
                    op.WriteLine("<TD>Total Worth</TD>");
                    op.WriteLine("<TD>Backpack Gold</TD>");
                    op.WriteLine("<TD>Bank Gold</TD>");
                    op.WriteLine("<TD>House Gold (house count)</TD>");
                    op.WriteLine("<TD>Vendor Gold (vendor count)</TD>");
                    op.WriteLine("<TD>Returnable Deed Worth (deed count)<br>(Included house and storage upgrade deeds</TD>");
                    op.WriteLine("<TD>House(s) Worth</TD>");
                    op.WriteLine("</TR>");

                    for (int i = 0; i < keys.Count && i < maxtoprint; i++)
                    {
                        GoldTotaller gt = table[keys[i]] as GoldTotaller;
                        if (gt != null)
                        {
                            string bannedstr = "";
                            if (bIndicateBanned)
                            {
                                if (((Account)keys[i]).Banned)
                                {
                                    bannedstr = " **banned** ";
                                }
                            }
                            //System.Console.WriteLine( "Acct: {0}, total: {1}", ((Account)keys[i]).Username, gt.TotalGold );
                            if (bSupressNames)
                            {
                                op.WriteLine("<TR><TD>(" + gt.CharacterCount + ")" + bannedstr + "</TD>");                                 //Account
                            }
                            else
                            {
                                op.WriteLine("<TR><TD><B>" + ((Account)keys[i]).Username + "</B>(" + gt.CharacterCount + ")" + bannedstr + "</TD>"); //Account
                            }
                            op.WriteLine("<TD>" + gt.TotalGold + "</TD>");                                                                           //Total Worth
                            op.WriteLine("<TD>" + gt.BackpackGold + "</TD>");                                                                        //Backpack
                            op.WriteLine("<TD>" + gt.BankGold + "</TD>");                                                                            //bank
                            op.WriteLine("<TD>" + gt.HouseGold + " (" + gt.HouseCount + ")</TD>");                                                   //houses
                            op.WriteLine("<TD>" + gt.VendorGold + " (" + gt.VendorCount + ")</TD>");                                                 //vendors
                            op.WriteLine("<TD>" + gt.HouseDeedWorth + " (" + gt.HouseDeedCount + ")</TD>");                                          //housedeeds
                            op.WriteLine("<TD>" + gt.HousesWorth + "</TD>");                                                                         //housedeeds

                            op.WriteLine("</TR>");
                        }
                    }

                    op.WriteLine("</TABLE></BODY></HTML>");
                    op.Flush();
                    op.Close();
                }
#endif
            }
            catch (Exception e)
            {
                LogHelper.LogException(e);
                System.Console.WriteLine("Error in GoldTracker: " + e.Message);
                System.Console.WriteLine(e.StackTrace);
            }
            finally
            {
                DateTime endDateTime = DateTime.Now;
                TimeSpan time        = endDateTime - startDateTime;
                string   endmsg      = "finished in " + ((double)time.TotalMilliseconds / (double)1000) + " seconds.";
                System.Console.WriteLine(endmsg);
                SM(cmdmob, endmsg);
                bInProcess = false;
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && !m_House.Deleted)
            {
                if (m_House.IsOwner(m_Mobile))
                {
                    if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
                    {
                        return;
                    }
                    else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null)
                    {
                        m_Mobile.SendLocalizedMessage(501389);                           // You cannot redeed a house with a guildstone inside.
                        return;
                    }

                    /*else if ( m_House.PlayerVendors.Count > 0 )
                     * {
                     *      m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
                     *      return;
                     * }*/
                    else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062679);                           // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                        return;
                    }
                    else if (m_House.HasRentedVendors)
                    {
                        m_Mobile.SendLocalizedMessage(1062680);                           // You cannot do that that while you still have contract vendors in your house.
                        return;
                    }
                    else if (m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062681);                           // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }

                    Item toGive = null;

                    if (m_House.IsAosRules)
                    {
                        if (m_House.Price > 0)
                        {
                            toGive = new BankCheck(m_House.Price);
                        }
                        else
                        {
                            toGive = m_House.GetDeed();
                        }
                    }
                    else
                    {
                        toGive = m_House.GetDeed();

                        if (toGive == null && m_House.Price > 0)
                        {
                            toGive = new BankCheck(m_House.Price);
                        }
                    }

                    if (toGive != null)
                    {
                        Container bp = m_Mobile.Backpack;

                        if (bp == null || !bp.TryDropItem(m_Mobile, toGive, true))
                        {
                            toGive.MoveToWorld(m_Mobile.Location, m_Mobile.Map);
                        }

                        m_House.RemoveKeys(m_Mobile);
                        m_House.Delete();
                    }
                    else
                    {
                        m_Mobile.SendMessage("Unable to refund house.");
                    }
                }
                else
                {
                    m_Mobile.SendLocalizedMessage(501320);                       // Only the house owner may do this.
                }
            }
        }
예제 #9
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && !m_House.Deleted)
            {
                if (m_House.IsOwner(m_Mobile))
                {
                    if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
                    {
                        return;
                    }
                    else if (!Guilds.Guild.NewGuildSystem && m_House.FindGuildstone() != null)
                    {
                        m_Mobile.SendLocalizedMessage(501389);                           // You cannot redeed a house with a guildstone inside.
                        return;
                    }

                    /*else if ( m_House.PlayerVendors.Count > 0 )
                     * {
                     *      m_Mobile.SendLocalizedMessage( 503236 ); // You need to collect your vendor's belongings before moving.
                     *      return;
                     * }*/
                    else if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062679);                           // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                        return;
                    }
                    else if (m_House.HasRentedVendors)
                    {
                        m_Mobile.SendLocalizedMessage(1062680);                           // You cannot do that that while you still have contract vendors in your house.
                        return;
                    }
                    else if (m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062681);                           // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }

                    if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
                    {
                        m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
                        m_House.RemoveKeys(m_Mobile);
                        m_House.Delete();
                    }
                    else
                    {
                        Item      toGive = null;
                        BankCheck check  = null;
                        BankBox   box    = m_Mobile.BankBox;

                        if (m_House.IsAosRules)
                        {
                            if (m_House.Price > 0)
                            {
                                check = new BankCheck(m_House.Price);
                            }

                            toGive = m_House.GetDeed();
                        }
                        else
                        {
                            toGive = m_House.GetDeed();

                            if (toGive == null && m_House.Price > 0)
                            {
                                check = new BankCheck(m_House.Price);
                            }
                        }

                        if (check != null)
                        {
                            if (box.TryDropItem(m_Mobile, check, false))
                            {
                                m_Mobile.SendLocalizedMessage(1060397, check.Worth.ToString());                                   // ~1_AMOUNT~ gold has been deposited into your bank box.
                            }
                            else
                            {
                                check.Delete();
                                if (toGive != null)
                                {
                                    toGive.Delete();
                                }
                                m_Mobile.SendLocalizedMessage(500390);                                   // Your bank box is full.
                                return;
                            }
                        }

                        if (toGive != null)
                        {
                            if (box.TryDropItem(m_Mobile, toGive, false))
                            {
/*								if ( pm.HasDonated )
 *                                                              {
 *                                                                      m_House.KillVendors( true );
 *                                                                      HouseDecayingCrate crate = m_House.MoveAllDecayingToCrate();
 *                                                                      if ( crate.Items.Count == 0 )
 *                                                                              crate.Delete();
 *                                                                      else
 *                                                                              m_Mobile.BankBox.DropItem( crate );
 *                                                              } */

                                m_Mobile.CloseGump(typeof(ConfirmCommitGump));

                                m_House.RemoveKeys(m_Mobile);
                                m_House.Delete();
                            }
                            else
                            {
                                if (check != null)
                                {
                                    check.Delete();
                                }
                                toGive.Delete();
                                m_Mobile.SendLocalizedMessage(500390);                                   // Your bank box is full.
                                return;
                            }
                        }
                        else if (TestCenter.Enabled)
                        {
                            m_Mobile.SendMessage("This house cannot be refunded during beta.  Please contact a Gamemaster for replacement options.");
                        }
                        else
                        {
                            m_Mobile.SendMessage("Your house cannot be refunded.");
                        }
                    }
                }
                else
                {
                    m_Mobile.SendLocalizedMessage(501320);                       // Only the house owner may do this.
                }
            }
        }
예제 #10
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && !m_House.Deleted)
            {
                if (m_House.IsOwner(m_Mobile))
                {
                    if (m_House.MovingCrate != null || m_House.InternalizedVendors.Count > 0)
                    {
                        return;
                    }

                    if (m_House.HasRentedVendors && m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062679);
                        // You cannot do that that while you still have contract vendors or unclaimed contract vendor inventory in your house.
                        return;
                    }

                    if (m_House.HasRentedVendors)
                    {
                        m_Mobile.SendLocalizedMessage(1062680);
                        // You cannot do that that while you still have contract vendors in your house.
                        return;
                    }

                    if (m_House.VendorInventories.Count > 0)
                    {
                        m_Mobile.SendLocalizedMessage(1062681);
                        // You cannot do that that while you still have unclaimed contract vendor inventory in your house.
                        return;
                    }

                    else if (m_House.HasActiveAuction)
                    {
                        m_Mobile.SendLocalizedMessage(1156453);
                        // You cannot currently take this action because you have auction safes locked down in your home. You must remove them first.
                        return;
                    }

                    if (m_Mobile.AccessLevel >= AccessLevel.GameMaster)
                    {
                        m_Mobile.SendMessage("You do not get a refund for your house as you are not a player");
                        m_House.RemoveKeys(m_Mobile);
                        m_House.Delete();
                    }
                    else
                    {
                        Item toGive;

                        if (m_House.IsAosRules)
                        {
                            if (m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                            else
                            {
                                toGive = m_House.GetDeed();
                            }
                        }
                        else
                        {
                            toGive = m_House.GetDeed();

                            if (toGive == null && m_House.Price > 0)
                            {
                                toGive = new BankCheck(m_House.Price);
                            }
                        }

                        if (AccountGold.Enabled && toGive is BankCheck)
                        {
                            int worth = ((BankCheck)toGive).Worth;

                            if (m_Mobile.Account != null && m_Mobile.Account.DepositGold(worth))
                            {
                                toGive.Delete();

                                m_Mobile.SendLocalizedMessage(1060397, worth.ToString("#,0"));
                                // ~1_AMOUNT~ gold has been deposited into your bank box.

                                m_House.RemoveKeys(m_Mobile);
                                m_House.Delete();
                                return;
                            }
                        }

                        if (toGive != null)
                        {
                            BankBox box = m_Mobile.BankBox;

                            if (box.TryDropItem(m_Mobile, toGive, false))
                            {
                                if (toGive is BankCheck)
                                {
                                    m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString("#,0"));
                                    // ~1_AMOUNT~ gold has been deposited into your bank box.
                                }

                                m_House.RemoveKeys(m_Mobile);
                                m_House.Delete();
                            }
                            else
                            {
                                toGive.Delete();
                                m_Mobile.SendLocalizedMessage(500390); // Your bank box is full.
                            }
                        }
                        else
                        {
                            m_Mobile.SendMessage("Unable to refund house.");
                        }
                    }
                }
                else
                {
                    m_Mobile.SendLocalizedMessage(501320); // Only the house owner may do this.
                }
            }
        }
예제 #11
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 1 && !m_House.Deleted)
            {
                if (m_House.IsOwner(m_Mobile))
                {
                    if (m_House.FindGuildstone() != null)
                    {
                        m_Mobile.SendLocalizedMessage(501389);                           // You cannot redeed a house with a guildstone inside.
                        return;
                    }
//Pix: 7/13/2008 - Removing the requirement of a townshipstone to be in a house.
//					else if (m_House.FindTownshipStone() != null)
//					{
//						m_Mobile.SendMessage("You can't demolish a house which holds a Township stone.");
//						return;
//					}
                    //It was decided that we should just auto-dismiss the township NPC if the house is demolished
                    //else if (m_House.FindTownshipNPC() != null)
                    //{
                    //	m_Mobile.SendMessage("You need to dismiss your Township NPC before moving.");
                    //	return;
                    //}
                    else if (m_House.FindPlayerVendor() != null)
                    {
                        m_Mobile.SendLocalizedMessage(503236);                         // You need to collect your vendor's belongings before moving.
                        return;
                    }
                    else if (m_House.FindPlayer() != null)
                    {
                        m_Mobile.SendMessage("It is not safe to demolish this house with someone still inside.");                         // You need to collect your vendor's belongings before moving.
                        //Tell staff that an exploit is in progress
                        //Server.Scripts.Commands.CommandHandlers.BroadcastMessage( AccessLevel.Counselor,
                        //0x482,
                        //String.Format( "Exploit in progress at {0}. Stay hidden, Jail involved players, get acct name, ban.", m_House.Location.ToString() ) );
                        return;
                    }

                    Item toGive = null;
                    Item Refund = null;     // for various home upgrades

                    if (m_House.IsAosRules)
                    {
                        if (m_House.Price > 0)
                        {
                            toGive = new BankCheck(m_House.Price);
                        }
                        else
                        {
                            toGive = m_House.GetDeed();
                        }
                    }
                    else
                    {
                        toGive = m_House.GetDeed();

                        if (toGive == null && m_House.Price > 0)
                        {
                            toGive = new BankCheck(m_House.Price);
                        }

                        if (m_House.UpgradeCosts > 0)
                        {
                            Refund = new BankCheck((int)m_House.UpgradeCosts);
                        }
                    }

                    if (toGive != null)
                    {
                        BankBox box = m_Mobile.BankBox;

                        // Adam: TryDropItem() fails if trhe bank is full, and this isn't the time to be
                        //  failing .. just overload their bank.
                        if (box != null /*&& box.TryDropItem( m_Mobile, toGive, false )*/)
                        {
                            box.AddItem(toGive);
                            if (toGive is BankCheck)
                            {
                                m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)toGive).Worth.ToString());                                   // ~1_AMOUNT~ gold has been deposited into your bank box.
                            }
                            if (Refund != null)
                            {
                                box.AddItem(Refund);
                                if (Refund is BankCheck)
                                {
                                    m_Mobile.SendLocalizedMessage(1060397, ((BankCheck)Refund).Worth.ToString()); // ~1_AMOUNT~ gold has been deposited into your bank box.
                                }
                            }

                            m_House.RemoveKeys(m_Mobile);
                            m_House.Delete();
                        }
                        else
                        {
                            toGive.Delete();
                            m_Mobile.SendLocalizedMessage(500390);                               // Your bank box is full.
                        }
                    }
                    else
                    {
                        m_Mobile.SendMessage("Unable to refund house.");
                    }
                }
                else
                {
                    m_Mobile.SendLocalizedMessage(501320);                       // Only the house owner may do this.
                }
            }
        }