카우방 스크립트 위족 제거 어떻게 하나요?
조회 수
259
추천 수
0
안녕하세요. 헬카우방의 포탈을 열 때, 워트의 족을 넣지않고 큐빙하게끔 설정을 하고 싶습니다.
여러 방법으로 시도해 보았지만, 잘 해결이 되지 않아 질문을 드려봅니다.
(아래 스크립트는 본문입니다.)
//////////////////////////////////////////////////////////////////////
// Script public variables
//////////////////////////////////////////////////////////////////////
// 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
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;
var _WXP_CanKillKing = false;
// Classes
var commPather = false;
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; }
}
_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; }
if (item.mode===0) { return true; }
return false;
}
}
function WXP_GetLeg() {
// Do precasts before going into the portal
XP_Precasts();
XP_Precasts();
// Use the WP to go to the Stony Field
DM_UsePortal("Waypoint",0x04);
DM_UsePortal("Waypoint",0x04);
// Do precasts after going into the portal
XP_Precasts();
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"); }
_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) {
if (WXP_KillRakanishu) {
XP_KillBoss( "Rakanishu", 20, 0x01, false, _WXP_UseLoader );
}
}
// Take portal to Tristram
delay(WXP_PortalDelay);
DM_UsePortal("Portal", 38);
delay(WXP_PortalDelay);
DM_UsePortal("Portal", 38);
// Go besides Wirt's body
commPather.GotoDest(25048,5181);
commPather.GotoDest(25048,5181);
// Kill monsters around to be safe
XP_ClearPosition(20);
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); }
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) {
var _wirtbody;
for (var x=0; x < 5; x+=1) {
_wirtbody=getUnit(2,268);
if (_wirtbody) { break; }
delay(50);
}
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."); }
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) {
for (x=0; x < 3 && _wirtbody.mode != 2; x+=1) {
DC_DoClick(0,0,_wirtbody);
delay(500);
}
delay(500);
}
// Get the leg dropped by Wirt's body
var _leg;
for (x=0; x < 5; x+=1) {
var _leg;
for (x=0; x < 5; x+=1) {
_leg=getUnit(4,"leg");
if (_leg) { break; }
delay(50);
}
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"); }
if (!WXP_PickItem(_leg)) { DC_ThrowException("CowsXP", "Cannot pick Wirt's leg"); }
// Check for items
DSN_PickItems();
}
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) {
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 (_ignoreitem) {
if (_xtratome.getNext("tbk")) { continue; }
else { _xtratome=false; }
}
}
}
else { _xtratome=false; }
}
}
}
// If the tome is on the ground, pick it
else if (_xtratome.mode == 3) {
else if (_xtratome.mode == 3) {
WXP_PickItem(_xtratome);
_xtratome = getUnit(4,"tbk");
continue;
}
else {
if (_xtratome.getNext("tbk")) { continue; }
else { _xtratome=false; }
}
_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."; }
if (!_xtratome) { return "no tome."; }
// get the leg in inventory
var _leg=getUnit(4,"leg");
if (_leg) {
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; }
}
}
_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!"; }
if (!_leg) { return "No leg found!"; }
// Get the stash object
var _mychest = getUnit(2,"bank");
if (!_mychest) { return "No stash found!"; }
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 !"; }
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();
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);
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);
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";
}
return "sucess";
}
function WXP_ClearArea() {
// If we see The Cow King very close, abort
var _cowking = getUnit(1,"The Cow King");
if (_cowking) {
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!"); }
if (XP_RunMode > 0) { say ("Come in only when I tell you that the portal is safe!"); }
// Call the function
XP_KillMonsters();
XP_KillMonsters();
// For public games, make a tp and call followers/leechers in
if (XP_RunMode > 1) {
if (XP_RunMode > 1) {
DM_MakeTP();
say(XP_TPLeechMessage);
}
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"); }
}
_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");
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 {
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) {
if (!_ignoreitem) {
_needtptome=false;
break;
}
}
else {
_needtptome=false;
break;
}
break;
}
}
else {
_needtptome=false;
break;
}
}
else if (_xtratome.mode == 3) {
else if (_xtratome.mode == 3) {
if (WXP_PickItem(_xtratome)) {
_needtptome=false;
break;
}
}
break;
}
}
} while(_xtratome.getNext("tbk")); }
// Check if we need a leg
var _needleg=true;
var _leg=getUnit(4,"leg");
if (_leg) {
var _needleg=true;
var _leg=getUnit(4,"leg");
if (_leg) {
if (_leg.mode === 0) { _needleg=false; }
else if (_leg.mode == 3) {
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) {
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) {
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) {
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 (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 (_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);
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); }
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 (_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);
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();
var result = WXP_OpenPortal();
// There was an error opening portal, abort run
if (result != "sucess") {
if (result != "sucess") {
// Drop any extra tbk
_xtratome = getUnit(4,"tbk", 0);
if (_xtratome) { do {
_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); }
}
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();
}
DT_IgnoredItems.pop();
}
//////////////////////////////////////////////////////////////////////
// CowsXP libs loading
//////////////////////////////////////////////////////////////////////
// CowsXP libs loading
//////////////////////////////////////////////////////////////////////
// Main function
function CowsXP() {
function CowsXP() {
// Initialize the script
DC_LoadInclude("XP/Libs/XP_Load.d2l");
XP_LoadLibs();
XP_StartScript( "CowsXP", "WXP", WXP_Variables, false, false );
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 (XP_AutoBOCheck) { registerEvent( EVENT_PLAYERSTATE, XP_EventPlayerState ); }
// If you don't use LoaderXP, invite the followers
if (!_WXP_UseLoader && XP_RunMode == 2) {
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 = " " + me.gamename;
_gamepass = (!me.gamepassword) ? "" : me.gamepassword;
if (XP_JoinMessage == "=JOIN") {
_gameinfo = (_gamepass === "") ? _gameinfo : _gameinfo + " " + _gamepass;
}
else {
_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);
}
say("/f m " + XP_JoinMessage + _gameinfo);
}
// Load the PartyUp file for public games
if (XP_RunMode > 0) {
if (XP_RunMode > 0) {
// Load the PartyXP script for invites if it isn't loaded yet
if ( !DC_FindScript(XP_PartyPath) ) {
if ( !DC_FindScript(XP_PartyPath) ) {
load(XP_PartyPath);
}
DT_DrinkAll=true;
}
}
DT_DrinkAll=true;
}
// Tell followers to wait in town
if (XP_RunMode == 2) { say( XP_WaitTownMessage ); }
if (XP_RunMode == 2) { say( XP_WaitTownMessage ); }
// Do town stuff
XP_TownManager();
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))) {
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)) {
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 !!"); }
}
_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();
WXP_Prepare();
// For public games
if (XP_RunMode) { say(WXP_CowPortalMsg); }
if (XP_RunMode) { say(WXP_CowPortalMsg); }
// If the bot want to do more than opening the portal, do the rest
if (!WXP_OpenOnly) {
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);
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"); }
if (!WXP_KillKing) { load("tools/KingWatchXP.d2j"); }
// Set the array of skills for area cleaning
if (me.classid == 1) { XP_SetMonsterSkills(); }
if (me.classid == 1) { XP_SetMonsterSkills(); }
// Do precasts before going into the portal
XP_Precasts();
XP_Precasts();
// Take the portal to cow level
DM_UsePortal("Portal", 39);
DM_UsePortal("Portal", 39);
// Do precasts after going into the portal
XP_Precasts();
XP_Precasts();
// Clear the cow level
try { WXP_ClearArea(); }
catch (e if e instanceof DC_ExceptionClass) {
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!");
}
}
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();
// 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 (!WXP_KillKing) {
if (DC_StopScript("KingWatchXP.d2j")) {
DC_Print("KingWatchXP stopped");
}
}
}
}
}
}
if (XP_RunMode > 0) {
var _partyscript = DC_FindScript(WXP_PartyPath);
if (_partyscript) {
if (_partyscript) {
_partyscript.stop();
DC_Print("PartyXP script Stopped!");
}
}
DC_Print("PartyXP script Stopped!");
}
}
// Quit the game
XP_CloseScript();
}
XP_CloseScript();
}
// Error handling
function main() {
function main() {
// Include the base d2jsp lib
include("common/d2jsp-common.d2l");
DC_LoadInclude("XP/Libs/XP_Exceptions.d2l");
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; }
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; }
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";
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(); }
try { CowsXP(); }
// Then catch and log any exception throwed by the script before quitting
catch (WXP_Exception) {
catch (WXP_Exception) {
XP_HandleException( WXP_Exception, "WXP", _WXP_UseLoader );
}
}
}
}
그런데 포탈책을 넣고 큐빙표시를 누르지 않아서 포탈이 안열리고 에러로 팅기네요.
도와주세요!