Changeset a2ac3f915e9adaed428bbabbcd6bca0ba5f5a467

Show
Ignore:
Timestamp:
03/25/07 15:42:07 (2 years ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1174830127 +0200
git-parent:

[ae11637eff7bd2537af9488073a3fa5a3c422270]

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

QuickQuests? koennen nun mehrere sources und targets haben

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • db/tables/quests_quick.sql

    r425acaa ra2ac3f9  
    1111  `finishtext` text NOT NULL, 
    1212  `notyettext` text NOT NULL, 
    13   `source` int(10) unsigned NOT NULL default '0', 
     13  `source` varchar(30) NOT NULL default '0', 
    1414  `sourcetype` varchar(20) NOT NULL default 'gtuposten', 
    15   `target` int(10) unsigned NOT NULL default '0', 
     15  `target` varchar(30) NOT NULL default '0', 
    1616  `targettype` varchar(20) NOT NULL default 'gtuposten', 
    1717  `startitems` text NOT NULL, 
  • db/updates.xml

    ra6ba521 ra2ac3f9  
    225225                 UPDATE buildings SET module='net.driftingsouls.ds2.server.bases.Waffenfabrik' WHERE module='waffenfabrik'; 
    226226        ]]></update> 
     227        <update type="structure" datum="2007-03-25"><![CDATA[ 
     228                ALTER TABLE quests_quick CHANGE source source VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''; 
     229                ALTER TABLE quests_quick CHANGE target target VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''; 
     230        ]]></update> 
    227231</updates> 
  • src/net/driftingsouls/ds2/server/modules/admin/QuestsQuick.java

    r2a7339d ra2ac3f9  
    7070                                pq.close(); 
    7171                        } 
    72                         db.update("UPDATE quests_quick SET enabled="+questdata.getInt("id")+"' WHERE id="+id); 
     72                        db.update("UPDATE quests_quick SET enabled='"+questdata.getInt("id")+"' WHERE id="+id); 
    7373                         
    7474                        echo.append("Quest aktiviert<br /><br />"); 
     
    164164                        SQLResultRow qquest = db.first("SELECT * FROM quests_quick WHERE id="+id); 
    165165                         
    166                         int sourceobjectid = qquest.getInt("source"); 
    167                         int targetobjectid = qquest.getInt("target"); 
     166                        if( (qquest.getString("source").indexOf(',') > -1) || (qquest.getString("target").indexOf(',') > -1) ) { 
     167                                echo.append("ERROR: QuickQuest-Scripte unterst&uuml;tzen im Moment nur EINE source und EIN target<br />"); 
     168                                return; 
     169                        } 
     170                         
     171                        int sourceobjectid = Integer.parseInt(qquest.getString("source")); 
     172                        int targetobjectid = Integer.parseInt(qquest.getString("target")); 
    168173                         
    169174                        String qquest_desc = StringUtils.replace(qquest.getString("desc"), "&", "&amp;"); 
  • src/net/driftingsouls/ds2/server/scripting/QuestFunctions.java

    ra8c7a57 ra2ac3f9  
    21512151                 
    21522152                        SQLQuery qquest = db.query("SELECT * FROM quests_quick " + 
    2153                                         "WHERE enabled>0 AND source="+shipid+" AND sourcetype='"+typeid+"'"); 
     2153                                        "WHERE enabled>0 AND " + 
     2154                                        "(source='"+shipid+"' OR source LIKE '"+shipid+",%' OR source LIKE '%,"+shipid+"' OR source LIKE '%,"+shipid+",%') AND " + 
     2155                                        "sourcetype='"+typeid+"'"); 
    21542156                        while( qquest.next() ) { 
    21552157                                if( qquest.getInt("moreThanOnce") == 0 ) { 
     
    22202222                         
    22212223                        SQLQuery qquest = db.query("SELECT * FROM quests_quick " + 
    2222                                         "WHERE enabled>0 AND target="+shipid+" AND targettype='"+typeid+"'"); 
     2224                                        "WHERE enabled>0 AND " + 
     2225                                        "(target='"+shipid+"' OR target LIKE '"+shipid+",%' OR target LIKE '%,"+shipid+"' OR target LIKE '%,"+shipid+",%') AND " +  
     2226                                        "targettype='"+typeid+"'"); 
    22232227                        while( qquest.next() ) { 
    22242228                                call(new LoadQuestContext(), db, scriptparser, qquest.getInt("enabled")); 
     
    22772281                                scriptparser.log("QQuest: "+scriptparser.getParameter(1)+"\n"); 
    22782282                                SQLResultRow qquest = db.first("SELECT * FROM quests_quick WHERE id="+Value.Int(scriptparser.getParameter(1))); 
    2279                                 if( qquest.isEmpty() || !qquest.getString("sourcetype").equals(typeid) ||  
    2280                                         (qquest.getInt("source") != shipid) ) { 
     2283                                if( qquest.isEmpty() || !qquest.getString("sourcetype").equals(typeid) ) { 
    22812284                                        scriptparser.setRegister("#A","0"); 
    2282                                         return CONTINUE;         
     2285                                        return CONTINUE; 
     2286                                } 
     2287                                 
     2288                                int[] sourcelist = Common.explodeToInt(",", qquest.getString("source")); 
     2289                                if( !Common.inArray(shipid, sourcelist) ) { 
     2290                                        scriptparser.setRegister("#A","0"); 
     2291                                        return CONTINUE; 
    22832292                                } 
    22842293                                 
     
    23672376                                scriptparser.log("QQuest: "+scriptparser.getParameter(1)+"\n"); 
    23682377                                SQLResultRow qquest = db.first("SELECT * FROM quests_quick WHERE id="+Value.Int(scriptparser.getParameter(1))); 
    2369                                 if( qquest.isEmpty() || !qquest.getString("sourcetype").equals(typeid) ||  
    2370                                         (qquest.getInt("source") != shipid) ) { 
     2378                                if( qquest.isEmpty() || !qquest.getString("sourcetype").equals(typeid) ) { 
    23712379                                        scriptparser.setRegister("#A","0"); 
    23722380                                        return CONTINUE;         
     2381                                } 
     2382                                 
     2383                                int[] sourcelist = Common.explodeToInt(",", qquest.getString("source")); 
     2384                                if( !Common.inArray(shipid, sourcelist) ) { 
     2385                                        scriptparser.setRegister("#A","0"); 
     2386                                        return CONTINUE; 
    23732387                                } 
    23742388                                 
     
    24702484                                scriptparser.log("QQuest: "+scriptparser.getParameter(1)+"\n"); 
    24712485                                SQLResultRow qquest = db.first("SELECT * FROM quests_quick WHERE id="+Value.Int(scriptparser.getParameter(1))); 
    2472                                 if( qquest.isEmpty() || !qquest.getString("sourcetype").equals(typeid) ||  
    2473                                         (qquest.getInt("source") != shipid) ) { 
     2486                                if( qquest.isEmpty() || !qquest.getString("sourcetype").equals(typeid) ) { 
    24742487                                        scriptparser.setRegister("#A","0"); 
    24752488                                        return CONTINUE;         
     2489                                } 
     2490                                 
     2491                                int[] sourcelist = Common.explodeToInt(",", qquest.getString("source")); 
     2492                                if( !Common.inArray(shipid, sourcelist) ) { 
     2493                                        scriptparser.setRegister("#A","0"); 
     2494                                        return CONTINUE; 
    24762495                                } 
    24772496