Changeset a53bf3df2ee843c7dcbff98462aa9c06d33cf7c1
- Timestamp:
- 07/20/08 18:05:12
(1 month ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1216569912 +0200
- git-parent:
[f76390b959038f5635e9e51ab381b567ff6d78d0]
- git-author:
- Sebastian Gift <Madison@gt-knm.de> 1216569912 +0200
- Message:
[feature] Die Position und der Typ eines Schiffes koennen jetzt ebenfalls geaendert werden.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rbe48d2f |
ra53bf3d |
|
| 20 | 20 | |
|---|
| 21 | 21 | import java.util.HashMap; |
|---|
| | 22 | import java.util.List; |
|---|
| 22 | 23 | import java.util.Map; |
|---|
| 23 | 24 | |
|---|
| … | … | |
| 34 | 35 | import net.driftingsouls.ds2.server.modules.AdminController; |
|---|
| 35 | 36 | import net.driftingsouls.ds2.server.ships.Ship; |
|---|
| | 37 | import net.driftingsouls.ds2.server.ships.ShipType; |
|---|
| 36 | 38 | import net.driftingsouls.ds2.server.ships.ShipTypeData; |
|---|
| 37 | 39 | |
|---|
| … | … | |
| 44 | 46 | public class EditShip implements AdminPlugin |
|---|
| 45 | 47 | { |
|---|
| | 48 | @SuppressWarnings("unchecked") |
|---|
| 46 | 49 | public void output(AdminController controller, String page, int action) |
|---|
| 47 | 50 | { |
|---|
| … | … | |
| 74 | 77 | ship.setOwner(owner); |
|---|
| 75 | 78 | } |
|---|
| | 79 | ShipType type = (ShipType)db.get(ShipType.class, context.getRequest().getParameterInt("type")); |
|---|
| | 80 | if(type != null) |
|---|
| | 81 | { |
|---|
| | 82 | ship.setBaseType(type); |
|---|
| | 83 | } |
|---|
| | 84 | ship.setSystem(context.getRequest().getParameterInt("system")); |
|---|
| | 85 | ship.setX(context.getRequest().getParameterInt("x")); |
|---|
| | 86 | ship.setY(context.getRequest().getParameterInt("y")); |
|---|
| 76 | 87 | ship.setHull(context.getRequest().getParameterInt("hull")); |
|---|
| 77 | 88 | ship.setAblativeArmor(context.getRequest().getParameterInt("ablativearmor")); |
|---|
| … | … | |
| 121 | 132 | |
|---|
| 122 | 133 | |
|---|
| | 134 | Map<Integer, String> shiptypes = new HashMap<Integer, String>(); |
|---|
| | 135 | List<ShipType> types = (List<ShipType>)db.createQuery("from ShipType").list(); |
|---|
| | 136 | for(ShipType shiptype: types) |
|---|
| | 137 | { |
|---|
| | 138 | shiptypes.put(shiptype.getId(), shiptype.getNickname()); |
|---|
| | 139 | } |
|---|
| | 140 | |
|---|
| | 141 | |
|---|
| 123 | 142 | echo.append("<form action=\"./ds\" method=\"post\">"); |
|---|
| 124 | 143 | echo.append("<table class=\"noBorder\" width=\"100%\">"); |
|---|
| … | … | |
| 130 | 149 | echo.append("<tr><td class=\"noBorderS\">Name: </td><td><input type=\"text\" name=\"name\" value=\"" + ship.getName() + "\"></td></tr>\n"); |
|---|
| 131 | 150 | echo.append("<tr><td class=\"noBorderS\">Besitzer: </td><td><input type=\"text\" name=\"owner\" value=\"" + ship.getOwner().getId() + "\"></td><td class=\"noBorderS\">"+ Common._title(ship.getOwner().getNickname()) +"</td></tr>\n"); |
|---|
| | 151 | echo.append("<tr><td class=\"noBorderS\">System: </td><td><input type=\"text\" name=\"system\" value=\"" + ship.getSystem() + "\"></td></tr>\n"); |
|---|
| | 152 | echo.append("<tr><td class=\"noBorderS\">x: </td><td><input type=\"text\" name=\"x\" value=\"" + ship.getX() + "\"></td></tr>\n"); |
|---|
| | 153 | echo.append("<tr><td class=\"noBorderS\">y: </td><td><input type=\"text\" name=\"y\" value=\"" + ship.getY() + "\"></td></tr>\n"); |
|---|
| | 154 | echo.append("<tr><td class=\"noBorderS\">Schiffstyp: </td><td><select size=\"1\" name=\"type\" \">"); |
|---|
| | 155 | for(Map.Entry<Integer, String> shiptype: shiptypes.entrySet()) |
|---|
| | 156 | { |
|---|
| | 157 | echo.append("<option value=\""+ shiptype.getKey() +"\" " + (shiptype.getKey().equals(ship.getBaseType().getId()) ? "selected=\"selected\"" : "") + " />"+shiptype.getValue()+"</option>"); |
|---|
| | 158 | } |
|---|
| | 159 | echo.append("</select></td></tr>\n"); |
|---|
| 132 | 160 | echo.append("<tr><td class=\"noBorderS\">Huelle: </td><td><input type=\"text\" name=\"hull\" value=\"" + ship.getHull() + "\"></td><td class=\"noBorderS\">/ "+type.getHull()+"</td></tr>\n"); |
|---|
| 133 | 161 | echo.append("<tr><td class=\"noBorderS\">Ablative Panzerung: </td><td><input type=\"text\" name=\"ablativearmor\" value=\"" + ship.getAblativeArmor() + "\"></td><td class=\"noBorderS\">/ "+type.getAblativeArmor()+"</td></tr>\n"); |
|---|