private void ParseCancelWalk(Internal.ByteArray message) { int direction = message.ReadUnsignedByte(); var absolutePosition = Player.Position; if (absolutePosition == _lastSnapback) { _snapbackCount++; } else { _snapbackCount = 0; } _lastSnapback.Set(absolutePosition.x, absolutePosition.y, absolutePosition.z); if (_snapbackCount >= 16) { Player.StopAutowalk(true); CreatureStorage.SetAttackTarget(null, false); SendCancel(); _snapbackCount = 0; } Player.AbortAutowalk((Direction)direction); }
private void ParseClearTarget(Internal.CommunicationStream message) { uint creatureId = 0; if (OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameAttackSeq)) { creatureId = message.ReadUnsignedInt(); } Creatures.Creature creature; if (!!(creature = CreatureStorage.AttackTarget) && (creature.Id == creatureId || creatureId == 0)) { CreatureStorage.SetAttackTarget(null, false); } else if (!!(creature = CreatureStorage.FollowTarget) && (creature.Id == creatureId || creatureId == 0)) { CreatureStorage.SetFollowTarget(null, false); } }