package MarcGuiPackage {
	function centerPrint(%cl, %msg, %delay) {
		if(!isObject(%cl)) { Parent::centerPrint(%cl, %msg, %delay); return; }
		if(isObject(%p = %cl.player) && %p.getState() !$= "Dead" && !isEventPending(%cl.loopmarcgui)) if(%cl.marcGuiDisabled) return;
		Parent::centerPrint(%cl, %msg, %delay);
	}
	function bottomPrint(%cl, %msg, %delay) {
		if(!isObject(%cl)) { Parent::bottomPrint(%cl, %msg, %delay); return; }
		if(isObject(%p = %cl.player) && %p.getState() !$= "Dead" && !isEventPending(%cl.loopmarcgui)) if(%cl.marcGuiDisabled) return;
		Parent::bottomPrint(%cl, %msg, %delay);
	}
};
activatePackage(MarcGuiPackage);
function serverCmdToggleMarcGui(%this) {
	%this.marcGuiDisabled = (%this.marcGuiDisabled ? 0 : 1);
	messageClient(%this, '', "\c6The MARC GUI is now " @ (%this.marcGuiDisabled ? "\c0Disabled" : "\c2Enabled") @ "\c6.");
}
function Player::loopMarcGui(%obj) {
	if(isEventPending(%obj.client.loopmarcgui)) return;
	if(!isObject(%this = %obj.targeting_obj)) %this = testobj;
	
	if(%obj.energyDrinkAmt > 0) {
		%obj.energyDrinkWearoff = 0;
		%obj.energyDrinkAmt -= 4;
	}
	if(%obj.energyDrinkAmt > 0) %hasDrinkHigh = 1;
	
	if(%obj.inStomach) {
		%vignette   = (%obj.getDamageLevel()/%obj.dataBlock.maxDamage)*1;
		%maxStamina = (%hasDrinkHigh ? 100 : 100 - mFloor((%obj.getDamageLevel() / %obj.dataBlock.maxDamage) * 40));
		%stRecharge = (%hasDrinkHigh ? 1 : 4 + mFloor((%obj.getDamageLevel() / %obj.dataBlock.maxDamage) * 4));
		//commandToClient(%obj.client,'setVignette',"0","0 0 0" SPC %vignette);
		%obj.stomach_recharge++;
		if(%obj.stomach_recharge / %stRecharge >= 1) {
			%obj.stomach_stamina += (%hasDrinkHigh ? getRandom(2, 3) : getRandom(1, 2));
			%obj.stomach_stamina  = mClamp(%obj.stomach_stamina, 0, %maxStamina);
			%obj.stomach_recharge = 1;
		}
		
		if(getSimTime()-%obj.stomach_msgTime >= 5000) {
			%obj.stomach_message = "";
		}
		%hp  = 100-mFloor((%obj.getDamageLevel()/%obj.dataBlock.maxDamage)*100) @ "%";
		if(%hp <= 50) {
			if(%obj.stomach_blink++ >= 20) {
				%obj.stomach_blink = 0;
			} else if(%obj.stomach_blink >= 10) {
				%hp = "";
			}
		}
		%wsp = "                           ";
		if(%obj.heldBy.digestionAmt >= 400) { %c = "\c0";      %stm = "Undulating"; }
		else if(%obj.heldBy.digestionAmt >= 300) { %c = "\c0"; %stm = "Stage 3 Digestion"; }
		else if(%obj.heldBy.digestionAmt >= 200) { %c = "\c0"; %stm = "Stage 2 Digestion";    }
		else if(%obj.heldBy.digestionAmt >= 100) { %c = "\c0"; %stm = "Stage 1 Digestion";    }
		else if(%obj.heldBy.digestionAmt >= 50)  { %c = "\c3"; %stm = "Preparing For Digestion"; }
		else { %c = "\c2"; %stm = "None"; }
		if(%obj.heldBy.energyDrinkAmt > 0) %c = "\c1";
		%stm = %c @ getSubStr(%stm @ %wsp, 0, strLen(%wsp));
		%hp  = getSubStr(%hp @ "    ", 0, 4);
		%tbl = "|||||||||||||||||||||||||||";
		if(%obj.stomach_stamina <= 0) %obj.stomach_stamina = 1;
		if(%obj.stomach_struggle <= 0) %obj.stomach_struggle = 1;
		%stmch_percent = mFloor((%obj.stomach_struggle/$CACHE::Marc::StomachStruggle::Max)*strLen(%tbl));
		%badSt_percent = strLen(%tbl) - mFloor((%maxStamina / 100) * strLen(%tbl));
		%stamn_percent = mFloor((mClamp(%obj.stomach_stamina, 0, %maxStamina)/%maxStamina) * (strLen(%tbl) - %badSt_percent));
		%displ_0 = "\c6STRUGGLE POINTS   \c0" @ getSubStr(%tbl,0,%stmch_percent) @ "\c6" @ getSubStr(%tbl, %stmch_percent, strLen(%tbl)) @ "\n";
		%displ_1 = "\c6STAMINA           " @ (%hasDrinkHigh ? "\c1" : "\c0") @ getSubStr(%tbl,0,%stamn_percent) @ "\c6" @ getSubStr(%tbl, %stamn_percent, strLen(%tbl) - %badSt_percent - %stamn_percent) @ "\c7" @ getSubStr(%tbl, 0, %badSt_percent) @ "\n";
		%displ_2 = "\c6HEALTH            \c0" @ %hp @ "                       \n";
		%displ_3 = "\c6STOMACH ACTIVITY  \c0" @ %stm @ "\n";
		%displ_4 = (%obj.stomach_message $= "" ? "" : "<br><br>" @ %obj.stomach_message);
		centerPrint(%obj.client,"<font:Consolas:14>" @ %displ_0 @ %displ_1 @ %displ_2 @ %displ_3, 1);
		if(%displ_4 $= "") clearBottomPrint(%obj.client);
		else bottomPrint(%obj.client, "<just:center><font:Consolas:14>" @ %displ_4, 2);
		if(%obj.heldBy.isNotVorist) {
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
			return;
		}
	} else { if(isEventPending(%obj.digestLoop)) cancel(%obj.digestLoop); }
	if((%obj.inMouth || %obj.inStomach) && isObject(%obj.heldBy) && %obj.heldBy.dataBlock.mouth && %obj.getState() !$= "Dead") {
		if(!$Stomach::use) {
			if(!%obj.isFirstPerson()) {
				if(%obj.view_type == 0) { %obj.view_type = 1; %obj.heldBy.mountObject(%obj, 2); }
			} else {
				if(%obj.view_type == 1) { %obj.view_type = 0; %obj.heldBy.mountObject(%obj, (%obj.inStomach ? 8 : 5)); %obj.heldBy.unhideNode("stomach"); }
			}
		}
	} else %obj.view_type = "0";
	if(isObject(%obj.heldBy) && %obj.heldBy.getClassName() $= "Player") {
		if(%obj.inStomach) {
			%obj.heldBy = "";
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
			return;
		}
		%tbl = "|||||||||||||||||||||||||||||||||||||||||||||||||||||||||";
		%mouth_percent = mFloor((%obj.strugglePoints/150)*strLen(%tbl));
		centerPrint(%obj.client,"<br><br><br><just:center><font:Consolas:14><color:ffffff>STRUGGLE POINTS <color:ff0000>"@getSubStr(%tbl,0,%mouth_percent) @ "<color:ffffff>" @ getSubStr(%tbl, %mouth_percent, strLen(%tbl)), 1);
		if(getSimTime()-%obj.lastStruggleExpire >= 100) {
			%obj.lastStruggleExpire = getSimTime();
			%obj.strugglePoints -= 2;
		}
		if(%obj.strugglePoints < 0) %obj.strugglePoints = 0;
		cancel(%obj.client.loopmarcgui);
		%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
		return;
	}
	if(%this.holding == %obj && !%this.isNotVorist && %this.trustsObj(%obj)) {
		if(getRandom(0, 5000) < 5) {
			%this.makeStomachSound(1);
		}
	}
	if(%this.holding == %obj && (!%this.isNotVorist && !%this.trustsObj(%obj))) {
		cancel(%obj.client.loopmarcgui);
		%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
		return;
	}
	if(%obj.hudBroken) {
		if(%obj.bleedOutLoop++ >= 90) {
			%obj.applyDamage(getRandom(0,5));
			%obj.bleedOutLoop = -1;
			%obj.marcAnn      = "You're bleeding out!";
		}
	}
	if(%obj.updateGuiLoop++ >= 5) {
		%obj.updateGuiLoop = -1;
		%vignette = (%obj.getDamageLevel()/%obj.dataBlock.maxDamage)*1;
		commandToClient(%obj.client,'setVignette',"0","1 0 0" SPC %vignette);
	}
	if((%this.isNotVorist && %this.targ_obj != %obj) || (!%this.isNotVorist && !%this.trustsObj(%obj))) %this = testobj;
	if(isObject(%this)) {
		if(isObject(%obj.heldBy)) if(!%obj.heldBy.isNotVorist) %this = testobj;
		if(%obj.hudBars $= "") %obj.hudBars = "||||||||||||||||||||||||||||";
		%bars = %obj.hudBars;
		if(getWord(%obj.getPosition(),2) < $EnvGui::WaterHeight) {
			%ann = "<color:ff0000>GASTRIC ACID DETECTED, VACATE AREA IMMEDIATELY";
		}
		if(%obj.searchBar) {
			if(!%obj.wasAlreadyDoingSearchBar) {
				%obj.wasAlreadyDoingSearchBar = 1;
				%obj.initialSearchBar = %obj.searchBar;
			}
			%obj.searchBar--;
			if(%obj.searchBar <= strLen(%bars)) {
				if(%obj.searchBar == strLen(%bars)) findFirstFile("add-ons/*.*");
				%thing = getSubStr(%bars,0,%obj.searchBar)@"<color:00FF00>|"@getSubStr(%bars,%obj.searchBar+1,strLen(%bars));
				%msg = "START" SPC strUpr(findNextFile("add-ons/*.*"));
				if(%obj.searchBar == 0) {
					%msg = "<color:00ff00>OK!";
					if(%obj.hudBattery <= 20) %msg = "<color:FFFF00>OK! (LOW BATTERY)";
					if(%obj.hudBattery <= 10) %msg = "<color:FF0000>OK! (CRITICAL BATTERY)";
					centerPrint(%obj.client,"<font:Consolas:16><color:ffffff>SAFETY <color:004400>"@%thing@" <color:ffffff>VULNERABLE <br>"@%msg@"<br>",1);
					cancel(%obj.client.loopmarcgui);
					%obj.client.loopmarcgui = %obj.schedule(1000,loopMarcGui);
					return;
				}
			} else {
				%obj.searchBar_pos = (%obj.searchBar_increase ? %obj.searchBar_pos+1 : %obj.searchBar_pos-1);
				if(%obj.searchBar_increase && %obj.searchBar_pos >= strLen(%bars)-1) {
					%obj.searchBar_pos = strLen(%bars)-1;
					%obj.searchBar_increase = 0;
				}
				if(!%obj.searchBar_increase && %obj.searchBar_pos <= 0) {
					%obj.searchBar_pos = 0;
					%obj.searchBar_increase = 1;
				}
				if(%obj.searchBar_pos == strLen(%bars)-1) {
					%thing = getSubStr(%bars,0,%obj.searchBar_pos-1)@"<color:008800>|<color:00FF00>|<color:004400>";
				} else if(%obj.searchBar_pos <= 0) {
					%thing = getSubStr(%bars,0,%obj.searchBar_pos)@"<color:00FF00>|<color:008800>|<color:004400>"@getSubStr(%bars,%obj.searchBar_pos+2,strLen(%bars));
				} else {
					%thing = getSubStr(%bars,0,%obj.searchBar_pos-1)@"<color:008800>|<color:00FF00>|<color:008800>|<color:004400>"@getSubStr(%bars,%obj.searchBar_pos+2,strLen(%bars));
	//				%thing = getSubStr(%bars,0,%obj.searchBar_pos)@"<color:00FF00>|<color:ff0000>"@getSubStr(%bars,%obj.searchBar_pos+1,strLen(%bars));
				}
				%msg = "RE-INITIALIZING... ("@100-mFloor(mAbs(((%obj.searchBar-strLen(%bars))/(%obj.initialSearchBar-strLen(%bars)))*100))@"%)";
			}
			centerPrint(%obj.client,"<font:Consolas:16><color:ffffff>SAFETY <color:004400>"@%thing@" <color:ffffff>VULNERABLE <br><color:ffff00>"@%MSG@"<br>",1);
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule((%obj.searchBar <= strLen(%bars) ? "30" : "60"),loopMarcGui);
			return;
		} else
			%obj.wasAlreadyDoingSearchBar = 0;

		%dist     = vectorDist(%this.getPosition(),%obj.getPosition());
		%percent  = mClamp(mFloor((%dist/(5*getWord(%this.getScale(),2)))*strLen(%bars)),0,strLen(%bars));
		%vpercent = mClamp(mFloor((%dist/(7*getWord(%this.getScale(),2)))*strLen(%bars)),0,strLen(%bars));
		if(%obj.hudBroken) {
			%percent  = getRandom(0,strLen(%bars));
			%vpercent = getRandom(0,strLen(%bars));
		}
		%line  = getSubStr(%bars,0,%percent)@"<color:"@(%this.dontFollow ? "cccc00" : "00cc00")@">"@getSubStr(%bars,%percent,strLen(%bars));
		%thing = %line @ " <color:ffffff>VULNERABLE ";
		if(%obj.inMouth && (%obj.heldBy.isNotVorist || %obj.heldBy.trustsObj(%obj))) {
			if(%obj.hudBroken) {
				if(%obj.hudBars !$= "||||||||||||||||||||||||||||") {
					if(%obj.fixBatteryLoop++ >= 20) {
						%obj.fixBatteryLoop = -1;
						for(%i=1;%i<strLen(%obj.hudBars);%i++) {
							if(getSubStr(%obj.hudBars,%i-1,1) $= "|") continue;
							%obj.hudBars = getSubStr(%obj.hudBars,0,%i-1)@"|"@getSubStr(%obj.hudBars,%i,strLen(%obj.hudBars));
							break;
						}
					}
				} else {
					%obj.hudBroken = 0;
				}
			} else {
				if(%obj.chargeBatteryLoop++ >= 10) {
					%obj.chargeBatteryLoop = -1;
					%obj.hudBattery += 2;
					%obj.addHealth(2);
				}
			}
			if(%obj.swallowDangerLoop++ >= getMaxSwallowLimit()) {
				%obj.swallowDangerLoop = -15001;
				serverCmdSwallow(%obj.heldBy);
				%obj.client.setControlObject(%obj);
			}
			if(%obj.swallowDangerLoop == mFloor(getMaxSwallowLimit()/1.2)) {
				%caughtMsg = "I can't hold out much longer...	It's getting really difficult to restrain myself.";
				%randomMsg = getField(%caughtMsg,getRandom(0,getFieldCount(%caughtMsg)-1));
				doSubTitleText(%obj.heldBy,"\c3"@%obj.heldBy.firstName@"\c6: "@%randomMsg);
			}
			%percent = mFloor(mAbs(%obj.swallowDangerLoop/getMaxSwallowLimit())*strLen(%bars));
			%line = getSubStr(%bars,0,%percent)@"<color:"@(%this.dontFollow ? "cccc00" : "00cc00")@">"@getSubStr(%bars,%percent,strLen(%bars));
			%thing = %line @ " <color:ffffff>STOMACH    ";
			%label = "<color:ffff00>POTENTIAL VICTIM TO ACCIDENTAL SWALLOW";
		} else
			%obj.swallowDangerLoop = mClamp(%obj.swallowDangerLoop-3,0,getMaxSwallowLimit());

		if(isObject(%obj.heldBy) && (!%obj.heldBy.isNotVorist && !%obj.heldBy.trustsObj(%obj))) {
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
			return;
		}
		if(%obj.barOff) {
			if(!%obj.hudBroken) {
				if(%obj.getMaxSideSpeed() != %obj.defaultSideSpeed) %obj.setMaxSideSpeed(%obj.defaultSideSpeed);
				if(%obj.getMaxBackwardSpeed() != %obj.defaultBackwardSpeed) %obj.setMaxBackwardSpeed(%obj.defaultBackwardSpeed);
				if(%obj.getMaxForwardSpeed() != %obj.defaultForwardSpeed) %obj.setMaxForwardSpeed(%obj.defaultForwardSpeed);
			} else {
				if(%obj.getMaxSideSpeed() != %obj.defaultSideSpeed-2) %obj.setMaxSideSpeed(%obj.defaultSideSpeed-2);
				if(%obj.getMaxBackwardSpeed() != %obj.defaultBackwardSpeed-2) %obj.setMaxBackwardSpeed(%obj.defaultBackwardSpeed-2);
				if(%obj.getMaxForwardSpeed() != %obj.defaultForwardSpeed-2) %obj.setMaxForwardSpeed(%obj.defaultForwardSpeed-2);
			}
			centerPrint(%obj.client,"<font:Consolas:16><color:ffffff>SAFETY <color:000000>"@%bars@" <color:ffffff>VULNERABLE <br><color:333333>SYSTEM OFFLINE<br>",1);
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
			return;
		}
		if(%obj.hudBroken) {
			if(getRandom(0,1000) <= 300) %obj.hudBattery = getRandom(3,50);
			%obj.loopBlinkThingOther = getRandom(0,9);
			%obj.loopBlinkThing = getRandom(0,4);
		}
		%obj.hudBatteryLoop -= (1+(mAbs(%obj.defaultBackwardSpeed-%obj.getMaxBackwardSpeed())/2));
		if(%obj.hudBatteryLoop <= 0) {
			%obj.hudBatteryLoop = 200;
			%obj.hudBattery -= 1;
			if(%obj.hudBattery <= 0) {
				%obj.barOff = 1;
				%obj.hudBattery = 0;
				cancel(%obj.client.loopmarcgui);
				%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
				return;
			}
		}
		if(%obj.marcAnn !$= "") {
			if(%obj.marcAnnThing++ >= 3) {
				%obj.marcAnnThing = -1;
				%obj.marcAnn = "";
			} else {
				%ann = "<color:ff0000>"@%obj.marcAnn;
			}
		} else {
			if(%obj.hudBroken) {
				%randomLabelTbl = "<font:Consolas Italic:16><color:ffff00>USE EXTREME CAUTION	<color:888888>EXTREMELY UNSAFE	<color:ff8888>WARNING	<color:888888>CAUTION	<color:ff0000>DANGER	<color:ffff00>USE CAUTION	<color:ff0000>EXTREME DANGER	<color:ffff00>USE EXTREME CAUTION";
				%label          = getField(%randomLabelTbl,getRandom(0,getFieldCount(%randomLabelTbl)-1));
			}
		}
		if(!%obj.notarget && %percent == strLen(%bars)) {
			if(%vpercent == strLen(%bars) && %obj.loopBlinkThing++ >= 5) {
				if(%obj.loopBlinkThingOther++ >= 10) %obj.loopBlinkThingOther = 0;
				%obj.loopBlinkThing = -1;
				%obj.loopBlinkThingBool = (%obj.loopBlinkThingBool ? "0" : "1");
				if(%label $= "") %label = "<color:888888>EXTREMELY UNSAFE";
				if(isObject(%cbot = %obj.findClosestBot())) {
					if(!%obj.hudBroken && !%cbot.isNotVorist) {
						%dist = vectorDist(%obj.getPosition(),%cbot.getPosition());
						if(%dist >= (6*getWord(%cbot.getScale(),2))) {
							if(%cbot.targ_obj == %obj) {
								if(%cbot.lastCheck_CanSeeObject) {
									%label = "<color:ff8888>WARNING";
								} else {
									%label = "<color:888888>CAUTION";
								}
							}

						}
						if(%dist <= (6*getWord(%cbot.getScale(),2))) {
							if(%cbot.lastCheck_CanSeeObject) {
								%label = "<color:ff0000>DANGER";
							} else {
								%label = "<color:ffff00>USE CAUTION";
							}
							if(%cbot.sizeDiff(%obj) !$= "smaller")
								%label = "<color:ff8888>NON-HOSTILE ENTITY NEARBY";
						}
						if(%dist <= (5*getWord(%cbot.getScale(),2))) {
							if(%cbot.lastCheck_CanSeeObject) {
								%label = "<color:ff0000>EXTREME DANGER";
							} else {
								%label = "<color:ffff00>USE EXTREME CAUTION";
							}
							if(%cbot.sizeDiff(%obj) !$= "smaller")
								%label = "<color:ff8888>NON-HOSTILE ENTITY NEARBY";
						}
						if(%dist <= (4*getWord(%cbot.getScale(),2))) {
							if(%cbot.lastCheck_CanSeeObject) {
								%label = "<font:Consolas Bold:16><color:ff0000>DEATH IMMINENT";
							} else {
								%randomHex = getHex(getRandom(100,255));
								%label = "<color:"@%randomhex@%randomHex@"00><font:Consolas Italic:16> USE EXTREME CAUTION";
							}
							if(%cbot.sizeDiff(%obj) !$= "smaller")
								%label = "<color:ff8888>NON-HOSTILE ENTITY NEARBY";
						}
					}
				}
				if(%obj.loopBlinkThingBool)
					centerPrint(%obj.client,"<font:Consolas:16><br>" @ (%hasDrinkHigh ? "\c1" : "\c0") @ %label@%bp@"<br>"@%ann,1);
				else
					centerPrint(%obj.client,"<font:Consolas:16><color:ffffff>SAFETY " @ (%hasDrinkHigh ? "\c1" : "\c0") @%thing@"<br>"@%label@%bp@"<br>"@%ann,1);
			} else if(%vpercent != strLen(%bars))
				centerPrint(%obj.client,"<font:Consolas:16><color:ffffff>SAFETY " @ (%hasDrinkHigh ? "\c1" : "\c0") @%thing@"<br><color:888888>UNSAFE"@%bp@"<br>"@%ann,1);
		} else if(%obj.notarget)
			centerPrint(%obj.client,"<font:Consolas:16><color:ffffff>SAFETY " @ (%hasDrinkHigh ? "\c1" : "\c0") @%thing@"<br><color:999999>CLOAKED"@%bp@"<br>"@%ann,1);
		else {
			if(%label $= "") %label = "SAFE";
			centerPrint(%obj.client,"<font:Consolas:16><color:ffffff>SAFETY " @ (%hasDrinkHigh ? "\c1" : "\c0") @%thing@"<br><color:00ff00>"@%label@%bp@"<br>"@%ann,1);
		}
		if(%obj.dontShowHud) {
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
			return;
		}
		%newobj = getWord(getRaycastFromObject(%obj,$TypeMasks::PlayerObjectType),0);
		if(%obj.hudBattery <= 15) {
			if(!%obj.hudBroken) {
				if(%obj.getMaxSideSpeed() != %obj.defaultSideSpeed) %obj.setMaxSideSpeed(%obj.defaultSideSpeed);
				if(%obj.getMaxBackwardSpeed() != %obj.defaultBackwardSpeed) %obj.setMaxBackwardSpeed(%obj.defaultBackwardSpeed);
				if(%obj.getMaxForwardSpeed() != %obj.defaultForwardSpeed) %obj.setMaxForwardSpeed(%obj.defaultForwardSpeed);
			} else {
				if(%obj.getMaxSideSpeed() != %obj.defaultSideSpeed-2) %obj.setMaxSideSpeed(%obj.defaultSideSpeed-2);
				if(%obj.getMaxBackwardSpeed() != %obj.defaultBackwardSpeed-2) %obj.setMaxBackwardSpeed(%obj.defaultBackwardSpeed-2);
				if(%obj.getMaxForwardSpeed() != %obj.defaultForwardSpeed-2) %obj.setMaxForwardSpeed(%obj.defaultForwardSpeed-2);
			}
			if(%obj.batteryBlinkLoop++ >= 8) {
				%obj.batteryBlinkLoop = -1;
				%obj.batteryHudShow = (%obj.batteryHudShow ? "0" : "1");
			}
			%playerHP = "00"@mFloor(mAbs((((%obj.dataBlock.maxDamage-%obj.getDamageLevel())/%obj.dataBlock.maxDamage)*100)));
			if(!%obj.batteryHudShow)
				%battery = "";
			else
				%battery = "<color:ff0000>("@getSubStr("00"@%obj.hudBattery,strLen("00"@%obj.hudBattery)-3,3)@"% | HP: "@getSubStr(%playerHP,strLen(%playerHp)-3,3)@"%)";

		} else {
			%mod = %obj.speedModifier;
			if(!%obj.hudBroken) {
				if(%obj.getMaxSideSpeed() != %obj.defaultSideSpeed+%mod) %obj.setMaxSideSpeed(%obj.defaultSideSpeed+%mod);
				if(%obj.getMaxBackwardSpeed() != %obj.defaultBackwardSpeed+%mod) %obj.setMaxBackwardSpeed(%obj.defaultBackwardSpeed+%mod);
				if(%obj.getMaxForwardSpeed() != %obj.defaultForwardSpeed+%mod) %obj.setMaxForwardSpeed(%obj.defaultForwardSpeed+%mod);
			} else {
				if(%obj.getMaxSideSpeed() != %obj.defaultSideSpeed-2) %obj.setMaxSideSpeed(%obj.defaultSideSpeed-2);
				if(%obj.getMaxBackwardSpeed() != %obj.defaultBackwardSpeed-2) %obj.setMaxBackwardSpeed(%obj.defaultBackwardSpeed-2);
				if(%obj.getMaxForwardSpeed() != %obj.defaultForwardSpeed-2) %obj.setMaxForwardSpeed(%obj.defaultForwardSpeed-2);
			}
			%playerHP = "00"@mFloor(mAbs((((%obj.dataBlock.maxDamage-%obj.getDamageLevel())/%obj.dataBlock.maxDamage)*100)));
			%battery = "<color:"@(%obj.hudBattery >= 100 ? "EE04E7" : "ffffff")@">("@getSubStr("00"@%obj.hudBattery,strLen("00"@%obj.hudBattery)-3,3)@"% | HP: "@getSubStr(%playerHP,strLen(%playerHp)-3,3)@"%)";
		}
		if(isObject(%newObj) && %newObj.getClassName() $= "Player" && %newObj.firstName $= "") { %newObj.age = getRandom(18, 23); %newObj.firstName = firstWord(%newObj.getShapeName()); %newObj.lastName = getWord(%newObj.getShapeName(), 1); }
		if(!isObject(%newObj) || %newObj.firstName $= "") {
			bottomPrint(%obj.client,"<font:Consolas:16><just:center><color:ff0000>NAME<color:777777><br>( NO TARGET )<br><color:ff0000>AGE<color:ffffff><br><br><color:ff0000>PREDATION<br><br>"@%battery,0.2);
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
			return;
		}
		%hp = mFloor((mAbs(%newObj.getDamageLevel()-100)/100)*255);
		%hp_bad = mAbs(%hp-255);
		%hex = getHex(%hp_bad)@getHex(%hp)@"00";
		if(!%obj.membank_obj[%newObj])
			%safteyStatus = "<color:888888>UNKNOWN";
		else
			%safteyStatus = (%newObj.isNotVorist ? "<color:00ff00>SAFE" : "<color:ffff00>UNSAFE");

		if(%obj.hudBattery <= 5) {
			%hp = getRandom(0,255);
			%hp_bad = mAbs(%hp-255);
			%hex = getHex(%hp_bad)@getHex(%hp)@"00";
			if(getRandom(0,10000) >= 8000)
				%safteyStatus = "<color:888888>UNKNOWN";
			else
				%safteyStatus = (getRandom(0,500) >= 300 ? "<color:00ff00>SAFE" : "<color:ffff00>UNSAFE");

			%name = %newObj.firstName SPC %newObj.lastName;
			%tbl = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
			for(%i=0;%i<getRandom(0,7);%i++){
				%rnd = getRandom(0,strLen(%name)-1);
				%rnd_chr = getSubStr(%tbl,getRandom(0,strLen(%tbl)-1),1);
				%name = getSubStr(%name,0,%rnd)@%rnd_chr@getSubStr(%name,%rnd+1,strLen(%name));
			}
			bottomPrint(%obj.client,"<font:Consolas:16><just:center><color:ff0000>NAME<color:"@%hex@"><br>"@%name@"<br><color:ff0000>AGE<color:ffffff><br>"@getRandom(%newObj.age-2,%newObj.age+2)@"<br><color:ff0000>PREDATION<br>"@%SafteyStatus@"<br>"@%battery,0.2);
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
			return;
		} else if(%obj.hudBattery <= 10 && getRandom(0,100) >= 80) {
			%hp = getRandom(0,255);
			%hp_bad = mAbs(%hp-255);
			%hex = getHex(%hp_bad)@getHex(%hp)@"00";
			if(getRandom(0,10000) >= 8000)
				%safteyStatus = "<color:888888>UNKNOWN";
			else
				%safteyStatus = (getRandom(0,500) >= 300 ? "<color:00ff00>SAFE" : "<color:ffff00>UNSAFE");

			%name = %newObj.firstName SPC %newObj.lastName;
			%tbl = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
			for(%i=0;%i<getRandom(0,7);%i++){
				%rnd = getRandom(0,strLen(%name)-1);
				%rnd_chr = getSubStr(%tbl,getRandom(0,strLen(%tbl)-1),1);
				%name = getSubStr(%name,0,%rnd)@%rnd_chr@getSubStr(%name,%rnd+1,strLen(%name));
			}
			bottomPrint(%obj.client,"<font:Consolas:16><just:center><color:ff0000>NAME<color:"@%hex@"><br>"@%name@"<br><color:ff0000>AGE<color:ffffff><br>"@getRandom(%newObj.age-2,%newObj.age+2)@"<br><color:ff0000>PREDATION<br>"@%SafteyStatus@"<br>"@%battery,0.2);
			cancel(%obj.client.loopmarcgui);
			%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
			return;
		}
		bottomPrint(%obj.client,"<font:Consolas:16><just:center><color:ff0000>NAME<color:"@%hex@"><br>"@%newObj.firstName SPC %newObj.lastName@"<br><color:ff0000>AGE<color:ffffff><br>"@%newObj.age@"<br><color:ff0000>PREDATION<br>"@%SafteyStatus@"<br>"@%battery,0.2);
	}
	cancel(%obj.client.loopmarcgui);
	%obj.client.loopmarcgui = %obj.schedule(60,loopMarcGui);
}