Author Topic: [D2NT] Open All Chests  (Read 2727 times)

Offline mythosis

  • PK Pro
  • ****
  • Join Date: Aug 2010
  • Posts: 265
  • Reputation 0
  • USWest Channel: op pkbaal
    • View Profile
[D2NT] Open All Chests
« on: September 06, 2010, 05:46:46 AM »
This mod does...
 - If NTConfig_OpenAllChest is true, checks for all openable chests (ratnests, urns, etc) on clearPosition AND clearLevel AND clearRoom. In simple terms... true = open all chests.

It does sometimes miss chests if there are many next to eachother.
Not all chest-types have been tested. Should work though.

Step 1:
Navigate to: D2NT\scripts\NTBot\char_config\
File: NTConfig.ntl
Add: (preferably under NTConfig_OpenChest)
Code: [Select]
var NTConfig_OpenAllChest;
Step 2:
Navigate to: D2NT\scripts\NTBot\char_config\
File: your character file
Add: (preferably under NTConfig_OpenChest)
Code: [Select]
NTConfig_OpenAllChest = true; // true: open all chests

Step 3:
Navigate to: D2NT\scripts\libs\common\
File: NTAttack.ntl
Find (crt+f): NTC_CHAR

This will be inside your clearPosition function.
Add:
Code: [Select]
if(NTConfig_OpenAllChest)
{
NTA_GetChest(2);
}
else if(NTConfig_OpenChest)
{
//NTA_GetChest(1);
}

To Here:
Code: [Select]
if(me.classid == NTC_CHAR_CLASS_PALADIN)
{
if(_attackcount > 2 && (parseInt(me.hp*100/me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp*100/me.mpmax) < NTConfig_UseRedemptionMP))
{
if(NTC_PutSkill(124, NTC_HAND_RIGHT))
NTC_PingDelay(1000);
}
}

if(pickitem && _attackcount > 0)
NTSI_PickItems();

if(NTConfig_OpenAllChest)
{
NTA_GetChest(2);
}
else if(NTConfig_OpenChest)
{
//NTA_GetChest(1);
}

switch(safelevel)
{
case 1:
return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
case 2:
return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
}

return true;
}

function NTA_ClearLevel(pickitem, safelevel)
{


Step 4:
Navigate to: D2NT\scripts\libs\common\
File: NTAttack.ntl
Find (crt+f): NTC_CHAR      --->(2nd instance)

Add:
Code: [Select]
if(NTConfig_OpenAllChest)
{
NTA_GetChest(2);
}

To Here:
Code: [Select]
if(me.classid == NTC_CHAR_CLASS_PALADIN)
{
if(_attackcount > 2 && (parseInt(me.hp*100/me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp*100/me.mpmax) < NTConfig_UseRedemptionMP))
{
if(NTC_PutSkill(124, NTC_HAND_RIGHT))
NTC_PingDelay(1000);
}
}

if(pickitem && _attackcount > 0)
NTSI_PickItems();

if(NTConfig_OpenAllChest)
{
NTA_GetChest(2);
}

switch(safelevel)
{
case 1:
return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
case 2:
return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
}

return true;
}

function NTA_IsValidMonster(monster)
{


Step 5:
Navigate to: D2NT\scripts\libs\common\
File: NTAttack.ntl

Add function:
Code: [Select]
function NTA_GetChest(_openThis)
{
// Mod By: Mythosis
///////////////////////////////

var i;
var _chest;
var _openableList = ["Altar",
"animated skulland rockpile",
"ArmorStand",
"Barrel",
"barrel wilderness",
"Basket",
"bed",
"body",
"BoneChest",
"burialchestL",
"burialchestR",
"burninglogs",
"Casket",
"chest",
"Chest3",
"ChestL",
"chestR",
"ChestSL",
"ChestSR",
"cocoon",
"coffin",
"CorpseOnStick",
"Crate",
"deadbarbarian",
"deadperson",
"deadperson2",
"dead guard",
"Dummy",
"dummy",
"earmorstandL",
"earmorstandR",
"eunuch",
"evilurn",
"eweaponrackL",
"eweaponrackR",
"explodingchest",
"funeralpire",
"goo pile",
"groundtomb",
"groundtombL",
"hidden stash",
"hiding spot",
"hollow log",
"HungSkeleton",
"icecavejar1",
"icecavejar2",
"icecavejar3",
"icecavejar4",
"jar1",
"jar2",
"jar3",
"jug",
"LargeUrn",
"loose boulder",
"loose rock",
"Obelisk",
"pileofskullsandrocks",
"pillar",
"ratnest",
"RockPIle",
"RogueCorpse",
"sarcophagus",
"skullpile",
"stash",
"Sarcophagus",
"skeleton",
"skull pile",
"tomb1",
"tomb1L",
"tomb2",
"tomb2L",
"tomb3",
"tomb3L",
"TowerTome",
"TrappedSoul",
"Trophy Case",
"Urn",
"WeaponRack",
"woodchestL",
"woodchestR",
"woodchest2L",
"woodchest2R"];

switch(_openThis)
{
case 1:
break;
case 2:
break;
default:
_openThis = 0;
break;
}

do
{
switch(_openThis)
{
case 0: //Do Nothing
case 1: //Open "chest"
_chest = NTC_FindUnit(NTC_UNIT_OBJECT, "chest");
break;
case 2: //Open All
for( i=0; i < _openableList.length; i++ )
{
_chest = NTC_FindUnit(NTC_UNIT_OBJECT, _openableList[i]);
if(_chest)
{
i = _openableList.legth;
}
}
break;
default:
break;
}

if(_chest)
{
if(NTC_OpenChest(_chest))
{
Delay(500);
NTSI_PickItems();
}
}
else
{
i = -1;
}
_chest = "undefined";
} while(i > -1);
}


 8)
