From: Hendrik B. <nh...@us...> - 2011-05-03 18:36:00
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/script In directory vz-cvs-4.sog:/tmp/cvs-serv25887/src/games/stendhal/server/script Modified Files: CreateRaid.java Log Message: fixed line endings Index: CreateRaid.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/script/CreateRaid.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CreateRaid.java 12 Feb 2011 14:10:33 -0000 1.13 --- CreateRaid.java 3 May 2011 18:35:58 -0000 1.14 *************** *** 11,68 **** * * ***************************************************************************/ ! package games.stendhal.server.script; ! import games.stendhal.common.Rand; ! import games.stendhal.server.core.engine.StendhalRPZone; ! import games.stendhal.server.core.scripting.ScriptImpl; ! import games.stendhal.server.entity.creature.RaidCreature; ! import games.stendhal.server.entity.player.Player; ! ! import java.util.List; ! import java.util.Map; /** * Base class for creating small raids of creatures from other lists * Picks randomly from the list and summons raid creatures within a radius of the admin. ! */ ! public abstract class CreateRaid extends ScriptImpl { private final int RADIUS = 5; ! ! protected abstract Map<String, Integer> createArmy(); ! ! @Override ! public void execute(final Player admin, final List<String> args) { ! ! if (args.size() > 0) { ! admin.sendPrivateText(getInfo()); ! return; ! } ! ! // extract position of admin ! final StendhalRPZone myZone = sandbox.getZone(admin); ! final int x = admin.getX(); ! final int y = admin.getY(); ! sandbox.setZone(myZone); ! ! for (final Map.Entry<String, Integer> entry : createArmy().entrySet()) { ! final RaidCreature creature = new RaidCreature(sandbox.getCreature(entry.getKey())); ! ! for (int i = 0; i < entry.getValue(); i++) { if(Rand.roll1D6()==1) { sandbox.add(creature, x + games.stendhal.common.Rand.randUniform(-RADIUS, RADIUS), y + games.stendhal.common.Rand.randUniform(-RADIUS, RADIUS)); ! } ! } ! } ! } ! ! /** ! * contains info to help raid makers decide if this special raid script is applicable for the given users or other usefull info. ! * ! * @return the info to simplify life of raid maker ! */ ! protected String getInfo() { ! return "no special Info"; ! } ! } --- 11,68 ---- * * ***************************************************************************/ ! package games.stendhal.server.script; ! import games.stendhal.common.Rand; ! import games.stendhal.server.core.engine.StendhalRPZone; ! import games.stendhal.server.core.scripting.ScriptImpl; ! import games.stendhal.server.entity.creature.RaidCreature; ! import games.stendhal.server.entity.player.Player; ! ! import java.util.List; ! import java.util.Map; /** * Base class for creating small raids of creatures from other lists * Picks randomly from the list and summons raid creatures within a radius of the admin. ! */ ! public abstract class CreateRaid extends ScriptImpl { private final int RADIUS = 5; ! ! protected abstract Map<String, Integer> createArmy(); ! ! @Override ! public void execute(final Player admin, final List<String> args) { ! ! if (args.size() > 0) { ! admin.sendPrivateText(getInfo()); ! return; ! } ! ! // extract position of admin ! final StendhalRPZone myZone = sandbox.getZone(admin); ! final int x = admin.getX(); ! final int y = admin.getY(); ! sandbox.setZone(myZone); ! ! for (final Map.Entry<String, Integer> entry : createArmy().entrySet()) { ! final RaidCreature creature = new RaidCreature(sandbox.getCreature(entry.getKey())); ! ! for (int i = 0; i < entry.getValue(); i++) { if(Rand.roll1D6()==1) { sandbox.add(creature, x + games.stendhal.common.Rand.randUniform(-RADIUS, RADIUS), y + games.stendhal.common.Rand.randUniform(-RADIUS, RADIUS)); ! } ! } ! } ! } ! ! /** ! * contains info to help raid makers decide if this special raid script is applicable for the given users or other usefull info. ! * ! * @return the info to simplify life of raid maker ! */ ! protected String getInfo() { ! return "no special Info"; ! } ! } |