Changeset f82584a7c1d40eae013b39c8dc47e98480f8dbfe
- Timestamp:
- 08/05/07 12:37:35
(1 year ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1186310255 +0200
- git-parent:
[a89e5107360c444563dcc1f31af8593ffdafc8a6]
- git-author:
- Sebastian Gift <Madison@gt-knm.de> 1186310255 +0200
- Message:
Handelsposten: Ankauflimits eingebaut
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| re35d2b9 |
rf82584a |
|
| 354 | 354 | ALTER TABLE `academy` DROP INDEX `col`; |
|---|
| 355 | 355 | ]]></update> |
|---|
| | 356 | <update type="structure" datum="2007-08-05"><![CDATA[ |
|---|
| | 357 | CREATE TABLE `tradepost_buy_limit` ( |
|---|
| | 358 | `shipid` int(11) NOT NULL, |
|---|
| | 359 | `resourceid` int(11) NOT NULL, |
|---|
| | 360 | `limit` int(11) NOT NULL, |
|---|
| | 361 | PRIMARY KEY (`shipid`,`resourceid`) |
|---|
| | 362 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|---|
| | 363 | |
|---|
| | 364 | ALTER TABLE tradepost_buy_limit ADD CONSTRAINT tradepost_buy_limit_fk_ships FOREIGN KEY (shipid) REFERENCES ships(id); |
|---|
| | 365 | ]]></update> |
|---|
| 356 | 366 | </updates> |
|---|
| re194c56 |
rf82584a |
|
| 24 | 24 | import net.driftingsouls.ds2.server.cargo.ResourceList; |
|---|
| 25 | 25 | import net.driftingsouls.ds2.server.entities.GtuWarenKurse; |
|---|
| | 26 | import net.driftingsouls.ds2.server.entities.ResourceLimit; |
|---|
| 26 | 27 | import net.driftingsouls.ds2.server.entities.StatVerkaeufe; |
|---|
| 27 | 28 | import net.driftingsouls.ds2.server.entities.User; |
|---|
| | 29 | import net.driftingsouls.ds2.server.entities.ResourceLimit.ResourceLimitKey; |
|---|
| 28 | 30 | import net.driftingsouls.ds2.server.framework.Common; |
|---|
| 29 | 31 | import net.driftingsouls.ds2.server.framework.Context; |
|---|
| … | … | |
| 154 | 156 | long resourceMass = Cargo.getResourceMass(res.getId(), 1); |
|---|
| 155 | 157 | |
|---|
| | 158 | //Wir wollen eventuell nur bis zu einem Limit ankaufen |
|---|
| | 159 | ResourceLimitKey resourceLimitKey = new ResourceLimitKey(posten, res.getId()); |
|---|
| | 160 | ResourceLimit resourceLimit = (ResourceLimit) db.get(ResourceLimit.class, resourceLimitKey); |
|---|
| | 161 | |
|---|
| | 162 | long limit = Long.MAX_VALUE; |
|---|
| | 163 | if(resourceLimit != null) { |
|---|
| | 164 | limit = resourceLimit.getLimit(); |
|---|
| | 165 | //Bereits gelagerte Bestaende abziehen |
|---|
| | 166 | limit -= posten.getCargo().getResourceCount(res.getId()); |
|---|
| | 167 | } |
|---|
| | 168 | |
|---|
| | 169 | if( tmp > limit ) { |
|---|
| | 170 | tmp = limit; |
|---|
| | 171 | } |
|---|
| | 172 | |
|---|
| 156 | 173 | //Nicht mehr ankaufen als Platz da ist |
|---|
| 157 | | if(tmp*resourceMass > freeSpace) |
|---|
| 158 | | { |
|---|
| | 174 | if(tmp*resourceMass > freeSpace) { |
|---|
| 159 | 175 | tmp = freeSpace/resourceMass; |
|---|
| 160 | 176 | } |
|---|
| … | … | |
| 216 | 232 | ResourceList reslist = this.kurse.getResourceList(); |
|---|
| 217 | 233 | |
|---|
| 218 | | if(!isFull()) |
|---|
| 219 | | { |
|---|
| | 234 | if(!isFull()) { |
|---|
| 220 | 235 | t.set_var("is.full", 0); |
|---|
| 221 | 236 | for( ResourceEntry res : reslist ) { |
|---|
| … | … | |
| 241 | 256 | } |
|---|
| 242 | 257 | } |
|---|
| 243 | | else |
|---|
| 244 | | { |
|---|
| | 258 | else { |
|---|
| 245 | 259 | |
|---|
| 246 | 260 | t.set_var( "is.full", true, |
|---|
| re35d2b9 |
rf82584a |
|
| 81 | 81 | <!-- surveys --> |
|---|
| 82 | 82 | <mapping class="net.driftingsouls.ds2.server.tasks.Task" /> |
|---|
| | 83 | <mapping class="net.driftingsouls.ds2.server.entities.ResourceLimit" /> |
|---|
| 83 | 84 | <!-- transmissionen [net.driftingsouls.ds2.server.comm.PM umbauen] --> |
|---|
| 84 | 85 | <mapping class="net.driftingsouls.ds2.server.entities.User" /> |
|---|