UOGamers Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • To obtain new Razor updates, please reinstall Razor from our new website.

[SVN] Changes to BOD Books

Status
Not open for further replies.
Re: BOB-Drop has somepitfalls

Really good job :)

Due to psz's speech, I move this in the section "Not as OSI but better". Mark's decision to implement in RunUO, or who has access in Demise to implement it in the shard.
 

psz

Administrator
[CODER NEEDED] BOD Book (other book) Page "memory"

Behavior on Demise: BOD Books (and others?) always revert to page 1
Behavior on OSI: Needs Verification
Supporting Documentation (URLs):
Changes needed:
Needs Verification
Code (optional):

uome;547180 said:
Can i ask about bod book gumps going back to page one when you drop a bod from them. I'm not sure if it's like this on osi because i have no acc to test it so i can't be sure it's a bug, but is a pain in the rear.
I noticed all gumps go back to page one after an action like when tinkering tongs for example which are on page two, ocasionally i have made scorps by mistake. So it could be an issue with all gumps not just bod books?
osd_daedalus;547211 said:
More than a bug, it's like the BOD/gump to be closed and reopened again, and they lose memory. That's why they always restart from first page.

A nice feature to add, I think. But let me (er... "us") resolve that fix about max weight to act on scripts and not on the core. Then I will have a look/search/ask about next things :)

Or you could help and post something in Script Support section of RunUO forums something about the BOD/gump question, like I did for stairs.
gilgamash;554818 said:
Here a first try for the BOD-BOOK drop action to NOT return to page zero
after dropping a bod.

Into BOBGumps.cs

insert this function into the class:

Code:
        public int GetPageForIndex(int index)
        {
            int count = 0;

            if (index <= 0)
                return 0;

            ArrayList list = m_List;

            for (int i = 0; i < index && i < list.Count; i++)
            {
                object obj = list[i];
                if (CheckFilter(obj))
                {
                    if (obj is BOBLargeEntry)
                        count += ((BOBLargeEntry)obj).Entries.Length;
                    else
                        count++;
                }
            }
            return (int)((count / 10) - Convert.ToInt32((count % 10) == 0));
        }

and add this lines to change the drop part (line 274 ff) to be

Code:
					if ( type == 0 ) // Drop
					{
						if ( m_Book.IsChildOf( m_From.Backpack ) )
						{
							Item item = Reconstruct( obj );

							if ( item != null )
							{
								m_From.AddToBackpack( item );
								m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack.

								m_Book.Entries.Remove( obj );
								m_Book.InvalidateProperties();

                                if (m_Book.Entries.Count > 0)
                                {
                                    m_Page = GetPageForIndex(index);
                                    m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
                                }
                                else
                                    m_From.SendLocalizedMessage(1062381); // The book is empty.
							}
							else
							{
								m_From.SendMessage( "Internal error. The bulk order deed could not be reconstructed." );
							}
						}
					}

Have just done some minor testing but seems to work so far.

G.
 

Athena

Account Terminated
Re: [VALIDATION NEEDED] BOD Book (other book) Page "memory"

I have tested this on OSI and I can reveal the following:

The BOD book page gumps do stay on the page you are currently on when you drop a BOD from that page. For example, click next until you get to the third page in the book, drop a BOD from that page and you will remain on page 3. On Demise the page will go back to page 1 no matter what page you drop the BOD from.

All of the tool gumps that go onto the 2nd page will revert back to the first page after crafting something, so this is the same as it is on Demise.

The code above needs to be provided in a patch file or drop-in script for ease of testing.
 

uome

Bug Hunter
Re: [CODER NEEDED] BOD Book (other book) Page "memory"

Gilgamash was working on this a while back and there were several versions worked through here.
http://www.uodemise.com/forum/showthread.php?t=115354

I never tested the final version supplied because we wern't sure how osi lik it was.
Might be a good idea to merge these two threads because most of the wrok has allready been done.
 

gilgamash

Knight
Re: [TESTING] BOB-Drop has somepitfalls

