Changeset 260 for trunk/src/game/PlayerDump.cpp
- Timestamp:
- 11/21/08 08:47:55 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/PlayerDump.cpp
r112 r260 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 278 278 // for guid set stop if set is empty 279 279 if(guids && guids->empty()) 280 return; // nothing to do280 return; // nothing to do 281 281 282 282 // setup for guids case start position … … 344 344 FILE *fout = fopen(file.c_str(), "w"); 345 345 if (!fout) 346 346 return DUMP_FILE_OPEN_ERROR; 347 347 348 348 std::string dump = GetDump(guid); … … 372 372 } 373 373 } 374 374 375 FILE *fin = fopen(file.c_str(), "r"); 375 376 if(!fin) 376 377 return DUMP_FILE_OPEN_ERROR; 377 378 378 379 QueryResult * result = NULL; … … 391 392 else incHighest = false; 392 393 } 393 else guid = objmgr.m_hiCharGuid; 394 else 395 guid = objmgr.m_hiCharGuid; 394 396 395 397 // normalize the name if specified and check if it exists … … 469 471 case DTT_CHAR_TABLE: 470 472 if(!changenth(line, 1, newguid)) 471 473 ROLLBACK(DUMP_FILE_BROKEN); 472 474 break; 473 475 … … 475 477 { 476 478 if(!changenth(line, 1, newguid)) 477 479 ROLLBACK(DUMP_FILE_BROKEN); 478 480 479 481 // guid, data field:guid, items 480 482 if(!changenth(line, 2, chraccount)) 481 ROLLBACK(DUMP_FILE_BROKEN); 482 483 ROLLBACK(DUMP_FILE_BROKEN); 483 484 std::string vals = getnth(line, 3); 484 485 if(!changetoknth(vals, OBJECT_FIELD_GUID+1, newguid)) 485 ROLLBACK(DUMP_FILE_BROKEN); 486 486 ROLLBACK(DUMP_FILE_BROKEN); 487 487 for(uint16 field = PLAYER_FIELD_INV_SLOT_HEAD; field < PLAYER_FARSIGHT; field++) 488 488 if(!changetokGuid(vals, field+1, items, objmgr.m_hiItemGuid, true)) 489 ROLLBACK(DUMP_FILE_BROKEN); 490 489 ROLLBACK(DUMP_FILE_BROKEN); 491 490 if(!changenth(line, 3, vals.c_str())) 492 ROLLBACK(DUMP_FILE_BROKEN); 493 491 ROLLBACK(DUMP_FILE_BROKEN); 494 492 if (name == "") 495 493 { … … 504 502 // rename on login: `at_login` field 30 in raw field list 505 503 if(!changenth(line, 30, "1")) 506 504 ROLLBACK(DUMP_FILE_BROKEN); 507 505 } 508 506 } 509 507 else if(!changenth(line, 4, name.c_str())) 510 508 ROLLBACK(DUMP_FILE_BROKEN); 511 509 512 510 break; … … 515 513 { 516 514 if(!changenth(line, 1, newguid)) 517 515 ROLLBACK(DUMP_FILE_BROKEN); 518 516 519 517 // bag, item 520 518 if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid, true)) 521 522 523 519 ROLLBACK(DUMP_FILE_BROKEN); 520 if(!changeGuid(line, 4, items, objmgr.m_hiItemGuid)) 521 ROLLBACK(DUMP_FILE_BROKEN); 524 522 break; 525 523 } … … 528 526 // item, owner, data field:item, owner guid 529 527 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); 534 531 std::string vals = getnth(line,3); 535 532 if(!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, objmgr.m_hiItemGuid)) 536 537 538 539 540 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); 541 538 break; 542 539 } … … 545 542 // guid,item_guid, 546 543 if(!changenth(line, 1, newguid)) 547 548 549 544 ROLLBACK(DUMP_FILE_BROKEN); 545 if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid)) 546 ROLLBACK(DUMP_FILE_BROKEN); 550 547 break; 551 548 } … … 570 567 // item, entry, owner, ... 571 568 if(!changenth(line, 1, newpetid)) 572 573 574 569 ROLLBACK(DUMP_FILE_BROKEN); 570 if(!changenth(line, 3, newguid)) 571 ROLLBACK(DUMP_FILE_BROKEN); 575 572 576 573 break; … … 583 580 std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid)); 584 581 if(petids_iter == petids.end()) // couldn't find new inserted id 585 582 ROLLBACK(DUMP_FILE_BROKEN); 586 583 587 584 snprintf(newpetid, 20, "%d", petids_iter->second); 588 585 589 586 if(!changenth(line, 1, newpetid)) 590 587 ROLLBACK(DUMP_FILE_BROKEN); 591 588 592 589 break; … … 596 593 // id,messageType,stationery,sender,receiver 597 594 if(!changeGuid(line, 1, mails, objmgr.m_mailid)) 598 599 600 595 ROLLBACK(DUMP_FILE_BROKEN); 596 if(!changenth(line, 5, newguid)) 597 ROLLBACK(DUMP_FILE_BROKEN); 601 598 break; 602 599 } … … 605 602 // mail_id,item_guid,item_template,receiver 606 603 if(!changeGuid(line, 1, mails, objmgr.m_mailid)) 607 608 609 610 611 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); 612 609 break; 613 610 } … … 618 615 619 616 if(!CharacterDatabase.Execute(line.c_str())) 620 617 ROLLBACK(DUMP_FILE_BROKEN); 621 618 } 622 619