⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mbm_include.d2l

📁 转载其他网站的资料与大家分享
💻 D2L
📖 第 1 页 / 共 2 页
字号:
					if (merc.hp > 0)
					{
						mercname = merc.name;
						needrevive = false;
						return 0;
					}
				}
			}
		}
		while(merc.getNext());
		if (needrevive)
		{
			goldamount = mbm_MyGold();
			if (goldamount < MercCost)
			{
				UseMerc = false;
				needrevive = false;
				return 2;
			}
		}
		return 1;
	}
	
	return -1;
	
}

// Gold Stashing Taken from PwnageInclude.d2l
function mbm_StashGoldFull()
{
	var maxGold;
	var level = me.getStat(c_UnitStat_Level);

	if (level < 30)
		maxGold = Math.floor((level + 10) / 10) * 50000;
	else
		maxGold = 800000 + Math.floor((level - 30) / 2) * 50000;

	return (maxGold == me.getStat(c_UnitStat_GoldBank));
}

// Check for maxed gold
function mbm_MaxedGold()
{
	return mbm_StashGoldFull() && mbm_InvGoldFull();
}

function mbm_MyGold()
{
	return me.getStat(c_UnitStat_Gold) + me.getStat(c_UnitStat_GoldBank);
}

function mbm_InvGoldFull()
{
	return me.getStat(c_UnitStat_Gold) == mbm_MyMaxGold();
}

function mbm_MyMaxGold()
{
	return (me.getStat(c_UnitStat_Level) * 10000);
}

function mbm_StashGold()
{
	if (mbm_StashGoldFull())
		return;
	
	if(me.getStat(c_UnitStat_Gold) != 0)
	{
		var CurGold = mbm_MyGold();
		gold(me.getStat(c_UnitStat_Gold), 3);
		for(var i=0; i<20; i++)
		{
			if(me.getStat(c_UnitStat_Gold) != CurGold)
				break;
			DoDel(20);
		}
	}

}

function drinkall(itemcode,itemlocation,itemname)
{
	ii = 0;
	bi = 0;
	if (itemlocation == 0) itemlocation = 100;
	if (itemlocation != 100 && itemlocation != 2 && itemlocation != -1) return;
	if (itemlocation == 100 || itemlocation == -1)
	{
		potion = locateitem(me,itemcode,100);
		if (potion)
		{
			haspotion = true;
			while (haspotion)
			{
				ii++;
				clickItem(1, potion);
				delay(250);
				potion = locateitem(me,itemcode,100);
				if (!potion) haspotion = false;
			}	
		}
	}
	if (itemlocation == 2 || itemlocation == -1)
	{
		potion = locateitem(me,itemcode,2);
		if (potion)
		{
			haspotion = true;
			while (haspotion)
			{
				bi++;
				clickItem(1, potion);
				delay(250);
				potion = locateitem(me,itemcode,2);
				if (!potion) haspotion = false;
			}	
		}
	}
	
	if (ii == 1) print("Drank a " + itemname + " from inventory");
	if (ii > 1) print("Drank " + ii + " " + itemname + "s from inventory");
	if (bi == 1) print("Drank a " + itemname + " from belt");
	if (bi > 1) print("Drank " + bi + " " + itemname + "s from belt");
}

function dropall(itemcode,itemlocation,itemname)
{
	ii = 0;
	bi = 0;
	if (itemlocation == 0) itemlocation = 100;
	if (itemlocation != 100 && itemlocation != 2 && itemlocation != -1) return;
	if (itemlocation == 100 || itemlocation == -1)
	{
		locitem = locateitem(me,itemcode,100);
		if (locitem)
		{
			hasitem = true;
			while (hasitem)
			{
				ii++;
				clickItem(0, locitem);
				numtries = 0;
				delay(50);
				while(!me.itemoncursor) 
				{
					delay(50);
					numtries++;
					if (numtries > 50) { bug("dropall1"); break; }
				}
				locitem.cancel();
				numtries = 0;
				delay(50);
				while(me.itemoncursor)
				{
					delay(50);
					numtries++;
					if (numtries > 50) { bug("dropall2"); break; }
				}
				locitem = locateitem(me,itemcode,100);
				if (!locitem) hasitem = false;
				delay(300);
			}
		}
	}

	if (itemlocation == 2 || itemlocation == -1)
	{
		locitem = locateitem(me,itemcode,2);
		if (locitem)
		{
			hasitem = true;
			while (hasitem)
			{
				ii++;
				clickItem(0, locitem);
				numtries = 0;
				while(!me.itemoncursor) 
				{
					delay(200);
					numtries += 1;
					if (numtries > retries) { bug("dropall3"); break; }
				}
				delay(200);
				locitem.cancel();
				numtries = 0;
				while(me.itemoncursor)
				{
					delay(200);
					numtries += 1;
					if (locitem) locitem.cancel();
					if (numtries > retries) { bug("dropall4"); break; }
				}
				locitem = locateitem(me,itemcode,2);
				if (!locitem) hasitem = false;
			}
		}
	}
		
	clearcursor();

	if (ii == 1) print("Dropped a " + itemname + " from inventory");
	if (ii > 1) print("Dropped " + ii + " " + itemname + "s from inventory");
	if (bi == 1) print("Dropped a " + itemname + " from belt");
	if (bi > 1) print("Dropped " + bi + " " + itemname + "s from belt");

	if (ii > 0 || bi > 0) return true;
	else return false;
}

