Skip to content
질문/답변다크 모드

d2jsp 카우방 여는 방법 좀 알려주세요..

조회 수
964
추천 수
0
등록일

안녕하세요. 이리 저리 알아보고 있는데 조금 막막해서 글 남겨봅니다.


1.11프리서버이구요. 프리서버 특성상 카우방을 위트족+포탈책이 아닌 포탈스크롤만 큐빙해서 카우를 여는데요.


관련 글을 검색해보니 비슷한 내용이 있긴 하나 d2nt용이라 해결을 못했네요..


//////////////////////////////////////////////////////////////////////
//
// Xizeta's CowsXP script
// Moo moo Farm runs bot script.
//
// The script will use any char.
//
// It is suggested to keep a Tome of Identification in
// inventory to make it work better.
//
// Updated on 2006/03/22
//
// Original authors : Xizeta, YAMB team
// Collaboration : Ven0m, Muellsammler, Darien, Killkeeper, Damoon, HellNucleus,
//                 DaBeerMan, Gill_105, Syadasti, Smoke and others :)
//
// Legal stuff :
// 1. D2jsp is NOT free, to use it you MUST pay 25$ to njaguar ( see details at www.d2jsp.org ) and d2jsp software
//    must ONLY be used with a legit and paid for d2jsp.key which can only be obtained by paying.
// 2. You may NOT redistribute this or any files which resides on the site www.d2jsp.org in any way what so ever
//    including but not limited to making it available for download/upload to anyone without the expressed consent
//    ( in writing or otherwise ) of the authors of the files. All headers and text documents must remain and contents stay intact.
//    The usage of scripts, part of scripts and/or files are permitted as long as they are used for scripts
//    which is being hosted at www.d2jsp.org with credit of the authors which made the parts of the scripts or files used.
// 3. MODIFICATIONS for redistribution can only be done by submitting to the core scripters team for approval. If you don't
//    want to submit the modifications you may not redistribute any files from the d2jsp core or scripts
// 4. You may not modify or change the existing code other than for your own personal use.
// 5. Any copies of this software must always be compatible with the current d2jsp-common libs
// 6. The sale of this software is strictly forbidden
// 7. Only a person which has paid for ( or otherwise proven that key was paid for) the d2jsp key
//    to njaguar ( mr Paul Taulborg) may use the scripts and/or files from www.d2jsp.org
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
// or FITNESS FOR A PARTICULAR PURPOSE.
//
//////////////////////////////////////////////////////////////////////






//////////////////////////////////////////////////////////////////////
// ***** NO EDITION BELOW THIS POINT *****
// MESSING WITH THE CODE BELOW WILL MAKE THE SCRIPT
// WORK DIFFERENTLY, WITH BAD RESULTS !!
//////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////
// Script public variables
//////////////////////////////////////////////////////////////////////

// General variables
var WXP_KillRakanishu = true;
var WXP_PortalClearMsg = "Portal clear"; // Display the public message
var WXP_CowPortalMsg = "Portal is now up"; // Message when portal is up
var WXP_OpenOnly = false;   // Set to true to open the portal only and quit
var WXP_WaitForPortal=false;   // Set to true to wait until the portal is open by someone else
var WXP_KillKing = false;   // Do we want to kill the king or not
var WXP_PortalDelay = 1000;   // Delay to wait before entering the portal in Cairn Stones


//////////////////////////////////////////////////////////////////////
// Script private variables
//////////////////////////////////////////////////////////////////////

var _WXP_UseLoader = false;
var _WXP_CanKillKing = false;

// Classes
var commPather = false;


//////////////////////////////////////////////////////////////////////
// CowsXP functions
//////////////////////////////////////////////////////////////////////

