Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-21-2011, 07:28 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
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?
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #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(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));

__________________
Quote:
Reply With Quote
  #3  
Old 03-21-2011, 07:44 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Thanks dude.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #4  
Old 03-21-2011, 10:38 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Requesting sticky.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:56 PM.


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