View Single Post
  #2  
Old 03-21-2011, 07:39 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
Quote:
Originally Posted by sssssssssss View Post
I was just wondering how you even do this with paid gralats? Is there any documentation on scripting this, and if not can someone explain it?
You have to contact Stefan and tell him what you want to add/remove.

Then you have the following DB. Then it's just a matter of calling your server's player functions to add the item.

DB-NPC: GlobalShopControl (Removed a lot of Zodiac specific code)

PHP Code:
// Adds or equips global items once the player bought one
// This is triggered by the Serverlister.

function onReceiveText(texttype, textoption, textlines) {
  if (
texttype=="lister") {
    
// Data sent by the server lister
    
switch (textoption) {
      case 
"globalitems": {
          
applyItems(findplayer(textlines[0]), textlines[1]);
          break;
        }
      case 
"globalitemuse": {
          
useGameItem(findplayer(textlines[0]), textlines[1]);
          break;
        }
    }
  }
}

function 
applyItems(pl, items) {
  
// The item list of the player has been updated,
  // check if there are subscriptions or gelats
  
if (pl==NULL)
    return;
  
  
//...
}

function 
useGameItem(pl, itemdata) {
  
// A particular item has been activated
  // and needs to be added in-game
//  echo("add item: " @ itemdata);
  
temp.added = true;
  
  
temp.item.loadvarsfromarray(itemdata);
  switch (
temp.item.title) {
    case 
"Character Slot":
      
/*
         Adds another character slot to your character
         select menu. 
      */
      // Accessible via ingame command: /charselect
      // Requires a check to prevent people from
      // purchasing more than 5 character slots
      
if (extraslots < 5) pl.AddCharacterSlot();
      
this.gralatcount += 510; 
      break;
    case 
"Improved EXP Potion":
      
/*
         6 Pack of EXP Potions that increase EXP Gained 
         by 75% for an hour.
      */
      // Accessible via inventory (Q)
      // Select and use with D
      
pl.addEXPPotions();
      
this.gralatcount += 170;
      break;
    case 
"Christmas Item Pack": {
        
// Add the items
        
break;
      }
    case 
"Starter Pack": {
        
// Add the items
        
pl.gralats += 5000;
        break;
      }
    case 
"Starter Pack Extended": {
        
// Add the items
        
pl.gralats += 10000;
        break;
      }
    case 
"Starter Pack Premium": {
        
// Add the items
        
pl.gralats += 15000;
        break;
      }
    case 
"Starter Pack Elite": {
        
// Add the items
        
pl.gralats += 20000;
        break;
      }
    default:
      
temp.added = false;
      break;
  }
  
  
// Log it
  
if (temp.added) {
    
// Send a message
    //pl.sendMessage();
    // Log transaction    
    
savelog2("globalitemuselog.txt",format("added %d x %s to %s",
      
temp.item.quantity, temp.item.title, pl.account));
  }
  else
    
savelog2("globalitemuselog.txt",format("unknown item: %d x %s for %s",
      
temp.item.quantity, temp.item.title, pl.account));
} 
__________________
Quote:
Reply With Quote