What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[Script] GB2 Hotspot randomiser

tomcruise

Member
Joined
Jan 15, 2011
Messages
345
Given that private profiles are best, but not everyone has the time to make them, I figured the next best thing would be to change each hotspot so that at least it doesn't exactly match the publicly released profiles. I'm not sure if GB2 does this on the fly, but I feel given the recent situation anything you can do to decrease the risk of triggering server side checks the better.

PHP:
<?php

$output = "";
$handle = @fopen($_GET['profile'], "r");
if ($handle) {
    while (($buffer = fgets($handle, 4096)) !== false) {
		$coords = array();
        preg_match('/Hotspot X="(.+?)" Y="(.+?)" Z="(.+?)"/', $buffer, $coords);
		if(!empty($coords)) {
			foreach($coords as &$coord) {
				$coord = (float) $coord + rand(10,30);
			}
			unset($coord);
			$buffer = preg_replace('/Hotspot X="(.+?)" Y="(.+?)" Z="(.+?)"/', 'Hotspot X="'.$coords[1].'" Y="'.$coords[2].'" Z="'.$coords[3].'"', $buffer);
		}
		$output .= $buffer;
    }
    if (!feof($handle)) {
        echo "Error: unexpected fgets() fail\n";
    }
    fclose($handle);
}

$fp = fopen($_GET['profile'] . ' [randomised]', 'w');
fwrite($fp, $output);
fclose($fp);

?>

Usage would be something like http://localhost/randomise/randomise.php?profile=w00tsFULLcobaltZulGrizz-Alliance072811.xml

Change the values in rand(10,30) to change the amount of variation added to each hotspot, I plucked this number out of thin air I'm not sure exactly how much randomness you could add before it breaks the profile.
 
Back
Top