From 27fdfb4fbd7e907500856741611b588aeded75a5 Mon Sep 17 00:00:00 2001 From: PolyAnthi <79588299+PolyAnthi@users.noreply.github.com> Date: Sat, 24 Jun 2023 12:33:24 +0100 Subject: [PATCH] Update grab_items.py (#52) * Update grab_items.py Update item ids, add reversed argument to grab_items (aka can do stack to id and id to stack) and added translate stack to id. * Update grab_items.py --- rustplus/utils/grab_items.py | 133 +++++++++++++++++++++-------------- 1 file changed, 81 insertions(+), 52 deletions(-) diff --git a/rustplus/utils/grab_items.py b/rustplus/utils/grab_items.py index b2183f3..7230dbe 100644 --- a/rustplus/utils/grab_items.py +++ b/rustplus/utils/grab_items.py @@ -8,7 +8,6 @@ "-2124352573": "Acoustic Guitar", "-2123125470": "Advanced Healing Tea", "-2107018088": "Shovel Bass", - "-2103694546": "Sunglasses", "-2099697608": "Stones", "-2097376851": "Nailgun Nails", "-2094954543": "Wood Armor Helmet", @@ -21,13 +20,14 @@ "-2049214035": "Pressure Pad", "-2047081330": "Movember Moustache", "-2040817543": "Pan Flute", + "-2027793839": "Advent Calendar", "-2025184684": "Shirt", + "-2024549027": "Heavy Frankenstein Legs", "-2022172587": "Diving Tank", "-2012470695": "Improvised Balaclava", "-2002277461": "Road Sign Jacket", "-2001260025": "Instant Camera", "-1999722522": "Furnace", - "-1997698639": "Sunglasses", "-1997543660": "Horse Saddle", "-1994909036": "Sheet Metal", "-1992717673": "Large Furnace", @@ -38,7 +38,6 @@ "-1966748496": "Mace", "-1962971928": "Mushroom", "-1961560162": "Firecracker String", - "-1958316066": "Scientist Suit", "-1950721390": "Concrete Barricade", "-1941646328": "Can of Tuna", "-1938052175": "Charcoal", @@ -46,7 +45,6 @@ "-1904821376": "Orange Roughy", "-1903165497": "Bone Helmet", "-1899491405": "Glue", - "-1884328185": "ScrapTransportHeliRepair", "-1880870149": "Red Keycard", "-1880231361": "Flatbed Vehicle Module", "-1878764039": "Small Trout", @@ -55,6 +53,7 @@ "-1861522751": "Research Table", "-1850571427": "Silencer", "-1848736516": "Cooked Chicken", + "-1843426638": "MLRS Rocket", "-1841918730": "High Velocity Rocket", "-1832422579": "One Sided Town Sign Post", "-1824943010": "Jack O Lantern Happy", @@ -67,19 +66,19 @@ "-1785231475": "Surgeon Scrubs", "-1780802565": "Salvaged Icepick", "-1779183908": "Paper", - "-1779180711": "Water", "-1778897469": "Button", "-1778159885": "Heavy Plate Pants", "-1776128552": "Green Berry Seed", "-1773144852": "Hide Skirt", "-1772746857": "Heavy Scientist Suit", "-1768880890": "Small Shark", - "-1759188988": "Hab Repair", "-1758372725": "Thompson", "-1754948969": "Sleeping Bag", "-1736356576": "Reactive Target", + "-1732475823": "Medium Frankenstein Head", "-1729415579": "Adv. Anti-Rad Tea", "-1709878924": "Raw Human Meat", + "-1707425764": "Fishing Tackle", "-1698937385": "Herring", "-1695367501": "Shorts", "-1693832478": "Large Flatbed Vehicle Module", @@ -88,18 +87,19 @@ "-1679267738": "Graveyard Fence", "-1677315902": "Pure Healing Tea", "-1673693549": "Empty Propane Tank", - "-1671551935": "Direct Torpedo", + "-1671551935": "Torpedo", "-1667224349": "Decorative Baubels", - "-1663759755": "Land Mine", + "-1663759755": "Homemade Landmine", "-1654233406": "Sardine", "-1651220691": "Pookie Bear", "-1647846966": "Two Sided Ornate Hanging Sign", + "-1624770297": "Light Frankenstein Torso", "-1622660759": "Large Present", "-1622110948": "Bandit Guard Gear", "-1621539785": "Beach Parasol", "-1615281216": "Armored Passenger Vehicle Module", "-1614955425": "Strengthened Glass Window", - "-1607980696": "Work Bench Level 3", + "-1607980696": "Workbench Level 3", "-1588628467": "Computer Station", "-1583967946": "Stone Hatchet", "-1581843485": "Sulfur", @@ -134,7 +134,6 @@ "-1432674913": "Anti-Radiation Pills", "-1429456799": "Prison Cell Wall", "-1423304443": "Medium Neon Sign", - "-1408336705": "Sunglasses", "-1405508498": "Muzzle Boost", "-1379835144": "Festive Window Garland", "-1379036069": "Canbourine", @@ -144,6 +143,7 @@ "-1336109173": "Wood Double Door", "-1331212963": "Star Tree Topper", "-1330640246": "Junkyard Drum Kit", + "-1323101799": "Double Horse Saddle", "-1321651331": "Explosive 5.56 Rifle Ammo", "-1316706473": "Camera", "-1306288356": "Green Roman Candle", @@ -157,18 +157,22 @@ "-1262185308": "Binoculars", "-1252059217": "Hatchet", "-1234735557": "Wooden Arrow", + "-1230433643": "Festive Double Doorway Garland", "-1215753368": "Flame Thrower", "-1215166612": "A Barrel Costume", + "-1214542497": "HMLMG", "-1211268013": "Basic Horse Shoes", "-1211166256": "5.56 Rifle Ammo", "-1199897172": "Metal Vertical embrasure", "-1199897169": "Metal horizontal embrasure", + "-1196547867": "Electric Furnace", "-1184406448": "Basic Max Health Tea", "-1183726687": "Wooden Window Bars", "-1167031859": "Spoiled Wolf Meat", "-1166712463": "Fluid Splitter", "-1163532624": "Jacket", "-1162759543": "Cooked Horse Meat", + "-1160621614": "Red Industrial Wall Light", "-1157596551": "Sulfur Ore", "-1138208076": "Small Wooden Sign", "-1137865085": "Machete", @@ -184,11 +188,12 @@ "-1101924344": "Wetsuit", "-1100422738": "Spinning wheel", "-1100168350": "Large Water Catcher", - "-1078639462": "Skull Spikes", "-1073015016": "Skull Spikes", "-1049881973": "Cowbell", + "-1049172752": "Storage Adaptor", "-1044468317": "RF Broadcaster", "-1043618880": "Ghost Costume", + "-1040518150": "Camper Vehicle Module", "-1039528932": "Small Water Bottle", "-1036635990": "12 Gauge Incendiary Shell", "-1023374709": "Wood Shutters", @@ -198,24 +203,26 @@ "-1018587433": "Animal Fat", "-1009359066": "SAM Site", "-1004426654": "Bunny Ears", + "-1003665711": "Super Serum", "-1002156085": "Gold Egg", "-1000573653": "Frog Boots", - "-996920608": "Blueprint", "-996185386": "XL Picture Frame", "-992286106": "White Berry Seed", "-989755543": "Burnt Bear Meat", + "-986782031": "Rabbit Mask", "-985781766": "High Ice Wall", "-979951147": "Jerry Can Guitar", "-979302481": "Easter Door Wreath", "-967648160": "High External Stone Wall", + "-965336208": "Chocolate Bar", "-961457160": "New Year Gong", "-956706906": "Prison Cell Gate", "-946369541": "Low Grade Fuel", "-939424778": "Flasher Light", + "-936921910": "Flashbang", "-932201673": "Scrap", "-930193596": "Fertilizer", "-929092070": "Basic Healing Tea", - "-924959988": "Skull Trophy", "-912398867": "Cassette - Medium", "-904863145": "Semi-Automatic Rifle", "-888153050": "Halloween Candy", @@ -227,8 +234,8 @@ "-851988960": "Salmon", "-850982208": "Key Lock", "-845557339": "Landscape Picture Frame", + "-842267147": "Snowman Helmet", "-819720157": "Metal Window Bars", - "-810326667": "Work Cart", "-804769727": "Plant Fiber", "-803263829": "Coffee Can Helmet", "-798293154": "Laser Detector", @@ -239,8 +246,10 @@ "-778367295": "L96 Rifle", "-769647921": "Skull Trophy", "-765183617": "Double Barrel Shotgun", + "-763071910": "Lumberjack Hoodie", "-761829530": "Burlap Shoes", "-751151717": "Spoiled Chicken", + "-747743875": "Egg Suit", "-746647361": "Memory Cell", "-746030907": "Granola Bar", "-742865266": "Rocket", @@ -262,6 +271,7 @@ "-649128577": "Basic Wood Tea", "-629028935": "Electric Fuse", "-626174997": "Taxi Vehicle Module", + "-596876839": "Spray Can", "-592016202": "Explosives", "-587989372": "Catfish", "-586784898": "Mail Box", @@ -274,8 +284,8 @@ "-567909622": "Pumpkin", "-566907190": "RF Pager", "-563624462": "Splitter", - "-560304835": "Space Suit", "-559599960": "Sandbag Barricade", + "-558880549": "Gingerbread Suit", "-557539629": "Pure Wood Tea", "-555122905": "Sofa", "-544317637": "Research Paper", @@ -289,32 +299,32 @@ "-489848205": "Large Candle Set", "-487356515": "Anti-Rad Tea", "-484206264": "Blue Keycard", + "-470439097": "Arctic Suit", "-465682601": "SUPER Stocking", "-463122489": "Watch Tower", "-458565393": "Root Combiner", "-454370658": "Red Volcano Firework", "-395377963": "Raw Wolf Meat", "-384243979": "SAM Ammo", + "-379734527": "Pattern Boomer", "-369760990": "Small Stash", "-365097295": "Powered Water Purifier", "-363689972": "Snowball", "-343857907": "Sound Light", "-335089230": "High External Wooden Gate", - "-333406828": "Sled", "-324675402": "Reindeer Antlers", "-321733511": "Crude Oil", "-321431890": "Beach Chair", "-316250604": "Wooden Ladder", + "-297099594": "Heavy Frankenstein Head", "-295829489": "Test Generator", "-282113991": "Simple Light", "-280223496": "Violet Boomer", - "-277057363": "Salt Water", "-265876753": "Gun Powder", "-265292885": "Fluid Combiner", "-262590403": "Salvaged Axe", "-253079493": "Scientist Suit", "-242084766": "Cooked Pork", - "-239306133": "Surface torpedo", "-237809779": "Hemp Seed", "-216999575": "Counter", "-216116642": "Skull Door Knocker", @@ -323,22 +333,22 @@ "-196667575": "Flashlight", "-194953424": "Metal Facemask", "-194509282": "Butcher Knife", - "-187031121": "Solo Submarine", "-180129657": "Wood Storage Box", - "-176608084": "Sunglasses", "-173268132": "Rustig\u00e9 Egg - Blue", "-173268131": "Rustig\u00e9 Egg - Purple", "-173268129": "Rustig\u00e9 Egg - Red", + "-173268128": "Rustig\u00e9 Egg - White", "-173268126": "Rustig\u00e9 Egg - Ivory", "-173268125": "Rustig\u00e9 Egg - Green", - "-156748077": "Skull Trophy", "-151838493": "Wood", "-151387974": "Deluxe Christmas Lights", "-148794216": "Garage Door", "-148229307": "Metal Shop Front", + "-144513264": "Pipe Tool", "-144417939": "Wire Tool", "-143132326": "Huge Wooden Sign", "-135252633": "Sled", + "-134959124": "Light Frankenstein Head", "-132516482": "Weapon Lasersight", "-132247350": "Small Water Catcher", "-129230242": "Decorative Pinecones", @@ -355,13 +365,9 @@ "-75944661": "Eoka Pistol", "-48090175": "Snow Jacket", "-44876289": "Igniter", - "-44066823": "Medium Chassis", - "-44066790": "Large Chassis", - "-44066600": "Small Chassis", - "-41896755": "Work Bench Level 2", + "-41896755": "Workbench Level 2", "-41440462": "Spas-12 Shotgun", "-33009419": "Pure Anti-Rad Tea", - "-25740268": "Skull Spikes", "-23994173": "Boonie Hat", "-22883916": "Dragon Mask", "-20045316": "Mobile Phone", @@ -386,18 +392,20 @@ "62577426": "Photograph", "69511070": "Metal Fragments", "73681876": "Tech Trash", + "86840834": "NVGM Scientist Suit", "95950017": "Metal Pipe", "98508942": "XXL Picture Frame", "99588025": "High External Wooden Wall", + "106959911": "Light Frankenstein Legs", "121049755": "Tall Picture Frame", "122783240": "Black Berry Clone", + "140006625": "PTZ CCTV Camera", "143803535": "F1 Grenade", "170758448": "Cockpit With Engine Vehicle Module", "171931394": "Stone Pickaxe", "174866732": "16x Zoom Scope", "176787552": "Rifle Body", "177226991": "Scarecrow", - "185586769": "Inner Tube", "190184021": "Kayak", "196700171": "Hide Vest", "198438816": "Vending Machine", @@ -422,13 +430,13 @@ "304481038": "Flare", "317398316": "High Quality Metal", "342438846": "Anchovy", + "343045591": "MLRS Aiming Module", "349762871": "40mm HE Grenade", "352130972": "Rotten Apple", "352321488": "Sunglasses", "352499047": "Shotgun Trap", "359723196": "Chippy Arcade Game", "363163265": "Hose Tool", - "363467698": "Chocolate Bar", "390728933": "Yellow Berry Clone", "418081930": "Wood Chestplate", "442289265": "Holosight", @@ -455,6 +463,7 @@ "603811464": "Advanced Max Health Tea", "605467368": "Incendiary 5.56 Rifle Ammo", "609049394": "Battery - Small", + "610102428": "Industrial Conveyor", "613961768": "Bota Bag", "621915341": "Raw Pork", "634478325": "CCTV Camera", @@ -471,9 +480,13 @@ "680234026": "Yellow Perch", "696029452": "Paper Map", "699075597": "Wooden Cross", + "709206314": "Tiger Mask", "722955039": "Water Gun", + "742745918": "Industrial Splitter", + "755224797": "Vodka Bottle", "756517185": "Medium Present", "762289806": "Siren Light", + "782422285": "Sofa - Pattern", "785728077": "Pistol Bullet", "794356786": "Hide Boots", "794443127": "Christmas Tree", @@ -484,12 +497,13 @@ "809199956": "Gravestone", "809942731": "Scarecrow Wrap", "813023040": "Cooked Wolf Meat", - "818733919": "Industrial Door", "818877484": "Semi-Automatic Pistol", "826309791": "Two Sided Town Sign Post", "830839496": "Red Berry Seed", "832133926": "Wood Armor Pants", "833533164": "Large Wood Box", + "835042040": "Medium Frankenstein Legs", + "838308300": "Burst Module", "838831151": "Blue Berry Clone", "844440409": "Bronze Egg", "850280505": "Bucket Helmet", @@ -498,7 +512,6 @@ "858486327": "Green Berry", "866332017": "Large Neon Sign", "866889860": "Wooden Barricade", - "878301596": "Generic vehicle module", "882559853": "Spider Webs", "884424049": "Compound Bow", "888415708": "RF Receiver", @@ -507,31 +520,29 @@ "926800282": "Medium Quality Valves", "935692442": "Longsleeve T-Shirt", "936496778": "Floor grill", - "946662961": "Car Key", "952603248": "Weapon flashlight", "963906841": "Rock", "968019378": "Clatter Helmet", "968421290": "Connected Speaker", - "971362526": "Skull Trophy", + "975983052": "Twitch Rivals Trophy", "980333378": "Hide Poncho", "988652725": "Smart Switch", "989925924": "Raw Fish", "996293980": "Human Skull", "998894949": "Corn Seed", "999690781": "Geiger Counter", - "1015352446": "Duo Submarine", "1052926200": "Mining Quarry", "1055319033": "40mm Shotgun Round", "1058261682": "Christmas Lights", "1072924620": "High Quality Spark Plugs", "1079279582": "Medical Syringe", "1081315464": "Nest Hat", - "1081921512": "Card Table", "1090916276": "Pitchfork", "1094293920": "Wrapping Paper", "1099314009": "Barbeque", "1103488722": "Snowball Gun", "1104520648": "Chainsaw", + "1107575710": "Arctic Scientist Suit", "1110385766": "Metal Chest Plate", "1112162468": "Blue Berry", "1121925526": "Candy Cane", @@ -553,15 +564,16 @@ "1205607945": "Two Sided Hanging Sign", "1221063409": "Armored Double Door", "1230323789": "SMG Body", + "1230691307": "Captain's Log", "1234878710": "Telephone", "1234880403": "Sewing Kit", "1242482355": "Jack O Lantern Angry", "1242522330": "Cursed Cauldron", "1248356124": "Timed Explosive Charge", - "1258768145": "Sunglasses", "1259919256": "Mixing Table", "1263920163": "Smoke Grenade", "1266491000": "Hazmat Suit", + "1268178466": "Green Industrial Wall Light", "1272194103": "Red Berry", "1272430949": "Wheelbarrow Piano", "1272768630": "Spoiled Human Meat", @@ -596,38 +608,45 @@ "1414245522": "Rope", "1422530437": "Raw Deer Meat", "1424075905": "Water Bucket", - "1426574435": "MC repair", + "1430085198": "Industrial Crafter", "1443579727": "Hunting Bow", "1451568081": "Chainlink Fence Gate", "1478091698": "Muzzle Brake", "1480022580": "Basic Ore Tea", "1488979457": "Jackhammer", "1491189398": "Paddle", + "1491753484": "Medium Frankenstein Torso", "1512054436": "Potato Clone", "1516985844": "Netting", "1521286012": "Double Sign Post", "1523195708": "Targeting Computer", "1523403414": "Cassette - Short", - "1524187186": "Work Bench Level 1", + "1524187186": "Workbench Level 1", + "1524980732": "Carvable Pumpkin", "1525520776": "Building Plan", "1533551194": "White Berry Clone", "1534542921": "Chair", "1536610005": "Cooked Human Meat", + "1538126328": "Industrial Combiner", "1540934679": "Wooden Spear", "1542290441": "Single Sign Post", "1545779598": "Assault Rifle", "1548091822": "Apple", "1553078977": "Bleach", - "1557173737": "Sunglasses", + "1556365900": "Molotov Cocktail", "1559779253": "Engine Vehicle Module", + "1559915778": "Single Horse Saddle", "1568388703": "Diesel Fuel", "1569882109": "Handmade Fishing Rod", + "1575635062": "Frankenstein Table", "1581210395": "Large Planter Box", "1588298435": "Bolt Action Rifle", "1588492232": "Drone", "1601468620": "Blue Jumpsuit", "1602646136": "Stone Spear", "1608640313": "Tank Top", + "1614528785": "Heavy Frankenstein Torso", + "1623701499": "Industrial Wall Light", "1629293099": "Snowman", "1638322904": "Incendiary Rocket", "1643667218": "Large Animated Neon Sign", @@ -653,13 +672,11 @@ "1729120840": "Wooden Door", "1729374708": "Pure Ore Tea", "1729712564": "Portrait Photo Frame", - "1735402444": "Disco Floor", "1744298439": "Blue Boomer", "1746956556": "Bone Armor", "1751045826": "Hoodie", "1757265204": "Silver Egg", "1770475779": "Worm", - "1770744540": "Generic vehicle chassis", "1771755747": "Black Berry", "1776460938": "Blood", "1783512007": "Cactus Flesh", @@ -668,6 +685,7 @@ "1796682209": "Custom SMG", "1803831286": "Garry's Mod Tool Gun", "1814288539": "Bone Knife", + "1819863051": "Sky Lantern", "1827479659": "Burnt Wolf Meat", "1835946060": "Cable Tunnel", "1840570710": "Above Ground Pool", @@ -689,6 +707,7 @@ "1903654061": "Small Planter Box", "1905387657": "Pure Rad. Removal Tea", "1911552868": "Black Berry Seed", + "1914691295": "Prototype 17", "1917703890": "Burnt Horse Meat", "1931713481": "Black Raspberries", "1946219319": "Camp Fire", @@ -703,6 +722,7 @@ "1983621560": "Floor triangle grill", "1989785143": "High Quality Horse Shoes", "1992974553": "Burlap Trousers", + "2005491391": "Extended Magazine", "2009734114": "Christmas Door Wreath", "2019042823": "Tarp", "2021351233": "Advanced Rad. Removal Tea", @@ -711,7 +731,6 @@ "2040726127": "Combat Knife", "2041899972": "Triangle Ladder Hatch", "2048317869": "Wolf Skull", - "2052270186": "Inner Tube", "2063916636": "Advanced Ore Tea", "2070189026": "Large Banner on pole", "2087678962": "Search Light", @@ -721,10 +740,9 @@ "2106561762": "Decorative Tinsel", "2114754781": "Water Purifier", "2126889441": "Santa Beard", - "2133269020": "Red Berry Clone", - "-1843426638": "MLRS Rocket", - "343045591": "MLRS Aiming Module", + "2133269020": "Red Berry Clone" } +stack_to_id = {} def translate_id_to_stack(value_id: Union[str, int]) -> str: @@ -735,25 +753,36 @@ def translate_id_to_stack(value_id: Union[str, int]) -> str: return "Not Found" -def grab_items() -> None: +def translate_stack_to_id(item: str) -> int: + global item_ids + global stack_to_id + if stack_to_id == {}: + for i in item_ids: + stack_to_id[item_ids[i].lower()] = i + try: + return stack_to_id[item.lower()] + except KeyError: + return "Not Found" + + +def grab_items(reversed = False) -> None: data = {} for line in ( requests.get( - "https://raw.githubusercontent.com/OrangeWulf/Rust-Docs/master/Items.md" + "https://raw.githubusercontent.com/olijeffers0n/RustItems/master/data/items.md" ) .content.decode() - .splitlines(False)[4:] + .splitlines(False)[2:] ): - if len(line) == 0: - continue + if len(line) == 0: continue item = line.split("|")[1:-1] - if item[1] == "": - continue + if item[1] == "" or item[2] == "N/A": continue - data[int(item[-1])] = item[1] + if not reversed: data[int(item[2])] = item[0] + else: data[str(item[0])] = int(item[2]) with open("rust_items.json", "w") as output: json.dump(data, output, indent=4, sort_keys=True)