美文网首页
武神传说wsmud辅助脚本开发(9)-gomap

武神传说wsmud辅助脚本开发(9)-gomap

作者: laputa19 | 来源:发表于2018-11-08 14:16 被阅读1237次

    接下来准备处理最难搞的衙门追捕任务。
    有几个难点:

    • 准确找到逃犯所在地方
    • 逃犯可能移动
    • 地方有可能重名
      先解决第一个问题。
      首先需要穷举地图数据
    maps={
      "武当派":{
          "广场":["",""],
          "三清殿":["","go north"],
          "石阶":["","go west"],
          "练功房":["","go west","go west"],
          "太子岩":["","go west","go northup"],
          "桃园小路":["","go west","go northup","go north"],
          "舍身崖":["","go west","go northup","go north","go east"],
          "南岩峰":["","go west","go northup","go north","go west"],
          "乌鸦岭":["南岩峰","go northup"],
          "五老峰":["南岩峰","go northup","go northup"],
          "虎头岩":["南岩峰","go northup","go northup","go northup"],
          "朝天宫":["南岩峰","go northup","go northup","go northup","go north"],
          "三天门":["南岩峰","go northup","go northup","go northup","go north","go north"],
          "紫金城":["南岩峰","go northup","go northup","go northup","go north","go north","go north"],
          "林间小径":["紫金城","go north"],
          "林间小径1":["","go north"],   //相对林间小径
          "后山小院":["紫金城","go north","go north","go north"]
      },
      "少林派":{
          "广场":["",""],
          "山门殿":["","go north"],
          "西侧殿":["","go north","go west"],
          "东侧殿":["","go north","go east"],
          "天王殿":["","go north","go north"],
          "大雄宝殿":["","go north","go north","go northup"],
          "鼓楼":["","go north","go north","go northwest"],
          "钟楼":["","go north","go north","go northeast"],
          "后殿":["","go north","go north","go northeast","go northwest"],
          "练武场":["","go north","go north","go northeast","go northwest","go north"],
          "般若堂":["","go north","go north","go northeast","go northwest","go north","go west"],
          "罗汉堂":["","go north","go north","go northeast","go northwest","go north","go east"],
          "方丈楼":["练武场","go north"],
          "达摩院":["练武场","go north","go west"],
          "戒律院":["练武场","go north","go east"],
          "竹林":["练武场","go north","go north"],
          "竹林1":["","go north"],
          "藏经阁":["练武场","go north","go north","go west"],
          "达摩洞":["练武场","go north","go north","go north","go north"],
          
      },
      "华山派":{
          "镇岳宫":["",""],
          "苍龙岭":["","go eastup"],
          "舍身崖":["","go eastup","go southup"],
          "峭壁":["","go eastup","go southup","jumpdown"],
          "山谷":["","go eastup","go southup","jumpdown","go southup"],
          "山间平地":["","go eastup","go southup","jumpdown","go southup","go south"],
          "林间小屋":["","go eastup","go southup","jumpdown","go southup","go south","go east"],
          "玉女峰":["","go westup"],
          "练武场":["","go westup","go north"],
          "练功房":["","go westup","go north","go east"],
          "客厅":["","go westup","go north","go north"],
          "偏厅":["","go westup","go north","go north","go east"],
          "寝室":["","go westup","go north","go north","go north"],
          "玉女祠":["","go westup","go west"],
          "玉女峰山路":["","go westup","go south"],
          "玉女峰小径":["","go westup","go south","go southup"],
          "思过崖":["","go westup","go south","go southup","go southup"],
          "山洞":["","go westup","go south","go southup","go southup","break bi","go enter"],
          "长空栈道":["","go westup","go south","go southup","go southup","break bi","go enter","go westup"],
          "落雁峰":["","go westup","go south","go southup","go southup","break bi","go enter","go westup","go westup"],
          "华山绝顶":["","go westup","go south","go southup","go southup","break bi","go enter","go westup","go westup","jumpup"],
      },
      "峨眉派":{
          "金顶":["",""],
          "睹光台":["","go northup"],
          "华藏庵":["","go northup","go east"],
          "庙门":["","go west"],
          "广场":["","go west","go south"],
          "大殿":["","go west","go south","go south"],
          "走廊":["","go west","go south","go east"],
          "走廊1":["","go west","go west"],
          "走廊2":["","go north"],
          "走廊3":["","go south","go south"],
          "练功房":["","go west","go south","go west","go west"],
          "清修洞":["","go west","go south","go west","go south","go south"],
          "小屋":["","go west","go south","go west","go north","go north"],
          "厨房":["","go west","go south","go east","go east"],
          "休息室":["","go west","go south","go east","go south"],
         
      },
      "逍遥派":{
          "青草坪":["",""],
          "林间小道":["","go north"],
          "林间小道1":["","go south","go south"],  
          "林间小道2":["","go north","go east"],  
          "林间小道3":["","go west","go west"], 
          "木屋":["","go north","go north"],
          "木屋1":["","go south","go south","go south","go south"],
          "休息室":["","go west","go south"],
          "练功房":["","go east","go north"],
          "木板路":["","go east","go south"],
          "工匠屋":["","go east","go south","go south"],
          "地下石室":["","go down"],
          "地下石室1":["","go down"],
      },
      "丐帮":{
          "树洞内部":["",""],
          "树洞下":["","go down"],
          "暗道":["","go down","go east"],
          "暗道1":["","go east"],
          "破庙密室":["","go down","go east","go east","go east"],
          "土地庙":["","go down","go east","go east","go east","go up"],
          "暗道2":["","go east","go east"],
          "暗道3":["","go east"],
          "林间小屋":["","go down","go east","go east","go east","go east","go east","go up"],
      }
    }
    

    然后就是分门派来处理,使用递归函数来简化地图数据

    function gomap(fname,mname){
         //根据任务的门派进入相应地图
          if(fname.indexOf("武当派") != -1){
              cmd("jh fam 1 start");  //武当
          }
          else if (fname.indexOf("少林派") != -1){
              cmd("jh fam 2 start");  
          }
          else if (fname.indexOf("华山派") != -1){
              cmd("jh fam 3 start");  
          }
          else if (fname.indexOf("峨眉派") != -1){
              cmd("jh fam 4 start");  
          }
          else if (fname.indexOf("逍遥派") != -1){
              cmd("jh fam 5 start");  
          }
          else if (fname.indexOf("丐帮") != -1){
              cmd("jh fam 6 start");  
          }
          gomapa(fname,mname);
    }
    
    function gomapa(fname,mname){ //这是一个递归函数
          //前置地点
          pre=maps[fname][mname][0];
          if (pre != ""){
              gomapa(fname,pre);
          }
          for (var i=1,len=maps[fname][mname].length; i<len; i++){
              c=maps[fname][mname][i];
              //console.log(c);
              cmd(c);
          }
    }
    

    对于重名的地方,依次增加后缀,采用相对寻址

    相关文章

      网友评论

          本文标题:武神传说wsmud辅助脚本开发(9)-gomap

          本文链接:https://www.haomeiwen.com/subject/jnkwxqtx.html