All pastes #85263 Raw Edit

silabsoft

public text v1 · immutable
·published 2006-07-11 20:18 UTC
rendered paste body
  protected void writeObjects()
    {
        XMLWriter xmlwriter;
        System.out.println("Writing objects to Objects.xml");
        xmlwriter = new XMLWriter("objectdb", "action", "object", "./Objects.xml");
        for(int i = 0; i < 10000; i++)
        {
            ObjectDef objectdef = ObjectDef.forID(i);
            int j = objectdef.type;
            String s = objectdef.name;
            String s1 = (new StringBuilder()).append("It's a ").append(s).append(".").toString();
            if(objectdef.description != null)
                s1 = new String(objectdef.description);
            String as[] = objectdef.actions;
            if(s == null)
                continue;
            Hashtable hashtable = new Hashtable();
            hashtable.put("name", s);
            hashtable.put("description", s1);
            hashtable.put("type", (new StringBuilder()).append("").append(j).toString());
            Vector vector = new Vector();
            if(as != null)
            {
                for(int k = 0; k < 5; k++)
                    if(as[k] != null)
                        vector.add(as[k]);

            }
            xmlwriter.addItem(hashtable, vector);
        }

        xmlwriter.closeXML();
        break MISSING_BLOCK_LABEL_258;
        Exception exception;
        exception;
        exception.printStackTrace();
        xmlwriter.closeXML();
        break MISSING_BLOCK_LABEL_258;
        Exception exception1;
        exception1;
        xmlwriter.closeXML();
        throw exception1;
    }

    protected void writeItems()
    {
        XMLWriter xmlwriter;
        System.out.println("Writing objects to Items.xml");
        xmlwriter = new XMLWriter("itemdb", "action", "item", "./Items.xml");
        for(int i = 0; i < 10000; i++)
        {
            ItemDef itemdef = ItemDef.forID(i);
            int j = itemdef.id;
            String s = itemdef.name;
            String s1 = (new StringBuilder()).append("It's a ").append(s).append(".").toString();
            if(itemdef.description != null)
                s1 = new String(itemdef.description);
            String as[] = itemdef.actions;
            boolean flag = itemdef.membersObject;
            if(s == null)
                continue;
            Hashtable hashtable = new Hashtable();
            hashtable.put("name", s);
            hashtable.put("description", s1);
            hashtable.put("type", (new StringBuilder()).append("").append(j).toString());
            hashtable.put("members", (new StringBuilder()).append("").append(flag).toString());
            Vector vector = new Vector();
            if(as != null)
            {
                for(int k = 0; k < as.length; k++)
                    if(as[k] != null)
                        vector.add(as[k]);

            }
            xmlwriter.addItem(hashtable, vector);
        }

        xmlwriter.closeXML();
        break MISSING_BLOCK_LABEL_294;
        Exception exception;
        exception;
        exception.printStackTrace();
        xmlwriter.closeXML();
        break MISSING_BLOCK_LABEL_294;
        Exception exception1;
        exception1;
        xmlwriter.closeXML();
        throw exception1;
    }

    protected void writeMonsters()
    {
        XMLWriter xmlwriter;
        System.out.println("Writing objects to Objects.xml");
        xmlwriter = new XMLWriter("monsterdb", "action", "monster", "./Monsters.xml");
        for(int i = 0; i < 10000; i++)
        {
            EntityDef entitydef = EntityDef.forID(i);
            long l = entitydef.type;
            String s = entitydef.name;
            String s1 = (new StringBuilder()).append("It's a ").append(s).append(".").toString();
            if(entitydef.description != null)
                s1 = new String(entitydef.description);
            String as[] = entitydef.actions;
            if(s == null)
                continue;
            Hashtable hashtable = new Hashtable();
            hashtable.put("name", s);
            hashtable.put("description", s1);
            hashtable.put("type", (new StringBuilder()).append("").append(l).toString());
            hashtable.put("combat", (new StringBuilder()).append("").append(entitydef.combatLevel).toString());
            Vector vector = new Vector();
            if(as != null)
            {
                for(int j = 0; j < 5; j++)
                    if(as[j] != null)
                        vector.add(as[j]);

            }
            xmlwriter.addItem(hashtable, vector);
        }

        xmlwriter.closeXML();
        break MISSING_BLOCK_LABEL_288;
        Exception exception;
        exception;
        exception.printStackTrace();
        xmlwriter.closeXML();
        break MISSING_BLOCK_LABEL_288;
        Exception exception1;
        exception1;
        xmlwriter.closeXML();
        throw exception1;
    }