« Last Edit: September 06, 2010, 07:29:29 AM by mythosis »

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

[D2NT] Open All Chests
« on: September 06, 2010, 05:46:46 AM »

Offline Awsome-Myth

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 1
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: [D2NT] Open All Chests
« Reply #1 on: October 09, 2010, 04:53:58 PM »
OK.Hi all.

 Thought I applied everything the way you showed to do it,but I'm getting an error that openallchest is undefined.

maybe you can find where the mistake is.Thanks in advance.

/////Here is my NTAttack scrip//////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
Code: [Select]
const NTA_DAMAGE_NONE = 0;
const NTA_DAMAGE_PHYSICAL = 1;
const NTA_DAMAGE_MAGIC = 2;
const NTA_DAMAGE_FIRE = 3;
const NTA_DAMAGE_LIGHTNING = 4;
const NTA_DAMAGE_COLD = 5;
const NTA_DAMAGE_POISON = 6;


var QuickPickIt = 2; // 0: Never, 1: PublicMode only, 2: Always
var QuickPickItDelay = 10; // SnagItDelay for quick pick
var _NTA_SkillHand = new Array(7);
var _NTA_SkillDamage = new Array(7);
var _NTA_SkillRange = new Array(7);

function NTA_Initialize()
{
    if(NTConfig_AttackSkill[1] == 0 || NTConfig_AttackSkill[3] == 0)
        NTA_DetectAttackPattern();

    for(var i = 0 ; i < 7 ; i++)
    {
        if(NTConfig_AttackSkill[i] > 0)
        {
            _NTA_SkillHand[i] = GetBaseStat("skills.txt", NTConfig_AttackSkill[i], 166) ? 2 : NTC_HAND_RIGHT;
            _NTA_SkillDamage[i] = NTA_GetDamageType(NTConfig_AttackSkill[i]);

            switch(NTConfig_AttackSkill[i])
            {
            case 44: //Frost Nova
            case 48: // Nova
                _NTA_SkillRange[i] = 10;
                break;
            case 64: // Frozen Orb
                _NTA_SkillRange[i] = 15;
                break;
            case 97: //Smite
            case 106: //Zeal
            case 112: //Blessed Hammer
                _NTA_SkillRange[i] = 3;
                break;
            case 151: //Whirlwind
                _NTA_SkillRange[i] = 8;
                break;
            case 152: //Berserk
                _NTA_SkillRange[i] = 3;
                break;
            default:
                _NTA_SkillRange[i] = 25;
                break;
            }
        }
    }
}

function NTA_KillMonster(classid)
{
   var _target;

   if(NTConfig_AttackSkill[1] < 1)
      return false;

   _target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, 5);

   if(QuickPickIt >= 1)
   {
      if(NTConfig_PublicMode || QuickPickIt == 2)
      {
         Delay(QuickPickItDelay);
         NTSI_PickItems();
      }
   }

   if(!_target)
      return false;

    if(_target.IsAttackable())
    {
        var _attackcount = 0;

        while(_attackcount < 300 && NTA_IsValidMonster(_target))
        {
            if(NTA_Attack(_target, (_attackcount%30) == 0) < 2)
                break;

            _attackcount++;
        }
    }

    return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
}

