PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
SYSEVENT_MERCHANT_SOLD?

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Feature Suggestions
Display posts from previous:   

Author Message
MontuZ
Distro Developer


Joined: 10 Feb 2006
Posts: 286
Location: Myrtle Beach, South Carolina

PostPosted: Wed Jan 02, 2008 6:35 pm    Post subject: SYSEVENT_MERCHANT_SOLD? Reply with quote

Maybe another struct member that has a reference to all the items sold to the player?

Author Message
Austin
POL Developer


Joined: 30 Jan 2006
Posts: 345
Location: San Diego, California

PostPosted: Sat Feb 09, 2008 12:53 pm    Post subject: Reply with quote

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.

Author Message
MontuZ
Distro Developer


Joined: 10 Feb 2006
Posts: 286
Location: Myrtle Beach, South Carolina

PostPosted: Sat Feb 09, 2008 4:35 pm    Post subject: Reply with quote

Sounds badass.

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

Post new topic   Reply to topic    PenUltima Online Forum Index -> Feature Suggestions All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty