View Single Post
  #15  
Old 08-06-2011, 07:55 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Your best bet would be to do something like this:

PHP Code:
function onCreated() {
  
this.items = {
    {
"Item Name""Description""Price"}
  };
  
this.join("shopkeeper");
}

//#CLIENTSIDE

function onCreated() {
  
this.items = {
    {
"Item Name""Description""Price"}
  };  

It's not very DRY, but transferring data from the server-side to the client-side in a level npc can be a un-needed pain in the ass. It'll be more instant this way anyway.

Then in your shopkeeper class just process the this.items array and create the list you need. Also on the server-side verify their purchase against the server-side items array.
__________________
Quote:
Reply With Quote