function NTA_ClearPosition(range, pickitem, safelevel)
{
    var _orgx, _orgy;
    var _spectype = [0x0A, 0x01, 0x01];
    var _skiplist;
    var _attackcount = 0;
    var _target;
    var _distance, _mingid, _mindistance;
    var _result;

    if(NTConfig_AttackSkill[1] < 1 || NTConfig_AttackSkill[3] < 1)
        return false;

    switch(arguments.length)
    {
    case 0:
        range = 20;
    case 1:
        pickitem = false;
    case 2:
        safelevel = 0;
    default:
        if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
            safelevel = 0;
        break;
    }

    _orgx = me.x;
    _orgy = me.y;

    for(var i = 0 ; i < _spectype.length ; i++)
    {
        _skiplist = new Array();

        while(_attackcount < (i+1)*100)
        {
            _mindistance = 100000;

            _target = NTC_FindUnit(NTC_UNIT_MONSTER);

            if(_target)
            {
                do
                {
                    if(_skiplist.indexOf(_target.gid) < 0)
                    {
                        if(_target.IsAttackable() && (_target.spectype&_spectype[i]))
                        {
                            if(GetDistance(_orgx, _orgy, _target.x, _target.y) <= range && NTA_IsValidMonster(_target))
                            {
                                _distance = GetDistance(me, _target);

                                if(_distance < _mindistance)
                                {
                                    _mingid = _target.gid;
                                    _mindistance = _distance;
                                }
                            }
                        }
                        else
                            _skiplist.push(_target.gid);
                    }
                } while(_target.GetNext());
            }

            if(_mindistance < 100000)
            {
                _target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid);

                if(_target)
                {
                    _result = NTA_Attack(_target, (_attackcount%30) == 0);

                    switch(_result)
                    {
                    case 1:
                        _skiplist.push(_mingid);
                        break;
                    case 2:
                    case 3:
                        _attackcount++;
                        break;
                    default:
                        return false;
                    }
                }
            }
            else
                break;
        }
    }

    if(me.classid == NTC_CHAR_CLASS_PALADIN)
    {
        if(_attackcount > 2 && (parseInt(me.hp*100/me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp*100/me.mpmax) < NTConfig_UseRedemptionMP))
        {
            if(NTC_PutSkill(124, NTC_HAND_RIGHT))
                NTC_PingDelay(1000);
        }
    }

    if(NTConfig_OpenChest)
    {
        _target = NTC_GetSpecialChest();

        if(_target && GetDistance(_orgx, _orgy, _target.x, _target.y) <= range && NTC_OpenChest(_target))
            _attackcount++;
    }

    if(pickitem && _attackcount > 0)
        NTSI_PickItems();


       //if(NTConfig_OpenAllChest)

        {

              //NTA_GetChest(2);

         }

        //else if(NTConfig_OpenChest)

        {

        //NTA_GetChest(1);

        }

    switch(safelevel)
    {
    case 1:
        return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
    case 2:
        return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
    }

    return true;
}

function NTA_ClearLevel(pickitem, safelevel)
{
    var i;
    var _room, _rooms;
    var _distance, _minindex, _mindistance;

    _room = GetRoom();

    if(!_room)
        return false;

    switch(arguments.length)
    {
    case 0:
        pickitem = true;
    case 1:
        safelevel = 2;
    default:
        if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
            safelevel = 0;
        break;
    }

    _rooms = new Array();

    do
    {
        _rooms.push([parseInt(_room.x*5 + _room.xsize*5/2), parseInt(_room.y*5 + _room.ysize*5/2)]);
    } while(_room.GetNext());

    while(_rooms.length > 0)
    {
        _mindistance = 100000;

        for(i = 0 ; i < _rooms.length ; i++)
        {
            _distance = GetDistance(me.x, me.y, _rooms[i][0], _rooms[i][1]);

            if(_distance < _mindistance)
            {
                _minindex = i;
                _mindistance = _distance;
            }
        }

        if(NTM_MoveTo(me.areaid, _rooms[_minindex][0], _rooms[_minindex][1], 1))
        {
            if(!NTA_ClearRoom(pickitem, safelevel))
                return false;

            NTP_DoPrecast(false);
        }

        _rooms.splice(_minindex, 1);
    }

    return true;
}

function NTA_ClearRoom(pickitem, safelevel)
{
    var _room;
    var _spectype = [0x0A, 0x01, 0x01];
    var _skiplist;
    var _attackcount = 0;
    var _target;
    var _distance, _mingid, _mindistance;
    var _result;

    if(NTConfig_AttackSkill[1] < 1 || NTConfig_AttackSkill[3] < 1)
        return false;

    _room = me.GetRoom();

    if(!_room)
        return false;

    switch(arguments.length)
    {
    case 0:
        pickitem = false;
    case 1:
        safelevel = 0;
    default:
        if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
            safelevel = 0;
        break;
    }

    for(var i = 0 ; i < _spectype.length ; i++)
    {
        _skiplist = new Array();

        while(_attackcount < (i+1)*100)
        {
            _mindistance = 100000;

            _target = NTC_FindUnit(NTC_UNIT_MONSTER);

            if(_target)
            {
                do
                {
                    if(_skiplist.indexOf(_target.gid) < 0)
                    {
                        if(_target.IsAttackable() && (_target.spectype&_spectype[i]))
                        {
                            if(_room.UnitInRoom(_target) && NTA_IsValidMonster(_target))
                            {
                                _distance = GetDistance(me, _target);

                                if(_distance < _mindistance)
                                {
                                    _mingid = _target.gid;
                                    _mindistance = _distance;
                                }
                            }
                        }
                        else
                            _skiplist.push(_target.gid);
                    }
                } while(_target.GetNext());
            }

            if(_mindistance < 100000)
            {
                _target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid);

                if(_target)
                {
                    _result = NTA_Attack(_target, (_attackcount%30) == 0);

                    switch(_result)
                    {
                    case 1:
                        _skiplist.push(_mingid);
                        break;
                    case 2:
                    case 3:
                        _attackcount++;
                        break;
                    default:
                        return false;
                    }
                }
            }
            else
                break;
        }
    }

    if(me.classid == NTC_CHAR_CLASS_PALADIN)
    {
        if(_attackcount > 2 && (parseInt(me.hp*100/me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp*100/me.mpmax) < NTConfig_UseRedemptionMP))
        {
            if(NTC_PutSkill(124, NTC_HAND_RIGHT))
                NTC_PingDelay(1000);
        }
    }

    if(NTConfig_OpenChest)
    {
        _target = NTC_GetSpecialChest();

        if(_target && _room.UnitInRoom(_target) && NTC_OpenChest(_target))
            _attackcount++;
    }

    if(pickitem && _attackcount > 0)
        NTSI_PickItems();


        //if(NTConfig_OpenAllChest)
        {
        //NTA_GetChest(2);
        }

    switch(safelevel)
    {
    case 1:
        return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
    case 2:
        return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
    }

    return true;
}

