Show
Ignore:
Timestamp:
11/21/08 08:47:55 (17 years ago)
Author:
yumileroy
Message:

*DB script table stucture change. Source Mangos. Also fix some bugs. Hopefully this rev will make program usable again.

Original author: megamage
Date: 2008-11-20 10:43:20-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/PlayerDump.cpp

    r112 r260  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    278278    // for guid set stop if set is empty 
    279279    if(guids && guids->empty()) 
    280         return;                                        // nothing to do 
     280        return;                                             // nothing to do 
    281281 
    282282    // setup for guids case start position 
     
    344344    FILE *fout = fopen(file.c_str(), "w"); 
    345345    if (!fout) 
    346                 return DUMP_FILE_OPEN_ERROR; 
     346        return DUMP_FILE_OPEN_ERROR; 
    347347 
    348348    std::string dump = GetDump(guid); 
     
    372372        } 
    373373    } 
     374 
    374375    FILE *fin = fopen(file.c_str(), "r"); 
    375376    if(!fin) 
    376                 return DUMP_FILE_OPEN_ERROR; 
     377        return DUMP_FILE_OPEN_ERROR; 
    377378 
    378379    QueryResult * result = NULL; 
     
    391392        else incHighest = false; 
    392393    } 
    393     else guid = objmgr.m_hiCharGuid; 
     394    else 
     395        guid = objmgr.m_hiCharGuid; 
    394396 
    395397    // normalize the name if specified and check if it exists 
     
    469471            case DTT_CHAR_TABLE: 
    470472                if(!changenth(line, 1, newguid)) 
    471                                         ROLLBACK(DUMP_FILE_BROKEN); 
     473                    ROLLBACK(DUMP_FILE_BROKEN); 
    472474                break; 
    473475 
     
    475477            { 
    476478                if(!changenth(line, 1, newguid)) 
    477                                         ROLLBACK(DUMP_FILE_BROKEN); 
     479                    ROLLBACK(DUMP_FILE_BROKEN); 
    478480 
    479481                // guid, data field:guid, items 
    480482                if(!changenth(line, 2, chraccount)) 
    481                                         ROLLBACK(DUMP_FILE_BROKEN); 
    482  
     483                    ROLLBACK(DUMP_FILE_BROKEN); 
    483484                std::string vals = getnth(line, 3); 
    484485                if(!changetoknth(vals, OBJECT_FIELD_GUID+1, newguid)) 
    485                                         ROLLBACK(DUMP_FILE_BROKEN); 
    486  
     486                    ROLLBACK(DUMP_FILE_BROKEN); 
    487487                for(uint16 field = PLAYER_FIELD_INV_SLOT_HEAD; field < PLAYER_FARSIGHT; field++) 
    488488                    if(!changetokGuid(vals, field+1, items, objmgr.m_hiItemGuid, true)) 
    489                                                 ROLLBACK(DUMP_FILE_BROKEN); 
    490  
     489                        ROLLBACK(DUMP_FILE_BROKEN); 
    491490                if(!changenth(line, 3, vals.c_str())) 
    492                                         ROLLBACK(DUMP_FILE_BROKEN); 
    493  
     491                    ROLLBACK(DUMP_FILE_BROKEN); 
    494492                if (name == "") 
    495493                { 
     
    504502                                                            // rename on login: `at_login` field 30 in raw field list 
    505503                        if(!changenth(line, 30, "1")) 
    506                                                         ROLLBACK(DUMP_FILE_BROKEN); 
     504                            ROLLBACK(DUMP_FILE_BROKEN); 
    507505                    } 
    508506                } 
    509507                else if(!changenth(line, 4, name.c_str())) 
    510                                         ROLLBACK(DUMP_FILE_BROKEN); 
     508                    ROLLBACK(DUMP_FILE_BROKEN); 
    511509 
    512510                break; 
     
    515513            { 
    516514                if(!changenth(line, 1, newguid)) 
    517                                         ROLLBACK(DUMP_FILE_BROKEN); 
     515                    ROLLBACK(DUMP_FILE_BROKEN); 
    518516 
    519517                // bag, item 
    520518                if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid, true)) 
    521                                         ROLLBACK(DUMP_FILE_BROKEN); 
    522                                 if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid)) 
    523                                         ROLLBACK(DUMP_FILE_BROKEN); 
     519                    ROLLBACK(DUMP_FILE_BROKEN); 
     520                if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid)) 
     521                    ROLLBACK(DUMP_FILE_BROKEN); 
    524522                break; 
    525523            } 
     
    528526                // item, owner, data field:item, owner guid 
    529527                if(!changeGuid(line, 1, items, objmgr.m_hiItemGuid)) 
    530                                         ROLLBACK(DUMP_FILE_BROKEN); 
    531                                 if(!changenth(line, 2, newguid)) 
    532                                         ROLLBACK(DUMP_FILE_BROKEN); 
    533  
     528                    ROLLBACK(DUMP_FILE_BROKEN); 
     529                if(!changenth(line, 2, newguid)) 
     530                    ROLLBACK(DUMP_FILE_BROKEN); 
    534531                std::string vals = getnth(line,3); 
    535532                if(!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, objmgr.m_hiItemGuid)) 
    536                                         ROLLBACK(DUMP_FILE_BROKEN); 
    537                                 if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid)) 
    538                                         ROLLBACK(DUMP_FILE_BROKEN); 
    539                                 if(!changenth(line, 3, vals.c_str())) 
    540                                         ROLLBACK(DUMP_FILE_BROKEN); 
     533                    ROLLBACK(DUMP_FILE_BROKEN); 
     534                if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid)) 
     535                    ROLLBACK(DUMP_FILE_BROKEN); 
     536                if(!changenth(line, 3, vals.c_str())) 
     537                    ROLLBACK(DUMP_FILE_BROKEN); 
    541538                break; 
    542539            } 
     
    545542                // guid,item_guid, 
    546543                if(!changenth(line, 1, newguid)) 
    547                                         ROLLBACK(DUMP_FILE_BROKEN); 
    548                                 if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
    549                                         ROLLBACK(DUMP_FILE_BROKEN); 
     544                    ROLLBACK(DUMP_FILE_BROKEN); 
     545                if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
     546                    ROLLBACK(DUMP_FILE_BROKEN); 
    550547                break; 
    551548            } 
     
    570567                // item, entry, owner, ... 
    571568                if(!changenth(line, 1, newpetid)) 
    572                                         ROLLBACK(DUMP_FILE_BROKEN); 
    573                                 if(!changenth(line, 3, newguid)) 
    574                                         ROLLBACK(DUMP_FILE_BROKEN); 
     569                    ROLLBACK(DUMP_FILE_BROKEN); 
     570                if(!changenth(line, 3, newguid)) 
     571                    ROLLBACK(DUMP_FILE_BROKEN); 
    575572 
    576573                break; 
     
    583580                std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid)); 
    584581                if(petids_iter == petids.end())             // couldn't find new inserted id 
    585                                         ROLLBACK(DUMP_FILE_BROKEN); 
     582                    ROLLBACK(DUMP_FILE_BROKEN); 
    586583 
    587584                snprintf(newpetid, 20, "%d", petids_iter->second); 
    588585 
    589586                if(!changenth(line, 1, newpetid)) 
    590                                         ROLLBACK(DUMP_FILE_BROKEN); 
     587                    ROLLBACK(DUMP_FILE_BROKEN); 
    591588 
    592589                break; 
     
    596593                // id,messageType,stationery,sender,receiver 
    597594                if(!changeGuid(line, 1, mails, objmgr.m_mailid)) 
    598                                         ROLLBACK(DUMP_FILE_BROKEN); 
    599                                 if(!changenth(line, 5, newguid)) 
    600                                         ROLLBACK(DUMP_FILE_BROKEN); 
     595                    ROLLBACK(DUMP_FILE_BROKEN); 
     596                if(!changenth(line, 5, newguid)) 
     597                    ROLLBACK(DUMP_FILE_BROKEN); 
    601598                break; 
    602599            } 
     
    605602                // mail_id,item_guid,item_template,receiver 
    606603                if(!changeGuid(line, 1, mails, objmgr.m_mailid)) 
    607                                         ROLLBACK(DUMP_FILE_BROKEN); 
    608                                 if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
    609                                         ROLLBACK(DUMP_FILE_BROKEN); 
    610                                 if(!changenth(line, 4, newguid)) 
    611                                         ROLLBACK(DUMP_FILE_BROKEN); 
     604                    ROLLBACK(DUMP_FILE_BROKEN); 
     605                if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
     606                    ROLLBACK(DUMP_FILE_BROKEN); 
     607                if(!changenth(line, 4, newguid)) 
     608                    ROLLBACK(DUMP_FILE_BROKEN); 
    612609                break; 
    613610            } 
     
    618615 
    619616        if(!CharacterDatabase.Execute(line.c_str())) 
    620                         ROLLBACK(DUMP_FILE_BROKEN); 
     617            ROLLBACK(DUMP_FILE_BROKEN); 
    621618    } 
    622619