function mbm_Pickup(pickitem)
{
	var attemptnum, gotIt;
	var tries = 3;
	var limit = 70;

	clearcursor();
	
	for (var i = 0; i < tries; i++) {
		if((pickitem.mode==c_UnitMode_Item_OnGround || pickitem.mode == c_UnitMode_Item_BeingDropped) && !(pickitem.getParent())) {
			while (pickitem.mode == c_UnitMode_Item_BeingDropped) { delay(10); }
			pickitem.interact();
			attemptnum = 0;
			while (pickitem.mode == c_UnitMode_Item_OnGround && attemptnum++ < limit) { delay(10); }
			if(pickitem.mode == c_UnitMode_Item_OnCursor || pickitem.mode == c_UnitMode_Item_BeingDropped) {
//				missReason = "full";
				clearcursor();
				break;
			}
			else if(pickitem.mode==c_UnitMode_Item_OnGround) {
				clearcursor();
			}
			else { break; }
		}
	}
	if (pickitem.mode == c_UnitMode_Item_OnGround || pickitem.mode == c_UnitMode_Item_OnCursor || pickitem.mode == c_UnitMode_Item_BeingDropped) {
		mbm_print("Failed to pick up a " + pickitem.name);
		return false;
	}
	else {
		mbm_print("Picked up a " + pickitem.name);
		return true;
	}
}

// Checks if an item is in the inventory
function mbm_IsInvItem(theitem)
{
	return (theitem.getParent() && theitem.getParent().name == me.name && theitem.itemloc == 0 && theitem.mode == 0);
}


function pickupall(itemcode,itemname,range)
{
	ii = 0;
	locitem = locaterangeditem(itemcode,range);
	if (locitem)
	{
		itemexists = true;
		while (itemexists)
		{
			ii++;
			if (!mbm_Pickup(locitem)) {
				bug("failed to pickup a " + itemcode);
				ii--;
			}
			locitem = locaterangeditem(itemcode,range);
			if (!locitem) itemexists = false;
		}
	}

	if (ii > 1) print("Picked up " + ii + " " + itemname + "s");
	if (ii == 1)  print("Picked up a " + itemname);
	clearcursor();
}

function locateitem(who, code, where)
{
//	print("locating " + code + " in " + who);
	
	start = getUnit(4);
	if (start) do
	{
		if (code == start.code || code == "" || code == null)
		{
			if (where == -1 || start.mode == where || (start.mode == 0 && (where >= 100 && where <= 104))
				|| (start.mode == 1 && (where >= 201 && where <= 210)))
			{
				if (who != "" && who != null)
				{
					if (start.mode < 3)
					{ 
						owner = start.getParent();  // Grab owner
						if (owner)
						{
							if (owner.name == who.name) return start;  // Match
						}
					}
				}
				else return start;
			}
		}
	}
	while (start.getNext(code,where));
}

function locaterangeditem(code, maxdist)
{
	start = getUnit(4, code, 3);
	if (start) do
	{
		if (code == start.code || code == "" || code == null)
		{
			if (calcrange(start.x,start.y) <= maxdist)
			{
				return start;
			}
		}
	}
	while (start.getNext(code,3));
}

function countitem(code, where)
{
	count = 0;
	start = getUnit(4, code, where);
	if (start) do
	{
		count++;
	}
	while (start.getNext(code,where));
	
	return count;
}

function mbm_MyMaxMana()
{
	return parseInt((me.mpmax) + (me.mpmax * (me.getStat(c_UnitStat_ItemMaxManaPercent) / 100)));
}

function mbm_MyFCR()
{
	return me.getStat(c_UnitStat_ItemFasterCastRate);
}

function mbm_MyMana()
{
	var pct = Math.floor((me.mp / mbm_MyMaxMana()) * 100);
	if (pct > 100) pct = 100;
	if (isNaN(pct) || pct < 0 || pct > 100 || pct == null) { 
		bug("mana bug: mpmax: " + me.mpmax + " me.mp: " + me.mp + " mymaxmana: " + mbm_MyMaxMana() + " pct: " + pct + " stat 77: " + me.getStat(77)); 
		delay(100);
		return 50; 
	}
	return pct;
}

function calchealthmana()
{
	mymaxlife = parseInt((me.hpmax) + (me.hpmax * (me.getStat(76) / 100)));
	mymaxmana = parseInt((me.mpmax) + (me.mpmax * (me.getStat(77) / 100)));

	lifethreshold = parseInt((mymaxlife * skipheallife) / 100);
	manathreshold = parseInt((mymaxmana * skiphealmana) / 100);

//	mypotionlife = parseInt((mymaxlife * potionlife) / 100);
//	mypotionmana = parseInt((mymaxmana * potionmana) / 100);

	mbm_print("Current Health is " + me.hp);
	mbm_print("Maximum Health is " + mymaxlife);
	mbm_print("Heal health threshold is " + lifethreshold);
	mbm_print("Current Mana is " + me.mp);
	mbm_print("Maximum Mana is " + mymaxmana);
	mbm_print("Heal mana threshold is " + manathreshold);
///	mbm_print("My fast cast rate is " + mbm_MyFCR());
}

function targetlife()
{
	return Math.round(target.hp / 1.28);
}

function targetdist()
{
	return calcdistance(me.x, me.y, target.x, target.y);
}

//function mbm_LifeOverhead(who)
//{
//	if (who.hp > 0) me.overhead(who.name + " Life: " + Math.round(who.hp / 1.28) + " %");
//	else me.overhead(who.name + " Killed");
//}

function mbm_TriBar(message, curval, maxval) 
{
	barlen = 12;
	precent = curval / maxval;
	if (precent > 0.66) 
		colour = "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -