Jump to content

Dear Devs - Help Remove attack sync


nolanri

Recommended Posts

As awesome as it is that you wanna do this to help the devs getting less complainers, as well as creating basic NPCs for the hell of it, I'm afraid it might have some backlash too.

 

For example, (this happened with another 'NPC mod' that occurred quite awhile ago) certain people might get into the mindset of "Well if this random modder can create NPCs, then how come it's taking the Devs so long?".

 

Just take that into account. :)

Link to comment
Share on other sites

3 minutes ago, Mr_Sunshine said:

As awesome as it is that you wanna do this to help the devs getting less complainers, as well as creating basic NPCs for the hell of it, I'm afraid it might have some backlash too.

 

For example, (this happened with another 'NPC mod' that occurred quite awhile ago) certain people might get into the mindset of "Well if this random modder can create NPCs, then how come it's taking the Devs so long?".

 

Just take that into account. :)

Yes understandable. That’s why the answer to that question will be "Because this only has very basic AI" 

Link to comment
Share on other sites

6 hours ago, nolanri said:

Yes understandable. That’s why the answer to that question will be "Because this only has very basic AI" 

 

Which you will understand, and I will understand, and hundreds of people who just see "NPC mod" who don't keep up with the game won't. Backlash on this every time is monumental.

 

Not speaking for TIS here or anything. You're obviously welcome to do w/e you want. Just know there will be a lot of pressure on you and a lot of horrible stuff said about us along the way.

Link to comment
Share on other sites

17 minutes ago, Rathlord said:

 

Which you will understand, and I will understand, and hundreds of people who just see "NPC mod" who don't keep up with the game won't. Backlash on this every time is monumental.

 

Not speaking for TIS here or anything. You're obviously welcome to do w/e you want. Just know there will be a lot of pressure on you and a lot of horrible stuff said about us along the way.

Not "NPC" mod, I never used that word and I went well out of my way to not use that Taboo word.  I was thinking of a name like "Survivors Mod". 

And though I could do it anyway ignoring the serious problem of Survivors moving when walk keys used etc, it would still be interesting but kind of dumb. So I was hoping TIS could push a simple fix for this problem, though I will probably try to make it either way.

And I agree there will be some people who will not understand there is a vast difference between basic AI and the kind of AI TIS wants NPC to have.  But those kind of people are likely to be complaining w/e they can even if its not about NPC.  So I still think you will have a lot less complainers when there is something to keep them occupied like this then compared to them having nothing to do but expect something big release on the next mondoid.

 

 

Link to comment
Share on other sites

7 hours ago, Mr_Sunshine said:

<snip>

 

 

1 hour ago, Rathlord said:

<snip>

 

 

Please avoid the off-topic next time. The NPC affair has been discussed time after time so there is no need to derail this topic which is actually about getting modding help ;)

 

@nolanri: I suspect the code for getting the player to move is hardcoded into the actual IsoPlayer class (I don't have the time to check this right now, so don't take my word for granted). If this is the case, then it probably isn't easy to fix without some major refactoring to the whole system. I can't think of any way to fix this on the Lua side. You might be able to write your own NPC class by extending the IsoPlayer class and removing the input related code in there (by overriding the parent methods)... No idea how that would work in reality though.

 

Anyway I hope you are able to fix this.

Edited by RoboMat
Link to comment
Share on other sites

48 minutes ago, RoboMat said:

 

 

Please avoid the off-topic next time. The NPC affair has been discussed time after time so there is no need to derail this topic which is actually about getting modding help ;)

 

@nolanri: I suspect the code for getting the player to move is hardcoded into the actual IsoPlayer class (I don't have the time to check this right now, so don't take my word for granted). If this is the case, then it probably isn't easy to fix without some major refactoring to the whole system. I can't think of any way to fix this on the Lua side. You might be able to write your own NPC class by extending the IsoPlayer class and removing the input related code in there (by overriding the parent methods)... No idea how that would work in reality though.

 

Anyway I hope you are able to fix this.

 

Local splitscreen coop works without me controlling both players with my keyboard. But how can I spawn these "players" like they are in local coop?

Link to comment
Share on other sites

Just now, RoboMat said:

Hm ... totally forgot about splitscreen. Did you take a look at the IsoPlayer class itself yet?

I looked at each method quite thoroughly and tried anything that even remotely seemed like it could effect this issue.

this:http://projectzomboid.com/modding/zombie/util/AddCoopPlayer.html

 

Looks suspicious but couldnt figure out how to use it.

Link to comment
Share on other sites

I meant if you looked at the actual IsoPlayer.class / .java file? You can use JD-gui to look at it.

 