function WXP_PickItem(item) {

 for (var x=0; x < 3; x+=1) {

  if (item.mode==3 || item.mode==5) {

   while (me.mode == 7 || me.mode == 8 || (me.mode >= 10 && me.mode <= 16) || me.mode == 18) {

    DC_DoDel(20);
    _totaltime+=20;
    if (_totaltime >= 1000) { break; }
   }

   if (me.mode == 7 || me.mode == 8 || (me.mode >= 10 && me.mode <= 16) || me.mode == 18) { continue; }

   DC_DoClick(0,0,item);

   if (item.mode===0) { return true; }
  }
 }

 DC_DoDel(200);
 if (item.mode===0) { return true; }

 return false;
}

function WXP_GetLeg() {

 // Do precasts before going into the portal
 XP_Precasts();

 // Use the WP to go to the Stony Field
 DM_UsePortal("Waypoint",0x04);

 // Do precasts after going into the portal
 XP_Precasts();

 // Move from WP to Cairn Stones
 _retval = commPather.GotoNPC(737,4,20,false,false);
 if (!_retval) { DC_ThrowException("CowsXP","Unable to path to Cairn Stones"); }

 // If we want to kill Rakanishu, do it now
 if (WXP_KillRakanishu) {

  XP_KillBoss( "Rakanishu", 20, 0x01, false, _WXP_UseLoader );
 }

 // Take portal to Tristram
 delay(WXP_PortalDelay);
 DM_UsePortal("Portal", 38);

 // Go besides Wirt's body
 commPather.GotoDest(25048,5181);

 // Kill monsters around to be safe
 XP_ClearPosition(20);

 // Tele beside Wirt's body if I'm too far
 if (Math.abs(25048 - me.x) > 5 || Math.abs(5181 - me.y) > 5) { commPather.GotoDest(25048,5181); }

 // get the body of Wirt
 var _wirtbody;
 for (var x=0; x < 5; x+=1) {

  _wirtbody=getUnit(2,268);
    if (_wirtbody) { break; }
    delay(50);
   }

 // Throw a exception if no body is found
 if (typeof _wirtbody == "undefined") { DC_ThrowException("CowsXP", "Could not find Wirt's body."); }

 // Interact with Wirt
 for (x=0; x < 3 && _wirtbody.mode != 2; x+=1) {

  DC_DoClick(0,0,_wirtbody);
  delay(500);
 }

 // Get the leg dropped by Wirt's body
 var _leg;
 for (x=0; x < 5; x+=1) {

  _leg=getUnit(4,"leg");
    if (_leg) { break; }
      delay(50);
   }

   if (typeof _leg == "undefined") { DC_ThrowException("CowsXP", "Could not find Wirt's leg."); }

 // Pick the leg
 if (!WXP_PickItem(_leg)) { DC_ThrowException("CowsXP", "Cannot pick Wirt's leg"); }

 // Check for items
 DSN_PickItems();
}

