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/Level2.cpp

    r263 r272  
    23622362    // Check 
    23632363    // Remember: "show" must also be the name of a column! 
    2364     if( (show != "emote") && (show != "spell") && (show != "textid1") && (show != "textid2") 
    2365         && (show != "textid3") && (show != "textid4") && (show != "textid5") 
     2364    if( (show != "emote") && (show != "spell") && (show != "text1") && (show != "text2") 
     2365        && (show != "text3") && (show != "text4") && (show != "text5") 
    23662366        && (show != "waittime") && (show != "del") && (show != "move") && (show != "add") 
    23672367        && (show != "model1") && (show != "model2") && (show != "orientation")) 
     
    27032703        PSendSysMessage(LANG_WAYPOINT_CREATNOTFOUND, lowguid); 
    27042704        SetSentErrorMessage(true); 
    2705         return false; 
    2706     } 
    2707  
    2708     // set in game textids not supported 
    2709     if( show == "textid1" || show == "textid2" || show == "textid3" || 
    2710         show == "textid4" || show == "textid5" ) 
    2711     { 
    27122705        return false; 
    27132706    } 
     
    28502843 
    28512844        QueryResult *result = 
    2852             WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, model1, model2 FROM creature_movement WHERE wpguid = %u", 
     2845            WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, text1, text2, text3, text4, text5, model1, model2 FROM creature_movement WHERE wpguid = %u", 
    28532846            target->GetGUIDLow() ); 
    28542847        if(!result) 
     
    28622855            PSendSysMessage(LANG_WAYPOINT_NOTFOUNDSEARCH, target->GetGUID()); 
    28632856 
    2864             result = WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, model1, model2 FROM creature_movement WHERE (abs(position_x - %f) <= %s ) and (abs(position_y - %f) <= %s ) and (abs(position_z - %f) <= %s )", 
     2857            result = WorldDatabase.PQuery( "SELECT id, point, waittime, emote, spell, text1, text2, text3, text4, text5, model1, model2 FROM creature_movement WHERE (abs(position_x - %f) <= %s ) and (abs(position_y - %f) <= %s ) and (abs(position_z - %f) <= %s )", 
    28652858                target->GetPositionX(), maxDIFF, target->GetPositionY(), maxDIFF, target->GetPositionZ(), maxDIFF); 
    28662859            if(!result) 
     
    28792872            uint32 emote            = fields[3].GetUInt32(); 
    28802873            uint32 spell            = fields[4].GetUInt32(); 
    2881             uint32 textid[MAX_WAYPOINT_TEXT]; 
    2882             for(int i = 0;  i < MAX_WAYPOINT_TEXT; ++i) 
    2883                 textid[i]           = fields[5+i].GetUInt32(); 
     2874            const char * text1      = fields[5].GetString(); 
     2875            const char * text2      = fields[6].GetString(); 
     2876            const char * text3      = fields[7].GetString(); 
     2877            const char * text4      = fields[8].GetString(); 
     2878            const char * text5      = fields[9].GetString(); 
    28842879            uint32 model1           = fields[10].GetUInt32(); 
    28852880            uint32 model2           = fields[11].GetUInt32(); 
     
    28942889            PSendSysMessage(LANG_WAYPOINT_INFO_EMOTE, emote); 
    28952890            PSendSysMessage(LANG_WAYPOINT_INFO_SPELL, spell); 
    2896             for(int i = 0;  i < MAX_WAYPOINT_TEXT; ++i) 
    2897                 PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, i+1, textid[i], (textid[i] ? GetTrinityString(textid[i]) : "")); 
     2891            PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 1, text1); 
     2892            PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 2, text2); 
     2893            PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 3, text3); 
     2894            PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 4, text4); 
     2895            PSendSysMessage(LANG_WAYPOINT_INFO_TEXT, 5, text5); 
    28982896 
    28992897        }while( result->NextRow() ); 
     
    32163214 
    32173215    QueryResult *result = WorldDatabase.PQuery( 
    3218     //          0      1           2           3           4            5       6       7         8      9      10       11       12       13       14       15 
    3219         "SELECT point, position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5, id FROM creature_movement WHERE id = '%u' ORDER BY point", lowguid ); 
     3216    //          0      1           2           3           4            5       6       7         8      9      10     11     12     13     14     15 
     3217        "SELECT point, position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, text1, text2, text3, text4, text5, id FROM creature_movement WHERE id = '%u' ORDER BY point", lowguid ); 
    32203218 
    32213219    if (!result) 
     
    32343232 
    32353233        outfile << "INSERT INTO creature_movement "; 
    3236         outfile << "( id, point, position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, textid1, textid2, textid3, textid4, textid5 ) VALUES "; 
     3234        outfile << "( id, point, position_x, position_y, position_z, orientation, model1, model2, waittime, emote, spell, text1, text2, text3, text4, text5 ) VALUES "; 
    32373235 
    32383236        outfile << "( "; 
     
    32593257        outfile << fields[9].GetUInt32();                   // spell 
    32603258        outfile << ", "; 
    3261         outfile << fields[10].GetUInt32();                  // textid1 
     3259        const char *tmpChar = fields[10].GetString(); 
     3260        if( !tmpChar ) 
     3261        { 
     3262            outfile << "NULL";                              // text1 
     3263        } 
     3264        else 
     3265        { 
     3266            outfile << "'"; 
     3267            outfile << tmpChar;                             // text1 
     3268            outfile << "'"; 
     3269        } 
    32623270        outfile << ", "; 
    3263         outfile << fields[11].GetUInt32();                  // textid2 
     3271        tmpChar = fields[11].GetString(); 
     3272        if( !tmpChar ) 
     3273        { 
     3274            outfile << "NULL";                              // text2 
     3275        } 
     3276        else 
     3277        { 
     3278            outfile << "'"; 
     3279            outfile << tmpChar;                             // text2 
     3280            outfile << "'"; 
     3281        } 
    32643282        outfile << ", "; 
    3265         outfile << fields[12].GetUInt32();                  // textid3 
     3283        tmpChar = fields[12].GetString(); 
     3284        if( !tmpChar ) 
     3285        { 
     3286            outfile << "NULL";                              // text3 
     3287        } 
     3288        else 
     3289        { 
     3290            outfile << "'"; 
     3291            outfile << tmpChar;                             // text3 
     3292            outfile << "'"; 
     3293        } 
    32663294        outfile << ", "; 
    3267         outfile << fields[13].GetUInt32();                  // textid4 
     3295        tmpChar = fields[13].GetString(); 
     3296        if( !tmpChar ) 
     3297        { 
     3298            outfile << "NULL";                              // text4 
     3299        } 
     3300        else 
     3301        { 
     3302            outfile << "'"; 
     3303            outfile << tmpChar;                             // text4 
     3304            outfile << "'"; 
     3305        } 
    32683306        outfile << ", "; 
    3269         outfile << fields[14].GetUInt32();                  // textid5 
     3307        tmpChar = fields[14].GetString(); 
     3308        if( !tmpChar ) 
     3309        { 
     3310            outfile << "NULL";                              // text5 
     3311        } 
     3312        else 
     3313        { 
     3314            outfile << "'"; 
     3315            outfile << tmpChar;                             // text5 
     3316            outfile << "'"; 
     3317        } 
    32703318        outfile << ");\n "; 
    32713319