Your problem is the update() method:

        this.TimeRightPressed += 1;
      } else {
        this.TimeRightPressed = 0;
      }
      if (this.bNewControls)
      {
        if (!this.isCharging) {
          this.isCharging = (((Mouse.isButtonDownUICheck(1)) && (this.TimeRightPressed >= 8)) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))));
        } else {
          this.isCharging = ((Mouse.isButtonDown(1)) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))));
        }
      }
      else if (!this.isCharging) {
        this.isCharging = ((Mouse.isButtonDownUICheck(0)) && ((this.TimeLeftPressed >= 13) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim")))));
      } else {
        this.isCharging = ((Mouse.isButtonDown(0)) && ((this.TimeLeftPressed >= 13) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim")))));
      }
      this.bRunning = ((!PZConsole.instance.isVisible()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey("Run"))) && (!this.bSneaking));
    }
    this.Waiting = false;

Looks like the controls are actually hardcoded into the player class. Haven't found anything that could disable it... so my guess is you can't fix it without touching the java side.

Edited by RoboMat
Link to comment
Share on other sites

I was brainstorming with @tommysticks recently, he was working on what he called a sibling mod where you could have more then one player, where you could switch back and forth. Maybe he can elaborate on it, I believe he had some elements of it working; even running into a similar problem with the zombies not attacking the npc spawns.

In one of the tutorials out there, I remember reading that getSpecificPlayer(0) would pick player 1, getSpecificPlayer(1) is player two, and so on. Would it be possible to use that? Perhaps select a player range well out of the usual for multiplayer? Say like getSpecificPlayer(99) or something. 

Is there a way to instead use the old npc code? I've seen some NPC stuff within TIS's code and folders, maybe reactivate and change the old AI / modify with different simple states as you mentioned.

Link to comment
Share on other sites

I'm not using the Survivor Class because the zombies ingore them. I'm using the IsoPLayer class. And currently the problem seems to be that ALL of the players I spawn have the same Index Number 0.  getSpesificPlayer() returns the player instance based on the index number so that wouldnt even work. Because player # 0 is meant to be the main (keyboard) player, that is why they all repond to the keyboard / mouse.

 

So I need to figure out the proper way to create a IsoPlayer Instance with incrementing PlayerIndex numbers.  I can't find any example in the PZ lua or on the /modding/ page of the website on how IsoPlayers are supposed to be created except via the constructor which has the problem of giving them all PlayerIndex 0 numbers

Link to comment
Share on other sites

even though all the Players I spawn have the same 0 result from getPlayerNum() of 0.  isLocalPlayer() still somehow recognizes the difference between my character and the spawned characters.

 

I was able to make it so the players I spawn dont stop thier actionQuene when I push walk key by altering WalkToTimedAction.lua in the base game files. by adding "and self.character:isLocalPlayer()" after self.character:getPlayerNum() == 0

 

If TIS could do this in the Java part of the player update function where it listens to keyboard it would be fixed

 

Though I had to edit base game files, its only a small improvement, because they survivors I spawn will still aim and face whereever I do even with a busy action quene.  And when they are idle they will still move with me fully.

 

 

Link to comment
Share on other sites

Is it possible to identify why the survivor class npc's are ignored by the zombies? That surely wouldn't be hard coded as TIS intended to use them for NPC's later on. Maybe an easier route would would be to somehow give the zombies and the survivor class npc entity a way to see each other? Sensor ranges or something like that?

Link to comment
Share on other sites

19 hours ago, RoboMat said:

I meant if you looked at the actual IsoPlayer.class / .java file? You can use JD-gui to look at it.

 

Your problem is the update() method:


        this.TimeRightPressed += 1;
      } else {
        this.TimeRightPressed = 0;
      }
      if (this.bNewControls)
      {
        if (!this.isCharging) {
          this.isCharging = (((Mouse.isButtonDownUICheck(1)) && (this.TimeRightPressed >= 8)) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))));
        } else {
          this.isCharging = ((Mouse.isButtonDown(1)) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))));
        }
      }
      else if (!this.isCharging) {
        this.isCharging = ((Mouse.isButtonDownUICheck(0)) && ((this.TimeLeftPressed >= 13) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim")))));
      } else {
        this.isCharging = ((Mouse.isButtonDown(0)) && ((this.TimeLeftPressed >= 13) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim")))));
      }
      this.bRunning = ((!PZConsole.instance.isVisible()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey("Run"))) && (!this.bSneaking));
    }
    this.Waiting = false;

Looks like the controls are actually hardcoded into the player class. Haven't found anything that could disable it... so my guess is you can't fix it without touching the java side.

If i edit this Java how can I recompile it? I know installation will become an issue with javaside edits but still.

 

here is my version with the && isLocalPlayer() added

 

 


package zombie.characters; import fmod.fmod.BaseSoundEmitter; import fmod.fmod.BaseSoundListener; import fmod.fmod.DummySoundEmitter; import fmod.fmod.DummySoundListener; import fmod.fmod.SoundEmitter; import fmod.fmod.SoundListener; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import java.security.MessageDigest; import java.util.ArrayList; import java.util.Arrays; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.Stack; import org.lwjgl.input.Keyboard; import zombie.BaseSoundManager; import zombie.FrameLoader; import zombie.GameTime; import zombie.GameWindow; import zombie.Lua.LuaEventManager; import zombie.SandboxOptions; import zombie.SoundManager; import zombie.SystemDisabler; import zombie.ZomboidGlobals; import zombie.ai.StateMachine; import zombie.ai.states.ClimbDownSheetRopeState; import zombie.ai.states.ClimbOverFenceState; import zombie.ai.states.ClimbOverFenceState2; import zombie.ai.states.ClimbSheetRopeState; import zombie.ai.states.ClimbThroughWindowState; import zombie.ai.states.ClimbThroughWindowState2; import zombie.ai.states.DieState; import zombie.ai.states.FakeDeadZombieState; import zombie.ai.states.IdleState; import zombie.ai.states.OpenWindowState; import zombie.ai.states.PathFindState; import zombie.ai.states.ReanimateState; import zombie.ai.states.SatChairState; import zombie.ai.states.SatChairStateOut; import zombie.ai.states.StaggerBackDieState; import zombie.ai.states.StaggerBackState; import zombie.ai.states.SwipeStatePlayer; import zombie.characters.BodyDamage.BodyDamage; import zombie.characters.BodyDamage.BodyPart; import zombie.characters.BodyDamage.BodyPartType; import zombie.characters.BodyDamage.Nutrition; import zombie.characters.Moodles.MoodleType; import zombie.characters.Moodles.Moodles; import zombie.characters.skills.PerkFactory; import zombie.characters.skills.PerkFactory.Perks; import zombie.core.Color; import zombie.core.Core; import zombie.core.PerformanceSettings; import zombie.core.Rand; import zombie.core.Translator; import zombie.core.properties.PropertyContainer; import zombie.core.skinnedmodel.ModelManager; import zombie.core.textures.ColorInfo; import zombie.core.utils.OnceEvery; import zombie.debug.DebugLog; import zombie.gameStates.MainScreenState; import zombie.input.GameKeyboard; import zombie.input.JoypadManager; import zombie.input.Mouse; import zombie.inventory.InventoryItem; import zombie.inventory.InventoryItemFactory; import zombie.inventory.ItemContainer; import zombie.inventory.types.Clothing; import zombie.inventory.types.Drainable; import zombie.inventory.types.HandWeapon; import zombie.iso.IsoCamera; import zombie.iso.IsoCell; import zombie.iso.IsoChunkMap; import zombie.iso.IsoDirections; import zombie.iso.IsoGridSquare; import zombie.iso.IsoMetaGrid; import zombie.iso.IsoMovingObject; import zombie.iso.IsoNPCPlayer; import zombie.iso.IsoObject; import zombie.iso.IsoObjectPicker.ClickObject; import zombie.iso.IsoPhysicsObject; import zombie.iso.IsoUtils; import zombie.iso.IsoWorld; import zombie.iso.SliceY; import zombie.iso.SpriteDetails.IsoFlagType; import zombie.iso.SpriteDetails.IsoObjectType; import zombie.iso.Vector2; import zombie.iso.areas.SafeHouse; import zombie.iso.objects.IsoCurtain; import zombie.iso.objects.IsoDoor; import zombie.iso.objects.IsoThumpable; import zombie.iso.objects.IsoWheelieBin; import zombie.iso.objects.IsoWindow; import zombie.iso.objects.IsoWindowFrame; import zombie.iso.sprite.IsoAnim; import zombie.iso.sprite.IsoSprite; import zombie.iso.sprite.IsoSpriteInstance; import zombie.network.BodyDamageSync; import zombie.network.GameClient; import zombie.network.GameServer; import zombie.network.ServerLOS; import zombie.network.ServerOptions; import zombie.network.ServerOptions.StringServerOption; import zombie.scripting.ScriptManager; import zombie.scripting.objects.Item.ClothingBodyLocation; import zombie.ui.MoodlesUI; import zombie.ui.PZConsole; import zombie.ui.Sidebar; import zombie.ui.SpeedControls; import zombie.ui.TutorialManager; import zombie.ui.UIManager; import zombie.ui.UITextBox2; public class IsoPlayer   extends IsoLivingCharacter {   public static final byte NetRemoteState_Idle = 0;   public static final byte NetRemoteState_Walk = 1;   public static final byte NetRemoteState_Run = 2;   public static byte NetRemoteState_Attack = 3;   public static final boolean NoSound = false;   public static final int MAX = 4;   private float MoveSpeed = 0.06F;   private static String forwardStr = "Forward";   private static String backwardStr = "Backward";   private static String leftStr = "Left";   private static String rightStr = "Right";   private static boolean CoopPVP = false;   private int offSetXUI = 0;   private int offSetYUI = 0;   private double HoursSurvived = 0.0D;   public boolean bDeathFinished = false;   private boolean bSentDeath;   private boolean noClip = false;   private boolean authorizeMeleeAction = true;   private boolean blockMovement = false;   private Nutrition nutrition;   public BaseSoundListener soundListener;   private long heavyBreathInstance = 0L;   private String heavyBreathSoundName = null;   public boolean bNewControls = true;   public String username = "Bob";     public static byte[] createChecksum(String filename)     throws Exception   {     InputStream fis = new FileInputStream(filename);          byte[] buffer = new byte['?'];     MessageDigest complete = MessageDigest.getInstance("MD5");     int numRead;     do     {       numRead = fis.read(buffer);       if (numRead > 0) {         complete.update(buffer, 0, numRead);       }     } while (numRead != -1);     fis.close();     return complete.digest();   }     public static String getMD5Checksum(String filename)     throws Exception   {     byte[] b = createChecksum(filename);     String result = "";     for (int i = 0; i < b.length; i++) {       result = result + Integer.toString((b & 0xFF) + 256, 16).substring(1);     }     return result;   }     public float closestZombie = 1000000.0F;     public void TestZombieSpotPlayer(IsoMovingObject chr)   {     chr.spotted(this, false);     if ((chr instanceof IsoZombie))     {       float dist = chr.DistTo(this);       if ((dist < this.closestZombie) && (!((IsoZombie)chr).isOnFloor())) {         this.closestZombie = dist;       }     }   }     public float getPathSpeed()   {     float speed = getMoveSpeed() * 0.9F;     switch (this.Moodles.getMoodleLevel(MoodleType.Endurance))     {     case 1:       speed *= 0.95F;       break;     case 2:       speed *= 0.9F;       break;     case 3:       speed *= 0.8F;       break;     case 4:       speed *= 0.6F;     }     if (this.stats.enduranceRecharging) {       speed *= 0.85F;     }     if (getMoodles().getMoodleLevel(MoodleType.HeavyLoad) > 0)     {       float weight = getInventory().getCapacityWeight();       float maxWeight = getMaxWeight().intValue();       float ratio = Math.min(2.0F, weight / maxWeight) - 1.0F;       speed *= (0.65F + 0.35F * (1.0F - ratio));     }     return speed;   }     public static boolean DoChecksumCheck(String str, String expected)   {     String checksum = "";     try     {       checksum = getMD5Checksum(str);       if (!checksum.equals(expected)) {         return false;       }     }     catch (Exception ex)     {       checksum = "";       try       {         checksum = getMD5Checksum("D:/Dropbox/Zomboid/zombie/build/classes/" + str);       }       catch (Exception ex1)       {         return false;       }     }     if (!checksum.equals(expected)) {       return false;     }     return true;   }     public static boolean DoChecksumCheck()   {     if (!DoChecksumCheck("zombie/GameWindow.class", "c4a62b8857f0fb6b9c103ff6ef127a9b")) {       return false;     }     if (!DoChecksumCheck("zombie/GameWindow$1.class", "5d93dc446b2dc49092fe4ecb5edf5f17")) {       return false;     }     if (!DoChecksumCheck("zombie/GameWindow$2.class", "a3e3d2c8cf6f0efaa1bf7f6ceb572073")) {       return false;     }     if (!DoChecksumCheck("zombie/gameStates/MainScreenState.class", "206848ba7cb764293dd2c19780263854")) {       return false;     }     if (!DoChecksumCheck("zombie/FrameLoader$1.class", "0ebfcc9557cc28d53aa982a71616bf5b")) {       return false;     }     if (!DoChecksumCheck("zombie/FrameLoader.class", "d5b1f7b2886a499d848c204f6a815776")) {       return false;     }     return true;   }     public boolean GhostMode = false;   public static IsoPlayer instance;   public Vector2 playerMoveDir = new Vector2(0.0F, 0.0F);   protected boolean isAiming = false;   protected static Stack<String> StaticTraits = new Stack();   private int sleepingPillsTaken = 0;   private long lastPillsTaken = 0L;     public boolean isGhostMode()   {     return this.GhostMode;   }     public void setGhostMode(boolean aGhostMode)   {     this.GhostMode = aGhostMode;   }     public static IsoPlayer getInstance()   {     return instance;   }     public static void setInstance(IsoPlayer aInstance)   {     instance = aInstance;   }     public Vector2 getPlayerMoveDir()   {     return this.playerMoveDir;   }     public void setPlayerMoveDir(Vector2 aPlayerMoveDir)   {     this.playerMoveDir = aPlayerMoveDir;   }     public boolean isIsAiming()   {     return this.isAiming;   }     public void setIsAiming(boolean aIsAiming)   {     this.isAiming = aIsAiming;   }     public void nullifyAiming()   {     this.isCharging = false;     this.TimeLeftPressed = 0;     PlayAnim("Idle");     this.isAiming = false;   }     public static Stack<String> getStaticTraits()   {     return StaticTraits;   }     public static void setStaticTraits(Stack<String> aStaticTraits)   {     StaticTraits = aStaticTraits;   }     public static int getFollowDeadCount()   {     return FollowDeadCount;   }     public static void setFollowDeadCount(int aFollowDeadCount)   {     FollowDeadCount = aFollowDeadCount;   }     protected int angleCounter = 0;   public Vector2 lastAngle = new Vector2();   protected int DialogMood = 1;   protected int ping = 0;   protected boolean FakeAttack = false;   protected IsoObject FakeAttackTarget = null;   protected IsoMovingObject DragObject = null;     public IsoPlayer(IsoCell cell)   {     super(cell, 0.0F, 0.0F, 0.0F);          this.bareHands = ((HandWeapon)InventoryItemFactory.CreateItem("Base.BareHands"));     if (Core.bDebug) {}     this.GuardModeUISprite = new IsoSprite(getCell().SpriteManager);     this.GuardModeUISprite.LoadFrameExplicit("TileFloorInt_0");     for (int n = 0; n < StaticTraits.size(); n++) {       this.Traits.add(StaticTraits.get(n));     }     StaticTraits.clear();          this.dir = IsoDirections.W;          this.descriptor = new SurvivorDesc();     this.PathSpeed = 0.08F;          this.descriptor.Instance = this;     if ((!GameClient.bClient) && (!GameServer.bServer)) {       instance = this;     }     this.SpeakColour = new Color(Rand.Next(135) + 120, Rand.Next(135) + 120, Rand.Next(135) + 120, 255);     if (HasTrait("Strong")) {       this.maxWeightDelta = 1.5F;     }     if (HasTrait("Weak")) {       this.maxWeightDelta = 0.75F;     }     if (HasTrait("Feeble")) {       this.maxWeightDelta = 0.9F;     }     if (HasTrait("Stout")) {       this.maxWeightDelta = 1.25F;     }     if (HasTrait("Injured")) {       getBodyDamage().AddRandomDamage();     }     if (FrameLoader.bClient) {}     this.descriptor.temper = 5.0F;     if (HasTrait("ShortTemper")) {       this.descriptor.temper = 7.5F;     } else if (HasTrait("Patient")) {       this.descriptor.temper = 2.5F;     }     this.nutrition = new Nutrition(this);          this.bMultiplayer = ((GameServer.bServer) || (GameClient.bClient));   }     protected float AsleepTime = 0.0F;   protected String[] MainHot = new String[10];   protected String[] SecHot = new String[10];   protected Stack<IsoMovingObject> spottedList = new Stack();   protected int TicksSinceSeenZombie = 9999999;   protected boolean Waiting = true;   protected IsoSurvivor DragCharacter = null;   protected Stack<Vector2> lastPos = new Stack();   protected boolean bDebounceLMB = false;   protected float heartDelay = 30.0F;   protected float heartDelayMax = 30.0F;   protected long heartEventInstance;   protected float DrunkOscilatorStepSin = 0.0F;   protected float DrunkOscilatorRateSin = 0.1F;   protected float DrunkOscilatorStepCos = 0.0F;   protected float DrunkOscilatorRateCos = 0.1F;   protected float DrunkOscilatorStepCos2 = 0.0F;   protected float DrunkOscilatorRateCos2 = 0.07F;   protected float DrunkSin = 0.0F;   protected float DrunkCos = 23784.0F;   protected float DrunkCos2 = 61616.0F;   protected float MinOscilatorRate = 0.01F;   protected float MaxOscilatorRate = 0.15F;   protected float DesiredSinRate = 0.0F;   protected float DesiredCosRate = 0.0F;   protected float OscilatorChangeRate = 0.05F;   public float maxWeightDelta = 1.0F;   protected String Forname = "Bob";   protected String Surname = "Smith";   public float TargetSpeed = 0.0F;   public float CurrentSpeed = 0.0F;   public float MaxSpeed = 0.09F;   public float SpeedChange = 0.007F;   protected IsoSprite GuardModeUISprite;     public IsoPlayer(IsoCell cell, SurvivorDesc desc, int x, int y, int z)   {     super(cell, x, y, z);          this.bareHands = ((HandWeapon)InventoryItemFactory.CreateItem("Base.BareHands"));     for (int n = 0; n < StaticTraits.size(); n++) {       this.Traits.add(StaticTraits.get(n));     }     StaticTraits.clear();          this.dir = IsoDirections.W;     this.nutrition = new Nutrition(this);          this.descriptor = new SurvivorDesc();     this.PathSpeed = 0.08F;          this.bFemale = desc.isFemale();     Dressup(desc);     InitSpriteParts(desc, desc.legs, desc.torso, desc.head, desc.top, desc.bottoms, desc.shoes, desc.skinpal, desc.toppal, desc.bottomspal, desc.shoespal, desc.hair, desc.extra);     this.descriptor = desc;          LuaEventManager.triggerEvent("OnCreateLivingCharacter", this, this.descriptor);     if ((!GameClient.bClient) && (!GameServer.bServer)) {       instance = this;     }     this.descriptor.Instance = this;          this.SpeakColour = new Color(Rand.Next(135) + 120, Rand.Next(135) + 120, Rand.Next(135) + 120, 255);     if (Core.GameMode.equals("LastStand")) {       this.Traits.add("Strong");     }     if (HasTrait("Strong")) {       this.maxWeightDelta = 1.5F;     }     if (HasTrait("Weak")) {       this.maxWeightDelta = 0.75F;     }     if (HasTrait("Feeble")) {       this.maxWeightDelta = 0.9F;     }     if (HasTrait("Stout")) {       this.maxWeightDelta = 1.25F;     }     this.descriptor.temper = 5.0F;     if (HasTrait("ShortTemper")) {       this.descriptor.temper = 7.5F;     } else if (HasTrait("Patient")) {       this.descriptor.temper = 2.5F;     }     Core.getInstance().refreshOffscreen();     if (HasTrait("Injured")) {       getBodyDamage().AddRandomDamage();     }     this.bMultiplayer = ((GameServer.bServer) || (GameClient.bClient));   }     public boolean IsSneaking()   {     if (this.bSneaking) {       return true;     }     return false;   }     protected int GuardModeUI = 0;   protected IsoSurvivor GuardChosen = null;   protected IsoGridSquare GuardStand = null;   protected IsoGridSquare GuardFace = null;   private boolean bMultiplayer;   public String SaveFileName;   private String SaveFileIP;     public void load(ByteBuffer input, int WorldVersion)     throws IOException   {     input.get();     input.getInt();          IsoPlayer oldInstance = instance;     instance = this;     try     {       super.load(input, WorldVersion);     }     finally     {       instance = oldInstance;     }     setHoursSurvived(input.getDouble());     SurvivorDesc desc = this.descriptor;     this.bFemale = desc.isFemale();          InitSpriteParts(desc, desc.legs, desc.torso, desc.head, desc.top, desc.bottoms, desc.shoes, desc.skinpal, desc.toppal, desc.bottomspal, desc.shoespal, desc.hair, desc.extra);     if ((!GameClient.bClient) && (!GameServer.bServer)) {       instance = this;     }     this.SpeakColour = new Color(Rand.Next(135) + 120, Rand.Next(135) + 120, Rand.Next(135) + 120, 255);          this.PathSpeed = 0.07F;          setZombieKills(input.getInt());     if (input.getInt() == 1)     {       String palette = GameWindow.ReadString(input);       String sprite = GameWindow.ReadString(input);       SetClothing(Item.ClothingBodyLocation.Top, sprite, palette);       this.topSprite.TintMod.r = input.getFloat();       this.topSprite.TintMod.g = input.getFloat();       this.topSprite.TintMod.b = input.getFloat();     }     if (input.getInt() == 1)     {       String palette = GameWindow.ReadString(input);       String sprite = GameWindow.ReadString(input);       SetClothing(Item.ClothingBodyLocation.Shoes, sprite, palette);     }     String sprite;     if (input.getInt() == 1)     {       String palette = GameWindow.ReadString(input);       sprite = GameWindow.ReadString(input);     }     if (input.getInt() == 1)     {       String palette = GameWindow.ReadString(input);       String sprite = GameWindow.ReadString(input);       SetClothing(Item.ClothingBodyLocation.Bottoms, sprite, palette);       this.bottomsSprite.TintMod.r = input.getFloat();       this.bottomsSprite.TintMod.g = input.getFloat();       this.bottomsSprite.TintMod.b = input.getFloat();     }     if (WorldVersion >= 46)     {       ArrayList<InventoryItem> items = this.inventory.IncludingObsoleteItems;       short index = input.getShort();       if ((index >= 0) && (index < items.size())) {         this.ClothingItem_Torso = ((InventoryItem)items.get(index));       }       index = input.getShort();       if ((index >= 0) && (index < items.size())) {         this.ClothingItem_Legs = ((InventoryItem)items.get(index));       }       index = input.getShort();       if ((index >= 0) && (index < items.size())) {         this.ClothingItem_Feet = ((InventoryItem)items.get(index));       }       index = input.getShort();       if ((index >= 0) && (index < items.size())) {         this.ClothingItem_Back = ((InventoryItem)items.get(index));       }       index = input.getShort();       if ((index >= 0) && (index < items.size())) {         this.leftHandItem = ((InventoryItem)items.get(index));       }       index = input.getShort();       if ((index >= 0) && (index < items.size())) {         this.rightHandItem = ((InventoryItem)items.get(index));       }     }     setSurvivorKills(input.getInt());          int iii = input.getInt();          initSpritePartsEmpty();     if (WorldVersion < 57) {       createKeyRing();     }     if (WorldVersion >= 81) {       this.nutrition.load(input);     }   }     public void save(ByteBuffer output)     throws IOException   {     IsoPlayer oldInstance = instance;     instance = this;     try     {       super.save(output);     }     finally     {       instance = oldInstance;     }     output.putDouble(getHoursSurvived());     output.putInt(getZombieKills());     if ((getClothingItem_Torso() != null) && (this.topSprite != null))     {       output.putInt(1);       GameWindow.WriteString(output, ((Clothing)getClothingItem_Torso()).getPalette());       GameWindow.WriteString(output, ((Clothing)getClothingItem_Torso()).getSpriteName());       output.putFloat(this.topSprite.TintMod.r);       output.putFloat(this.topSprite.TintMod.g);       output.putFloat(this.topSprite.TintMod.b);     }     else     {       output.putInt(0);     }     if (getClothingItem_Feet() != null)     {       output.putInt(1);       GameWindow.WriteString(output, ((Clothing)getClothingItem_Feet()).getPalette());       GameWindow.WriteString(output, ((Clothing)getClothingItem_Feet()).getSpriteName());     }     else     {       output.putInt(0);     }     if (getClothingItem_Hands() != null)     {       output.putInt(1);       GameWindow.WriteString(output, ((Clothing)getClothingItem_Hands()).getPalette());       GameWindow.WriteString(output, ((Clothing)getClothingItem_Hands()).getSpriteName());     }     else     {       output.putInt(0);     }     if ((getClothingItem_Legs() != null) && (this.bottomsSprite != null))     {       output.putInt(1);       GameWindow.WriteString(output, ((Clothing)getClothingItem_Legs()).getPalette());       GameWindow.WriteString(output, ((Clothing)getClothingItem_Legs()).getSpriteName());       output.putFloat(this.bottomsSprite.TintMod.r);       output.putFloat(this.bottomsSprite.TintMod.g);       output.putFloat(this.bottomsSprite.TintMod.b);     }     else     {       output.putInt(0);     }     output.putShort((short)this.inventory.getItems().indexOf(getClothingItem_Torso()));     output.putShort((short)this.inventory.getItems().indexOf(getClothingItem_Legs()));     output.putShort((short)this.inventory.getItems().indexOf(getClothingItem_Feet()));     output.putShort((short)this.inventory.getItems().indexOf(getClothingItem_Back()));     output.putShort((short)this.inventory.getItems().indexOf(getPrimaryHandItem()));     output.putShort((short)this.inventory.getItems().indexOf(getSecondaryHandItem()));          output.putInt(getSurvivorKills());          output.putInt(this.PlayerIndex);          this.nutrition.save(output);   }     public void save()     throws IOException   {     SliceY.SliceBuffer.rewind();          SliceY.SliceBuffer.put((byte)80);     SliceY.SliceBuffer.put((byte)76);     SliceY.SliceBuffer.put((byte)89);     SliceY.SliceBuffer.put((byte)82);     SliceY.SliceBuffer.putInt(89);          GameWindow.WriteString(SliceY.SliceBuffer, this.bMultiplayer ? ServerOptions.instance.ServerPlayerID.getValue() : "");          SliceY.SliceBuffer.putInt(IsoWorld.instance.CurrentCell.ChunkMap[0].WorldX);     SliceY.SliceBuffer.putInt(IsoWorld.instance.CurrentCell.ChunkMap[0].WorldY);     SliceY.SliceBuffer.putInt((int)this.x);     SliceY.SliceBuffer.putInt((int)this.y);     SliceY.SliceBuffer.putInt((int)this.z);          save(SliceY.SliceBuffer);          File file = new File(GameWindow.getGameModeCacheDir() + File.separator + Core.GameSaveWorld + File.separator + "map_p.bin");     FileOutputStream fos = new FileOutputStream(file);Throwable localThrowable3 = null;     try     {       BufferedOutputStream bos = new BufferedOutputStream(fos);Throwable localThrowable4 = null;       try       {         bos.write(SliceY.SliceBuffer.array(), 0, SliceY.SliceBuffer.position());       }       catch (Throwable localThrowable1)       {         localThrowable4 = localThrowable1;throw localThrowable1;       }       finally {}     }     catch (Throwable localThrowable2)     {       localThrowable3 = localThrowable2;throw localThrowable2;     }     finally     {       if (fos != null) {         if (localThrowable3 != null) {           try           {             fos.close();           }           catch (Throwable x2)           {             localThrowable3.addSuppressed(x2);           }         } else {           fos.close();         }       }     }   }     public void save(String fileName)     throws IOException   {     this.SaveFileName = fileName;          File outFile = new File(fileName);     FileOutputStream outStream = new FileOutputStream(outFile);     BufferedOutputStream output2 = new BufferedOutputStream(outStream);          SliceY.SliceBuffer.rewind();     SliceY.SliceBuffer.putInt(89);          GameWindow.WriteString(SliceY.SliceBuffer, this.bMultiplayer ? ServerOptions.instance.ServerPlayerID.getValue() : "");          save(SliceY.SliceBuffer);          output2.write(SliceY.SliceBuffer.array(), 0, SliceY.SliceBuffer.position());     output2.flush();     output2.close();   }     public void load(String fileName)     throws FileNotFoundException, IOException   {     File inFile = new File(fileName);     if (!inFile.exists()) {       return;     }     this.SaveFileName = fileName;          FileInputStream inStream = new FileInputStream(inFile);     BufferedInputStream input = new BufferedInputStream(inStream);     synchronized (SliceY.SliceBuffer)     {       SliceY.SliceBuffer.rewind();       input.read(SliceY.SliceBuffer.array());       int worldVersion = SliceY.SliceBuffer.getInt();       if (worldVersion >= 69)       {         this.SaveFileIP = GameWindow.ReadStringUTF(SliceY.SliceBuffer);         if (worldVersion < 71) {           this.SaveFileIP = ServerOptions.instance.ServerPlayerID.getValue();         }       }       else if (GameClient.bClient)       {         this.SaveFileIP = ServerOptions.instance.ServerPlayerID.getValue();       }       load(SliceY.SliceBuffer, worldVersion);       inStream.close();     }   }     public static ArrayList<String> getAllFileNames()   {     ArrayList<String> names = new ArrayList();     String saveDir = GameWindow.getGameModeCacheDir() + File.separator + Core.GameSaveWorld;     for (int n = 1; n < 100; n++)     {       File file = new File(saveDir + File.separator + "map_p" + n + ".bin");       if (file.exists()) {         names.add("map_p" + n + ".bin");       }     }     return names;   }     public static String getUniqueFileName()   {     int max = 0;          String saveDir = GameWindow.getGameModeCacheDir() + File.separator + Core.GameSaveWorld;     for (int n = 1; n < 100; n++)     {       File file = new File(saveDir + File.separator + "map_p" + n + ".bin");       if (file.exists()) {         max = n;       }     }     max++;     return GameWindow.getGameModeCacheDir() + File.separator + Core.GameSaveWorld + File.separator + "map_p" + max + ".bin";   }     public static ArrayList<IsoPlayer> getAllSavedPlayers()   {     ArrayList<IsoPlayer> players = new ArrayList();          IsoPlayer oldInstance = instance;          String saveDir = GameWindow.getGameModeCacheDir() + File.separator + Core.GameSaveWorld;     for (int n = 1; n < 100; n++)     {       File file = new File(saveDir + File.separator + "map_p" + n + ".bin");       if (file.exists()) {         try         {           IsoPlayer player = new IsoPlayer(IsoWorld.instance.CurrentCell);           try           {             player.load(saveDir + File.separator + "map_p" + n + ".bin");           }           finally           {             instance = oldInstance;           }           players.add(player);         }         catch (Exception ex)         {           ex.printStackTrace();         }       }     }     return players;   }     public boolean isSaveFileInUse()   {     if (this.SaveFileName == null) {       return false;     }     for (int pn = 0; pn < numPlayers; pn++) {       if ((players[pn] != null) && (this.SaveFileName.equals(players[pn].SaveFileName))) {         return true;       }     }     return false;   }     public void removeSaveFile()   {     try     {       if (this == players[0])       {         File file = new File(GameWindow.getGameModeCacheDir() + File.separator + Core.GameSaveWorld + File.separator + "map_p.bin");         if (file.exists()) {           file.delete();         }       }       else if (this.SaveFileName != null)       {         File file = new File(this.SaveFileName);         if (file.exists()) {           file.delete();         }       }     }     catch (Exception ex)     {       ex.printStackTrace();     }   }     public boolean isSaveFileIPValid()   {     return isServerPlayerIDValid(this.SaveFileIP);   }     public static boolean isServerPlayerIDValid(String id)   {     if (GameClient.bClient)     {       String ServerPlayerID = ServerOptions.instance.ServerPlayerID.getValue();       if ((ServerPlayerID == null) || (ServerPlayerID.isEmpty())) {         return true;       }       return ServerPlayerID.equals(id);     }     return true;   }     public String getObjectName()   {     return "Player";   }     public void collideWith(IsoObject obj) {}     public int getJoypadBind()   {     return this.JoypadBind;   }     public boolean isLBPressed()   {     if (this.JoypadBind == -1) {       return false;     }     return JoypadManager.instance.isLBPressed(this.JoypadBind);   }     public Vector2 getControllerAimDir(Vector2 vec)   {     if ((GameWindow.ActivatedJoyPad != null) && (this.JoypadBind != -1) && (this.bJoypadMovementActive))     {       float xVal2 = JoypadManager.instance.getAimingAxisX(this.JoypadBind);       float yVal2 = JoypadManager.instance.getAimingAxisY(this.JoypadBind);       if (vec.set(xVal2, yVal2).getLength() < 0.3F) {         xVal2 = yVal2 = 0.0F;       }       if ((xVal2 != 0.0F) || (yVal2 != 0.0F))       {         vec.set(xVal2, yVal2);         vec.normalize();         vec.rotate(-0.7853982F);                  this.angle.x = vec.x;         this.angle.y = vec.y;       }       else       {         return vec.set(0.0F, 0.0F);       }     }     return vec;   }     public IsoObject getInteract()   {     int x = 0;     int y = 0;     int fx = 0;     int fy = 0;     int cx = 0;     int cy = 0;     if (this.dir == IsoDirections.N)     {       fy--;       cy--;     }     if (this.dir == IsoDirections.NE)     {       fy--;       cy--;       x++;       cy++;     }     if (this.dir == IsoDirections.E)     {       x++;       cx++;     }     if (this.dir == IsoDirections.SE)     {       x++;       cx++;       y++;       cy++;     }     if (this.dir == IsoDirections.S)     {       y++;       cy++;     }     if (this.dir == IsoDirections.SW)     {       y++;       cy++;       fx--;       cx--;     }     if (this.dir == IsoDirections.W)     {       fx--;       cx--;     }     if (this.dir == IsoDirections.NW)     {       fx--;       fy--;       cx--;       cy--;     }     IsoGridSquare ca = getCell().getGridSquare((int)getX() + cx, (int)(getY() + cy), (int)getZ());          IsoGridSquare c = getCell().getGridSquare((int)getX(), (int)getY(), (int)getZ());     IsoGridSquare a = getCell().getGridSquare((int)(getX() + x), (int)getY(), (int)getZ());     IsoGridSquare b = getCell().getGridSquare((int)getX(), (int)(getY() + y), (int)getZ());     IsoGridSquare d = getCell().getGridSquare((int)(getX() - fx), (int)getY(), (int)getZ());     IsoGridSquare e = getCell().getGridSquare((int)getX(), (int)(getY() - fy), (int)getZ());     if (c != null) {       for (int n = 0; n < c.getObjects().size(); n++)       {         IsoObject obh = (IsoObject)c.getObjects().get(n);         if (obh.container != null) {           return obh;         }       }     }     if (ca != null) {       for (int n = 0; n < ca.getObjects().size(); n++)       {         IsoObject obh = (IsoObject)ca.getObjects().get(n);         if (obh.container != null) {           return obh;         }       }     }     if ((cx != 0) && (cy != 0))     {       IsoGridSquare cax = getCell().getGridSquare((int)getX() + cx, (int)getY(), (int)getZ());       IsoGridSquare cay = getCell().getGridSquare((int)getX(), (int)getY() + cy, (int)getZ());       if (cax != null) {         for (int n = 0; n < cax.getObjects().size(); n++)         {           IsoObject obh = (IsoObject)cax.getObjects().get(n);           if (obh.container != null) {             return obh;           }         }       }       if (cay != null) {         for (int n = 0; n < cay.getObjects().size(); n++)         {           IsoObject obh = (IsoObject)cay.getObjects().get(n);           if (obh.container != null) {             return obh;           }         }       }     }     if ((c != null) && (c.getSpecialObjects().size() > 0)) {       for (int n = 0; n < c.getObjects().size(); n++)       {         IsoObject obh = (IsoObject)c.getObjects().get(n);         if (((obh instanceof IsoDoor)) || (((obh instanceof IsoThumpable)) && (((IsoThumpable)obh).isDoor.booleanValue()))) {           return obh;         }       }     } else if ((a != null) && (a.getSpecialObjects().size() > 0)) {       for (int n = 0; n < a.getSpecialObjects().size(); n++)       {         IsoObject obh = (IsoObject)a.getSpecialObjects().get(n);         if (((obh instanceof IsoDoor)) || (((obh instanceof IsoThumpable)) && (((IsoThumpable)obh).isDoor.booleanValue()))) {           return obh;         }       }     } else if ((b != null) && (b.getSpecialObjects().size() > 0)) {       for (int n = 0; n < b.getSpecialObjects().size(); n++)       {         IsoObject obh = (IsoObject)b.getSpecialObjects().get(n);         if (((obh instanceof IsoDoor)) || (((obh instanceof IsoThumpable)) && (((IsoThumpable)obh).isDoor.booleanValue()))) {           return obh;         }       }     } else if ((d != null) && (b.getSpecialObjects().size() > 0)) {       for (int n = 0; n < d.getSpecialObjects().size(); n++)       {         IsoObject obh = (IsoObject)d.getSpecialObjects().get(n);         if (((obh instanceof IsoDoor)) || (((obh instanceof IsoThumpable)) && (((IsoThumpable)obh).isDoor.booleanValue()))) {           return obh;         }       }     } else if ((e != null) && (b.getSpecialObjects().size() > 0)) {       for (int n = 0; n < e.getSpecialObjects().size(); n++)       {         IsoObject obh = (IsoObject)e.getSpecialObjects().get(n);         if (((obh instanceof IsoDoor)) || (((obh instanceof IsoThumpable)) && (((IsoThumpable)obh).isDoor.booleanValue()))) {           return obh;         }       }     }     return null;   }     public float getMoveSpeed()   {     float minDelta = 1.0F;     for (int i = BodyPartType.ToIndex(BodyPartType.UpperLeg_L); i <= BodyPartType.ToIndex(BodyPartType.Foot_R); i++)     {       BodyPart part = getBodyDamage().getBodyPart(BodyPartType.FromIndex(i));       float delta = 1.0F;       if (part.getFractureTime() > 20.0F)       {         delta = 0.4F;         if (part.getFractureTime() > 50.0F) {           delta = 0.3F;         }         if (part.getSplintFactor() > 0.0F) {           delta += part.getSplintFactor() / 10.0F;         }       }       if ((part.getFractureTime() < 20.0F) && (part.getSplintFactor() > 0.0F)) {         delta = 0.8F;       }       if ((delta > 0.7F) && (part.getDeepWoundTime() > 0.0F))       {         delta = 0.7F;         if (part.bandaged()) {           delta += 0.2F;         }       }       if (delta < minDelta) {         minDelta = delta;       }     }     if (minDelta != 1.0F) {       return this.MoveSpeed * minDelta;     }     if ((getMoodles().getMoodleLevel(MoodleType.Panic) >= 4) && (HasTrait("AdrenalineJunkie")))     {       float del = 1.0F;       int mul = getMoodles().getMoodleLevel(MoodleType.Panic) + 1;       del += mul / 50.0F;              return this.MoveSpeed * del;     }     return this.MoveSpeed;   }     public void setMoveSpeed(float moveSpeed)   {     this.MoveSpeed = moveSpeed;   }     public float getTorchStrength()   {     if (this.bRemote) {       return this.mpTorchStrength;     }     float strength = 0.0F;     if ((this.leftHandItem != null) && (this.leftHandItem.getLightStrength() > 0.0F) && ((((this.leftHandItem instanceof Drainable)) && (((Drainable)this.leftHandItem).getUsedDelta() > 0.0F)) || ((!(this.leftHandItem instanceof Drainable)) && (((this.leftHandItem.canBeActivated()) && (this.leftHandItem.isActivated())) || (!this.leftHandItem.canBeActivated()))))) {       strength = this.leftHandItem.getLightStrength();     }     if ((this.rightHandItem != null) && (this.rightHandItem.getLightStrength() > 0.0F) && ((((this.rightHandItem instanceof Drainable)) && (((Drainable)this.rightHandItem).getUsedDelta() > 0.0F)) || ((!(this.rightHandItem instanceof Drainable)) && (((this.rightHandItem.canBeActivated()) && (this.rightHandItem.isActivated())) || (!this.rightHandItem.canBeActivated()))))) {       strength = this.rightHandItem.getLightStrength();     }     return strength;   }     public void pathFinished()   {     this.stateMachine.changeState(this.defaultState);     this.path = null;   }     public void Scratched()   {     IsoSurvivor other;     if ((this.descriptor.Group != null) && (this.descriptor.Group.Members.size() > 0)) {       other = (IsoSurvivor)this.descriptor.Group.getRandomMemberExcept(instance);     }   }     public void Bitten()   {     IsoSurvivor other;     if ((this.descriptor.Group != null) && (this.descriptor.Group.Members.size() > 0)) {       other = (IsoSurvivor)this.descriptor.Group.getRandomMemberExcept(instance);     }   }     public boolean isCharging = false;   public boolean isChargingLT = false;   public boolean bSneaking = false;   protected boolean bRunning = false;   protected boolean bWasRunning = false;   public boolean bRightClickMove = false;   protected boolean bChangeCharacterDebounce = false;   protected Vector2 runAngle = new Vector2();   protected int followID = 0;   protected Stack<IsoGameCharacter> FollowCamStack = new Stack();   public static boolean DemoMode = false;   protected static int FollowDeadCount = 240;   protected boolean bSeenThisFrame = false;   protected boolean bCouldBeSeenThisFrame = false;   public int TimeSprinting = 0;   public int TimeSinceRightClick = 0;   public int TimeRightClicking = 1110;   public int LastTimeRightClicking = 1110;   public boolean JustMoved = false;   public boolean ControllerRun = true;   public boolean L3Pressed = false;   public boolean bDoubleClick = false;   public float AimRadius = 0.0F;   public float DesiredAimRadius = 0.0F;   static int lmx = -1;   static int lmy = -1;     public float getRadiusKickback(HandWeapon weapon)   {     return 15.0F * getInvAimingMod();   }     public int getChancesToHeadshotHandWeapon()   {     int level = getPerkLevel(PerkFactory.Perks.Aiming);     if (level == 1) {       return 2;     }     if (level == 2) {       return 2;     }     if (level == 3) {       return 2;     }     if (level == 4) {       return 2;     }     if (level == 5) {       return 3;     }     if (level == 6) {       return 3;     }     if (level == 7) {       return 3;     }     if (level == 8) {       return 4;     }     if (level == 9) {       return 4;     }     if (level == 10) {       return 4;     }     return 2;   }     public float getInvAimingMod()   {     int level = getPerkLevel(PerkFactory.Perks.Aiming);     if (level == 1) {       return 0.9F;     }     if (level == 2) {       return 0.86F;     }     if (level == 3) {       return 0.82F;     }     if (level == 4) {       return 0.74F;     }     if (level == 5) {       return 0.7F;     }     if (level == 6) {       return 0.66F;     }     if (level == 7) {       return 0.62F;     }     if (level == 8) {       return 0.58F;     }     if (level == 9) {       return 0.54F;     }     if (level == 10) {       return 0.5F;     }     return 0.9F;   }     public float getAimingMod()   {     int level = getPerkLevel(PerkFactory.Perks.Aiming);     if (level == 1) {       return 1.1F;     }     if (level == 2) {       return 1.14F;     }     if (level == 3) {       return 1.18F;     }     if (level == 4) {       return 1.22F;     }     if (level == 5) {       return 1.26F;     }     if (level == 6) {       return 1.3F;     }     if (level == 7) {       return 1.34F;     }     if (level == 8) {       return 1.36F;     }     if (level == 9) {       return 1.4F;     }     if (level == 10) {       return 1.5F;     }     return 1.0F;   }     public float getReloadingMod()   {     int level = getPerkLevel(PerkFactory.Perks.Reloading);          return 3.5F - level * 0.25F;   }     public float getAimingRangeMod()   {     int level = getPerkLevel(PerkFactory.Perks.Aiming);     if (level == 1) {       return 1.2F;     }     if (level == 2) {       return 1.28F;     }     if (level == 3) {       return 1.36F;     }     if (level == 4) {       return 1.42F;     }     if (level == 5) {       return 1.5F;     }     if (level == 6) {       return 1.58F;     }     if (level == 7) {       return 1.66F;     }     if (level == 8) {       return 1.72F;     }     if (level == 9) {       return 1.8F;     }     if (level == 10) {       return 2.0F;     }     return 1.1F;   }     public boolean isBannedAttacking()   {     return this.bBannedAttacking;   }     public boolean bBannedAttacking = false;     public void setBannedAttacking(boolean b)   {     this.bBannedAttacking = b;   }     public float getInvAimingRangeMod()   {     int level = getPerkLevel(PerkFactory.Perks.Aiming);     if (level == 1) {       return 0.8F;     }     if (level == 2) {       return 0.7F;     }     if (level == 3) {       return 0.62F;     }     if (level == 4) {       return 0.56F;     }     if (level == 5) {       return 0.45F;     }     if (level == 6) {       return 0.38F;     }     if (level == 7) {       return 0.31F;     }     if (level == 8) {       return 0.24F;     }     if (level == 9) {       return 0.17F;     }     if (level == 10) {       return 0.1F;     }     return 0.8F;   }     public float EffectiveAimDistance = 0.0F;   private static Vector2 tempVector2 = new Vector2();     public void CalculateAim()   {     if (this.JoypadBind != -1) {       return;     }     Vector2 vec = tempVector2.set(instance.getX(), instance.getY());     int mx = Mouse.getX();     int my = Mouse.getY();          vec.x -= IsoUtils.XToIso(mx - 0, my - 0.0F + 0.0F, instance.getZ());     vec.y -= IsoUtils.YToIso(mx - 0, my - 0.0F + 0.0F, instance.getZ());          float dist = vec.getLength();          this.EffectiveAimDistance = dist;     float distDelta = dist / 10.0F;     if (distDelta > 1.0F) {       distDelta *= 2.0F;     }     if (distDelta < 0.05F) {       distDelta = 0.05F;     }     distDelta *= getInvAimingRangeMod();     if (IsUsingAimWeapon()) {       this.DesiredAimRadius = (distDelta * 60.0F);     } else if ((IsUsingAimHandWeapon()) && (this.isCharging)) {       this.DesiredAimRadius = 10.0F;     } else if ((IsUsingAimHandWeapon()) && (!this.isCharging)) {       this.AimRadius = 100.0F;     }     if (IsUsingAimWeapon()) {       if (this.DesiredAimRadius < 10.0F) {         this.DesiredAimRadius = 10.0F;       }     }     mx = Mouse.getXA();     my = Mouse.getYA();          float moveDist = IsoUtils.DistanceTo(mx, my, lmx, lmy);          float moveDelta = moveDist / 30.0F;          moveDelta *= getInvAimingMod();          this.AimRadius += moveDelta * 5.0F;     if (this.AimRadius > 70.0F) {       this.AimRadius = 70.0F;     }     lmx = mx;     lmy = my;          float Dif = Math.abs(this.AimRadius - this.DesiredAimRadius) / 40.0F;          Dif *= GameTime.instance.getMultiplier();     if ((getUseHandWeapon() == null) || (!getUseHandWeapon().isAimedHandWeapon())) {       if ((getUseHandWeapon() != null) && (!getUseHandWeapon().isAimed()))       {         if (this.isCharging) {           this.DesiredAimRadius += this.chargeTime * 0.05F;         } else {           this.DesiredAimRadius = 10.0F;         }         if (this.isCharging) {           this.AimRadius += this.chargeTime * 0.05F;         } else {           this.AimRadius = 10.0F;         }       }     }     if (getUseHandWeapon() != null) {       this.DesiredAimRadius *= getUseHandWeapon().getAimingMod();     }     if (this.AimRadius > this.DesiredAimRadius)     {       if (distDelta <= 0.2F) {         Dif *= 2.0F;       }       if (distDelta <= 0.5F) {         Dif *= 2.0F;       }       Dif *= getAimingMod();       if (getUseHandWeapon() != null) {         Dif *= getUseHandWeapon().getAimingMod();       }       this.AimRadius -= Dif;       if (this.AimRadius < this.DesiredAimRadius) {         this.AimRadius = this.DesiredAimRadius;       }     }     else if (this.AimRadius > this.DesiredAimRadius)     {       this.AimRadius += Dif;       if (this.AimRadius > this.DesiredAimRadius) {         this.AimRadius = this.DesiredAimRadius;       }     }   }     public float timePressedContext = 0.0F;   int TimeRightPressed = 0;   int TimeLeftPressed = 0;   public float chargeTime = 0.0F;   public float useChargeTime = 0.0F;   public boolean bPressContext = false;   HandWeapon lastWeapon = null;   String strafeAnim = "";   String strafeRAnim = "";   String walkAnim = "";   String walkRAnim = "";   public float numNearbyBuildingsRooms = 0.0F;   static OnceEvery networkUpdate = new OnceEvery(0.4F);   static OnceEvery networkUpdate2 = new OnceEvery(0.083333336F);   BaseSoundEmitter testemitter;   long Checksum = 0L;   float lastdist = 0.0F;   int checkSafehouse = 200;     public void render() {}     public void update()   {     updateEmitter();          updateHeavyBreathing();     if (SystemDisabler.doCharacterStats) {       this.nutrition.update();     }     if (isLocalPlayer())     {       if (this.soundListener == null) {         this.soundListener = (Core.SoundDisabled ? new DummySoundListener(this.PlayerIndex) : new SoundListener(this.PlayerIndex));       }       this.soundListener.setPos(this.x, this.y, this.z);              this.numNearbyBuildingsRooms = IsoWorld.instance.MetaGrid.countNearbyBuildingsRooms(this);       if (this.testemitter == null)       {         this.testemitter = (Core.SoundDisabled ? new DummySoundEmitter() : new SoundEmitter());         this.testemitter.setPos(this.x, this.y, this.z);       }       this.soundListener.tick();       this.testemitter.tick();     }     if ((!GameClient.bClient) && (!GameServer.bServer) && (this.bDeathFinished)) {       return;     }     if ((this instanceof IsoNPCPlayer))     {       super.update();       return;     }     if ((this.checkSafehouse > 0) && (GameServer.bServer))     {       this.checkSafehouse -= 1;       if (this.checkSafehouse == 0)       {         this.checkSafehouse = 200;         SafeHouse safe = SafeHouse.isSafeHouse(getCurrentSquare(), null);         if (safe != null) {           safe.updateSafehouse(this);         }       }     }     if ((this.bRemote) && (this.TimeSinceLastNetData > 600))     {       IsoWorld.instance.CurrentCell.getObjectList().remove(this);       if (this.movingSq != null) {         this.movingSq.getMovingObjects().remove(this);       }     }     this.TimeSinceLastNetData = ((int)(this.TimeSinceLastNetData + GameTime.instance.getMultiplier()));          this.TimeSinceOpenDoor += GameTime.instance.getMultiplier();     this.lastTargeted += GameTime.instance.getMultiplier();     this.targetedByZombie = false;     Core.getInstance();     if ((this.bRemote) || ((GameClient.bClient) && (this.NetRemoteState == NetRemoteState_Attack) && (!this.def.Finished)))     {       if (GameServer.bServer)       {         ServerLOS.instance.doServerZombieLOS(this);         ServerLOS.instance.updateLOS(this);         if ((this.Health <= 0.0F) || (this.BodyDamage.getHealth() <= 0.0F))         {           super.update();           return;         }         tempo.x = (this.x - this.lx);         tempo.y = (this.y - this.ly);         if (this.bSneaking) {           DoFootstepSound(this.CurrentSpeed * (2.0F - getNimbleMod()));         } else {           DoFootstepSound(this.CurrentSpeed);         }         if (this.slowTimer > 0.0F)         {           this.slowTimer -= GameTime.instance.getRealworldSecondsSinceLastUpdate();           this.slowFactor -= GameTime.instance.getMultiplier() / 100.0F;           if (this.slowFactor < 0.0F) {             this.slowFactor = 0.0F;           }         }         else         {           this.slowFactor = 0.0F;         }       }       setBlendSpeed(0.08F);       if ((this.remoteMoveX != 0.0F) || (this.remoteMoveY != 0.0F))       {         this.playerMoveDir.x = this.remoteMoveX;         this.playerMoveDir.y = this.remoteMoveY;         tempo.x = this.remoteMoveX;         tempo.y = this.remoteMoveY;         Move(tempo);         setBlendSpeed(tempo.getLength() * 2.0F * 0.9F);       }       if ((!GameServer.bServer) && (this.bRemote)) {         this.stateMachine.setCurrent(IdleState.instance());       }       super.update();       return;     }     if (isLocalPlayer())     {       IsoCamera.CamCharacter = this;       instance = this;     }     IsoCamera.update();     if ((isLocalPlayer()) && (UIManager.getMoodleUI(this.PlayerIndex) != null)) {       UIManager.getMoodleUI(this.PlayerIndex).setCharacter(this);     }     if (this.closestZombie > 1.2F)     {       this.slowTimer = -1.0F;       this.slowFactor = 0.0F;     }     this.ContextPanic -= 0.025F * GameTime.instance.getMultiplier();     if (this.ContextPanic < 0.0F) {       this.ContextPanic = 0.0F;     }     HandWeapon weapon = null;     if ((getPrimaryHandItem() != null) && ((getPrimaryHandItem() instanceof HandWeapon)))     {       weapon = (HandWeapon)getPrimaryHandItem();       if (this.lastWeapon != weapon)       {         String sw = weapon.getSwingAnim();         if ((!sw.equals("Bat")) && (!sw.equals("Handgun")) && (!sw.equals("Rifle"))) {           sw = "Bat";         }         this.strafeRAnim = ("Strafe_Aim_" + sw + "_R");         this.strafeAnim = ("Strafe_Aim_" + sw);         this.walkAnim = ("Walk_Aim_" + sw);         this.walkRAnim = ("Walk_Aim_" + sw + "_R");         this.lastWeapon = weapon;       }     }     else     {       this.strafeRAnim = "Strafe_R";       this.strafeAnim = "Strafe";       this.walkAnim = "Walk";       this.walkRAnim = "Walk_R";       this.lastWeapon = weapon;     }     this.lastSeenZombieTime += GameTime.instance.getGameWorldSecondsSinceLastUpdate() / 60.0F / 60.0F;     LuaEventManager.triggerEvent("OnPlayerUpdate", this);     if (instance.pressedMovement())     {       instance.ContextPanic = 0.0F;       this.ticksSincePressedMovement = 0;     }     else     {       this.ticksSincePressedMovement += 1;     }     if ((isDead()) && (this.heartEventInstance != 0L))     {       getEmitter().stopSound(this.heartEventInstance);       this.heartEventInstance = 0L;     }     if ((!GameClient.bClient) && ((this.Health <= 0.0F) || (this.BodyDamage.getHealth() <= 0.0F)))     {       this.stateMachine.changeState(DieState.instance());       this.stateMachine.Lock = true;              super.update();       return;     }     if ((GameClient.bClient) && (!this.bRemote) && ((this.Health <= 0.0F) || (this.BodyDamage.getHealth() <= 0.0F)))     {       if (!this.bSentDeath)       {         GameClient.instance.sendDeath(this);         this.bSentDeath = true;       }       super.update();       return;     }     int heartVolume = Core.getInstance().getOptionHeartVolume();     if ((!this.Asleep) && (heartVolume > 0) && (GameTime.getInstance().getTrueMultiplier() == 1.0F))     {       this.heartDelay -= GameTime.getInstance().getMultiplier() / 1.6F;       if (this.heartDelay <= 0.0F)       {         this.heartDelayMax = ((int)((1.0F - this.stats.Panic / 100.0F * 0.7F) * 25.0F) * 2);         this.heartDelay = this.heartDelayMax;         float gain = heartVolume / 10.0F;         if (Core.getInstance().getOptionSoundVolume() > 0) {           gain /= Core.getInstance().getOptionSoundVolume() / 10.0F;         }         if (this.heartEventInstance == 0L) {           this.heartEventInstance = getEmitter().playSoundImpl("heart", null);         }         if (this.heartEventInstance != 0L) {           getEmitter().setVolume(this.heartEventInstance, this.stats.Panic / 100.0F * gain);         }       }     }     if ((GameKeyboard.isKeyDown(Core.getInstance().getKey("Interact"))) && (!GameKeyboard.wasKeyDown(Core.getInstance().getKey("Interact")))) {       this.ContextPanic += 0.6F;     }     if ((getStateMachine().getCurrent() == ClimbOverFenceState.instance()) || (getStateMachine().getCurrent() == ClimbOverFenceState2.instance()) || (getStateMachine().getCurrent() == ClimbThroughWindowState.instance()) || (getStateMachine().getCurrent() == ClimbThroughWindowState2.instance()) || (getStateMachine().getCurrent() == OpenWindowState.instance()) || (getStateMachine().getCurrent() == SatChairState.instance()) || (getStateMachine().getCurrent() == SatChairStateOut.instance()) || (getStateMachine().getCurrent() == ClimbSheetRopeState.instance()) || (getStateMachine().getCurrent() == ClimbDownSheetRopeState.instance()) || (isAsleep()))     {       updateLOS();       super.update();       if ((GameClient.bClient) && (networkUpdate.Check())) {         GameClient.instance.sendPlayer(this);       }       return;     }     setCollidable(true);     CalculateAim();     if ((!PerkFactory.newMode) &&       (this.bCouldBeSeenThisFrame) && (!isbSeenThisFrame()) && (this.bSneaking))     {       this.xp.AddXP(PerkFactory.Perks.Sneak, 1.0F);       this.xp.AddXP(PerkFactory.Perks.Lightfoot, 1.0F);     }     this.bSeenThisFrame = false;     this.bCouldBeSeenThisFrame = false;     if ((IsoCamera.CamCharacter == null) && (GameClient.bClient)) {       IsoCamera.CamCharacter = instance;     }     this.timePressedContext += GameTime.instance.getRealworldSecondsSinceLastUpdate();     if (this.PlayerIndex == 0) {       if ((GameKeyboard.isKeyDown(Core.getInstance().getKey("Interact"))) && (this.timePressedContext < 0.5F))       {         this.bPressContext = true;       }       else       {         if ((this.bPressContext) && (((Core.CurrentTextEntryBox != null) && (Core.CurrentTextEntryBox.DoingTextEntry)) || (!GameKeyboard.doLuaKeyPressed))) {           this.bPressContext = false;         }         if (this.bPressContext)         {           if (doContext(this.dir, false))           {             super.update();             this.timePressedContext = 0.0F;             this.bPressContext = false;             return;           }           this.timePressedContext = 0.0F;         }         this.bPressContext = false;         this.timePressedContext = 0.0F;       }     }     if (!GameServer.bServer)     {       if ((Core.bDebug) && (GameKeyboard.isKeyDown(49)) && (!GameKeyboard.wasKeyDown(49)))       {         IsoPlayer player = null;         for (int n = 0; n < numPlayers; n++) {           if ((players[n] != null) && (!players[n].isDead()))           {             player = players[n];             break;           }         }         if ((player != null) && (this == player))         {           player.GhostMode = (!player.GhostMode);           for (int n = 0; n < numPlayers; n++) {             if ((players[n] != null) && (players[n] != player)) {               players[n].GhostMode = player.GhostMode;             }           }         }       }       if ((this.PlayerIndex == 0) &&         (Core.bDebug) && (GameKeyboard.isKeyDown(61)) && (!GameKeyboard.wasKeyDown(61))) {         ModelManager.instance.bDebugEnableModels = (!ModelManager.instance.bDebugEnableModels);       }       if (this.PlayerIndex == 0) {         if ((Core.bDebug) && (GameKeyboard.isKeyDown(22)))         {           if (!this.bChangeCharacterDebounce)           {             this.FollowCamStack.clear();             this.bChangeCharacterDebounce = true;             for (int n = 0; n < getCell().getObjectList().size(); n++)             {               IsoMovingObject obj = (IsoMovingObject)getCell().getObjectList().get(n);               if ((obj instanceof IsoSurvivor)) {                 this.FollowCamStack.add((IsoSurvivor)obj);               }             }             if (!this.FollowCamStack.isEmpty())             {               if (this.followID >= this.FollowCamStack.size()) {                 this.followID = 0;               }               IsoCamera.SetCharacterToFollow((IsoGameCharacter)this.FollowCamStack.get(this.followID));               if (UIManager.getSidebar() != null)               {                 UIManager.sidebar.InventoryFlow.Container = IsoCamera.CamCharacter.inventory;                 UIManager.sidebar.MainHand.chr = IsoCamera.CamCharacter;                 UIManager.sidebar.SecondHand.chr = IsoCamera.CamCharacter;               }               this.followID += 1;             }           }         }         else {           this.bChangeCharacterDebounce = false;         }       }       if ((this.current != null) && ((this.current.Has(IsoObjectType.stairsBN)) || (this.current.Has(IsoObjectType.stairsMN)) || (this.current.Has(IsoObjectType.stairsTN))))       {         float xl = this.x - (int)this.x;         if (xl < 0.5F)         {           setX(this.x + 0.1F);                      xl = this.x - (int)this.x;           if (xl > 0.5F) {             xl = 0.5F;           }         }         else if (xl < 0.5F)         {           setX(this.x - 0.1F);                      xl = this.x - (int)this.x;           if (xl > 0.5F) {             xl = 0.5F;           }         }       }     }     if (this.GhostMode)     {       this.stats.hunger = 0.0F;              this.stats.thirst = 0.0F;     }     boolean bDoneEquipTwoHandedMustBeInHand = false;          boolean isAttacking = false;     boolean bMelee = false;     this.bRunning = false;     this.bSneaking = false;     this.TimeSinceRightClick += 1;     this.useChargeTime = this.chargeTime;     if (!GameServer.bServer)     {       if (this.sprite.CurrentAnim.name.contains("Attack")) {         this.TimeLeftPressed = 16;       }       if (this.bNewControls) {         this.isAiming = (((GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))) || (Mouse.isButtonDownUICheck(1))) && ((GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))) || (this.TimeRightPressed >= 8)) && (getPlayerNum() == 0) && isLocalPlayer());       } else {         this.isAiming = (((GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))) || (this.TimeLeftPressed >= 16)) && (getPlayerNum() == 0) && isLocalPlayer());       }       if ((this.isCharging) || (this.isChargingLT)) {         this.chargeTime += 1.0F * GameTime.instance.getMultiplier();       }       if ((GameWindow.ActivatedJoyPad != null) && (this.JoypadBind != -1))       {         if (this.bJoypadMovementActive) {           if (!isAttacking) {             isAttacking = (this.isCharging) && (!JoypadManager.instance.isRTPressed(this.JoypadBind));           } else {             isAttacking = (this.isCharging) && (!JoypadManager.instance.isRTPressed(this.JoypadBind));           }         }         if ((this.isChargingLT) && (!JoypadManager.instance.isLTPressed(this.JoypadBind)))         {           bMelee = true;           isAttacking = false;         }       }       else       {         if (this.bNewControls)         {           if (!isAttacking) {             isAttacking = (this.isCharging) && (Mouse.isButtonDownUICheck(0));           } else {             isAttacking = (this.isCharging) && (Mouse.isButtonDown(0));           }         }         else if (!isAttacking) {           isAttacking = (this.isCharging) && (!Mouse.isButtonDownUICheck(0));         } else {           isAttacking = (this.isCharging) && (!Mouse.isButtonDown(0));         }         if ((GameKeyboard.isKeyDown(Core.getInstance().getKey("Melee"))) && (this.authorizeMeleeAction))         {           bMelee = true;           isAttacking = false;         }       }       int gdfgdf;       if (this.isCharging) {         gdfgdf = 0;       }       int nnn;       if (isAttacking)       {         this.TimeLeftPressed = 0;         this.isAiming = true;       }       else       {         nnn = 0;       }       if ((!this.isCharging) && (!this.isChargingLT)) {         this.chargeTime = 0.0F;       }       if ((GameWindow.ActivatedJoyPad != null) && (this.JoypadBind != -1))       {         if (this.bJoypadMovementActive)         {           this.isCharging = JoypadManager.instance.isRTPressed(this.JoypadBind);           this.isChargingLT = JoypadManager.instance.isLTPressed(this.JoypadBind);         }       }       else       {         if (Mouse.isButtonDown(1)) {           this.TimeRightPressed += 1;         } else {           this.TimeRightPressed = 0;         }         if (this.bNewControls)         {           if (!this.isCharging) {             this.isCharging = (((Mouse.isButtonDownUICheck(1)) && (this.TimeRightPressed >= 8)) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))));           } else {             this.isCharging = ((Mouse.isButtonDown(1)) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))));           }         }         else if (!this.isCharging) {           this.isCharging = ((Mouse.isButtonDownUICheck(0)) && ((this.TimeLeftPressed >= 13) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim")))));         } else {           this.isCharging = ((Mouse.isButtonDown(0)) && ((this.TimeLeftPressed >= 13) || (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim")))));         }         this.bRunning = ((!PZConsole.instance.isVisible()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey("Run"))) && (!this.bSneaking));       }       this.Waiting = false;              int last = 0;       if (!this.bNewControls) {         if (Mouse.isButtonDownUICheck(2))         {           this.TimeLeftPressed += 1;         }         else         {           last = this.TimeLeftPressed;           this.TimeLeftPressed = 0;         }       }       this.bWasRunning = this.bRightClickMove;       if (!this.bNewControls) {         this.bRightClickMove = ((Mouse.isRightDown()) && (this.stateMachine.getCurrent() != SwipeStatePlayer.instance()));       } else {         this.bRightClickMove = false;       }       if (this.bRightClickMove) {         this.isAiming = false;       }       if (this.bRightClickMove)       {         this.isCharging = false;         this.chargeTime = 0.0F;         if ((this.TimeLeftPressed == 0) && (last != 0))         {           this.isCharging = true;           this.isAiming = true;           isAttacking = true;           this.chargeTime = 0.5F;           this.bRightClickMove = false;           this.bWasRunning = false;           this.JustMoved = false;           setBeenMovingFor(getBeenMovingFor() - this.BeenMovingForDecrease * GameTime.getInstance().getMultiplier());         }         if (this.TimeLeftPressed >= 8) {           this.TimeLeftPressed = 8;         }       }       else if (!this.bWasRunning) {}       if (this.bRightClickMove) {         this.bDoubleClick = true;       }       if ((this.bRightClickMove) && (!this.bWasRunning) && (this.TimeSinceRightClick < 30))       {         this.TimeRightClicking = 0;         if (this.LastTimeRightClicking < 30) {           this.bDoubleClick = true;         }       }       if ((!this.bRightClickMove) ||                (!this.bRightClickMove))       {         if (this.bWasRunning) {           if (this.TimeRightClicking > 0) {             this.LastTimeRightClicking = this.TimeRightClicking;           }         }         this.TimeRightClicking = 0;         this.TimeSinceRightClick = 0;         this.bDoubleClick = false;       }       else       {         this.TimeSinceRightClick = 0;       }       if (this.bDoubleClick) {         this.bRunning = true;       }       if (this.bRunning) {         this.bDoubleClick = true;       }       this.TimeSinceRightClick += 1;              this.bSneaking = this.isAiming;       if (this.bSneaking) {         this.bRunning = false;       }       this.TicksSinceSeenZombie += 1;     }     super.update();          this.movementLastFrame.x = this.playerMoveDir.x;     this.movementLastFrame.y = this.playerMoveDir.y;     if (this.sprite != null)     {       if (this.sprite.CurrentAnim == null) {         return;       }       if (this.sprite.CurrentAnim.name == null) {         return;       }       if (this.sprite.CurrentAnim.name.equals("Die")) {         return;       }       if (this.sprite.CurrentAnim.name.equals("ZombieDeath")) {         return;       }     }     if ((GameServer.bServer) || (            (this.stateMachine.getCurrent() == StaggerBackState.instance()) || (this.stateMachine.getCurrent() == StaggerBackDieState.instance()) || (this.stateMachine.getCurrent() == DieState.instance()) || (this.stateMachine.getCurrent() == FakeDeadZombieState.instance()) || (this.stateMachine.getCurrent() == ReanimateState.instance()) || (UIManager.speedControls == null)))     {       if ((GameClient.bClient) && (networkUpdate2.Check())) {         GameClient.instance.sendPlayer(this);       }       return;     }     this.JustMoved = false;     setBeenMovingFor(getBeenMovingFor() - this.BeenMovingForDecrease * GameTime.getInstance().getMultiplier());     float nax = 0.0F;     float nay = 0.0F;     float moveDirX = nax;     float moveDirY = nay;          IsoDirections NewFacing = this.dir;     if (!GameServer.bServer) {       if (!TutorialManager.instance.StealControl)       {         if ((GameWindow.ActivatedJoyPad != null) && (this.JoypadBind != -1))         {           this.playerMoveDir.x = 0.0F;           this.playerMoveDir.y = 0.0F;           if (this.bJoypadMovementActive)           {             if (JoypadManager.instance.isRTPressed(this.JoypadBind)) {               this.isCharging = true;             }             if (!JoypadManager.instance.isAPressed(this.JoypadBind)) {               this.DebounceA = false;             }           }           float yVal = JoypadManager.instance.getMovementAxisY(this.JoypadBind);           float xVal = JoypadManager.instance.getMovementAxisX(this.JoypadBind);           float yVal2 = JoypadManager.instance.getAimingAxisY(this.JoypadBind);           float xVal2 = JoypadManager.instance.getAimingAxisX(this.JoypadBind);           if (tempVector2.set(xVal2, yVal2).getLength() < 0.3F) {             xVal2 = yVal2 = 0.0F;           }           Vector2 dir = tempVector2.set(xVal, yVal);           if (Math.abs(xVal) > 0.2F)           {             this.playerMoveDir.x += 0.04F * xVal;             this.playerMoveDir.y -= 0.04F * xVal;                          this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }           if (Math.abs(yVal) > 0.2F)           {             this.playerMoveDir.y += 0.04F * yVal;             this.playerMoveDir.x += 0.04F * yVal;                          this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }           if (JoypadManager.instance.isL3Pressed(this.JoypadBind))           {             if (!this.L3Pressed)             {               this.ControllerRun = (!this.ControllerRun);               this.L3Pressed = true;             }           }           else {             this.L3Pressed = false;           }           if (this.ControllerRun)           {             if (dir.getLength() > 0.95F)             {               this.bRunning = true;               setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());             }             else if (dir.getLength() < 0.5F)             {               this.bSneaking = true;             }           }           else if (dir.getLength() < 0.5F) {             this.bSneaking = true;           }           this.playerMoveDir.setLength(0.05F * dir.getLength() * dir.getLength() * dir.getLength() * dir.getLength() * dir.getLength() * dir.getLength() * dir.getLength() * dir.getLength() * dir.getLength());           if ((xVal2 != 0.0F) || (yVal2 != 0.0F))           {             Vector2 newVec = tempVector2.set(xVal2, yVal2);             IsoDirections temp = this.dir;                          newVec.normalize();                          DirectionFromVector(newVec);             NewFacing = this.dir;             this.bSneaking = true;             this.isAiming = true;             this.dir = temp;             this.bRunning = false;           }           else if ((xVal != 0.0F) || (yVal != 0.0F))           {             Vector2 newVec = tempVector2.set(this.playerMoveDir.x, this.playerMoveDir.y);             if (newVec.getLength() > 0.0F)             {               newVec.normalize();                              IsoDirections temp = this.dir;               DirectionFromVector(newVec);               NewFacing = this.dir;               this.dir = temp;             }           }         }         this.lastAngle.x = this.angle.x;         this.lastAngle.y = this.angle.y;         if ((!isBlockMovement()) && (this.PlayerIndex == 0) && (!this.Speaking) && (GameKeyboard.isKeyDown(Core.getInstance().getKey("Shout")))) {           Callout();         }         if ((GameKeyboard.isKeyDown(88)) && (Translator.debug)) {           Translator.loadFiles();         }         if ((this.PlayerIndex == 0) && (Core.bAltMoveMethod) && (this.stateMachine.getCurrent() != SwipeStatePlayer.instance()))         {           if ((!isBlockMovement()) && ((GameKeyboard.isKeyDown(Core.getInstance().getKey(leftStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(rightStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(forwardStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(backwardStr)))))           {             nax = 0.0F;             nay = 0.0F;           }           if ((!isBlockMovement()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey(leftStr))) && (!GameKeyboard.isKeyDown(Core.getInstance().getKey(rightStr))))           {             nax -= 0.04F;                          NewFacing = IsoDirections.W;             if (this.stateMachine.getCurrent() == PathFindState.instance()) {               this.stateMachine.setCurrent(this.defaultState);             }             this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }           if ((!isBlockMovement()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey(rightStr))) && (!GameKeyboard.isKeyDown(Core.getInstance().getKey(leftStr))))           {             nax += 0.04F;             NewFacing = IsoDirections.E;             if (this.stateMachine.getCurrent() == PathFindState.instance()) {               this.stateMachine.setCurrent(this.defaultState);             }             this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }           if ((!isBlockMovement()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey(forwardStr))) && (!GameKeyboard.isKeyDown(Core.getInstance().getKey(backwardStr))))           {             nay -= 0.04F;             if (NewFacing == IsoDirections.W) {               NewFacing = IsoDirections.NW;             } else if (NewFacing == IsoDirections.E) {               NewFacing = IsoDirections.NE;             } else {               NewFacing = IsoDirections.N;             }             if (this.stateMachine.getCurrent() == PathFindState.instance()) {               this.stateMachine.setCurrent(this.defaultState);             }             this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }           if ((!isBlockMovement()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey(backwardStr))) && (!GameKeyboard.isKeyDown(Core.getInstance().getKey(forwardStr))))           {             nay += 0.04F;             if (NewFacing == IsoDirections.W) {               NewFacing = IsoDirections.SW;             } else if (NewFacing == IsoDirections.E) {               NewFacing = IsoDirections.SE;             } else {               NewFacing = IsoDirections.S;             }             if (this.stateMachine.getCurrent() == PathFindState.instance()) {               this.stateMachine.setCurrent(this.defaultState);             }             this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }         }         else if ((this.PlayerIndex == 0) && (this.stateMachine.getCurrent() != SwipeStatePlayer.instance()))         {           if ((!isBlockMovement()) && ((GameKeyboard.isKeyDown(Core.getInstance().getKey(leftStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(rightStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(forwardStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(backwardStr)))))           {             nax = 0.0F;             nay = 0.0F;           }           if ((!isBlockMovement()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey(leftStr))) && (!GameKeyboard.isKeyDown(Core.getInstance().getKey(rightStr))))           {             nax -= 0.04F;             nay += 0.04F;             NewFacing = IsoDirections.SW;             if (this.stateMachine.getCurrent() == PathFindState.instance()) {               this.stateMachine.setCurrent(this.defaultState);             }             this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }           if ((!isBlockMovement()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey(rightStr))) && (!GameKeyboard.isKeyDown(Core.getInstance().getKey(leftStr))))           {             nax += 0.04F;             nay -= 0.04F;             NewFacing = IsoDirections.NE;             if (this.stateMachine.getCurrent() == PathFindState.instance()) {               this.stateMachine.setCurrent(this.defaultState);             }             this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }           if ((!isBlockMovement()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey(forwardStr))) && (!GameKeyboard.isKeyDown(Core.getInstance().getKey(backwardStr))))           {             UIManager.setDoMouseControls(true);             nay -= 0.04F;             nax -= 0.04F;             if (NewFacing == IsoDirections.SW) {               NewFacing = IsoDirections.W;             } else if (NewFacing == IsoDirections.NE) {               NewFacing = IsoDirections.N;             } else {               NewFacing = IsoDirections.NW;             }             if (this.stateMachine.getCurrent() == PathFindState.instance()) {               this.stateMachine.setCurrent(this.defaultState);             }             this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }           if ((!isBlockMovement()) && (GameKeyboard.isKeyDown(Core.getInstance().getKey(backwardStr))) && (!GameKeyboard.isKeyDown(Core.getInstance().getKey(forwardStr))))           {             nay += 0.04F;             nax += 0.04F;             if (NewFacing == IsoDirections.SW) {               NewFacing = IsoDirections.S;             } else if (NewFacing == IsoDirections.NE) {               NewFacing = IsoDirections.E;             } else {               NewFacing = IsoDirections.SE;             }             if (this.stateMachine.getCurrent() == PathFindState.instance()) {               this.stateMachine.setCurrent(this.defaultState);             }             this.JustMoved = true;             setBeenMovingFor(getBeenMovingFor() + this.BeenMovingForIncrease * GameTime.getInstance().getMultiplier());           }         }         moveDirX = nax;         moveDirY = nay;         if ((!isBlockMovement()) && (this.JustMoved))         {           if (!this.isAiming) {             if (this.JoypadBind != -1)             {               moveDirX = this.playerMoveDir.x;               moveDirY = this.playerMoveDir.y;               this.angle.x = moveDirX;               this.angle.y = moveDirY;             }             else             {               this.angle.x = nax;               this.angle.y = nay;               moveDirX = this.angle.x;               moveDirY = this.angle.y;             }           }           this.bRightClickMove = true;                      this.angle.normalize();                      UIManager.speedControls.SetCurrentGameSpeed(1);         }         else         {           if ((nax != 0.0F) || (nay != 0.0F))           {             this.angle.x = nax;             this.angle.y = nay;           }           moveDirX = nax;           moveDirY = nay;         }         if (this.bRightClickMove)         {           if (UIManager.getSpeedControls().getCurrentGameSpeed() > 1) {             UIManager.getSpeedControls().SetCurrentGameSpeed(1);           }         }         else if (this.stats.endurance < this.stats.endurancedanger) {           if (Rand.Next((int)(300.0F * GameTime.instance.getInvMultiplier())) == 0) {             this.xp.AddXP(PerkFactory.Perks.Fitness, 1.0F);           }         }       }     }     if (!GameServer.bServer)     {       float len = getMoveSpeed();       float delta = 1.0F;              float d = 0.0F;       if (this.bRightClickMove)       {         if (this.JustMoved)         {           if (!this.bRunning) {             d = 1.0F;           } else {             d = 1.5F;           }         }         else if (!this.isAiming) {           d = this.runAngle.getLength() / 4.0F;         }         if (d > 1.5F) {           d = 1.5F;         }       }       float newDelta = d;              delta *= d;       if ((this.runAngle.getLength() == 0.0F) && (!this.JustMoved)) {         delta = 0.0F;       }       if (delta > 1.0F) {         delta *= getSprintMod();       }       float animDelta = this.CurrentSpeed / 0.06F * getGlobalMovementMod(false);       if ((delta > 1.0F) &&         (HasTrait("Athletic"))) {         delta *= 1.2F;       }       if (delta > 1.0F)       {         if (HasTrait("Overweight")) {           delta *= 0.99F;         }         if (HasTrait("Obese"))         {           delta *= 0.85F;           if (getNutrition().getWeight() > 120.0F) {             delta *= 0.97F;           }         }         if (HasTrait("Out of Shape")) {           delta *= 0.99F;         }         if (HasTrait("Unfit")) {           delta *= 0.8F;         }       }       float rundelta = this.CurrentSpeed / 0.06F;       if ((animDelta > 1.0F) || (delta > 1.0F))       {         if (delta < 1.0F) {           rundelta *= 0.3F;         }         float enddelta = 1.4F;         if (HasTrait("Overweight")) {           enddelta = 2.9F;         }         if (HasTrait("Athletic")) {           enddelta = 0.8F;         }         enddelta *= 3.0F;                  enddelta *= getPacingMod();                  enddelta *= getHyperthermiaMod();                  float mod = 0.7F;         if (HasTrait("Asthmatic")) {           mod = 1.4F;         }         if (this.Moodles.getMoodleLevel(MoodleType.HeavyLoad) == 0)         {           Stats tmp6413_6410 = this.stats;tmp6413_6410.endurance = ((float)(tmp6413_6410.endurance - ZomboidGlobals.RunningEnduranceReduce * enddelta * (rundelta * 0.5F) * mod * GameTime.instance.getMultiplier() * this.stats.endurance));         }         else         {           Stats tmp6466_6463 = this.stats;tmp6466_6463.endurance = ((float)(tmp6466_6463.endurance - ZomboidGlobals.RunningEnduranceReduce * enddelta * (rundelta * 0.5F) * mod * GameTime.instance.getMultiplier() * 2.0D * this.stats.endurance));         }       }       if ((TutorialManager.instance.ActiveControlZombies) && (!IsoWorld.instance.CurrentCell.IsZone("tutArea", (int)this.x, (int)this.y))) {         TutorialManager.instance.ActiveControlZombies = false;       }       if ((this.bSneaking) && (this.JustMoved)) {         delta *= 0.7F;       }       if (this.bSneaking) {         delta *= getNimbleMod();       }       if (delta > 0.0F)       {         if (delta < 0.7F) {           this.bSneaking = true;         }         if (delta > 1.2F) {           this.bRunning = true;         }         LuaEventManager.triggerEvent("OnPlayerMove");         if (!PerkFactory.newMode)         {           if (this.bSneaking) {             if (Rand.Next((int)(80.0F * GameTime.instance.getInvMultiplier())) == 0) {               this.xp.AddXP(PerkFactory.Perks.Nimble, 1.0F);             }           }           if (getInventoryWeight() > this.maxWeight.intValue() * 0.5F) {             if (Rand.Next((int)(80.0F * GameTime.instance.getInvMultiplier())) == 0) {               this.xp.AddXP(PerkFactory.Perks.Strength, 2.0F);             }           }           if (this.bRunning) {             if (this.stats.endurance > this.stats.endurancewarn)             {               if (getInventoryWeight() > this.maxWeight.intValue() * 0.5F) {                 if (Rand.Next((int)(80.0F * GameTime.instance.getInvMultiplier())) == 0) {                   this.xp.AddXP(PerkFactory.Perks.Strength, 2.0F);                 }               }               if (Rand.Next((int)(80.0F * GameTime.instance.getInvMultiplier())) == 0) {                 this.xp.AddXP(PerkFactory.Perks.Fitness, 1.0F);               }               if (Rand.Next((int)(80.0F * GameTime.instance.getInvMultiplier())) == 0) {                 this.xp.AddXP(PerkFactory.Perks.Sprinting, 1.0F);               }             }           }         }       }       if ((this.JustMoved) || (this.bRightClickMove)) {         this.sprite.Animate = true;       }       if (bMelee)       {         if ((!this.bBannedAttacking) && (CanAttack()))         {           this.sprite.Animate = true;           DoAttack(this.useChargeTime, true, null);           this.useChargeTime = 0.0F;           this.chargeTime = 0.0F;           if (!this.isCharging) {             this.isAiming = false;           }         }       }       else if (((this.bRightClickMove) && (!this.JustMoved)) || ((this.isAiming) && (CanAttack())))       {         if (this.DragCharacter != null)         {           this.DragObject = null;           this.DragCharacter.Dragging = false;           this.DragCharacter = null;         }         HandWeapon leftHandItem = null;         if ((this.leftHandItem instanceof HandWeapon)) {           leftHandItem = (HandWeapon)this.leftHandItem;         } else {           leftHandItem = this.bareHands;         }         if ((!isForceShove()) && (leftHandItem != null) && (this.AttackDelay <= 0.0F) && (this.isAiming) && (!this.JustMoved) && (DoAimAnimOnAiming())) {           PlayShootAnim();         }         if ((isAttacking) && (!this.bBannedAttacking))         {           this.sprite.Animate = true;                      Vector2 vec = tempVector2.set(instance.getX(), instance.getY());           int mx = Mouse.getX();           int my = Mouse.getY();                      vec.x -= IsoUtils.XToIso(mx, my + 55.0F * this.def.getScaleY(), getZ());           vec.y -= IsoUtils.YToIso(mx, my + 55.0F * this.def.getScaleY(), getZ());                      vec.x = (-vec.x);           vec.y = (-vec.y);           vec.normalize();           if ((GameWindow.ActivatedJoyPad != null) && (this.JoypadBind != -1)) {             vec = getControllerAimDir(vec);           }           if (vec.getLength() > 0.0F)           {             DirectionFromVector(vec);             this.angle.x = vec.x;             this.angle.y = vec.y;           }           AttemptAttack(this.useChargeTime);           this.useChargeTime = 0.0F;           this.chargeTime = 0.0F;           this.bDebounceLMB = true;         }         else         {           this.bDebounceLMB = false;         }         if (((!this.JustMoved) || (this.isAiming)) && ((this.JoypadBind == -1) || (this.bJoypadMovementActive)))         {           Vector2 vec = tempVector2.set(getX(), getY());           int mx = Mouse.getX();           int my = Mouse.getY();                      vec.x -= IsoUtils.XToIso(mx, my + 55.0F * this.def.getScaleY(), getZ());           vec.y -= IsoUtils.YToIso(mx, my + 55.0F * this.def.getScaleY(), getZ());                      this.runAngle.x = vec.x;           this.runAngle.y = vec.y;           if (this.runAngle.getLength() < 0.3F) {             this.runAngle.setLength(0.0F);           } else {             this.runAngle.setLength(this.runAngle.getLength() - 0.3F);           }           vec.x = (-vec.x);           vec.y = (-vec.y);           vec.normalize();           this.lastAngle.x = this.angle.x;           this.lastAngle.y = this.angle.y;           this.angleCounter += 1;           if ((GameWindow.ActivatedJoyPad != null) && (this.JoypadBind != -1))           {             vec = getControllerAimDir(vec);           }           else           {             this.angle.x = vec.x;             this.angle.y = vec.y;             this.angleCounter = 0;           }           if (vec.getLength() > 0.0F)           {             DirectionFromVector(vec);             this.angle.x = vec.x;             this.angle.y = vec.y;           }         }         else if (this.angle.getLength() > 0.0F)         {           DirectionFromVector(this.angle);         }         NewFacing = this.dir;       }       if ((this.angle.x == 0.0F) && (this.angle.y == 0.0F))       {         this.angle.x = this.dir.ToVector().x;         this.angle.y = this.dir.ToVector().y;       }       if (this.DragCharacter != null) {         delta = 0.4F;       }       if (this.stats.endurance < 0.0F) {         this.stats.endurance = 0.0F;       }       if (this.stats.endurance > 1.0F) {         this.stats.endurance = 1.0F;       }       switch (this.Moodles.getMoodleLevel(MoodleType.Endurance))       {       case 1:         delta *= 0.95F;         break;       case 2:         delta *= 0.9F;         break;       case 3:         delta *= 0.8F;         break;       case 4:         delta *= 0.6F;       }       if (this.stats.enduranceRecharging) {         delta *= 0.85F;       }       if (delta < 0.6F)       {         float mul = 1.0F;                  mul *= (1.0F - this.stats.fatigue);         mul *= GameTime.instance.getMultiplier();         if (this.Moodles.getMoodleLevel(MoodleType.HeavyLoad) == 0)         {           Stats tmp7951_7948 = this.stats;tmp7951_7948.endurance = ((float)(tmp7951_7948.endurance + ZomboidGlobals.ImobileEnduranceReduce * SandboxOptions.instance.getEnduranceRegenMultiplier() * getRecoveryMod() * mul));         }       }       if ((delta <= 1.0F) && (delta > 0.6F))       {         float mul = 1.0F;                  mul *= (1.0F - this.stats.fatigue);         mul *= GameTime.instance.getMultiplier();         if (this.Moodles.getMoodleLevel(MoodleType.HeavyLoad) == 0)         {           Stats tmp8041_8038 = this.stats;tmp8041_8038.endurance = ((float)(tmp8041_8038.endurance + ZomboidGlobals.ImobileEnduranceReduce / 3.0D * SandboxOptions.instance.getEnduranceRegenMultiplier() * getRecoveryMod() * mul));         }       }       if (this.Moodles.getMoodleLevel(MoodleType.HeavyLoad) > 0)       {         float weight = getInventory().getCapacityWeight();         float maxWeight = getMaxWeight().intValue();         float ratio = Math.min(2.0F, weight / maxWeight) - 1.0F;         delta *= (0.65F + 0.35F * (1.0F - ratio));       }       if (this.playerMoveDir.getLength() > 0.0F) {         UIManager.CloseContainers();       }       int dif = Math.abs(this.dir.index() - NewFacing.index());       if (dif > 4) {         dif = 4 - (dif - 4);       }       if ((dif <= 2) || (                (!this.bFalling) && (!this.isAiming) && (!isAttacking))) {         this.dir = NewFacing;       }       if (this.current != null)       {         if ((this.current.Has(IsoObjectType.stairsBN)) || (this.current.Has(IsoObjectType.stairsMN)) || (this.current.Has(IsoObjectType.stairsTN)))         {           moveDirX = 0.0F;           if ((!this.JustMoved) && (this.bRightClickMove))           {             this.angle.x = 0.0F;             this.angle.normalize();           }         }         if ((this.current.Has(IsoObjectType.stairsBW)) || (this.current.Has(IsoObjectType.stairsMW)) || (this.current.Has(IsoObjectType.stairsTW)))         {           moveDirY = 0.0F;           if ((!this.JustMoved) && (this.bRightClickMove))           {             this.angle.y = 0.0F;             this.angle.normalize();           }         }       }       if ((this.isAiming) && ((GameWindow.ActivatedJoyPad == null) || (this.JoypadBind == -1)))       {         this.playerMoveDir.x = moveDirX;         this.playerMoveDir.y = moveDirY;       }       if ((!this.isAiming) && (this.bRightClickMove))       {         moveDirX = this.angle.x;         moveDirY = this.angle.y;         this.playerMoveDir.x = moveDirX;         this.playerMoveDir.y = moveDirY;       }       float animdelaymult = 1.0F + (1.0F - (animDelta > 1.0F ? 1.0F : animDelta));       if (this.bRightClickMove)       {         float WobbleFactor = 0.0F;         if (this.Moodles.getMoodleLevel(MoodleType.Drunk) == 1) {           WobbleFactor = 0.1F;         }         if (this.Moodles.getMoodleLevel(MoodleType.Drunk) == 2) {           WobbleFactor = 0.3F;         }         if (this.Moodles.getMoodleLevel(MoodleType.Drunk) == 3) {           WobbleFactor = 0.5F;         }         if (this.Moodles.getMoodleLevel(MoodleType.Drunk) == 4) {           WobbleFactor = 1.0F;         }         if (!this.bRunning) {           WobbleFactor /= 2.0F;         }         if (Rand.Next(80) == 0)         {           this.DrunkCos2 = (Rand.Next(64536, 1000) / 500.0F);           this.DrunkCos2 *= WobbleFactor;         }         if (this.DrunkSin < this.DrunkCos2)         {           this.DrunkSin += 0.015F;           if (this.DrunkSin > this.DrunkCos2)           {             this.DrunkSin = this.DrunkCos2;             this.DrunkCos2 = (Rand.Next(64536, 1000) / 500.0F);             this.DrunkCos2 *= WobbleFactor;           }         }         if (this.DrunkSin > this.DrunkCos2)         {           this.DrunkSin -= 0.015F;           if (this.DrunkSin < this.DrunkCos2)           {             this.DrunkSin = this.DrunkCos2;             this.DrunkCos2 = (Rand.Next(64536, 1000) / 500.0F);             this.DrunkCos2 *= WobbleFactor;           }         }         this.playerMoveDir.rotate(this.DrunkSin);         if (WobbleFactor > 0.0F) {           if ((this.playerMoveDir.x != 0.0F) || (this.playerMoveDir.y != 0.0F))           {             Vector2 newVec = tempo;             tempo.x = this.playerMoveDir.x;             tempo.y = this.playerMoveDir.y;             newVec.normalize();                          IsoDirections temp = this.dir;             DirectionFromVector(newVec);             NewFacing = this.dir;             this.dir = temp;             moveDirX = newVec.x;             moveDirY = newVec.y;             if (!this.isAiming)             {               this.angle.x = moveDirX;               this.angle.y = moveDirY;             }           }         }       }       else       {         this.DrunkCos2 = 0.0F;         if (this.DrunkSin < this.DrunkCos2) {           this.DrunkSin += 0.015F;         }         if (this.DrunkSin > this.DrunkCos2) {           this.DrunkSin -= 0.015F;         }       }       if (getStateMachine().getCurrent() != SwipeStatePlayer.instance()) {         if (this.path == null)         {           if (this.CurrentSpeed > 0.0F)           {             if ((!this.bClimbing) || (this.lastFallSpeed > 0.0F))             {               if (animDelta > 1.0F)               {                 StopAllActionQueueRunning();                 this.AimRadius += 10.0F;                 if ((this.leftHandItem instanceof HandWeapon))                 {                   PlayAnim(((HandWeapon)this.leftHandItem).RunAnim);                   if (!GameClient.bClient) {                     this.NetRemoteState = 2;                   }                 }                 else                 {                   PlayAnim("Run");                   if (!GameClient.bClient) {                     this.NetRemoteState = 2;                   }                   this.def.setFrameSpeedPerFrame(0.25F * animDelta);                 }               }               else               {                 if (isSat())                 {                   this.StateMachineParams.clear();                   this.StateMachineParams.put(Integer.valueOf(0), getChair());                   getStateMachine().changeState(SatChairStateOut.instance());                   return;                 }                 this.AimRadius += 0.8F;                                  StopAllActionQueueWalking();                                  this.def.setFrameSpeedPerFrame(0.3F);                 if (!this.isAiming)                 {                   PlayAnim("Walk");                   if (!GameClient.bClient) {                     this.NetRemoteState = 1;                   }                   this.def.setFrameSpeedPerFrame(0.25F * animDelta);                 }                 else                 {                   tempo.x = this.playerMoveDir.x;                   tempo.y = this.playerMoveDir.y;                   tempo.normalize();                   float dot = tempo.dot(this.angle);                   if (dot > 0.8D)                   {                     this.def.setFrameSpeedPerFrame(0.2F * (this.playerMoveDir.getLength() / 0.06F));                     PlayAnim(this.walkAnim);                   }                   else if ((dot >= -0.8D) && (dot <= 0.8D))                   {                     tempo.rotate((float)Math.toRadians(90.0D));                     dot = tempo.dot(this.angle);                     if (dot < 0.0F) {                       PlayAnim(this.strafeAnim);                     } else {                       PlayAnim(this.strafeRAnim);                     }                     this.playerMoveDir.setLength(this.CurrentSpeed * 0.8F);                     this.def.setFrameSpeedPerFrame(0.35F * (this.CurrentSpeed / 0.06F));                   }                   else if (dot < -0.8F)                   {                     this.def.setFrameSpeedPerFrame(0.2F * (this.CurrentSpeed / 0.06F));                     PlayAnim(this.walkRAnim);                     this.playerMoveDir.setLength(this.CurrentSpeed * 0.5F);                   }                 }               }             }             else if (!this.sprite.CurrentAnim.name.contains("Attack_"))             {               this.def.setFrameSpeedPerFrame(0.1F);               if (!GameClient.bClient) {                 this.NetRemoteState = 0;               }               if ((this.leftHandItem instanceof HandWeapon)) {                 PlayAnim(((HandWeapon)this.leftHandItem).IdleAnim);               } else {                 PlayAnim("Idle");               }             }           }           else if (!this.sprite.CurrentAnim.name.contains("Attack_"))           {             this.def.setFrameSpeedPerFrame(0.1F);             if ((this.leftHandItem instanceof HandWeapon))             {               if (this.isAiming)               {                 PlayAnim("Attack_" + ((HandWeapon)this.leftHandItem).getSwingAnim());                 this.def.Finished = true;                 this.def.Frame = 0.0F;               }               else               {                 PlayAnim(((HandWeapon)this.leftHandItem).IdleAnim);               }               if (!GameClient.bClient) {                 this.NetRemoteState = 0;               }             }             else if (isSat())             {               PlayAnim("SatChairIdle");             }             else             {               if (!GameClient.bClient) {                 this.NetRemoteState = 0;               }               PlayAnim("Idle");             }           }         }         else         {           this.AimRadius += 0.8F;                      StopAllActionQueueWalking();                      PlayAnim("Walk");           float animDelta2 = getPathSpeed() / 0.06F * getGlobalMovementMod(false);           this.def.setFrameSpeedPerFrame(0.25F * animDelta2);         }       }       if (delta > 1.3F)       {         float sprintdelta = 1.0F;         float sprintcutoff = 180.0F;         if (this.TimeSprinting >= sprintcutoff) {           sprintdelta = 1.0F - (this.TimeSprinting - sprintcutoff) / 360.0F;         } else {           sprintdelta = 1.0F - (sprintcutoff - this.TimeSprinting) / 360.0F;         }         sprintdelta *= 0.1F;         sprintdelta += 1.0F;         if (sprintdelta < 0.0F) {           sprintdelta = 0.0F;         }         this.TimeSprinting += 1;         this.TargetSpeed = (len * sprintdelta * delta * 1.1F);       }       else       {         this.TargetSpeed = (len * delta * 0.9F);         if (this.CurrentSpeed < 0.08F) {           this.TimeSprinting = 0;         }       }       float useSpeedChange = this.SpeedChange;       if (this.CurrentSpeed < 0.06F) {         useSpeedChange *= 5.0F;       }       if (this.slowTimer > 0.0F) {         this.TargetSpeed *= (1.0F - this.slowFactor);       }       if (this.CurrentSpeed < this.TargetSpeed)       {         this.CurrentSpeed += useSpeedChange / 3.0F;         if (this.CurrentSpeed > this.TargetSpeed) {           this.CurrentSpeed = this.TargetSpeed;         }       }       else if (this.CurrentSpeed > this.TargetSpeed)       {         if (this.CurrentSpeed < 0.03F)         {           this.CurrentSpeed = this.TargetSpeed;         }         else         {           this.CurrentSpeed -= useSpeedChange;           if (this.CurrentSpeed < this.TargetSpeed) {             this.CurrentSpeed = this.TargetSpeed;           }         }       }       if (this.slowTimer > 0.0F)       {         this.slowTimer -= GameTime.instance.getRealworldSecondsSinceLastUpdate();         this.CurrentSpeed *= (1.0F - this.slowFactor);         this.slowFactor -= GameTime.instance.getMultiplier() / 100.0F;         if (this.slowFactor < 0.0F) {           this.slowFactor = 0.0F;         }       }       else       {         this.slowFactor = 0.0F;       }       len = this.CurrentSpeed;              this.playerMoveDir.setLength(len);       if ((this.playerMoveDir.x != 0.0F) || (this.playerMoveDir.y != 0.0F)) {         ScriptManager.instance.Trigger("OnPlayerMoved");       }       if (!this.GhostMode) {         if (this.bSneaking) {           DoFootstepSound(this.CurrentSpeed * (2.0F - getNimbleMod()));         } else {           DoFootstepSound(this.CurrentSpeed);         }       }       if (this.DragObject != null)       {         Vector2 vec = new Vector2(instance.getX(), instance.getY());         vec.x -= this.DragObject.getX();         vec.y -= this.DragObject.getY();         vec.x = (-vec.x);         vec.y = (-vec.y);         vec.normalize();         DirectionFromVectorNoDiags(vec);         if (((this.dir == IsoDirections.W) || (this.dir == IsoDirections.S) || (this.dir == IsoDirections.N) || (this.dir == IsoDirections.E)) && ((this.DragObject instanceof IsoWheelieBin))) {           this.DragObject.dir = this.dir;         }       }       if ((this.DragObject != null) && ((this.DragObject instanceof IsoWheelieBin))) {         this.DragObject.dir = this.dir;       }       if (this.DragObject != null)       {         float tweight = this.DragObject.getWeight(this.playerMoveDir.x, this.playerMoveDir.y) + getWeight(this.playerMoveDir.x, this.playerMoveDir.y);                  float del = getWeight(this.playerMoveDir.x, this.playerMoveDir.y) / tweight;         this.playerMoveDir.x *= del;         this.playerMoveDir.y *= del;       }       if (this.DragObject != null) {         if (this.playerMoveDir.getLength() != 0.0F)         {           this.DragObject.setImpulsex(this.DragObject.getImpulsex() + this.playerMoveDir.x);           this.DragObject.setImpulsey(this.DragObject.getImpulsey() + this.playerMoveDir.y);         }       }       if (this.GhostMode)       {         Vector2 tmp10557_10554 = this.playerMoveDir;tmp10557_10554.x = ((float)(tmp10557_10554.x * (4.0D + (this.bRunning ? 4.0D : 0.5D)))); Vector2           tmp10591_10588 = this.playerMoveDir;tmp10591_10588.y = ((float)(tmp10591_10588.y * (4.0D + (this.bRunning ? 4.0D : 0.5D))));       }       if (this.stateMachine.getCurrent() != SwipeStatePlayer.instance()) {         Move(this.playerMoveDir);       }       if ((GameClient.bClient) && ((networkUpdate.Check()) || (this.dir != this.lastdir) || ((this.playerMoveDir.getLength() == 0.0F) && ((this.llx != this.x) || (this.lly != this.y))) || ((this.playerMoveDir.getLength() > 0.0F) && (this.llx == this.x) && (this.lly == this.y)) || (this.stateMachine.getCurrent() == DieState.instance()) || (this.path != null))) {         GameClient.instance.sendPlayer(this);       }       if (this.DragCharacter != null)       {         Vector2 vec = new Vector2(instance.getX(), instance.getY());         vec.x -= this.DragCharacter.getX();         vec.y -= this.DragCharacter.getY();         vec.x = (-vec.x);         vec.y = (-vec.y);         vec.normalize();         DirectionFromVector(vec);         if ((this.dir == IsoDirections.W) || (this.dir == IsoDirections.S) || (this.dir == IsoDirections.N) || (this.dir == IsoDirections.E)) {           this.DragCharacter.dir = this.dir;         }       }       this.closestZombie = 1000000.0F;              updateLOS();     }     this.weight = 0.3F;     seperate();     if (getCurrentSquare() != null) {       if (getCurrentSquare().getRoom() == null) {}     }     updateSleepingPillsTaken();          updateTorchStrength();   }     private boolean flickTorch = false;     private void updateTorchStrength()   {     if ((getTorchStrength() > 0.0F) || (this.flickTorch))     {       InventoryItem torch = null;       if ((this.leftHandItem != null) && (this.leftHandItem.getLightStrength() > 0.0F) && ((this.leftHandItem instanceof Drainable))) {         torch = this.leftHandItem;       }       if ((torch == null) && (this.rightHandItem != null) && (this.rightHandItem.getLightStrength() > 0.0F) && ((this.rightHandItem instanceof Drainable))) {         torch = this.rightHandItem;       }       if (torch == null) {         return;       }       if (Rand.Next(600 - (int)(0.4D / ((Drainable)torch).getUsedDelta() * 100.0D)) == 0) {         this.flickTorch = true;       }       if (this.flickTorch)       {         if (Rand.Next(6) == 0) {           torch.setActivated(false);         } else {           torch.setActivated(true);         }         if (Rand.Next(40) == 0)         {           this.flickTorch = false;           torch.setActivated(true);         }       }     }   }     public float ContextPanic = 0.0F;   private int ticksSincePressedMovement = 0;     public IsoCell getCell()   {     return IsoWorld.instance.CurrentCell;   }     public void calculateContext()   {     float cx = this.x;     float cy = this.y;     float cz = this.x;     IsoGridSquare[] sqs = new IsoGridSquare[4];     if (this.dir == IsoDirections.N)     {       sqs[2] = getCell().getGridSquare(cx - 1.0F, cy - 1.0F, cz);sqs[1] = getCell().getGridSquare(cx, cy - 1.0F, cz);sqs[3] = getCell().getGridSquare(cx + 1.0F, cy - 1.0F, cz);     }     else if (this.dir == IsoDirections.NE)     {       sqs[2] = getCell().getGridSquare(cx, cy - 1.0F, cz);sqs[1] = getCell().getGridSquare(cx + 1.0F, cy - 1.0F, cz);sqs[3] = getCell().getGridSquare(cx + 1.0F, cy, cz);     }     else if (this.dir == IsoDirections.E)     {       sqs[2] = getCell().getGridSquare(cx + 1.0F, cy - 1.0F, cz);sqs[1] = getCell().getGridSquare(cx + 1.0F, cy, cz);sqs[3] = getCell().getGridSquare(cx + 1.0F, cy + 1.0F, cz);     }     else if (this.dir == IsoDirections.SE)     {       sqs[2] = getCell().getGridSquare(cx + 1.0F, cy, cz);sqs[1] = getCell().getGridSquare(cx + 1.0F, cy + 1.0F, cz);sqs[3] = getCell().getGridSquare(cx, cy + 1.0F, cz);     }     else if (this.dir == IsoDirections.S)     {       sqs[2] = getCell().getGridSquare(cx + 1.0F, cy + 1.0F, cz);sqs[1] = getCell().getGridSquare(cx, cy + 1.0F, cz);sqs[3] = getCell().getGridSquare(cx - 1.0F, cy + 1.0F, cz);     }     else if (this.dir == IsoDirections.SW)     {       sqs[2] = getCell().getGridSquare(cx, cy + 1.0F, cz);sqs[1] = getCell().getGridSquare(cx - 1.0F, cy + 1.0F, cz);sqs[3] = getCell().getGridSquare(cx - 1.0F, cy, cz);     }     else if (this.dir == IsoDirections.W)     {       sqs[2] = getCell().getGridSquare(cx - 1.0F, cy + 1.0F, cz);sqs[1] = getCell().getGridSquare(cx - 1.0F, cy, cz);sqs[3] = getCell().getGridSquare(cx - 1.0F, cy - 1.0F, cz);     }     else if (this.dir == IsoDirections.NW)     {       sqs[2] = getCell().getGridSquare(cx - 1.0F, cy, cz);sqs[1] = getCell().getGridSquare(cx - 1.0F, cy - 1.0F, cz);sqs[3] = getCell().getGridSquare(cx, cy - 1.0F, cz);     }     sqs[0] = this.current;     for (int n = 0; n < 4; n++)     {       IsoGridSquare test = sqs[n];       if (test == null) {}     }   }     private boolean isSafeToClimbOver(IsoDirections dir)   {     IsoGridSquare sq = null;     switch (dir)     {     case N:       sq = getCell().getGridSquare(this.x, this.y - 1.0F, this.z);       break;     case S:       sq = getCell().getGridSquare(this.x, this.y + 1.0F, this.z);       break;     case W:       sq = getCell().getGridSquare(this.x - 1.0F, this.y, this.z);       break;     case E:       sq = getCell().getGridSquare(this.x + 1.0F, this.y, this.z);       break;     default:       DebugLog.log("IsoPlayer.isSafeToClimbOver(): unhandled direction");       return false;     }     return (sq != null) && (sq.TreatAsSolidFloor());   }     private boolean doContext(IsoDirections dir, boolean bPrint)   {     IsoDirections assumedDir = dir;          float lx = this.x - (int)this.x;     float ly = this.y - (int)this.y;     if (dir == IsoDirections.NW)     {       if (ly < lx)       {         if (doContext(IsoDirections.N, bPrint)) {           return true;         }         return doContext(IsoDirections.W, bPrint);       }       if (doContext(IsoDirections.W, bPrint)) {         return true;       }       return doContext(IsoDirections.N, bPrint);     }     if (dir == IsoDirections.NE)     {       lx = 1.0F - lx;       if (ly < lx)       {         if (doContext(IsoDirections.N, bPrint)) {           return true;         }         return doContext(IsoDirections.E, bPrint);       }       if (doContext(IsoDirections.E, bPrint)) {         return true;       }       return doContext(IsoDirections.N, bPrint);     }     if (dir == IsoDirections.SE)     {       lx = 1.0F - lx;       ly = 1.0F - ly;       if (ly < lx)       {         if (doContext(IsoDirections.S, bPrint)) {           return true;         }         return doContext(IsoDirections.E, bPrint);       }       if (doContext(IsoDirections.E, bPrint)) {         return true;       }       return doContext(IsoDirections.S, bPrint);     }     if (dir == IsoDirections.SW)     {       ly = 1.0F - ly;       if (ly < lx)       {         if (doContext(IsoDirections.S, bPrint)) {           return true;         }         return doContext(IsoDirections.W, bPrint);       }       if (doContext(IsoDirections.W, bPrint)) {         return true;       }       return doContext(IsoDirections.S, bPrint);     }     if (this.current != null)     {       if ((assumedDir == IsoDirections.N) &&         (this.current.Is(IsoFlagType.climbSheetN)) && (canClimbSheetRope(this.current)))       {         climbSheetRope();         return true;       }       if ((assumedDir == IsoDirections.S) &&         (this.current.Is(IsoFlagType.climbSheetS)) && (canClimbSheetRope(this.current)))       {         climbSheetRope();         return true;       }       if ((assumedDir == IsoDirections.W) &&         (this.current.Is(IsoFlagType.climbSheetW)) && (canClimbSheetRope(this.current)))       {         climbSheetRope();         return true;       }       if ((assumedDir == IsoDirections.E) &&         (this.current.Is(IsoFlagType.climbSheetE)) && (canClimbSheetRope(this.current)))       {         climbSheetRope();         return true;       }     }     IsoGridSquare checkForDoorsAndWindows = getCurrentSquare();     if (assumedDir == IsoDirections.S) {       checkForDoorsAndWindows = IsoWorld.instance.CurrentCell.getGridSquare(this.x, this.y + 1.0F, this.z);     } else if (assumedDir == IsoDirections.E) {       checkForDoorsAndWindows = IsoWorld.instance.CurrentCell.getGridSquare(this.x + 1.0F, this.y, this.z);     }     if (checkForDoorsAndWindows == null) {       return false;     }     IsoObject o = null;     if ((assumedDir == IsoDirections.S) || (assumedDir == IsoDirections.N))     {       o = checkForDoorsAndWindows.getDoorOrWindow(true);       if (o == null) {         o = checkForDoorsAndWindows.getWindowFrame(true);       }     }     else     {       o = checkForDoorsAndWindows.getDoorOrWindow(false);       if (o == null) {         o = checkForDoorsAndWindows.getWindowFrame(false);       }     }     if (o != null)     {       if ((o instanceof IsoDoor))       {         IsoDoor d = (IsoDoor)o;         if ((Keyboard.isKeyDown(42)) && (d.HasCurtains() != null) && (d.isFacingSheet(this)) && (this.ticksSincePressedMovement > PerformanceSettings.LockFPS / 2)) {           d.toggleCurtain();         } else if (!bPrint) {           d.ToggleDoor(this);         }       }       else if (((o instanceof IsoThumpable)) && (((IsoThumpable)o).isDoor()))       {         IsoThumpable d = (IsoThumpable)o;         if (!bPrint) {           d.ToggleDoor(this);         }       }       else if (((o instanceof IsoWindow)) && (!o.getSquare().getProperties().Is(IsoFlagType.makeWindowInvincible)))       {         IsoWindow d = (IsoWindow)o;         if (Keyboard.isKeyDown(42))         {           IsoCurtain curtain = d.HasCurtains();           if ((curtain != null) && (this.current != null) && (!curtain.getSquare().isBlockedTo(this.current))) {             curtain.ToggleDoor(this);           }         }         else if (this.timePressedContext >= 0.5F)         {           if (d.canClimbThrough(this))           {             if (!bPrint)             {               this.StateMachineParams.clear();               this.StateMachineParams.put(Integer.valueOf(0), d);               changeState(ClimbThroughWindowState.instance());             }           }           else if ((!d.PermaLocked) && (!d.isBarricaded())) {             if (!bPrint)             {               this.StateMachineParams.clear();               this.StateMachineParams.put(Integer.valueOf(0), d);               getStateMachine().changeState(OpenWindowState.instance());             }           }         }         else if ((d.Health > 0) && (!d.isDestroyed()))         {           if ((!d.open) && (!d.isBarricaded()))           {             if (!bPrint)             {               this.StateMachineParams.clear();               this.StateMachineParams.put(Integer.valueOf(0), d);               getStateMachine().changeState(OpenWindowState.instance());             }           }           else if (!bPrint) {             d.ToggleWindow(this);           }         }         else         {           if (!isSafeToClimbOver(assumedDir)) {             return true;           }           if ((!bPrint) && (!d.isBarricaded()))           {             this.StateMachineParams.clear();             this.StateMachineParams.put(Integer.valueOf(0), d);             changeState(ClimbThroughWindowState.instance());           }           else           {             printString = "Climb through";           }         }       }       else if (((o instanceof IsoThumpable)) && (!o.getSquare().getProperties().Is(IsoFlagType.makeWindowInvincible)))       {         IsoThumpable d = (IsoThumpable)o;         if (Keyboard.isKeyDown(42))         {           IsoCurtain curtain = d.HasCurtains();           if ((curtain != null) && (this.current != null) && (!curtain.getSquare().isBlockedTo(this.current))) {             curtain.ToggleDoor(this);           }         }         else if (this.timePressedContext >= 0.5F)         {           if (!d.isBarricaded()) {             if (!bPrint)             {               this.StateMachineParams.clear();               this.StateMachineParams.put(Integer.valueOf(0), d);               changeState(ClimbThroughWindowState.instance());             }           }         }         else         {           if (!isSafeToClimbOver(assumedDir)) {             return false;           }           if ((!bPrint) && (!d.isBarricaded()))           {             this.StateMachineParams.clear();             this.StateMachineParams.put(Integer.valueOf(0), d);             changeState(ClimbThroughWindowState.instance());           }           else           {             printString = "Climb through";           }         }       }       else if ((IsoWindowFrame.isWindowFrame(o)) &&         ((this.timePressedContext >= 0.5F) || (isSafeToClimbOver(assumedDir))) &&         (!bPrint))       {         this.StateMachineParams.clear();         this.StateMachineParams.put(Integer.valueOf(0), o);         changeState(ClimbThroughWindowState.instance());       }       return true;     }     if ((Keyboard.isKeyDown(42)) && (this.current != null) && (this.ticksSincePressedMovement > PerformanceSettings.LockFPS / 2))     {       IsoObject doorN = this.current.getDoor(true);       if (((doorN instanceof IsoDoor)) && (((IsoDoor)doorN).isFacingSheet(this)))       {         ((IsoDoor)doorN).toggleCurtain();         return true;       }       IsoObject doorW = this.current.getDoor(false);       if (((doorW instanceof IsoDoor)) && (((IsoDoor)doorW).isFacingSheet(this)))       {         ((IsoDoor)doorW).toggleCurtain();         return true;       }       if (assumedDir == IsoDirections.E)       {         checkForDoorsAndWindows = IsoWorld.instance.CurrentCell.getGridSquare(this.x + 1.0F, this.y, this.z);         IsoObject doorE = checkForDoorsAndWindows != null ? checkForDoorsAndWindows.getDoor(true) : null;         if (((doorE instanceof IsoDoor)) && (((IsoDoor)doorE).isFacingSheet(this)))         {           ((IsoDoor)doorE).toggleCurtain();           return true;         }       }       if (assumedDir == IsoDirections.S)       {         checkForDoorsAndWindows = IsoWorld.instance.CurrentCell.getGridSquare(this.x, this.y + 1.0F, this.z);         IsoObject doorS = checkForDoorsAndWindows != null ? checkForDoorsAndWindows.getDoor(false) : null;         if (((doorS instanceof IsoDoor)) && (((IsoDoor)doorS).isFacingSheet(this)))         {           ((IsoDoor)doorS).toggleCurtain();           return true;         }       }     }     if ((this.timePressedContext < 0.5F) && (!isSafeToClimbOver(assumedDir))) {       return false;     }     if ((assumedDir == IsoDirections.N) && (getCurrentSquare().Is(IsoFlagType.HoppableN)))     {       this.StateMachineParams.clear();       this.StateMachineParams.put(Integer.valueOf(0), assumedDir);       changeState(ClimbOverFenceState.instance());       return true;     }     if ((assumedDir == IsoDirections.W) && (getCurrentSquare().Is(IsoFlagType.HoppableW)))     {       this.StateMachineParams.clear();       this.StateMachineParams.put(Integer.valueOf(0), assumedDir);       changeState(ClimbOverFenceState.instance());       return true;     }     if ((assumedDir == IsoDirections.S) && (IsoWorld.instance.CurrentCell.getGridSquare(this.x, this.y + 1.0F, this.z) != null) && (IsoWorld.instance.CurrentCell.getGridSquare(this.x, this.y + 1.0F, this.z).Is(IsoFlagType.HoppableN)))     {       this.StateMachineParams.clear();       this.StateMachineParams.put(Integer.valueOf(0), assumedDir);       changeState(ClimbOverFenceState.instance());       return true;     }     if ((assumedDir == IsoDirections.E) && (IsoWorld.instance.CurrentCell.getGridSquare(this.x + 1.0F, this.y, this.z) != null) && (IsoWorld.instance.CurrentCell.getGridSquare(this.x + 1.0F, this.y, this.z).Is(IsoFlagType.HoppableW)))     {       this.StateMachineParams.clear();       this.StateMachineParams.put(Integer.valueOf(0), assumedDir);       changeState(ClimbOverFenceState.instance());       return true;     }     return false;   }     public boolean hopFence(IsoDirections dir, boolean bTest)   {     IsoDirections assumedDir = dir;          float lx = this.x - (int)this.x;     float ly = this.y - (int)this.y;     if (dir == IsoDirections.NW)     {       if (ly < lx)       {         if (hopFence(IsoDirections.N, bTest)) {           return true;         }         return hopFence(IsoDirections.W, bTest);       }       if (hopFence(IsoDirections.W, bTest)) {         return true;       }       return hopFence(IsoDirections.N, bTest);     }     if (dir == IsoDirections.NE)     {       lx = 1.0F - lx;       if (ly < lx)       {         if (hopFence(IsoDirections.N, bTest)) {           return true;         }         return hopFence(IsoDirections.E, bTest);       }       if (hopFence(IsoDirections.E, bTest)) {         return true;       }       return hopFence(IsoDirections.N, bTest);     }     if (dir == IsoDirections.SE)     {       lx = 1.0F - lx;       ly = 1.0F - ly;       if (ly < lx)       {         if (hopFence(IsoDirections.S, bTest)) {           return true;         }         return hopFence(IsoDirections.E, bTest);       }       if (hopFence(IsoDirections.E, bTest)) {         return true;       }       return hopFence(IsoDirections.S, bTest);     }     if (dir == IsoDirections.SW)     {       ly = 1.0F - ly;       if (ly < lx)       {         if (hopFence(IsoDirections.S, bTest)) {           return true;         }         return hopFence(IsoDirections.W, bTest);       }       if (hopFence(IsoDirections.W, bTest)) {         return true;       }       return hopFence(IsoDirections.S, bTest);     }     if ((assumedDir == IsoDirections.N) && (getCurrentSquare().Is(IsoFlagType.HoppableN)))     {       if (bTest) {         return true;       }       this.StateMachineParams.clear();       this.StateMachineParams.put(Integer.valueOf(0), assumedDir);       changeState(ClimbOverFenceState.instance());       return true;     }     if ((assumedDir == IsoDirections.W) && (getCurrentSquare().Is(IsoFlagType.HoppableW)))     {       if (bTest) {         return true;       }       this.StateMachineParams.clear();       this.StateMachineParams.put(Integer.valueOf(0), assumedDir);       changeState(ClimbOverFenceState.instance());       return true;     }     if ((assumedDir == IsoDirections.S) && (IsoWorld.instance.CurrentCell.getGridSquare(this.x, this.y + 1.0F, this.z) != null) && (IsoWorld.instance.CurrentCell.getGridSquare(this.x, this.y + 1.0F, this.z).Is(IsoFlagType.HoppableN)))     {       if (bTest) {         return true;       }       this.StateMachineParams.clear();       this.StateMachineParams.put(Integer.valueOf(0), assumedDir);       changeState(ClimbOverFenceState.instance());       return true;     }     if ((assumedDir == IsoDirections.E) && (IsoWorld.instance.CurrentCell.getGridSquare(this.x + 1.0F, this.y, this.z) != null) && (IsoWorld.instance.CurrentCell.getGridSquare(this.x + 1.0F, this.y, this.z).Is(IsoFlagType.HoppableW)))     {       if (bTest) {         return true;       }       this.StateMachineParams.clear();       this.StateMachineParams.put(Integer.valueOf(0), assumedDir);       changeState(ClimbOverFenceState.instance());       return true;     }     return false;   }     static String printString = "";   public static IsoPlayer[] players = new IsoPlayer[4];   public int JoypadBind = -1;     private void updateSleepingPillsTaken()   {     if ((getSleepingPillsTaken() > 0) && (this.lastPillsTaken > 0L) && (GameTime.instance.Calender.getTimeInMillis() - this.lastPillsTaken > 7200000L)) {       setSleepingPillsTaken(getSleepingPillsTaken() - 1);     }   }     public boolean AttemptAttack()   {     return DoAttack(this.useChargeTime);   }     public float useChargeDelta = 0.0F;     public boolean DoAttack(float chargeDelta)   {     return DoAttack(chargeDelta, false, null);   }     public boolean DoAttack(float chargeDelta, boolean forceShove, String clickSound)   {     setForceShove(forceShove);     setClickSound(clickSound);     if ((this.stateMachine.getCurrent() == SwipeStatePlayer.instance()) || (getRecoilDelay() > 0.0F)) {       return false;     }     if (forceShove) {       chargeDelta *= 2.0F;     }     if (chargeDelta > 90.0F) {       chargeDelta = 90.0F;     }     chargeDelta /= 25.0F;          this.useChargeDelta = chargeDelta;     if ((this instanceof IsoPlayer)) {       this.FakeAttack = false;     }     if ((this.Health <= 0.0F) || (this.BodyDamage.getHealth() < 0.0F)) {       return false;     }     if (((this.AttackDelay <= 0.0F) && ((!this.sprite.CurrentAnim.name.contains("Attack")) || (this.def.Frame >= this.sprite.CurrentAnim.Frames.size() - 1))) || (this.def.Frame == 0.0F))     {       InventoryItem attackItem = this.leftHandItem;       if ((attackItem == null) || (!(attackItem instanceof HandWeapon)) || (forceShove)) {         attackItem = this.bareHands;       }       if ((attackItem instanceof HandWeapon))       {         this.useHandWeapon = ((HandWeapon)attackItem);                  int moodleLevel = this.Moodles.getMoodleLevel(MoodleType.Endurance);         if ((this.useHandWeapon.isCantAttackWithLowestEndurance()) && (moodleLevel == 4)) {           return false;         }         if ((this.PlayerIndex == 0) && (this.JoypadBind == -1) && (UIManager.getPicked() != null))         {           this.attackTargetSquare = UIManager.getPicked().square;           if ((UIManager.getPicked().tile instanceof IsoMovingObject)) {             this.attackTargetSquare = ((IsoMovingObject)UIManager.getPicked().tile).getCurrentSquare();           }         }         if (this.useHandWeapon.getOtherHandRequire() != null) {           if ((this.rightHandItem == null) || (!this.rightHandItem.getType().equals(this.useHandWeapon.getOtherHandRequire()))) {             return false;           }         }         float val = this.useHandWeapon.getSwingTime();         if ((this.useHandWeapon.isCantAttackWithLowestEndurance()) && (moodleLevel == 4)) {           return false;         }         if (this.useHandWeapon.isUseEndurance()) {           switch (moodleLevel)           {           case 1:             val *= 1.1F;             break;           case 2:             val *= 1.2F;             break;           case 3:             val *= 1.3F;             break;           case 4:             val *= 1.4F;           }         }         if (val < this.useHandWeapon.getMinimumSwingTime()) {           val = this.useHandWeapon.getMinimumSwingTime();         }         val *= this.useHandWeapon.getSpeedMod(this);                  val *= 1.0F / GameTime.instance.getMultiplier();         if ((HasTrait("PlaysBaseball")) && (this.useHandWeapon.getType().contains("Baseball"))) {           val *= 0.8F;         }         this.AttackDelayMax = (this.AttackDelay = val * GameTime.instance.getMultiplier() * 0.6F);                  this.AttackDelayUse = (this.AttackDelayMax * this.useHandWeapon.getDoSwingBeforeImpact());         if (this.AttackDelayUse == 0.0F) {           this.AttackDelayUse = 0.2F;         }         this.AttackDelay = 0.0F;                  this.AttackWasSuperAttack = this.superAttack;         if (this.stateMachine.getCurrent() != SwipeStatePlayer.instance())         {           setRecoilDelay(this.useHandWeapon.getRecoilDelay() - getPerkLevel(PerkFactory.Perks.Aiming) * 2);           if (forceShove) {             setRecoilDelay(10.0F);           }           this.stateMachine.changeState(SwipeStatePlayer.instance());         }         if (this.useHandWeapon.isUseSelf()) {           if (this.leftHandItem != null) {             this.leftHandItem.Use();           }         }         if (this.useHandWeapon.isOtherHandUse()) {           if (this.rightHandItem != null) {             this.rightHandItem.Use();           }         }         return true;       }     }     return false;   }     protected int timeSinceLastStab = 0;   protected Stack<IsoMovingObject> LastSpotted = new Stack();     public int getPlayerNum()   {     return this.PlayerIndex;   }     public void updateLOS()   {     this.spottedList.clear();          this.stats.NumVisibleZombies = 0;     this.stats.LastNumChasingZombies = this.stats.NumChasingZombies;     this.stats.NumChasingZombies = 0;          int close = 0;          this.NumSurvivorsInVicinity = 0;     int s = getCell().getObjectList().size();     for (int n = 0; n < s; n++)     {       IsoMovingObject chr = (IsoMovingObject)getCell().getObjectList().get(n);       if (!(chr instanceof IsoPhysicsObject)) {         if (chr == this)         {           this.spottedList.add(chr);         }         else         {           float dist = IsoUtils.DistanceManhatten(chr.getX(), chr.getY(), getX(), getY());           if (dist < 20.0F) {             close++;           }           if (chr.getCurrentSquare() != null)           {             if (getCurrentSquare() == null) {               return;             }             boolean couldSee = GameServer.bServer ? ServerLOS.instance.isCouldSee(this, chr.getCurrentSquare()) : chr.getCurrentSquare().isCouldSee(this.PlayerIndex);             boolean canSee = GameServer.bServer ? couldSee : chr.getCurrentSquare().isCanSee(this.PlayerIndex);             if ((canSee) || ((dist < 2.5F) && (couldSee)))             {               TestZombieSpotPlayer(chr);               if (((chr instanceof IsoGameCharacter)) && (((IsoGameCharacter)chr).SpottedSinceAlphaZero[this.PlayerIndex] != 0))               {                 if ((chr instanceof IsoSurvivor)) {                   this.NumSurvivorsInVicinity += 1;                 }                 if ((chr instanceof IsoZombie))                 {                   this.lastSeenZombieTime = 0.0D;                   if ((chr.getZ() >= getZ() - 1.0F) && (dist < 7.0F) && (!((IsoZombie)chr).Ghost) && (!((IsoZombie)chr).isFakeDead()) && (chr.getCurrentSquare().getRoom() == getCurrentSquare().getRoom()))                   {                     this.TicksSinceSeenZombie = 0;                     this.stats.NumVisibleZombies += 1;                   }                 }                 this.spottedList.add(chr);                 chr.targetAlpha[getPlayerIndex()] = 1.0F;                                  float maxdist = 4.0F;                 if (this.stats.NumVisibleZombies > 4) {                   maxdist = 7.0F;                 }                 if ((dist < maxdist * 2.0F) && ((chr instanceof IsoZombie)) && ((int)chr.getZ() == (int)getZ())) {                   if ((!this.GhostMode) && (!GameClient.bClient))                   {                     GameTime.instance.setMultiplier(1.0F);                     UIManager.getSpeedControls().SetCurrentGameSpeed(1);                   }                 }                 if ((dist < maxdist) && ((chr instanceof IsoZombie)) && ((int)chr.getZ() == (int)getZ())) {                   if (!this.LastSpotted.contains(chr)) {                     this.stats.NumVisibleZombies += 2;                   }                 }               }               else               {                 chr.targetAlpha[getPlayerIndex()] = 1.0F;               }             }             else             {               if (chr != instance) {                 chr.targetAlpha[getPlayerIndex()] = 0.0F;               }               if (couldSee) {                 TestZombieSpotPlayer(chr);               }             }             if (this.GhostMode) {               chr.alpha[getPlayerIndex()] = (chr.targetAlpha[getPlayerIndex()] = 1.0F);             }             if (((chr instanceof IsoGameCharacter)) && (((IsoGameCharacter)chr).invisible) && (!this.admin)) {               chr.alpha[getPlayerIndex()] = (chr.targetAlpha[getPlayerIndex()] = 0.0F);             }           }         }       }     }     if ((!isDead()) && (this.stats.NumVisibleZombies > 0) && (this.timeSinceLastStab <= 0))     {       this.timeSinceLastStab = 1800;       getEmitter().playSoundImpl("stab", null);     }     this.timeSinceLastStab -= 1;          float del = close / 20.0F;     if (del > 1.0F) {       del = 1.0F;     }     del *= 0.6F;          SoundManager.instance.BlendVolume(MainScreenState.ambient, del);          int actualSpotted = 0;     for (int n = 0; n < this.spottedList.size(); n++)     {       if (!this.LastSpotted.contains(this.spottedList.get(n))) {         this.LastSpotted.add(this.spottedList.get(n));       }       if ((this.spottedList.get(n) instanceof IsoZombie)) {         actualSpotted++;       }     }     if ((this.ClearSpottedTimer <= 0) && (actualSpotted == 0))     {       this.LastSpotted.clear();       this.ClearSpottedTimer = 1000;     }     else     {       this.ClearSpottedTimer -= 1;     }   }     protected int ClearSpottedTimer = -1;     void DoHotKey(int n, int key)   {     if (GameKeyboard.isKeyDown(key)) {       if ((GameKeyboard.isKeyDown(42)) && (GameKeyboard.isKeyDown(29)))       {         UIManager.setDoMouseControls(true);         if (this.leftHandItem != null) {           this.MainHot[n] = this.leftHandItem.getType();         } else {           this.MainHot[n] = null;         }         if (this.rightHandItem != null) {           this.SecHot[n] = this.rightHandItem.getType();         } else {           this.SecHot[n] = null;         }       }       else       {         this.leftHandItem = this.inventory.FindAndReturn(this.MainHot[n]);         this.rightHandItem = this.inventory.FindAndReturn(this.SecHot[n]);       }     }   }     public boolean DebounceA = false;     private void PressedA()   {     IsoObject inter = getInteract();     if (inter != null)     {       if ((inter instanceof IsoDoor)) {         ((IsoDoor)inter).ToggleDoor(this);       }       if ((inter instanceof IsoThumpable)) {         ((IsoThumpable)inter).ToggleDoor(this);       }       if (inter.container != null) {         inter.onMouseLeftClick(0, 0);       }     }     this.DebounceA = true;   }     public void saveGame() {}     public int getAngleCounter()   {     return this.angleCounter;   }     public void setAngleCounter(int angleCounter)   {     this.angleCounter = angleCounter;   }     public Vector2 getLastAngle()   {     return this.lastAngle;   }     public void setLastAngle(Vector2 lastAngle)   {     this.lastAngle = lastAngle;   }     public int getDialogMood()   {     return this.DialogMood;   }     public void setDialogMood(int DialogMood)   {     this.DialogMood = DialogMood;   }     public int getPing()   {     return this.ping;   }     public void setPing(int ping)   {     this.ping = ping;   }     public boolean isFakeAttack()   {     return this.FakeAttack;   }     public void setFakeAttack(boolean FakeAttack)   {     this.FakeAttack = FakeAttack;   }     public IsoObject getFakeAttackTarget()   {     return this.FakeAttackTarget;   }     public void setFakeAttackTarget(IsoObject FakeAttackTarget)   {     this.FakeAttackTarget = FakeAttackTarget;   }     public IsoMovingObject getDragObject()   {     return this.DragObject;   }     public void setDragObject(IsoMovingObject DragObject)   {     this.DragObject = DragObject;   }     public float getAsleepTime()   {     return this.AsleepTime;   }     public void setAsleepTime(float AsleepTime)   {     this.AsleepTime = AsleepTime;   }     public String[] getMainHot()   {     return this.MainHot;   }     public void setMainHot(String[] MainHot)   {     this.MainHot = MainHot;   }     public String[] getSecHot()   {     return this.SecHot;   }     public void setSecHot(String[] SecHot)   {     this.SecHot = SecHot;   }     public Stack<IsoMovingObject> getSpottedList()   {     return this.spottedList;   }     public void setSpottedList(Stack<IsoMovingObject> spottedList)   {     this.spottedList = spottedList;   }     public int getTicksSinceSeenZombie()   {     return this.TicksSinceSeenZombie;   }     public void setTicksSinceSeenZombie(int TicksSinceSeenZombie)   {     this.TicksSinceSeenZombie = TicksSinceSeenZombie;   }     public boolean isWaiting()   {     return this.Waiting;   }     public void setWaiting(boolean Waiting)   {     this.Waiting = Waiting;   }     public IsoSurvivor getDragCharacter()   {     return this.DragCharacter;   }     public void setDragCharacter(IsoSurvivor DragCharacter)   {     this.DragCharacter = DragCharacter;   }     public Stack<Vector2> getLastPos()   {     return this.lastPos;   }     public void setLastPos(Stack<Vector2> lastPos)   {     this.lastPos = lastPos;   }     public boolean isbDebounceLMB()   {     return this.bDebounceLMB;   }     public void setbDebounceLMB(boolean bDebounceLMB)   {     this.bDebounceLMB = bDebounceLMB;   }     public float getHeartDelay()   {     return this.heartDelay;   }     public void setHeartDelay(float heartDelay)   {     this.heartDelay = heartDelay;   }     public float getHeartDelayMax()   {     return this.heartDelayMax;   }     public void setHeartDelayMax(int heartDelayMax)   {     this.heartDelayMax = heartDelayMax;   }     public double getHoursSurvived()   {     return this.HoursSurvived;   }     public void setHoursSurvived(double hrs)   {     this.HoursSurvived = hrs;   }     public String getTimeSurvived()   {     String total = "";     int hours = (int)getHoursSurvived();     int hoursLeft = hours;     int days = hours / 24;     hoursLeft = hours % 24;          int months = days / 30;     days %= 30;          int years = months / 12;     months %= 12;          String dayString = Translator.getText("IGUI_Gametime_day");     String yearString = Translator.getText("IGUI_Gametime_year");     String hourString = Translator.getText("IGUI_Gametime_hour");     String monthString = Translator.getText("IGUI_Gametime_month");     if (years != 0)     {       if (years > 1) {         yearString = Translator.getText("IGUI_Gametime_years");       }       if (total.length() > 0) {         total = total + ", ";       }       total = total + years + " " + yearString;     }     if (months != 0)     {       if (months > 1) {         monthString = Translator.getText("IGUI_Gametime_months");       }       if (total.length() > 0) {         total = total + ", ";       }       total = total + months + " " + monthString;     }     if (days != 0)     {       if (days > 1) {         dayString = Translator.getText("IGUI_Gametime_days");       }       if (total.length() > 0) {         total = total + ", ";       }       total = total + days + " " + dayString;     }     if (hoursLeft != 0)     {       if (hoursLeft > 1) {         hourString = Translator.getText("IGUI_Gametime_hours");       }       if (total.length() > 0) {         total = total + ", ";       }       total = total + hoursLeft + " " + hourString;     }     if (total.isEmpty())     {       int minutes = (int)(this.HoursSurvived * 60.0D);       total = minutes + " " + Translator.getText("IGUI_Gametime_minutes");     }     return total;   }     public float getDrunkOscilatorStepSin()   {     return this.DrunkOscilatorStepSin;   }     public void setDrunkOscilatorStepSin(float DrunkOscilatorStepSin)   {     this.DrunkOscilatorStepSin = DrunkOscilatorStepSin;   }     public float getDrunkOscilatorRateSin()   {     return this.DrunkOscilatorRateSin;   }     public void setDrunkOscilatorRateSin(float DrunkOscilatorRateSin)   {     this.DrunkOscilatorRateSin = DrunkOscilatorRateSin;   }     public float getDrunkOscilatorStepCos()   {     return this.DrunkOscilatorStepCos;   }     public void setDrunkOscilatorStepCos(float DrunkOscilatorStepCos)   {     this.DrunkOscilatorStepCos = DrunkOscilatorStepCos;   }     public float getDrunkOscilatorRateCos()   {     return this.DrunkOscilatorRateCos;   }     public void setDrunkOscilatorRateCos(float DrunkOscilatorRateCos)   {     this.DrunkOscilatorRateCos = DrunkOscilatorRateCos;   }     public float getDrunkOscilatorStepCos2()   {     return this.DrunkOscilatorStepCos2;   }     public void setDrunkOscilatorStepCos2(float DrunkOscilatorStepCos2)   {     this.DrunkOscilatorStepCos2 = DrunkOscilatorStepCos2;   }     public float getDrunkOscilatorRateCos2()   {     return this.DrunkOscilatorRateCos2;   }     public void setDrunkOscilatorRateCos2(float DrunkOscilatorRateCos2)   {     this.DrunkOscilatorRateCos2 = DrunkOscilatorRateCos2;   }     public float getDrunkSin()   {     return this.DrunkSin;   }     public void setDrunkSin(float DrunkSin)   {     this.DrunkSin = DrunkSin;   }     public float getDrunkCos()   {     return this.DrunkCos;   }     public void setDrunkCos(float DrunkCos)   {     this.DrunkCos = DrunkCos;   }     public float getDrunkCos2()   {     return this.DrunkCos2;   }     public void setDrunkCos2(float DrunkCos2)   {     this.DrunkCos2 = DrunkCos2;   }     public float getMinOscilatorRate()   {     return this.MinOscilatorRate;   }     public void setMinOscilatorRate(float MinOscilatorRate)   {     this.MinOscilatorRate = MinOscilatorRate;   }     public float getMaxOscilatorRate()   {     return this.MaxOscilatorRate;   }     public void setMaxOscilatorRate(float MaxOscilatorRate)   {     this.MaxOscilatorRate = MaxOscilatorRate;   }     public float getDesiredSinRate()   {     return this.DesiredSinRate;   }     public void setDesiredSinRate(float DesiredSinRate)   {     this.DesiredSinRate = DesiredSinRate;   }     public float getDesiredCosRate()   {     return this.DesiredCosRate;   }     public void setDesiredCosRate(float DesiredCosRate)   {     this.DesiredCosRate = DesiredCosRate;   }     public float getOscilatorChangeRate()   {     return this.OscilatorChangeRate;   }     public void setOscilatorChangeRate(float OscilatorChangeRate)   {     this.OscilatorChangeRate = OscilatorChangeRate;   }     public float getMaxWeightDelta()   {     return this.maxWeightDelta;   }     public void setMaxWeightDelta(float maxWeightDelta)   {     this.maxWeightDelta = maxWeightDelta;   }     public String getForname()   {     return this.Forname;   }     public void setForname(String Forname)   {     this.Forname = Forname;   }     public String getSurname()   {     return this.Surname;   }     public void setSurname(String Surname)   {     this.Surname = Surname;   }     public IsoSprite getGuardModeUISprite()   {     return this.GuardModeUISprite;   }     public void setGuardModeUISprite(IsoSprite GuardModeUISprite)   {     this.GuardModeUISprite = GuardModeUISprite;   }     public int getGuardModeUI()   {     return this.GuardModeUI;   }     public void setGuardModeUI(int GuardModeUI)   {     this.GuardModeUI = GuardModeUI;   }     public IsoSurvivor getGuardChosen()   {     return this.GuardChosen;   }     public void setGuardChosen(IsoSurvivor GuardChosen)   {     this.GuardChosen = GuardChosen;   }     public IsoGridSquare getGuardStand()   {     return this.GuardStand;   }     public void setGuardStand(IsoGridSquare GuardStand)   {     this.GuardStand = GuardStand;   }     public IsoGridSquare getGuardFace()   {     return this.GuardFace;   }     public void setGuardFace(IsoGridSquare GuardFace)   {     this.GuardFace = GuardFace;   }     public boolean isbSneaking()   {     return this.bSneaking;   }     public void setbSneaking(boolean bSneaking)   {     this.bSneaking = bSneaking;   }     public boolean isbChangeCharacterDebounce()   {     return this.bChangeCharacterDebounce;   }     public void setbChangeCharacterDebounce(boolean bChangeCharacterDebounce)   {     this.bChangeCharacterDebounce = bChangeCharacterDebounce;   }     public int getFollowID()   {     return this.followID;   }     public void setFollowID(int followID)   {     this.followID = followID;   }     public boolean isbSeenThisFrame()   {     return this.bSeenThisFrame;   }     public void setbSeenThisFrame(boolean bSeenThisFrame)   {     this.bSeenThisFrame = bSeenThisFrame;   }     public boolean isbCouldBeSeenThisFrame()   {     return this.bCouldBeSeenThisFrame;   }     public void setbCouldBeSeenThisFrame(boolean bCouldBeSeenThisFrame)   {     this.bCouldBeSeenThisFrame = bCouldBeSeenThisFrame;   }     public int getTimeSinceLastStab()   {     return this.timeSinceLastStab;   }     public void setTimeSinceLastStab(int timeSinceLastStab)   {     this.timeSinceLastStab = timeSinceLastStab;   }     public Stack<IsoMovingObject> getLastSpotted()   {     return this.LastSpotted;   }     public void setLastSpotted(Stack<IsoMovingObject> LastSpotted)   {     this.LastSpotted = LastSpotted;   }     public int getClearSpottedTimer()   {     return this.ClearSpottedTimer;   }     public void setClearSpottedTimer(int ClearSpottedTimer)   {     this.ClearSpottedTimer = ClearSpottedTimer;   }     public boolean IsRunning()   {     return this.bRunning;   }     public void InitSpriteParts()   {     SurvivorDesc desc = this.descriptor;     InitSpriteParts(desc, desc.legs, desc.torso, desc.head, desc.top, desc.bottoms, desc.shoes, desc.skinpal, desc.toppal, desc.bottomspal, desc.shoespal, desc.hair, desc.extra);   }     public boolean IsAiming()   {     return this.isAiming;   }     public boolean IsUsingAimWeapon()   {     if (this.leftHandItem == null) {       return false;     }     if (!(this.leftHandItem instanceof HandWeapon)) {       return false;     }     if (!this.isAiming) {       return false;     }     if (!((HandWeapon)this.leftHandItem).bIsAimedFirearm) {       return false;     }     return true;   }     private boolean IsUsingAimHandWeapon()   {     if (this.leftHandItem == null) {       return false;     }     if (!(this.leftHandItem instanceof HandWeapon)) {       return false;     }     if (!this.isAiming) {       return false;     }     if (!((HandWeapon)this.leftHandItem).bIsAimedHandWeapon) {       return false;     }     return true;   }     private boolean DoAimAnimOnAiming()   {     if (IsUsingAimWeapon()) {       return true;     }     return false;   }     public int getSleepingPillsTaken()   {     return this.sleepingPillsTaken;   }     public void setSleepingPillsTaken(int sleepingPillsTaken)   {     this.sleepingPillsTaken = sleepingPillsTaken;     if (getStats().Drunkenness > 10.0F) {       this.sleepingPillsTaken += 1;     }     this.lastPillsTaken = GameTime.instance.Calender.getTimeInMillis();   }     public boolean isOutside()   {     if ((getCurrentSquare() != null) && (getCurrentSquare().getRoom() == null)) {       return true;     }     return false;   }     double lastSeenZombieTime = 2.0D;   public int PlayerIndex = 0;     public double getLastSeenZomboidTime()   {     return this.lastSeenZombieTime;   }     public float getPlayerClothingTemperature()   {     float result = 0.0F;     if (getClothingItem_Feet() != null) {       result += ((Clothing)getClothingItem_Feet()).getTemperature();     }     if (getClothingItem_Hands() != null) {       result += ((Clothing)getClothingItem_Hands()).getTemperature();     }     if (getClothingItem_Head() != null) {       result += ((Clothing)getClothingItem_Head()).getTemperature();     }     if (getClothingItem_Legs() != null) {       result += ((Clothing)getClothingItem_Legs()).getTemperature();     }     if (getClothingItem_Torso() != null) {       result += ((Clothing)getClothingItem_Torso()).getTemperature();     }     return result;   }     public boolean mpTorchCone = false;   public float mpTorchDist = 0.0F;   public float mpTorchStrength = 0.0F;     public boolean isTorchCone()   {     if (this.bRemote) {       return this.mpTorchCone;     }     if ((this.leftHandItem != null) && (this.leftHandItem.isTorchCone())) {       return true;     }     if ((this.rightHandItem != null) && (this.rightHandItem.isTorchCone())) {       return true;     }     return false;   }     public float getLightDistance()   {     if (this.bRemote) {       return this.mpTorchDist;     }     if ((this.leftHandItem != null) && (this.leftHandItem.getLightDistance() > 0)) {       return this.leftHandItem.getLightDistance();     }     if ((this.rightHandItem != null) && (this.rightHandItem.getLightDistance() > 0)) {       return this.rightHandItem.getLightDistance();     }     return 0.0F;   }     public boolean pressedMovement()   {     if ((this.PlayerIndex == 0) && (       (GameKeyboard.isKeyDown(Core.getInstance().getKey(leftStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(rightStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(forwardStr))) || (GameKeyboard.isKeyDown(Core.getInstance().getKey(backwardStr))))) {       return true;     }     if (this.JoypadBind != -1)     {       float yVal = JoypadManager.instance.getMovementAxisY(this.JoypadBind);       float xVal = JoypadManager.instance.getMovementAxisX(this.JoypadBind);       if ((Math.abs(yVal) > 0.1F) || (Math.abs(xVal) > 0.1F)) {         return true;       }     }     return false;   }     public boolean pressedAim()   {     if (this.PlayerIndex == 0)     {       if (GameKeyboard.isKeyDown(Core.getInstance().getKey("Aim"))) {         return true;       }       if (Mouse.isButtonDownUICheck(1)) {         return true;       }     }     if (this.JoypadBind != -1)     {       float yVal = JoypadManager.instance.getAimingAxisY(this.JoypadBind);       float xVal = JoypadManager.instance.getAimingAxisX(this.JoypadBind);       if ((Math.abs(yVal) > 0.1F) || (Math.abs(xVal) > 0.1F)) {         return true;       }     }     return false;   }     public static int assumedPlayer = 0;   public static int numPlayers = 1;   public int OnlineID = 1;   public int OnlineChunkGridWidth;   public boolean bJoypadMovementActive = true;   private long steamID;     public static int getPlayerIndex()   {     if (instance == null) {       return assumedPlayer;     }     return instance.PlayerIndex;   }     public void setSteamID(long steamID)   {     this.steamID = steamID;   }     public long getSteamID()   {     return this.steamID;   }     public static boolean allPlayersDead()   {     for (int n = 0; n < numPlayers; n++) {       if ((players[n] != null) && (!players[n].isDead())) {         return false;       }     }     if ((IsoWorld.instance != null) && (!IsoWorld.instance.AddCoopPlayers.isEmpty())) {       return false;     }     return true;   }     public static ArrayList<IsoPlayer> getPlayers()   {     return new ArrayList(Arrays.asList(players));   }     public boolean targetedByZombie = false;   public float lastTargeted = 1.0E8F;   public float TimeSinceOpenDoor;   public boolean bRemote;   public int TimeSinceLastNetData = 0;   public boolean admin = false;     public boolean isTargetedByZombie()   {     return this.targetedByZombie;   }     public boolean isMaskClicked(int x, int y, boolean flip)   {     if (this.sprite == null) {       return false;     }     return this.sprite.isMaskClicked(this.dir, x, y, flip);   }     public int getOffSetXUI()   {     return this.offSetXUI;   }     public void setOffSetXUI(int offSetXUI)   {     this.offSetXUI = offSetXUI;   }     public int getOffSetYUI()   {     return this.offSetYUI;   }     public void setOffSetYUI(int offSetYUI)   {     this.offSetYUI = offSetYUI;   }     public String getUsername()   {     return this.username;   }     public int getOnlineID()   {     return this.OnlineID;   }     public boolean isLocalPlayer()   {     for (int pn = 0; pn < numPlayers; pn++) {       if (players[pn] == this) {         return true;       }     }     return false;   }     public boolean isOnlyPlayerAsleep()   {     if (!isAsleep()) {       return false;     }     for (int pn = 0; pn < numPlayers; pn++) {       if ((players[pn] != null) && (!players[pn].isDead()) && (players[pn] != this) && (players[pn].isAsleep())) {         return false;       }     }     return true;   }     public static boolean allPlayersAsleep()   {     int numLiving = 0;int numSleeping = 0;     for (int pn = 0; pn < numPlayers; pn++) {       if ((players[pn] != null) && (!players[pn].isDead()))       {         numLiving++;         if ((players[pn] != null) && (players[pn].isAsleep())) {           numSleeping++;         }       }     }     return (numLiving > 0) && (numLiving == numSleeping);   }     public void OnDeath()   {     super.OnDeath();     if (GameServer.bServer) {       return;     }     StopAllActionQueue();     if ((!GameClient.bClient) || (isLocalPlayer())) {       dropHandItems();     }     if (isLocalPlayer()) {       SoundManager.instance.PlaySound("deathcrash", false, 0.8F);     }     if (allPlayersDead()) {       SoundManager.instance.playMusic("tunedeath");     }     if (isLocalPlayer()) {       LuaEventManager.triggerEvent("OnPlayerDeath", this);     }     removeSaveFile();     if (shouldBecomeZombieAfterDeath()) {       forceAwake();     }     getMoodles().Update();          getCell().setDrag(null, getPlayerNum());   }     public boolean isNoClip()   {     return this.noClip;   }     public void setNoClip(boolean noClip)   {     this.noClip = noClip;   }     public static boolean getCoopPVP()   {     return CoopPVP;   }     public static void setCoopPVP(boolean enabled)   {     CoopPVP = enabled;   }     public void setAuthorizeMeleeAction(boolean enabled)   {     this.authorizeMeleeAction = enabled;   }     public boolean isBlockMovement()   {     return this.blockMovement;   }     public void setBlockMovement(boolean blockMovement)   {     this.blockMovement = blockMovement;   }     public void startReceivingBodyDamageUpdates(IsoPlayer other)   {     if ((GameClient.bClient) && (other != null) && (other != this) && (isLocalPlayer()) && (!other.isLocalPlayer()))     {       other.resetBodyDamageRemote();       BodyDamageSync.instance.startReceivingUpdates(other.getOnlineID());     }   }     public void stopReceivingBodyDamageUpdates(IsoPlayer other)   {     if ((GameClient.bClient) && (other != null) && (other != this) && (!other.isLocalPlayer())) {       BodyDamageSync.instance.stopReceivingUpdates(other.getOnlineID());     }   }     public Nutrition getNutrition()   {     return this.nutrition;   }     private void updateHeavyBreathing() {} }  

 

 

 

if somone can compile this into a new IsoPlayer.class let me know. will mean extra installation step but worth it.

Edited by nolanri
Link to comment
Share on other sites

17 hours ago, nolanri said:

Mod released:

 

Seems that you do not find a solution for the keyboard setting yet. I dunno if this is possible but what about setting a variable everytime a new survivor spawns and assigning the variable to that spawned player moddata. Then putting a condition such as if getplayer getmoddata is true than not execute any move or atk etc.  

 

Btw your mods are awesome :) 

