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

Some missing changes. This should fix the bug that loading char causes crash.

Original author: megamage
Date: 2008-11-20 17:18:23-06:00

Files:
1 modified

Legend:

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

    r230 r262  
    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 
     
    6565    res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP,           "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid)); 
    6666    res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES,  "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid)); 
    67     res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS,           "SELECT caster_guid,spell,effect_index,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid)); 
     67    res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS,           "SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid)); 
    6868    res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS,          "SELECT spell,slot,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid)); 
    6969    res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS,     "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid)); 
     
    181181    std::string name; 
    182182    uint8 race_,class_; 
     183 
    183184    recv_data >> name; 
    184185 
     
    215216    ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(class_); 
    216217    ChrRacesEntry const* raceEntry = sChrRacesStore.LookupEntry(race_); 
     218 
    217219    if( !classEntry || !raceEntry ) 
    218220    { 
     
    608610    } 
    609611 
    610     if (!MapManager::Instance().GetMap(pCurrChar->GetMapId(), pCurrChar)->Add(pCurrChar)) 
     612    if (!pCurrChar->GetMap()->Add(pCurrChar)) 
    611613    { 
    612614        AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId()); 
     
    10001002    uint64 guid; 
    10011003 
    1002     CHECK_PACKET_SIZE(recv_data, 8+6); 
     1004    CHECK_PACKET_SIZE(recv_data, 8); 
    10031005    recv_data >> guid; 
    10041006 
    10051007    // not accept declined names for unsupported languages 
    10061008    std::string name; 
    1007     if(!objmgr.GetPlayerNameByGUID(guid,name)) 
    1008     { 
    1009         WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT,4+8); 
    1010         data << (uint32)1; 
    1011         data << guid; 
     1009    if(!objmgr.GetPlayerNameByGUID(guid, name)) 
     1010    { 
     1011        WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); 
     1012        data << uint32(1); 
     1013        data << uint64(guid); 
    10121014        SendPacket(&data); 
    10131015        return; 
     
    10151017 
    10161018    std::wstring wname; 
    1017     if(!Utf8toWStr(name,wname)) 
    1018     { 
    1019         WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT,4+8); 
    1020         data << (uint32)1; 
    1021         data << guid; 
     1019    if(!Utf8toWStr(name, wname)) 
     1020    { 
     1021        WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); 
     1022        data << uint32(1); 
     1023        data << uint64(guid); 
    10221024        SendPacket(&data); 
    10231025        return; 
     
    10261028    if(!isCyrillicCharacter(wname[0]))                      // name already stored as only single alphabet using 
    10271029    { 
    1028         WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT,4+8); 
    1029         data << (uint32)1; 
    1030         data << guid; 
     1030        WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); 
     1031        data << uint32(1); 
     1032        data << uint64(guid); 
    10311033        SendPacket(&data); 
    10321034        return; 
     
    10361038    DeclinedName declinedname; 
    10371039 
     1040    CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1); 
    10381041    recv_data >> name2; 
    10391042 
    1040     if(name2!=name)                                         // character have different name 
    1041     { 
    1042         WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT,4+8); 
    1043         data << (uint32)1; 
    1044         data << guid; 
     1043    if(name2 != name)                                       // character have different name 
     1044    { 
     1045        WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); 
     1046        data << uint32(1); 
     1047        data << uint64(guid); 
    10451048        SendPacket(&data); 
    10461049        return; 
     
    10491052    for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i) 
    10501053    { 
     1054        CHECK_PACKET_SIZE(recv_data, recv_data.rpos() + 1); 
    10511055        recv_data >> declinedname.name[i]; 
    10521056        if(!normalizePlayerName(declinedname.name[i])) 
    10531057        { 
    1054             WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT,4+8); 
    1055             data << (uint32)1; 
    1056             data << guid; 
     1058            WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); 
     1059            data << uint32(1); 
     1060            data << uint64(guid); 
    10571061            SendPacket(&data); 
    10581062            return; 
     
    10601064    } 
    10611065 
    1062     if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname,0),declinedname)) 
    1063     { 
    1064         WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT,4+8); 
    1065         data << (uint32)1; 
    1066         data << guid; 
     1066    if(!ObjectMgr::CheckDeclinedNames(GetMainPartOfName(wname, 0), declinedname)) 
     1067    { 
     1068        WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); 
     1069        data << uint32(1); 
     1070        data << uint64(guid); 
    10671071        SendPacket(&data); 
    10681072        return; 
     
    10751079    CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid = '%u'", GUID_LOPART(guid)); 
    10761080    CharacterDatabase.PExecute("INSERT INTO character_declinedname (guid, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%s','%s','%s','%s','%s')", 
    1077         GUID_LOPART(guid), declinedname.name[0].c_str(),declinedname.name[1].c_str(),declinedname.name[2].c_str(),declinedname.name[3].c_str(),declinedname.name[4].c_str()); 
     1081        GUID_LOPART(guid), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str()); 
    10781082    CharacterDatabase.CommitTransaction(); 
    10791083 
    1080     WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT,4+8); 
    1081     data << (uint32)0;                                      // OK 
    1082     data << guid; 
     1084    WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8); 
     1085    data << uint32(0);                                      // OK 
     1086    data << uint64(guid); 
    10831087    SendPacket(&data); 
    10841088}