function NTA_IsValidMonster(monster)
{
    var _classid;

    if(monster.hp <= 0 || monster.mode == 0 || monster.mode == 12)
        return false;

    _classid = monster.classid;

    if(((_classid >= 110 && _classid <= 113) || _classid == 608) && monster.mode == 8) // ignore flying scavengers
        return false;

    if(_classid == 68 && monster.mode == 14) // ignore burrowing maggots
        return false;

    if(_classid >= 258 && _classid <= 263 && monster.mode == 14) // ignore submerged WaterWatchers
        return false;

    if(monster.GetState(53) || monster.GetState(96)) // Conversion, Revive
        return false;

    return true;
}

function NTA_GetDamageType(skillid)
{
    if(skillid == 74) // Corpse Explosion
        return NTA_DAMAGE_PHYSICAL;

    if(skillid == 112) // Blessed Hammer
        return NTA_DAMAGE_MAGIC;

    switch(GetBaseStat("skills.txt", skillid, 233))
    {
    case "cold":
        return NTA_DAMAGE_COLD;
    case "fire":
        return NTA_DAMAGE_FIRE;
    case "ltng":
        return NTA_DAMAGE_LIGHTNING;
    case "mag":
        return NTA_DAMAGE_MAGIC;
    case "pois":
        return NTA_DAMAGE_POISON;
    case "stun":
        return NTA_DAMAGE_NONE;
    default:
        if(GetBaseStat("skills.txt", skillid, 178) || GetBaseStat("skills.txt", skillid, 182)) // aura or passive
            return NTA_DAMAGE_NONE;
    }

    return NTA_DAMAGE_PHYSICAL;
}

function NTA_GetResistance(enemy, type)
{
    switch(type)
    {
    case NTA_DAMAGE_PHYSICAL:
        return enemy.GetStat(36);
    case NTA_DAMAGE_MAGIC:
        return enemy.GetStat(37);
    case NTA_DAMAGE_FIRE:
        return enemy.GetStat(39);
    case NTA_DAMAGE_LIGHTNING:
        return enemy.GetStat(41);
    case NTA_DAMAGE_COLD:
        return enemy.GetStat(43);
    case NTA_DAMAGE_POISON:
        return enemy.GetStat(45);
    }

    return 0;
}

function NTA_DetectAttackPattern()
{
    switch(me.classid)
    {
    case NTC_CHAR_CLASS_AMAZON:
        return NTA_AmazonAttackPatternInt();
    case NTC_CHAR_CLASS_SORCERESS:
        return NTA_SorceressAttackPatternInt();
    case NTC_CHAR_CLASS_NECROMANCER:
        return NTA_NecromancerAttackPatternInt();
    case NTC_CHAR_CLASS_PALADIN:
        return NTA_PaladinAttackPatternInt();
    case NTC_CHAR_CLASS_BARBARIAN:
        return NTA_BarbarianAttackPatternInt();
    case NTC_CHAR_CLASS_DRUID:
        return NTA_DruidAttackPatternInt();
    case NTC_CHAR_CLASS_ASSASSIN:
        return NTA_AssassinAttackPatternInt();
    }

    return false;
}

// Return value : 0 = Unrecoverable process, 1 = Unavailable attack, 2 = Onetime fail, 3 = Success
function NTA_Attack(target, firstorder)
{
    switch(me.classid)
    {
    case NTC_CHAR_CLASS_AMAZON:
        return NTA_AmazonAttackInt(target, firstorder);
    case NTC_CHAR_CLASS_SORCERESS:
        return NTA_SorceressAttackInt(target, firstorder);
    case NTC_CHAR_CLASS_NECROMANCER:
        return NTA_NecromancerAttackInt(target, firstorder);
    case NTC_CHAR_CLASS_PALADIN:
        return NTA_PaladinAttackInt(target, firstorder);
    case NTC_CHAR_CLASS_BARBARIAN:
        return NTA_BarbarianAttackInt(target, firstorder);
    case NTC_CHAR_CLASS_DRUID:
        return NTA_DruidAttackInt(target, firstorder);
    case NTC_CHAR_CLASS_ASSASSIN:
        return NTA_AssassinAttackInt(target, firstorder);
    }

    return 0;
}

// Internal function
function NTA_AmazonAttackPatternInt()
{
    return false;
}

function NTA_AmazonAttackInt(target, firstorder)
{
    return 1;
}

function NTA_AmazonCastSkillInt(index, target)
{
    return false;
}