function WXP_OpenPortal() {

 // Make 100% sure we have items because we crash if we don't, choose the right tome

 // Get the extra tome in inventory
 var _xtratome = getUnit(4,"tbk");
 while (_xtratome) {

  if (_xtratome.mode === 0) {

   if (_xtratome.itemloc === 0) {

    var _ignoreitem = (DT_Columns[_xtratome.y][_xtratome.x]===0);
    if (_ignoreitem) {

     if (_xtratome.getNext("tbk")) { continue; }
     else { _xtratome=false; }
    }
   }
  }

  // If the tome is on the ground, pick it
  else if (_xtratome.mode == 3) {

   WXP_PickItem(_xtratome);
   _xtratome = getUnit(4,"tbk");
   continue;
  }
  else {
   if (_xtratome.getNext("tbk")) { continue; }
   else { _xtratome=false; }
  }

  break;
 }

 // if no tome is found, return
 if (!_xtratome) { return "no tome."; }

 // get the leg in inventory
 var _leg=getUnit(4,"leg");
 if (_leg) {

  if (_leg.mode !== 0) {

   if (_leg.mode == 3) {

    WXP_PickItem(_leg);
    _leg=getUnit(4,"leg");
    if (_leg.mode !== 0) { _leg=false; }
   }
   else { _leg=false; }
  }
 }

 // If no leg is found, return
 if (!_leg) { return "No leg found!"; }

 // Get the stash object
 var _mychest = getUnit(2,"bank");
 if (!_mychest) { return "No stash found!"; }

 // Check if we got the cube
 var _mycube = getUnit(4, "box");
 if (!_mycube) { return "No cube. CowsXP requires a cube to run !"; }

 // Clear the cube of any items
 DT_DoInteract(_mychest);
 DCU_CheckInventory();
 DCU_ClearCube();

 // Put leg and tome in cube
 DCU_ReEnterStash();
 DCU_MoveItemToCube(_leg, 0, 0);
 DCU_MoveItemToCube(_xtratome, 1, 0);

 // Transmute
 DT_DoInteract(_mycube);
 DCU_UseCube();
 DT_MenuCancel(_mycube,0);
 for (var x=1000; !getUIFlag(0x19) && x > 0; x-=25) { delay(25); } // Wait for stash UI to apear
 DT_MenuCancel(_mychest,0);

 // Return the success of the portal opening
 return "sucess";
}

function WXP_ClearArea() {

 // If we see The Cow King very close, abort
 var _cowking = getUnit(1,"The Cow King");
 if (_cowking) {

  if ( DA_GetRange( _cowking ) < 20 ) {

   DC_ThrowException("CowsXP", "The Cow King is already too close");
  }
 }

 // Warn fellow ppl
 if (XP_RunMode > 0) { say ("Come in only when I tell you that the portal is safe!"); }

 // Call the function
 XP_KillMonsters();

 // For public games, make a tp and call followers/leechers in
 if (XP_RunMode > 1) {

  DM_MakeTP();
  say(XP_TPLeechMessage);
 }

 // Start exploring the area
 _retval = commPather.ExploreLevel(false,XP_KillMonsters,XP_KillMonsters,false);
 if (!_retval) { DC_ThrowException("CowsXP","Unable to explore the area"); }
}

