public static void HandleMovement(Character chr, byte[] tx, byte[] ty, byte mMode) { if(chr == null) { Logger.LogCheat(Logger.HackTypes.NullActive, chr.getAccount().mClient, "Wrong target has been selected by moving packet"); chr.getAccount().mClient.Close(); return; } Area lastArea = chr.getArea(); Boolean nullify = false; if(lastArea == null) nullify = true; Area newArea = WMap.Instance.getGrid(chr.getMap()).getAreaByRound(chr.getPosition()[0], chr.getPosition()[1]); if(newArea == null) { CharacterFunctions.warpToNearestTown(chr); return; } if(!nullify) { if(lastArea != newArea) { lastArea.removeCharacter(chr); newArea.addCharacter(chr); chr.setArea(newArea); } } else if(nullify) { newArea.addCharacter(chr); chr.setArea(newArea); } OutPacket p = new OutPacket(56); p.WriteInt(56); p.WriteShort(0x04); p.WriteShort(0x0d); p.WriteInt (); p.WriteInt (chr.getuID()); p.WriteFloat(chr.getPosition()[0]); p.WriteFloat(chr.getPosition()[1]); p.WriteBytes(tx); //2nd set p.WriteBytes(ty); p.WriteInt (newArea.getaID()); p.WriteShort(); p.WriteByte ((byte)0x80); p.WriteByte ((byte)0x3f); p.WriteByte (mMode); p.WriteByte ((byte)0x03); p.WriteByte ((byte)0x05); p.WriteByte ((byte)0x08); p.WriteInt (chr.getCurHP()); p.WriteShort(chr.getCurMP()); p.WriteShort(chr.getCurSP()); p.WriteInt(newArea.getRegionID()); chr.getAccount().mClient.WriteRawPacket(p.ToArray()); OutPacket externalMovement = new OutPacket(48); externalMovement.WriteInt(48); externalMovement.WriteShort(0x05); externalMovement.WriteShort(0x0d); externalMovement.WriteInt((newArea != lastArea) ? (0x01) : (-1084232447)); externalMovement.WriteInt(chr.getuID()); externalMovement.WriteInt(1078117293); externalMovement.WriteFloat(chr.getPosition()[0]); externalMovement.WriteFloat(chr.getPosition()[1]); externalMovement.WriteBytes(tx); externalMovement.WriteBytes(ty); externalMovement.WriteShort(mMode); // who knows? | 36 externalMovement.WriteShort((short)newArea.getaID()); externalMovement.WriteShort(); externalMovement.WriteByte(0x80); externalMovement.WriteByte(0x3f); externalMovement.WriteInt((newArea != lastArea) ? (0x05) : (0x03)); WMap.Instance.getGrid(chr.getMap()).sendTo3x3AreaMovement(chr, newArea, externalMovement.ToArray()); bool areaTriggered = false; for(int i = 0;i < 3;i++) { for(int u = 0;u < 3;u++) { Area nearCentral = WMap.Instance.getGrid(chr.getMap()).getArea(new int[] { newArea.getAreaPosition()[0] - 1 + i, newArea.getAreaPosition()[1] - 1 + u }); if(nearCentral == null) continue; if(nearCentral.getAreaTriggers().Count() == 0) continue; { foreach(AreaTrigger areaTrigger in nearCentral.getAreaTriggers()) { if((WMap.distance(chr.getPosition()[0], chr.getPosition()[1], areaTrigger.getFromPosition()[0], areaTrigger.getFromPosition()[1]) > 35)) continue; if(!CharacterFunctions.isCharacterWearingItem(chr, areaTrigger.getRequiredItem())) continue; try { areaTriggered = true; CharacterFunctions.setPlayerPosition(chr, areaTrigger.getToPosition()[0], areaTrigger.getToPosition()[1], areaTrigger.gettMap()); } catch(Exception e) { Console.WriteLine(e); } } } } } if(!areaTriggered) chr.setPosition(new float[] { (float)BitTools.byteArrayToFloat(tx), (float)BitTools.byteArrayToFloat(ty) }); }