#!/usr/bin/env python3 """Revert the custom dragon weapon / right-half additions to return pk_npcdrops_update.sql to the pure OpenRSC use-java state. Removes ALL entries for: DRAGON_SWORD (id 593) DRAGON_AXE (id 594) RIGHT_HALF_DRAGON_SQUARE_SHIELD (id 1276) These items are not defined as drops anywhere in OpenRSC's NpcDrops.java, so removing them returns drop tables to OpenRSC defaults. """ import sys, os sys.path.insert(0, '/Users/tomassimkus/VS/openrsc-develop') os.chdir('/Users/tomassimkus/VS/openrsc-develop') from update_drops import parse_update_sql, write_update_sql from compare_drops import load_enums from collections import defaultdict _, npc_id_to_name, _, _ = load_enums() TO_REMOVE = {593, 594, 1276} header, rows, footer = parse_update_sql() # Count what's being removed by NPC removed_per_npc = defaultdict(lambda: defaultdict(int)) for nid, amt, iid, w, _ in rows: if iid in TO_REMOVE: removed_per_npc[nid][iid] += 1 new_rows = [r for r in rows if r[2] not in TO_REMOVE] removed = len(rows) - len(new_rows) new_rows.sort(key=lambda r: (r[0], 0 if r[3] == 0 else 1, r[3], r[2])) write_update_sql(header, new_rows, footer) print(f"Removed {removed} custom drop entries.\n") print(f"By NPC:") ITEM_NAME = {593: "DRAGON_SWORD", 594: "DRAGON_AXE", 1276: "RIGHT_HALF_DRAGON_SQUARE_SHIELD"} for nid in sorted(removed_per_npc): nname = npc_id_to_name.get(nid, f"#{nid}") parts = [f"{ITEM_NAME[iid]} (x{cnt})" for iid, cnt in removed_per_npc[nid].items()] print(f" {nname:<24} {', '.join(parts)}")