Changeset 7f0a2d954e9670f22011e0ff0ebc390401b1343d

Show
Ignore:
Timestamp:
05/01/07 14:58:50 (1 year ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1178024330 +0200
git-parent:

[0f80e75ad3bc135cf584aa7b3e6f74c91464688b]

git-author:
Christopher Jung <bktheg@web.de> 1178024330 +0200
Message:

Jaegerflotten aufsammeln eingebaut

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/net/driftingsouls/ds2/server/modules/schiffplugins/SensorsDefault.java

    r0f80e75 r7f0a2d9  
    301301                        */ 
    302302                         
     303                        // Cache fuer Jaegerflotten. Key ist die Flotten-ID. Value die Liste der Schiffs-IDs der Flotte 
     304                        Map<Integer,List<Integer>> jaegerFleetCache = new HashMap<Integer,List<Integer>>(); 
     305                         
     306                        // Die ID des Schiffes, an dem das aktuell ausgewaehlte Schiff angedockt ist 
    303307                        int currentDockID = 0; 
    304308                        if( data.getString("docked").length() > 0 ) { 
     
    311315                        } 
    312316                         
     317                        int user_wrapfactor = Integer.parseInt(user.getUserValue("TBLORDER/schiff/wrapfactor")); 
     318                         
     319                        // dockCount - die Anzahl der aktuell angedockten Schiffe 
     320                        final int dockCount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND docked='",data.getInt("id"),"'").getInt("count"); 
     321                         
     322                        // superdock - Kann der aktuelle Benutzer alles andocken? 
    313323                        boolean superdock = false; 
    314                         int user_wrapfactor = Integer.parseInt(user.getUserValue("TBLORDER/schiff/wrapfactor")); 
    315                         final int dockCount = db.first("SELECT count(*) count FROM ships WHERE id>0 AND docked='",data.getInt("id"),"'").getInt("count"); 
    316                          
    317324                        if( datatype.getInt("adocks") > dockCount ) {    
    318325                                superdock = user.hasFlag( User.FLAG_SUPER_DOCK ); 
    319326                        } 
    320327                         
     328                        // fullcount - Die Anzahl der freien Landeplaetze auf dem aktuell ausgewaehlten Traeger 
     329                        // spaceToLand - Ist ueberhaupt noch Platz auf dem aktuell ausgewaehlten Traeger? 
    321330                        boolean spaceToLand = false; 
    322331                        int fullcount = db.first("SELECT count(*) fullcount FROM ships WHERE id>0 AND docked='l ",data.getInt("id"),"'").getInt("fullcount"); 
     
    657666                                                                if( data.getInt("fleet") > 0 ) { 
    658667                                                                        boolean ok = true; 
     668                                                                        // Falls noch nicht geschehen die Flotte des Jaegers ermitteln 
    659669                                                                        if( fleetlist == null ) { 
    660670                                                                                fleetlist = new ArrayList<Integer>(); 
     
    688698                                        if( (datas.getInt("owner") == user.getID()) && spaceToLand && ShipTypes.hasShipTypeFlag(ashiptype, ShipTypes.SF_JAEGER) ) { 
    689699                                                t.set_var("sships.action.landthis",1); 
     700                                                 
     701                                                // Flotte des aktuellen Jaegers landen lassen 
     702                                                if( datas.getInt("fleet") != 0 ) { 
     703                                                        if( !jaegerFleetCache.containsKey(datas.getInt("fleet"))) { 
     704                                                                List<Integer> thisFleetList = new ArrayList<Integer>(); 
     705                                                                 
     706                                                                boolean ok = true; 
     707                                                                SQLQuery tmp = db.query("SELECT id,type,status FROM ships WHERE id>0 AND fleet='"+datas.getInt("fleet")+"'"); 
     708                                                                while( tmp.next() ) { 
     709                                                                        SQLResultRow tmptype = ShipTypes.getShipType( tmp.getRow() ); 
     710                                                                        if( !ShipTypes.hasShipTypeFlag(tmptype, ShipTypes.SF_JAEGER) ) { 
     711                                                                                ok = false; 
     712                                                                                break; 
     713                                                                        } 
     714                                                                        thisFleetList.add(tmp.getInt("id")); 
     715                                                                }                
     716                                                                tmp.free(); 
     717                                                                if( !ok ) { 
     718                                                                        thisFleetList.clear(); 
     719                                                                } 
     720                                                                 
     721                                                                jaegerFleetCache.put(datas.getInt("fleet"), thisFleetList); 
     722                                                        } 
     723                                                        List<Integer> thisFleetList = jaegerFleetCache.get(datas.getInt("fleet")); 
     724                                                         
     725                                                        if( !thisFleetList.isEmpty() && (thisFleetList.size() <= datatype.getInt("jdocks")) ) { 
     726                                                                if( fullcount + thisFleetList.size() <= datatype.getInt("jdocks") ) 
     727                                                                        t.set_var(      "sships.action.landthisfleet", 1, 
     728                                                                                                "sships.shiplist", Common.implode("|",thisFleetList) ); 
     729                                                        } 
     730                                                } 
    690731                                        } 
    691732 
  • templates/schiff.sensors.default.html

    rae09dfe r7f0a2d9  
    315315                                {/endif}{if sships.action.landthis} 
    316316                                        <a class="greenborder" onmouseover="return helpme('{sships.type.name} landen lassen');" onmouseout="return nd();" href="./main.php?module=schiff&amp;sess={global.sess}&amp;action=land&amp;land={global.ship}&amp;ship={global.ship}&amp;shiplist={sships.id}"><img src="{URL}data/interface/schiffe/schiff_landen.gif" alt="" /></a> 
     317                                {/endif}{if sships.action.landthisfleet} 
     318                                        <a class="greenborder" onmouseover="return helpme('{sships.type.name}\'s Flotte landen lassen');" onmouseout="return nd();" href="./main.php?module=schiff&amp;sess={global.sess}&amp;action=land&amp;land={global.ship}&amp;ship={global.ship}&amp;shiplist={sships.shiplist}"><img src="{URL}data/interface/schiffe/schiff_flottelanden.gif" alt="" /></a> 
    317319                                {/endif}{if sships.action.joinfleet} 
    318320                                        <a class="greenborder" onmouseover="return helpme('an {sships.type.name}s Flotte anschliessen');" onmouseout="return nd();" href="./main.php?module=schiff&amp;sess={global.sess}&amp;action=join&amp;join={sships.id}&amp;ship={global.ship}"><img src="{URL}data/interface/schiffe/schiff_anschliessen.gif" alt="" /></a>