function NTA_SorceressAttackPatternInt()
{
    var _maxindex, _maxskill;
    var _avgskilllevel = new Array();

    _avgskilllevel[0] = parseInt((me.GetSkill(59, false)+me.GetSkill(39, false)+me.GetSkill(45, false)+me.GetSkill(55, false))/4);
    _avgskilllevel[1] = parseInt((me.GetSkill(53, false)+me.GetSkill(38, false)+me.GetSkill(48, false)+me.GetSkill(49, false))/4);
    _avgskilllevel[2] = parseInt((me.GetSkill(47, false)+me.GetSkill(36, false)+me.GetSkill(56, false)+me.GetSkill(64, false))/4);
    _avgskilllevel[3] = parseInt((me.GetSkill(47, false)+me.GetSkill(36, false)+me.GetSkill(56, false))/3);

    _maxindex = -1;
    _maxskill = 0;

    for(var i = 0 ; i < _avgskilllevel.length ; i++)
    {
        if(_avgskilllevel[i] > _maxskill)
        {
            _maxindex = i;
            _maxskill = _avgskilllevel[i];
        }
    }

    switch(_maxindex)
    {
    case 0: // Blizzard + Glacial Spike
        NTConfig_AttackSkill[1] = 59;
        NTConfig_AttackSkill[2] = 55;
        NTConfig_AttackSkill[3] = 59;
        NTConfig_AttackSkill[4] = 55;
        break;
    case 1: // Chain Lightning + Lightning
        NTConfig_AttackSkill[1] = 49;
        NTConfig_AttackSkill[3] = 53;
        break;
    case 2: // Fire Ball + Frozen Orb
        NTConfig_AttackSkill[0] = 64;
        NTConfig_AttackSkill[1] = 47;
        NTConfig_AttackSkill[3] = 47;
        NTConfig_AttackSkill[5] = 64;
        NTConfig_AttackSkill[6] = 55;
        break;
    case 3: // Fire Ball + Meteor
        NTConfig_AttackSkill[1] = 56;
        NTConfig_AttackSkill[2] = 47;
        NTConfig_AttackSkill[3] = 56;
        NTConfig_AttackSkill[4] = 47;
        break;
    }

    return (NTConfig_AttackSkill[1] && NTConfig_AttackSkill[3]);
}

function NTA_SorceressAttackInt(target, firstorder)
{
    var _primaryindex;

    if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe&0x10, NTConfig_CheckMercSafe&0x10))
    {
        if(!NTTMGR_VisitTown())
            return 0;
    }

    if(firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && me.GetSkillStatus(NTConfig_AttackSkill[0]) != 8)
    {
        if(GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4))
        {
            var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[0], 4);

            if(_pos)
                NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
        }

        if(!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
            return 2;

        return 3;
    }

    if(NTConfig_CastStatic < 100 && parseInt(target.hp*100/target.hpmax) > NTConfig_CastStatic && NTA_GetResistance(target, NTA_DAMAGE_LIGHTNING) <= 80)
    {
        var _staticlevel = NTC_GetSkillLevel(42);

        if(_staticlevel > 0)
        {
            var _staticrange;
            var _castx, _casty;

            _staticrange = Math.floor((5+_staticlevel-1)*2/3);

            if(GetDistance(me, target) > _staticrange || !CheckCollision(me, target, 6))
            {
                var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _staticrange, 6);

                if(_pos)
                    NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
            }

            if(target.x < me.x)
                _castx = me.x - 1;
            else if(target.x > me.x)
                _castx = me.x + 1;
            else
                _castx = me.x;

            if(target.y < me.y)
                _casty = me.y - 1;
            else if(target.y > me.y)
                _casty = me.y + 1;
            else
                _casty = me.y;

            if(!CheckCollision(target.areaid, _castx, _casty, 1))
            {
                _castx = me.x;
                _casty = me.y;
            }

            if(!NTC_CastSkill(42, NTC_HAND_RIGHT, _castx, _casty))
                return 2;

            return 3;
        }
    }

    _primaryindex = (target.spectype&0x0A) ? 1 : 3;

    if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) <= 90)
    {
        if(!NTA_SorceressCastSkillInt(_primaryindex, target))
            return 2;

        return 3;
    }

    if(NTConfig_AttackSkill[5] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[5]) <= 80)
    {
        if(!NTA_SorceressCastSkillInt(5, target))
            return 2;

        return 3;
    }

    if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100 || (_primaryindex == 1 && NTC_GetMerc()))
    {
        if(!NTA_SorceressCastSkillInt(_primaryindex, target))
            return 2;

        return 3;
    }

    return 1;
}

function NTA_SorceressCastSkillInt(index, target)
{
    if(me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8)
    {
        if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4))
        {
            var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);

            if(_pos)
                NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
        }

        return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
    }

    if(NTConfig_AttackSkill[index+1] > 0)
    {
        if(GetDistance(me, target) > _NTA_SkillRange[index+1] || !CheckCollision(me, target, 4))
        {
            var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index+1], 4);

            if(_pos)
                NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
        }

        return NTC_CastSkill(NTConfig_AttackSkill[index+1], _NTA_SkillHand[index+1], target);
    }

    for(var i = 0 ; i < 25 ; i++)
    {
        NTC_Delay(NTC_DELAY_FRAME);

        if(me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8)
            break;
    }

    return false;
}

