PenUltima Online

It is currently Sat Sep 06, 2008 11:41 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: SYSEVENT_MERCHANT_SOLD?
PostPosted: Wed Jan 02, 2008 2:35 pm 
Offline
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 317
Location: Myrtle Beach, South Carolina
Maybe another struct member that has a reference to all the items sold to the player?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 09, 2008 8:53 am 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 410
Location: San Diego, California
Im looking at it right now..

It looks like it would be best to move most of it to script side..
EVID_MERCHANT_SOLD is received by the npc (items the player selected from the gump)

Then with that event have .items which is an array
The array would cain a reference to the item, the cost, and the amount.
Cost and amount would be used for handling subtracting from a stack in the vendor's pack and adding to the player's pack.

.amount would remain to check right away if the player's has enough gold to save going through the items array.

Code:
struct
.type - EVID_MERCHANT_SOLD
.amount - Total cost of everything
.purchases (array)
   [1] (struct)
     .item      - <APPOBJ:ITEM> (say a sword cause theyre pointy)
     .amount - 1
     .cost      - 65
   [2] (struct)
     .item      - a stack of 200 lockpicks
     .amount - 25
     .cost      - 16
   [3] (struct )
     .item      -  a pair of scissors (note: not stackable)
     .amount -  5
     .cost      - 80


For 1: you know you just need to move it because only 1 was purchased and the item in index 1 is the one selected and just take 65 gold from the player.

For 2: You know that the amount purchased (25) is less than the amount selected from .item. It is safe to subtract 25 from its amount, and add them to the player's pack, then take 16*25 gold from the player.

For 3: This is more difficult. The vendor had say 100 pairs of scissors for sale, but they are not stackable. The player purchased 5 of them.
You need to go through the forsale container and find 4 more items that match (this isnt gonna be done in the core anymore). Then subtract 80*5 gold from the player.

_________________
-Austin


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 09, 2008 12:35 pm 
Offline
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 317
Location: Myrtle Beach, South Carolina
Sounds badass.

Any word on CreateScript when an item is created in merchant inventory via CreateItemInInventory()?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl