Graal Pastebin

New Paste
Pasted on March 11, 2012.
View the raw file

public function onLoadPlayerData() {
  temp.results = SQL.executeSQL("items", "SELECT rowid, * FROM 'player_data' WHERE account = '" @ player.account @ "'", null, true);
  temp.rows = temp.results.rows;
  for (temp.row: temp.rows) {
    clientr.item.(@temp.row.realname).(@temp.row.rowid) = {
      temp.row.rowid, temp.row.realname, temp.row.socket, temp.row.accountlocked
    };
    if (clientr.item.(@temp.row.realname).data == null) {
      temp.results2 = SQL.executeSQL("items", "SELECT realname, itemname, itemtype, itemthumbnail, itemdescription FROM 'item_data' WHERE realname ='" @ temp.row.realname @ "'", null, true);
      temp.rows2 = temp.results2.rows;
      for (temp.row2: temp.rows2) {
        clientr.item.(@temp.row.realname).data = {
          temp.row2.realname, temp.row2.itemname, temp.row2.itemtype, temp.row2.itemthumbnail, temp.row2.itemdescription
        };
      }
    }
  }
}
 
public function onClearVariables() {
  temp.clientrvars = clientr.getdynamicvarnames();
  for (temp.
  var: temp.clientrvars) {
    temp.clientrvars2 = clientr.(@temp.
    var).getdynamicvarnames();
    clientr.(@temp.
    var) = null;
    for (temp.var2: temp.clientrvars2) {
      temp.clientrvars3 = clientr.(@temp.
      var).(@temp.var2).getdynamicvarnames();
      clientr.(@temp.
      var).(@temp.var2) = null;
      for (temp.var3: temp.clientrvars3) {
        clientr.(@temp.
        var).(@temp.var2).(@temp.var3) = null;
      }
    }
  }
}
 
public function onCreateItem(realname, createdby) {
  if (temp.realname == null || temp.createdby == null) return;
  temp.timecreated = timevar2;
  temp.results = SQL.executeSQL("items", "SELECT * FROM 'item_data' WHERE realname = '" @ temp.realname.escape() @ "'", null, true);
  temp.rows = temp.results.rows;
  if (temp.rows.size() >= 1) {
    temp.results = SQL.executeSQL("items", "INSERT INTO 'player_data' VALUES(
                                '" @ player.account.escape() @ "',
                                '" @ temp.realname.escape() @ "',
                                '" @ temp.timecreated.escape() @ "',
                                '" @ temp.createdby.escape() @ "',
                                '" @ player.account.escape() @ "',
                                '0',
                                '0'
                               )", null, true);
    temp.results = SQL.executeSQL("items", "SELECT rowid FROM 'player_data' WHERE account = '" @ player.account.escape() @ "' AND  timecreated = '" @ temp.timecreated.escape() @ "' AND realname = '" @ temp.realname.escape() @ "'", null, true);
    temp.itemid = temp.results.rows;
    temp.itemid = temp.itemid.substring(1);
    onAddItem(temp.realname, temp.itemid[0]);
  } else echo("Hacker Alert?:" SPC player.account SPC "is attempting to create a" SPC temp.realname SPC "and it doesn't exist");
}
 
public function onAddItem(realname, itemid) {
  temp.results = SQL.executeSQL("items", "SELECT realname, itemname, itemtype, itemthumbnail, itemdescription FROM 'item_data' WHERE realname = '" @ temp.realname.escape() @ "'", null, true);
  temp.rows = temp.results.rows;
  for (temp.row: temp.rows) {
    clientr.item.(@temp.row.realname).data = {
      temp.row.realname, temp.row.itemname, temp.row.itemtype, temp.row.itemthumbnail, temp.row.itemdescription
    };
  }
  temp.results = SQL.executeSQL("items", "SELECT rowid, * FROM 'player_data' WHERE rowid = '" @ temp.itemid.escape() @ "'", null, true);
  temp.rows2 = temp.results.rows;
  for (temp.row: temp.rows2) {
    clientr.item.(@temp.row.realname).(@temp.row.rowid) = {
      temp.row.rowid, temp.row.realname, temp.row.socket, temp.row.accountlocked
    };
  }
}
 
public function onRemoveItem(itemid, realname) {
  if (clientr.item.(@temp.realname).(@temp.itemid) != null) {
    clientr.item.(@temp.realname).(@temp.itemid) = null;
    temp.results = SQL.executeSQL("items", "DELETE FROM 'player_data' WHERE rowid = '" @ temp.itemid.escape() @ "'", null, true);
    temp.i = clientr.item.(@temp.realname).getdynamicvarnames();
    if (temp.i.size() <= 2) {
      clientr.item.(@temp.realname).data = null;
    }
  } else echo("Item Error: Player" SPC player.communityname SPC "is trying to delete" SPC temp.itemid @ "(" @ temp.realname @ ") however no items with the ID" SPC temp.itemid SPC "exist");
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89