elite*gold: 0
Join Date: Dec 2010
Posts: 23
Received Thanks: 3
|
i found this 2 online if they now work  GL
PHP Code:
<?PHP
if(isset($_POST['proces'])){
$playerinfo=ambilplayerinfo($_POST['fbid'],$_POST['ukey']);
$data.='======================
';
$data.= "FBID : ".$_POST['fbid']."
";
$data.='=======SEBELUM=======
';
$data.=infodcfreegold($playerinfo);
$data.='=======SESUDAH=======
';
$data.=dcfreegold($_POST['fbid'],$_POST['ukey'],$_POST['jumlah'],$playerinfo);
$data.='======================
';
echo $data;
}
function ambilkodedc($kode,$playerinfo){
foreach ($playerinfo['map']['items'] as $kode => $isi) {
if ($isi[0]==81){
return $kode;
}
}
}
function ambilplayerinfo($id,$ukey){
$result=sendPost("http://dc-canvas.socialpointgames.com/dragoncity/web/srv/get_player_info.php?USERID=".$id."&user_key=".$ukey."&spdebug=1",null);
$result = explode(";",$result);
$result = json_decode($result[1],true);
return $result;
}
function sendPost($url,$data=null){
if($data!=null){
$postdata=http_build_query($data);
$opts = array('http' =>
array(
'method' => 'POST',
'timeout' => 120,
'header' => "Content-type: application/x-www-form-urlencoded\r\n"."Content-Length: ".strlen($postdata)."\r\n",
'content' => $postdata
)
);
}else $opts = array('http'=>array('timeout'=>120));
$result=file_get_contents($url,false,stream_context_create($opts));
return $result;
}
function infodcfreegold($data){
$return.= 'GEMS : '.number_format($data['playerInfo']['cash'],0,',','.').'
';
$return.= 'GOLD : '.number_format($data['playerInfo']['gold'],0,',','.').'
';
$return.= 'FOOD : '.number_format($data['playerInfo']['food'],0,',','.').'
';
$return.= 'XP : '.number_format($data['playerInfo']['xp'],0,',','.').'
';
$return.= 'LEVEL : '.$data['playerInfo']['level'].'
';
return $return;
}
function kirimperintah($id,$ukey,$cmd){
$cmd = json_encode(array('publishActions'=>0,'commands'=>$cmd,'flashVersion'=>'0.7.6','first_number'=>1,'tries'=>1,'ts'=>time()));
$hash = hash_hmac('sha256',$cmd,'RGhXbiy4xEeDnSNX1oBG');
$cmd=array('data'=>$hash.';'.$cmd,'id'=>$id);
$result=sendPost("http://dc-canvas.socialpointgames.com/dragoncity/web/srv/packet.php?USERID=".$id."&user_key=".$ukey."&spdebug=1",$cmd) ;
$result = explode(";",$result);
$result = json_decode($result[1],true);
return $result;
}
function ambil1mgold($id,$ukey,$kodetavern,$jum){
$cmd=array();
$i=1;
$num=20*$jum;
for($i=1;$i<=$num;$i++){
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,0),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,1),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,2),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,3),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,5),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,6),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,7),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,8),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,9),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,9),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,9),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array($kodetavern,9),'cmd'=>'finish_si');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1151,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1143,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1141,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1147,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1139,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1150,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1152,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1137,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1149,0,0),'cmd'=>'sell_stored_dragon');
$i++;
$cmd[]=array('number'=>$i,'time'=>time(),'args'=>array(1149,0,0),'cmd'=>'sell_stored_dragon');
}
return $cmd;
}
function dcfreegold($id,$ukey,$jumlah,$playerinfo){
$kodetavern=ambilkodedc(81,$playerinfo);
$result=array();
$cmd=array();
if($jumlah==1){
$cmd[]=array('number'=>1,'time'=>time(),'args'=>array($kodetavern,0),'cmd'=>'finish_si');
$cmd[]=array('number'=>2,'time'=>time(),'args'=>array(1151,0,0),'cmd'=>'sell_stored_dragon');
$result=kirimperintah($id,$ukey,$cmd);
}elseif($jumlah==2){
$cmd[]=array('number'=>1,'time'=>time(),'args'=>array($kodetavern,0),'cmd'=>'finish_si');
$cmd[]=array('number'=>2,'time'=>time(),'args'=>array($kodetavern,1),'cmd'=>'finish_si');
$cmd[]=array('number'=>1,'time'=>time(),'args'=>array(1151,0,0),'cmd'=>'sell_stored_dragon');
$cmd[]=array('number'=>2,'time'=>time(),'args'=>array(1143,0,0),'cmd'=>'sell_stored_dragon');
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==5){
$cmd[]=array('number'=>1,'time'=>time(),'args'=>array($kodetavern,0),'cmd'=>'finish_si');
$cmd[]=array('number'=>2,'time'=>time(),'args'=>array($kodetavern,1),'cmd'=>'finish_si');
$cmd[]=array('number'=>3,'time'=>time(),'args'=>array($kodetavern,2),'cmd'=>'finish_si');
$cmd[]=array('number'=>4,'time'=>time(),'args'=>array($kodetavern,4),'cmd'=>'finish_si');
$cmd[]=array('number'=>5,'time'=>time(),'args'=>array($kodetavern,5),'cmd'=>'finish_si');
$cmd[]=array('number'=>6,'time'=>time(),'args'=>array(1151,0,0),'cmd'=>'sell_stored_dragon');
$cmd[]=array('number'=>7,'time'=>time(),'args'=>array(1143,0,0),'cmd'=>'sell_stored_dragon');
$cmd[]=array('number'=>8,'time'=>time(),'args'=>array(1141,0,0),'cmd'=>'sell_stored_dragon');
$cmd[]=array('number'=>9,'time'=>time(),'args'=>array(1147,0,0),'cmd'=>'sell_stored_dragon');
$cmd[]=array('number'=>10,'time'=>time(),'args'=>array(1139,0,0),'cmd'=>'sell_stored_dragon');
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==10){
$cmd=ambil1mgold($id,$ukey,$kodetavern,1);
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==20){
$cmd=ambil1mgold($id,$ukey,$kodetavern,2);
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==40){
$cmd=ambil1mgold($id,$ukey,$kodetavern,4);
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==50){
$cmd=ambil1mgold($id,$ukey,$kodetavern,5);
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==60){
$cmd=ambil1mgold($id,$ukey,$kodetavern,6);
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==70){
$cmd=ambil1mgold($id,$ukey,$kodetavern,7);
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==80){
$cmd=ambil1mgold($id,$ukey,$kodetavern,8);
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}elseif($jumlah==90){
$cmd=ambil1mgold($id,$ukey,$kodetavern,9);
$result=kirimperintah($id,$ukey,$cmd);
sleep(3);
}
$ret='';
if($result['result']==true){
$data=ambilplayerinfo($id,$ukey);
$ret.=infodcfreegold($data);
}else{
$ret.='ERROR : '.$result['error'].'
';
}
return $ret;
}
?>
PHP Code:
<?php
if(session_id()=="") session_start();
function getLevelByXp($xp){
$listlevel=array(0,40,60,100,200,350,550,800,1113,1504,1993,2604,3368,4323,5517,7010,8876,11209,13659,16232,18934,21771,24750,27878,31162,34610,38230,42031,46022,50213,54614,59235,64087,69182,74532,80150,86049,92243,98747,105576,112746,120275,128180,136480,145195,154346,163955,174044,184637,195760,207439,219702,232578,246098,260294,275200,290851,307285,324541,342660,361685,381661,402636,424660,447785,472066,497561,524331,552440,581954,612944,645484,679651,715526,756782,804226,858787,921532,993689,1076670,1172098,1281840,1408043,1553176,1720079,1912017,2132746,2386584,2678498,3014199,3400255,3844219,4354778,4941921,5617135,6393631,7286601,8313517,9494470,2016089205);
$j=count($listlevel);
for($i=0;$i<$j;$i++){
if($listlevel[$i] > $xp) break;
}
return $i;
}
function userkey($fbid) {
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, "http://dynamicdc.socialpointgames.com/dragoncity/web/srv/get_user_session.php?secret=zoltan3287&id=" . $fbid);
curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36" );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $ch, CURLOPT_HEADER, false );
//curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8888");
curl_setopt ( $ch, CURLOPT_NOBODY, false );
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 5 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 10 );
$userkey = curl_exec ( $ch );
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, 'http://dynamicdc.socialpointgames.com/dragoncity/web/srv/get_game_config.php?USERID=' . $fbid . '&user_key=' . $userkey."&language=tr" );
curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36" );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $ch, CURLOPT_HEADER, false );
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
curl_setopt ( $ch, CURLOPT_NOBODY, false );
//curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8888");
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 5 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 10 );
$result = curl_exec ( $ch );
curl_setopt ( $ch, CURLOPT_URL, 'http://dynamicdc.socialpointgames.com/dragoncity/web/srv/get_player_info.php?USERID=' . $fbid . '&user_key=' . $userkey."&language=tr"
);
curl_setopt ( $ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36" );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $ch, CURLOPT_HEADER, false );
curl_setopt ( $ch, CURLOPT_NOBODY, false );
curl_setopt ( $ch, CURLOPT_ENCODING , "gzip");
//curl_setopt ( $ch, CURLOPT_PROXY, "127.0.0.1:8888");
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( $ch, CURLOPT_CONNECTTIMEOUT, 5 );
curl_setopt ( $ch, CURLOPT_TIMEOUT, 10 );
$result = curl_exec ( $ch );
return $userkey;
}
if(isset($_POST['flashVersion']) and !empty($_POST['flashVersion'])) $_SESSION['swversi']=$_POST['flashVersion'];
$versi="0.5.23a";
if(isset($_SESSION['swversi'])) $versi=$_SESSION['swversi'];
$str = '<html><head><title>Dragon Saint Bracked</title></head><body>
<form method="post">
ID FB:<br/>
<input name="fbid" /><br/>
Flash Version:<br/>
<input name="flashVersion" value="'.$versi.'"/><br/>
<select name="mode">
<option value="1">100k xp + 100k gold</option>
<option value="2">100k xp + 100k food</option>
</select><br/>
<input type="submit" value="Submit" />
</form>
';
if(isset($_POST['fbid']) and isset($_POST['mode'])){
if(empty($_POST['fbid'])) die('Please enter your FB ID');
$fbid=$_POST['fbid'];
$user=userkey($fbid);
$result=komut("http://dynamicdc.socialpointgames.com/dragoncity/web/srv/get_player_info.php?USERID=$fbid&user_key=$user&language=en");
$payload = explode(';',$result);
$data = json_decode($payload[1],true);
$str .= "Bracked Creation<br/>";
$str .= "name: ".$data['playerInfo']['name']."<br/>";
$str .= "cash: ".number_format($data['playerInfo']['cash'],0,',','.')."<br/>";
$str .= "gold: ".number_format($data['playerInfo']['gold'],0,',','.')."<br/>";
$str .= "food: ".number_format($data['playerInfo']['food'],0,',','.')."<br/>";
$str .= "xp: ".number_format($data['playerInfo']['xp'],0,',','.')."<br/>";
$str .= "------------------------------<br/>";
$hcx='';
for($i=1;$i<100;$i++)
{
//$hcx.='{"args":[89,25],"number":'.$i.',"cmd":"collect","time":1372771201},';
$hcx.='{"args":[18],"number":'.$i.',"cmd":"collect","time":1372771201},';
//$hcx.='{"args":[134],"number":'.$i.',"cmd":"collect","time":1372771201},';
}
$hcx=substr($hcx,0,-1);
$hc='{"commands":['.$hcx.']}';
$hc=json_decode($hc,1);
$num=1;
for($i=0;$i<count($hc['commands']);$i++)
{
$hc['commands'][$i]['time']=time();
}
$hc=substr(substr(str_replace(" ","",json_encode($hc)),0,-1),1);
function arasi($a,$b,$data)
{
$x = explode($a,$data);
$z = explode($b,$x[1]);
$oh = $z[0];
if($x && $z) { return $oh; } else { return false; }
}
function komut2($komut,$num)
{
$data=komutyolla($komut,$num);
if(stristr($data,'bad command number: expected'))
{
$yeninum=arasi('bad command number: expected ',',',$data);
$data=komutyolla($komut,$yeninum);
return substr($data,65);
}
else
{
return substr($data,65);
}
}
function komutyolla($komut,$num)
{
global $fbid,$user;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"http://dynamicdc.socialpointgames.com/dragoncity/web/srv/packet.php?USERID=$fbid&user_key=$user&language=tr");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query(array("id"=>"$fbid","data"=>hashla($komut,$num))));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: ".fakeip(),"X-Client-IP: ".fakeip(),"Client-IP: ".fakeip(),"HTTP_X_FORWARDED_FOR: ".fakeip(),"X-Forwarded-For: ".fakeip()));
curl_setopt($ch, CURLOPT_ENCODING , "gzip");
//curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8888");
$data = curl_exec ($ch);
curl_close ($ch);
return $data;
}
function hashla($komut,$n)
{
$ar=array("first_number"=>$n,"publishActions"=>0,"tries"=>1,"flashVersion"=>"0.5.19","ts"=>time());
$x='RGhXbiy4xEeDnSNX1oBG';
$sonkod=str_replace(" ","",str_replace('}',','.$komut.'}',json_encode($ar)));
return hash_hmac('sha256', $sonkod, $x).';'.$sonkod;
}
if(isset($_POST["fbid"]))
{
$fbid=$_POST['fbid'];
$user=userkey($fbid);
/*
{"commands":[{"args":[1040],"number":1,"cmd":"get_rewarded_dragon","time":1372844166}]}
{"commands":[{"cmd":"assist_receive","number":1,"args":[1],"time":1372539611}]}
*/
if($_POST["mode"]==1)
{
unset($hc,$hcx);$hcx='';
for($i=1;$i<10001;$i++)
{
/* 3gems (work 1 times)
$hcx.='{"args":[147,"[0,1]"],"number":'.$i.',"cmd":"set_goals","time":1372771201},';
$hcx.='{"args":[147],"number":'.$i.',"cmd":"complete_goal","time":1372771201},';
$hcx.='{"args":[134],"number":'.$i.',"cmd":"complete_goal","time":1372771201},';
$hcx.='{"args":[148,"[0,1]"],"number":'.$i.',"cmd":"set_goals","time":1372771201},';
$hcx.='{"args":[148],"number":'.$i.',"cmd":"complete_goal","time":1372771201},';
$hcx.='{"args":[134,"[0,1]"],"number":'.$i.',"cmd":"set_goals","time":1372771201},';
$hcx.='{"args":[147,"[0,1]"],"number":1,"cmd":"set_goals","time":1372771201},';
$hcx.='{"args":[145,"[1,1]"],"number":1,"cmd":"set_goals","time":1372771201},';
$hcx.='{"args":[145],"number":1,"cmd":"set_goals","time":1372771201},';
*/
$hcx.='{"args":[1],"number":'.$i.',"cmd":"assist_receive","time":1372771201},';
}
$hcx=substr($hcx,0,-1);
$hc='{"commands":['.$hcx.']}';
$hc=json_decode($hc,1);
$num=1;
for($i=0;$i<count($hc['commands']);$i++)
{
$hc['commands'][$i]['time']=time();
}
}
else if ($_POST["mode"]==2)
{
unset($hc,$hcx);$hcx='';
for($i=1;$i<10001;$i++)
{
$hcx.='{"args":[18],"number":'.$i.',"cmd":"assist_receive","time":1372771201},';
// xp:$hcx.='{"args":[3666,1],"number":'.$i.',"cmd":"finish_building","time":1372771201},';
}
$hcx=substr($hcx,0,-1);
$hc='{"commands":['.$hcx.']}';
$hc=json_decode($hc,1);
$num=1;
for($i=0;$i<count($hc['commands']);$i++)
{
$hc['commands'][$i]['time']=time();
}
}
else if ($_POST["mode"]==3)
{
unset($hc,$hcx);$hcx='';
for($i=1;$i<201;$i++)
{
$hcx.='{"args":[8241,0],"number":'.$i.',"cmd":"finish_building","time":1372771201},';
}
$hcx=substr($hcx,0,-1);
$hc='{"commands":['.$hcx.']}';
$hc=json_decode($hc,1);
$num=1;
for($i=0;$i<count($hc['commands']);$i++)
{
$hc['commands'][$i]['time']=time();
}
}
$hc=substr(substr(str_replace(" ","",json_encode($hc)),0,-1),1);
$sucb=json_decode(komut2($hc,$num),1);
}
else
{
}
$result=komut("http://dynamicdc.socialpointgames.com/dragoncity/web/srv/get_player_info.php?USERID=$fbid&user_key=$user&language=en");
$payload = explode(';',$result);
$data = json_decode($payload[1],true);
$str .= "Bracked Creation<br/>";
$str .= "name: ".$data['playerInfo']['name']."<br/>";
$str .= "cash: ".number_format($data['playerInfo']['cash'],0,',','.')."<br/>";
$str .= "gold: ".number_format($data['playerInfo']['gold'],0,',','.')."<br/>";
$str .= "food: ".number_format($data['playerInfo']['food'],0,',','.')."<br/>";
$str .= "xp: ".number_format($data['playerInfo']['xp'],0,',','.')."<br/>";
$str .= "------------------------------<br/>";
die("$str</body></html>");
}else die("$str</body></html>");
function fakeip()
{
return long2ip( mt_rand(0, 65537) * mt_rand(0, 65535) );
}
function komut($url,$args=false)
{
global $fbid,$user;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: ".fakeip(),"X-Client-IP: ".fakeip(),"Client-IP: ".fakeip(),"HTTP_X_FORWARDED_FOR: ".fakeip(),"X-Forwarded-For: ".fakeip()));
if($args)
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$args);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8888");
$result = curl_exec ($ch);
curl_close ($ch);
return $result;
}
?>
here is the one they use for the egg hack
PHP Code:
<?php
require_once "dragoncity.class.php";
$versi="";
if(file_exists(__DIR__."/versi.txt")) $versi=file_get_contents(__DIR__."/versi.txt");
$str = '<html><head><title>DRAGON CITY - EGGS</title></head><body>
<form action="egg.php" method="post">
DC Versi:<br/>
<input name="versi" value="'.$versi.'"/><br/>
ID FB:<br/>
<input name="fbid" /><br/>
User Key:<br/>
<input name="ukey" /><br/>
egg code:<br/>
<input name="egg" size="68"/><br/>
<input type="submit" value="Submit" />
</form>';
if(isset($_POST['fbid']) && isset($_POST['ukey']) && isset($_POST['versi']) && isset($_POST['egg'])){
$dragon = explode(",",$_POST['egg']);
$dra=count($dragon);
if($dra>10) diex($str."<hr/>max 10 dragon each process.");
$dc=new DragonCity($_POST['fbid'],$_POST['ukey'],$_POST['versi']);
if(!$dc->getInfo()) infoError($str);
$str .= $dc->html();
$cost = $dra*25;
if($dc->info['cash']<$cost) diex($str."<hr/>You need ".$cost." gems to process.");
$num=1;
$cmd=array();
$time=time();
$listdragon=array(1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,24,25,26​,27,28,29,30,31,32,33,34,35,36,37,38,39,40,45,46,47,48,49,50,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,72,73,74,75,76,77,79,80,81,82,83,84,85,86,87,88,89,90,101,102,103,104,105,106,110,111,112,113,114,115,116,117,118,119,120,121,122,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,2000,5000,5001,1000,1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1011,1012,1013,1014,1015,1016,1017,1018,1019,1020,1021,1022,1023,1024,1025,1026,1028,1029,1031,1032,1033,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115,1116,1117,1118,1119,1120,1121,1122,1123,1124,1125,1126,1127,1128,1129,1130,1131,1132,1133,1134,1135,1136,1137,1138,1139,1140,1141,1142,1143,1144,1145,1146,1147,1148,1149,1150,1151,1152,1153,1154,1155,1156,1157,1158,1159,1160,1161,1162,1163,1164,1165,1166,1167,1168,1169,1170,1171,1172,1173,1174,1175,1176,1177,1178,1179,1180,1182,1183,1184,1187,1190,1196,1197,1194,1195);
for($i=0;$i<$dra;$i++){
if(in_array($dragon[$i],$listdragon)){
$cmd[]=array('number'=>$num,'time'=>$time,'args'=>array(2,(integer)$dragon[$i]),'cmd'=>'buy_offer_pack');
$num++;
}
}
if(count($cmd)<1) diex($str."empty dragon for process.");
$res = $dc->sendCommand($cmd);
if($res===false) diex($str."<hr/>ERROR.");
//$str .= "<hr/>".json_encode($res);
if(!$dc->getInfo()) infoError($str);
diex($str.$dc->html());
}else die($str."</body></html>");
function infoError($str){
die($str."<hr/>Get Info Error.</body></html>");
}
function diex($str){
die($str."</body></html>");
}
?>
PHP Code:
<?php
class DragonCity {
private $timeout = 120;
private $path = "http://dc-canvas.socialpointgames.com/dragoncity/web/srv/";
private $id = "";
private $ukey = "";
public $info = array();
public $ps = array();
public $ts = 0;
public function __construct($id,$ukey,$ver){
$this->ts = time();
$this->id = $id;
$this->ukey = $ukey;
$this->versi = $ver;
$this->info = array('name'=>"",'cash'=>0,'gold'=>0,'food'=>0,'level'=>1,'xp'=>0,'dragons'=>0,'storeDragon'=>0,'storeItems'=>0,'mondayReward'=>date('d-m-Y H:i:s',$this->ts+172800));
}
public function getInfo(){
if(!$this->sendPost($result,$this->path."get_player_info.php?USERID=".$this->id."&user_key=".$this->ukey."&spdebug=1")) return false;
$result = explode(";",$result);
$result = json_decode($result[1],true);
if(!$result) return false;
if(isset($result['playerInfo']['name'])) $this->info['name'] = $result['playerInfo']['name'];
if(isset($result['playerInfo']['cash'])) $this->info['cash'] = $result['playerInfo']['cash'];
if(isset($result['playerInfo']['gold'])) $this->info['gold'] = $result['playerInfo']['gold'];
if(isset($result['playerInfo']['food'])) $this->info['food'] = $result['playerInfo']['food'];
if(isset($result['playerInfo']['level'])) $this->info['level'] = $result['playerInfo']['level'];
if(isset($result['playerInfo']['xp'])) $this->info['xp'] = $result['playerInfo']['xp'];
if(isset($result['map']['dragons'])) $this->info['dragons'] = count($result['map']['dragons']);
if(isset($result['map']['store']['dragons'])) $this->info['storeDragon'] = count($result['map']['store']['dragons']);
if(isset($result['map']['store']['items'])) $this->info['storeItems'] = count($result['map']['store']['items']);
if(isset($result['timestamp'])) $this->ts = $result['timestamp'];
if(isset($result['privateState'])){
$this->ps = $result['privateState'];
$this->info['mondayReward']=date('d-m-Y H:i:s',$this->ps['timeStampMondayBonus']+172800);
}
unset($result);
return true;
}
public function html(){
$str = "<hr/>name: ".$this->info['name']."<br/>";
$str .= "cash: ".$this->info['cash']."<br/>";
$str .= "gold: ".$this->info['gold']."<br/>";
$str .= "food: ".$this->info['food']."<br/>";
$str .= "level: ".$this->info['level']."<br/>";
$str .= "xp: ".$this->info['xp']."<br/>";
$str .= "dragons: ".$this->info['dragons']."<br/>";
$str .= "storeDragon: ".$this->info['storeDragon']."<br/>";
$str .= "storeItems: ".$this->info['storeItems']."<br/>";
$str .= "mondayReward: ".$this->info['mondayReward']."<br/>";
return $str;
}
public function sendCommand($cmd){
$cmd = json_encode(array('publishActions'=>"0",'commands'=>$cmd,'flashVersion'=>$this->versi,'first_number'=>1,'tries'=>1,'ts'=>time()));
$hash = hash_hmac('sha256',$cmd,'RGhXbiy4xEeDnSNX1oBG');
$cmd=array('data'=>$hash.';'.$cmd,'id'=>$this->id);
if(!$this->sendPost($result,$this->path."packet.php?USERID=".$this->id."&user_key=".$this->ukey."&spdebug=1",$cmd)) return false;
$result = explode(";",$result);
$result = json_decode($result[1],true);
if(!$result) return false;
if(!isset($result['result'])) return false;
if(!$result['result']) return false;
if(isset($result['response'])) return $result['response'];
return array();
}
private function sendPost(&$result,$url,$data=null){
if($data!=null){
$postdata=http_build_query($data);
$opts = array('http' =>
array(
'method' => 'POST',
'timeout' => $this->timeout,
'header' => "Content-type: application/x-www-form-urlencoded\r\n"."Content-Length: ".strlen($postdata)."\r\n",
'content' => $postdata
)
);
}else $opts = array('http'=>array('timeout'=>$this->timeout));
$result=file_get_contents($url,false,stream_context_create($opts));
if(!$result) return false;
return true;
}
}
|