Quote:
Originally Posted by Lebeau
^This is a good idea, but is it doable (Adrian is solo coding atm)? Done right, anyone could loan to anyone else for a set amount of time: #/#/# (either a chosen set return date, or manually in hours, days, weeks, months, etc). Options are always the w2g. Without fail (actually with a lot of fail), most of the gears I've lent out to help folk grind up, etc, never made it back to me (not cool!) & sit useless & unused on unplayed & discarded 60- toon accounts now....
|
TL; DR: I think it's doable.
My thought:
Add a Loan dialog, like the Trade dialog, that only works one way (e.g., Player A loans Item X to Player B). Items borrowed are flagged with the owner's name and a time period (which could be indefinite, like 12/31/2999). At the end of that time period, those items are returned to the owner (repossessed), with a tag of "Returned by name".
I think this is four fields per item. The fields are internally tagged with the
- ID number of the owner (likely a long integer), and the server translates the name.
- There's a timestamp for when it was loaned,
- a duration in seconds for when it goes back (32 bits),
- and then the ID number of "Returned by ...".
Borrowed items cannot be traded, given away, auctioned, loaned, sold to merchants, or dropped. They can be equipped; they can be upgraded; they can be returned to the lender. How much code this affects, I don't know, but I'm guessing the Merchant Commerce, Trade, Loan, Auction, and Dropping routines would need to check this (if the item has an Owner other than the current character, the routine says "you can't do that with a Loaned Item").
Max limit of borrowed items in any character's inventory should be 10 (although I think a limit per class is appropriate, 10 is certainly reasonable no matter what class, and avoids any calculations). Perhaps there should be a separate tab in inventory for them (clearly labeled "Borrowed Items", limited to ten slots, showing item, owner, date due). No more open slots, no more loans to you.
Probably need another dialog (perhaps driven by a right-click in the Loaned Items inventory tab) is needed to return to lender.
There should be a function to clear the "Returned by X" tag (player driven).
I'm not sure how intense that code is going to be. I think most of it is already in use in various places (you can't sell certain items, already; this is a copy of that code with a different flag to check). Some items are already tagged in various ways ("Quest Item" as one example). That DB column could perhaps be re-used for Loan items to save database space, but that would require a bit more code.
The Trade dialog could be copied, and certain parts of it simply eliminated. No need for the receiving character to do anything but accept or decline (no interest or loand fees. Keep it simple). Add to the loan function behind the loan dialog the routines of filling in the DB fields. If the receiver already has ten loaned items, the lender receives a message, "Recipient already has ten loaned items."
There probably also needs to be a record of Loaned items in the Loaning character's inventory, and a repossession dialog should be openable there. Some thought is required. If the recipient of the loan is currently using the item, does it get taken from him mid-swing? Maybe, but the repossession should likely give a 2-minute countdown (every 15 seconds, a brief message flashes; last 15 seconds, countdown). If the item is returned by the borrower during the countdown, it stops and the repossession is completed. Countdown code is already in use in many places. Only one item at a time (let's keep things simpler for the coders and players, and not overload the poor server) can be repossessed. That is, until the repossession routing is done, another repossession routine may not be started by the character.
It is fairly complex, and there are a lot of bits, some of which could be easily bollixed with a typo or a logic error.
The Inventory sections to track Loaned items on both sides would be relatively complex (only that tab shows those fields), but there is code that kind of does things like that (Auction House, for one). Might have to be a separate dialog, and not part of Inventory, though.
Question is, would it take a long time to code it?
And that's a question only Adrian at this point can answer.