Hoi all,

please notice that I had to correct some errors of the first version.

The working one with correct page flipping and all is the textfile attached to the last post on the 2nd page (where I mention that I don't want to do any OSI+ thingy).

I'm glad this might get in an update, as it would help me and other a lot in game and save a lot of nasty page-flipping time :)

The Book still flips back to page one when a bod is inserted. Please let me know how this behaves on OSI, so I might fix that, too, if neccessary.

Atb.,
G.
 

gilgamash

Knight
Re: [TESTING] BOB-Drop has somepitfalls

I'll deliver mentioned in my prev. thread in a 'diff' version within the next hour.

G.
 

gilgamash

Knight
Re: [TESTING] BOB-Drop has somepitfalls

here's the unified diff

Code:
Index: ./Scripts/Engines/BulkOrders/Books/BOBGump.cs
===================================================================
--- ./Scripts/Engines/BulkOrders/Books/BOBGump.cs	(revision 343)
+++ ./Scripts/Engines/BulkOrders/Books/BOBGump.cs	(working copy)
@@ -107,7 +107,63 @@
 			return index;
 		}
 
-		public int GetCountForIndex( int index )
+        public int GetPageForIndex(int index, int sizeDropped)
+        {
+            int count = 0;
+
+            if (index <= 0)
+                return 0;
+
+            // index++;
+            int add = 0;
+            int page = 0;
+            
+            ArrayList list = m_List;
+            int i; object obj;
+
+            for (i = 0; i < index && i < list.Count; i++)
+            {
+                obj = list[i];
+                if (CheckFilter(obj))
+                {
+                    if (obj is BOBLargeEntry)
+                        add = ((BOBLargeEntry)obj).Entries.Length;
+                    else
+                        add = 1;
+                    count += add;
+                    if (count > 10)
+                    {
+                        page++;
+                        count = add;
+                    }
+                }
+            }
+            // now we are on the page of the bod preceeding the dropped one. let's
+            // let's see if we have to remain on this.
+            
+            i++;          // move the bod-counter to the sccuessor bod of the dropped one
+            // this increment seems necessary as the bod is not yet removed from m_List
+
+            if (count + sizeDropped > 10) {
+                while (i < list.Count && count <= 10)
+                {
+                    obj = list[i];
+                    if (CheckFilter(obj))
+                    {
+                        if (obj is BOBLargeEntry)
+                            count += ((BOBLargeEntry)obj).Entries.Length;
+                        else
+                            count += 1;
+                    }
+                    i++;
+                }
+                if (count > 10)
+                    page++;
+            }    
+            return page;
+        }
+
+        public int GetCountForIndex(int index)
 		{
 			int slots = 0;
 			int count = 0;
@@ -256,16 +312,26 @@
 
 							if ( item != null )
 							{
-								m_From.AddToBackpack( item );
-								m_From.SendLocalizedMessage( 1045152 ); // The bulk order deed has been placed in your backpack.
+                                int sizeOfDroppedBod;
+                                if (obj is BOBLargeEntry)
+                                    sizeOfDroppedBod = ((BOBLargeEntry)obj).Entries.Length;
+                                else
+                                    sizeOfDroppedBod = 1;
 
-								m_Book.Entries.Remove( obj );
-								m_Book.InvalidateProperties();
+                                m_From.AddToBackpack(item);
+                                m_From.SendLocalizedMessage(1045152); // The bulk order deed has been placed in your backpack.
+                                m_Book.Entries.Remove(obj);
+                                m_Book.InvalidateProperties();
 
-								if ( m_Book.Entries.Count > 0 )
-									m_From.SendGump( new BOBGump( m_From, m_Book, 0, null ) );
-								else
-									m_From.SendLocalizedMessage( 1062381 ); // The book is empty.
+                                if (m_Book.Entries.Count > 0)
+                                {
+                                    m_Page = GetPageForIndex(index, sizeOfDroppedBod);
+                                    m_From.SendGump(new BOBGump(m_From, m_Book, m_Page, null));
+                                }
+                                else
+                                    m_From.SendLocalizedMessage(1062381); // The book is empty.
+
+
 							}
 							else
 							{
 

Athena

Account Terminated
Re: [TESTING] BOB-Drop has somepitfalls

gilgamash;588536 said:
The Book still flips back to page one when a bod is inserted. Please let me know how this behaves on OSI

I can confirm that this is how it is on OSI.
 

uome

Bug Hunter
Re: [TESTING] BOB-Drop has somepitfalls

I havn't managed to break this one yet.

One question, atm it goes back to page one when buying a bod from a vendor. How should it be?
 

gilgamash

Knight
Re: [TESTING] BOB-Drop has somepitfalls

Yep, this would be my next aim if I knew how it worked on OSI :)

Would not take much effort to modify that, so let us know!

Thanks,
G.
 

Athena

Account Terminated
Re: [TESTING] BOB-Drop has somepitfalls

I can confirm that on OSI when buying from a BOD book on a vendor it does NOT revert back to page 1. It will stay on the page that you browsed too.
 

gilgamash

Knight
Re: [IN DEVELOPMENT] BOB-Drop has somepitfalls

Thank a lot for the test, Athena! I'll care about this point this evening.
As the routine used will be the same, the testing afterwards should be finished soon :)