function NTA_NecromancerAttackPatternInt()
{
    return false;
}

function NTA_NecromancerAttackInt(target, firstorder)
{
    return 1;
}

function NTA_NecromancerCastSkillInt(index, target)
{
    return false;
}

function NTA_PaladinAttackPatternInt()
{
    var _maxindex, _maxskill;
    var _avgskilllevel = new Array();

    _avgskilllevel[0] = parseInt((me.GetSkill(112, false)+me.GetSkill(108, false)+me.GetSkill(115, false))/3);
    _avgskilllevel[1] = parseInt((me.GetSkill(106, false)+me.GetSkill(96, false))/2);
    _avgskilllevel[2] = parseInt((me.GetSkill(121, false)+me.GetSkill(101, false)+me.GetSkill(118, false))/3);

    _maxindex = -1;
    _maxskill = 0;

    for(var i = 0 ; i < _avgskilllevel.length ; i++)
    {
        if(_avgskilllevel[i] > _maxskill)
        {
            _maxindex = i;
            _maxskill = _avgskilllevel[i];
        }
    }

    switch(_maxindex)
    {
    case 0: // Blessed Hammer
        NTConfig_AttackSkill[1] = 112;
        NTConfig_AttackSkill[2] = 113;
        NTConfig_AttackSkill[3] = 112;
        NTConfig_AttackSkill[4] = 113;
        break;
    case 1: // Zeal
        NTConfig_AttackSkill[1] = 106;
        NTConfig_AttackSkill[2] = 122;
        NTConfig_AttackSkill[3] = 106;
        NTConfig_AttackSkill[4] = 122;
        break;
    case 2: // Fist of the Heavens
        NTConfig_AttackSkill[1] = 121;
        NTConfig_AttackSkill[2] = 123;
        NTConfig_AttackSkill[3] = 121;
        NTConfig_AttackSkill[4] = 123;
        break;
    }

    return (NTConfig_AttackSkill[1] && NTConfig_AttackSkill[3]);
}

function NTA_PaladinAttackInt(target, firstorder)
{
    var _primaryindex;

    if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe&0x10, NTConfig_CheckMercSafe&0x10))
    {
        if(!NTTMGR_VisitTown())
            return 0;
    }

    if(firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100)
    {
        if(GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4))
        {
            var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[0], 4);

            if(_pos)
                NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
        }

        if(!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
            return 2;

        return 3;
    }

    _primaryindex = (target.spectype&0x0A) ? 1 : 3;

    if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100)
    {
        if(_NTA_SkillRange[_primaryindex] < 4 && !CheckCollision(target.areaid, target.x, target.y, 1))
            return 1;

        if(!NTA_PaladinCastSkillInt(_primaryindex, target))
            return 2;

        return 3;
    }

    if(NTConfig_AttackSkill[5] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[5]) < 100)
    {
        if(_NTA_SkillRange[5] < 4 && !CheckCollision(target.areaid, target.x, target.y, 1))
            return 1;

        if(!NTA_PaladinCastSkillInt(5, target))
            return 2;

        return 3;
    }

    return 1;
}

function NTA_PaladinCastSkillInt(index, target)
{
    if(NTConfig_AttackSkill[index] == 112)
    {
        if(me.x-target.x < 1 || me.x-target.x > 2 || me.y-target.y < 1 || me.y-target.y > 2)
        {
            if(CheckCollision(target.areaid, target.x+2, target.y+2, 1))
                NTM_MoveTo(target.areaid, target.x+2, target.y+2, 0);
            else if(me.x-target.x < -4 || me.x-target.x > 2 || me.y-target.y < 0 || me.y-target.y > 2)
                NTM_MoveTo(target.areaid, target.x-4, target.y, 0);
        }
    }
    else
    {
        if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4))
        {
            var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);

            if(_pos)
                NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
        }
    }

    if(NTConfig_AttackSkill[index+1] > 0)
        NTC_PutSkill(NTConfig_AttackSkill[index+1], NTC_HAND_RIGHT);

    return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
}

function NTA_BarbarianAttackPatternInt()
{
    var _maxindex, _maxskill;
    var _avgskilllevel = new Array();

    _avgskilllevel[0] = me.GetSkill(151, false);

    _maxindex = -1;
    _maxskill = 0;

    for(var i = 0 ; i < _avgskilllevel.length ; i++)
    {
        if(_avgskilllevel[i] > _maxskill)
        {
            _maxindex = i;
            _maxskill = _avgskilllevel[i];
        }
    }

    switch(_maxindex)
    {
    case 0: // Whirlwind
        NTConfig_AttackSkill[1] = 151;
        NTConfig_AttackSkill[3] = 151;
        NTConfig_AttackSkill[5] = 152;
        break;
    }

    return (NTConfig_AttackSkill[1] && NTConfig_AttackSkill[3]);
}

