megameknet-cvs Mailing List for MegaMekNET (Page 2)
Status: Inactive
Brought to you by:
mcwizard
You can subscribe to this list here.
2005 |
Jan
|
Feb
(203) |
Mar
(268) |
Apr
(41) |
May
(7) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Immanuel S. <im...@us...> - 2005-04-09 14:08:41
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/cyclops In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15313/src/server/cyclops Modified Files: CyclopsVisitor.java Cyclops.java Log Message: cyclops pilot.* function Index: CyclopsVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/cyclops/CyclopsVisitor.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CyclopsVisitor.java 9 Apr 2005 09:47:44 -0000 1.3 --- CyclopsVisitor.java 9 Apr 2005 14:08:31 -0000 1.4 *************** *** 27,30 **** --- 27,31 ---- import common.Continent; import common.House; + import common.Pilot; import common.Planet; import common.PlanetEnvironment; *************** *** 286,288 **** --- 287,303 ---- return e; } + + + /** + * pilot struct is : + * id, piloting, gunnery, desc + */ + public Object visitPilot(Pilot data) { + HashMap e = new HashMap(); + e.put("id", "id"+data.getId()); + e.put("piloting", new Integer(data.getPiloting())); + e.put("gunnery", new Integer(data.getGunnery())); + e.put("desc", data.getName()); + return e; + } } Index: Cyclops.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/cyclops/Cyclops.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Cyclops.java 9 Apr 2005 12:56:37 -0000 1.4 --- Cyclops.java 9 Apr 2005 14:08:31 -0000 1.5 *************** *** 82,85 **** --- 82,86 ---- m.put("id", filename); m.put("name", e.getShortName()); + System.out.println(e.getShortName()); m.put("filename", filename); m.put("chassis", e.getChassis()); |
From: Immanuel S. <im...@us...> - 2005-04-09 14:08:41
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15313/src/server/campaign/commands Modified Files: CyclopsCommand.java Log Message: cyclops pilot.* function Index: CyclopsCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/CyclopsCommand.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CyclopsCommand.java 9 Apr 2005 12:56:39 -0000 1.4 --- CyclopsCommand.java 9 Apr 2005 14:08:32 -0000 1.5 *************** *** 17,22 **** --- 17,24 ---- import java.net.URL; import java.util.Collection; + import java.util.Iterator; import java.util.LinkedList; import java.util.List; + import common.Unit; import server.campaign.CampaignMain; import server.cyclops.Cyclops; *************** *** 46,49 **** --- 48,52 ---- " planet.writeFromList - Send all planets to cyclops.<br>" + " planet.write#planet - Send the 'planet' to cyclops.<br>" + + " pilot.writeFromList - Send all pilots in all units to cyclops.<br>" + " house.writeFromList - Send all houses to cyclops.<br>" + " house.updateFromList - Send all houses to cyclops as update.<br>" + *************** *** 87,90 **** --- 90,98 ---- } else if (command.equals("planet.writeFromList")) { o = CampaignMain.cm.getData().getAllPlanets(); + } else if (command.equals("pilot.writeFromList")) { + LinkedList pilots = new LinkedList(); + for (Iterator it = CampaignMain.cm.units.values().iterator(); it.hasNext();) + pilots.add(((Unit)it.next()).getPilot()); + o = pilots; } else if (command.startsWith("house.") && command.endsWith("FromList")) { o = CampaignMain.cm.getData().getAllHouses(); |
From: Immanuel S. <im...@us...> - 2005-04-09 12:56:47
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10580/src/server/campaign Modified Files: CampaignMain.java Log Message: more cyclops changes Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** CampaignMain.java 9 Apr 2005 09:47:46 -0000 1.123 --- CampaignMain.java 9 Apr 2005 12:56:38 -0000 1.124 *************** *** 237,241 **** SXMLSaveVisitor saver = new SXMLSaveVisitor(); // Units ! saver.toXml("campaign/unit.xml", "units", CampaignMain.cm.units.values()); // Houses (one file for each house because memory concerns) for (Iterator it = data.getAllHouses().iterator(); it.hasNext();) { --- 237,242 ---- SXMLSaveVisitor saver = new SXMLSaveVisitor(); // Units ! updateUnitList(); ! saver.toXml("campaign/unit.xml", "units", units.values()); // Houses (one file for each house because memory concerns) for (Iterator it = data.getAllHouses().iterator(); it.hasNext();) { *************** *** 258,264 **** }); // Blackboard ! saver.toXml("campaign/blackboard.xml", CampaignMain.cm.getBlackBoard()); // Market ! saver.toXml("campaign/blackmarket.xml", CampaignMain.cm.getMarket()); // Planet environment saver.toXml("campaign/planetEnvironment.xml", "planetEnvironments", data.getAllTerrains()); --- 259,265 ---- }); // Blackboard ! saver.toXml("campaign/blackboard.xml", getBlackBoard()); // Market ! saver.toXml("campaign/blackmarket.xml", getMarket()); // Planet environment saver.toXml("campaign/planetEnvironment.xml", "planetEnvironments", data.getAllTerrains()); *************** *** 410,436 **** } - // generate a list of all units in the system. - for (Iterator it = getData().getAllHouses().iterator();it.hasNext();) { - SHouse house = (SHouse)it.next(); - for (Iterator pl = house.getMembers().values().iterator(); pl.hasNext();) { - for (Iterator un = ((SPlayer)pl.next()).getUnits().iterator(); un.hasNext();) { - SUnit u = (SUnit)un.next(); - units.put(new Integer(u.getId()), u); - } - } - for (Iterator ha = house.getHangar().values().iterator(); ha.hasNext();) { - for (Iterator ha2 = ((Vector)ha.next()).iterator(); ha2.hasNext();) { - for (Iterator ha3 = ((Vector)ha2.next()).iterator(); ha3.hasNext();) { - SUnit u = (SUnit)ha3.next(); - units.put(new Integer(u.getId()), u); - } - } - } - } - for (Iterator it = market.getAllUnits().iterator(); it.hasNext();) { - SUnit u = (SUnit)((MarketUnit)it.next()).getCmech(); - units.put(new Integer(u.getId()), u); - } - // saving in fresh xml format for the next run to make it better :) saveData(); --- 411,414 ---- *************** *** 491,495 **** rpcserver = new RPCServer(Integer.parseInt(getConfig("RPCPORT")), data); } ! /** * Stops the RPC server instance. --- 469,503 ---- rpcserver = new RPCServer(Integer.parseInt(getConfig("RPCPORT")), data); } ! ! /** ! * Updates the campaign intern unit list by iterating through all players ! * and houses and collect all units in the list. ! */ ! private void updateUnitList() { ! units = new HashMap(); ! // generate a list of all units in the system. ! for (Iterator it = getData().getAllHouses().iterator();it.hasNext();) { ! SHouse house = (SHouse)it.next(); ! for (Iterator pl = house.getMembers().values().iterator(); pl.hasNext();) { ! for (Iterator un = ((SPlayer)pl.next()).getUnits().iterator(); un.hasNext();) { ! SUnit u = (SUnit)un.next(); ! units.put(new Integer(u.getId()), u); ! } ! } ! for (Iterator ha = house.getHangar().values().iterator(); ha.hasNext();) { ! for (Iterator ha2 = ((Vector)ha.next()).iterator(); ha2.hasNext();) { ! for (Iterator ha3 = ((Vector)ha2.next()).iterator(); ha3.hasNext();) { ! SUnit u = (SUnit)ha3.next(); ! units.put(new Integer(u.getId()), u); ! } ! } ! } ! } ! for (Iterator it = market.getAllUnits().iterator(); it.hasNext();) { ! SUnit u = (SUnit)((MarketUnit)it.next()).getCmech(); ! units.put(new Integer(u.getId()), u); ! } ! } ! /** * Stops the RPC server instance. *************** *** 718,722 **** cmd.process(param, userName); } catch (IllegalUsageException e) { ! toUser("Illegal Arguments to command '"+cmdName+"'."+cmd.getUsage(), userName, true); } catch (RuntimeException e) { toUser("Your command has thrown an exception ("+e.getClass().getName()+"). Please do a bug report or inform a developer.", userName, true); --- 726,730 ---- cmd.process(param, userName); } catch (IllegalUsageException e) { ! toUser("Illegal Arguments to command '"+cmdName+"'. Usage: "+cmd.getUsage(), userName, true); } catch (RuntimeException e) { toUser("Your command has thrown an exception ("+e.getClass().getName()+"). Please do a bug report or inform a developer.", userName, true); *************** *** 960,971 **** while (ST.hasMoreElements()) { String mek = ST.nextToken().toLowerCase(); ! //Is one of the meks reported owned by the player? Then he ! // didn't ! // watch but play the game! if (mek.indexOf(Username.toLowerCase()) != -1) participated = true; ! //Graveyard meks and Destroyed meks count equal.. We do the ! // salvage ! // code ourselfes Meks.add(mek); } --- 968,977 ---- while (ST.hasMoreElements()) { String mek = ST.nextToken().toLowerCase(); ! // Is one of the meks reported owned by the player? Then he ! // didn't watch but play the game! if (mek.indexOf(Username.toLowerCase()) != -1) participated = true; ! // Graveyard meks and Destroyed meks count equal.. We do the ! // salvage code ourselfes Meks.add(mek); } *************** *** 1731,1758 **** } - // unit rebuild - units = new Hashtable(); - for (Iterator it = getData().getAllHouses().iterator();it.hasNext();) { - SHouse house = (SHouse)it.next(); - for (Iterator pl = house.getMembers().values().iterator(); pl.hasNext();) { - for (Iterator un = ((SPlayer)pl.next()).getUnits().iterator(); un.hasNext();) { - SUnit u = (SUnit)un.next(); - units.put(new Integer(u.getId()), u); - } - } - for (Iterator ha = house.getHangar().values().iterator(); ha.hasNext();) { - for (Iterator ha2 = ((Vector)ha.next()).iterator(); ha2.hasNext();) { - for (Iterator ha3 = ((Vector)ha2.next()).iterator(); ha3.hasNext();) { - SUnit u = (SUnit)ha3.next(); - units.put(new Integer(u.getId()), u); - } - } - } - } - for (Iterator it = market.getAllUnits().iterator(); it.hasNext();) { - SUnit u = (SUnit)((MarketUnit)it.next()).getCmech(); - units.put(new Integer(u.getId()), u); - } - //Purge inactive? - Every 100 ticks if (tickid % 100 == 0){ --- 1737,1740 ---- *************** *** 1765,1768 **** --- 1747,1752 ---- // serverDescriptions.save(getConfig("ServerDescription")); + saveData(); + System.gc(); } |
From: Immanuel S. <im...@us...> - 2005-04-09 12:56:47
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10580/src/server/campaign/commands Modified Files: CyclopsCommand.java Log Message: more cyclops changes Index: CyclopsCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/CyclopsCommand.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CyclopsCommand.java 9 Apr 2005 09:47:44 -0000 1.3 --- CyclopsCommand.java 9 Apr 2005 12:56:39 -0000 1.4 *************** *** 16,25 **** import java.net.MalformedURLException; import java.net.URL; import java.util.LinkedList; import java.util.List; import server.campaign.CampaignMain; import server.cyclops.Cyclops; - import common.House; - import common.Planet; --- 16,24 ---- import java.net.MalformedURLException; import java.net.URL; + import java.util.Collection; import java.util.LinkedList; import java.util.List; import server.campaign.CampaignMain; import server.cyclops.Cyclops; *************** *** 45,54 **** " player.writeFromList[#playerspercall] - Send all players to cyclops.<br>" + " player.write#player - Send the player to cyclops.<br>" + ! " planet.initFromList - Send all planets to cyclops.<br>" + ! " planet.init#planet - Send the 'planet' to cyclops.<br>" + ! " house.initFromList - Send all houses to cyclops.<br>" + " house.updateFromList - Send all houses to cyclops as update.<br>" + ! " house.init#house - Send the 'house' to cyclops.<br>" + ! " house.update#house - Send the 'house' to cyclops as update."; } --- 44,54 ---- " player.writeFromList[#playerspercall] - Send all players to cyclops.<br>" + " player.write#player - Send the player to cyclops.<br>" + ! " planet.writeFromList - Send all planets to cyclops.<br>" + ! " planet.write#planet - Send the 'planet' to cyclops.<br>" + ! " house.writeFromList - Send all houses to cyclops.<br>" + " house.updateFromList - Send all houses to cyclops as update.<br>" + ! " house.write#house - Send the 'house' to cyclops.<br>" + ! " house.update#house - Send the 'house' to cyclops as update.<br>" + ! " unitTemplate.writeFromList - Send all megamek entities."; } *************** *** 60,63 **** --- 60,69 ---- String command = param[0]; String report = null; + Object o = null; + int packageSize = 0; + + if (command.endsWith("FromList") && param.length > 1) + packageSize = Integer.parseInt(param[1]); + if (command.equals("host")) { if (param.length < 2) *************** *** 72,116 **** } } else if (command.equals("player.writeFromList")) { ! if (param.length > 1) { ! int packagesize = Integer.parseInt(param[1]); ! List all = new LinkedList(CampaignMain.cm.getAllPlayers().values()); ! for (int i = 0; i < (all.size()+packagesize-1)/packagesize && report == null; ++i) { ! List l = all.subList(i*packagesize, (i+1)*packagesize); ! System.out.println("index "+(i*packagesize)+" to "+((i+1)*packagesize)); ! report = Cyclops.player_writeFromList(l); ! } ! ! } else ! report = Cyclops.player_writeFromList(CampaignMain.cm.getAllPlayers().values()); } else if (command.equals("player.write")) { if (param.length < 2) throw new IllegalUsageException(); ! report = Cyclops.player_write(CampaignMain.cm.getPlayer(param[1])); ! } else if (command.equals("planet.initFromList")) { ! report = Cyclops.planet_initFromList(CampaignMain.cm.getData().getAllPlanets()); ! } else if (command.equals("house.initFromList")) { ! report = Cyclops.house_initFromList(CampaignMain.cm.getData().getAllHouses()); ! } else if (command.equals("house.updateFromList")) { ! report = Cyclops.house_updateFromList(CampaignMain.cm.getData().getAllHouses()); ! } else if (command.equals("planet.init") || command.equals("planet.update")) { if (param.length < 2) throw new IllegalUsageException(); ! Planet p = CampaignMain.cm.getPlanetFromPartialString(param[1], userName); ! if (p == null) ! return; ! if (command.equals("planet.init")) ! report = Cyclops.planet_init(p); ! else ! report = Cyclops.planet_update(p); ! } else if (command.equals("house.init") || command.equals("house.update")) { if (param.length < 2) throw new IllegalUsageException(); ! House house = CampaignMain.cm.getHouseForName(param[1]); ! if (command.equals("house.init")) ! report = Cyclops.house_init(house); ! else ! report = Cyclops.house_update(house); } else throw new IllegalUsageException(); if (report != null) send("Cyclops report error: "+report, userName); --- 78,116 ---- } } else if (command.equals("player.writeFromList")) { ! if (param.length > 1) ! packageSize = Integer.parseInt(param[1]); ! o = CampaignMain.cm.getAllPlayers().values(); } else if (command.equals("player.write")) { if (param.length < 2) throw new IllegalUsageException(); ! o = CampaignMain.cm.getPlayer(param[1]); ! } else if (command.equals("planet.writeFromList")) { ! o = CampaignMain.cm.getData().getAllPlanets(); ! } else if (command.startsWith("house.") && command.endsWith("FromList")) { ! o = CampaignMain.cm.getData().getAllHouses(); ! } else if (command.equals("planet.write") || command.equals("planet.update")) { if (param.length < 2) throw new IllegalUsageException(); ! o = CampaignMain.cm.getPlanetFromPartialString(param[1], userName); ! } else if (command.equals("house.write") || command.equals("house.update")) { if (param.length < 2) throw new IllegalUsageException(); ! o = CampaignMain.cm.getHouseForName(param[1]); ! } else if (command.equals("unitTemplate.writeFromList")) { ! report = Cyclops.unitTemplate_writeFromList(); } else throw new IllegalUsageException(); + if (o != null) { + if (packageSize > 0 && o instanceof Collection && param.length > 1) { + List all = new LinkedList((Collection)o); + for (int i = 0; i < (all.size()+packageSize-1)/packageSize && report == null; ++i) { + int upperBound = Math.min((i+1)*packageSize, all.size()); + List l = all.subList(i*packageSize, upperBound); + System.out.println("index "+(i*packageSize)+" to "+upperBound); + report = Cyclops.invoke(command, l); + } + } else + report = Cyclops.invoke(command, o); + } if (report != null) send("Cyclops report error: "+report, userName); |
From: Immanuel S. <im...@us...> - 2005-04-09 12:56:46
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10580/src/common/visitor Modified Files: XMLLoadVisitor.java Log Message: more cyclops changes Index: XMLLoadVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/visitor/XMLLoadVisitor.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** XMLLoadVisitor.java 9 Apr 2005 09:47:45 -0000 1.8 --- XMLLoadVisitor.java 9 Apr 2005 12:56:38 -0000 1.9 *************** *** 393,403 **** List unitsInHangar = new LinkedList(); ! for (Iterator it = toIdList(toString("unitIds", e)).iterator(); it.hasNext();) ! unitsInHangar.add((Unit)units.get(new Integer((String)it.next()))); data.setUnits(unitsInHangar); List unitsOnMarket = new LinkedList(); ! for (Iterator it = toIdList(toString("unitsOnMarket", e)).iterator(); it.hasNext();) ! unitsOnMarket.add((Unit)units.get(new Integer((String)it.next()))); data.setUnitsOnMarket(unitsOnMarket); --- 393,413 ---- List unitsInHangar = new LinkedList(); ! for (Iterator it = toIdList(toString("unitIds", e)).iterator(); it.hasNext();) { ! String unitId = (String)it.next(); ! Unit u = (Unit)units.get(new Integer(unitId)); ! if (u == null) ! throw new RuntimeException("Unit "+unitId+" not found"); ! unitsInHangar.add(u); ! } data.setUnits(unitsInHangar); List unitsOnMarket = new LinkedList(); ! for (Iterator it = toIdList(toString("unitsOnMarket", e)).iterator(); it.hasNext();) { ! String unitId = (String)it.next(); ! Unit u = (Unit)units.get(new Integer(unitId)); ! if (u == null) ! throw new RuntimeException("Unit "+unitId+" not found"); ! unitsOnMarket.add(u); ! } data.setUnitsOnMarket(unitsOnMarket); |
From: Immanuel S. <im...@us...> - 2005-04-09 12:56:46
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/cyclops In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10580/src/server/cyclops Modified Files: Cyclops.java Log Message: more cyclops changes Index: Cyclops.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/cyclops/Cyclops.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Cyclops.java 9 Apr 2005 09:47:44 -0000 1.3 --- Cyclops.java 9 Apr 2005 12:56:37 -0000 1.4 *************** *** 14,24 **** package server.cyclops; import java.net.MalformedURLException; import java.net.URL; import java.util.Collection; import java.util.Iterator; ! import common.House; ! import common.Planet; ! import common.Player; import common.util.CommunicationException; import common.util.MMNetXmlRpcClient; --- 14,35 ---- package server.cyclops; + import java.io.File; + import java.io.FileFilter; import java.net.MalformedURLException; import java.net.URL; import java.util.Collection; + import java.util.HashMap; import java.util.Iterator; ! import java.util.LinkedList; ! import java.util.zip.ZipEntry; ! import java.util.zip.ZipFile; ! import megamek.common.BattleArmor; ! import megamek.common.Entity; ! import megamek.common.Infantry; ! import megamek.common.Mech; ! import megamek.common.MechFileParser; ! import megamek.common.Protomech; ! import megamek.common.QuadMech; ! import megamek.common.Tank; import common.util.CommunicationException; import common.util.MMNetXmlRpcClient; *************** *** 41,111 **** } ! /** ! * Send the players given at parameter to the cyclops server. ! */ ! public static String player_writeFromList(Collection players) { ! return invoke1("player.writeFromList", players); ! } ! ! /** ! * Send the player given at parameter to the cyclops server. ! */ ! public static String player_write(Player player) { ! return invoke1("player.write", player); ! } ! ! /** ! * Send the houses given at parameter to the cyclops server. ! */ ! public static String planet_initFromList(Collection planets) { ! for (Iterator it = planets.iterator(); it.hasNext();) { ! String ret = invoke1("planet.init", (Planet)it.next()); ! if (ret != null) ! return ret; } ! System.out.println("Cyclops: finished dumping "+planets.size()+" planets."); ! return null; ! } ! ! /** ! * Send the houses given at parameter to the cyclops server. ! */ ! public static String planet_init(Planet planet) { ! return invoke1("planet.init", planet); ! } ! ! /** ! * Send the planet given at parameter to the cyclops server as update. ! */ ! public static String planet_update(Planet planet) { ! return invoke1("planet.update", planet); ! } ! ! /** ! * Send the houses given at parameter to the cyclops server. ! */ ! public static String house_initFromList(Collection houses) { ! return invoke1("house.initFromList", houses); ! } ! ! /** ! * Send the given house to cyclops as update. ! */ ! public static String house_update(House house) { ! return invoke1("house.update", house); ! } ! ! /** ! * Send the given house to cyclops. ! */ ! public static String house_init(House house) { ! return invoke1("house.init", house); ! } ! /** ! * Send the houses given at parameter to the cyclops server as an update. ! */ ! public static String house_updateFromList(Collection houses) { ! return invoke1("house.updateFromList", houses); } --- 52,117 ---- } ! public static String unitTemplate_writeFromList() { ! File[] zips = new File("./data/mechfiles").listFiles(new FileFilter() { ! public boolean accept(File pathname) { ! return pathname.getName().toLowerCase().endsWith(".zip"); ! } ! }); ! HashMap allMechs = new HashMap(); ! for (int i = 0; i < zips.length; i++) { ! try { ! ZipFile zFile = new ZipFile(zips[i]); ! for (java.util.Enumeration j = zFile.entries(); j.hasMoreElements();) { ! ZipEntry zEntry = (ZipEntry)j.nextElement(); ! if (zEntry.isDirectory() || zEntry.getName().toLowerCase().endsWith(".txt")) ! continue; ! allMechs.put(zEntry.getName(), new MechFileParser(zips[i], zEntry.getName()).getEntity()); ! } ! } catch (Exception ex) { ! if (ex instanceof RuntimeException) ! throw (RuntimeException)ex; ! throw new RuntimeException(ex); ! } } ! ! LinkedList templates = new LinkedList(); ! for (Iterator it = allMechs.keySet().iterator(); it.hasNext();) { ! String filename = (String)it.next(); ! Entity e = (Entity)allMechs.get(filename); ! HashMap m = new HashMap(); ! m.put("id", filename); ! m.put("name", e.getShortName()); ! m.put("filename", filename); ! m.put("chassis", e.getChassis()); ! m.put("model", e.getModel()); ! m.put("tonnage", new Integer((int)e.getWeight())); ! ! if (e.getWeight() <= 35) ! m.put("class", "light"); ! else if (e.getWeight() <= 55) ! m.put("class", "medium"); ! else if (e.getWeight() <= 75) ! m.put("class", "heavy"); ! else ! m.put("class", "assault"); ! if (e instanceof Tank) ! m.put("category", "vehicle"); ! else if (e instanceof Infantry) ! m.put("category", "infantry"); ! else if (e instanceof Mech) ! m.put("category", "mech"); ! else if (e instanceof QuadMech) ! m.put("category", "mech"); ! else if (e instanceof BattleArmor) ! m.put("category", "infantry"); ! else if (e instanceof Protomech) ! m.put("category", "mech"); ! else ! m.put("category", "unknown"); ! ! templates.add(m); ! } ! return invoke("unitTemplate.writeFromList", templates); } *************** *** 113,117 **** * Send the given house to cyclops. */ ! private static String invoke1(String cmd, Object o) { MMNetXmlRpcClient client = new MMNetXmlRpcClient(server, false); System.out.println("Cyclops call: "+cmd); --- 119,123 ---- * Send the given house to cyclops. */ ! public static String invoke(String cmd, Object o) { MMNetXmlRpcClient client = new MMNetXmlRpcClient(server, false); System.out.println("Cyclops call: "+cmd); |
From: Immanuel S. <im...@us...> - 2005-04-09 09:48:24
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/server/campaign/commands Modified Files: UnVoteCommand.java CyclopsCommand.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: CyclopsCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/CyclopsCommand.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CyclopsCommand.java 25 Mar 2005 19:52:54 -0000 1.2 --- CyclopsCommand.java 9 Apr 2005 09:47:44 -0000 1.3 *************** *** 16,23 **** import java.net.MalformedURLException; import java.net.URL; ! import common.House; ! import common.Planet; import server.campaign.CampaignMain; import server.cyclops.Cyclops; --- 16,25 ---- import java.net.MalformedURLException; import java.net.URL; ! import java.util.LinkedList; ! import java.util.List; import server.campaign.CampaignMain; import server.cyclops.Cyclops; + import common.House; + import common.Planet; *************** *** 41,44 **** --- 43,48 ---- return "Calls manually any cyclops command. Supported commands are:<br>" + " host#url - set the cyclops-host to 'url'.<br>" + + " player.writeFromList[#playerspercall] - Send all players to cyclops.<br>" + + " player.write#player - Send the player to cyclops.<br>" + " planet.initFromList - Send all planets to cyclops.<br>" + " planet.init#planet - Send the 'planet' to cyclops.<br>" + *************** *** 67,70 **** --- 71,90 ---- return; } + } else if (command.equals("player.writeFromList")) { + if (param.length > 1) { + int packagesize = Integer.parseInt(param[1]); + List all = new LinkedList(CampaignMain.cm.getAllPlayers().values()); + for (int i = 0; i < (all.size()+packagesize-1)/packagesize && report == null; ++i) { + List l = all.subList(i*packagesize, (i+1)*packagesize); + System.out.println("index "+(i*packagesize)+" to "+((i+1)*packagesize)); + report = Cyclops.player_writeFromList(l); + } + + } else + report = Cyclops.player_writeFromList(CampaignMain.cm.getAllPlayers().values()); + } else if (command.equals("player.write")) { + if (param.length < 2) + throw new IllegalUsageException(); + report = Cyclops.player_write(CampaignMain.cm.getPlayer(param[1])); } else if (command.equals("planet.initFromList")) { report = Cyclops.planet_initFromList(CampaignMain.cm.getData().getAllPlanets()); Index: UnVoteCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/UnVoteCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnVoteCommand.java 13 Mar 2005 17:20:39 -0000 1.1 --- UnVoteCommand.java 9 Apr 2005 09:47:44 -0000 1.2 *************** *** 14,20 **** package server.campaign.commands; import java.util.Iterator; - import java.util.List; - import server.campaign.CampaignMain; import server.campaign.SPlayer; --- 14,19 ---- package server.campaign.commands; + import java.util.Collection; import java.util.Iterator; import server.campaign.CampaignMain; import server.campaign.SPlayer; *************** *** 39,43 **** SPlayer p = CampaignMain.cm.getPlayer(userName); String target = param[0]; ! List l = VoteManager.getInstance().getVotesFrom(p.getName()); Iterator it = l.iterator(); while (it.hasNext()){ --- 38,42 ---- SPlayer p = CampaignMain.cm.getPlayer(userName); String target = param[0]; ! Collection l = VoteManager.getInstance().getVotesFrom(p.getName()); Iterator it = l.iterator(); while (it.hasNext()){ |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:59
|
Update of /cvsroot/megameknet/MegaMekNET/server-dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/server-dist Modified Files: terrain.xml .cvsignore Log Message: Cyclops changes and some minor corrections to the xml loading Index: .cvsignore =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/server-dist/.cvsignore,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** .cvsignore 14 Mar 2005 21:07:47 -0000 1.5 --- .cvsignore 9 Apr 2005 09:47:44 -0000 1.6 *************** *** 13,14 **** --- 13,15 ---- houses.dat prepare + generatedTerrains.txt Index: terrain.xml =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/server-dist/terrain.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** terrain.xml 18 Jun 2004 13:52:00 -0000 1.1 --- terrain.xml 9 Apr 2005 09:47:44 -0000 1.2 *************** *** 1,936 **** ! <?xml version="1.0" encoding="UTF-8"?> ! <!DOCTYPE DOCUMENT SYSTEM "terrain.dtd"> ! <DOCUMENT> ! <MEGAMEKNETTERRAINDATA> ! <TERRAIN> ! <NAME>Jungle</NAME> ! <ENVIRONMENT> ! <ENVIRONMENTPROBABILITY>50</ENVIRONMENTPROBABILITY> ! <CRATERPROB>0</CRATERPROB> ! <CRATERMINNUM>0</CRATERMINNUM> [...1842 lines suppressed...] ! <ROUGHMINSPOTS>6</ROUGHMINSPOTS> ! <ROUGHMAXSPOTS>8</ROUGHMAXSPOTS> ! <ROUGHMINHEXES>1</ROUGHMINHEXES> ! <ROUGHMAXHEXES>3</ROUGHMAXHEXES> ! <ROADPROB>50</ROADPROB> ! <WATERMINSPOTS>2</WATERMINSPOTS> ! <WATERMAXSPOTS>4</WATERMAXSPOTS> ! <WATERMINHEXES>1</WATERMINHEXES> ! <WATERMAXHEXES>3</WATERMAXHEXES> ! <RIVERPROB>0</RIVERPROB> ! <CRATERPROB>100</CRATERPROB> ! <CRATERMINNUM>2</CRATERMINNUM> ! <CRATERMAXNUM>4</CRATERMAXNUM> ! <CRATERMINRADIUS>2</CRATERMINRADIUS> ! <CRATERMAXRADIUS>7</CRATERMAXRADIUS> ! </ENVIRONMENT> ! </TERRAIN> ! </MEGAMEKNETTERRAINDATA> ! </DOCUMENT> \ No newline at end of file |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:59
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/ranks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/server/campaign/ranks Modified Files: VoteManager.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: VoteManager.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/ranks/VoteManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VoteManager.java 13 Mar 2005 10:43:29 -0000 1.1 --- VoteManager.java 9 Apr 2005 09:47:44 -0000 1.2 *************** *** 15,18 **** --- 15,19 ---- import java.util.ArrayList; + import java.util.Collections; import java.util.Hashtable; import java.util.List; *************** *** 51,59 **** public List getVotesFor(String name){ ! return (List)votees.get(name); } public List getVotesFrom(String name){ ! return (List)voters.get(name); } --- 52,62 ---- public List getVotesFor(String name){ ! return Collections.unmodifiableList( ! votees.contains(name) ? (List)votees.get(name) : new ArrayList()); } public List getVotesFrom(String name){ ! return Collections.unmodifiableList( ! voters.contains(name) ? (List)voters.get(name) : new ArrayList()); } *************** *** 66,70 **** result.add(v); } ! private void removeFromList(Hashtable h, String key, Vote v){ Object o = h.get(key); --- 69,73 ---- result.add(v); } ! private void removeFromList(Hashtable h, String key, Vote v){ Object o = h.get(key); |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:59
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/cyclops In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/server/cyclops Modified Files: CyclopsVisitor.java Cyclops.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: CyclopsVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/cyclops/CyclopsVisitor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CyclopsVisitor.java 25 Mar 2005 19:52:54 -0000 1.2 --- CyclopsVisitor.java 9 Apr 2005 09:47:44 -0000 1.3 *************** *** 19,27 **** --- 19,33 ---- import java.util.Iterator; import java.util.LinkedList; + import java.util.List; + import java.util.Map; + import server.campaign.CampaignMain; import server.campaign.SPlanet; + import server.campaign.SPlayer; + import server.campaign.ranks.RankClassifier; import common.Continent; import common.House; import common.Planet; import common.PlanetEnvironment; + import common.Player; import common.UnitFactory; import common.visitor.AbstractVisitor; *************** *** 90,93 **** --- 96,100 ---- * - continents (an array of continent structs) * - enhancements (an array of enhancement struct) + * - influences (an array of influences struct) * * continent struct is : *************** *** 100,104 **** * - desc (str) * - type (char3) ! * - rank (char3) */ public Object visitPlanet(Planet dataPlanet) { --- 107,126 ---- * - desc (str) * - type (char3) ! * WH - Warehouse ! * LM - light mech ! * MM - medium mech ! * HM - heavy mech ! * AM - assault mech ! * LV - light vehicle ! * MV - medium vehicle ! * HV - heavy vehicle ! * AV - assault vehicle ! * LI - light infantry ! * AI - assault infantry ("battlearmor" on lvl2 servers) ! * - rank (char3) ! * ! * influence struct is: ! * - house (id of the house) ! * - influence (integer with influence on the planet) */ public Object visitPlanet(Planet dataPlanet) { *************** *** 146,157 **** wh.put("type", "WH"); wh.put("rank", new Integer(data.getBaysProvided())); } for (Iterator it = data.getUnitFactories().iterator(); it.hasNext();) { UnitFactory uf = (UnitFactory)it.next(); ! HashMap h = new HashMap(); ! h.put("id", "id"+data.getId()); ! //TODO: continue here. } return e; } --- 168,210 ---- wh.put("type", "WH"); wh.put("rank", new Integer(data.getBaysProvided())); + enhancements.add(wh); + } + // sum up all factory types for this planet + class CyclopsFab { + String id; + String desc; + String planet; + String type; + int rank; } + Map sumFabs = new HashMap(); for (Iterator it = data.getUnitFactories().iterator(); it.hasNext();) { UnitFactory uf = (UnitFactory)it.next(); ! String type = uf.getSize().substring(0,1) + uf.getTypeString(); ! HashMap c = (HashMap)sumFabs.get(type); ! if (c == null) { ! c = new HashMap(); ! c.put("planet", "id"+data.getId()); ! c.put("id", "id"+data.getId()+type); ! c.put("type", type); ! c.put("desc", uf.getName()); ! c.put("rank", new Integer(0)); ! } ! c.put("rank", new Integer(((Integer)c.get("rank")).intValue()+1)); ! sumFabs.put(type, c); } + enhancements.addAll(sumFabs.values()); + e.put("enhancements", enhancements); + // Influences + List influences = new LinkedList(); + for (Iterator it = data.getInfluence().getHouseIds().iterator();it.hasNext();) { + HashMap h = new HashMap(); + Integer id = (Integer)it.next(); + h.put("house", "id"+id); + h.put("influence", new Integer(data.getInfluence().getInfluence(id.intValue()))); + influences.add(h); + } + e.put("influences", influences); return e; } *************** *** 207,209 **** --- 260,288 ---- return new BigInteger(bin, 2).intValue(); } + + /** + * id, + * username, + * desc, (not used in MMnet i guess), + * house, (houseid) + * logo, (url) + * camo, + * passwd, (leave it empty) + * access, (that the user level in MMnet, let's define a encoding) + * level (that's the rank of the player) + */ + public Object visitPlayer(Player data) { + SPlayer p = (SPlayer)data; + HashMap e = new HashMap(); + e.put("id", "id"+p.getName().toLowerCase()); + e.put("username", p.getName()); + // e.put("desc", ""); + e.put("house", "id"+p.getMyHouse().getId()); + e.put("logo", p.getLogo()); + // e.put("passwd", ""); + // e.put("camo", ""); + e.put("access", new Integer(CampaignMain.cm.getServer().getUserAccessLevel(p.getName()))); + e.put("level", RankClassifier.getRankDescription(p)); + return e; + } } Index: Cyclops.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/cyclops/Cyclops.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Cyclops.java 25 Mar 2005 19:52:54 -0000 1.2 --- Cyclops.java 9 Apr 2005 09:47:44 -0000 1.3 *************** *** 20,23 **** --- 20,24 ---- import common.House; import common.Planet; + import common.Player; import common.util.CommunicationException; import common.util.MMNetXmlRpcClient; *************** *** 41,44 **** --- 42,59 ---- /** + * Send the players given at parameter to the cyclops server. + */ + public static String player_writeFromList(Collection players) { + return invoke1("player.writeFromList", players); + } + + /** + * Send the player given at parameter to the cyclops server. + */ + public static String player_write(Player player) { + return invoke1("player.write", player); + } + + /** * Send the houses given at parameter to the cyclops server. */ |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:59
|
Update of /cvsroot/megameknet/MegaMekNET/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/client Modified Files: CAddToChat.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: CAddToChat.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/CAddToChat.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CAddToChat.java 14 Mar 2005 11:45:50 -0000 1.2 --- CAddToChat.java 9 Apr 2005 09:47:45 -0000 1.3 *************** *** 110,114 **** } ! MessageFormat mf = new MessageFormat(input.toString()); mf.format(parameter.toArray(), input = new StringBuffer(), null); if (client.getConfigParam("BEAUTIFIER").equalsIgnoreCase("DEBUG")) --- 110,117 ---- } ! String inputStr = input.toString(); ! inputStr.replaceAll("\\{", "b;"); ! inputStr.replaceAll("\\}", "d;"); ! MessageFormat mf = new MessageFormat(inputStr); mf.format(parameter.toArray(), input = new StringBuffer(), null); if (client.getConfigParam("BEAUTIFIER").equalsIgnoreCase("DEBUG")) |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:59
|
Update of /cvsroot/megameknet/MegaMekNET/src/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/common Modified Files: Player.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: Player.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/Player.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Player.java 5 Mar 2005 12:50:15 -0000 1.12 --- Player.java 9 Apr 2005 09:47:45 -0000 1.13 *************** *** 23,27 **** public class Player implements Visitorable { - private int id; private String name; private int money = 0; --- 23,26 ---- *************** *** 118,133 **** } /** - * @return Returns the id. - */ - public int getId() { - return id; - } - /** - * @param id The id to set. - */ - public void setId(int id) { - this.id = id; - } - /** * @return Returns the money. */ --- 117,120 ---- |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:58
|
Update of /cvsroot/megameknet/MegaMekNET/src/common/visitor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/common/visitor Modified Files: XMLSaveVisitor.java XMLLoadVisitor.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: XMLSaveVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/visitor/XMLSaveVisitor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** XMLSaveVisitor.java 26 Mar 2005 17:44:27 -0000 1.10 --- XMLSaveVisitor.java 9 Apr 2005 09:47:45 -0000 1.11 *************** *** 322,326 **** public Object visitPlayer(Player data) { Element e = start("player", data, Player.class); - attr(e, "id", data.getId()); attr(e, "name", data.getName()); attr(e, "money", data.getMoney()); --- 322,325 ---- Index: XMLLoadVisitor.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/common/visitor/XMLLoadVisitor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** XMLLoadVisitor.java 26 Mar 2005 17:44:27 -0000 1.7 --- XMLLoadVisitor.java 9 Apr 2005 09:47:45 -0000 1.8 *************** *** 384,388 **** public Object visitPlayer(Player data) { - data.setId(toInt("id", e)); data.setName(toString("name", e)); data.setMoney(toInt("money", e)); --- 384,387 ---- |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:58
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/server/campaign Modified Files: CampaignMain.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: CampaignMain.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/CampaignMain.java,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** CampaignMain.java 29 Mar 2005 20:10:38 -0000 1.122 --- CampaignMain.java 9 Apr 2005 09:47:46 -0000 1.123 *************** *** 433,443 **** } ! try { ! // saving in fresh xml format for the next run to make it better :) ! // yea, I know. Not the fine english way to do the save, but this ! // is temporary anyway. ! new SaveCampaignCommand().process(new String[]{"xml"}, null); ! } catch (Exception e1) { ! } } // end loading old .dat file format --- 433,438 ---- } ! // saving in fresh xml format for the next run to make it better :) ! saveData(); } // end loading old .dat file format *************** *** 1733,1739 **** BlackBoardMessage bbm = (BlackBoardMessage) it.next(); if (bbm.decreaseTick()) ! it.remove(); } ! // unit rebuild units = new Hashtable(); --- 1728,1734 ---- BlackBoardMessage bbm = (BlackBoardMessage) it.next(); if (bbm.decreaseTick()) ! blackBoard.removeMessage(bbm.getTitle()); } ! // unit rebuild units = new Hashtable(); |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:58
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/mercenaries In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/server/campaign/mercenaries Modified Files: MercHouse.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: MercHouse.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/mercenaries/MercHouse.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MercHouse.java 26 Mar 2005 12:22:17 -0000 1.11 --- MercHouse.java 9 Apr 2005 09:47:46 -0000 1.12 *************** *** 96,100 **** public void setContract(ContractInfo cToAdd, SPlayer player) { //add contract to hash, with player as key. ! outstandingContracts.put(new Integer(player.getId()), cToAdd); } --- 96,100 ---- public void setContract(ContractInfo cToAdd, SPlayer player) { //add contract to hash, with player as key. ! outstandingContracts.put(player.getName(), cToAdd); } |
From: Immanuel S. <im...@us...> - 2005-04-09 09:47:58
|
Update of /cvsroot/megameknet/MegaMekNET/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5552/src/server Modified Files: MMServ.java Log Message: Cyclops changes and some minor corrections to the xml loading Index: MMServ.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/MMServ.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** MMServ.java 27 Mar 2005 08:36:37 -0000 1.36 --- MMServ.java 9 Apr 2005 09:47:46 -0000 1.37 *************** *** 355,377 **** public boolean isAdmin(String username) { ! com.lyrisoft.chat.server.remote.ChatClient c = this.myCommunicator.getClient(ChatServer.clientKey(username)); ! if (c != null) { ! if (c.getAccessLevel() >= CustomPasswdAuthenticator.ADMIN) { ! return true; ! } ! } ! return false; ! } public boolean isModerator(String username) { com.lyrisoft.chat.server.remote.ChatClient c = this.myCommunicator.getClient(ChatServer.clientKey(username)); if (c != null) { ! if (c.getAccessLevel() >= CustomPasswdAuthenticator.CAMPAIGN_MODERATOR) { ! return true; ! } } ! return false; ! } --- 355,371 ---- public boolean isAdmin(String username) { ! return getUserAccessLevel(username) >= CustomPasswdAuthenticator.ADMIN; } public boolean isModerator(String username) { + return getUserAccessLevel(username) >= CustomPasswdAuthenticator.CAMPAIGN_MODERATOR; + } + + public int getUserAccessLevel(String username) { com.lyrisoft.chat.server.remote.ChatClient c = this.myCommunicator.getClient(ChatServer.clientKey(username)); if (c != null) { ! return c.getAccessLevel(); } ! return -1; } |
From: Helge R. <mcw...@us...> - 2005-04-05 17:45:29
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9261/src/server/campaign/commands Modified Files: PurgeInactiveCommand.java Log Message: Banneed players are not auto-deleted Index: PurgeInactiveCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/PurgeInactiveCommand.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PurgeInactiveCommand.java 22 Feb 2005 22:27:20 -0000 1.9 --- PurgeInactiveCommand.java 5 Apr 2005 17:45:19 -0000 1.10 *************** *** 16,19 **** --- 16,20 ---- import java.util.*; + import server.BanList; import server.campaign.*; *************** *** 57,60 **** --- 58,65 ---- while (f.hasMoreElements()) { SPlayer p = (SPlayer) f.nextElement(); + //Do not check banned players + if (BanList.getInstance().isBannedName(p.getName())){ + continue; + } if (((System.currentTimeMillis() - p.getLastOnlineDate().getTime()) / 86400000) > daysInactive) { if (h.isNewbieHouse()){ |
From: Helge R. <mcw...@us...> - 2005-04-05 17:45:29
|
Update of /cvsroot/megameknet/MegaMekNET/src/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9261/src/server Modified Files: BanList.java Log Message: Banneed players are not auto-deleted Index: BanList.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/BanList.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BanList.java 19 Feb 2005 01:40:35 -0000 1.2 --- BanList.java 5 Apr 2005 17:45:20 -0000 1.3 *************** *** 17,20 **** --- 17,23 ---- import java.util.Map; + import server.campaign.CampaignMain; + import server.campaign.SPlayer; + /** * @author Helge Richter *************** *** 47,50 **** --- 50,57 ---- public boolean isBanned(String IP, String accountName){ + return isBannedIP(IP) || isBannedName(accountName); + } + + public boolean isBannedIP(String IP){ //Check the IP if (bannedIPs.get(IP) != null){ *************** *** 57,60 **** --- 64,71 ---- } } + return false; + } + + public boolean isBannedName(String accountName){ //Check the Account if (bannedAccounts.get(accountName.toLowerCase()) != null){ *************** *** 63,66 **** --- 74,82 ---- if (System.currentTimeMillis() > time.longValue()){ bannedAccounts.remove(accountName.toLowerCase()); + //If he was just unbanned, act as if he just logged in, so that he's not auto-deleted + SPlayer p = CampaignMain.cm.getPlayer(accountName); + if (p != null){ + p.setLastOnline(System.currentTimeMillis()); + } } else { return true; *************** *** 69,72 **** --- 85,89 ---- return false; } + public Object[] getBannedAccounts(){ return bannedAccounts.keySet().toArray(); |
From: Helge R. <mcw...@us...> - 2005-04-02 14:29:20
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21040/src/server/campaign/commands Modified Files: CheckAttackCommand.java Log Message: last bunch of TrainingTask fixes Index: CheckAttackCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/CheckAttackCommand.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** CheckAttackCommand.java 8 Mar 2005 22:38:52 -0000 1.26 --- CheckAttackCommand.java 2 Apr 2005 14:29:10 -0000 1.27 *************** *** 24,27 **** --- 24,28 ---- import server.campaign.tasks.ConquerTask; import server.campaign.tasks.MechRaidTask; + import server.campaign.tasks.TrainingTask; import common.constants.PlayerStatus; *************** *** 66,69 **** --- 67,71 ---- StringBuffer raidResult = new StringBuffer("You may raid: "); StringBuffer conquerResult = new StringBuffer("You may conquer: "); + StringBuffer trainResult = new StringBuffer("You may train: "); SArmy army = (SArmy)armies.next(); result.append("Army "); *************** *** 86,89 **** --- 88,92 ---- List possibleRaidDefendings = pl.isAbleToDefendVs(p, army, 1.0, Integer.parseInt(CampaignMain.cm.getConfig("MaxBVDifference")), new MechRaidTask()); List possibleConquerDefendings = pl.isAbleToDefendVs(p, army, 1.0, Integer.parseInt(CampaignMain.cm.getConfig("MaxBVDifference")), new ConquerTask()); + List possibleTrainingDefendings = pl.isAbleToDefendVs(p, army, 1.0, Integer.parseInt(CampaignMain.cm.getConfig("MaxBVDifference")), new TrainingTask()); //Can he defend? if (possibleRaidDefendings.size() > 0) { *************** *** 98,101 **** --- 101,115 ---- } } + if (possibleTrainingDefendings.size() > 0) { + //Add Housename + trainResult.append(pl.getMyHouse().getHouseFightingFor(pl).getColoredAbbreviation() + " ("); + for (int i = 0; i < possibleTrainingDefendings.size(); i++) { + //Show all possible combinations + Object tmp = possibleTrainingDefendings.get(i); + SArmy defendArmy = ((SArmy)tmp); + trainResult.append(defendArmy.getAmountOfUnitsWithoutInfantry()); + trainResult.append((i < possibleTrainingDefendings.size() - 1) ? "," : ")"); + } + } if (possibleConquerDefendings.size() > 0) { //Add Housename *************** *** 116,120 **** } } ! result.append(raidResult + "<br>" + conquerResult + "<br>"); } return result.toString(); --- 130,134 ---- } } ! result.append(raidResult + "<br>" + conquerResult + "<br>" + trainResult + "<br>"); } return result.toString(); |
From: Helge R. <mcw...@us...> - 2005-04-02 14:29:20
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/tasks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21040/src/server/campaign/tasks Modified Files: TrainingTask.java Log Message: last bunch of TrainingTask fixes Index: TrainingTask.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/tasks/TrainingTask.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TrainingTask.java 26 Mar 2005 16:40:58 -0000 1.2 --- TrainingTask.java 2 Apr 2005 14:29:10 -0000 1.3 *************** *** 27,30 **** --- 27,34 ---- */ public class TrainingTask extends Task { + + public TrainingTask(){ + super(); + } public TrainingTask(SPlayer actor, SPlanet target, String task, SArmy army) { *************** *** 32,35 **** --- 36,43 ---- } + public boolean countForRanking() { + return false; + } + /* (non-Javadoc) * @see server.campaign.tasks.Task#doTickGain(server.campaign.SPlayer, int) |
From: Helge R. <mcw...@us...> - 2005-04-02 14:29:20
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21040/src/client/gui Modified Files: CMainFrame.java Log Message: last bunch of TrainingTask fixes Index: CMainFrame.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/CMainFrame.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** CMainFrame.java 29 Mar 2005 20:10:48 -0000 1.59 --- CMainFrame.java 2 Apr 2005 14:29:10 -0000 1.60 *************** *** 1018,1021 **** --- 1018,1022 ---- jMenuTask.add(jMenuTaskComponentRaid); jMenuTask.add(jMenuTaskDelayRaid); + jMenuTask.add(jMenuTaskTraining); jMenuTask.addSeparator(); jMenuTask.add(jMenuTaskTriad); |
From: Helge R. <mcw...@us...> - 2005-04-02 09:08:25
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20084/src/server/campaign Modified Files: SHouse.java Log Message: fixed possible NPE Index: SHouse.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/SHouse.java,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** SHouse.java 26 Mar 2005 17:44:25 -0000 1.95 --- SHouse.java 2 Apr 2005 09:08:07 -0000 1.96 *************** *** 1839,1848 **** List l = VoteManager.getInstance().getVotesFrom(name); ! Iterator it = l.iterator(); ! while (it.hasNext()){ ! Vote v = (Vote)it.next(); ! VoteManager.getInstance().removeVote(v); } - getMembers().remove(name.toLowerCase()); --- 1839,1849 ---- List l = VoteManager.getInstance().getVotesFrom(name); ! if (l != null){ ! Iterator it = l.iterator(); ! while (it.hasNext()){ ! Vote v = (Vote)it.next(); ! VoteManager.getInstance().removeVote(v); ! } } getMembers().remove(name.toLowerCase()); |
From: Helge R. <mcw...@us...> - 2005-04-01 19:33:40
|
Update of /cvsroot/megameknet/MegaMekNET/src/client In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30439/src/client Modified Files: MMClient.java Log Message: client reads config again due to FW problems on Highlander Index: MMClient.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/MMClient.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** MMClient.java 28 Mar 2005 17:23:50 -0000 1.68 --- MMClient.java 1 Apr 2005 19:33:14 -0000 1.69 *************** *** 209,213 **** createGUICommands(); dataFetcher = new DataFetchClient( ! Integer.parseInt(config.getServerPort()) + 1, config.getServerIP()); --- 209,213 ---- createGUICommands(); dataFetcher = new DataFetchClient( ! Integer.parseInt(config.getParam("DATAPORT")), config.getServerIP()); |
From: Helge R. <mcw...@us...> - 2005-03-29 20:11:17
|
Update of /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11524/src/server/campaign/commands Modified Files: SaveCampaignCommand.java Log Message: prevent a NPE Index: SaveCampaignCommand.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/server/campaign/commands/SaveCampaignCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SaveCampaignCommand.java 27 Mar 2005 08:36:36 -0000 1.1 --- SaveCampaignCommand.java 29 Mar 2005 20:10:37 -0000 1.2 *************** *** 54,61 **** } else throw new IllegalUsageException(); ! send(saveString+" saved!",userName); } catch (RuntimeException e) { e.printStackTrace(); ! send("XML saving failed because: "+e, userName); } } --- 54,63 ---- } else throw new IllegalUsageException(); ! if (userName != null) ! send(saveString+" saved!",userName); } catch (RuntimeException e) { e.printStackTrace(); ! if (userName != null) ! send("XML saving failed because: "+e, userName); } } |
From: Helge R. <mcw...@us...> - 2005-03-29 20:10:59
|
Update of /cvsroot/megameknet/MegaMekNET/src/client/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11524/src/client/gui Modified Files: CMainFrame.java Log Message: prevent a NPE Index: CMainFrame.java =================================================================== RCS file: /cvsroot/megameknet/MegaMekNET/src/client/gui/CMainFrame.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** CMainFrame.java 27 Feb 2005 19:17:06 -0000 1.58 --- CMainFrame.java 29 Mar 2005 20:10:48 -0000 1.59 *************** *** 1824,1828 **** dlg.show(); String planetNamestr = (String)combo.getSelectedItem(); ! if (planetNamestr == null || planetNamestr.length() == 0) return; Planet planet = client.getData().getPlanetByName(planetNamestr); --- 1824,1828 ---- dlg.show(); String planetNamestr = (String)combo.getSelectedItem(); ! if (planetNamestr == null || planetNamestr.length() == 0 ) return; Planet planet = client.getData().getPlanetByName(planetNamestr); |