|
You last visited: Today at 12:00
Advertisement
[Release] Muddy's D2NT
Discussion on [Release] Muddy's D2NT within the Diablo 2 Programming forum part of the Diablo 2 category.
05/06/2011, 11:19
|
#1726
|
elite*gold: 358
Join Date: Jul 2009
Posts: 1,519
Received Thanks: 288
|
danke dir ist echt geil dein goldbarb script und konnte alles schnell einstellen und das sogar direckt nach dem aufstehen^^.
aber was nur schade ist das ich den sternis nicht mehr nutzen kann da dann ein "loader" nicht mehr klappt.
|
|
|
05/06/2011, 11:56
|
#1727
|
elite*gold: 5
Join Date: Apr 2010
Posts: 689
Received Thanks: 151
|
Quote:
Originally Posted by Denny456
danke dir ist echt geil dein goldbarb script und konnte alles schnell einstellen und das sogar direckt nach dem aufstehen^^.
aber was nur schade ist das ich den sternis nicht mehr nutzen kann da dann ein "loader" nicht mehr klappt.
|
Ich nehm an mit "loader" meinst du "Manager"...
Da gibts nur eins :P komplett auf den besten "D2NT" Bot zu wechseln :P (Muddy's natürlich)
Ich weiss auch nicht was der noch für wünsche offen lässt. (ausser, dass Muddy sich weigert ein Leechbot/Leaderbot Script einzufügen :P)
|
|
|
05/06/2011, 12:08
|
#1728
|
elite*gold: 358
Join Date: Jul 2009
Posts: 1,519
Received Thanks: 288
|
@ Derbeth jo genau das meinte ich und ja sternis nutze ich wegen dem leecher script^^
|
|
|
05/06/2011, 12:40
|
#1729
|
elite*gold: 0
Join Date: May 2010
Posts: 4
Received Thanks: 0
|
bekomm static nicht zum laufen
Hallo Leutz!
Hab Muddy's mal geladen und bin allein schon vom waypoint catcher begeistert. Nun wollte ich ein bisschen meppeln und muß leider festellen das trotz eingestelltem NTConfig_CastStatic = 60; bei mir nix passiert. Also kein Static auf Meppel. Auch auf Andy, Duriel oder so mach meine Sorce kein Static.
Hab ne light sorc und Static ist natürlich auch geskillt.
Hab auch schon bei
MWConfig_StaticTargets.push(242); // Mephisto
die kombination mit ("Mephisto") und ("mephisto") probiert.
Vielleicht weiß ja jemand von euch rat.
Besten Dank!
|
|
|
05/06/2011, 13:02
|
#1730
|
Administrator
elite*gold: 41624
Join Date: Jan 2010
Posts: 22,728
Received Thanks: 12,654
|
So, ich hoffe nur, ich habe nicht die hälfte Vergessen, so 2-3 Seiten Beiträge auf einmal sind immer etwas viel.
An dieser Stelle nochmal vielen Dank an alle, die hier mithelfen und mir die Arbeit so ein stückweit abnehmen!
Quote:
Originally Posted by fischdinho
Hallo,
mal ne Frage : habt ihr mit dem Chest Bot von Muddys gute erfahrungen gemacht ???
|
Ja, ich.
Quote:
Originally Posted by Derbeth
Ist es möglich dass ich im Toolsentry auch den Horadric Cube loggen kann, um z.B das Ilvl festzustellen oder eine schöne itemausgabe für d2jsp habe?
|
Möglich schon, ich denke aber nicht, dass ich in Sachen Logs noch irgendwas entwickle, was nicht auf meinen MuleManager abgestimmt ist, einfach weil ich dort sehr viel mehr Möglichkeiten habe, als wenn ich das D2NT seitig angehe.
Quote:
Originally Posted by seltn
Moinsen!
Hab ein kleines Problem!
Mein Goldbarb hebt ziemlich viele items auf, die wenig gold beim verkauf bringen.
< 10k gold.
Dadurch geht er pro run ein paar mal in die stadt und verkauft sie,
Das zieht die runs natürlich in die länge.
Gibt es eine möglichkeit eine minimum olgd-verkaufsgrenze zu setzen oder sowas ähnliches?
Lg Seltn
|
Die Sachen hast du vermutlich in den .nips, oder?
Mein Tipp:
Nimm den Krempel dort raus.
Füge am Ende deines Travi Scripts einen Aufruf:
Code:
NTSI_PickItems(true);
ein.
Durch den Parameter legst du fest, dass Items nur zum Verkauf aufgehoben werden und zwar gerade die, die potentiell viel Gold einbringen.
Dein Char wird dabei nur soviele Items aufheben, wie er unterbringen kann, der Rest bleibt liegen.
Achte drauf, dass du einen zusätzlichen Aufruf einfügst, das soll nicht den alten Aufruf ersetzen.
Quote:
Originally Posted by AlderonXP
Hallo Leutz!
Hab Muddy's mal geladen und bin allein schon vom waypoint catcher begeistert. Nun wollte ich ein bisschen meppeln und muß leider festellen das trotz eingestelltem NTConfig_CastStatic = 60; bei mir nix passiert. Also kein Static auf Meppel. Auch auf Andy, Duriel oder so mach meine Sorce kein Static.
Hab ne light sorc und Static ist natürlich auch geskillt.
Hab auch schon bei
MWConfig_StaticTargets.push(242); // Mephisto
die kombination mit ("Mephisto") und ("mephisto") probiert.
Vielleicht weiß ja jemand von euch rat.
Besten Dank!
|
Ersetz deine NTAttack library mal durch folgende, ich meine mich vage zu erinnern, dass dort diesbezüglich ein Bug drin warm bin aber unsicher, weil ich recht schlampig bin, was das Change Log angeht:
Code:
/**
* This file was modified by
* Check the programming section for updates and further scripts
* Last Update: 15:51 16.04.2011
*/
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 _MWA_Attack_Slot = -1;
var _MWA_Merc_Weapon_Type = -1;
var _MWA_Corpse_Damage_Radius = -1.0;
var _MWA_Minion_Counts = new Array(-1, -1, -1);
var _NTA_SkillHand = new Array(10);
var _NTA_SkillDamage = new Array(10);
var _NTA_SkillRange = new Array(10);
var _MWA_SkipList = new Array();
var _MWA_Attack_Time = new Array();
var _MWA_Traps;
function NTA_Initialize()
{
if(NTConfig_AttackSkill[1] == 0 || NTConfig_AttackSkill[3] == 0)
NTA_DetectAttackPattern();
for(var i = 0; i < NTConfig_AttackSkill.length; 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 MWS_TORNADO:
_NTA_SkillRange[i] = MWConfig_TornadoRange;
break;
case MWS_TWISTER:
_NTA_SkillRange[i] = MWConfig_TwisterRange;
break;
case MWS_FROST_NOVA: //Frost Nova
case MWS_NOVA: // Nova
case MWS_HOLY_BOLT: // Holy Bolt
_NTA_SkillRange[i] = 5;
break;
case MWS_FIRE_BLAST:
case MWS_SHOCK_WEB:
case MWS_FROZEN_ORB: // Frozen Orb
_NTA_SkillRange[i] = 15;
break;
case MWS_CORPSE_EXPLOSION: // Corpse Explosion
_NTA_SkillRange[i] = 25;
break;
case MWS_SMITE: // Smite
case MWS_ZEAL: // Zeal
_NTA_SkillHand[i] = NTC_HAND_LEFT; // Make sure those skills are casted without shift being hold
case MWS_BLESSED_HAMMER: //Blessed Hammer
case MWS_BERSERK: //Berserk
case MWS_WAR_CRY: // War Cry
_NTA_SkillRange[i] = 3;
break;
case MWS_WHIRLWIND: //Whirlwind
_NTA_SkillRange[i] = 8;
break;
case MWS_INFERNO:
_NTA_SkillRange[i] = 10;
break;
// Range definition for traps: [0]: range to place a trap [1]: range of the trap itself
case MWS_CHARGED_BOLT_SENTRY:
case MWS_WAKE_OF_FIRE:
case MWS_WAKE_OF_INFERNO:
_NTA_SkillRange[i] = [15, 10];
break;
case MWS_LIGHTNING_SENTRY:
case MWS_DEATH_SENTRY:
_NTA_SkillRange[i] = [15, 20];
break;
default:
_NTA_SkillRange[i] = 20;
break;
}
}
}
}
function NTA_KillMonster(search)
{
var _target, _attackcount, _attacksFailed;
if(NTConfig_AttackSkill[1] < 1)
return false;
_target = NTC_FindUnit(NTC_UNIT_MONSTER, search, 5);
if(!_target)
return false;
if(_target.IsAttackable())
{
_attackcount = 0;
_attacksFailed = 0;
if(MWConfig_ClearBossPosition && me.diff > 0 && MWA_FindNearbyMonsters(10, _target))
NTA_ClearPosition(15, false, 0, false, false);
while(_attackcount < 350 && NTA_IsValidMonster(_target))
{
if(MWConfig_ShowOverheadStatus)
MWA_PrintAttackStatus(1, _target);
if(NTA_Attack(_target, (_attackcount % 30) == 0) < 2)
_attacksFailed++;
_attackcount++;
if(_attacksFailed > 2)
break;
}
}
if(MWConfig_PickItemsInstantly && (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12))
NTSI_PickItems();
return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
}
function NTA_ClearPosition(range, pickitem, safelevel, openchests, usefinditem, spectype)
{
var _orgx, _orgy;
var _spectype = [0x0A, 0x0E, 0x01];
var _skiplist;
var _attackcount = 0;
var _target;
var _distance, _mingid, _mindistance;
var _mingidPrio, _mindistPrio;
var _result;
var _outputType;
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 = 2;
case 3:
if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
safelevel = 0;
openchests = true;
case 4:
usefinditem = true;
case 5:
break;
default:
if(spectype > 0x01)
_spectype = [spectype];
}
if(_spectype.length == 3 && (me.classid == NTC_CHAR_CLASS_NECROMANCER || me.classid == NTC_CHAR_CLASS_SORCERESS && MWConfig_KeepDistanceToMonsters))
_spectype = [0x01];
_orgx = me.x;
_orgy = me.y;
for(var i = 0; i < _spectype.length; i++)
{
_skiplist = new Array();
while(_attackcount < (i+1)*100)
{
_mindistance = 1E6;
_mindistPrio = 1E6;
_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;
}
if(MWA_IsPriorityTarget(_target))
{
if(_distance < _mindistPrio)
{
_mingidPrio = _target.gid;
_mindistPrio = _distance;
}
}
}
}
else
_skiplist.push(_target.gid);
}
} while(_target.GetNext());
}
if(_mindistance < 1E6)
{
if(_mindistPrio < 1E6)
{
_target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingidPrio, 1);
_outputType = 1;
}
else
{
_target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid, 1);
_outputType = 0;
}
if(_target)
{
if(MWConfig_ShowOverheadStatus)
MWA_PrintAttackStatus(_outputType, _target);
_result = NTA_Attack(_target, (_attackcount % 30) == 0);
if(MWConfig_ShowOverheadStatus)
MWA_PrintAttackStatus(_outputType, _target);
switch(_result)
{
case 1:
_skiplist.push(_mingid);
break;
case 2:
case 3:
if(MWConfig_PickItemsInstantly && (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12))
NTSI_PickItems();
_attackcount++;
break;
default:
return false;
}
}
}
else
break;
}
}
if(_attackcount > 2)
{
switch(me.classid)
{
case NTC_CHAR_CLASS_PALADIN:
if(parseInt(me.hp * 100 / me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp * 100 / me.mpmax) < NTConfig_UseRedemptionMP)
{
if(NTC_PutSkill(MWS_REDEMPTION, NTC_HAND_RIGHT))
NTC_PingDelay(1000);
}
break;
case NTC_CHAR_CLASS_BARBARIAN:
if(usefinditem && MWConfig_UseFindItem)
MWL_FindItem(MWConfig_FindItemRange);
break;
case NTC_CHAR_CLASS_NECROMANCER:
MWA_RaiseMinions();
break;
}
}
if(pickitem && _attackcount > 0)
NTSI_PickItems();
if(MWConfig_OpenAllNearbyChests && openchests)
MWL_OpenNearbyChests(MWConfig_OpenChestsRange);
if(MWConfig_ActivateNearbyShrines)
MWL_ActivateNearbyShrines();
switch(safelevel)
{
case 1:
return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
case 2:
return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
}
if(MWConfig_IdentAfterPickup)
MWL_IDItemsAfterPickup();
return true;
}
function NTA_ClearLevel(pickitem, safelevel, spectype)
{
var _room, _rooms;
var _distance, _minindex, _mindistance;
_room = GetRoom();
if(!_room)
return false;
switch(arguments.length)
{
case 0:
pickitem = true;
case 1:
safelevel = 2;
case 2:
if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
safelevel = 0;
default:
spectype = 0x01;
}
_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(var 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, spectype))
return false;
NTP_DoPrecast(false);
}
_rooms.splice(_minindex, 1);
}
return true;
}
function NTA_ClearRoom(pickitem, safelevel, spectype)
{
var _room;
var _spectype = [0x0A, 0x0E, 0x01];
var _skiplist;
var _attackcount = 0;
var _target;
var _distance, _mingid, _mindistance;
var _mingidPrio, _mindistPrio;
var _result;
var _outputType;
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;
case 2:
if(NTConfig_CheckSelfSafe < 0x01 && NTConfig_CheckMercSafe < 0x01)
safelevel = 0;
default:
if(spectype > 0x01)
_spectype = [spectype];
}
if(_spectype.length == 3 && (me.classid == NTC_CHAR_CLASS_NECROMANCER || me.classid == NTC_CHAR_CLASS_SORCERESS && MWConfig_KeepDistanceToMonsters))
_spectype = [0x01];
for(var i = 0; i < _spectype.length; i++)
{
_skiplist = new Array();
while(_attackcount < (i+1)*100)
{
_mindistance = 1E6;
_mindistPrio = 1E6;
_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;
}
if(MWA_IsPriorityTarget(_target))
{
if(_distance < _mindistPrio)
{
_mingidPrio = _target.gid;
_mindistPrio = _distance;
}
}
}
}
else
_skiplist.push(_target.gid);
}
} while(_target.GetNext());
}
if(_mindistance < 1E6)
{
if(_mindistPrio < 1E6)
{
_target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingidPrio, 1);
_outputType = 1;
}
else
{
_target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid, 1);
_outputType = 0;
}
if(_target)
{
if(MWConfig_ShowOverheadStatus)
MWA_PrintAttackStatus(_outputType, _target);
_result = NTA_Attack(_target, (_attackcount%30) == 0);
if(MWConfig_ShowOverheadStatus)
MWA_PrintAttackStatus(_outputType, _target);
switch(_result)
{
case 1:
_skiplist.push(_mingid);
break;
case 2:
case 3:
if(MWConfig_PickItemsInstantly && (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12))
NTSI_PickItems();
_attackcount++;
break;
default:
return false;
}
}
}
else
break;
}
}
if(_attackcount > 2)
{
switch(me.classid)
{
case NTC_CHAR_CLASS_PALADIN:
if(parseInt(me.hp * 100 / me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp * 100 / me.mpmax) < NTConfig_UseRedemptionMP)
{
if(NTC_PutSkill(MWS_REDEMPTION, NTC_HAND_RIGHT))
NTC_PingDelay(1000);
}
break;
case NTC_CHAR_CLASS_BARBARIAN:
if(MWConfig_UseFindItem)
MWL_FindItem(MWConfig_FindItemRange);
break;
case NTC_CHAR_CLASS_NECROMANCER:
MWA_RaiseMinions();
break;
}
}
if(pickitem && _attackcount > 0)
NTSI_PickItems();
if(MWConfig_OpenAllNearbyChests)
MWL_OpenNearbyChests(_room);
if(MWConfig_ActivateNearbyShrines)
MWL_ActivateNearbyShrines();
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 || monster.mode == 14))
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) // ignore submerged WaterWatchers
return false;
if(monster.GetState(53) || monster.GetState(96)) // Conversion, Revive
return false;
if(!CheckCollision(me, monster, 0)) // Invalid map location
return false;
return true;
}
function NTA_GetDamageType(skillid, target, skillindex)
{
if(target && MWA_IsUndead(target))
{
if(skillid == MWS_HOLY_BOLT || me.GetState(47) || !isNaN(skillindex) && _NTA_SkillDamage[skillindex] == NTA_DAMAGE_PHYSICAL && NTConfig_AttackSkill[skillindex + 1] == MWS_SANCTUARY)
return NTA_DAMAGE_NONE;
}
if(skillid == MWS_CORPSE_EXPLOSION) // Corpse Explosion
return NTA_DAMAGE_PHYSICAL;
if(skillid == MWS_BLESSED_HAMMER) // 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:
if(MWA_IsUndead(enemy) && me.GetState(47))
break;
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, _immuneTarget, _useStatic;
_useStatic = false;
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(_MWA_SkipList.indexOf(target.gid) > -1)
return 1;
if(MWConfig_AttacksBeforeRepositioning > 0 && _MWA_Attack_Time[3] % MWConfig_AttacksBeforeRepositioning == 0)
{
var _vec = MWA_GetEvasionVector(4, 2, target);
if(_vec && !_vec.isZero())
NTM_MoveTo(target.areaid, parseInt(target.x + _vec.x), parseInt(target.y + _vec.y), 0);
}
_immuneTarget = MWA_CheckMonsterImmunity(target);
if(_immuneTarget && NTConfig_BehaviourOnImmuneMonster == 2 && !(target.spectype&0x02) && me.areaid != 131 || MWA_CheckAttackTimeLimit(target))
{
_MWA_SkipList.push(target.gid);
return 1;
}
if(_immuneTarget)
{
if(NTConfig_BehaviourOnImmuneMonster == 3 && NTConfig_AttackSkill[8] > 0) // Attack the target using the selected skill
{
if(!NTA_SorceressCastSkillInt(8, target))
return 2;
return 3;
}
else if(NTConfig_BehaviourOnImmuneMonster == 1 && NTC_GetMerc())// Get close so the merc can attack the target
{
if(GetDistance(me, target) > 5)
NTM_MoveTo(target.areaid, target.x + 2, target.y + 2);
NTC_Delay(100);
_useStatic = true;
}
}
if(firstorder && NTConfig_AttackSkill[0] > 0 && MWA_CheckMonsterResistance(target, _NTA_SkillDamage[0]) && 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((_useStatic || MWA_UseStaticOnTarget(target)) && NTConfig_CastStatic < 100 && parseInt(target.hp * 100 / target.hpmax) > NTConfig_CastStatic && MWA_CheckMonsterResistance(target, NTA_DAMAGE_LIGHTNING))
{
var _staticlevel = NTC_GetSkillLevel(MWS_STATIC_FIELD);
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(MWS_STATIC_FIELD, NTC_HAND_RIGHT, _castx, _casty))
return 2;
return 3;
}
}
if(_useStatic)
return 3;
_primaryindex = (target.spectype&0x0A) ? 1 : 3;
if(MWA_CheckMonsterResistance(target, _NTA_SkillDamage[_primaryindex]))
{
if(!NTA_SorceressCastSkillInt(_primaryindex, target))
return 2;
return 3;
}
if(NTConfig_AttackSkill[5] > 0 && MWA_CheckMonsterResistance(target, _NTA_SkillDamage[5]))
{
if(!NTA_SorceressCastSkillInt(5, target))
return 2;
return 3;
}
return 1;
}
function NTA_SorceressCastSkillInt(index, target, evade)
{
var _maxDist, _pos;
if(arguments.length < 3)
evade = true;
switch(target.classid)
{
case 310: // Doom Knight (CS)
case 362: // Venom Lord (CS)
case 472: // Hell Temptress
case 510: // Death Lord (Throne)
case 558: // Venom Lord (Throne)
case 571: // Minion of Desctrution (Throne)
case 638: // Vile Witch
case 691: // Undead Soul Killer (Throne)
_maxDist = 5;
break;
default:
_maxDist = 4;
break;
}
if(evade && NTC_GetSkillLevel(MWS_TELEPORT) >= 1 && MWA_CalcDistToClosestMonster() <= _maxDist && MWConfig_KeepDistanceToMonsters && MWA_AreaCheckEvading(me.areaid))
return MWA_MoveAwayFromMonster(target);
if(me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8)
{
if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4))
{
_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 && (index == 8 || MWA_CheckMonsterResistance(target, _NTA_SkillDamage[index + 1])))
{
if(GetDistance(me, target) > _NTA_SkillRange[index+1] || !CheckCollision(me, target, 4))
{
_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);
}
else if(NTConfig_AttackSkill[7] > 0 && MWA_CheckMonsterResistance(target, _NTA_SkillDamage[7]))
{
if(GetDistance(me, target) > _NTA_SkillRange[7] || !CheckCollision(me, target, 4))
{
_pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[7], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
return NTC_CastSkill(NTConfig_AttackSkill[7], _NTA_SkillHand[7], 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)
{
var _nextCorpse, _gid, _vec, _viciousFoe, _count, _pos;
var i;
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(_MWA_SkipList.indexOf(target.gid) > -1)
return 1;
if(MWA_CheckAttackTimeLimit(target))
{
_MWA_SkipList.push(target.gid);
return 1;
}
if(MWConfig_AttacksBeforeRepositioning > 0 && _MWA_Attack_Time[3] % MWConfig_AttacksBeforeRepositioning == 0)
{
_vec = MWA_GetEvasionVector(4, 2, target);
if(!_vec && !_vec.isZero())
NTM_MoveTo(target.areaid, parseInt(target.x + _vec.x), parseInt(target.y + _vec.y), 0);
}
_viciousFoe = MWA_IsHazardousMonster(target);
// Define the maximum values once as they are mostly constant anyway
if(_MWA_Corpse_Damage_Radius < 0 || _MWA_Minion_Counts[0] < 0 || _MWA_Minion_Counts[1] < 0 || _MWA_Minion_Counts[2] < 0)
{
// Define the Corpse or Poison Explosion Range Radius
if(NTConfig_AttackSkill[3] == 74)
_MWA_Corpse_Damage_Radius = MWA_CalcCorpseExplosionRadius();
else
_MWA_Corpse_Damage_Radius = 5; // TODO: Check poison exp range
MWA_SetMinionCounts();
}
// Cast the initial attack unless it is a curse and the target is already cursed
if(!_viciousFoe && firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && me.GetSkillStatus(NTConfig_AttackSkill[0]) != 8 && !MWA_GetCurseState(NTConfig_AttackSkill[0], target))
{
if(GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4))
{
_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;
}
// The current target is vicious and we gotta use the selected skill in order to make it less dangerous
if(_viciousFoe && !MWA_GetCurseState(NTConfig_AttackSkill[2], target))
{
if(GetDistance(me, target) > _NTA_SkillRange[2] || !CheckCollision(me, target, 4))
{
_pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[2], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
if(!NTA_NecromancerCastSkillInt(2, target))
return 2;
return 3;
}
// Use the standard curse unless the monster is already curse
if(!_viciousFoe && !MWA_GetCurseState(NTConfig_AttackSkill[1], target))
{
if(GetDistance(me, target) > _NTA_SkillRange[1] || !CheckCollision(me, target, 4))
{
_pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[1], 4);
if(_pos)
NTM_MoveTo(target.areaid, _pos[0], _pos[1], 0);
}
if(!NTA_NecromancerCastSkillInt(1, target))
return 2;
return 3;
}
// The target is vicious and some monsters are very close to the char --> Evade
if(_viciousFoe && MWA_CalcDistToClosestMonster() < 3)
{
MWA_MoveAwayFromMonster(target);
_vec = MWA_GetEvasionVector(3, 2);
if(!_vec || _vec.isZero())
{
_vec = new vector(me.x - target.x, me.y - target.y);
_vec.normalize();
}
_vec.setlength(3);
NTC_Delay(100);
ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, me.x + parseInt(_vec.x), me.y + parseInt(_vec.y));
NTC_Delay(100);
ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
NTC_Delay(100);
return 3;
}
// Find the corpse closest to the target's current position
_gid = MWA_GetClosestCorpseGID(target.x, target.y);
// Instantiate the unit if a valid gid was found
if(_gid > 0)
_nextCorpse = NTC_FindUnit(NTC_UNIT_MONSTER, _gid);
if(_nextCorpse)
{
// Use the corpse closest to the target in order to raise primary minions if you do not already have the desired amount of minions
_count = MWC_GetMinionCount(NTConfig_AttackSkill[4]);
if(_count < _MWA_Minion_Counts[0] - 1)
{
if(MWConfig_ShowOverheadStatus)
{
if(NTConfig_AttackSkill[4] == 95)
MWC_PrintOverheadStatus("Reviving " + _corpse.name + " (" + (_count + 1) + "/" + _MWA_Minion_Counts[0] + ")");
else
MWC_PrintOverheadStatus("Summoning " + MWC_GetMinionName(NTConfig_AttackSkill[4]) + " (" + (_count + 1) + "/" + _MWA_Minion_Counts[0] + ")");
}
if(!NTA_NecromancerCastSkillInt(4, _nextCorpse))
return 2;
return 3;
}
// Use the corpse to attack the target using corpse or poison explosion
if(GetDistance(target, _nextCorpse) <= _MWA_Corpse_Damage_Radius)
{
if(!NTA_NecromancerCastSkillInt(3, _nextCorpse))
return 2;
return 3;
}
}
// The target is not too dangerous and the average target - minion distance is too high --> Move close to the target
if(!_viciousFoe && MWA_CalcAverageMinionDistance(target) > 4.0)
{
_vec = new vector(me.x - target.x, me.y - target.y);
if(_vec && !_vec.isZero())
{
_vec.normalize();
NTM_MoveTo(target.areaid, target.x + parseInt(2 * _vec.x), target.y + parseInt(2 * _vec.y));
}
}
// If the distance to our minions is rather short (stuck on our position?) or some enemy monsters are close --> Step aside
if(MWA_CalcAverageMinionDistance() < 2.0 || MWA_CalcDistToClosestMonster() < 3)
{
_vec = MWA_GetEvasionVector(3, 2);
if(!_vec || _vec.isZero())
_vec = new vector(me.x - target.x, me.y - target.y);
_vec.setlength(3);
NTC_Delay(100);
ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, me.x + parseInt(_vec.x), me.y + parseInt(_vec.y));
NTC_Delay(100);
ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
NTC_Delay(100);
return 3;
}
// If the enemy is vicious or if our minions are already close to the target --> Wait and let the minions do their job
if(_viciousFoe && MWA_CalcDistToClosestMonster() > 3 || MWA_CalcAverageMinionDistance(target) <= 4.0)
{
for(i = 0; i < 20; i++)
{
NTC_Delay(NTC_DELAY_FRAME);
if(MWA_GetClosestCorpseGID(target.x, target.y, _MWA_Corpse_Damage_Radius) > 0 || !NTA_IsValidMonster(target))
break;
}
return ((i >= 20) ? 3 : 2);
}
NTC_Delay(250);
return NTA_NecromancerAttackInt(target, firstorder);
}
function NTA_NecromancerCastSkillInt(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);
}
for(var i = 0; i < 25; i++)
{
NTC_Delay(NTC_DELAY_FRAME);
if(me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8)
break;
}
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, _immuneTarget;
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(_MWA_SkipList.indexOf(target.gid) > -1)
return 1;
if(MWConfig_AttacksBeforeRepositioning > 0 && _MWA_Attack_Time[3] % MWConfig_AttacksBeforeRepositioning == 0)
{
var _vec = MWA_GetEvasionVector(4, 2, target);
if(_vec && !_vec.isZero())
NTM_MoveTo(target.areaid, parseInt(target.x + _vec.x), parseInt(target.y + _vec.y), 0);
}
_immuneTarget = MWA_CheckMonsterImmunity(target);
if(_immuneTarget && NTConfig_BehaviourOnImmuneMonster == 2 && !(target.spectype&0x02) && me.areaid != 131 || MWA_CheckAttackTimeLimit(target)) // Skip the target
{
_MWA_SkipList.push(target.gid);
return 1;
}
if(_immuneTarget)
{
if(NTConfig_BehaviourOnImmuneMonster == 3 && NTConfig_AttackSkill[8] > 0) // Attack the target using the selected skill
{
if(!NTA_PaladinCastSkillInt(8, target))
return 2;
return 3;
}
else if(NTConfig_BehaviourOnImmuneMonster == 1 && MWA_FindNearbyMonsters(15, target) < 3 && NTC_GetMerc())// Get close so the merc can attack the target
{
if(GetDistance(me, target) > 5)
NTM_MoveTo(target.areaid, target.x + 3, target.y + 3);
NTC_Delay(100);
return 2;
}
}
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 || MWA_IsUndead(target) && NTConfig_AttackSkill[_primaryindex + 1] == 119 && _NTA_SkillDamage[_primaryindex] == NTA_DAMAGE_PHYSICAL)
{
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_GetDamageType(NTConfig_AttackSkill[5], target, 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] == MWS_BLESSED_HAMMER)
{
if(GetDistance(me, target) > 2 && (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))
{
switch(Random(0, 2))
{
case 0:
NTM_MoveTo(target.areaid, target.x + 1, target.y, 0);
break;
case 1:
NTM_MoveTo(target.areaid, target.x + 2, target.y - 1, 0);
break;
default:
NTM_MoveTo(target.areaid, target.x + 2, target.y, 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(target.classid == 704 && NTConfig_AttackSkill[7] > 0)
NTC_PutSkill(NTConfig_AttackSkill[7], NTC_HAND_RIGHT);
else 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(MWS_WHIRLWIND, 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] = MWS_WHIRLWIND;
NTConfig_AttackSkill[3] = MWS_WHIRLWIND;
NTConfig_AttackSkill[5] = MWS_BERSERK;
break;
}
return (NTConfig_AttackSkill[1] && NTConfig_AttackSkill[3]);
}
function NTA_BarbarianAttackInt(target, firstorder)
{
var _primaryindex, _immuneTarget;
if(_MWA_Attack_Slot < 0)
{
_MWA_Attack_Slot = MWC_GetSlotID("attack");
if(_MWA_Attack_Slot < 0)
return 1;
}
NTC_SwapWeapons(_MWA_Attack_Slot);
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(_MWA_SkipList.indexOf(target.gid) > -1)
return 1;
if(MWConfig_AttacksBeforeRepositioning > 0 && _MWA_Attack_Time[3] % MWConfig_AttacksBeforeRepositioning == 0)
{
var _vec = MWA_GetEvasionVector(4, 2, target);
if(_vec && !_vec.isZero())
NTM_MoveTo(target.areaid, parseInt(target.x + _vec.x), parseInt(target.y + _vec.y), 0);
}
_immuneTarget = MWA_CheckMonsterImmunity(target);
if(_immuneTarget && NTConfig_BehaviourOnImmuneMonster == 2 && !(target.spectype&0x02) && me.areaid != 131 || MWA_CheckAttackTimeLimit(target))
{
_MWA_SkipList.push(target.gid);
return 1;
}
if(_immuneTarget)
{
if(NTConfig_BehaviourOnImmuneMonster == 3 && NTConfig_AttackSkill[8] > 0) // Attack the target using the selected skill
{
if(!NTA_BarbarianCastSkillInt(8, target))
return 2;
return 3;
}
else if(NTConfig_BehaviourOnImmuneMonster == 1 && MWA_FindNearbyMonsters(15, target) < 3 && NTC_GetMerc())// Get close so the merc can attack the target
{
if(GetDistance(me, target) > 5)
NTM_MoveTo(target.areaid, target.x + 2, target.y + 2);
NTC_Delay(100);
return 2;
}
}
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] == MWS_WHIRLWIND) && !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] == MWS_WHIRLWIND)
{
var _cast, _vec;
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);
}
_cast = new coord();
_vec = new vector(target.x - me.x, target.y - me.y);
if(!_vec)
return false;
_vec.setlength(4);
_angles = new Array(30, -60, 90, -120, 150, -180);
for(var i = 0; i < _angles.length; i++)
{
_cast.x = parseInt(target.x + _vec.x);
_cast.y = parseInt(target.y + _vec.y);
if(CheckCollision(me.areaid, _cast.x, _cast.y, 0))
break;
_vec.rotate(_angles[i]);
}
return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], _cast.x, _cast.y);
}
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)
{
var _primaryindex, _immuneTarget;
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(_MWA_SkipList.indexOf(target.gid) > -1)
return 1;
if(firstorder)
NTP_DoPrecast(false);
if(MWConfig_AttacksBeforeRepositioning > 0 && _MWA_Attack_Time[3] % MWConfig_AttacksBeforeRepositioning == 0)
{
var _vec = MWA_GetEvasionVector(4, 2, target);
if(_vec && !_vec.isZero())
NTM_MoveTo(target.areaid, parseInt(target.x + _vec.x), parseInt(target.y + _vec.y), 0);
}
_immuneTarget = MWA_CheckMonsterImmunity(target);
if(_immuneTarget && NTConfig_BehaviourOnImmuneMonster == 2 && !(target.spectype&0x02) && me.areaid != 131 || MWA_CheckAttackTimeLimit(target)) // Skip the target
{
_MWA_SkipList.push(target.gid);
return 1;
}
if(_immuneTarget)
{
if(NTConfig_BehaviourOnImmuneMonster == 3 && NTConfig_AttackSkill[8] > 0) // Attack the target using the selected skill
{
if(!NTA_DruidCastSkillInt(8, target))
return 2;
return 3;
}
else if(NTConfig_BehaviourOnImmuneMonster == 1 && MWA_FindNearbyMonsters(15, target) < 3 && NTC_GetMerc())// Get close so the merc can attack the target
{
if(GetDistance(me, target) > 5)
NTM_MoveTo(target.areaid, target.x + 3, target.y + 3);
NTC_Delay(100);
return 2;
}
}
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 || MWA_IsUndead(target) && NTConfig_AttackSkill[_primaryindex + 1] == 119 && _NTA_SkillDamage[_primaryindex] == NTA_DAMAGE_PHYSICAL)
{
if(_NTA_SkillRange[_primaryindex] < 4 && !CheckCollision(target.areaid, target.x, target.y, 1))
return 1;
if(!NTA_DruidCastSkillInt(_primaryindex, target))
return 2;
return 3;
}
if(NTConfig_AttackSkill[5] > 0 && NTA_GetResistance(target, NTA_GetDamageType(NTConfig_AttackSkill[5], target, 5)) < 100)
{
if(_NTA_SkillRange[5] < 4 && !CheckCollision(target.areaid, target.x, target.y, 1))
return 1;
if(!NTA_DruidCastSkillInt(5, target))
return 2;
return 3;
}
return 1;
}
function NTA_DruidCastSkillInt(index, target)
{
var _pos;
if(me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8)
{
if(GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4))
{
_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 && NTA_GetResistance(target, _NTA_SkillDamage[index + 1]) <= 99)
{
if(GetDistance(me, target) > _NTA_SkillRange[index+1] || !CheckCollision(me, target, 4))
{
_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_AssassinAttackPatternInt()
{
return true;
}
function NTA_AssassinAttackInt(target, firstorder)
{
var _pos, _trapPos, _index, _vec;
if(NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe))
{
if(!NTTMGR_VisitTown())
return 0;
}
if(_MWA_SkipList.indexOf(target.gid) > -1)
return 1;
if(MWConfig_AttacksBeforeRepositioning > 0 && _MWA_Attack_Time[3] % MWConfig_AttacksBeforeRepositioning == 0)
{
_vec = MWA_GetEvasionVector(4, 2, target);
if(_vec && !_vec.isZero())
NTM_MoveTo(target.areaid, parseInt(target.x + _vec.x), parseInt(target.y + _vec.y), 0);
}
_immuneTarget = MWA_CheckMonsterImmunity(target);
if(_immuneTarget && NTConfig_BehaviourOnImmuneMonster == 2 && !(target.spectype&0x02) && me.areaid != 131 || MWA_CheckAttackTimeLimit(target)) // Skip the target
{
_MWA_SkipList.push(target.gid);
return 1;
}
if(_immuneTarget)
{
if(NTConfig_BehaviourOnImmuneMonster == 3 && NTConfig_AttackSkill[8] > 0) // Attack the target using the selected skill
{
if(!NTA_AmazonCastSkillInt(8, target))
return 2;
return 3;
}
else if(NTConfig_BehaviourOnImmuneMonster == 1 && MWA_FindNearbyMonsters(15, target) < 3 && NTC_GetMerc())// Get close so the merc can attack the target
{
if(GetDistance(me, target) > 5)
NTM_MoveTo(target.areaid, target.x + 2, target.y + 2);
NTC_Delay(100);
return 2;
}
}
if(firstorder && NTConfig_AttackSkill[0] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && me.GetSkillStatus(NTConfig_AttackSkill[0]) != 8)
{
if(GetDistance(me, target) > 20 || !CheckCollision(me, target, 4))
{
_pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, 20, 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(!_MWA_Traps)
{
_MWA_Traps = new MWA_Traps(target);
return 2;
}
if(_MWA_Traps.Refresh(target) && _MWA_Traps.Active.length < _MWA_Traps.MAXQUANTITY)
{
_index = -1;
if(target.spectype&0x0A)
{
if(NTConfig_AttackSkill[1] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[1]) <= 99 && _MWA_Traps.GetQuantity(NTConfig_AttackSkill[1]) < MWConfig_TrapRatio[0][0])
_index = 1;
else if(NTConfig_AttackSkill[2] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[2]) <= 99 && _MWA_Traps.GetQuantity(NTConfig_AttackSkill[2]) < MWConfig_TrapRatio[0][1])
_index = 2;
}
else
{
if(NTConfig_AttackSkill[3] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[3]) <= 99 && _MWA_Traps.GetQuantity(NTConfig_AttackSkill[3]) < MWConfig_TrapRatio[1][0])
_index = 3;
else if(NTConfig_AttackSkill[4] > 0 && NTA_GetResistance(target, _NTA_SkillDamage[4]) <= 99 && _MWA_Traps.GetQuantity(NTConfig_AttackSkill[4]) < MWConfig_TrapRatio[1][1])
_index = 4;
}
if(_index > -1)
{
_trapPos = _MWA_Traps.GetTrapPosition(_NTA_SkillRange[_index][1]);
if(_trapPos)
{
_trapPos.areaid = target.areaid;
if(GetDistance(me , _trapPos) > _NTA_SkillRange[_index][0] || !CheckCollision(me.areaid, _trapPos.x, _trapPos.y, 2))
{
_pos = me.GetOptimalAttackPos(_trapPos.areaid, _trapPos.x, _trapPos.y, _NTA_SkillRange[_index][0], 2);
if(_pos)
NTM_MoveTo(_trapPos.areaid, _pos[0], _pos[1], 0);
}
if(!NTC_CastSkill(NTConfig_AttackSkill[_index], _NTA_SkillHand[_index], _trapPos.x, _trapPos.y))
return 2;
}
else
return 2;
return 3;
}
}
if(NTC_GetSkillLevel(MWS_TELEPORT) > 0 && MWA_CalcDistToClosestMonster() < 3 && MWConfig_KeepDistanceToMonsters && MWA_AreaCheckEvading(me.areaid))
{
if(!MWA_MoveAwayFromMonster(target))
return 2;
return 3;
}
if(NTConfig_AttackSkill[5] > 0 && (NTA_GetResistance(target, _NTA_SkillDamage[5]) <= 99 || NTA_GetResistance(target, _NTA_SkillDamage[6]) <= 99))
{
if(!NTA_AssassinCastSkillInt(5, target))
return 2;
return 3;
}
return 1;
}
function NTA_AssassinCastSkillInt(index, target)
{
if(NTA_GetResistance(target, _NTA_SkillDamage[index]) <= 99 && 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(NTA_GetResistance(target, _NTA_SkillDamage[index + 1]) <= 99 && 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 MWA_UseStaticOnTarget(monster)
{
if(MWConfig_StaticTargets.length == 0)
return true;
if(me.diff == 0 || !monster || !monster.name)
return false;
for(var i = 0; i < MWConfig_StaticTargets.length; i++)
{
if(MWConfig_StaticTargets[i] == monster.classid || typeof MWConfig_StaticTargets[i] == "string" && monster.name.toLowerCase().indexOf(MWConfig_StaticTargets[i].toLowerCase()) > -1)
return true;
}
return false;
}
function MWA_CheckForCloseMonsters(range)
{
var _monstersClose, _checkMonster;
if(range < 1 || arguments.length < 1)
return false;
_monstersClose = false;
_checkMonster = NTC_FindUnit(NTC_UNIT_MONSTER);
if(_checkMonster)
{
do
{
if(_checkMonster.IsAttackable() && GetDistance(me.x, me.y, _checkMonster.x, _checkMonster.y) < range && NTA_IsValidMonster(_checkMonster))
{
_monstersClose = true;
break;
}
} while(_checkMonster.GetNext());
}
return _monstersClose;
}
function MWA_CalcDistToClosestMonster(x, y, calcAverage)
{
var _dist, _minDist, _checkMonster, _distances;
if(arguments.length < 2)
{
x = me.x;
y = me.y;
}
if(arguments.length < 3)
calcAverage = false;
_checkMonster = NTC_FindUnit(NTC_UNIT_MONSTER);
_dist = 1E3;
_minDist = 1E3;
_distances = new Array();
if(_checkMonster)
{
do
{
if(_checkMonster.IsAttackable() && NTA_IsValidMonster(_checkMonster))
{
_dist = GetDistance(x, y, _checkMonster.x, _checkMonster.y);
if(calcAverage)
_distances.push(_dist);
else if(_dist < _minDist)
_minDist = _dist;
}
} while(_checkMonster.GetNext());
}
if(calcAverage)
{
_dist = 0;
for(var i = 0; i < _distances.length; i++)
_dist += _distances[i];
if(_distances.length > 0)
return _dist / _distances.length;
}
return _minDist;
}
function MWA_AreaCheckEvading(areaid)
{
if(MWConfig_EvasionExceptions.length > 0 && MWConfig_EvasionExceptions.indexOf(areaid) != -1)
return false;
else
return true;
}
function MWA_GetEvasionVector(length, offset, origin, rotationAngle)
{
var _vec, _targetVec, _maxDistIndex, _dist, _maxDist, _destx, _desty, _path, _pathX, _pathY;
_targetVec = new Array();
if(arguments.length < 3 || !origin.x || !origin.y || !origin.areaid)
origin = me;
if(arguments.length < 4 || isNaN(rotationAngle))
rotationAngle = 22.5;
_vec = new vector(1, 0);
if(!_vec)
return new vector();
for(var i = 0; i < parseInt(360 / rotationAngle); i++)
{
_vec.rotate(rotationAngle);
_vec.normalize();
_targetVec.push(new vector(_vec.x, _vec.y));
}
_maxDistIndex = -1;
_maxDist = 0;
_dist = 0;
// Find the spot with the largest distance to the next monster
for(var i = 0; i < _targetVec.length; i++)
{
_destx = origin.x + Math.round(_targetVec[i].x * length);
_desty = origin.y + Math.round(_targetVec[i].y * length);
_path = GetPath(origin.areaid, origin.x, origin.y, _destx, _desty, true);
if(_path)
{
_pathX = _path[_path.length - 1][0];
_pathY = _path[_path.length - 1][1];
if(GetDistance(_destx, _desty, _pathX, _pathY) > offset || !CheckCollision(origin.areaid, _pathX, _pathY, 0)) // DEBUG !CheckCollision(origin.areaid, origin.x, origin.y, _pathX, _pathY, 0)
continue;
_dist = MWA_CalcDistToClosestMonster(_pathX, _pathY);
if(_dist > _maxDist)
{
_maxDist = _dist;
_maxDistIndex = i;
}
}
}
if(_maxDistIndex != -1)
return _targetVec[_maxDistIndex];
else
return new vector();
}
function MWA_MoveAwayFromMonster(target)
{
var _vec, _targetVec, _spotIndex, _targetDist, _destx, _desty, _path;
const _VEC_LENGTH = 8; // Length of the vector pointing to the target spot
const _DELTA_DEST = 2; // Maximum distance to the target location after moving
_targetVec = MWA_GetEvasionVector(_VEC_LENGTH, _DELTA_DEST);
if(_targetVec && !_targetVec.isZero())
{
_targetVec.setlength(_VEC_LENGTH);
_targetDist = MWA_CalcDistToClosestMonster(me.x + Math.round(_targetVec.x), me.y + Math.round(_targetVec.y));
if(_targetDist > MWA_CalcDistToClosestMonster() && _targetDist > 4)
{
_destx = me.x + Math.round(_targetVec.x);
_desty = me.y + Math.round(_targetVec.y);
if(MWConfig_ShowOverheadStatus)
MWC_PrintOverheadStatus("Evading...");
NTM_MoveTo(me.areaid, _destx, _desty, 1);
if(GetDistance(me.x, me.y, _destx, _desty) < _DELTA_DEST)
return true;
}
}
_targetVec = MWA_GetEvasionVector(_VEC_LENGTH * 2.5, _DELTA_DEST, target);
if(_targetVec && !_targetVec.isZero())
{
_targetVec.setlength(_VEC_LENGTH * 2.5);
_targetDist = MWA_CalcDistToClosestMonster(me.x + Math.round(_targetVec.x), me.y + Math.round(_targetVec.y));
if(_targetDist > MWA_CalcDistToClosestMonster())
return NTM_MoveTo(me.areaid, target.x + Math.round(_targetVec.x), target.y + Math.round(_targetVec.y), 1);
}
return false;
}
function MWA_FindNearbyMonsters(range, target)
{
var _monster;
var _count = 0;
if(arguments.length < 1)
range = 20;
if(arguments.length < 2)
target = me;
_monster = NTC_FindUnit(NTC_UNIT_MONSTER);
if(_monster)
{
do
{
if(_monster.IsAttackable() && NTA_IsValidMonster(_monster) && GetDistance(target, _monster) < range)
_count++;
}
while(_monster.GetNext());
}
return _count;
}
function MWA_CheckInfinity()
{
var _merc, _items;
_merc = NTC_GetMerc();
if(!_merc)
return false;
_items = _merc.GetItems();
if(_items)
{
for(var i = 0; i < _items.length; i++)
{
if(_items[i].itemloc == 4)
{
if(_items[i].itemprefix == 0x5056) // Infinity
_MWA_Merc_Weapon_Type = 1;
else if( _items[i].GetStat(198) == 0x21) // The Reaper's Toll
_MWA_Merc_Weapon_Type = 2;
return true;
}
}
_MWA_Merc_Weapon_Type = 0;
}
return false;
}
function MWA_CheckMonsterImmunity(target)
{
var _resistance;
for(var i = 0; i < MWConfig_CheckImmunitySkills.length; i++)
{
if(isNaN(MWConfig_CheckImmunitySkills[i]) || MWConfig_CheckImmunitySkills[i] < 0 || MWConfig_CheckImmunitySkills[i] >= NTConfig_AttackSkill.length)
return false;
if(NTConfig_AttackSkill[MWConfig_CheckImmunitySkills[i]] == 0)
continue;
if(MWA_CheckMonsterResistance(target, NTA_GetDamageType(NTConfig_AttackSkill[MWConfig_CheckImmunitySkills[i]], target, MWConfig_CheckImmunitySkills[i])))
return false;
}
return MWConfig_CheckImmunitySkills.length > 0;
}
function MWA_CheckMonsterResistance(target, damageType)
{
var _res;
if(_MWA_Merc_Weapon_Type == -1)
MWA_CheckInfinity();
_res = NTA_GetResistance(target, damageType);
if(_res < 100)
return true;
if(_MWA_Merc_Weapon_Type == 1 && damageType >= NTA_DAMAGE_FIRE && damageType <= NTA_DAMAGE_COLD) // Infinity
{
if(target.GetState(28))
return false;
return (_res < 117 && NTC_GetMerc())
}
else if(_MWA_Merc_Weapon_Type == 2 && damageType == NTA_DAMAGE_PHYSICAL) // Reaper's Toll
{
if(MWA_GetCurseState(MWS_DECREPIFY, target) || MWA_GetCurseState(MWS_AMPLIFY_DAMAGE, target))
return false;
return (_res < 150 && NTC_GetMerc());
}
return false;
}
function MWA_CalcCorpseExplosionRadius()
{
// Calculate the approximate CE Range using a simple linear regression
if(me.GetSkill(74, true) > 0)
return (0.333684 * me.GetSkill(74, true) + 2.29632).toFixed(1);
else
return 0.0;
}
function MWA_GetClosestCorpseGID(x, y, range)
{
var _gid, _dist, _mindist, _corpses;
if(arguments.length < 3)
range = 50;
_mindist = 10000;
_gid = 0;
_corpses = NTC_FindUnit(NTC_UNIT_MONSTER);
if(_corpses)
{
do
{
if(MWL_CheckLootStatus(_corpses) && MWL_IsLootableMonster(_corpses.classid) && _corpses.name != GetLocaleString(5386) && _corpses.mode == 12) // Only check valid corpses that can be used for corpse explosion or minions
{
_dist = GetDistance(x, y, _corpses.x, _corpses.y);
if(_dist < _mindist && _dist <= range)
{
_mindist = _dist;
_gid = _corpses.gid;
}
}
} while(_corpses.GetNext());
}
return _gid;
}
function MWA_IsHazardousMonster(target)
{
var _viciousness, _damageType, _count;
_viciousness = 0;
_damageType = -1;
switch(target.classid)
{
// Physical damage (type 0)
case 310: // Doom Knight
case 312: // Oblivion Knight
case 472: // Hell Temptress WSK
case 510: // Death Lord WSK
case 571: // Minion Of Destruction
case 638: // Vile Witch WSK
case 691: // Undead Soul Killer Throne
case 700: // Doom Knight Throne
case 702: // Oblivion Knight Throne
_damageType = 0;
_viciousness++;
break;
// Elemental damage (type 1)
case 640: // Black Soul WSK
case 641: // Black Soul Throne
_damageType = 1;
_viciousness++;
break;
// Both physical and elemental damage (type -1)
case 345: // Council Member
case 346: // Council Member
case 347: // Council Member
case 362: // Venom Lord
case 558: // Venom Lord Throne
_viciousness++;
break;
}
_count = MWA_FindNearbyMonsters(6, target);
if(_count > 2)
_viciousness++;
else if(_count > 4)
_viciousness += 2;
else if(_count > 6)
_viciousness += 3;
if(target.GetState(29)) // Conviction
_viciousness += 2;
if(_damageType == 0 || _damageType == -1)
{
if(target.GetState(49)) // Fanatism
_viciousness += 2;
if(target.GetState(33) // Might
|| target.GetState(40)) // Blessed Aim
_viciousness++;
if(me.GetState(9) // Amplify Damage
|| me.GetState(60)) // Decrepify
_viciousness++;
}
if(_damageType == 1 || _damageType == -1)
{
if(me.GetState(28) // Convicted
|| me.GetState(61)) // Lower Resist
_viciousness++;
}
return _viciousness > 3;
}
function MWA_SetMinionCounts()
{
// Define the maximum amount of Skeletons
if(MWConfig_SkeletonMinionCount <= MWC_GetMaxMinionCount(NTConfig_AttackSkill[4]))
_MWA_Minion_Counts[0] = MWConfig_SkeletonMinionCount;
else
_MWA_Minion_Counts[0] = MWC_GetMaxMinionCount(NTConfig_AttackSkill[4]);
// Define the maximum amount of Mages
if(MWConfig_MageMinionCount <= MWC_GetMaxMinionCount(NTConfig_AttackSkill[5]))
_MWA_Minion_Counts[1] = MWConfig_MageMinionCount;
else
_MWA_Minion_Counts[1] = MWC_GetMaxMinionCount(NTConfig_AttackSkill[5]);
// Define the maximum amount of Revives
if(MWConfig_ReviveMinionCount <= MWC_GetMaxMinionCount(NTConfig_AttackSkill[6]))
_MWA_Minion_Counts[2] = MWConfig_ReviveMinionCount;
else
_MWA_Minion_Counts[2] = MWC_GetMaxMinionCount(NTConfig_AttackSkill[6]);
}
function MWA_RaiseMinions()
{
var _corpse, _gid, _gidsHandled, _count;
if(me.classid != NTC_CHAR_CLASS_NECROMANCER)
return false;
_gidsHandled = new Array();
MWA_SetMinionCounts();
for(var i = 0; i < 100; i++)
{
_gid = MWA_GetClosestCorpseGID(me.x, me.y, 30);
if(_gid == 0) // Stop if there are not any corpses nearby
break;
if(_gidsHandled.indexOf(_gid) > -1)
continue;
_corpse = NTC_FindUnit(NTC_UNIT_MONSTER, _gid); // Get the unit of the closest corpse
if(_corpse)
{
_gidsHandled.push(_gid);
if(NTC_GetSkillLevel(NTConfig_AttackSkill[4]) > 0) // Summon first minion type until the desired number of minions is reached
{
_count = MWC_GetMinionCount(NTConfig_AttackSkill[4]);
if(_count < _MWA_Minion_Counts[0] && (NTConfig_AttackSkill[4] != 95 || !(_corpse.spectype&0x0E)))
{
if(MWConfig_ShowOverheadStatus)
{
if(NTConfig_AttackSkill[4] == 95)
MWC_PrintOverheadStatus("Reviving " + _corpse.name + " (" + (_count + 1) + "/" +_MWA_Minion_Counts[0] + ")");
else
MWC_PrintOverheadStatus("Summoning " + MWC_GetMinionName(NTConfig_AttackSkill[4]) + " (" + (_count + 1) + "/" + _MWA_Minion_Counts[0] + ")");
}
if(GetDistance(me, _corpse) > _NTA_SkillRange[4] || !CheckCollision(me, _corpse, 4) || !CheckCollision(me, _corpse, 2))
NTM_MoveTo(_corpse.areaid, _corpse.x, _corpse.y, 0);
NTC_CastSkill(NTConfig_AttackSkill[4], _NTA_SkillHand[4], _corpse);
continue;
}
}
if(NTC_GetSkillLevel(NTConfig_AttackSkill[5]) > 0) // Summon second minion type until the desired number of minions is reached
{
_count = MWC_GetMinionCount(NTConfig_AttackSkill[5]);
if(_count < _MWA_Minion_Counts[1] && (NTConfig_AttackSkill[5] != 95 || !(_corpse.spectype&0x0E)))
{
if(MWConfig_ShowOverheadStatus)
{
if(NTConfig_AttackSkill[5] == 95)
MWC_PrintOverheadStatus("Reviving " + _corpse.name + " (" + (_count + 1) + "/" + _MWA_Minion_Counts[1] + ")");
else
MWC_PrintOverheadStatus("Summoning " + MWC_GetMinionName(NTConfig_AttackSkill[5]) + " (" + (_count + 1) + "/" + _MWA_Minion_Counts[1] + ")");
}
if(GetDistance(me, _corpse) > _NTA_SkillRange[4] || !CheckCollision(me, _corpse, 4) || !CheckCollision(me, _corpse, 2))
NTM_MoveTo(_corpse.areaid, _corpse.x, _corpse.y, 0);
NTC_CastSkill(NTConfig_AttackSkill[5], _NTA_SkillHand[5], _corpse);
continue;
}
}
if(NTC_GetSkillLevel(NTConfig_AttackSkill[6]) > 0) // Summon third minion type until the desired number of minions is reached
{
_count = MWC_GetMinionCount(NTConfig_AttackSkill[6]);
if(_count < _MWA_Minion_Counts[2] && (NTConfig_AttackSkill[6] != 95 || !(_corpse.spectype&0x0E)))
{
if(MWConfig_ShowOverheadStatus)
{
if(NTConfig_AttackSkill[6] == 95)
MWC_PrintOverheadStatus("Reviving " + _corpse.name + " (" + (_count + 1) + "/" + _MWA_Minion_Counts[2] + ")");
else
MWC_PrintOverheadStatus("Summoning " + MWC_GetMinionName(NTConfig_AttackSkill[6]) + " (" + (_count + 1) + "/" + _MWA_Minion_Counts[2] + ")");
}
if(GetDistance(me, _corpse) > _NTA_SkillRange[4] || !CheckCollision(me, _corpse, 4) || !CheckCollision(me, _corpse, 2))
NTM_MoveTo(_corpse.areaid, _corpse.x, _corpse.y, 0);
NTC_CastSkill(NTConfig_AttackSkill[6], _NTA_SkillHand[6], _corpse);
continue;
}
}
// Stop if the the maximum number of each minion type is reached
break;
}
}
return true;
}
function MWA_CalcAverageMinionDistance(unit)
{
var _monsters, _parent, _distances, _averageDist;
_averageDist = 0.0;
_distances = new Array();
if(arguments.length < 1)
unit = me;
_monsters = NTC_FindUnit(NTC_UNIT_MONSTER);
if(_monsters)
{
do
{
if(GetDistance(unit, _monsters) < 45)
{
_parent = _monsters.GetParent();
if(_parent && _parent.name == me.name) // Check whether the unit (Merc, Skeleton, Mage, Revive or Golem) actually belongs to our char
_distances.push(GetDistance(unit, _monsters));
}
} while(_monsters.GetNext());
}
// Calculate the average
for(var i = 0; i < _distances.length; i++)
_averageDist += _distances[i]; // Add all distances
if(_distances.length != 0)
_averageDist /= _distances.length; // Divide the sum by the number of distances
return _averageDist; // Return true if the majority of minions is sharing the same position as our char --> minions stuck
}
function MWA_GetCurseState(skillid, target)
{
if(!target || skillid < 66 || skillid > 91)
return false;
if((target.spectype & 0x04) && target.name.indexOf(GetLocaleString(11086)) != -1) // Ignore possessed champions that cannot be cursed
return true;
// Ignore foes that cannot be cursed anyway
switch(target.classid)
{
case 194: // Blood Maggot Egg
case 207: // Blood Hawk Nest
case 497: // Catapult
case 498: // Catapult
case 499: // Catapult
case 500: // Catapult
case 516: // Catapult
case 517: // Catapult
case 518: // Catapult
case 519: // Catapult
return true;
}
switch(skillid)
{
case 66: // Amplify Damage
return (target.GetState(9) != 0);
case 71: // Dim Vision
return (target.GetState(23) != 0);
case 72: // Weaken
return (target.GetState(19) != 0);
case 76: // Iron Maiden
return (target.GetState(55) != 0);
case 77: // Terror
return (target.GetState(56) != 0);
case 81: // Confuse
return (target.GetState(59) != 0);
case 82: // Life Tap
return (target.GetState(58) != 0);
case 86: // Attract
return (target.GetState(57) != 0);
case 87: // Decrepify
return (target.GetState(60) != 0);
case 91: // Lower Resist
return (target.GetState(61) != 0);
}
return false;
}
function MWA_CheckAttackTimeLimit(target)
{
var _tickLimit;
if(_MWA_Attack_Time.length > 0 && _MWA_Attack_Time[0] == target.gid) // If the target has been attacked before and its gid is saved in the array
{
_MWA_Attack_Time[3]++;
if(GetTickCount() > _MWA_Attack_Time[1] + _MWA_Attack_Time[2]) // Check if the time limit exceeded yet
{
Print("ÿc1Attack time limit exceeded! Skipping " + target.name + "...");
return true;
}
}
else // The target has not been attacked before
{
// Determine the end time in ticks using the limits specified in the char config
if((target.spectype & 0x02) && MWConfig_AttackTimeLimit[4] > 0) // Super Unique
_tickLimit = 1E3 * MWConfig_AttackTimeLimit[1];
else if((target.spectype & 0x04) && MWConfig_AttackTimeLimit[3] > 0) // Champion
_tickLimit = 1E3 * MWConfig_AttackTimeLimit[2];
else if((target.spectype & 0x08) && MWConfig_AttackTimeLimit[2] > 0) // Boss
_tickLimit = 1E3 * MWConfig_AttackTimeLimit[3];
else if((target.spectype & 0x10) && MWConfig_AttackTimeLimit[1] > 0) // Minion
_tickLimit = 1E3 * MWConfig_AttackTimeLimit[4];
else if(MWConfig_AttackTimeLimit[0] > 0) // All
_tickLimit = 1E3 * MWConfig_AttackTimeLimit[0];
else
_tickLimit = 2 * GetTickCount(); // Set Attack time to "infinite" if no time limit is defined
_MWA_Attack_Time = [target.gid, GetTickCount(), _tickLimit, 1]; // Save both the target's gid and the end time
}
return false;
}
function MWA_IsUndead(target)
{
if(arguments.lenth < 1 || !target)
return false;
switch(target.classid)
{
case 0: // Skeleton
case 1: // Returned
case 2: // Bone Warrior
case 3: // Burning Dead
case 4: // Horror
case 5: // Zombie
case 6: // Hungry Dead
case 7: // Ghoule
case 9: // Plague Bearer
case 38: // Ghost
case 40: // Specter
case 41: // Apparition
case 96: // Dried Corpse
case 98: // Embalmed
case 99: // Preserved Dead
case 101: // Hollow One
case 102: // Guardian
case 103: // Unraveler
case 104: // Horadrim Ancient
case 105: // Unraveler
case 111: // Undead Scavenger
case 131: // Ghoul Lord
case 132: // Night Lord
case 133: // Dark Lord
case 134: // Blood Lord
case 135: // The Banished
case 170: // Skeleton Archer
case 171: // Returned Archer
case 172: // Bone Archer
case 174: // Horror Archer
case 215: // Undead Soul Killer
case 276: // Bone Ash
case 306: // Storm Caster
case 310: // Doom Knight
case 311: // Abyss Knight
case 312: // Oblivion Knight
case 365: // Griswold
case 381: // Death Mage
case 383: // Returned Mage
case 384: // Bone Mage
case 385: // Burning Dead mage
case 387: // Returned Mage
case 388: // Bone Mage
case 390: // Horror Mage
case 437: // Reanimated Horde
case 438: // Prowling Dead
case 440: // Defiled Warrior
case 578: // Returned Archer
case 608: // Carrion Bird
case 620: // Returned Mage
case 622: // Returned Mage
case 623: // Horror Mage
case 624: // Bone Mage
case 626: // Horror Mage
case 640: // Black Soul
case 641: // Black Soul Throne
case 669: // Horadrim Ancient
case 670: // Horadrim Ancient
case 696: // Ghoul Lord
case 697: // Dark Lord
case 698: // Unholy Corpse
case 691: // Undead Soul Killer
case 700: // Doom Knight
case 702: // Oblivion Knight
case 713: // Oblivion Knight
case 726: // Horror Archer
case 727: // Burning Dead Mage
case 728: // Horror Mage
case 729: // Bone Mage
case 730: // Horror Mage
case 731: // Dark Lord
return true;
}
return false;
}
function MWA_IsPriorityTarget(target)
{
if(arguments.lenth < 1 || !target)
return false;
switch(target.classid)
{
case 58: // Fallen Shaman
case 59: // Carver Shaman
case 60: // Devilkin Shaman
case 61: // Dark Shaman
case 62: // Warped Shaman
case 68: // Sand Maggot
case 69: // Rock Worm
case 70: // Devourer
case 101: // Hollow One
case 102: // Guardian
case 103: // Unraveler
case 104: // Horadrim Ancient
case 105: // Unraveler
case 207: // Blood Hawk Nest
case 238: // Sexton
case 240: // Heirophant
case 279: // Fetish Shaman
case 280: // Flayer Shaman
case 281: // Soul Killer Shaman
case 298: // Flesh Spawner
case 299: // Stygian Hag
case 300: // Grotesque
case 646: // Devilkin Shaman
case 669: // Horadrim Ancient
case 670: // Horadrim Ancient
case 674: // Heirophant
case 676: // Flesh Spawner
return true;
}
return false;
}
function MWA_PrintAttackStatus(type, target)
{
var _output, _attackTimeString;
if(!MWConfig_ShowOverheadStatus || arguments.length < 2)
return false;
_attackTimeString = "";
switch(type)
{
case 1:
_output = "Killing ";
break;
default:
_output = "Attacking ";
break;
}
if(target.gid == _MWA_Attack_Time[0] && GetTickCount() - _MWA_Attack_Time[1] > 5E3)
_attackTimeString = " [" + MWC_ConvertTicksToTimeString(GetTickCount() - _MWA_Attack_Time[1]) + "]";
if(target.hp / target.hpmax > 0)
return MWC_PrintOverheadStatus(_output + target.name + " " + (target.hp * 100 / target.hpmax).toFixed(0) + "%" + _attackTimeString);
else
return MWC_PrintOverheadStatus("Killed " + target.name + "!");
}
function MWA_Traps(target)
{
this.Active;
this.Target = target;
this.MAXQUANTITY = 5;
this.GetTrapPosition = MWA_Traps_GetTrapPosition;
this.Refresh = MWA_Traps_Refresh;
this.GetQuantity = MWA_Traps_GetQuantity;
this.Refresh();
}
function MWA_Trap(unit)
{
this.X = unit.x;
this.Y = unit.y;
this.GID = unit.gid;
this.ClassID = unit.classid;
this.Mode = unit.mode;
this.RANGE = 20;
this.IsValid = MWA_Trap_IsValid;
}
function MWA_Trap_IsValid(target)
{
var _trap;
if(!target)
return false;
_trap = NTC_FindUnit(NTC_UNIT_MONSTER, this.GID);
if(!_trap || _trap.mode == 12) // The trap is either really far aways or already fired all its shots
return false;
if(_trap.mode == 8) // Traps that are currently fireing are considered valid
return true;
if(!CheckCollision(target, _trap, 2)) // The trap cannot attack the current target due to obstacles
return false;
if(GetDistance(this.X, this.Y, target.x, target.y) > this.RANGE) // The target is too far away from the trap
return false;
if(GetDistance(this.X, this.Y, me.x, me.y) > 40) // The trap is too far away from us
return false;
return true;
}
function MWA_Traps_GetTrapPosition(range)
{
var _pos, _trapPos, _vec, _vecOrtho;
const _DIST = 4;
if(!this.Target || arguments.length < 1)
return null;
_pos = me.GetOptimalAttackPos(this.Target.areaid, this.Target.x, this.Target.y, range, 4);
if(_pos)
{
_vec = new vector(this.Target.x - _pos[0], this.Target.y - _pos[1]);
if(_vec)
{
_vecOrtho = new vector(_vec.x, _vec.y);
if(_vecOrtho)
{
_vecOrtho.rotate(90);
switch(this.Active.length)
{
case 4:
_vec.setlength(_DIST);
_vecOrtho.setlength(_DIST);
break;
case 3:
_vec.setlength(_DIST);
_vecOrtho.setlength(-1 * _DIST);
break;
case 2:
_vec.setlength(_DIST / 2);
_vecOrtho.setlength(_DIST / 2);
break;
case 1:
_vec.setlength(_DIST / 2);
_vecOrtho.setlength(_DIST / -2);
break;
default:
return new coord(_pos[0], _pos[1]);
}
_trapPos = new coord(Math.round(_pos[0] + _vec.x + _vecOrtho.x), Math.round(_pos[1] + _vec.y + _vecOrtho.y));
if(_trapPos && CheckCollision(this.Target.areaid, _trapPos.x, _trapPos.y, 0))
return _trapPos;
}
}
return new coord(_pos[0], _pos[1]);
}
return null;
}
function MWA_Traps_GetQuantity(skillid)
{
var _count, _classid;
_count = 0;
switch(skillid)
{
case MWS_CHARGED_BOLT_SENTRY:
_classid = MWC_MINION_CHARGED_BOLT_SENTRY;
break;
case MWS_WAKE_OF_FIRE:
_classid = MWC_MINION_WAKE_OF_FIRE;
break;
case MWS_LIGHTNING_SENTRY:
_classid = MWC_MINION_LIGHTNING_SENTRY;
break;
case MWS_WAKE_OF_INFERNO:
_classid = MWC_MINION_WAKE_OF_INFERNO;
break;
case MWS_DEATH_SENTRY:
_classid = MWC_MINION_DEATH_SENTRY;
break;
}
for(var i = 0; i < this.Active.length; i++)
{
if(this.Active[i].IsValid(this.Target) && this.Active[i].ClassID == _classid)
_count++;
}
return _count;
}
function MWA_Traps_Refresh(target)
{
var _unit, _trap;
this.Active = new Array();
this.Target = target;
_unit = NTC_FindUnit(NTC_UNIT_MONSTER);
if(_unit)
{
do
{
if(!_unit.IsAttackable() && (_unit.classid >= MWC_MINION_WAKE_OF_FIRE && _unit.classid <= MWC_MINION_LIGHTNING_SENTRY || _unit.classid >= MWC_MINION_WAKE_OF_INFERNO && _unit.classid <= MWC_MINION_DEATH_SENTRY))
{
if(NTC_CheckOwner(_unit))
{
_trap = new MWA_Trap(_unit);
if(_trap && _trap.IsValid(this.target))
this.Active.push(_trap);
}
}
} while(_unit.GetNext());
return true;
}
return false;
}
LG
Muddy
|
|
|
05/06/2011, 13:13
|
#1731
|
elite*gold: 0
Join Date: Sep 2009
Posts: 148
Received Thanks: 21
|
Quote:
Originally Posted by Muddy_Waters
Da hat sich ja schon wieder einiges angesammelt, falls ich jemanden vergessen haben sollte, bitte melden.
MWT_IsPotionRequired ist eine Funktion.
Und wenn die nicht definiert ist, spricht das für grobe Syntaxfehler ind er Funktion selber bzw. in der library, in der diese implementiert ist.
Hattest du dort irgendwas verändert?
|
Ne habs von dir direkt bei NTTown.ntl per Copy&overwrite an die Stelle des Originalen eingefügt.
^^
|
|
|
05/06/2011, 13:16
|
#1732
|
Administrator
elite*gold: 41624
Join Date: Jan 2010
Posts: 22,728
Received Thanks: 12,654
|
Quote:
Originally Posted by -Nemesis1337-
Ne habs von dir direkt bei NTTown.ntl per Copy&overwrite an die Stelle des Originalen eingefügt.
^^
|
Demnach hast du dort also doch etwas verändert? Verzeih mir die Frage, aber ich kann nicht so ganz folgen.
LG
Muddy
|
|
|
05/06/2011, 13:28
|
#1733
|
elite*gold: 0
Join Date: May 2010
Posts: 4
Received Thanks: 0
|
Hab die NTAttack.ntl ersetzt. Bis jetzt leider ohne erfolg.
Hab hoffentlich alles richtig eingestellt für static. hier mal die meines erachtens wichtigen bereiche.
NTConfig_Sorceress_AXPlight.ntl
Code:
var NTConfig_CastStatic;
NTConfig_CastStatic = 60;
MWConfig_StaticTargets.push(242); // Mephisto
Sollte ich was vergessen haben und es daran liegen dann prügel mich.
|
|
|
05/06/2011, 13:44
|
#1734
|
elite*gold: 0
Join Date: Sep 2009
Posts: 148
Received Thanks: 21
|
Quote:
Originally Posted by Muddy_Waters
Demnach hast du dort also doch etwas verändert? Verzeih mir die Frage, aber ich kann nicht so ganz folgen.
LG
Muddy
|
Na der Code den du hier geschrieben hattest
Code:
function NTT_ShopItem(item, npc, mode)
{
var _mygold, _initCount, _unit, _return;
_mygold = NTC_MyGold();
_return = false;
if(mode > 1)
{
if(item.GetItemCost(0, npc.classid) > _mygold)
return false;
}
if(mode > 1)
{
var _havespace = false;
if(item.classid == 529 || item.classid == 530)
{
_unit = (item.classid == 530) ? NTT_GetTome(0) : NTT_GetTome(1);
if(_unit && _unit.GetStat(70) < 20)
{
_havespace = true;
_initCount = _unit.GetStat(70);
}
}
else if(item.classid == 543)
{
_initCount = MWTMGR_GetKeyQuantity();
if(_initCount < 12)
_havespace = true;
}
else if(item.itemtype >= 76 && item.itemtype <= 81)
{
if(MWT_IsPotionRequired(item.code, true))
_havespace = true;
_unit = new MWT_Belt();
if(!_unit)
return false;
_initCount = _unit.GetPotionCount(-1, 1);
}
if(!_havespace)
{
if(NTT_CheckSpace(item.xsize, item.ysize))
_havespace = true;
}
if(_havespace)
{
for(var i = 0; i <= 40; i++)
{
NTC_Delay(200);
if((i % 10) == 0)
me.ClickItem(mode > 2 ? 3 : 1, item);
// This is used to avoid a general delay before buying keys, scrolls or potions
if(item.classid == 543)
{
if(_initCount != MWTMGR_GetKeyQuantity)
_return = true;
}
else if(item.classid == 529 || item.classid == 530)
{
if(_initCount != NTTMGR_CheckScrolls((item.classid == 530) ? 0 : 1))
_return = true;
}
else if(item.itemtype >= 76 && item.itemtype <= 81)
{
_unit.RefreshProperties();
if(_initCount != _unit.GetPotionCount(-1, 1))
_return = true;
}
if(_mygold > NTC_MyGold() || _return)
{
NTC_PingDelay(100);
return true;
}
}
}
}
else
{
if(item.quality == 7)
Print("Selling " + NTC_ItemQualityToD2Color[MWC_GetItemColorInt(item)] + item.name.split("\n")[0]);
if(NTC_ItemToCursor(item))
{
for(var i = 0; i < 40; i++)
{
if((i % 20) == 0)
me.ClickItem(0, 8, 6, 1);
NTC_Delay(100);
if(!me.itemoncursor)
{
NTC_PingDelay(100);
return true;
}
}
}
}
return false;
}
war ja ne erweiterte Form des in der Town.ntl Codes fürs Shoppen richtig?
Code:
function NTT_ShopItem(item, npc, mode)
{
var _mygold, _initCount, _unit, _return;
_mygold = NTC_MyGold();
_return = false;
if(mode > 1)
{
if(item.GetItemCost(0, npc.classid) > _mygold)
return false;
}
if(mode > 1)
{
var _havespace = false;
if(item.classid == 529 || item.classid == 530)
{
_unit = (item.classid == 530) ? NTT_GetTome(0) : NTT_GetTome(1);
if(_unit && _unit.GetStat(70) < 20)
{
_havespace = true;
_initCount = _unit.GetStat(70);
}
}
else if(item.classid == 543)
{
_initCount = MWTMGR_GetKeyQuantity();
if(_initCount < 12)
_havespace = true;
}
else if(item.itemtype >= 76 && item.itemtype <= 81)
{
if(MWT_IsPotionRequired(item.code, true))
_havespace = true;
_unit = new MWT_Belt();
if(!_unit)
return false;
_initCount = _unit.GetPotionCount(-1, 1);
}
if(!_havespace)
{
if(NTT_CheckSpace(item.xsize, item.ysize))
_havespace = true;
}
if(_havespace)
{
for(var i = 0; i <= 40; i++)
{
NTC_Delay(200);
if((i % 10) == 0)
me.ClickItem(mode > 2 ? 3 : 1, item);
// This is used to avoid a general delay before buying keys, scrolls or potions
if(item.classid == 543)
{
if(_initCount != MWTMGR_GetKeyQuantity)
_return = true;
}
else if(item.classid == 529 || item.classid == 530)
{
if(_initCount != NTTMGR_CheckScrolls((item.classid == 530) ? 0 : 1))
_return = true;
}
else if(item.itemtype >= 76 && item.itemtype <= 81)
{
_unit.RefreshProperties();
if(_initCount != _unit.GetPotionCount(-1, 1))
_return = true;
}
if(_mygold > NTC_MyGold() || _return)
{
NTC_PingDelay(100);
return true;
}
}
}
}
else
{
if(NTC_ItemToCursor(item))
{
for(var i = 0; i < 40; i++)
{
if((i % 20) == 0)
me.ClickItem(0, 8, 6, 1);
NTC_Delay(100);
if(!me.itemoncursor)
{
NTC_PingDelay(100);
return true;
}
}
}
}
return false;
}
Ich hab den Code den du hier gepostet hast mit dem originalen aus der Town.ntl ersetzt.
Oder war das falsch?^^ an dem Code an sich hab ich nix geändert :P
|
|
|
05/06/2011, 13:48
|
#1735
|
Administrator
elite*gold: 41624
Join Date: Jan 2010
Posts: 22,728
Received Thanks: 12,654
|
Quote:
Originally Posted by AlderonXP
Hab die NTAttack.ntl ersetzt. Bis jetzt leider ohne erfolg.
Hab hoffentlich alles richtig eingestellt für static. hier mal die meines erachtens wichtigen bereiche.
NTConfig_Sorceress_AXPlight.ntl
Code:
var NTConfig_CastStatic;
NTConfig_CastStatic = 60;
MWConfig_StaticTargets.push(242); // Mephisto
Sollte ich was vergessen haben und es daran liegen dann prügel mich.
|
Die Config ist auch korrekt benannt und wird geladen?
Die Variable ist hoffentlich ausserhalb der LoadConfig Funktion deklariert (== global), oder?
Quote:
Originally Posted by -Nemesis1337-
Na der Code den du hier geschrieben hattest war ja ne erweiterte Form des in der Town.ntl Codes fürs Shoppen richtig?
Ich hab den Code den du hier gepostet hast mit dem originalen aus der Town.ntl ersetzt.
Oder war das falsch?^^ an dem Code an sich hab ich nix geändert :P
|
In dem Fall, überschreib doch einfach mal deine NTTown library mit dieser hier:
Code:
[noparse]
/**
* This file was modified by
* Check the programming section for updates and further scripts
* Last Update: 13:47 06.05.2011
*/
var _NTT_BeltColNeeded = new Array(4);
_NTT_BeltColNeeded[0] = 0;
_NTT_BeltColNeeded[1] = 0;
_NTT_BeltColNeeded[2] = 0;
_NTT_BeltColNeeded[3] = 0;
var _NTT_BeltSize = 0;
var _NTT_OldItems;
var _NTT_IgnoredItems = new Array(
"box", // Horadric Cube
"aqv", // Arrows quiver
"cqv", // Bolts quiver
"key", // Keys
"yps", // Antidote potion
"vps", // Stamina potion
"wms", // Thawing potion
"gps", // Rancid Gas Pot
"ops", // Oil Potion
"gpm", // Choking Gas Pot
"opm", // Exploding Pot
"gpl", // Strangling Gas
"opl", // Fulminating Pot
"hp1","hp2","hp3","hp4","hp5", // Healing potions
"mp1","mp2","mp3","mp4","mp5", // Mana potions
"rvs","rvl"); // Rejuvenation potions
var _MWT_UnsellableItems = new Array(
88, // Wirt's Leg
89, // Horadric Maulus
90, // Hellforge Hammer
91, // Horadric Staff
92, // Hadadric Staff Shaft
521, // Horadric Amulet
524, // Scroll of Inifuss
545, // Potion of Life
546, // A Jade Figurine
547, // The Golden Bird
549, // Lam Esens Tome
550, // Horadric Cube
551, // Mephisto's Soulstone
552, // Book of Skill
553, // Khalim's Eye
554, // Khalim's Heart
555, // Khalim's Brain
644, // Malah's Potion
646, // Scroll of Resistance
647, // Key of Terror
648, // Key of Hate
649, // Key of Destruction
650, // Diablo's Horn
651, // Baal's Eye
652, // Mephisto's Brain
653, // Token of Absolution
654, // Twisted Essence of Suffering
655, // Charged Essence of Hatered
656, // Burning Essence of Terror
657, // Festering Essence of Destruction
658); // Standard of Heroes
// type : 1 = shop, 2 = ressurect, 3 = repair, 4 = potion, 5 = scrolls, 6 = gamble, 7 = ammo, 8 = healing
function NTT_CheckNPC(npc, type)
{
var _npcclassid;
if(typeof(npc) == "number")
_npcclassid = npc;
else
_npcclassid = npc.classid;
if(type == 1)
{
if(_npcclassid == 147 || _npcclassid == 148 || _npcclassid == 154 || _npcclassid == 177 ||
_npcclassid == 178 || _npcclassid == 199 || _npcclassid == 202 || _npcclassid == 252 ||
_npcclassid == 253 || _npcclassid == 254 || _npcclassid == 255 || _npcclassid == 257 ||
_npcclassid == 405 || _npcclassid == 511 || _npcclassid == 512 || _npcclassid == 513)
return true;
else
return false;
}
if(type == 2)
{
if(_npcclassid == 150 || _npcclassid == 198 || _npcclassid == 252 || _npcclassid == 367 || _npcclassid == 515)
return true;
else
return false;
}
if(type == 3)
{
if(_npcclassid == 154 || _npcclassid == 178 || _npcclassid == 253 || _npcclassid == 257 || _npcclassid == 511)
return true;
else
return false;
}
if(type == 4)
{
if(_npcclassid == 148 || _npcclassid == 177 || _npcclassid == 198 || _npcclassid == 202 ||
_npcclassid == 255 || _npcclassid == 405 || _npcclassid == 513)
return true;
else
return false;
}
if(type == 5)
{
if(_npcclassid == 148 || _npcclassid == 177 || _npcclassid == 255 || _npcclassid == 405 || _npcclassid == 513)
return true;
else
return false;
}
if(type == 6)
{
if(_npcclassid == 147 || _npcclassid == 199 || _npcclassid == 254 ||
_npcclassid == 405 || _npcclassid == 512 || _npcclassid == 514)
return true;
else
return false;
}
if(type == 7)
{
if(_npcclassid == 147 || _npcclassid == 154 || _npcclassid == 178 || _npcclassid == 199 || _npcclassid == 252 ||
_npcclassid == 253 || _npcclassid == 257 || _npcclassid == 511 || _npcclassid == 512)
return true;
else
return false;
}
if(type == 8)
{
if(_npcclassid == 148 || _npcclassid == 178 || _npcclassid == 255 || _npcclassid == 513)
return true;
else
return false;
}
return false;
}
// npc : NPC, stash or cube
function NTT_DoInteract(npc)
{
var _uiflag = 0x08;
if(!npc)
return false;
if(npc.classid == NTC_UNIT_STASH)
_uiflag = 0x19;
else if(npc.classid == NTC_UNIT_CUBE)
_uiflag = 0x1A;
if(GetUIState(_uiflag))
return true;
for(var i = 0; i < 40; i++)
{
if((i % 10) == 0 || i == 5)
{
if(npc.classid == NTC_UNIT_CUBE)
me.ClickItem(1, npc);
else
{
if(i > 10)
me.Cancel(0);
if(MWConfig_UseTelekinesis && i < 20 && NTC_GetSkillLevel(MWS_TELEKINESIS) > 0 && npc.classid == NTC_UNIT_STASH)
MWC_CastTelekinesis(npc);
else
NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, npc);
}
}
NTC_Delay(200);
if(GetUIState(_uiflag))
{
NTC_PingDelay(200);
return true;
}
}
return false;
}
// type : 0 = shop, 1 = gamble
function NTT_DoTrade(npc, type)
{
if(!npc)
return false;
if(GetUIState(0x0C))
return true;
if(arguments.length < 2)
type = 0;
for(var i = 0 ; i < 20 ; i++)
{
if((i % 10) == 0)
{
if(NTT_CheckNPC(npc.classid, 3))
me.SelectNPCMenu(0x0D06);
else if(type == 1 && NTT_CheckNPC(npc.classid, 6))
me.SelectNPCMenu(0x0D46);
else
me.SelectNPCMenu(0x0D44);
}
NTC_Delay(200);
if(GetUIState(0x0C))
{
for(i = 0; i < 5; i++)
{
NTC_PingDelay(100);
if(npc.GetItems())
break;
}
return true;
}
}
return false;
}
function NTT_GetCorpses()
{
var _corpse;
for(var i = 0 ; i < 4 ; i++)
{
_corpse = NTC_FindUnit(NTC_UNIT_PLAYER);
if(_corpse)
{
do
{
if(_corpse.name == me.name && _corpse.hpmax == 0)
{
NTC_SwapWeapons(0);
NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _corpse);
NTC_PingDelay(1000);
break;
}
} while(_corpse.GetNext());
}
}
}
function NTT_CheckMerc()
{
if(NTConfig_UseMerc)
{
if(NTC_GetMerc())
return false;
else
{
if(NTC_MyGold() < me.GetMercCost())
return false;
return true;
}
}
return false;
}
function NTT_ReviveMerc()
{
var _mygold;
if(!NTT_CheckMerc())
return true;
if(!GetUIState(0x08))
return false;
_mygold = NTC_MyGold();
if(_mygold < me.GetMercCost())
return false;
for(var i = 0 ; i < 8 ; i++)
{
if((i % 4) == 0)
me.SelectNPCMenu(0x1507);
NTC_Delay(500);
if(_mygold > NTC_MyGold())
return true;
}
return false;
}
function MWT_ResetMyArmor()
{
var i, n;
var _armor;
_armor = MWC_GetItems(MWC_ITEMLOC_BODY_ARMOR, 1);
if(!_armor)
return false;
if((_armor.itemflag&0x4000000) && _armor.itemprefix == 0x503B)
{
MWC_WriteToTextfile("Enigma Reset: " + me.charname, "EniResets.txt", 2, true);
SetUIState(0x1, true);
for(n = 0; n < 80; n++)
{
if(n % 40 == 0)
me.ClickItem(MWC_ITEMLOC_BODY_ARMOR);
NTC_Delay(100);
if(me.itemoncursor)
{
NTC_PingDelay(200);
break;
}
}
if(n >= 80)
{
me.Cancel(1);
return false;
}
for(n = 0; n < 120; n++)
{
if(n % 40 == 0)
me.ClickItem(MWC_ITEMLOC_BODY_ARMOR);
NTC_Delay(100);
if(!me.itemoncursor)
break;
}
me.Cancel(1);
if(n < 120)
return true;
}
return false;
}
function NTT_CheckRepair(repairpercent)
{
var _max_dur;
var _percent;
var _items = me.GetItems();
if(!_items)
return false;
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 1 && !(_items[i].itemflag&0x400000) && !_items[i].GetStat(152))
{
if(_items[i].itemtype == 42 || _items[i].itemtype == 43 || _items[i].itemtype == 44 || _items[i].itemtype == 87)
_percent = Math.floor((_items[i].GetStat(70)*100) / (GetBaseStat("weapons.txt", _items[i].classid, 45)+_items[i].GetStat(254)));
else
{
_max_dur = _items[i].GetStat(73);
if(_max_dur == 0)
continue;
_percent = Math.floor((_items[i].GetStat(72)*100) / (_max_dur*(_items[i].GetStat(75)/100 + 1)));
}
if(_percent <= repairpercent)
return true;
}
}
return false;
}
function MWT_CheckRepairCost()
{
var _cost, _items;
_items = me.GetItems();
_cost = 0;
if(!_items)
return false;
for(var i = 0; i < _items.length; i++)
{
if(_items[i].mode == 1 && !(_items[i].itemflag&0x400000) && !_items[i].GetStat(152))
{
if(_items[i].GetItemCost(3) > 1)
_cost += _items[i].GetItemCost(3);
}
}
return NTC_MyGold() > _cost;
}
function NTT_RepairItems(npc)
{
var _mygold;
if(!npc)
return false;
if(!GetUIState(0x0C))
return false;
_mygold = NTC_MyGold();
for(var i = 0; i <= 4; i++)
{
if((i % 4) == 0)
me.Repair();
NTC_Delay(500);
if(_mygold > NTC_MyGold())
return true;
}
return false;
}
function NTT_CheckInventory()
{
var x, y;
var _items;
_itemlist = new Array();
_ignorestring = _NTT_IgnoredItems.join();
if(!NTC_StashGoldFull() && NTC_MyGoldCarry() > NTConfig_MinGoldToStash)
return true;
_invspace = new Array(4);
_invspace[0] = new Array(10);
_invspace[1] = new Array(10);
_invspace[2] = new Array(10);
_invspace[3] = new Array(10);
for(y = 0 ; y < 4 ; y++)
{
for(x = 0 ; x < 10 ; x++)
_invspace[y][x] = 0;
}
_items = me.GetItems();
if(!_items)
return false;
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY)
{
if(NTConfig_Columns[_items[i].y][_items[i].x] > 0)
_itemlist.push(_items[i].code);
for(y = 0 ; y < _items[i].ysize ; y++)
{
for(x = 0 ; x < _items[i].xsize ; x++)
_invspace[y+_items[i].y][x+_items[i].x] = 1;
}
}
}
_freecols = new Array(10);
for(x = 0 ; x < 10 ; x++)
_freecols[x] = 0;
for(x = 0 ; x < 10 ; x++)
{
for(y = 0 ; y < 4 ; y++)
{
if(_invspace[y][x] == 1)
{
_freecols[x] = 1;
break;
}
}
}
_numfreecols = 0;
for(x = 0 ; x < 10 ; x++)
{
if(_freecols[x] == 0)
_numfreecols++;
}
if(NTConfig_FreeSpace > _numfreecols)
{
for(x = 0 ; x < _itemlist.length ; x++)
{
if(_ignorestring.indexOf(_itemlist[x]) != -1)
_itemlist.splice(x, 1);
}
if(_itemlist.length > 0)
return true;
}
return false;
}
function NTT_CheckStash()
{
var _stash;
_stash = new MWT_Stash();
if(!_stash)
return false;
return _stash.Check();
}
function NTT_ManageStash(invitem)
{
var _items;
var _stashall;
var _ignorestring = _NTT_IgnoredItems.join();
var _ignoreitem;
var _check;
var _targetSlot;
var _retriedGid;
var _stash;
if(!GetUIState(0x19))
return false;
if(arguments.length < 1)
_stashall = true;
else
_stashall = false;
if(!NTC_StashGoldFull() && NTC_MyGoldCarry() > NTConfig_MinGoldToStash)
{
var _mygold = NTC_MyGoldCarry();
Gold(3, _mygold);
for(i = 0; i < 5; i++)
{
NTC_Delay(200);
if(_mygold > NTC_MyGoldCarry())
break;
}
}
_items = MWC_GetItems(0);
_stash = new MWT_Stash();
if(!_items || !_stash)
return false;
for(var i = 0; i < _items.length; i++)
{
if(_stashall || _items[i].gid == invitem.gid)
{
if(_stashall)
{
_ignoreitem = (NTConfig_Columns[_items[i].y][_items[i].x] <= 0);
if(!_ignoreitem)
{
_check = NTSI_CheckItem(_items[i], true);
if(_ignorestring.indexOf(_items[i].code) != -1 || _check <= 0 || _check == 3)
_ignoreitem = true;
}
}
else
_ignoreitem = false;
if(!_ignoreitem)
{
_targetSlot = _stash.GetTargetSlot(_items[i]); // Use the Stash object in order to find the item's target location in stash
if(_targetSlot.x != -1)
_stash.MoveItem(_items[i], _targetSlot.x, _targetSlot.y); // Move the item to the target coordinates if valid
else if(MWConfig_SortStash)
{
if(_stash.Sort()) // Try sorting the stash in order to get sufficient space for the the item handled
{
// Retry once if sorting was successful
if(_retriedGid != _items[i].gid)
{
_retriedGid = _items[i].gid;
i--;
}
continue;
}
}
if(!_stashall)
return true;
}
}
}
if(MWConfig_SortStash)
_stash.Sort();
MWT_CheckKeyPosition();
return true;
}
// type : id = 0, tp = 1
function NTT_GetScroll(type)
{
var _items;
if(arguments.length < 1)
type = 0;
if(type)
_items = me.GetItems(529);
else
_items = me.GetItems(530);
if(_items)
{
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY)
return _items[i];
}
}
return null;
}
// type : id = 0, tp = 1
function NTT_GetTome(type)
{
var _items;
if(arguments.length < 1)
type = 0;
if(type)
_items = me.GetItems(518);
else
_items = me.GetItems(519);
if(_items)
{
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY)
return _items[i];
}
}
return null;
}
// type : id = 0, tp = 1
function NTT_FillTome(npc, type)
{
var _tome;
if(arguments.length < 1)
return false;
if(arguments.length < 2)
type = 0;
_tome = NTT_GetTome(type);
if(_tome)
{
var _items;
if(_tome.GetStat(70) >= 20)
return true;
if(type)
_items = npc.GetItems(529);
else
_items = npc.GetItems(530);
if(_items && _items.length > 0)
return NTT_ShopItem(_items[0], npc, 3);
}
return false;
}
// type : id = 0, tp = 1
function NTT_BuyScrolls(npc, type, amount)
{
var _items;
var _counter = 0;
if(arguments.length < 1)
return false;
if(arguments.length < 2)
type = 0;
if(arguments.length < 3)
amount = 1;
if(amount == 0)
return false;
if(type)
_items = npc.GetItems(529);
else
_items = npc.GetItems(530);
if(_items && _items.length > 0)
{
for(var i = 0 ; i < amount ; i++)
{
if(NTT_ShopItem(_items[0], npc, 2))
_counter++;
}
}
return (_counter > 0);
}
function NTT_GetKey()
{
var _items;
_items = MWC_GetItems(MWC_LOC_INVENTORY, 0, 543);
if(_items[0])
return _items[0];
return null;
}
function NTT_FillKey(npc)
{
var _key;
var _items;
if(arguments.length < 1)
return false;
_key = NTT_GetKey();
if(_key && _key.GetStat(70) >= 12)
return true;
_items = npc.GetItems(543);
if(_items && _items.length > 0)
return NTT_ShopItem(_items[0], npc, 3);
return false;
}
function NTT_CheckBelt()
{
var _belt;
_belt = new MWT_Belt();
if(_belt)
return _belt.Check();
return false;
}
function NTT_FillBelt(npc)
{
var _emptyColCount;
if(!npc)
return false;
if(!GetUIState(0x0C))
return false;
if(_NTT_BeltSize < 1)
_NTT_BeltSize = NTC_GetBeltSize();
_emptyColCount = 0;
for(var i = 0; i < _NTT_BeltColNeeded.length; i++)
{
if(_NTT_BeltColNeeded[i] == _NTT_BeltSize)
_emptyColCount++;
}
if(_emptyColCount > 1)
NTT_BuyPotionsSlowInt(npc);
else
NTT_BuyPotionsFastInt(npc);
return true;
}
function NTT_CheckHeal()
{
var _merc;
if(parseInt(me.hp*100/me.hpmax) < NTConfig_SkipHealLife || parseInt(me.mp*100/me.mpmax) < NTConfig_SkipHealMana)
return true;
_merc = NTC_GetMerc();
if(_merc)
{
if(parseInt(_merc.hp*100/_merc.hpmax) < NTConfig_SkipHealLife)
return true;
}
return false;
}
function NTT_CheckSpace(itemX, itemY)
{
var i, j, x, y;
var _items;
_invspace = new Array(4);
_invspace[0] = new Array(10);
_invspace[1] = new Array(10);
_invspace[2] = new Array(10);
_invspace[3] = new Array(10);
for(y = 0 ; y < 4 ; y++)
{
for(x = 0 ; x < 10 ; x++)
_invspace[y][x] = 0;
}
_items = me.GetItems();
if(!_items)
return false;
for(i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY)
{
for(y = 0 ; y < _items[i].ysize ; y++)
{
for(x = 0 ; x < _items[i].xsize ; x++)
_invspace[y+_items[i].y][x+_items[i].x] = 1;
}
}
}
for(i = 0 ; i < 5-itemY ; i++)
{
invloop2:
for(j = 0 ; j < 11-itemX ; j++)
{
for(y = 0 ; y < itemY ; y++)
{
for(x = 0 ; x < itemX ; x++)
{
if(_invspace[i+y][j+x])
continue invloop2;
}
}
return true;
}
}
return false;
}
function NTT_CleanPotions()
{
var _items;
_items = MWC_GetItems(MWC_LOC_INVENTORY, 0);
if(!_items)
return false;
NTT_CheckBelt();
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].itemtype >= 76 && _items[i].itemtype <= 78)
{
if(NTConfig_Columns[_items[i].y][_items[i].x] > 0)
{
SetUIState(0x01, true);
if(MWT_IsPotionRequired(_items[i].code))
me.ClickItem(2, _items[i]);
else
me.ClickItem(1, _items[i]);
NTC_PingDelay(250);
}
}
}
if(GetUIState(0x01))
me.Cancel(1);
return true;
}
function NTT_ClearInventory()
{
var _retval = true;
var _ignorestring = _NTT_IgnoredItems.join();
var _items;
var _check;
_items = me.GetItems();
if(!_items)
return false;
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY)
{
if(NTConfig_Columns[_items[i].y][_items[i].x] > 0)
{
_check = NTSI_CheckItem(_items[i], true);
if(_ignorestring.indexOf(_items[i].code) != -1 || _check != 0 && _check != 3)
{
if(!(_items[i].itemtype >= 4 && _items[i].itemtype <= 9) && !(_items[i].itemtype >= 76 || _items[i].itemtype <= 81) && _items[i].itemtype != 41)
MWI_WriteManagerLog(_items[i], 0, true);
continue;
}
SetUIState(0x01, true);
Print("ÿc5Dropped " + NTC_ItemQualityToD2Color[MWC_GetItemColorInt(_items[i])] + _items[i].name.split("\n")[0] + ((_items[i].quality > 4) ? " (" + MWI_NameItem(_items[i].classid) + ")" : ""));
if(MWConfig_UseXMLItemlog)
MWI_WriteLog(_items[i], 1);
if(MWConfig_LogSoldItems)
MWI_WriteManagerLog(_items[i], 3);
if(!NTT_DropItem(_items[i]))
_retval = false;
}
}
}
me.Cancel(1);
return _retval;
}
function NTT_DropItem(item)
{
if(!item)
return false;
if(NTC_ItemToCursor(item))
return NTC_ClearCursor();
return false;
}
// mode : 1 = sell, 2 = buy, 3 = shift buy
function NTT_ShopItem(item, npc, mode)
{
var _mygold, _initCount, _unit, _return;
_mygold = NTC_MyGold();
_return = false;
if(mode > 1)
{
if(item.GetItemCost(0, npc.classid) > _mygold)
return false;
}
if(mode > 1)
{
var _havespace = false;
if(item.classid == 529 || item.classid == 530)
{
_unit = (item.classid == 530) ? NTT_GetTome(0) : NTT_GetTome(1);
if(_unit && _unit.GetStat(70) < 20)
{
_havespace = true;
_initCount = _unit.GetStat(70);
}
}
else if(item.classid == 543)
{
_initCount = MWTMGR_GetKeyQuantity();
if(_initCount < 12)
_havespace = true;
}
else if(item.itemtype >= 76 && item.itemtype <= 81)
{
if(MWT_IsPotionRequired(item.code, true))
_havespace = true;
_unit = new MWT_Belt();
if(!_unit)
return false;
_initCount = _unit.GetPotionCount(-1, 1);
}
if(!_havespace)
{
if(NTT_CheckSpace(item.xsize, item.ysize))
_havespace = true;
}
if(_havespace)
{
for(var i = 0; i <= 40; i++)
{
NTC_Delay(200);
if((i % 10) == 0)
me.ClickItem(mode > 2 ? 3 : 1, item);
// This is used to avoid a general delay before buying keys, scrolls or potions
if(item.classid == 543)
{
if(_initCount != MWTMGR_GetKeyQuantity)
_return = true;
}
else if(item.classid == 529 || item.classid == 530)
{
if(_initCount != NTTMGR_CheckScrolls((item.classid == 530) ? 0 : 1))
_return = true;
}
else if(item.itemtype >= 76 && item.itemtype <= 81)
{
_unit.RefreshProperties();
if(_initCount != _unit.GetPotionCount(-1, 1))
_return = true;
}
if(_mygold > NTC_MyGold() || _return)
{
NTC_PingDelay(100);
return true;
}
}
}
}
else
{
if(NTC_ItemToCursor(item))
{
for(var i = 0; i < 40; i++)
{
if((i % 20) == 0)
me.ClickItem(0, 8, 6, 1);
NTC_Delay(100);
if(!me.itemoncursor)
{
NTC_PingDelay(100);
return true;
}
}
}
}
return false;
}
function NTT_IdItem(scroll, uniditem)
{
var i;
if(arguments.length < 1 || !scroll)
return false;
if(arguments.length < 2 || !uniditem)
return false;
if(uniditem.itemflag&0x10)
return true;
for(i = 0; i < 40; i++)
{
if((i % 20) == 0)
me.ClickItem(1, scroll);
if(GetCursorType() == 6)
break;
NTC_Delay(200);
}
if(i >= 40)
return false;
NTC_PingDelay(200);
for(i = 0; i < 40; i++)
{
if((i % 20) == 0)
me.ClickItem(0, uniditem);
if(uniditem.itemflag&0x10)
{
NTC_PingDelay(200);
return true;
}
NTC_Delay(200);
}
return false;
}
function NTT_CheckUnids()
{
var _unidcount = 0;
var _items = me.GetItems();
if(!_items)
return _unidcount;
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY && !(_items[i].itemflag&0x10))
_unidcount++;
}
return _unidcount;
}
function NTT_GetUnidItems()
{
var _uniditems = new Array();
var _items = me.GetItems();
if(!_items)
return _uniditems;
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY && !(_items[i].itemflag&0x10))
_uniditems.push(_items[i]);
}
return _uniditems;
}
function NTT_GambleIt(npc, gamblingData)
{
var _items, _newitem, _preGold, _preGoldTotal, _preItems;
if(!npc || !GetUIState(0x0C))
return gamblingData;
_items = npc.GetItems();
if(!_items)
return gamblingData;
NTC_SendMsgToScript("MWBotGame.ntj", "STOP_STATUS_TEXT_UPDATE");
_preGoldTotal = NTC_MyGold();
_preItems = new Array(gamblingData["itemsgambled"], gamblingData["itemskept"]);
for(var i = 0 ; i < _items.length ; i++)
{
_preGold = NTC_MyGold();
if(NTC_MyGold() < NTConfig_GambleStopGold)
break;
if(NTT_IsItemInGambleArrayInt(_items[i].classid))
{
if(NTT_CheckSpace(_items[i].xsize, _items[i].ysize))
{
NTT_GetOldItemsInt();
NTC_PingDelay(250);
if(NTT_ShopItem(_items[i], npc, 2))
_newitem = NTT_GetGambledItemInt();
else
break;
if(_newitem)
{
gamblingData["itemsgambled"]++;
while(!(_newitem.itemflag & 0x10))
NTC_Delay(NTC_DELAY_FRAME);
switch(NTSI_CheckItem(_newitem))
{
case 1:
gamblingData["itemskept"]++;
MWI_WriteLoc(_newitem, "Gambling [" + npc.name + "]");
Print("Gambled " + NTC_ItemQualityToD2Color[MWC_GetItemColorInt(_newitem)] + _newitem.name.split("\n")[0] + " (" + MWI_NameItem(_newitem.classid) + ")");
MWI_WriteManagerLog(_newitem, 1, true);
if(MWConfig_UseXMLItemlog)
MWI_WriteLog(_newitem, 0);
case 2:
break;
default:
MWI_WriteLoc(_newitem, "Gambling [" + npc.name + "]");
if(MWConfig_UseXMLItemlog)
MWI_WriteLog(_newitem, 1);
if(MWConfig_LogSoldItems)
MWI_WriteManagerLog(_newitem, 3);
NTT_ShopItem(_newitem, npc, 1);
break;
}
gamblingData["goldspent"] += _preGold - NTC_MyGold();
if((gamblingData["goldspent"] / gamblingData["goldmax"] * 100.0).toFixed(1) <= 100)
SetStatusText("ÿc8Gambling... [" + gamblingData["itemsgambled"] + "] (" + (gamblingData["goldspent"] / gamblingData["goldmax"] * 100.0).toFixed(1) + "%)");
}
}
else
gamblingData["abort"] = true;
}
}
MWI_WriteGamblingData(_preGoldTotal - NTC_MyGold(), new Array(gamblingData["itemsgambled"] - _preItems[0], gamblingData["itemskept"] - _preItems[1]));
return gamblingData;
}
// Internal function
function NTT_IsItemInGambleArrayInt(classid)
{
for(var i = 0 ; i < NTConfig_GambleItem.length ; i++)
{
if(classid == NTConfig_GambleItem[i])
return true;
}
return false;
}
function NTT_GetPotionAtNPCInt(type, npc)
{
var _items;
var i;
if(!type)
return null;
if(type == "hp" || type == "mp")
{
_items = npc.GetItems();
if(_items)
{
for(var n = 5; n > 0; n--)
{
for(i = 0; i < _items.length; i++)
{
if(_items[i].code == (type+n))
return _items[i];
}
}
}
}
else
{
if(type == "rv")
return null;
_items = npc.GetItems(type);
if(_items && _items.length > 0)
return _items[0];
}
return null;
}
function NTT_GetGambledItemInt()
{
var _items;
var _founditem;
_items = me.GetItems();
if(!_items)
return null;
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY)
{
_founditem = true;
for(var n = 0 ; n < _NTT_OldItems.length ; n++)
{
if(_items[i].gid == _NTT_OldItems[n])
{
_founditem = false;
break;
}
}
if(_founditem)
return _items[i];
}
}
return null;
}
function NTT_GetOldItemsInt()
{
var _items;
_NTT_OldItems = new Array();
_items = me.GetItems();
if(!_items)
return false;
for(var i = 0 ; i < _items.length ; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY)
_NTT_OldItems.push(_items[i].gid);
}
return true;
}
function MWT_CarryForcedUnids()
{
var _items;
_items = me.GetItems();
if(!_items)
return true;
for(var i = 0; i < _items.length; i++)
{
if(!(_items[i].itemflag&0x10) && (_items[i].itemloc == MWC_LOC_INVENTORY || (_items[i].itemloc == MWC_LOC_CUBE && _items[i].mode == 0)))
{
if(NTSI_CheckItem(_items[i]) == 1)
return true;
}
}
return false;
}
function MWT_OpenStash()
{
var _stash;
if(!NTC_InTown())
return false;
if(GetUIState(0x19))
return true;
_stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH);
if(!_stash || GetDistance(me, _stash) > 5)
{
NTTM_TownMove("stash");
_stash = NTC_FindUnit(NTC_UNIT_OBJECT, NTC_UNIT_STASH, 3);
}
if(_stash)
{
for(var i = 0; i < 5; i++)
{
NTT_DoInteract(_stash);
if(GetUIState(0x19))
{
NTC_PingDelay(200);
return true;
}
NTC_Delay(250);
}
}
return false;
}
function MWT_GetTrashItems(simple)
{
var _items, _trash, _check;
if(arguments.length < 1)
simple = true;
_trash = new Array();
_items = me.GetItems();
if(_items)
{
for(var i = 0; i < _items.length; i++)
{
if(_items[i].mode == 0 && _items[i].itemloc == MWC_LOC_INVENTORY && NTConfig_Columns[_items[i].y][_items[i].x] > 0 && _NTT_IgnoredItems.indexOf(_items[i].code) == -1)
{
_check = NTSI_CheckItem(_items[i], true);
if(_check == 0 || _check == 3)
{
if(!simple || MWT_IsSellable(_items[i]))
_trash.push(_items[i]);
}
}
}
}
return _trash;
}
function MWT_IsSellable(item)
{
return (_MWT_UnsellableItems.indexOf(item.classid) == -1);
}
function MWT_CheckKeyPosition()
{
var _items, _targetPos;
if(!MWConfig_CarryKeys)
return false;
if(!GetUIState(0x01) && !GetUIState(0x19))
return false;
_targetPos = new coord(-1, -1);
for(var y = 0; y < 4; y++)
{
for(var x = 0; x < 10; x++)
{
if(NTConfig_Columns[y][x] == 2)
{
_targetPos = new coord(x, y);
y = 4;
break;
}
}
}
if(_targetPos.x > -1)
{
_items = MWC_GetItems(0);
if(_items)
{
for(var i = 0; i < _items.length; i++)
{
if(_items[i].classid != 543)
{
if(_items[i].xsize == 1 && _items[i].x == _targetPos.x || _items[i].x <= _targetPos.x && _items[i].x + _items[i].xsize - 1 >= _targetPos.x)
{
if(_items[i].ysize == 1 && _items[i].y == _targetPos.y || _items[i].y <= _targetPos.y && _items[i].y + _items[i].ysize - 1 >= _targetPos.y)
return false;
}
}
}
}
_items = me.GetItems(543);
if(_items && _items.length > 0)
{
if(_items[0].x != _targetPos.x || _items[0].y != _targetPos.y || _items[0].itemloc != MWC_LOC_INVENTORY)
{
if(NTC_ItemToCursor(_items[0]))
{
for(var i = 0; i <= 40; i++)
{
if(i % 20 == 0)
me.ClickItem(0, _targetPos.x, _targetPos.y, MWC_LOC_INVENTORY);
if(!me.itemoncursor)
{
NTC_PingDelay(200);
break;
}
NTC_Delay(100);
}
}
}
return _items[0].x == _targetPos.x && _items[0].y == _targetPos.y;
}
}
return false;
}
function MWT_Stash()
{
this.HEIGHT = (me.gametype == 0) ? 4 : 8;
this.WIDTH = 6;
this.COLWIDTH = 2;
this.Items;
this.Slots;
this.Refresh = true;
this.RefreshProperties = MWT_Stash_RefreshProperties;
this.GetTargetSlot = MWT_Stash_GetTargetSlot;
this.GetItemIndex = MWT_Stash_GetItemIndex;
this.Sort = MWT_Stash_Sort;
this.MoveItem = MWT_Stash_MoveItem;
this.CheckFragmentation = MWT_Stash_CheckFragmentation;
this.Check = MWT_Stash_Check;
this.PrintContent = MWT_Stash_PrintContent;
this.GetSlotCount = MWT_Stash_GetSlotCount;
this.RefreshProperties();
}
function MWT_Stash_GetSlotCount(mode)
{
var i, j;
var _count;
if(arguments.length < 1)
mode = 0;
this.RefreshProperties();
_count = 0;
for(i = 0; i < this.HEIGHT; i++)
{
for(j = 0; j < this.WIDTH; j++)
{
if(this.Slots[i][j] != 0)
_count++;
}
}
if(mode == 0) // Free slots
return this.HEIGHT * this.WIDTH - _count;
else // Used slots
return _count;
}
function MWT_Stash_PrintContent()
{
var _line;
var i, j;
this.RefreshProperties();
Print("Current Stash Status:");
for(i = 0; i < this.HEIGHT; i++)
{
_line = "[" + i + "]: ";
for(j = 0; j < this.WIDTH; j++)
{
if(this.Slots[i][j] == 0)
_line += "ÿc2O";
else if(this.Slots[i][j] == 1)
_line += "ÿc1X";
else
_line += "ÿc4C";
}
Print(_line);
}
}
function MWT_Stash_Check()
{
var _items, _targetSlot, _ignorestring;
this.RefreshProperties();
_items = MWC_GetItems(MWC_LOC_INVENTORY);
if(!_items)
return false;
_ignorestring = _NTT_IgnoredItems.join();
for(var i = 0; i < _items.length; i++)
{
// Checked whether the item is supposed to be stashed
if(NTConfig_Columns[_items[i].y][_items[i].x] == 1)
{
_check = NTSI_CheckItem(_items[i], true);
if(_ignorestring.indexOf(_items[i].code) != -1 || _check <= 0 || _check == 3)
continue;
}
else
continue;
// The item is supposed to be stashed - check if the room will suffice
_targetSlot = this.GetTargetSlot(_items[i]);
if(_targetSlot.x > -1) // Return true if a valid stash position was found
return true;
else if(_items[i].xsize == 1 && _items[i].ysize == 1)
return false;
}
return false;
}
function MWT_Stash_CheckFragmentation()
{
var _index = -1;
this.RefreshProperties();
for(var _columnX = this.WIDTH - 2; _columnX >= 0; _columnX -= 2)
{
for(var y = this.HEIGHT - 1; y >= 0; y--)
{
for(var x = 1; x >= 0; x--)
{
if(_index == -1)
{
if(this.Slots[y][_columnX + x] > 0)
{
_index = this.GetItemIndex(_columnX + x, y);
break;
}
}
else if(this.Slots[y][_columnX + x] == 0 && (this.Items[_index].y > y || _columnX + x <= this.Items[_index].x))
return true;
}
}
}
return false;
}
function MWT_Stash_MoveItem(item, x, y)
{
if(arguments.length < 3 || !item)
return false;
if(NTC_ItemToCursor(item))
{
this.Refresh = true;
for(n = 0; n < 80; n++)
{
if((n % 40) == 0)
me.ClickItem(0, x, y, MWC_LOC_STASH);
NTC_Delay(100);
if(!me.itemoncursor)
break;
}
if(n < 80)
{
NTC_PingDelay(100);
return true;
}
}
return false;
}
function MWT_Stash_Sort()
{
var _index, _targetSlot, _moved, _handledIndices;
if(!this.CheckFragmentation())
return true;
_moved = 0;
_handledIndices = new Array();
for(var _col = this.WIDTH - this.COLWIDTH; _col >= 0; _col -= this.COLWIDTH) // Loop over all columns starting with the very right one
{
for(var y = this.HEIGHT - 1; y >= 0; y--) // Loop over all y starting with the largest y value at the very bottom of the stash
{
for(var x = this.COLWIDTH - 1; x >= 0; x--) // Loop over the current column starting with the largest x located at the column's right-hand side
{
if(this.Slots[y][_col + x] > 0) // Only handle fields that are actually blocked by an item
{
_index = this.GetItemIndex(_col + x, y); // Get the index of the item unit blocking the current coordinates
if(_index > -1 && _handledIndices.indexOf(_index) == -1)
{
_handledIndices.push(_index); // Make sure large items are only handled once per recursion
_targetSlot = this.GetTargetSlot(this.Items[_index]); // Get the item's target location in stash
if(_targetSlot.x != -1 && (_targetSlot.x != this.Items[_index].x || _targetSlot.y != this.Items[_index].y))
{
// The target location must be valid and differ from the items current location
if(_targetSlot.x < _col + this.COLWIDTH - 1 || _targetSlot.y < this.Items[_index].y && _targetSlot.x <= _col + this.COLWIDTH - 1)
{
// Move the item if the item's target location either is in a lower column or if it is in a lower or the same column and closer to the top of stash than the item currently is
if(!this.MoveItem(this.Items[_index], _targetSlot.x, _targetSlot.y))
return false;
else
_moved++; // Count the number of items move in order to control recursion and avoid infinite recursion
}
}
else if(this.Items[_index].xsize == 1 && this.Items[_index].ysize == 1)
{
// Stop all loops if the target coordinates are invalid and the item size is 1*1 as this tells us that there is no room left at all
y = -1;
_col = -1;
break;
}
}
}
}
}
}
if(this.CheckFragmentation() && _moved > 0) // Run recusions while the stash is still fragmented and there were items moved during the last recusion
return this.Sort();
return !this.CheckFragmentation();
}
function MWT_Stash_GetItemIndex(x, y)
{
if(arguments.length < 2)
return -1;
this.RefreshProperties();
for(var i = 0; i < this.Items.length; i++)
{
if(x >= this.Items[i].x && x < this.Items[i].x + this.Items[i].xsize)
{
if(y >= this.Items[i].y && y < this.Items[i].y + this.Items[i].ysize)
return i;
}
}
return -1;
}
function MWT_Stash_GetTargetSlot(item)
{
var x, y, m, n;
var _index, _col;
this.RefreshProperties();
/*
_colX: | | |
V V V
0 O O O O O O
H 1 O O O O O O
E 2 O O O O O O
I 3 O O O O O O
G 4 O O O O O O
H 5 O O O O O O
T 6 O O O O O O
7 O O O O O O
0 1 2 3 4 5
W I D T H
Clear: 0
Blocked: 1
Blocked (Cube): -1
*/
if(item)
{
for(_col = 0; _col < this.WIDTH; _col += 2)
{
for(y = 0; y < this.HEIGHT; y++)
{
for(x = 0; x < 3 - item.xsize; x++)
{
if(this.Slots[y][_col + x] == 0 || item.itemloc == MWC_LOC_STASH && _col + x == item.x && y == item.y)
{
if(_col + x + item.xsize <= this.WIDTH && y + item.ysize <= this.HEIGHT)
{
for(m = 0; m < item.ysize; m++)
{
for(n = 0; n < item.xsize; n++)
{
_index = this.GetItemIndex(_col + x + n, y + m);
// Abort if location is blocked and the item blocking the location is not the very item currently being handled
if(this.Slots[y + m][_col + x + n] != 0 && (_index == -1 || item.gid != this.Items[_index].gid))
{
m = 1000;
break;
}
}
}
if(m < 1000)
return new coord(_col + x, y);
}
}
}
}
}
}
return new coord(-1, -1);
}
function MWT_Stash_RefreshProperties()
{
var x, y;
if(!this.Refresh) // Only refresh the properties if it is actually necessary
return false;
this.Items = MWC_GetItems(MWC_LOC_STASH);
if(!this.Items)
return this.RefreshProperties();
// Create a 2 dimensional array that represents the stash
this.Slots = new Array(this.HEIGHT);
for(y = 0; y < this.Slots.length; y++)
{
this.Slots[y] = new Array(this.WIDTH);
for(x = 0; x < this.Slots[y].length; x++)
this.Slots[y][x] = 0; // Initialize all array elements with 0
}
for(var i = 0; i < this.Items.length; i++)
{
for(x = 0; x < this.Items[i].xsize; x++)
{
for(y = 0; y < this.Items[i].ysize; y++)
{
// Set the fields taken by the item to either -1 if the item is the horadric cube or 1 for any other item
if(this.Items[i].classid == NTC_UNIT_CUBE)
this.Slots[this.Items[i].y + y][this.Items[i].x + x] = -1;
else
this.Slots[this.Items[i].y + y][this.Items[i].x + x] = 1;
}
}
}
this.Refresh = false;
return true;
}
function MWT_CheckManaPotions(threshold)
{
if(!MWConfig_BuyPotionsOnLackOfMana)
return false;
if(me.mp / me.mpmax < threshold && MWC_GetPotionCountInt("mp") == 0)
{
Print("Lack of ÿc3Manaÿc0! Visiting Town...");
return NTTMGR_VisitTown();
}
return false;
}
function MWT_Belt()
{
this.Columns;
this.ColumnType;
this.SIZE = NTC_GetBeltSize();
this.RefreshProperties = MWT_Belt_RefreshProperties;
this.GetPotionCount = MWT_Belt_GetPotionCount;
this.CheckPotionPositions = MWT_Belt_CheckPotionPositions;
this.CheckMaxColumns = MWT_Belt_CheckMaxColumns;
this.ClearSlot = MWT_Belt_ClearSlot;
this.GetColumnCount = MWT_Belt_GetColumnCount;
this.GetTargetSlot = MWT_Belt_GetTargetSlot;
this.RelocatePotion = MWT_Belt_RelocatePotion;
this.CalcColumnValue = MWT_Belt_CalcColumnValue;
this.RefreshProperties();
// Inline methods
this.Check = function()
{
this.CheckPotionPositions();
for(var i = 0; i < this.Columns.length; i++)
{
if(this.ColumnType[i] != "rv" && this.ColumnType[i] != "none" && this.GetPotionCount(i, 1) < MWConfig_BeltTypeColQuantity[this.ColumnType[i]][1])
return true;
}
if(MWConfig_BeltTypeColQuantity["hp"][1] > 0 && this.CheckMaxColumns("hp", 0) || MWConfig_BeltTypeColQuantity["mp"][1] > 0 && this.CheckMaxColumns("mp", 0)) // Either a hp or mp column is completely empty
return true;
return false;
};
}
function MWT_Belt_Slot(pos)
{
this.PotionCode = "none";
this.PotionGID = -1;
this.Position = pos;
}
function MWT_Belt_RefreshProperties()
{
var _potions;
var i, j, k;
this.Columns = new Array(4);
this.ColumnType = new Array(4);
for(i = 0; i < this.Columns.length; i++)
{
this.ColumnType[i] = "none";
this.Columns[i] = new Array(this.SIZE);
for(j = 0; j < this.Columns[i].length; j++)
this.Columns[i][j] = new MWT_Belt_Slot(i + j * 4, i, j);
}
_potions = MWC_GetItems(-1, 2);
if(_potions)
{
for(i = 0; i < _potions.length; i++)
{
for(j = 0; j < this.Columns.length; j++)
{
for(k = 0; k < this.Columns[j].length; k++)
{
if(this.Columns[j][k].Position == _potions[i].x)
{
this.ColumnType[j] = _potions[i].code.substr(0, 2);
this.Columns[j][k].PotionCode = _potions[i].code;
this.Columns[j][k].PotionGID = _potions[i].gid;
j = this.Columns.length;
break;
}
}
}
}
return true;
}
return false;
}
function MWT_Belt_GetPotionCount(col, mode)
{
var _count;
var i, j;
if(col > 3)
return 0;
if(col > -1)
{
_count = this.SIZE;
for(i = 0; i < this.SIZE; i++)
{
if(this.Columns[col][i].PotionGID > -1)
_count--;
}
}
else
{
_count = 4 * this.SIZE;
for(i = 0; i < 4; i++)
{
for(j = 0; j < this.SIZE; j++)
{
if(this.Columns[i][j].PotionGID > -1)
_count--;
}
}
}
if(mode == 0) // Amount of potions required
return _count;
else if(mode == 1) // Amount of potions in column
return this.SIZE - _count;
return 0;
}
function MWT_Belt_GetTargetSlot(type)
{
if(type == "none")
return new coord(-1, -1);
for(var i = 0; i < this.Columns.length; i++)
{
if(this.ColumnType[i] == type)
{
for(var j = 0; j < this.Columns[i].length; j++)
{
if(this.Columns[i][j].PotionGID == -1)
return new coord(i, j);
}
}
}
return new coord(-1, -1);
}
function MWT_Belt_RelocatePotion(colIndex, lineIndex)
{
var _potion, _slot, _retVal;
var i;
_potion = MWC_GetItems(-1, 2, this.Columns[colIndex][lineIndex].PotionGID);
_retVal = false;
if(_potion[0])
{
_slot = this.GetTargetSlot(_potion[0].code.substr(0, 2));
if(_slot.x > -1 && _slot.x != colIndex)
{
SetUIState(0x1F, true);
if(NTC_ItemToCursor(_potion[0]))
{
for(i = 0; i < 80; i++)
{
NTC_Delay(100);
if(i % 40 == 0)
me.ClickItem(0, _slot.x, _slot.y, 5);
if(!me.itemoncursor)
break;
}
if(i < 80)
{
_retVal = true;
NTC_PingDelay(100);
}
}
}
}
if(GetUIState(0x1F))
me.Cancel(1);
return _retVal;
}
function MWT_Belt_CheckPotionPositions()
{
var _types, _val, _minVal, _minIndex;
var i, j, n;
for(i = 0; i < this.Columns.length; i++)
{
for(j = 0; j < this.Columns[i].length; j++)
{
if(this.Columns[i][j].PotionCode != "none" && this.Columns[i][j].PotionCode.substr(0, 2) != this.ColumnType[i])
{
if(!this.RelocatePotion(i, j))
this.ClearSlot(i, j);
this.RefreshProperties();
}
}
}
// Make sure that you aint got more columns of a pot type filled that specified in the char config
_types = ["hp", "mp", "rv"];
for(i = 0; i < _types.length; i++)
{
if(!this.CheckMaxColumns(_types[i], 1)) // True if the number of columns of this type exceeds the one defined in the config
{
_minVal = 1E6;
_minIndex = -1;
for(j = 0; j < this.Columns.length; j++)
{
if(this.ColumnType[j] == _types[i])
{
_val = this.CalcColumnValue(j);
if(_val < _minVal)
{
_minVal = _val;
_minIndex = j;
}
}
}
if(_minIndex > -1)
{
for(j = 0; j < this.SIZE; j++)
{
if(!this.RelocatePotion(_minIndex, 0))
this.ClearSlot(_minIndex, 0);
this.RefreshProperties();
if(this.CheckMaxColumns(_types[i], 1))
break;
}
}
if(!this.CheckMaxColumns(_types[i], 1))
i--;
}
}
if(GetUIState(0x1F))
me.Cancel(1);
return true;
}
function MWT_Belt_CheckMaxColumns(type, offset)
{
if(arguments.length < 2)
offset = 0;
return this.GetColumnCount(type) < MWConfig_BeltTypeColQuantity[type][0] + offset;
}
function MWT_Belt_GetColumnCount(type)
{
var _count;
_count = 0;
for(var i = 0; i < this.ColumnType.length; i++)
{
if(this.ColumnType[i] == type)
_count++;
}
return _count;
}
function MWT_IsPotionRequired(code, simple)
{
var _belt;
var i, j;
if(arguments.length < 1 || typeof code != "string")
return false;
if(arguments.length < 2)
simple = false;
_belt = new MWT_Belt();
if(!_belt)
return false;
for(i = 0; i < _belt.ColumnType.length; i++)
{
if(code.substr(0, 2) == _belt.ColumnType[i] && _belt.GetPotionCount(i, 0) > 0 // Check columns that are not empty first
|| _belt.ColumnType[i] == "none" && _belt.CheckMaxColumns(code.substr(0, 2))) // Check empty columns
return true;
}
if(!simple && MWConfig_ReplaceLowQualityPotions)
{
for(i = 0; i < _belt.Columns.length; i++)
{
// Check if there are any potions of lower quality in our belt that could be drank in order to pick up the higher quality potion
if(code.substr(0, 2) == _belt.ColumnType[i])
{
for(j = 0; j < _belt.Columns[i].length; j++)
{
if(_NTIPAliasClassID[code] > _NTIPAliasClassID[_belt.Columns[i][j].PotionCode] || _belt.Columns[i][j].PotionCode.indexOf(_belt.ColumnType[i]) == -1)
{
if(_belt.ClearSlot(i, j))
return true;
}
}
}
}
}
return false;
}
function MWT_FillBelt(npc)
{
var _belt, _potion, _types;
var i, j;
if(!npc)
return false;
if(!GetUIState(0x0C))
return false;
_belt = new MWT_Belt();
if(!_belt)
return false;
if(!_belt.Check())
return true;
// Buy single potions
if(_belt.CheckMaxColumns("rv")) // Shift buying is generally impossible if there are empty columns that are supposed to contain rejuvenation potions
{
_types = ["hp", "mp"];
for(i = 0; i < _types.length; i++)
{
for(j = 0; j < _belt.Columns.length; j++)
{
if(_belt.ColumnType[j] == _types[i] || _belt.ColumnType[j] == "none" && _belt.CheckMaxColumns(_types[i]))
{
if(MWT_BuyPotion(npc, _types[i], 2, _belt.GetPotionCount(j, 0)))
_belt.RefreshProperties();
}
}
}
return true;
}
else // No rejuv columns empty
{
if(_belt.CheckMaxColumns("hp")) // Check is there is at least one hp column empty
{
if(_belt.CheckMaxColumns("mp"))
MWT_BuyPotion(npc, "hp", 2); // Buy a single hp if at least one mp column is emptry as well
else
MWT_BuyPotion(npc, "hp", 3); // Shift buy if all empty columns are used for hp
}
else if(_belt.CheckMaxColumns("mp")) // Check is there is at least one mp column empty
{
if(_belt.CheckMaxColumns("hp"))
MWT_BuyPotion(npc, "mp", 2); // Buy a single mp if at least one hp column is emptry as well
else
MWT_BuyPotion(npc, "mp", 3); // Shift buy if all empty columns are used for mp
}
else // no columns are empty
{
for(i = 0; i < _belt.Columns.length; i++)
{
if(_belt.GetPotionCount(i, 0) > 0)
{
if(!MWT_BuyPotion(npc, _belt.ColumnType[i], 3))
return false;
}
}
}
}
return MWT_FillBelt(npc);
}
function MWT_BuyPotion(npc, type, mode, amount)
{
var _potion;
if(!npc || type == "rv")
return false;
if(arguments.length < 4 || mode == 3)
amount = 1;
for(var i = 0; i < amount; i++)
{
_potion = NTT_GetPotionAtNPCInt(type, npc);
if(_potion)
{
NTC_PingDelay(100);
if(!NTT_ShopItem(_potion, npc, mode))
break;
}
}
return i >= amount;
}
function MWT_Belt_ClearSlot(colIndex, lineIndex)
{
var _potion;
var i;
if(arguments.length < 2)
return false;
if(lineIndex == 0)
return me.UseBelt(colIndex) && NTC_Delay(100);
else
{
SetUIState(0x1F, true);
for(i = 0; i <= 40; i++)
{
_potion = MWC_GetItems(-1, 2, this.Columns[colIndex][lineIndex].PotionGID);
if(_potion[0])
{
if(i % 10 == 0)
me.ClickItem(1, _potion[0]);
NTC_Delay(100);
}
else
break;
}
me.Cancel(1);
if(i < 40)
return true;
}
return false;
}
function MWT_Belt_CalcColumnValue(col)
{
var _val;
_val = 0;
for(var i = 0; i < this.Columns[col].length; i++)
{
if(this.Columns[col][i].PotionCode != "none")
_val += _NTIPAliasClassID[this.Columns[col][i].PotionCode];
}
return _val;
}
[/noparse]
LG
Muddy
|
|
|
05/06/2011, 13:59
|
#1736
|
elite*gold: 0
Join Date: Sep 2009
Posts: 148
Received Thanks: 21
|
Dein Spoilercode is zwar bissle broken  Aber habs überschrieben^^
Is das schon die erweiterte Version?
|
|
|
05/06/2011, 15:27
|
#1737
|
elite*gold: 0
Join Date: Nov 2010
Posts: 17
Received Thanks: 1
|
Leechbot
So also ich hab mich hier mal durchgelesen, besonders seite 161 weil ich gerne mit muddys super bot, auch ein leacher betreiben möchte nur irgent wie bekomme ich es nicht gebacken könnte mir mal jemand die geänderte ntbot geben und was mann sonst noch braucht.
Und erstmal ein DICKES danke an alle die an diesen bot so hart arbeiten
Mfg
Andre
|
|
|
05/06/2011, 16:43
|
#1738
|
elite*gold: 0
Join Date: May 2010
Posts: 4
Received Thanks: 0
|
bekomm static nicht zum laufen
Hab nochmal neu runtergeladen und entpackt.
Backup der alten NTAttack.ntl gemacht und mit der neuen ersetzt.
Script eingestellt und gewartet.
Sorce portet zu meppel und ... Lightning Attacke... kein Static
Also vom ablauf soweit alles gut nur mit Static wärs mir etwas lieber.
Bin auch etwas verwundert das die neue NTAttack.ntl nur 75kb belegt. Die alte schlägt mit 148kb zu buche.
Static funzt bei Sternenlooper problemlos.
Die Bosse sind da direkt verpflanzt wie ich seh.
Find dein script aber besser. Schon wegen dem Waypoint Catcher
|
|
|
05/06/2011, 17:19
|
#1739
|
elite*gold: 0
Join Date: Mar 2009
Posts: 382
Received Thanks: 45
|
Quote:
Originally Posted by Muddy_Waters
Das bezieht sich auf meine Version mit dem aktuellsten Update?
Wenn ja, bitte eine möglichst präzise Fehlermeldung.
Wenn nein, bist du hier falsch.
lg
Muddy
|
ich glaube er meint diesen fehler (habe ihn auch ab und an)
hab beim durchforsten des threads aber auch nix weiter gefunden außer es über die runtime zu "beheben" ein richtiges fix scheints wohl dazu noch net zu geben?
tritt bei mir glaube immer dann auf wenn er ein item grabben will aber ein zweiter (eventuell bot?) ihm zuvor kam und er es dadurch net picken kann
|
|
|
05/06/2011, 17:31
|
#1740
|
elite*gold: 0
Join Date: Mar 2010
Posts: 87
Received Thanks: 1
|
danke nochmal an dich muddy, läuft jetzt, aus irgendnem grund kopiert sich der temporary data ordner bei mir nich mit in den logs ordner  wahrscheinlich weil keine datei drinnen is
die restarts bleiben bestehen, habe jetzt nen location loop fehler dens mir im manager profil anzeigt, hatte gerade den bot neu entpackt usw
|
|
|
 |