function NTA_BarbarianAttackInt(target, firstorder)
{
    var _primaryindex;

    if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe&0x10, NTConfig_CheckMercSafe&0x10))
    {
        if(!NTTMGR_VisitTown())
            return 0;
    }

    if(firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100)
    {
        if(GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4))
        {
            var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[0], 4);

            if(_pos)
                NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
        }

        if(!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target))
            return 2;

        return 3;
    }

    _primaryindex = (target.spectype&0x0A) ? 1 : 3;

    if(NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100)
    {
        if((_NTA_SkillRange[_primaryindex] < 4 || NTConfig_AttackSkill[_primaryindex] == 151) && !CheckCollision(target.areaid, target.x, target.y, 1))
            return 1;

        if(!NTA_BarbarianCastSkillInt(_primaryindex, target))
            return 2;

        return 3;
    }

    if(NTConfig_AttackSkill[5] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[5]) < 100)
    {
        if((_NTA_SkillRange[5] < 4 || NTConfig_AttackSkill[5] == 151) && !CheckCollision(target.areaid, target.x, target.y, 1))
            return 1;

        if(!NTA_BarbarianCastSkillInt(5, target))
            return 2;

        return 3;
    }

    return 1;
}

function NTA_BarbarianCastSkillInt(index, target)
{
    if(NTConfig_AttackSkill[index] == 151)
    {
        var _castx, _casty;

        if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 5))
        {
            var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 5);

            if(_pos)
                NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
        }

        _castx =  target.x > me.x ? target.x+3 : target.x-3;
        _casty =  target.y > me.y ? target.y+3 : target.y-3;

        return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], _castx, _casty);
    }

    if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4))
    {
        var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);

        if(_pos)
            NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
    }

    return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
}

function NTA_DruidAttackPatternInt()
{
    return false;
}

function NTA_DruidAttackInt(target, firstorder)
{
    return 1;
}

function NTA_DruidCastSkillInt(index, target)
{
    return false;
}

function NTA_AssassinAttackPatternInt()
{
    return false;
}

function NTA_AssassinAttackInt(target, firstorder)
{
    return 1;
}

function NTA_AssassinCastSkillInt(index, target)
{
    return false;
}


function NTA_GetChest(_openThis)
{
   // Mod By: Mythosis
   ///////////////////////////////

   var i;
   var _chest;
   var _openableList = ["Altar",
   "animated skulland rockpile",
   "ArmorStand",
   "Barrel",
   "barrel wilderness",
   "Basket",
   "bed",
   "body",
   "BoneChest",
   "burialchestL",
   "burialchestR",
   "burninglogs",
   "Casket",
   "chest",
   "Chest3",
   "ChestL",
   "chestR",
   "ChestSL",
   "ChestSR",
   "cocoon",
   "coffin",
   "CorpseOnStick",
   "Crate",
   "deadbarbarian",
   "deadperson",
   "deadperson2",
   "dead guard",
   "Dummy",
   "dummy",
   "earmorstandL",
   "earmorstandR",
   "eunuch",
   "evilurn",
   "eweaponrackL",
   "eweaponrackR",
   "explodingchest",
   "funeralpire",
   "goo pile",
   "groundtomb",
   "groundtombL",
   "hidden stash",
   "hiding spot",
   "hollow log",
   "HungSkeleton",
   "icecavejar1",
   "icecavejar2",
   "icecavejar3",
   "icecavejar4",
   "jar1",
   "jar2",
   "jar3",
   "jug",
   "LargeUrn",
   "loose boulder",
   "loose rock",
   "Obelisk",
   "pileofskullsandrocks",
   "pillar",
   "ratnest",
   "RockPIle",
   "RogueCorpse",
   "sarcophagus",
   "skullpile",
   "stash",
   "Sarcophagus",
   "skeleton",
   "skull pile",
   "tomb1",
   "tomb1L",
   "tomb2",
   "tomb2L",
   "tomb3",
   "tomb3L",
   "TowerTome",
   "TrappedSoul",
   "Trophy Case",
   "Urn",
   "WeaponRack",
   "woodchestL",
   "woodchestR",
   "woodchest2L",
   "woodchest2R"];
   
   switch(_openThis)
   {
      case 1:
         break;
      case 2:
         break;
      default:
         _openThis = 0;
         break;
   }

   do
   {
      switch(_openThis)
      {
         case 0:   //Do Nothing
         case 1:   //Open "chest"
            _chest = NTC_FindUnit(NTC_UNIT_OBJECT, "chest");
            break;
         case 2:   //Open All
            for( i=0; i < _openableList.length; i++ )
            {
               _chest = NTC_FindUnit(NTC_UNIT_OBJECT, _openableList[i]);
               if(_chest)
               {
                  i = _openableList.legth;
               }
            }
            break;
         default:
            break;
      }

      if(_chest)
      {
         if(NTC_OpenChest(_chest))
         {
            Delay(500);
            NTSI_PickItems();
         }
      }
      else
      {
         i = -1;
      }
      _chest = "undefined";
   } while(i > -1);
}
« Last Edit: October 15, 2010, 11:40:39 AM by mythosis »

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: [D2NT] Open All Chests
« Reply #1 on: October 09, 2010, 04:53:58 PM »

