Skip to content

Commit

Permalink
clues: use builder for cryptic clues
Browse files Browse the repository at this point in the history
The code for this was dumped via a test:

	@test
	public void dump() throws IllegalAccessException
	{
		Map<Integer, String> map = new HashMap<>();
		for (Field f : ObjectID.class.getDeclaredFields())
		{
			map.put(f.getInt(null), f.getName());
		}
		for (CrypticClue cc : CrypticClue.CLUES)
		{
			System.out.println("CrypticClue.builder()");
			System.out.println(".text(\"" + cc.getText() + "\")");
			if (!"Viggora".equals(cc.getNpc()))
			{
				WorldPoint wp = cc.getLocation(plugin);
				if (wp != null)
				{
					int plane = wp.getPlane();
					int x = wp.getX();
					int y = wp.getY();
					System.out.println(".location(new WorldPoint(" + x + ", " + y + ", " + plane + "))");
				}
			}
			else
			{
				System.out.println(".locationProvider(CrypticClue::getViggoraLocation)");
			}
			if (cc.getNpc() != null)
			{
				System.out.println(".npc(\"" + cc.getNpc() + "\")");
			}
			if (cc.getObjectId() != -1)
			{
				var name = map.get(cc.getObjectId());
				if (name != null)
				{
					System.out.println(".objectId(ObjectID." + name + ")");
				}
				else
				{
					System.out.println(".objectId(NullObjectID.NULL_" + cc.getObjectId() + ")");
				}
			}
			System.out.println(".solution(\"" + cc.getSolution() + "\")");
			if (cc.isRequiresLight())
			{
				System.out.println(".requiresLight(true)");
			}
			if (cc.getQuestionText() != null)
			{
				System.out.println(".questionText(\"" + cc.getQuestionText() + "\")");
			}
			System.out.println(".build(),");
		}
	}
  • Loading branch information
Adam- committed Dec 30, 2023
1 parent eeff4f0 commit 07d8b76
Showing 1 changed file with 1,630 additions and 333 deletions.
Loading

0 comments on commit 07d8b76

Please sign in to comment.