Changeset 8e3cf9b4c2ca1641f6fffa569ea85a5309290daf
- Timestamp:
- 07/01/07 14:57:03 (1 year ago)
- git-parent:
- Files:
-
- db/tables/werft_queues.sql (added)
- db/updates.xml (modified) (1 diff)
- src/net/driftingsouls/ds2/server/bases/Kommandozentrale.java (modified) (3 diffs)
- src/net/driftingsouls/ds2/server/bases/Werft.java (modified) (2 diffs)
- src/net/driftingsouls/ds2/server/entities/User.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/modules/SchiffInfoController.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/tick/regular/WerftTick.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/werften/BaseWerft.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/werften/WerftGUI.java (modified) (8 diffs)
- src/net/driftingsouls/ds2/server/werften/WerftObject.java (modified) (21 diffs)
- src/net/driftingsouls/ds2/server/werften/WerftQueueEntry.java (added)
- templates/schiffinfo.html (modified) (1 diff)
- templates/werft.werftgui.html (modified) (2 diffs)
- web/WEB-INF/cfg/hibernatemappings.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
db/updates.xml
rc3ab33e r8e3cf9b 298 298 ALTER TABLE werften ADD CONSTRAINT werften_fk_ships FOREIGN KEY (shipid) REFERENCES ships(id); 299 299 ]]></update> 300 <update type="structure" datum="2007-07-01"><![CDATA[ 301 CREATE TABLE `werft_queues` ( 302 werft int NOT NULL, 303 `position` int NOT NULL, 304 `building` int(11) default NULL, 305 `item` smallint(6) NOT NULL default '-1', 306 `remaining` tinyint(4) NOT NULL default '0', 307 `flagschiff` tinyint(1) unsigned NOT NULL default '0', 308 PRIMARY KEY (`werft`,`position`) 309 ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 310 311 ALTER TABLE werft_queues ADD CONSTRAINT werft_queues_fk_werften FOREIGN KEY (werft) REFERENCES werften(id); 312 ALTER TABLE werft_queues ADD CONSTRAINT werft_queues_fk_ship_types FOREIGN KEY (building) REFERENCES ship_types(id); 313 314 ALTER TABLE `werften` 315 DROP `building`, 316 DROP `item`, 317 DROP `remaining`; 318 ]]></update> 300 319 </updates> src/net/driftingsouls/ds2/server/bases/Kommandozentrale.java
r283e6c7 r8e3cf9b 42 42 import net.driftingsouls.ds2.server.framework.db.SQLResultRow; 43 43 import net.driftingsouls.ds2.server.framework.templates.TemplateEngine; 44 import net.driftingsouls.ds2.server.werften.BaseWerft; 44 45 45 46 class Kommandozentrale extends DefaultBuilding { … … 56 57 super.cleanup(context, base); 57 58 58 Database db = context.getDatabase(); 59 60 db.update("UPDATE bases SET owner=0,autogtuacts='' WHERE id="+base.getID()); 59 org.hibernate.Session db = context.getDB(); 60 61 61 base.setAutoGTUActs(new ArrayList<AutoGTUAction>()); 62 62 User nullUser = (User)context.getDB().get(User.class, 0); … … 64 64 65 65 // TODO: Unschoen. Das sollte die Werft selbst machen 66 db.update("UPDATE werften SET building=0,item=-1,remaining=0,flagschiff=0 WHERE col="+base.getID()); 67 db.update("UPDATE werften SET linked=0 WHERE linked="+base.getID()); 66 BaseWerft werft = (BaseWerft)db.createQuery("from BaseWerft where col=?") 67 .setEntity(0, base) 68 .uniqueResult(); 69 werft.clearQueue(); 70 71 db.createQuery("update ShipWerft set linked=null where linked=?") 72 .setEntity(0, base) 73 .executeUpdate(); 68 74 } 69 75 src/net/driftingsouls/ds2/server/bases/Werft.java
rc3ab33e r8e3cf9b 55 55 super.build(base); 56 56 57 ContextMap.getContext().getDatabase().update("INSERT INTO werften (type,col) VALUES(1,"+base.getID()+")"); 57 BaseWerft werft = new BaseWerft(base); 58 ContextMap.getContext().getDB().persist(werft); 58 59 } 59 60 … … 63 64 super.cleanup(context, base); 64 65 65 context.getDatabase().update("DELETE FROM werften WHERE col="+base.getID()); 66 context.getDB().createQuery("delete from BaseWerft where col=?") 67 .setEntity(0, base) 68 .executeUpdate(); 66 69 } 67 68 70 69 71 @Override src/net/driftingsouls/ds2/server/entities/User.java
r4e34802 r8e3cf9b 311 311 } 312 312 else { 313 flagschiffSpace = fs.getBoolean("flagschiff") ? 1 : 0;313 flagschiffSpace = 1; 314 314 } 315 315 } 316 316 else { 317 flagschiffSpace = fs.getBoolean("flagschiff") ? 1 : 0;317 flagschiffSpace = 1; 318 318 } 319 319 } src/net/driftingsouls/ds2/server/modules/SchiffInfoController.java
r283e6c7 r8e3cf9b 169 169 t.set_var( "shiptype.cost.energie", shipBuildData.getInt("ekosten"), 170 170 "shiptype.cost.crew", shipBuildData.getInt("crew"), 171 "shiptype.cost.dauer", shipBuildData.getInt("dauer"), 172 "shiptype.cost.linfactor", shipBuildData.getInt("linfactor")*100 ); 171 "shiptype.cost.dauer", shipBuildData.getInt("dauer") ); 173 172 174 173 t.set_block("_SCHIFFINFO", "shiptype.werften.listitem", "shiptype.werften.list" ); src/net/driftingsouls/ds2/server/tick/regular/WerftTick.java
r6b67f71 r8e3cf9b 47 47 org.hibernate.Session db = getDB(); 48 48 49 List werften = db.createQuery("from Werft where building!=0order by id").list();49 List werften = db.createQuery("from WerftObject order by id").list(); 50 50 for( Iterator iter=werften.iterator(); iter.hasNext(); ) { 51 51 WerftObject werft = (WerftObject)iter.next(); src/net/driftingsouls/ds2/server/werften/BaseWerft.java
r6b67f71 r8e3cf9b 54 54 55 55 /** 56 * Erstellt eine neue Werft 57 * @param base Die Basis auf der die Werft stehen soll 58 */ 59 public BaseWerft(Base base) { 60 super(1); 61 this.base = base; 62 } 63 64 /** 56 65 * Gibt die ID der Basis zurueck, auf dem die Werft steht 57 66 * @return Die ID der Basis src/net/driftingsouls/ds2/server/werften/WerftGUI.java
rfdd9b7d r8e3cf9b 81 81 82 82 int build = context.getRequest().getParameterInt("build"); 83 String conf = context.getRequest().getParameterString("conf");84 83 int ws = context.getRequest().getParameterInt("ws"); 85 int item = context.getRequest().getParameterInt("item");86 84 87 85 if( !t.set_file( "_WERFT.WERFTGUI", "werft.werftgui.html" ) ) { … … 92 90 "werftgui.urlbase", werft.getUrlBase() ); 93 91 92 // Baudialog 94 93 if( build != 0 ) { 95 if( werft.isBuilding() ) { 96 t.set_var("werftgui.msg", "Sie können nur ein Schiff zur selben Zeit bauen"); 97 } 98 else { 99 this.out_buildShip(build, item, werft, conf); 100 } 101 } 94 final int item = context.getRequest().getParameterInt("item"); 95 final String conf = context.getRequest().getParameterString("conf"); 96 97 this.out_buildShip(build, item, werft, conf); 98 } 99 // Werkstadt 102 100 else if( ws != 0 ) { 103 101 if( werft.isBuilding() ) { … … 108 106 } 109 107 } 110 else if( werft.isBuilding() ) { 111 this.out_werftbuilding( werft, conf ); 112 } 113 else if( !werft.isBuilding() ) { 108 // Hauptseite 109 else { 110 String show = context.getRequest().getParameterString("show"); 111 if( show.length() == 0 ) { 112 show = "build"; 113 } 114 115 t.set_var("werftgui.main", 1); 116 114 117 SQLResultRow[] shipdata = werft.getBuildShipList(); 115 118 … … 122 125 this.out_ResourceList( werft, costs ); 123 126 124 //Schiffsliste 125 this.out_buildShipList( werft, shipdata ); 126 127 this.out_wsShipList(werft); 128 129 // Verbindung Base <-> Werft 130 if( werft.getWerftType() == WerftObject.SHIP ) { 131 int shipid = ((ShipWerft)werft).getShipID(); 132 int linkedbaseID = ((ShipWerft)werft).getLinkedBase(); 133 134 ShipTypeData shiptype = Ship.getShipType( shipid, true ); 135 if( shiptype.getCost() == 0 ) { 136 t.set_block("_WERFT.WERFTGUI", "werftgui.linkedbase.listitem", "werftgui.linkedbase.list"); 137 138 t.set_var( "linkedbase.selected", linkedbaseID == 0, 139 "linkedbase.value", "-1", 140 "linkedbase.name", (linkedbaseID != 0 ? "kein " : "")+"Ziel" ); 141 142 t.parse("werftgui.linkedbase.list", "werftgui.linkedbase.listitem", true); 143 144 List bases = db.createQuery("from Base " + 145 "where x=? and y=? and system=? and owner=? order by id") 146 .setInteger(0, werft.getX()) 147 .setInteger(1, werft.getY()) 148 .setInteger(2, werft.getSystem()) 149 .setInteger(3, werft.getOwner()) 150 .list(); 151 for( Iterator iter=bases.iterator(); iter.hasNext(); ) { 152 Base base = (Base)iter.next(); 153 154 t.set_var( "linkedbase.selected", (linkedbaseID == base.getID()), 155 "linkedbase.value", base.getID(), 156 "linkedbase.name", base.getName()+" ("+base.getID()+")" ); 157 t.parse("werftgui.linkedbase.list", "werftgui.linkedbase.listitem", true); 127 if( "build".equals(show) ) { 128 t.set_var("werftgui.main.build", 1); 129 130 this.out_buildShipList( werft, shipdata ); 131 } 132 else if( "repair".equals(show) ) { 133 t.set_var("werftgui.main.repair", 1); 134 135 this.out_wsShipList(werft); 136 } 137 else if( "queue".equals(show) ) { 138 t.set_var("werftgui.main.queue", 1); 139 140 final int position = context.getRequest().getParameterInt("entry"); 141 final String action = context.getRequest().getParameterString("werftact"); 142 143 if( action.equals("canclebuild") ) { 144 WerftQueueEntry entry = werft.getBuildQueueEntry(position); 145 if( entry != null ) { 146 t.set_var( "werftgui.building.cancel", 1 ); 147 148 werft.cancelBuild(entry); 158 149 } 159 150 } 151 else if( action.equals("queuedown") ) { 152 WerftQueueEntry entry = werft.getBuildQueueEntry(position); 153 WerftQueueEntry entry2 = werft.getBuildQueueEntry(position+1); 154 if( (entry != null) && (entry2 != null) ) { 155 werft.swapQueueEntries(entry, entry2); 156 } 157 } 158 else if( action.equals("queueup") ) { 159 WerftQueueEntry entry = werft.getBuildQueueEntry(position); 160 WerftQueueEntry entry2 = werft.getBuildQueueEntry(position-1); 161 if( (entry != null) && (entry2 != null) ) { 162 werft.swapQueueEntries(entry, entry2); 163 } 164 } 165 166 out_queueShipList(werft, werft.getBuildQueue()); 167 } 168 else if( "options".equals(show) ) { 169 t.set_var("werftgui.main.options", 1); 170 171 // Verbindung Base <-> Werft 172 if( werft.getWerftType() == WerftObject.SHIP ) { 173 int shipid = ((ShipWerft)werft).getShipID(); 174 int linkedbaseID = ((ShipWerft)werft).getLinkedBase(); 175 176 ShipTypeData shiptype = Ship.getShipType( shipid, true ); 177 if( shiptype.getCost() == 0 ) { 178 t.set_block("_WERFT.WERFTGUI", "werftgui.linkedbase.listitem", "werftgui.linkedbase.list"); 179 180 if( linkedbaseID != 0 ) { 181 t.set_var( "linkedbase.selected", false, 182 "linkedbase.value", "-1", 183 "linkedbase.name", "kein Ziel" ); 184 185 t.parse("werftgui.linkedbase.list", "werftgui.linkedbase.listitem", true); 186 } 187 188 List bases = db.createQuery("from Base " + 189 "where x=? and y=? and system=? and owner=? order by id") 190 .setInteger(0, werft.getX()) 191 .setInteger(1, werft.getY()) 192 .setInteger(2, werft.getSystem()) 193 .setInteger(3, werft.getOwner()) 194 .list(); 195 for( Iterator iter=bases.iterator(); iter.hasNext(); ) { 196 Base base = (Base)iter.next(); 197 198 t.set_var( "linkedbase.selected", (linkedbaseID == base.getID()), 199 "linkedbase.value", base.getID(), 200 "linkedbase.name", base.getName()+" ("+base.getID()+")" ); 201 t.parse("werftgui.linkedbase.list", "werftgui.linkedbase.listitem", true); 202 } 203 } 204 } 160 205 } 161 206 } … … 170 215 t.set_block("_WERFT.WERFTGUI", "wsshiplist.listitem", "wsshiplist.list"); 171 216 172 List ships = db.createQuery("from Ship s inner join fetch s.owner as u " +217 List ships = db.createQuery("from Ship s inner join fetch s.owner as u left join fetch s.modules " + 173 218 "where s.id>0 and (s.x between ? and ?) and (s.y between ? and ?) and s.system=? and " + 174 219 "locate('l ',s.docked)=0 and s.battle=0 order by u.id,s.id") … … 207 252 } 208 253 254 private void out_queueShipList(WerftObject werft, WerftQueueEntry[] queue) { 255 t.set_block("_WERFT.WERFTGUI", "queueshiplist.listitem", "queueshiplist.list"); 256 257 int remaining = 0; 258 for( int i=0; i < queue.length; i++ ) { 259 WerftQueueEntry entry = queue[i]; 260 261 remaining += entry.getRemaining(); 262 263 t.set_var( 264 "queueship.position", entry.getPosition(), 265 "queueship.type.image", entry.getBuilding().getPicture(), 266 "queueship.type.id", entry.getBuilding().getTypeId(), 267 "queueship.type.name", entry.getBuilding().getNickname(), 268 "queueship.remainingtotal", remaining, 269 "queueship.building", i == 0, 270 "queueship.uppossible", i > 0, 271 "queueship.downpossible", i < queue.length-1); 272 273 t.parse("queueshiplist.list", "queueshiplist.listitem", true); 274 } 275 } 276 209 277 private void out_buildShipList(WerftObject werft, SQLResultRow[] shipdata) { 210 278 t.set_var("werftgui.buildshiplist", 1); … … 276 344 277 345 private void out_ResourceList(WerftObject werft, Cargo showonly) { 278 t.set_var("werftgui.reslist", 1);279 346 t.set_block("_WERFT.WERFTGUI", "reslist.res.listitem", "reslist.res.list"); 280 347 … … 298 365 "res.cargo", frei ); 299 366 t.parse("reslist.res.list", "reslist.res.listitem", true); 300 }301 302 private void out_werftbuilding(WerftObject werft, String conf) {303 String action = context.getRequest().getParameterString("werftact");304 305 ShipTypeData type = werft.getBuildShipType();306 307 if( action.equals("canclebuild") && conf.equals("ok") ) {308 t.set_var( "werftgui.building.cancel", 1 );309 werft.cancelBuild();310 return;311 }312 313 t.set_var( "werftgui.building", 1,314 "ship.type.image", type.getPicture(),315 "ship.type.id", type.getTypeId(),316 "ship.type.name", type.getNickname(),317 "ship.build.remaining", werft.getRemainingTime(),318 "werftgui.building.cancel.conf", action.equals("canclebuild") && !conf.equals("ok") );319 320 if( werft.getRequiredItem() > -1 ) {321 t.set_var( "ship.build.item", werft.getRequiredItem(),322 "ship.build.item.picture", Items.get().item(werft.getRequiredItem()).getPicture(),323 "ship.build.item.name", Items.get().item(werft.getRequiredItem()).getName(),324 "ship.build.item.available", werft.isBuildContPossible() );325 }326 367 } 327 368 src/net/driftingsouls/ds2/server/werften/WerftObject.java
rfdd9b7d r8e3cf9b 32 32 import javax.persistence.InheritanceType; 33 33 import javax.persistence.Table; 34 import javax.persistence.Transient; 34 35 35 36 import net.driftingsouls.ds2.server.ContextCommon; … … 86 87 @Id @GeneratedValue 87 88 private int id = 0; 88 private int building = 0;89 @Column(name="item")90 private int buildItem = -1;91 private int remaining = 0;92 89 @Column(name="flagschiff") 93 90 private boolean buildFlagschiff = false; … … 102 99 } 103 100 104 @Deprecated 105 protected WerftObject( SQLResultRow werftdata ) { 106 this.id = werftdata.getInt("id"); 107 this.type = werftdata.getInt("type"); 108 this.building = werftdata.getInt("building"); 109 this.buildItem = werftdata.getInt("item"); 110 this.remaining = werftdata.getInt("remaining"); 111 this.buildFlagschiff = werftdata.getBoolean("flagschiff"); 101 /** 102 * Erstellt eine neue Werft 103 * @param type Der Typ der Werft 104 */ 105 public WerftObject(int type) { 106 this.type = type; 112 107 } 113 108 … … 117 112 */ 118 113 public final boolean isBuilding() { 119 return building != 0; 114 return getQueueTopEntry() != null; 115 } 116 117 /** 118 * Gibt zurueck, ob sich in der Bauschlange ein Flagschiff befindet 119 * @return <code>true</code>, falls ein Flagschiff gebaut werden soll 120 */ 121 public final boolean isBuildFlagschiff() { 122 return this.buildFlagschiff; 123 } 124 125 @Transient 126 private WerftQueueEntry topEntry = null; 127 128 private WerftQueueEntry getQueueTopEntry() { 129 if( topEntry == null ) { 130 org.hibernate.Session db = ContextMap.getContext().getDB(); 131 132 topEntry = (WerftQueueEntry)db 133 .createQuery("from WerftQueueEntry where id.werft=? and id.position=1") 134 .setInteger(0, this.getWerftID()) 135 .uniqueResult(); 136 } 137 138 return topEntry; 120 139 } 121 140 … … 125 144 */ 126 145 public final ShipTypeData getBuildShipType() { 127 if( building > 0 ) { 128 return Ship.getShipType(building, false); 146 WerftQueueEntry entry = getQueueTopEntry(); 147 148 if( entry != null ) { 149 return entry.getBuilding(); 129 150 } 130 151 … … 136 157 */ 137 158 public final void decRemainingTime() { 138 if( remaining <= 0 ) { 159 WerftQueueEntry entry = getQueueTopEntry(); 160 if( (entry == null) || (entry.getRemaining() <= 0) ) { 139 161 return; 140 162 } 141 remaining--;142 ContextMap.getContext().getDatabase().update("UPDATE werften SET remaining=remaining-1 WHERE id=",getWerftID());163 164 entry.setRemaining(entry.getRemaining()-1); 143 165 } 144 166 … … 147 169 */ 148 170 public final void incRemainingTime() { 149 remaining++; 150 ContextMap.getContext().getDatabase().update("UPDATE werften SET remaining=remaining+1 WHERE id=",getWerftID()); 171 WerftQueueEntry entry = getQueueTopEntry(); 172 if( entry == null ) { 173 return; 174 } 175 entry.setRemaining(entry.getRemaining()+1); 151 176 } 152 177 … … 156 181 */ 157 182 public final int getRemainingTime() { 158 return remaining; 183 WerftQueueEntry entry = getQueueTopEntry(); 184 if( entry != null ) { 185 return entry.getRemaining(); 186 } 187 return 0; 159 188 } 160 189 … … 165 194 */ 166 195 public final int getRequiredItem() { 167 return buildItem; 196 WerftQueueEntry entry = getQueueTopEntry(); 197 if( entry != null ) { 198 return entry.getBuildItem(); 199 } 200 return -1; 168 201 } 169 202 … … 185 218 Context context = ContextMap.getContext(); 186 219 org.hibernate.Session db = context.getDB(); 220 221 if( !this.isBuilding() ) { 222 return 0; 223 } 187 224 188 225 ShipTypeData shipd = this.getBuildShipType(); … … 217 254 this.MESSAGE.get().append("\tWerft '"+shipd.getWerft()+"' in Liste der Werften eingetragen\n"); 218 255 } 219 if( this.buildFlagschiff ) { 256 257 WerftQueueEntry entry = getQueueTopEntry(); 258 if( entry.isBuildFlagschiff() ) { 220 259 auser.setFlagschiff(id); 221 260 this.MESSAGE.get().append("\tFlagschiff eingetragen\n"); … … 278 317 ship.recalculateShipStatus(); 279 318 280 this.building = 0; 281 this.remaining = 0; 282 this.buildFlagschiff = false; 283 this.buildItem = -1; 319 if( entry.isBuildFlagschiff() ) { 320 this.buildFlagschiff = false; 321 } 322 323 db.delete(entry); 324 db.createQuery("update WerftQueueEntry set id.position=id.position-1 where id.werft=?") 325 .setInteger(0, this.getWerftID()) 326 .executeUpdate(); 327 328 topEntry = null; 284 329 285 330 return id; … … 319 364 320 365 /** 321 * Bricht das aktuelle Bauvorhaben ab 322 */ 323 public void cancelBuild() { 324 building = 0; 325 remaining = 0; 326 buildItem = -1; 327 buildFlagschiff = false; 366 * Bricht das angegebene Bauvorhaben ab 367 * @param entry Ein Eintrag aus der Bauschlange 368 */ 369 public void cancelBuild(WerftQueueEntry entry) { 370 org.hibernate.Session db = ContextMap.getContext().getDB(); 371 372 if( entry.isBuildFlagschiff() ) { 373 this.buildFlagschiff = false; 374 } 375 db.delete(entry); 376 377 db.createQuery("update WerftQueueEntry set id.position=id.position-1 where id.werft=? and id.position>?") 378 .setInteger(0, this.getWerftID()) 379 .setInteger(1, entry.getPosition()) 380 .executeUpdate(); 381 382 topEntry = null; 383 } 384 385 /** 386 * Entfernt alle Eintraege aus der Bauschlange 387 * 388 */ 389 public void clearQueue() { 390 org.hibernate.Session db = ContextMap.getContext().getDB(); 391 db.createQuery("delete from WerftQueueEntry where id.werft=?") 392 .setInteger(0, this.getWerftID()) 393 .executeUpdate(); 394 395 this.buildFlagschiff = false; 396 this.topEntry = null; 328 397 } 329 398 … … 1059 1128 sysreqquery = "t1.systemreq=0 AND "; 1060 1129 } 1061 String query = "SELECT t1.id,t1.race,t1.type,t1.dauer,t1.costs,t1.ekosten,t1.crew,t1.tr1,t1.tr2,t1.tr3,t1.flagschiff ,t1.linfactor" +1130 String query = "SELECT t1.id,t1.race,t1.type,t1.dauer,t1.costs,t1.ekosten,t1.crew,t1.tr1,t1.tr2,t1.tr3,t1.flagschiff " + 1062 1131 "FROM ships_baubar t1 JOIN ship_types t2 ON t1.type=t2.id " + 1063 1132 "WHERE "+sysreqquery+" LOCATE('"+this.getWerftTag()+"',t1.werftreq) "+fsquery+" " + … … 1108 1177 1109 1178 Cargo costs = new Cargo( Cargo.Type.STRING, shipdata.getString("costs") ); 1110 1111 // Kosten anpassen1112 if( shipdata.getDouble("linfactor") > 0 ) {1113 int count = db.first("SELECT count(*) count FROM ships WHERE id>0 AND type=",shipdata.getInt("type")," AND owner=",user.getID()).getInt("count");1114 int count2 = db.first("SELECT count(t1.id) count FROM werften t1 JOIN bases t2 ON t1.col=t2.id WHERE t1.building=",shipdata.getInt("type")," AND t2.owner=",user.getID()).getInt("count");1115 int count3 = db.first("SELECT count(t1.id) count FROM werften t1 JOIN ships t2 ON t1.shipid=t2.id WHERE t2.id>0 AND t1.building=",shipdata.getInt("type")," AND t2.owner=",user.getID()).getInt("count");1116 1117 count = count + count2 + count3;1118 1119 costs.multiply( count*shipdata.getDouble("linfactor")+1, Cargo.Round.NONE );1120 }1121 1179 1122 1180 shipdata.put("costs", costs); … … 1160 1218 shipdata.put("type", effect.getShipType()); 1161 1219 shipdata.put("costs", cost); 1162 shipdata.put("linfactor", 0);1163 1220 shipdata.put("crew", effect.getCrew()); 1164 1221 shipdata.put("dauer", effect.getDauer()); … … 1208 1265 shipdata.put("type", effect.getShipType()); 1209 1266 shipdata.put("costs", cost); 1210 shipdata.put("linfactor", 0);1211 1267 shipdata.put("crew", effect.getCrew()); 1212 1268 shipdata.put("dauer", effect.getDauer()); … … 1257 1313 SQLResultRow shipdata = null; 1258 1314 if( build > 0 ) { 1259 shipdata = db.first("SELECT type,costs,ekosten,crew,dauer,race,systemreq,tr1,tr2,tr3,werftreq,flagschiff ,linfactorFROM ships_baubar WHERE id=",build);1315 shipdata = db.first("SELECT type,costs,ekosten,crew,dauer,race,systemreq,tr1,tr2,tr3,werftreq,flagschiff FROM ships_baubar WHERE id=",build); 1260 1316 if( shipdata.isEmpty() ) { 1261 1317 MESSAGE.get().append("Es wurde kein passender Schiffsbauplan gefunden"); … … 1264 1320 1265 1321 shipdata.put("costs", new Cargo(Cargo.Type.STRING, shipdata.getString("costs"))); 1266 1267 // Kosten anpassen1268 if( shipdata.getDouble("linfactor") > 0 ) {1269 int count = db.first("SELECT count(*) count FROM ships WHERE id>0 AND type=",shipdata.getInt("type")," AND owner=",user.getID()).getInt("count");1270 int count2 = db.first("SELECT count(t1.id) count FROM werften t1 JOIN bases t2 ON t1.col=t2.id WHERE t1.building=",shipdata.getInt("type")," AND t2.owner=",user.getID()).getInt("count");1271 int count3 = db.first("SELECT count(t1.id) count FROM werften t1 JOIN ships t2 ON t1.shipid=t2.id WHERE t2.id>0 AND t1.building=",shipdata.getInt("type")," AND t2.owner=",user.getID()).getInt("count");1272 1273 count = count + count2 + count3;1274 ((Cargo)shipdata.get("costs")).multiply( shipdata.getDouble("linfactor")*count+1, Cargo.Round.NONE );1275 }1276 1322 } 1277 1323 else { … … 1291 1337 shipdata.put("type", effect.getShipType()); 1292 1338  
