这里问的东西基本上是老百宝有的,哪位能把老百宝的东西发上来
老百宝已经打不开了,希望各位能把以前下的都发上来
我提供的压缩包可能有你要的东西
但我没有测试过
string kongfu="乾坤大挪移";
#define lifemed "金创药(中)"//红药的种类
#define magicmed "魔法药(中)"//蓝药的种类
int redMedicine = 50;//红药的数量
int blueMedicine = 1500;//蓝药的数量
int fight_flag = 1;
int totalUse = 0;
int totalSuccess = 0;
int failedtimes = 1;
int start_time = time();
int break_time = 4 ;//可以自己修改时间间隔
int now_time = time();
//设置连续使用技能失败次数〉设定的次数,就可以认为处于断线状态,可以自己修改
#define offline_time 40
array x_center = ({141,150,167,181});
array y_center = ({240,256,207,220});
int gotoCity(string mycityname);
mixed gotoNPC(string item_name);
mixed prepare();
void run_to_destination(int i);
mixed getSkillMonster();
int checkMedicine();
int practice(mapping monster);
mixed calc_practice_location(mapping monster);
void closeToMonster(mapping monster);
create_thread("DouZhuan","go");
mixed go() {
int i=0;
for(i=0;i<sizeof(x_center);i++) {
if(checkMedicine()==0) prepare();
run_to_destination(i);
sleep(1);
mixed ret = getSkillMonster();
if(ret!=0) {
mapping monster = (mapping)ret;
closeToMonster(monster);
practice(monster);
}
if(i==(sizeof(x_center)-1)) i=0;
}
}
mixed prepare() {
gotoCity("比奇县");
if(checkMedicine()==0) {
//买药
tell_user("药品不足,去买药...\n");
mapping npc;
close_to_npc("potion", &npc);
talk_to(npc);
talk_to(npc, "@buy");
buy_item(lifemed, redMedicine, &npc );
talk_to(npc);
talk_to(npc, "@buy");
buy_item(magicmed, blueMedicine, &npc );
tell_user("买好了,又重新开始练了哈...\n");
}
}
int checkMedicine() {
int i=0;
int rcount = 0;
int bcount = 0;
int size = sizeof(me()["carry"]);
for(i=0;i<size;i++) {
if(me()["carry"]["name"]==lifemed) {
rcount = me()["carry"]["amount"];
}
if(me()["carry"]["name"]==magicmed) {
bcount = me()["carry"]["amount"];
}
}
if(rcount<=5||bcount<=1) return 0;
else return 1;
}
void run_to_destination(int i) {
tell_user(sprintf("前往练功点:(%d,%d)",x_center,y_center));
run_close_to (x_center, y_center, 2);
}
mixed getSkillMonster() {
int i;
array ks = keys(all_objects);
for(i = 0; i < sizeof(all_objects); i++){
mapping monster = all_objects[ks];
if(monster["type"] == OBJECT_TYPE_MONSTER&&(monster["name"]=="羊"||monster["name"]=="牛"||monster["name"]=="猪"||monster["name"]=="鸡")){
tell_user(sprintf("发现练功怪物 %s 出现...选择该怪物为目标进行练习。\n", monster["name"]));
return monster;
}
}
return 0;
}
void closeToMonster(mapping monster){
int distance = calc_offset(monster, me());
mixed route = calc_route(me()["x"], me()["y"],monster["x"], monster["y"],0);
if(route==0||sizeof(route)>10) {
tell_user(sprintf("到达怪物 %s 的距离太远,或者无法到达。",monster["name"]));
tell_user(sprintf("到达怪物 %s 需要行进 %d 步",monster["name"],sizeof(route)));
return;
}
if(distance>5) {
run_close_to(monster["x"],monster["y"],3);
}
}
int gotoCity(string cityname) {
tell_user(sprintf("前往城市:%s",cityname));
int success = goto_city(cityname,0,0);
if(success==0) tell_user(sprintf("无法到达指定城市:%s",cityname));
return success;
}
mixed calc_practice_location(mapping monster) {
int monsterx = monster["x"];
int monstery = monster["y"];
int mex = me()["x"];
int mey = me()["y"];
int xdiv = monsterx - mex;
int ydiv = monstery - mey;
array faces = ({
(["x":1,"y":1]),(["x":1,"y":-1]),(["x":-1,"y":1]),(["x":-1,"y":-1])
});
int i=0;
mixed ret = 0;
for(i=0;i<sizeof(faces);i++) {
int targetx = mex - xdiv*3*faces["x"];
int targety = mey - ydiv*3*faces["y"];
printf("%d,%d\n",targetx,targety);
ret =(["x":targetx,"y":targety]);
mixed route = calc_route(me()["x"], me()["y"],ret["x"], ret["y"],0);
if(route!=0&&sizeof(route)<10&&calc_offset(ret,me())>1) return ret;
}
return ret;
}
int practice(mapping monster) {
int distance = calc_offset(monster, me());
int monsterx = monster["x"];
int monstery = monster["y"];
while(!monster["died"]&&distance<=5) {
int trytimes = 0;
while(distance==1) {
if(checkMedicine()==0) return 0;
tell_user("距离太近,跑远些...");
mixed ret = calc_practice_location(monster);
if(ret==0) {
tell_user("算不清楚位置了,去下一个地方好了...");
return 0;
}
mapping target = (mapping)ret;
sleep(1);
run_close_to(target["x"],target["y"],1);
distance = calc_offset(monster, me());
printf("%d\n",distance);
}
while(time()-now_time<break_time) {
sleep(1);
}
tell_user(sprintf("对距离 %d 步的 %s 使用 %s...",distance,monster["name"],kongfu));
cast(monster["id"],kongfu);
trytimes++;
now_time=time();
sleep(1);
distance = calc_offset(monster, me());
if(distance==1) {
totalSuccess++;
failedtimes=1;
totalUse++;
int t_now = time();
float hours = ((float)t_now - (float)start_time)/3600.0;
float rate = 0.0;
float successRate = (float)totalSuccess/(float)totalUse*100;
if(hours>0.1) rate = (float)totalSuccess/hours;
tell_user("哈哈,成功了!我真是天才啊!");
tell_user(sprintf("在过去的 %f 小时里,共使用( %s ) %d 次,成功 %d 次。",hours,kongfu,totalUse,totalSuccess));
tell_user(sprintf("成功率 %f %, 平均每小时成功 %f 次。",successRate,rate));
run_close_to(monsterx,monstery,1);
distance = calc_offset(monster, me());
monsterx=monster["x"];
monstery=monster["y"];
} else {
tell_user(sprintf("失败--------不怕,偶继续...第 %d 次",failedtimes));
totalUse++;
failedtimes++;
if(trytimes>20) {
tell_user("有问题,换个地方再练撒");
}
if(failedtimes>offline_time) {
tell_user("失去服务器的响应,重新连接游戏\n");
failedtimes=1;
restart_game(0);
}
}
}
return 0;
}
void beat_to_die(mapping attacker)
{
int id = attacker["id"];
while(!attacker["died"]) {
sleep(1);
run_to(all_objects[id]["x"], all_objects[id]["y"]);
if(hit(attacker))
tell_user("攻击怪物%s\n", attacker["name"]);
}
}
void on_attack_by(mapping attacker, int damaged)
{
if(fight_flag) {
tell_user("练功被怪物攻击,反击\n");
delete_thread("fight");
create_thread("fight", "beat_to_die", attacker);
fight_flag = 0;
}
}
void on_acquire_exp(int got_exp, int weapon_exp)
{
fight_flag = 1;
delete_thread("fight");
tell_user("怪物被杀死,重新练功\n");
delete_thread("DouZhuan");
create_thread("DouZhuan","go");
}
void on_enter_world()
{
delete_thread("DouZhuan");
create_thread("DouZhuan","go");
}
private void destruct()
{
printf("停止练习。\n");
delete_thread("DouZhuan");
}
[ 本帖最后由 caihemm 于 2006-3-20 13:23 编辑 ]
附件: 您所在的用户组无法下载或查看附件