Skip to content

Commit

Permalink
Merge pull request runelite#2710 from Abextm/update-objectid
Browse files Browse the repository at this point in the history
Strip tags from java names in ID files
  • Loading branch information
Adam- authored May 14, 2018
2 parents fdc8e9d + 7cc7260 commit b374c82
Show file tree
Hide file tree
Showing 5 changed files with 939 additions and 305 deletions.
30 changes: 29 additions & 1 deletion cache/src/main/java/net/runelite/cache/util/Namer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, Adam <[email protected]>
* Copyright (c) 2018, Joshua Filby <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -53,7 +54,8 @@ public String name(String name, int id)

private static String sanitize(String in)
{
String s = in.toUpperCase()
String s = removeTags(in)
.toUpperCase()
.replace(' ', '_')
.replaceAll("[^a-zA-Z0-9_]", "");
if (s.isEmpty())
Expand All @@ -69,4 +71,30 @@ private static String sanitize(String in)
return s;
}
}

public static String removeTags(String str)
{
StringBuilder builder = new StringBuilder(str.length());
boolean inTag = false;

for (int i = 0; i < str.length(); i++)
{
char currentChar = str.charAt(i);

if (currentChar == '<')
{
inTag = true;
}
else if (currentChar == '>')
{
inTag = false;
}
else if (!inTag)
{
builder.append(currentChar);
}
}

return builder.toString();
}
}
40 changes: 35 additions & 5 deletions runelite-api/src/main/java/net/runelite/api/ItemID.java
Original file line number Diff line number Diff line change
Expand Up @@ -3546,10 +3546,10 @@ public final class ItemID
public static final int CHEFS_DELIGHTM2 = 5909;
public static final int CHEFS_DELIGHTM3 = 5911;
public static final int CHEFS_DELIGHTM4 = 5913;
public static final int SLAYER_RESPITEM1 = 5915;
public static final int SLAYER_RESPITEM2 = 5917;
public static final int SLAYER_RESPITEM3 = 5919;
public static final int SLAYER_RESPITEM4 = 5921;
public static final int SLAYERS_RESPITEM1 = 5915;
public static final int SLAYERS_RESPITEM2 = 5917;
public static final int SLAYERS_RESPITEM3 = 5919;
public static final int SLAYERS_RESPITEM4 = 5921;
public static final int CIDERM1 = 5923;
public static final int CIDERM2 = 5925;
public static final int CIDERM3 = 5927;
Expand Down Expand Up @@ -10035,7 +10035,7 @@ public final class ItemID
public static final int KHAREDSTS_MEMOIRS = 21760;
public static final int LUNCH_BY_THE_LANCALLIUMS = 21762;
public static final int THE_FISHERS_FLUTE = 21764;
public static final int HEARSAY_AND_HISTORY = 21766;
public static final int HISTORY_AND_HEARSAY = 21766;
public static final int JEWELLERY_OF_JUBILATION = 21768;
public static final int A_DARK_DISPOSITION = 21770;
public static final int SECRET_PAGE = 21772;
Expand Down Expand Up @@ -10308,4 +10308,34 @@ public final class ItemID
public static final int ANCIENT_MEDALLION = 22299;
public static final int ANCIENT_EFFIGY = 22302;
public static final int ANCIENT_RELIC = 22305;
public static final int PROP_SWORD = 22316;
public static final int PET_CORPOREAL_CRITTER = 22318;
public static final int TZREKZUK = 22319;
public static final int CHAMPIONS_LAMP = 22320;
public static final int ROTTEN_CABBAGE = 22321;
public static final int AVERNIC_DEFENDER = 22322;
public static final int SANGUINESTI_STAFF = 22323;
public static final int GHRAZI_RAPIER = 22324;
public static final int SCYTHE_OF_VITUR = 22325;
public static final int JUSTICIAR_FACEGUARD = 22326;
public static final int JUSTICIAR_CHESTGUARD = 22327;
public static final int JUSTICIAR_LEG_GUARDS = 22328;
public static final int VAMPYRIUM_VAMBRACES = 22329;
public static final int DEADMAN_STARTER_PACK = 22330;
public static final int STARTER_SWORD = 22331;
public static final int STARTER_BOW = 22333;
public static final int STARTER_STAFF = 22335;
public static final int EGGSHELL_PLATEBODY = 22351;
public static final int EGGSHELL_PLATELEGS = 22353;
public static final int HOLY_HANDEGG = 22355;
public static final int PEACEFUL_HANDEGG = 22358;
public static final int CHAOTIC_HANDEGG = 22361;
public static final int OCULUS_ORB = 22364;
public static final int SHAYZIEN_FAVOUR_CERTIFICATE = 22365;
public static final int CYAN_CRYSTAL_22366 = 22366;
public static final int KOUREND_FAVOUR_CERTIFICATE = 22367;
public static final int BRYOPHYTAS_STAFF_UNCHARGED = 22368;
public static final int BRYOPHYTAS_STAFF = 22370;
public static final int BRYOPHYTAS_ESSENCE = 22372;
public static final int MOSSY_KEY = 22374;
}
Loading

0 comments on commit b374c82

Please sign in to comment.