function WXP_Prepare() {

 // Add leg into ignored items list for cow run duration
 DT_IgnoredItems.push("leg");

 // Check if we need to buy a TP book
 var _needtptome=true;
 var _ignoreitem;
 var _xtratome=getUnit(4,"tbk");
 if (_xtratome) { do {

  if (_xtratome.mode === 0) {

   if (_xtratome.itemloc === 0) {

    _ignoreitem = (DT_Columns[_xtratome.y][_xtratome.x]===0);
    if (!_ignoreitem) {

     _needtptome=false;
     break;
    }
   }
   else {
    _needtptome=false;
    break;
   }

  }
  else if (_xtratome.mode == 3) {

   if (WXP_PickItem(_xtratome)) {

    _needtptome=false;
    break;
   }
  }

 } while(_xtratome.getNext("tbk")); }

 // Check if we need a leg
 var _needleg=true;
 var _leg=getUnit(4,"leg");
 if (_leg) {

  if (_leg.mode === 0) { _needleg=false; }
  else if (_leg.mode == 3) {

   if (WXP_PickItem(_leg)) { _needleg=false; }
  }
 }

 // Go grab Wirt's leg if needed and make sure we are in Act 1
 if (_needleg) {

  // Go to the waypoint area
  if (XP_UseOverheads) { me.overhead("Walking to WayPoint"); }
  commPather.GotoWaypoint(me.area,8,false,false);
  WXP_GetLeg();
  if (DM_MakeTP(me.area,1) === false) {

   DC_ThrowException("CowsXP","Unable to go to town!");
  }

 }
 else if (me.act != 1) {

  // Go to the waypoint area
  if (XP_UseOverheads) { me.overhead("Walking to WayPoint"); }
  commPather.GotoWaypoint(me.area,8,false,false);
  DM_UsePortal("Waypoint",0x01);
 }

 // If we need a TP book, go to Akara, buy a tp tome and do healer stuff too
 if (_needtptome) {

  if (XP_UseOverheads) { me.overhead("Walking to Akara"); }
  commPather.GotoNPC(148,1,8,false,false);
  var npc = DC_getNPC(148);
  if (!npc || !DT_DoInteract(npc)) { DC_ThrowException("CowsXP", "Unable to interact with Akara !"); }
  DT_DoTrade(npc);

  if (_XP_GetNumUnId > 0) { XP_CheckItems(npc); }

  var _tptome = DT_GetTome(1);
  if (!_tptome) { DT_BuyScrolls(npc,1,1); }
  else if (_tptome.getStat(70) < 7) { DT_FillTome(npc,1); }

  var _tbk = DT_GetTome(1,npc.name);
  if (_tbk) { DT_BuyItem(_tbk,npc,2); }

  if (XP_UseBeltManager && DT_CheckBelt()) { DT_FillBelt(npc); }

  DT_MenuCancel(npc,1);
 }

 // Go to stash
 if (XP_UseOverheads) { me.overhead("Walking to Stash"); }
 commPather.GotoObject(2,267,267,me.area,3,false,false);

 // Open portal to Cow Level
 var result = WXP_OpenPortal();

 // There was an error opening portal, abort run
 if (result != "sucess") {

  // Drop any extra tbk
  _xtratome = getUnit(4,"tbk", 0);
  if (_xtratome) { do {

   if (_xtratome.itemloc === 0) {

    _ignoreitem = (DT_Columns[_xtratome.y][_xtratome.x]===0);
    if (!_ignoreitem) { DT_DropItem(_xtratome); }
   }

  } while(_xtratome && _xtratome.getNext("tbk", 0)); }

  DC_ThrowException("CowsXP", "Error Opening Cow Portal : " + result);
 }

 // Remove leg from ignored items list
 DT_IgnoredItems.pop();
}

//////////////////////////////////////////////////////////////////////
// CowsXP libs loading
//////////////////////////////////////////////////////////////////////