G.
 

gilgamash

Knight
Re: [IN DEVELOPMENT] BOB-Drop has somepitfalls

I need another OSI test:

when buying or dropping a BOD with backpack full, is the bod lost (and in the buying case, the money also)?

Thanks for help,
G.
 

Athena

Account Terminated
Re: [IN DEVELOPMENT] BOB-Drop has somepitfalls

If you try to drop a BOD out of a book and your backpack is full it will not drop it from the book and give you a localized message "There is not enough room in your backpack for the deed."

You cannot buy anything from a vendor if your backpack is full, this includes BODs it will give you a localized message "There is not enough room in your backpack for the Deed" and it does not take the gold.

When trying to collect a BOD when your backpack is full you get a localized message "Your backpack is too full to receive a bulk order". I removed one thing from my backpack and tried again, I could get the BOD fine at that point. I did not lose it.
 

Athena

Account Terminated
Re: [IN DEVELOPMENT] BOB-Drop has somepitfalls

I'd like to add that there is a sound when you drop a BOD into a bulk order book on OSI, the SoundID is 0x42.
 

gilgamash

Knight
Re: [IN DEVELOPMENT] BOB-Drop has somepitfalls

Thanks again for the tests. In the current implementation it looks like the bod is lost when buying it with full backpack (it is definetly removed from the book-entries) if there is no room left in the backspace. The same happens, when your backpack is full and you ask for a bod order (smith or tailor) - the timer is not resetted.

@sound: I'll care about that.

G.
 

gilgamash

Knight
Re: [IN DEVELOPMENT] BOB-Drop has somepitfalls

Hoi,

is there a way to test whether there is space (and weight) left to insert an item in a backpack without actually adding it (thus not using AddToBackPack(...))? The problem is, that in the current implementation, the money is drawn from the buyer (when a bod is bought) even when there is no space or weight left. But Adding it before checking, if the player can afford it is no solution!

I guess this might be a problem with all items bought :)

Would be nice to get an answer,
G.

EDIT: I am trying 'CheckHold' atm, that should work...
 

gilgamash

Knight
Re: [IN DEVELOPMENT] BOB-Drop has somepitfalls

Here comes the patch for testing.

Changes:

When buying a Bod or dropping one from the book...
  • the book remains on the page or flips to an adjacent one when the page turns invalid
  • when the backpack is full, the bod is no longer deleted from the book nevertheless and thus lost and the player is no longer incorrectly chared the price when buying
  • the sound is played when the bod drops into the backpack

Regards,
G.
 

Attachments

  • BOBdiffs.diff
    13.7 KB · Views: 12
Status
Not open for further replies.
Top