|
Similar Threads
|
[Release] D2NT 3.1 1.13c
07/17/2016 - Diablo 2 - 91 Replies
hi,
hab eben den d2nt3.1 gefunden. ein neues baba script is dabei.
release thread eon
D2NT3.1
|
[Realease] Muddy's Waypoint Catcher
08/21/2013 - Diablo 2 Programming - 46 Replies
Moin zusammen,
hier mal die erste Release Version eines kleinen Scripts genannt Waypoint Catcher. Das ganze ist jetzt nichtmal 24h alt, dementsprechend sind vermutlich noch einige Bugs vorhanden. Hinweise dazu nehme ich gerne entgegen. ;)
Features:
- Suchen sämtlicher Wegpunkte mit Ausnahme, wobei in Akt ein durch Probleme im Jail Bereich nach dem Wegpunkt Outer Cloister abgebrochen wird
- Wahlweise auch mit TP an jedem gefundenen Wp, sodass man damit auch anderen (nicht-Bots) die...
|
[D2NT] Long Dia Release
05/10/2011 - Diablo 2 Programming - 28 Replies
Ein kleines Script für diablo, es startet beim eingang macht ein tp cleart den weg zum star macht am star noch ein tp dann läufts wie das normale nur cleart es schöner :)
hoffe euch gefällts ich habs noch nicht wirklich getestet (2-3 runs) bugs können gerne hier gepostet werden verbesserungs vorschläge auch :D
installation:
1.)Script in den Bot ordner kopieren
2.)Script im editor oder vergleichbaren öffnen
3.) Msg´s anpassen (ist nicht schwer)
4.) in der char config die zeile...
|
D2NT 3.0 Pickit release
10/22/2010 - Diablo 2 - 77 Replies
edit
|
Muddy's D2NT Help
07/29/2010 - Diablo 2 - 3 Replies
hi i just started to use the bot it work's great.
how do i set up the skill's i use on my Sorc and pick up itme's?
.....
if you reply to this post please use english
|
All times are GMT +1. The time now is 12:00.
|
|