// Main function
function CowsXP() {

 // Initialize the script
 DC_LoadInclude("XP/Libs/XP_Load.d2l");
 XP_LoadLibs();
 XP_StartScript( "CowsXP", "WXP", WXP_Variables, false, false );

 // Start the event handler if we want automatic BO check and refresh
 if (XP_AutoBOCheck) { registerEvent( EVENT_PLAYERSTATE, XP_EventPlayerState ); }

 // If you don't use LoaderXP, invite the followers
 if (!_WXP_UseLoader && XP_RunMode == 2) {

  // determine the gamename/password format depending on the join cmd
  _gameinfo = " " + me.gamename;
  _gamepass = (!me.gamepassword) ? "" : me.gamepassword;
  if (XP_JoinMessage == "=JOIN") {

   _gameinfo = (_gamepass === "") ? _gameinfo : _gameinfo + " " + _gamepass;
  }
  else {
   _gameinfo = (_gamepass === "") ? _gameinfo : _gameinfo + "/" + _gamepass;
  }

  // Send the join message to the followers if we set Teambot mode
  say("/f m " + XP_JoinMessage + _gameinfo);
 }

 // Load the PartyUp file for public games
 if (XP_RunMode > 0) {

  // Load the PartyXP script for invites if it isn't loaded yet
  if ( !DC_FindScript(XP_PartyPath) ) {

   load(XP_PartyPath);
  }
  DT_DrinkAll=true;
 }

 // Tell followers to wait in town
 if (XP_RunMode == 2) { say( XP_WaitTownMessage ); }

 // Do town stuff
 XP_TownManager();

 // If we want to open the portal only and the quest is done, throw a exception
 if (WXP_OpenOnly && (me.getQuest(4,10) || !me.getQuest(40,0))) {

  DC_ThrowException("CowsXP", "WXP_OpenOnly is set to true but the quest is completed or Baal is not killed in that difficulty");
 }

 // If the quest is done or Baal is not killed
 if (me.getQuest(4, 10) || !me.getQuest(40,0)) {

  DC_Print("I can't open the Cow Portal, so I can kill the Cow King!");
  _WXP_CanKillKing = true;
  if (!WXP_WaitForPortal) { DC_ThrowException("CowsXP", "I can't open the Cow portal anymore !!"); }
 }

 // Prepare for the Cows by getting the items and opening the portal
 WXP_Prepare();

 // For public games
 if (XP_RunMode) { say(WXP_CowPortalMsg); }

 // If the bot want to do more than opening the portal, do the rest
 if (!WXP_OpenOnly) {

  // Check if we are in the right place
  if (XP_UseOverheads) { me.overhead("Walking to Stash"); }
  commPather.GotoObject(2,267,267,me.area,3,false,false);

  // Load King watch if we don't want him dead
  if (!WXP_KillKing) { load("tools/KingWatchXP.d2j"); }

  // Set the array of skills for area cleaning
  if (me.classid == 1) { XP_SetMonsterSkills(); }

  // Do precasts before going into the portal
  XP_Precasts();

  // Take the portal to cow level
  DM_UsePortal("Portal", 39);

  // Do precasts after going into the portal
  XP_Precasts();

  // Clear the cow level
  try { WXP_ClearArea(); }
  catch (e if e instanceof DC_ExceptionClass) {

   if (e.name != "King Found")  { throw e; }
   else {
    DC_Print("Cow King Found!  Ending CowsXP module!");
    DC_LogToautod2jsp("Cow King Found!  Ending CowsXP module!");
   }
  }

  // Increase the kills counter then leave the game
  // For WXP,a kill is equal to a completed run so with a small note, it is fine as is.
  DL_AddKill();

  // Stop KingWatchXP if it is running
  if (!WXP_KillKing) {

   if (DC_StopScript("KingWatchXP.d2j")) {

    DC_Print("KingWatchXP stopped");
   }
  }
 }

 if (XP_RunMode > 0) {

  var _partyscript = DC_FindScript(WXP_PartyPath);
  if (_partyscript) {

   _partyscript.stop();
   DC_Print("PartyXP script Stopped!");
  }
 }

 // Quit the game
 XP_CloseScript();
}

// Error handling
function main() {

 // Include the base d2jsp lib
 include("common/d2jsp-common.d2l");
 DC_LoadInclude("XP/Libs/XP_Exceptions.d2l");

 // Check if this script is loaded by LoaderXP
 if (DC_FindScript("LoaderXP.d2j")) { _WXP_UseLoader = true; }

 // Set the maximum game delay before aborting if the script is running standalone
 if (!_WXP_UseLoader) { me.gamelength=300000; }

 // configure the debug and error log paths
 DC_DebugLogPath = "output/XP-DebugLogs/" + me.name + "-WXP-DebugLog.html";
 DC_ErrorLogPath = "output/XP-ErrorLogs/" + me.name + "-XP-ErrorLog.html";

 // Call the main function to check for exceptions
     try { CowsXP(); }

 // Then catch and log any exception throwed by the script before quitting
 catch (WXP_Exception) {

  XP_HandleException( WXP_Exception, "WXP", _WXP_UseLoader );
     }
}


bots에 있는 CowsXP 이니 내용이에요.


위트족을 구할필요없고 스크롤만 큐빙하면 되는데... 이니에 일가견 있으신분 도움 좀 주시면 감사하겠습니다.

잘부탁드려요~~
댓글 0
권한이 없습니다.
다크 모드

댓글을 추천하시면 답변으로 채택됩니다.

댓글을 추천하면 글 작성자와 댓글 작성자 둘 다 경험치를 획득합니다.

자세한 내용은 업데이트 공지를 참고해주시기 바랍니다.