Edited by ShuiYin
Link to comment
Share on other sites

5 minutes ago, ShuiYin said:

Seems that you do not find a solution for the keyboard setting yet. I dunno if this is possible but what about setting a variable everytime a new survivor spawns and assigning the variable to that spawned player moddata. Then putting a condition such as if getplayer getmoddata is true than not execute any move or atk etc. 

they keyboard movements for players is hard coded into the java IsoPLayer class, dont have access to do this. Blindcoder is trying to edit and rebuild the IsoPlayer.class so that I can set the PLayerIndex, and if that dont work maybe alter the keyboard listen condidtion from getPlayerNum() == 0 to isLocalPlayer()

 

either way, it's a java side fix which will make installation of the mod complicated even if it works.  And would have to redo it each time build updates. Which is why I hoped TIS would alter the condition officaially or add a method to set or create isoplayer with spesified index

Edited by nolanri
Link to comment
Share on other sites

So we made changes to the Java side class to allow setting the PlayerIndex but this caused out of bounds error with getSpesificPlayer(int index) .  I think because we need to add the new player object to the IsoPlayer.players[] array, we will try to do that next but its likely that there will be other problem,s

Link to comment
Share on other sites

5 hours ago, nolanri said:

So we made changes to the Java side class to allow setting the PlayerIndex but this caused out of bounds error with getSpesificPlayer(int index) .  I think because we need to add the new player object to the IsoPlayer.players[] array, we will try to do that next but its likely that there will be other problem,s

Good luck bro Nolan :) 

Link to comment
Share on other sites

So blindocoder showed me how to recompile my java edits. and with that we made a method to set player index to something that is not 0. Had to also add the new players to the players object array and initialize a reloadmanager instance to get it to work without errors.  With all that the survivors are now free from my keyboard and mouse commands! ... But for some reason...., now your player has no Line of SIght LOS.  Fog of war is everywhere so zombies are essentially invisible, If you use necro forge to toggle ghost mode on, you can see everywhere (even behind you) and see that the AIs are running around independantly now.  But obvioulsy being blind is a problem and is the NEW problem.  I could set ghost mode on sure. But then you'd have a perfect field of view 360 degrees and even see behind obstructions. so thats not much of a fix either.  I cant really imagine why changing the index number of other players makes player 0 (keyboard player) LOS disappear so at the moment im not sure what to try but thats whats going on

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...