Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require '../dibi/dibi.php';
- require '../php_scripts/config.php';
- require '../classes/Telnet.php';
- require '../php_scripts/functions.php';
- function transferThisItemChar($r) {
- global $mysqliC,$ii,$newCharGuid;
- if(($r['slot']<=73 && $r['bag']==0)) {
- // $mysqliC->query("SET AUTOCOMMIT=0");
- $mysqliC->query("LOCK TABLES character_inventory READ, item_instance READ;");
- $mysqliC->query("START TRANSACTION");
- $query = $mysqliC->query("SELECT (MAX(item)+1) FROM character_inventory");
- $guid = $query->fetch_row();
- $p1 = $mysqliC->query("INSERT INTO character_inventory (guid,bag,slot,item) VALUES('".$newCharGuid."',".$r['bag'].",".$r['slot'].",".$guid[0].")");
- $p2 = $mysqliC->query("INSERT INTO item_instance (guid,itemEntry,owner_guid,creatorGuid,giftCreatorGuid,count,duration,charges,flags,enchantments,randomPropertyId,durability,playedTime,text) VALUES (".$guid[0].",'".$ii[$r['item']]['itemEntry']."','".$newCharGuid."','0','0','".$ii[$r['item']]['count']."','".$ii[$r['item']]['duration']."','".$ii[$r['item']]['charges']."','".$ii[$r['item']]['flags']."','".$ii[$r['item']]['enchantments']."','".$ii[$r['item']]['randomPropertyId']."','".$ii[$r['item']]['durability']."','".$ii[$r['item']]['playedTime']."','".$ii[$r['item']]['text']."')");
- if($r['bag']==0 && $r['slot']>=19 && $r['slot']<=22) { session_start(); $_SESSION['changes']['inventory'][$r['item']] = $guid[0]; } // bags in inventory
- if($r['bag']==0 && $r['slot']>=67 && $r['slot']<=73) { session_start(); $_SESSION['changes']['bank'][$r['item']] = $guid[0]; } // bags in bank
- if($p1 && $p2) {
- $mysqliC->query("COMMIT");
- } else {
- $mysqliC->query("ROLLBACK");
- transferThisItemChar($r);
- }
- $mysqliC->query("UNLOCK TABLES;");
- unset($p1,$p2);
- }
- }
- function transferThisItemBank($r) {
- }
- $type = $_GET['t'];
- if(is_numeric($type)) {
- switch($type) {
- case 1:
- {
- $username = $_GET['username'];
- $password = $_GET['password'];
- $hash = sha1(strtoupper($username).':'.strtoupper($password));
- $match = $dibiSW->query("SELECT id FROM account WHERE username = %s",$username," AND sha_pass_hash = %s",$hash)->fetchSingle();
- $banned = $dibiSW->query("SELECT bandate FROM account_banned WHERE id = %i", $match, " AND active = '1'")->fetchSingle();
- if(!$banned) {
- if($match) {
- $array = $dibiCT->query("SELECT name FROM characters WHERE online = '0' AND account = %s",$match)->fetchAll();
- echo '<form action="" method="post" enctype="application/x-www-form-urlencoded">';
- echo '<tr><td><input type="hidden" name="transf_wtc_account" value="'.$username.'"></td></tr>';
- echo '<table>';
- foreach($array as $value) {
- echo '<tr><td><input type="checkbox" name="'.$value['name'].'" id="'.$value['name'].'" /></td><td><label for="'.$value['name'].'">'.$value['name'].'</label></td></tr>';
- }
- echo '<tr><td colspan="2"><hr /><br /></td></tr>';
- echo '<tr><td colspan="2">cata účet: <input type="text" id="transf_wtc_account_cata" name="transf_wtc_account_cata" value="" /><br /><br /></td></tr>';
- echo '<tr><td colspan="2">Tímto stvrzujete, že žádáte o převedení postav na cataclysm realm. Postavy Vám budou v tento okamžik odebrány z účtu, ponechány v záloze a v nejbližším možném termínu převedeny na cataclysm realm.</td></tr>';
- echo '<tr><td colspan="2"><input type="submit" name="submit_transfer_wtc_send" value="zažádat o převod postav" onclick="return transferSecoundCheck()"></td></tr>';
- echo '</table></form>';
- } else {
- echo '<br />chyba přístupu na účet';
- }
- } else {
- echo '<br />nelze převést charactery ze zabanovaného účtu';
- }
- break;
- }
- case 2:
- {
- $id = $_GET['id'];
- $cata_char = $_GET['cc'];
- $faze = $_GET['faze'];
- if(is_numeric($id)) {
- $newCharGuid=$dibiC->query("SELECT guid FROM characters WHERE online = '0' AND name = %s", $cata_char)->fetchSingle();
- if($newCharGuid) {
- $array = dibi::query("SELECT * FROM web2_transfer_wtc WHERE id = %i",$id)->fetch();
- $character = $array['character'];
- $characters=$dibiCT->query("SELECT * FROM characters WHERE name = %s",$character)->fetch();
- switch($faze) {
- case 1:
- {
- session_start();
- $_SESSION['changes']=null;
- $faze = $array['status'];
- if($faze == 0) {
- /*
- * lets transfer begin
- */
- // step 1. money
- $dibiC->query("UPDATE characters SET money = %i",$characters['money']," WHERE guid = %i",$newCharGuid);
- // step 2. skilly - fishing(356), archaeology(794),cooking(185),first aid(129)
- $skills=$dibiCT->query("SELECT * FROM character_skills WHERE guid = %i",$characters['guid'])->fetchAll();
- $onlyThisSkills = array('356','794','185','129','171','164','333','202','182','773','755','165','186','393','197','762');
- foreach($skills as $r) {
- if(in_array($r['skill'],$onlyThisSkills)) {
- $dibiC->query("DELETE FROM character_skills WHERE guid = %i",$newCharGuid, " AND skill = %i",$r['skill']);
- $r['guid']=$newCharGuid;
- $dibiC->query("INSERT INTO character_skills ",$r);
- }
- }
- // step 3. spelly
- $notSpells=array('688','712','697','691');
- $spells=$dibiCT->query("SELECT * FROM character_spell WHERE guid = %i",$characters['guid'])->fetchAll();
- foreach($spells as $r) {
- if(!in_array($r['spell'],$notSpells)) {
- $dibiC->query("DELETE FROM character_spell WHERE guid = %i",$newCharGuid," AND spell = %i",$r['spell']);
- $r['guid']=$newCharGuid;
- $dibiC->query("INSERT INTO character_spell ",$r);
- }
- }
- // step 4. reputation
- $reputation=$dibiCT->query("SELECT * FROM character_reputation WHERE guid = %i",$characters['guid'])->fetchAll();
- foreach($reputation as $r) {
- $dibiC->query("DELETE FROM character_reputation WHERE guid = %i",$newCharGuid," AND faction = %i",$r['faction']);
- $r['guid']=$newCharGuid;
- $dibiC->query("INSERT INTO character_reputation ",$r);
- }
- dibi::query("UPDATE web2_transfer_wtc SET status = '1' WHERE id = %i",$id);
- } else {
- // TODO: notice - character has been transfered yet via phase 1
- }
- break;
- }
- case 2:
- {
- $faze = $array['status'];
- if($faze == 1) {
- $notQuest=array('1599','1598');
- $quests=$dibiCT->query("SELECT * FROM character_queststatus WHERE guid = %i",$characters['guid'])->fetchAll();
- $questsRewarded=$dibiCT->query("SELECT * FROM character_queststatus_rewarded WHERE guid = %i",$characters['guid'])->fetchAll();
- foreach($quest as $r) {
- if(!in_array($r['quest'],$notQuest)) {
- $r['guid']=$newCharGuid;
- $dibiC->query("INSERT INTO character_queststatus ",$r);
- }
- }
- foreach($questsRewarded as $r) {
- if(!in_array($r['quest'],$notQuest)) {
- $r['guid']=$newCharGuid;
- $dibiC->query("INSERT INTO character_queststatus_rewarded ",$r);
- }
- }
- dibi::query("UPDATE web2_transfer_wtc SET status = '2' WHERE id = %i",$id);
- } else {
- // TODO: notice - character has been transfered yet via phase 2
- }
- break;
- }
- case 3:
- {
- $faze = $array['status'];
- // TODO: pro test zakomentovano if($faze == 2) {
- // erase all items on new char
- $delThis=$dibiC->query("SELECT item FROM character_inventory WHERE guid = %i",$newCharGuid)->fetchAll();
- foreach($delThis as $r) { $del[]=$r['item']; }
- $delThisIn=implode("','",$del);
- $delThisIn="'".$delThisIn."'";
- $dibiC->query("DELETE FROM character_inventory WHERE guid = %i",$newCharGuid);
- $dibiC->query("DELETE FROM item_instance WHERE guid IN (",$delThisIn,")");
- $dibiC->query("DELETE FROM mail WHERE receiver = %i",$newCharGuid);
- $dibiC->query("DELETE FROM mail_items WHERE receiver = %i",$newCharGuid);
- // step 5. itemy - nahrat pouze bagy a veci na charu, zapamatovat si ID bagu ( to stare + nove radej )
- $items=$dibiCT->query("SELECT * FROM character_inventory WHERE guid = %i",$characters['guid'])->fetchAll();
- foreach($items as $r) {
- $temp[]=$r['item'];
- }
- $in=implode("','", $temp);
- $in="'".$in."'";
- $instances=$dibiCT->query("SELECT * FROM item_instance WHERE guid IN (",$in,")")->fetchAll();
- foreach($instances as $r) {
- $ii[$r['guid']] = $r;
- }
- foreach($items as $r) {
- transferThisItemChar($r);
- }
- unset($r);
- /*foreach($changes as $k=>$r) {
- $dibiC->query("UPDATE character_inventory SET bag = %i",$r," WHERE bag = %i",$k," AND guid = %i",$newCharGuid);
- }*/
- // TODO: pro test zakomentovano } else {
- // TODO: notice - character has been transfered yet via phase 2
- // TODO: pro test zakomentovano }
- break;
- }
- case 4:
- {
- $faze = $array['status'];
- // TODO: pro test zakomentovano if($faze == 3) {
- // step 5. itemy
- /*$items=$dibiCT->query("SELECT * FROM character_inventory WHERE guid = %i",$characters['guid'])->fetchAll();
- foreach($items as $r) {
- $temp[]=$r['item'];
- }
- $in=implode("','", $temp);
- $in="'".$in."'";
- $instances=$dibiCT->query("SELECT * FROM item_instance WHERE guid IN (",$in,")")->fetchAll();
- foreach($instances as $r) {
- $ii[$r['guid']] = $r;
- }
- foreach($items as $r) {
- transferThisItemBank($r);
- }
- unset($r);
- foreach($changes as $k=>$r) {
- $dibiC->query("UPDATE character_inventory SET bag = %i",$r," WHERE bag = %i",$k," AND guid = %i",$newCharGuid);
- }
- */
- session_start();
- var_export($_SESSION);
- // TODO: pro test zakomentovano }
- break;
- }
- }
- } else {
- // TODO: notice - character is online or was not created
- }
- // DEPRECIATED
- // 3444 port wotlk, 3443 port cata, 3445 port cata test
- /*
- $array = dibi::query("SELECT * FROM web2_transfer_wtc WHERE id = %i",$id)->fetch();
- $character = $array['character'];
- $account_cata = $array['account_cata'];
- $prevedeno = $array['status'];
- if(!$prevedeno) {
- send_ra_command($var['account']['gm']['username'], $var['account']['gm']['password'], '89.185.235.181', 3445, 'pdump write /home/kalgul/'.$character.'.sql '.$character);
- send_ra_command($var['account']['gm']['username'], $var['account']['gm']['password'], '89.185.235.181', 3443, 'pdump load /home/kalgul/'.$character.'.sql '.$account_cata);
- }
- */
- }
- break;
- }
- case 3:
- {
- $input = $_GET['i'];
- // $input = '2097152 249024 33554432 199280668 8704 0'; // koval
- $inputs = explode(' ',$input);
- function idTitle($inGameOrder)
- {
- $idTitles = array('1'=>'1',
- '2'=>'2',
- '3'=>'3',
- '4'=>'4',
- '5'=>'5',
- '6'=>'6',
- '7'=>'7',
- '8'=>'8',
- '9'=>'9',
- '10'=>'10',
- '11'=>'11',
- '12'=>'12',
- '13'=>'13',
- '14'=>'14',
- '15'=>'15',
- '16'=>'16',
- '17'=>'17',
- '18'=>'18',
- '19'=>'19',
- '20'=>'20',
- '21'=>'21',
- '22'=>'22',
- '23'=>'23',
- '24'=>'24',
- '25'=>'25',
- '26'=>'26',
- '27'=>'27',
- '28'=>'28',
- '29'=>'42',
- '30'=>'43',
- '31'=>'44',
- '32'=>'45',
- '33'=>'46',
- '34'=>'47',
- '35'=>'48',
- '36'=>'53',
- '37'=>'62',
- '38'=>'63',
- '39'=>'64',
- '40'=>'71',
- '41'=>'72',
- '43'=>'74',
- '44'=>'75',
- '45'=>'76',
- '46'=>'77',
- '47'=>'78',
- '48'=>'79',
- '49'=>'80',
- '42'=>'81',
- '50'=>'82',
- '51'=>'83',
- '52'=>'84',
- '53'=>'85',
- '54'=>'86',
- '55'=>'87',
- '57'=>'89',
- '58'=>'90',
- '59'=>'91',
- '60'=>'92',
- '61'=>'93',
- '62'=>'94',
- '63'=>'95',
- '64'=>'96',
- '65'=>'97',
- '66'=>'98',
- '67'=>'99',
- '68'=>'100',
- '69'=>'101',
- '70'=>'102',
- '71'=>'103',
- '72'=>'104',
- '73'=>'105',
- '74'=>'106',
- '75'=>'107',
- '76'=>'108',
- '77'=>'109',
- '78'=>'110',
- '79'=>'111',
- '80'=>'112',
- '81'=>'113',
- '82'=>'114',
- '83'=>'115',
- '84'=>'116',
- '85'=>'117',
- '86'=>'118',
- '87'=>'119',
- '88'=>'120',
- '89'=>'121',
- '90'=>'122',
- '91'=>'123',
- '92'=>'124',
- '93'=>'125',
- '94'=>'126',
- '95'=>'127',
- '96'=>'128',
- '97'=>'129',
- '98'=>'130',
- '99'=>'131',
- '100'=>'132',
- '101'=>'133',
- '102'=>'134',
- '103'=>'135',
- '104'=>'137',
- '105'=>'138',
- '106'=>'139',
- '107'=>'140',
- '108'=>'141',
- '109'=>'142',
- '110'=>'143',
- '111'=>'144',
- '112'=>'145',
- '113'=>'146',
- '114'=>'147',
- '115'=>'148',
- '116'=>'149',
- '117'=>'150',
- '118'=>'151',
- '119'=>'152',
- '120'=>'153',
- '121'=>'154',
- '122'=>'155',
- '123'=>'156',
- '56'=>'157',
- '124'=>'158',
- '125'=>'159',
- '126'=>'160',
- '127'=>'161',
- '128'=>'163',
- '129'=>'164',
- '130'=>'165',
- '131'=>'166',
- '132'=>'167',
- '133'=>'168',
- '134'=>'169',
- '135'=>'170',
- '136'=>'171',
- '137'=>'172',
- '138'=>'173',
- '139'=>'174',
- '140'=>'175',
- '141'=>'176',
- '142'=>'177');
- return $idTitles[$inGameOrder];
- }
- function zakoduj($idGameOrder)
- {
- $data['saveIndex'] = floor($idGameOrder/32);
- $data['flag'] = 1 << ($idGameOrder%32);
- return $data;
- }
- function obsahuje($data)
- {
- global $inputs;
- if($data['flag'] == $inputs[$data['saveIndex']]) {
- return true;
- } else {
- $check = $data['flag'] & $inputs[$data['saveIndex']];
- if($check) {
- return true;
- }
- }
- return false;
- }
- for($i=1;$i<=131;$i++) {
- $idGameOrders[$i] = $i;
- }
- foreach($idGameOrders as $key=>$val) {
- $data = zakoduj($val);
- if(obsahuje($data)) {
- $idExistTitleOrder[] = $val;
- }
- }
- foreach($idExistTitleOrder as $val) {
- echo '.title add '.idTitle($val).'<br />';
- }
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement