關閉自動任務 id = 0
代客泊車 id:1, req:1
賣翻版DVD id:2, req:3
幫財務公司收數 id:3, req:5
麻將館睇埸 id:4, req:7
走水貨返大陸 id:5, req:10
偷車 id:6, req:12
放貴利 id:7, req:14
打劫銀行 id:8, req:16
連環洗劫金鋪 id:9, req:20
綁架重要人物 id:10, req:25
走私毒品 id:11, req:30
經營外圍投注 id:12, req:35
this.renwu_selece_id = 5; //修改任務
this.renwu_selece_reg = 10; //修改體力
// ==UserScript==
// @name cx-sf-t1
// @description by CX, neo@orz.hk, Moochi, 真正john
// @namespace http://apps.facebook.com/street-fights/
// @include http://apps.facebook.com/street-fights/job.php
// @include http://apps.facebook.com/street-fights/bank.php
//2009-8/28 cx-sf-t1 Version 0.1 by cx
// ==/UserScript==
/*pf
Requirement:
- Firefox 3.0.1 or better
- Firefox plugin: Greasemonkey
- Facebook w/ the new interface
function sf_obj() 設定任務,和體力
renwu_selece: id & reg
義氣仔女Online
關閉自動任務 id = 0
代客泊車 id:1, req:1
賣翻版DVD id:2, req:3
幫財務公司收數 id:3, req:5
麻將館睇埸 id:4, req:7
走水貨返大陸 id:5, req:10
偷車 id:6, req:15
放貴利 id:7, req:18
打劫銀行 id:8, req:25
連環洗劫金鋪 id:9, req:30
代客泊車 id:1, req:1
賣翻版DVD id:2, req:3
幫財務公司收數 id:3, req:5
麻將館睇埸 id:4, req:7
走水貨返大陸 id:5, req:10
偷車 id:6, req:12
放貴利 id:7, req:14
打劫銀行 id:8, req:16
連環洗劫金鋪 id:9, req:20
綁架重要人物 id:10, req:25
走私毒品 id:11, req:30
經營外圍投注 id:12, req:35
*/
var job = "http://apps.facebook.com/street-fights/job.php";
var bank = "http://apps.facebook.com/street-fights/bank.php";
var page = "";
if(location.href == job){
page = "job";
}else{
page = "bank";
}
/*****************/
//樣板 template
function template_sf_info(){//sfobj.my_data['level']
this.template_info_data;
//this.template_info_data = sfobj.my_data['level'];
//alert(my_data['level']);
//location.href
template_info_data = "
義氣仔女Online, 頁面:"+ page +" | |||
功能: | 任務,存錢 | ||
修改自neo@orz.hk,by CX | |||
等級: | " + sfobj.my_data['level']+" | ||
體力: | " + sfobj.my_data['en']+" | ||
剩下: | " + sfobj.my_data['-exp']+"經驗值 | ||
生命: | " + sfobj.my_data['hp']+" | ||
現金: | " + sfobj.now_money+" | ||
執行任務: | " + sfobj.renwu_selece_id+" | ||
體力上線: | " + sfobj.renwu_selece_reg+" | ||
自動存款: | " + sfobj.money+" | ||
更新時間: | " + sfobj.time+" (S)"+" |
return this.template_info_data;
}
function template_sf_set(){
var template_set_data;
template_set_data = "";
return template_set_data;
}
function div_template(id){
var backgroundcolor = '#ffeeee';
this.htmlElement = document.createElement('div');
this.htmlElement.id = id;
this.htmlElement.style.top = '56px';//向上的高度
this.htmlElement.style.right = '2px';
this.htmlElement.style.position = 'absolute';
this.htmlElement.style.width = '160px';
this.htmlElement.style.height = '230px';
this.htmlElement.style.background = backgroundcolor;
this.htmlElement.style.font = '11px arial';
this.htmlElement.style.color = 'grey';
this.htmlElement.style.textAlign = 'center';
this.htmlElement.style.zIndex = 100;
this.run = function() { //obj is window
//alert(this.htmlElement.zIndex);
//window.parent.document.body.appendChild(this.htmlElement);
window.parent.document.body.appendChild(this.htmlElement);
};
};
function sf_obj(){
this.action = null;
this.action_link = null;
this.env = null;
this.renwu_selece_id = 5;//修改任務
this.renwu_selece_reg = 10;//修改體力
this.htmldata = "";
this.my_info = new Array(20);
this.my_data = new Array(20);
this.money = 1000;
this.ren_io = false;
this.money_io = false;
this.time = 30000;
this.get_my_info = function(htdata){
//this.str = new RegExp('現金:[^v]+').exec(document.getElementById('app17326627347_main').innerHTML);
this.str = new RegExp('現金:[^v]+').exec(htdata);
//this.my_info['cash'] = parseInt(sf_str.toString(10).split('$')[1].split('<')[0].replace(/,/g,""),10);
this.now_money = parseInt(this.str.toString(10).split('$')[1].split('<')[0].replace(/,/g,""),10);
//alert(this.now_money);
this.str = null;
this.my_info['level'] = htdata.match(/等級:<\/span>([0-9]{1,3})/);
this.my_info['exp'] = htdata.match(/EXP:<\/span>([0-9]{1,10})\/([0-9]{1,10})/);
this.my_info['hp'] = htdata.match(/生命:<\/span>([0-9]{0,10})\/([0-9]{1,3})/);
this.my_info['sta'] = htdata.match(/精神:<\/span>([0-9]{0,10})\/([0-9]{1,3})/);
this.my_info['en'] = htdata.match(/體力:<\/span>([0-9]{1,3})\/([0-9]{1,3})/);
//this.my_info['cash'] = htdata.match(/現金:<\/span>\$(.*?)<\/span>/);
this.my_info['cash'] = this.now_money;
this.my_info['level'][1] = parseInt(this.my_info['level'][1]);
this.my_info['hp'][1] = parseInt(this.my_info['hp'][1]);
this.my_data['level'] = this.my_info['level'][1];
this.my_data['exp'] = this.my_info['exp'][1];
this.my_data['-exp'] = this.my_info['exp'][2] - this.my_info['exp'][1];
this.my_data['hp'] = this.my_info['hp'][1];
this.my_data['hp_all'] = this.my_info['hp'][2];
this.my_data['sta'] = this.my_info['sta'][1];
this.my_data['en'] = this.my_info['en'][1];
this.my_data['cash'] = this.my_info['cash'][1];
//alert(this.my_data['cash']);
};
this.Renwu = function(id_exit){//0 is exit
if(page != "job"){return 0;}
//alert("p"+this.renwu_selece_reg);
//if(!this.renwu_selece_reg){return this.renwu_selece_reg;}
//alert("p"+this.my_data['en']);
if(this.my_data['en'] >= this.renwu_selece_reg && this.my_data['en'] != null){
this.action = document.getElementById('app17326627347_mod_action-' + this.renwu_selece_id);
if(this.action.getElementsByTagName('a')[0] == null){location.href = job;}
this.action_link = this.action.getElementsByTagName('a')[0];
this.evt = document.createEvent("MouseEvents");
this.evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
this.action_link.dispatchEvent(this.evt);
}
}
this.save_money = function(id_exit){//0 is exit
if(page != "bank"){return 0;}
if (document.getElementsByName("amount").length > 1) {
document.getElementsByName("deposit")[0].click();
//alert("m");
return;
}
}
};
function post(url, data, cb) {
GM_xmlhttpRequest({
method: "POST",
url: url,
headers:{'Content-type':'application/x-www-form-urlencoded'},
data:encodeURI(data),
onload: function(xhr) { cb(xhr.responseText); }
});
}
/*ex
post('http://www.flash-mx.com/mm/viewscope.cfm', 'userid=joe&password=guessme', function(text) {
alert('HTML of the page:' + text)
})
*/
var last_check = new Date();
var sfobj = new sf_obj();
var div1 = new div_template("window1");
div1.run();
//sfobj.save_money();
function cx_run(){
GM_xmlhttpRequest({
method: 'GET',
url: 'http://apps.facebook.com/street-fights/job.php',
headers: {
'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey',
'Accept': 'application/atom+xml,application/xml,text/xml',
},
onload: function(responseDetails) {
var html_data = responseDetails.responseText;
sfobj.get_my_info(html_data);//1
//alert(sfobj.my_info['level']);
//alert(sfobj.my_data['level']);
//get_my_info(html_data);
//Renwu();
var tmp1 = sfobj.now_money;
var tmp2 = sfobj.money;
//alert(tmp1+" : "+tmp2);
//alert(tmp1 > tmp2);
if(sfobj.now_money > sfobj.money){
if(page != "bank"){
location.href = bank;
//alert("t0");
}
sfobj.save_money();
//alert("t1");
}else if(sfobj.now_money != null){
//alert("t3");
if(page != "job"){location.href = job;}
sfobj.Renwu();
}
/*
var now_date =new Date();
last_check = now_date;
now_date = null;
*/
//window.setTimeout(function() { cx_run(); }, 30000);
}
});
}
function main_fun(){
var current = new Date();
var seconds = (current - last_check) / 1000;
sfobj.time = parseInt(30-seconds);
if(sfobj.time <= 0){
last_check = current;
window.setTimeout(function() { cx_run(); }, 500);
}
div1.htmlElement.innerHTML = template_sf_info();
window.setTimeout(function() { main_fun(); }, 1000);
}
div1.htmlElement.innerHTML = '
Initializing . . .' ;
//*****htmlElement.innerHTML = '
Initializing . . .' ;
window.setTimeout(function() { cx_run(); }, 500);
window.setTimeout(function() { main_fun(); }, 1000);
沒有留言:
張貼留言