Show
Ignore:
Timestamp:
11/22/08 00:35:41 (17 years ago)
Author:
yumileroy
Message:

Delete possessed AI only on creature delete.

Original author: gvcoman
Date: 2008-11-16 14:38:02-05:00

Files:
1 modified

Legend:

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

    r263 r272  
    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  
    375374    FILE *fin = fopen(file.c_str(), "r"); 
    376375    if(!fin) 
    377         return DUMP_FILE_OPEN_ERROR; 
     376                return DUMP_FILE_OPEN_ERROR; 
    378377 
    379378    QueryResult * result = NULL; 
     
    392391        else incHighest = false; 
    393392    } 
    394     else 
    395         guid = objmgr.m_hiCharGuid; 
     393    else guid = objmgr.m_hiCharGuid; 
    396394 
    397395    // normalize the name if specified and check if it exists 
     
    471469            case DTT_CHAR_TABLE: 
    472470                if(!changenth(line, 1, newguid)) 
    473                     ROLLBACK(DUMP_FILE_BROKEN); 
     471                                        ROLLBACK(DUMP_FILE_BROKEN); 
    474472                break; 
    475473 
     
    477475            { 
    478476                if(!changenth(line, 1, newguid)) 
    479                     ROLLBACK(DUMP_FILE_BROKEN); 
     477                                        ROLLBACK(DUMP_FILE_BROKEN); 
    480478 
    481479                // guid, data field:guid, items 
    482480                if(!changenth(line, 2, chraccount)) 
    483                     ROLLBACK(DUMP_FILE_BROKEN); 
     481                                        ROLLBACK(DUMP_FILE_BROKEN); 
     482 
    484483                std::string vals = getnth(line, 3); 
    485484                if(!changetoknth(vals, OBJECT_FIELD_GUID+1, newguid)) 
    486                     ROLLBACK(DUMP_FILE_BROKEN); 
     485                                        ROLLBACK(DUMP_FILE_BROKEN); 
     486 
    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); 
     489                                                ROLLBACK(DUMP_FILE_BROKEN); 
     490 
    490491                if(!changenth(line, 3, vals.c_str())) 
    491                     ROLLBACK(DUMP_FILE_BROKEN); 
     492                                        ROLLBACK(DUMP_FILE_BROKEN); 
     493 
    492494                if (name == "") 
    493495                { 
     
    502504                                                            // rename on login: `at_login` field 30 in raw field list 
    503505                        if(!changenth(line, 30, "1")) 
    504                             ROLLBACK(DUMP_FILE_BROKEN); 
     506                                                        ROLLBACK(DUMP_FILE_BROKEN); 
    505507                    } 
    506508                } 
    507509                else if(!changenth(line, 4, name.c_str())) 
    508                     ROLLBACK(DUMP_FILE_BROKEN); 
     510                                        ROLLBACK(DUMP_FILE_BROKEN); 
    509511 
    510512                break; 
     
    513515            { 
    514516                if(!changenth(line, 1, newguid)) 
    515                     ROLLBACK(DUMP_FILE_BROKEN); 
     517                                        ROLLBACK(DUMP_FILE_BROKEN); 
    516518 
    517519                // bag, item 
    518520                if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid, true)) 
    519                     ROLLBACK(DUMP_FILE_BROKEN); 
    520                 if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid)) 
    521                     ROLLBACK(DUMP_FILE_BROKEN); 
     521                                        ROLLBACK(DUMP_FILE_BROKEN); 
     522                                if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid)) 
     523                                        ROLLBACK(DUMP_FILE_BROKEN); 
    522524                break; 
    523525            } 
     
    526528                // item, owner, data field:item, owner guid 
    527529                if(!changeGuid(line, 1, items, objmgr.m_hiItemGuid)) 
    528                     ROLLBACK(DUMP_FILE_BROKEN); 
    529                 if(!changenth(line, 2, newguid)) 
    530                     ROLLBACK(DUMP_FILE_BROKEN); 
     530                                        ROLLBACK(DUMP_FILE_BROKEN); 
     531                                if(!changenth(line, 2, newguid)) 
     532                                        ROLLBACK(DUMP_FILE_BROKEN); 
     533 
    531534                std::string vals = getnth(line,3); 
    532535                if(!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, objmgr.m_hiItemGuid)) 
    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); 
     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); 
    538541                break; 
    539542            } 
     
    542545                // guid,item_guid, 
    543546                if(!changenth(line, 1, newguid)) 
    544                     ROLLBACK(DUMP_FILE_BROKEN); 
    545                 if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
    546                     ROLLBACK(DUMP_FILE_BROKEN); 
     547                                        ROLLBACK(DUMP_FILE_BROKEN); 
     548                                if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 
     549                                        ROLLBACK(DUMP_FILE_BROKEN); 
    547550                break; 
    548551            } 
     
    567570                // item, entry, owner, ... 
    568571                if(!changenth(line, 1, newpetid)) 
    569                     ROLLBACK(DUMP_FILE_BROKEN); 
    570                 if(!changenth(line, 3, newguid)) 
    571                     ROLLBACK(DUMP_FILE_BROKEN); 
     572                                        ROLLBACK(DUMP_FILE_BROKEN); 
     573                                if(!changenth(line, 3, newguid)) 
     574                                        ROLLBACK(DUMP_FILE_BROKEN); 
    572575 
    573576                break; 
     
    580583                std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid)); 
    581584                if(petids_iter == petids.end())             // couldn't find new inserted id 
    582                     ROLLBACK(DUMP_FILE_BROKEN); 
     585                                        ROLLBACK(DUMP_FILE_BROKEN); 
    583586 
    584587                snprintf(newpetid, 20, "%d", petids_iter->second); 
    585588 
    586589                if(!changenth(line, 1, newpetid)) 
    587                     ROLLBACK(DUMP_FILE_BROKEN); 
     590                                        ROLLBACK(DUMP_FILE_BROKEN); 
    588591 
    589592                break; 
     
    593596                // id,messageType,stationery,sender,receiver 
    594597                if(!changeGuid(line, 1, mails, objmgr.m_mailid)) 
    595                     ROLLBACK(DUMP_FILE_BROKEN); 
    596                 if(!changenth(line, 5, newguid)) 
    597                     ROLLBACK(DUMP_FILE_BROKEN); 
     598                                        ROLLBACK(DUMP_FILE_BROKEN); 
     599                                if(!changenth(line, 5, newguid)) 
     600                                        ROLLBACK(DUMP_FILE_BROKEN); 
    598601                break; 
    599602            } 
     
    602605                // mail_id,item_guid,item_template,receiver 
    603606                if(!changeGuid(line, 1, mails, objmgr.m_mailid)) 
    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); 
     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); 
    609612                break; 
    610613            } 
     
    615618 
    616619        if(!CharacterDatabase.Execute(line.c_str())) 
    617             ROLLBACK(DUMP_FILE_BROKEN); 
     620                        ROLLBACK(DUMP_FILE_BROKEN); 
    618621    } 
    619622