Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Micro-transactions (https://forums.graalonline.com/forums/showthread.php?t=134262494)

sssssssssss 03-21-2011 07:28 PM

Micro-transactions
 
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?

fowlplay4 03-21-2011 07:39 PM

Quote:

Originally Posted by sssssssssss (Post 1638024)
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(texttypetextoptiontextlines) {
  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(plitems) {
  
// The item list of the player has been updated,
  // check if there are subscriptions or gelats
  
if (pl==NULL)
    return;
  
  
//...
}

function 
useGameItem(plitemdata) {
  
// 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 5pl.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.quantitytemp.item.titlepl.account));
  }
  else
    
savelog2("globalitemuselog.txt",format("unknown item: %d x %s for %s",
      
temp.item.quantitytemp.item.titlepl.account));



sssssssssss 03-21-2011 07:44 PM

Thanks dude. :)

WhiteDragon 03-21-2011 10:38 PM

Requesting sticky.


All times are GMT +2. The time now is 07:55 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.