Changeset 23d6d8b37036e4077d22eab2901a279414fcc775
- Timestamp:
- 06/09/07 17:59:45 (1 year ago)
- git-parent:
- Files:
-
- db/tables/ships.sql (modified) (2 diffs)
- db/updates.xml (modified) (1 diff)
- src/net/driftingsouls/ds2/server/modules/FleetMgntController.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/modules/SchiffController.java (modified) (2 diffs)
- src/net/driftingsouls/ds2/server/modules/ks/KSKapernAction.java (modified) (1 diff)
- src/net/driftingsouls/ds2/server/modules/schiffplugins/SensorsDefault.java (modified) (2 diffs)
- src/net/driftingsouls/ds2/server/ships/Ship.java (modified) (3 diffs)
- src/net/driftingsouls/ds2/server/ships/Ships.java (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
db/tables/ships.sql
r37644ad r23d6d8b 21 21 `docked` varchar(20) NOT NULL default '', 22 22 `alarm` int(11) NOT NULL default '0', 23 `fleet` int(11) NOT NULL default '0',23 `fleet` int(11) default NULL, 24 24 `destsystem` int(11) NOT NULL default '0', 25 25 `destx` int(11) NOT NULL default '0', … … 51 51 ALTER TABLE ships ADD CONSTRAINT ships_fk_users FOREIGN KEY (owner) REFERENCES users(id); 52 52 ALTER TABLE ships ADD CONSTRAINT ships_type_fk FOREIGN KEY (type) REFERENCES ship_types(id); 53 ALTER TABLE ships ADD CONSTRAINT ships_fk_ship_fleets FOREIGN KEY (fleet) REFERENCES ship_fleets(id); 53 54 54 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (2, -1, 'Frachter', 27, '0,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,', 1, 1, 0, 'noconsign', 50, 80, 0, 5000, 0, '', 100, 100, 100, 100, '', 0, 0, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL);55 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (3, -1, 'Tanker', 2, '0,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 1, 2, 0, 'noconsign', 30, 40, 0, 10000, 0, '', 100, 100, 100, 100, '', 0, 0, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL);56 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (5, -1, 'Frachter', 31, '0,60,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,', 2, 1, 0, 'noconsign', 30, 80, 0, 8500, 0, '', 100, 100, 100, 100, '', 0, 0, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL);57 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (6, -1, 'Tanker', 30, '0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 2, 2, 0, 'noconsign', 30, 50, 0, 4000, 0, '', 100, 100, 100, 100, '', 0, 0, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL);58 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (666, -2, 'GTU Handelsposten Delta Serpentis', 10, '0,2000,0,0,500,2000,0,0,0,0,0,0,5000,0,0,0,0,0,300|10|0|0;301|3|0|0;325|3|0|0;326|3|0|0;161|500|0|0;170|500|0|0;150|500|0|0;154|500|0|0;172|500|0|0', 75, 75, 1, 'tradepost nocrew', 0, 4700, 0, 100000, 0, '', 100, 100, 100, 100, '', 0, 0, 0, 0, 0, '', 0, 0, 0, '2:150/150', 1, '', NULL, NULL, '*:26:0', NULL, NULL, NULL, NULL);55 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (2, -1, 'Frachter', 27, '0,0,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,', 1, 1, 0, 'noconsign', 50, 80, 0, 5000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 56 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (3, -1, 'Tanker', 2, '0,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 1, 2, 0, 'noconsign', 30, 40, 0, 10000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 57 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (5, -1, 'Frachter', 31, '0,60,0,0,50,0,0,0,0,0,0,0,0,0,0,0,0,0,', 2, 1, 0, 'noconsign', 30, 80, 0, 8500, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 58 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (6, -1, 'Tanker', 30, '0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,', 2, 2, 0, 'noconsign', 30, 50, 0, 4000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); 59 INSERT INTO `ships` (`id`, `owner`, `name`, `type`, `cargo`, `x`, `y`, `system`, `status`, `crew`, `e`, `s`, `hull`, `shields`, `heat`, `engine`, `weapons`, `comm`, `sensors`, `docked`, `alarm`, `fleet`, `destsystem`, `destx`, `desty`, `destcom`, `bookmark`, `battle`, `battleAction`, `jumptarget`, `autodeut`, `history`, `script`, `scriptexedata`, `oncommunicate`, `lock`, `visibility`, `onmove`, `respawn`) VALUES (666, -2, 'GTU Handelsposten Delta Serpentis', 10, '0,2000,0,0,500,2000,0,0,0,0,0,0,5000,0,0,0,0,0,300|10|0|0;301|3|0|0;325|3|0|0;326|3|0|0;161|500|0|0;170|500|0|0;150|500|0|0;154|500|0|0;172|500|0|0', 75, 75, 1, 'tradepost nocrew', 0, 4700, 0, 100000, 0, '', 100, 100, 100, 100, '', 0, null, 0, 0, 0, '', 0, 0, 0, '2:150/150', 1, '', NULL, NULL, '*:26:0', NULL, NULL, NULL, NULL); db/updates.xml
r3924571 r23d6d8b 279 279 ALTER TABLE ammo ADD CONSTRAINT ammo_fk_ammo FOREIGN KEY (replaces) REFERENCES ammo(id); 280 280 ]]></update> 281 <update type="structure" datum="2007-06-09"><![CDATA[ 282 ALTER TABLE ships CHANGE fleet fleet int DEFAULT NULL; 283 UPDATE ships SET fleet=NULL WHERE fleet=0; 284 ALTER TABLE ships ADD CONSTRAINT ships_fk_ship_fleets FOREIGN KEY (fleet) REFERENCES ship_fleets(id); 285 ]]></update> 281 286 </updates> src/net/driftingsouls/ds2/server/modules/FleetMgntController.java
r283e6c7 r23d6d8b 378 378 Database db = getDatabase(); 379 379 380 db.update("UPDATE ships SET fleet= 0WHERE fleet='",fleet.getInt("id"),"'");380 db.update("UPDATE ships SET fleet=null WHERE fleet='",fleet.getInt("id"),"'"); 381 381 db.update("DELETE FROM ship_fleets WHERE id='",fleet.getInt("id"),"'"); 382 382 src/net/driftingsouls/ds2/server/modules/SchiffController.java
r283e6c7 r23d6d8b 263 263 264 264 if( fleetcount < 3 ) { 265 db.update("UPDATE ships SET fleet= 0WHERE id>0 AND fleet="+fleet);265 db.update("UPDATE ships SET fleet=null WHERE id>0 AND fleet="+fleet); 266 266 db.update("DELETE FROM ship_fleets WHERE id>0 AND id="+fleet); 267 267 } … … 1181 1181 else { 1182 1182 t.set_var("ship.fleet", 0); 1183 db.update("UPDATE ships SET fleet= 0WHERE id>0 AND id=",ship.getInt("id"));1183 db.update("UPDATE ships SET fleet=null WHERE id>0 AND id=",ship.getInt("id")); 1184 1184 } 1185 1185 } src/net/driftingsouls/ds2/server/modules/ks/KSKapernAction.java
r283e6c7 r23d6d8b 260 260 enemyShip.put("history", enemyShip.getString("history") + "Im Kampf gekapert am "+currentTime+" durch "+user.getName()+" ("+user.getID()+")\n"); 261 261 262 db.update("UPDATE ships SET owner=",user.getID(),",fleet= 0,battleAction=1,engine=",enemyShip.getInt("engine"),",weapons=",enemyShip.getInt("weapons"),",crew=",newshipcrew," WHERE id>0 AND id=",enemyShip.getInt("id"));262 db.update("UPDATE ships SET owner=",user.getID(),",fleet=null,battleAction=1,engine=",enemyShip.getInt("engine"),",weapons=",enemyShip.getInt("weapons"),",crew=",newshipcrew," WHERE id>0 AND id=",enemyShip.getInt("id")); 263 263 db.update("UPDATE battles_ships SET side=",battle.getOwnSide(),",engine=",enemyShip.getInt("engine"),",weapons=",enemyShip.getInt("weapons")," WHERE shipid=",enemyShip.getInt("id")); 264 264 265 db.update("UPDATE ships SET owner=",user.getID(),",fleet= 0,battleAction=1 WHERE id>0 AND docked IN ('",enemyShip.getInt("id"),"','l ",enemyShip.getInt("id"),"')");265 db.update("UPDATE ships SET owner=",user.getID(),",fleet=null,battleAction=1 WHERE id>0 AND docked IN ('",enemyShip.getInt("id"),"','l ",enemyShip.getInt("id"),"')"); 266 266 267 267 db.update("UPDATE offiziere SET userid=",user.getID()," WHERE dest='s ",enemyShip.getInt("id"),"'"); src/net/driftingsouls/ds2/server/modules/schiffplugins/SensorsDefault.java
r283e6c7 r23d6d8b 408 408 String groupidlist = ""; 409 409 if( datas.getInt("owner") == user.getID() ) { 410 fleetlesscount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND system='",data.getInt("system"),"' AND x='",data.getInt("x"),"' AND y='",data.getInt("y"),"' AND owner='",user.getID(),"' AND type='",datas.getInt("type"),"' AND !LOCATE('l ',docked) AND !LOCATE('disable_iff',status) AND fleet =0").getInt("count");410 fleetlesscount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND system='",data.getInt("system"),"' AND x='",data.getInt("x"),"' AND y='",data.getInt("y"),"' AND owner='",user.getID(),"' AND type='",datas.getInt("type"),"' AND !LOCATE('l ',docked) AND !LOCATE('disable_iff',status) AND fleet is null").getInt("count"); 411 411 if( data.getInt("fleet") != 0 ) { 412 412 ownfleetcount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND system='",data.getInt("system"),"' AND x='",data.getInt("x"),"' AND y='",data.getInt("y"),"' AND owner='",user.getID(),"' AND type='",datas.getInt("type"),"' AND !LOCATE('l ',docked) AND !LOCATE('disable_iff',status) AND fleet=",data.getInt("fleet")).getInt("count"); … … 446 446 int ownfleetcount = 0; 447 447 if( datas.getInt("owner") == user.getID() ) { 448 fleetlesscount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND system='",data.getInt("system"),"' AND x='",data.getInt("x"),"' AND y='",data.getInt("y"),"' AND owner='",user.getID(),"' AND type='",datas.getInt("type"),"' AND docked='' AND fleet =0").getInt("count");448 fleetlesscount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND system='",data.getInt("system"),"' AND x='",data.getInt("x"),"' AND y='",data.getInt("y"),"' AND owner='",user.getID(),"' AND type='",datas.getInt("type"),"' AND docked='' AND fleet is null").getInt("count"); 449 449 if( data.getInt("fleet") != 0 ) { 450 450 ownfleetcount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND system='",data.getInt("system"),"' AND x='",data.getInt("x"),"' AND y='",data.getInt("y"),"' AND owner='",user.getID(),"' AND type='",datas.getInt("type"),"' AND docked='' AND fleet=",data.getInt("fleet")).getInt("count"); src/net/driftingsouls/ds2/server/ships/Ship.java
r283e6c7 r23d6d8b 75 75 private String docked; 76 76 private int alarm; 77 private int fleet; 77 @ManyToOne(fetch=FetchType.LAZY) 78 @JoinColumn(name="fleet", nullable=true) 79 private ShipFleet fleet; 78 80 private int destsystem; 79 81 private int destx; … … 424 426 /** 425 427 * Gibt die Flotte zurueck in der sich das Schiff befindet 426 * @return Die ID der Flotte oder <code>0</code>427 */ 428 public int getFleet() {428 * @return Die Flotte 429 */ 430 public ShipFleet getFleet() { 429 431 return fleet; 430 432 } … … 432 434 /** 433 435 * Setzt die Flotte in der sich das Schiff befindet 434 * @param fleet Die neue Flotte n-ID435 */ 436 public void setFleet( int fleet) {436 * @param fleet Die neue Flotte 437 */ 438 public void setFleet(ShipFleet fleet) { 437 439 this.fleet = fleet; 438 440 } src/net/driftingsouls/ds2/server/ships/Ships.java
r283e6c7 r23d6d8b 1973 1973 if( fleetcount <= 2 ) { 1974 1974 db.update("DELETE FROM ship_fleets WHERE id=",ship.getInt("fleet")); 1975 db.update("UPDATE ships SET fleet= 0WHERE fleet=",ship.getInt("fleet"));1975 db.update("UPDATE ships SET fleet=null WHERE fleet=",ship.getInt("fleet")); 1976 1976 } 1977 1977 } … … 2185 2185 ship.put("history", ship.getString("history")+"Übergeben am [tick="+ContextMap.getContext().get(ContextCommon.class).getTick()+"] an "+newowner.getName()+" ("+newowner.getID()+")\n"); 2186 2186 2187 db.prepare("UPDATE ships SET owner= ?,fleet= 0,history= ? ,alarm='0' WHERE id= ? AND owner= ?")2187 db.prepare("UPDATE ships SET owner= ?,fleet=null,history= ? ,alarm='0' WHERE id= ? AND owner= ?") 2188 2188 .update(newowner.getID(), ship.getString("history"), ship.getInt("id"), ship.getInt("owner")); 2189 2189 db.update("UPDATE offiziere SET userid='",newowner.getID(),"' WHERE dest='s ",ship.getInt("id"),"'"); … … 2334 2334 2335 2335 if( fleetcount > 2 ) { 2336 db.tUpdate(1, "UPDATE ships SET fleet= 0WHERE id>0 AND id=",ship.getInt("id"));2336 db.tUpdate(1, "UPDATE ships SET fleet=null WHERE id>0 AND id=",ship.getInt("id")); 2337 2337 MESSAGE.get().append("aus der Flotte ausgetreten"); 2338 2338 … … 2340 2340 } 2341 2341 else { 2342 db.tUpdate(1, "UPDATE ships SET fleet= 0WHERE fleet="+ship.getInt("fleet"));2342 db.tUpdate(1, "UPDATE ships SET fleet=null WHERE fleet="+ship.getInt("fleet")); 2343 2343 db.tUpdate(1, "DELETE FROM ship_fleets WHERE id="+ship.getInt("fleet")); 2344 2344 MESSAGE.get().append("Flotte aufgelößt");