Offline mythosis

  • PK Pro
  • ****
  • Join Date: Aug 2010
  • Posts: 265
  • Reputation 0
  • USWest Channel: op pkbaal
    • View Profile
Re: [D2NT] Open All Chests
« Reply #2 on: October 15, 2010, 11:48:14 AM »
Hello myth. Sorry its taken so long. Been busy.
May I first suggest you try using my install package? Its in my sigy, and has every mod I've published and other changes.
If not, I'll be more then willing to help you fix this in your own script.

"openallchest is undefined"
I would check that you followed steps 1 & 2 correctly.
1 is the file config.ntl
2 is config_paladin_yourname.ntl

Offline Felix_Jaeger

  • PK Beginner
  • **
  • Join Date: Jun 2011
  • Posts: 52
  • Reputation 0
  • Followed guide, doesn't work, need better guide ty
    • View Profile
Re: [D2NT] Open All Chests
« Reply #3 on: June 20, 2011, 09:52:01 AM »
Does this only work for paladins

im ont he NTC_CHAR part and your sample shows paladin, i want to use this on my sorc so i look through but there is no sorc there is every other class

but no sorc, where whould i put it?

because right now this doesnt work, no chests are opened

please help
« Last Edit: June 20, 2011, 10:28:56 AM by noobbot »

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: [D2NT] Open All Chests
« Reply #3 on: June 20, 2011, 09:52:01 AM »

Offline fade

  • Newbie
  • *
  • Join Date: Jun 2011
  • Posts: 11
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: [D2NT] Open All Chests
« Reply #4 on: June 20, 2011, 10:42:15 AM »
just download the coopd2nt from here the options work for sorc i use it on mine

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: [D2NT] Open All Chests
« Reply #4 on: June 20, 2011, 10:42:15 AM »

Offline Felix_Jaeger

  • PK Beginner
  • **
  • Join Date: Jun 2011
  • Posts: 52
  • Reputation 0
  • Followed guide, doesn't work, need better guide ty
    • View Profile
Re: [D2NT] Open All Chests
« Reply #5 on: June 20, 2011, 11:29:00 AM »
i have but the boss scripts are, shall we say somewhat lacking for what i want to use sorc for, i want to clear various map's not just kill the bosses
but this bot does not have the option like others ive found, which tbh is annoying because i like this bot

p.s
Thankyou for taking time to reply albeit  not very helpful based on the topic/question
« Last Edit: June 20, 2011, 11:31:27 AM by noobbot »

Online Justin

  • I run this bitch!
  • Administrator
  • PureKaoz HeRo
  • *****
  • Join Date: Apr 2010
  • Posts: 688
  • Reputation 3
  • Fck Bnet
    • View Profile
    • PureKaoz.com
    • Youtube's channel
Re: [D2NT] Open All Chests
« Reply #6 on: June 20, 2011, 01:47:41 PM »
i have but the boss scripts are, shall we say somewhat lacking for what i want to use sorc for, i want to clear various map's not just kill the bosses
but this bot does not have the option like others ive found, which tbh is annoying because i like this bot

p.s
Thankyou for taking time to reply albeit  not very helpful based on the topic/question

The D2NT CoopMod has every script that is available to D2NT... and if it doesn't you can copy/paste it in... it's your best option to open chests, especially instead of going and copy/pasting a script into your bot not knowing what you are doing.
USEast Channel: Clan Kaoz
HighLyfe@jsp

Offline Felix_Jaeger

  • PK Beginner
  • **
  • Join Date: Jun 2011
  • Posts: 52
  • Reputation 0
  • Followed guide, doesn't work, need better guide ty
    • View Profile
Re: [D2NT] Open All Chests
« Reply #7 on: June 20, 2011, 02:09:07 PM »
i have but the boss scripts are, shall we say somewhat lacking for what i want to use sorc for, i want to clear various map's not just kill the bosses
but this bot does not have the option like others ive found, which tbh is annoying because i like this bot

p.s
Thankyou for taking time to reply albeit  not very helpful based on the topic/question

The D2NT CoopMod has every script that is available to D2NT... and if it doesn't you can copy/paste it in... it's your best option to open chests, especially instead of going and copy/pasting a script into your bot not knowing what you are doing.

thankyou for your reply

and yes it is a good bot i downloaded it after the chest script didnt work in any of the others

but the problem with this bot is that it doesnt cover the areas i need, between the other bots  ihave  they have options where you can clear cold plains, black marsh, act 4 zones and various other full zones after killing a boss, or just a script for the zone itself

which i need to do because i want to use the bot to farm up gems

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: [D2NT] Open All Chests
« Reply #7 on: June 20, 2011, 02:09:07 PM »

Offline fade

  • Newbie
  • *
  • Join Date: Jun 2011
  • Posts: 11
  • Reputation 0
  • I <3 PureKaoz.com
    • View Profile
Re: [D2NT] Open All Chests
« Reply #8 on: June 22, 2011, 03:03:36 AM »
i like that idea would be nice for lvling noobs at the early lvls

PureKaoz.com - D2NT, Diablo 3 & Starcaft 2 Hacks

Re: [D2NT] Open All Chests
« Reply #8 on: June 22, 2011, 03:03:36 AM »