Thread: Custom Classes!
View Single Post
  #21  
Old 12-09-2007, 11:37 PM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Sure... Phone-Address look-up. In Era.
PHP Code:
Phones.phoneMap TMap.newInstance();

// In various locations around the world
Phones.phoneMap.put("553-4234"this );


// To phone...
otherPhone Phones.phoneMap.get"553-4234" );
otherPhone.chat "*ring* *ring*"
Merger...
Item System:
PHP Code:
items TMap.newInstance();
items.putitemID, {quantstate});

merger = function( keyval1val2 ){ return {val1[0] + val2[0], val1[1] || val2[1]}; }
items TMap.mergeitemsTMap.newInstance( {{ itemIDquant}}, merger ); 
... There are many situations that it could come up.

What I use it for is to have a cumulative effects from the clothing that the player uses.
For instance, let's say 'Speed'...
PHP Code:
Special Boots TMap.newInstance( {{"Speed"5}});
Other Clothing TMap.n... ...

mods playerMods;
mods TMap.mergemodsracialMods );
for ( 
clothesall worn clothes )
  
mods TMap.mergemodsclothes.mods );

player.speed mods.get("Speed"); 
This is done FOR-ALL possible (and future) attributes:

PHP Code:
  temp.modList temp.mod.toArray();
  for ( 
temp.modtemp.modList )
    
clientr.(@ temp.mod[0] ) = temp.mod[1]; 
Reply With Quote