From: Hendrik B. <nh...@us...> - 2006-08-08 19:09:07
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/actions In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv11198/src/games/stendhal/server/actions Modified Files: AdministrationAction.java Log Message: /inspect of items Index: AdministrationAction.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/actions/AdministrationAction.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AdministrationAction.java 4 Aug 2006 21:31:40 -0000 1.12 --- AdministrationAction.java 8 Aug 2006 19:09:03 -0000 1.13 *************** *** 583,587 **** Log4J.startMethod(logger, "onInspect"); ! RPEntity inspected = null; if (action.has("target")) { --- 583,587 ---- Log4J.startMethod(logger, "onInspect"); ! Entity target = null; if (action.has("target")) { *************** *** 589,593 **** for (Player p : rules.getPlayers()) { if (p.getName().equals(name)) { ! inspected = p; break; } --- 589,593 ---- for (Player p : rules.getPlayers()) { if (p.getName().equals(name)) { ! target = p; break; } *************** *** 601,611 **** if (zone.has(id)) { RPObject object = zone.get(id); ! if (object instanceof RPEntity) { ! inspected = (RPEntity) object; } } } ! if (inspected == null) { String text = "Entity not found"; player.sendPrivateText(text); --- 601,611 ---- if (zone.has(id)) { RPObject object = zone.get(id); ! if (object instanceof Entity) { ! target = (Entity) object; } } } ! if (target == null) { String text = "Entity not found"; player.sendPrivateText(text); *************** *** 614,662 **** StringBuffer st = new StringBuffer(); - // It would be nice if the entity's type would be shown, but I don't - // know if the type attribute is mandatory. - //st.append("Inspected " + inspected.get("type") + " is called " + inspected.getName() + " and has attributes:"); - st.append("Inspected entity is called " + inspected.getName() + " and has attributes:"); - st.append("\nID: " + inspected.getID()); - st.append("\nATK: " + inspected.getATK() + "(" - + inspected.getATKXP() + ")"); - st.append("\nDEF: " + inspected.getDEF() + "(" - + inspected.getDEFXP() + ")"); - st.append("\nHP: " + inspected.getHP() + " / " - + inspected.getBaseHP()); - st.append("\nXP: " + inspected.getXP()); - st.append("\nLevel: " + inspected.getLevel()); ! st.append("\nequips"); ! for (RPSlot slot : inspected.slots()) { ! if (slot.getName().equals("!buddy")) { ! continue; ! } ! st.append("\n Slot " + slot.getName() + ": "); ! ! if (slot.getName().equals("!quests") ! || slot.getName().equals("!kills")) { ! for (RPObject object : slot) { ! st.append(object); } ! } else { ! for (RPObject object : slot) { ! String item = object.get("type"); ! if (object.has("name")) { ! item = object.get("name"); } ! if (object instanceof StackableItem) { ! st.append("[" + item + " Q=" + object.get("quantity") ! + "], "); ! } else { ! st.append("[" + item + "], "); } } } } - if (inspected instanceof Player) { - st.append("\r\n" + StendhalQuestSystem.get().listQuests((Player) inspected)); - } - player.sendPrivateText(st.toString()); Log4J.finishMethod(logger, "onInspect"); --- 614,669 ---- StringBuffer st = new StringBuffer(); ! if (target instanceof RPEntity) { ! RPEntity inspected = (RPEntity) target; ! ! // It would be nice if the entity's type would be shown, but I don't ! // know if the type attribute is mandatory. ! //st.append("Inspected " + inspected.get("type") + " is called " + inspected.getName() + " and has attributes:"); ! st.append("Inspected entity is called " + inspected.getName() + " and has attributes:"); ! st.append("\nID: " + inspected.getID()); ! st.append("\nATK: " + inspected.getATK() + "(" ! + inspected.getATKXP() + ")"); ! st.append("\nDEF: " + inspected.getDEF() + "(" ! + inspected.getDEFXP() + ")"); ! st.append("\nHP: " + inspected.getHP() + " / " ! + inspected.getBaseHP()); ! st.append("\nXP: " + inspected.getXP()); ! st.append("\nLevel: " + inspected.getLevel()); ! ! st.append("\nequips"); ! for (RPSlot slot : inspected.slots()) { ! if (slot.getName().equals("!buddy")) { ! continue; } ! st.append("\n Slot " + slot.getName() + ": "); ! ! if (slot.getName().equals("!quests") ! || slot.getName().equals("!kills")) { ! for (RPObject object : slot) { ! st.append(object); } ! } else { ! for (RPObject object : slot) { ! String item = object.get("type"); ! if (object.has("name")) { ! item = object.get("name"); ! } ! if (object instanceof StackableItem) { ! st.append("[" + item + " Q=" + object.get("quantity") ! + "], "); ! } else { ! st.append("[" + item + "], "); ! } } } } + if (inspected instanceof Player) { + st.append("\r\n" + StendhalQuestSystem.get().listQuests((Player) inspected)); + } + } else { + st.append("Inspected entity has id " + action.getInt("targetid") + " and has attributes:\r\n"); + st.append(target.toString()); } player.sendPrivateText(st.toString()); Log4J.finishMethod(logger, "onInspect"); |