Changeset 30f818dab988ccb2abce2ac23f68f91148666a59
- Timestamp:
- 07/10/07 17:12:09
(1 year ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1184080329 +0200
- git-parent:
[d230b2f35546b981310b027ee99cd9f7e0e12506]
- git-author:
- Christopher Jung <bktheg@web.de> 1184080329 +0200
- Message:
WerftObject?: Kleinere API-Aenderungen
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r07a80e0 |
r30f818d |
|
| 55 | 55 | } |
|---|
| 56 | 56 | |
|---|
| 57 | | User owner = (User)db.get(User.class, werft.getOwner()); |
|---|
| | 57 | User owner = werft.getOwner(); |
|---|
| 58 | 58 | if( (owner.getVacationCount() > 0) && (owner.getWait4VacationCount() == 0) ) { |
|---|
| 59 | 59 | this.log("xxx Ignoriere Werft "+werft.getWerftID()+" [VAC]"); |
|---|
| … | … | |
| 85 | 85 | String msg = "Auf "+werft.getName()+" wurde eine "+shipd.getNickname()+" gebaut. Sie steht bei "+werft.getSystem()+" : "+werft.getX()+"/"+werft.getY()+"."; |
|---|
| 86 | 86 | |
|---|
| 87 | | PM.send(getContext(), -1, werft.getOwner(), "Schiff gebaut", msg); |
|---|
| | 87 | PM.send(getContext(), -1, werft.getOwner().getID(), "Schiff gebaut", msg); |
|---|
| 88 | 88 | } |
|---|
| 89 | 89 | } |
|---|
| r8e3cf9b |
r30f818d |
|
| 29 | 29 | import net.driftingsouls.ds2.server.bases.Base; |
|---|
| 30 | 30 | import net.driftingsouls.ds2.server.cargo.Cargo; |
|---|
| | 31 | import net.driftingsouls.ds2.server.entities.User; |
|---|
| 31 | 32 | |
|---|
| 32 | 33 | /** |
|---|
| … | … | |
| 187 | 188 | |
|---|
| 188 | 189 | @Override |
|---|
| 189 | | public int getOwner() { |
|---|
| 190 | | return this.base.getOwner().getID(); |
|---|
| | 190 | public User getOwner() { |
|---|
| | 191 | return this.base.getOwner(); |
|---|
| 191 | 192 | } |
|---|
| 192 | 193 | |
|---|
| r9965374 |
r30f818d |
|
| 31 | 31 | import net.driftingsouls.ds2.server.cargo.ResourceEntry; |
|---|
| 32 | 32 | import net.driftingsouls.ds2.server.cargo.ResourceList; |
|---|
| | 33 | import net.driftingsouls.ds2.server.entities.User; |
|---|
| 33 | 34 | import net.driftingsouls.ds2.server.framework.ContextMap; |
|---|
| 34 | 35 | import net.driftingsouls.ds2.server.ships.Ship; |
|---|
| … | … | |
| 352 | 353 | |
|---|
| 353 | 354 | @Override |
|---|
| 354 | | public int getOwner() { |
|---|
| 355 | | return this.ship.getOwner().getID(); |
|---|
| | 355 | public User getOwner() { |
|---|
| | 356 | return this.ship.getOwner(); |
|---|
| 356 | 357 | } |
|---|
| 357 | 358 | |
|---|
| r9965374 |
r30f818d |
|
| 25 | 25 | import java.util.Map; |
|---|
| 26 | 26 | |
|---|
| 27 | | import net.driftingsouls.ds2.server.Location; |
|---|
| 28 | 27 | import net.driftingsouls.ds2.server.Offizier; |
|---|
| 29 | 28 | import net.driftingsouls.ds2.server.bases.Base; |
|---|
| … | … | |
| 187 | 186 | .setInteger(1, werft.getY()) |
|---|
| 188 | 187 | .setInteger(2, werft.getSystem()) |
|---|
| 189 | | .setInteger(3, werft.getOwner()) |
|---|
| | 188 | .setEntity(3, werft.getOwner()) |
|---|
| 190 | 189 | .list(); |
|---|
| 191 | 190 | for( Iterator iter=bases.iterator(); iter.hasNext(); ) { |
|---|
| … | … | |
| 417 | 416 | return; |
|---|
| 418 | 417 | } |
|---|
| 419 | | if( !ship.getLocation().sameSector(0, new Location(werft.getSystem(), werft.getX(), werft.getY()), werft.getSize()) ) { |
|---|
| | 418 | if( !ship.getLocation().sameSector(0, werft, werft.getSize()) ) { |
|---|
| 420 | 419 | context.addError("Das Schiff befindet sich nicht im selben Sektor wie die Werft", werft.getUrlBase()+"&sess="+sess); |
|---|
| 421 | 420 | return; |
|---|
| re4db260 |
r30f818d |
|
| 35 | 35 | |
|---|
| 36 | 36 | import net.driftingsouls.ds2.server.ContextCommon; |
|---|
| | 37 | import net.driftingsouls.ds2.server.Locatable; |
|---|
| | 38 | import net.driftingsouls.ds2.server.Location; |
|---|
| 37 | 39 | import net.driftingsouls.ds2.server.Offizier; |
|---|
| 38 | 40 | import net.driftingsouls.ds2.server.cargo.Cargo; |
|---|
| … | … | |
| 79 | 81 | @Inheritance(strategy=InheritanceType.SINGLE_TABLE) |
|---|
| 80 | 82 | @DiscriminatorFormula("case when col is not null then 'base' else 'ship' end") |
|---|
| 81 | | public abstract class WerftObject extends DSObject { |
|---|
| | 83 | public abstract class WerftObject extends DSObject implements Locatable { |
|---|
| 82 | 84 | protected static final int BUILDING = 0; |
|---|
| 83 | 85 | protected static final int SHIP = 1; |
|---|
| … | … | |
| 223 | 225 | ShipTypeData shipd = this.getBuildShipType(); |
|---|
| 224 | 226 | |
|---|
| 225 | | int owner = this.getOwner(); |
|---|
| 226 | 227 | int x = this.getX(); |
|---|
| 227 | 228 | int y = this.getY(); |
|---|
| … | … | |
| 229 | 230 | |
|---|
| 230 | 231 | Cargo cargo = new Cargo(); |
|---|
| 231 | | User auser = (User)context.getDB().get(User.class, owner); |
|---|
| | 232 | User auser = this.getOwner(); |
|---|
| 232 | 233 | |
|---|
| 233 | 234 | String currentTime = Common.getIngameTime(context.get(ContextCommon.class).getTick()); |
|---|
| … | … | |
| 272 | 273 | |
|---|
| 273 | 274 | if( !ok ) { |
|---|
| 274 | | User user = (User)context.getDB().get(User.class, this.getOwner()); |
|---|
| | 275 | User user = this.getOwner(); |
|---|
| 275 | 276 | |
|---|
| 276 | 277 | Cargo allyitems = null; |
|---|
| … | … | |
| 306 | 307 | db.createQuery("update User as u set u.ally.items=? where u.id=?") |
|---|
| 307 | 308 | .setString(0, allyitems.getData(Cargo.Type.ITEMSTRING)) |
|---|
| 308 | | .setInteger(1, this.getOwner()) |
|---|
| | 309 | .setInteger(1, this.getOwner().getID()) |
|---|
| 309 | 310 | .executeUpdate(); |
|---|
| 310 | 311 | } |
|---|
| … | … | |
| 343 | 344 | // Pruefen, ob ein evt notwendiges Item vorhanden ist |
|---|
| 344 | 345 | if( this.getRequiredItem() > -1 ) { |
|---|
| 345 | | Context context = ContextMap.getContext(); |
|---|
| 346 | | |
|---|
| 347 | 346 | Cargo cargo = this.getCargo(true); |
|---|
| 348 | | User user = (User)context.getDB().get(User.class, this.getOwner()); |
|---|
| | 347 | User user = this.getOwner(); |
|---|
| 349 | 348 | |
|---|
| 350 | 349 | if( user.getAlly() != null ) { |
|---|
| … | … | |
| 464 | 463 | /** |
|---|
| 465 | 464 | * Gibt den Besitzer der Werft zurueck |
|---|
| 466 | | * @return Die ID des Besitzers |
|---|
| 467 | | */ |
|---|
| 468 | | public abstract int getOwner(); |
|---|
| | 465 | * @return Der Besitzer |
|---|
| | 466 | */ |
|---|
| | 467 | public abstract User getOwner(); |
|---|
| 469 | 468 | |
|---|
| 470 | 469 | /** |
|---|
| … | … | |
| 1158 | 1157 | Database db = context.getDatabase(); |
|---|
| 1159 | 1158 | |
|---|
| 1160 | | User user = (User)context.getDB().get(User.class, this.getOwner()); |
|---|
| | 1159 | User user = this.getOwner(); |
|---|
| 1161 | 1160 | |
|---|
| 1162 | 1161 | boolean flagschiff = user.hasFlagschiffSpace(); |
|---|
| … | … | |
| 1340 | 1339 | Context context = ContextMap.getContext(); |
|---|
| 1341 | 1340 | Database db = context.getDatabase(); |
|---|
| 1342 | | User user = (User)context.getDB().get(User.class, this.getOwner()); |
|---|
| | 1341 | User user = this.getOwner(); |
|---|
| 1343 | 1342 | |
|---|
| 1344 | 1343 | Cargo allyitems = null; |
|---|
| … | … | |
| 1410 | 1409 | Context context = ContextMap.getContext(); |
|---|
| 1411 | 1410 | org.hibernate.Session db = context.getDB(); |
|---|
| 1412 | | User user = (User)db.get(User.class, this.getOwner()); |
|---|
| | 1411 | User user = this.getOwner(); |
|---|
| 1413 | 1412 | |
|---|
| 1414 | 1413 | Cargo cargo = this.getCargo(false); |
|---|
| … | … | |
| 1662 | 1661 | .uniqueResult(); |
|---|
| 1663 | 1662 | } |
|---|
| | 1663 | |
|---|
| | 1664 | public Location getLocation() { |
|---|
| | 1665 | return new Location(getSystem(), getX(), getY()); |
|---|
| | 1666 | } |
|---|
| 1664 | 1667 | } |
|---|