Show
Ignore:
Timestamp:
11/19/08 13:27:40 (17 years ago)
Author:
yumileroy
Message:

[svn] * Merge Temp dev SVN with Assembla.
* Changes include:

  • Implementation of w12x's Outdoor PvP and Game Event Systems.
  • Temporary removal of IRC Chat Bot (until infinite loop when disabled is fixed).
  • All mangos -> trinity (to convert your mangos_string table, please run mangos_string_to_trinity_string.sql).
  • Improved Config cleanup.
  • And many more changes.

Original author: Seline
Date: 2008-10-14 11:57:03-05:00

Files:
1 modified

Legend:

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

    r37 r44  
    11/* 
    2  * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> 
     2 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> 
     3 * 
     4 * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> 
    35 * 
    46 * This program is free software; you can redistribute it and/or modify 
     
    911 * This program is distributed in the hope that it will be useful, 
    1012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1214 * GNU General Public License for more details. 
    1315 * 
    1416 * You should have received a copy of the GNU General Public License 
    1517 * along with this program; if not, write to the Free Software 
    16  * 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 
    1719 */ 
    1820 
     
    323325            { 
    324326                if(!GetPlayerNameByGUID(bidder_guid,bidder_name)) 
    325                     bidder_name = GetMangosStringForDBCLocale(LANG_UNKNOWN); 
     327                    bidder_name = GetTrinityStringForDBCLocale(LANG_UNKNOWN); 
    326328            } 
    327329        } 
     
    331333            std::string owner_name; 
    332334            if(!GetPlayerNameByGUID(auction->owner,owner_name)) 
    333                 owner_name = GetMangosStringForDBCLocale(LANG_UNKNOWN); 
     335                owner_name = GetTrinityStringForDBCLocale(LANG_UNKNOWN); 
    334336 
    335337            uint32 owner_accid = GetPlayerAccountIdByGUID(auction->owner); 
     
    10201022        if(mask & 1) 
    10211023        { 
    1022             CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY); 
     1024            CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); 
    10231025            uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; 
    10241026 
     
    10361038        if(mask & 1) 
    10371039        { 
    1038             CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY); 
     1040            CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); 
    10391041            uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; 
    10401042 
     
    10901092        data.animprogress   = fields[12].GetUInt32(); 
    10911093        data.go_state       = fields[13].GetUInt32(); 
     1094        data.ArtKit         = 0; 
    10921095        data.spawnMask      = fields[14].GetUInt8(); 
    10931096        int16 gameEvent     = fields[15].GetInt16(); 
     
    11191122        if(mask & 1) 
    11201123        { 
    1121             CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY); 
     1124            CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); 
    11221125            uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; 
    11231126 
     
    11351138        if(mask & 1) 
    11361139        { 
    1137             CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY); 
     1140            CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY); 
    11381141            uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord; 
    11391142 
     
    18421845                    sLog.outErrorDb("Wrong (> 255) level %u in `pet_levelstats` table, ignoring.",current_level); 
    18431846                else 
    1844                     sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `pet_levelstats` table, ignoring.",current_level); 
     1847                    sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `pet_levelstats` table, ignoring.",current_level); 
    18451848                continue; 
    18461849            } 
     
    20802083    { 
    20812084 
    2082         QueryResult *result = NULL; 
    2083         if(sWorld.getConfig(CONFIG_START_ALL_SPELLS)) 
    2084                 result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom"); 
    2085         else 
    2086                 result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell"); 
     2085        QueryResult *result = NULL; 
     2086        if(sWorld.getConfig(CONFIG_START_ALL_SPELLS)) 
     2087            result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom"); 
     2088        else 
     2089            result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell"); 
    20872090 
    20882091        uint32 count = 0; 
     
    22242227                    sLog.outErrorDb("Wrong (> 255) level %u in `player_classlevelstats` table, ignoring.",current_level); 
    22252228                else 
    2226                     sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `player_classlevelstats` table, ignoring.",current_level); 
     2229                    sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `player_classlevelstats` table, ignoring.",current_level); 
    22272230                continue; 
    22282231            } 
     
    23192322                    sLog.outErrorDb("Wrong (> 255) level %u in `player_levelstats` table, ignoring.",current_level); 
    23202323                else 
    2321                     sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `player_levelstats` table, ignoring.",current_level); 
     2324                    sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `player_levelstats` table, ignoring.",current_level); 
    23222325                continue; 
    23232326            } 
     
    28042807        } 
    28052808 
    2806         if (qinfo->QuestFlags & ~QUEST_MANGOS_FLAGS_DB_ALLOWED) 
     2809        if (qinfo->QuestFlags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED) 
    28072810        { 
    28082811            sLog.outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", 
    2809                 qinfo->GetQuestId(),qinfo->QuestFlags,QUEST_MANGOS_FLAGS_DB_ALLOWED >> 16); 
    2810             qinfo->QuestFlags &= QUEST_MANGOS_FLAGS_DB_ALLOWED; 
     2812                qinfo->GetQuestId(),qinfo->QuestFlags,QUEST_TRINITY_FLAGS_DB_ALLOWED >> 16); 
     2813            qinfo->QuestFlags &= QUEST_TRINITY_FLAGS_DB_ALLOWED; 
    28112814        } 
    28122815 
    28132816        if(qinfo->QuestFlags & QUEST_FLAGS_DAILY) 
    28142817        { 
    2815             if(!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE)) 
     2818            if(!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE)) 
    28162819            { 
    28172820                sLog.outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId()); 
    2818                 qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE; 
     2821                qinfo->QuestFlags |= QUEST_TRINITY_FLAGS_REPEATABLE; 
    28192822            } 
    28202823        } 
     
    30293032                } 
    30303033 
    3031                 qinfo->SetFlag(QUEST_MANGOS_FLAGS_DELIVER); 
     3034                qinfo->SetFlag(QUEST_TRINITY_FLAGS_DELIVER); 
    30323035 
    30333036                if(!sItemStorage.LookupEntry<ItemPrototype>(id)) 
     
    31463149                    if(found) 
    31473150                    { 
    3148                         if(!qinfo->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) 
     3151                        if(!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) 
    31493152                        { 
    3150                             sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1); 
     3153                            sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE or SPELL_EFFECT_SEND_EVENT for quest %u and ReqCreatureOrGOId%d = 0, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags or ReqCreatureOrGOId%d must be fixed, quest modified to enable objective.",spellInfo->Id,qinfo->QuestId,j+1,j+1); 
    31513154 
    31523155                            // this will prevent quest completing without objective 
    3153                             const_cast<Quest*>(qinfo)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); 
     3156                            const_cast<Quest*>(qinfo)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); 
    31543157                        } 
    31553158                    } 
     
    31853188                // In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast 
    31863189 
    3187                 qinfo->SetFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO); 
     3190                qinfo->SetFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO); 
    31883191 
    31893192                if(!qinfo->ReqCreatureOrGOCount[j]) 
     
    33743377            mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId())); 
    33753378        if(qinfo->LimitTime) 
    3376             qinfo->SetFlag(QUEST_MANGOS_FLAGS_TIMED); 
    3377     } 
    3378  
    3379     // check QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE 
     3379            qinfo->SetFlag(QUEST_TRINITY_FLAGS_TIMED); 
     3380    } 
     3381 
     3382    // check QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE 
    33803383    for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) 
    33813384    { 
     
    33973400                continue; 
    33983401 
    3399             if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) 
    3400             { 
    3401                 sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.",spellInfo->Id,quest_id); 
     3402            if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) 
     3403            { 
     3404                sLog.outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u , but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.",spellInfo->Id,quest_id); 
    34023405 
    34033406                // this will prevent quest completing without objective 
    3404                 const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); 
     3407                const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); 
    34053408            } 
    34063409        } 
     
    36593662                } 
    36603663 
    3661                 if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o)) 
     3664                if(!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o)) 
    36623665                { 
    36633666                    sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u",tablename,tmp.x,tmp.y,tmp.id); 
     
    36693672            case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE: 
    36703673            { 
    3671                 if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o)) 
     3674                if(!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o)) 
    36723675                { 
    36733676                    sLog.outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u",tablename,tmp.x,tmp.y,tmp.id); 
     
    37443747                } 
    37453748 
    3746                 if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) 
    3747                 { 
    3748                     sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",tablename,tmp.datalong,tmp.id); 
     3749                if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) 
     3750                { 
     3751                    sLog.outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.",tablename,tmp.datalong,tmp.id); 
    37493752 
    37503753                    // this will prevent quest completing without objective 
    3751                     const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); 
     3754                    const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); 
    37523755 
    37533756                    // continue; - quest objective requiremet set and command can be allowed 
     
    43784381        } 
    43794382 
    4380         if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT)) 
    4381         { 
    4382             sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.",trigger_ID,quest_ID); 
     4383        if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT)) 
     4384        { 
     4385            sLog.outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have flag QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.",trigger_ID,quest_ID); 
    43834386 
    43844387            // this will prevent quest completing without objective 
    4385             const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT); 
     4388            const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT); 
    43864389 
    43874390            // continue; - quest modified to required obkective and trigger can be allowed. 
     
    48014804    return true; 
    48024805} 
     4806 
     4807void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inDB) 
     4808{ 
     4809    GraveYardMap::iterator graveLow  = mGraveYardMap.lower_bound(zoneId); 
     4810    GraveYardMap::iterator graveUp   = mGraveYardMap.upper_bound(zoneId); 
     4811    if(graveLow==graveUp) 
     4812    { 
     4813        //sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.",zoneId,team); 
     4814        return; 
     4815    } 
     4816 
     4817    bool found = false; 
     4818 
     4819    GraveYardMap::iterator itr; 
     4820 
     4821    for(itr = graveLow; itr != graveUp; ++itr) 
     4822    { 
     4823        GraveYardData & data = itr->second; 
     4824 
     4825        // skip not matching safezone id 
     4826        if(data.safeLocId != id) 
     4827            continue; 
     4828 
     4829        // skip enemy faction graveyard at same map (normal area, city, or battleground) 
     4830        // team == 0 case can be at call from .neargrave 
     4831        if(data.team != 0 && team != 0 && data.team != team) 
     4832            continue; 
     4833 
     4834        found = true; 
     4835        break; 
     4836    } 
     4837 
     4838    // no match, return 
     4839    if(!found) 
     4840        return; 
     4841 
     4842    // remove from links 
     4843    mGraveYardMap.erase(itr); 
     4844 
     4845    // remove link from DB 
     4846    if(inDB) 
     4847    { 
     4848        WorldDatabase.PExecute("DELETE FROM game_graveyard_zone WHERE id = '%u' AND ghost_zone = '%u' AND faction = '%u'",id,zoneId,team); 
     4849    } 
     4850 
     4851    return; 
     4852} 
     4853 
    48034854 
    48044855void ObjectMgr::LoadAreaTriggerTeleports() 
     
    61476198} 
    61486199 
    6149 bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value) 
     6200bool ObjectMgr::LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value) 
    61506201{ 
    61516202    // cleanup affected map part for reloading case 
    6152     for(MangosStringLocaleMap::iterator itr = mMangosStringLocaleMap.begin(); itr != mMangosStringLocaleMap.end();) 
     6203    for(TrinityStringLocaleMap::iterator itr = mTrinityStringLocaleMap.begin(); itr != mTrinityStringLocaleMap.end();) 
    61536204    { 
    61546205        if(itr->first >= min_value && itr->first <= max_value) 
    61556206        { 
    6156             MangosStringLocaleMap::iterator itr2 = itr; 
     6207            TrinityStringLocaleMap::iterator itr2 = itr; 
    61576208            ++itr; 
    6158             mMangosStringLocaleMap.erase(itr2); 
     6209            mTrinityStringLocaleMap.erase(itr2); 
    61596210        } 
    61606211        else 
     
    61726223        sLog.outString(""); 
    61736224        if(min_value > 0)                                   // error only in case internal strings 
    6174             sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Cannot continue.",table); 
     6225            sLog.outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.",table); 
    61756226        else 
    61766227            sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.",table); 
     
    62026253        } 
    62036254 
    6204         MangosStringLocale& data = mMangosStringLocaleMap[entry]; 
     6255        TrinityStringLocale& data = mTrinityStringLocaleMap[entry]; 
    62056256 
    62066257        if(data.Content.size() > 0) 
     
    62376288 
    62386289    sLog.outString(); 
    6239     if(min_value > 0)                                       // internal mangos strings 
    6240         sLog.outString( ">> Loaded %u MaNGOS strings from table %s", count,table); 
     6290    if(min_value > 0)                                       // internal Trinity strings 
     6291        sLog.outString( ">> Loaded %u Trinity strings from table %s", count,table); 
    62416292    else 
    62426293        sLog.outString( ">> Loaded %u string templates from %s", count,table); 
     
    62456296} 
    62466297 
    6247 const char *ObjectMgr::GetMangosString(int32 entry, int locale_idx) const 
     6298const char *ObjectMgr::GetTrinityString(int32 entry, int locale_idx) const 
    62486299{ 
    62496300    // locale_idx==-1 -> default, locale_idx >= 0 in to idx+1 
    6250     // Content[0] always exist if exist MangosStringLocale 
    6251     if(MangosStringLocale const *msl = GetMangosStringLocale(entry)) 
     6301    // Content[0] always exist if exist TrinityStringLocale 
     6302    if(TrinityStringLocale const *msl = GetTrinityStringLocale(entry)) 
    62526303    { 
    62536304        if(msl->Content.size() > locale_idx+1 && !msl->Content[locale_idx+1].empty()) 
     
    62586309 
    62596310    if(entry > 0) 
    6260         sLog.outErrorDb("Entry %i not found in `mangos_string` table.",entry); 
     6311        sLog.outErrorDb("Entry %i not found in `trinity_string` table.",entry); 
    62616312    else 
    6262         sLog.outErrorDb("Mangos string entry %i not found in DB.",entry); 
     6313        sLog.outErrorDb("Trinity string entry %i not found in DB.",entry); 
    62636314    return "<error>"; 
    62646315} 
     
    68696920} 
    68706921 
    6871 void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost ) 
     6922void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb) 
    68726923{ 
    68736924    VendorItemData& vList = m_mCacheVendorItemMap[entry]; 
    68746925    vList.AddItem(item,maxcount,incrtime,extendedcost); 
    68756926 
    6876     WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost); 
    6877 } 
    6878  
    6879 bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item ) 
     6927    if(savetodb) WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost); 
     6928} 
     6929 
     6930bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item, bool savetodb) 
    68806931{ 
    68816932    CacheVendorItemMap::iterator  iter = m_mCacheVendorItemMap.find(entry); 
     
    68876938 
    68886939    iter->second.RemoveItem(item); 
    6889     WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item); 
     6940    if(savetodb) WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item); 
    68906941    return true; 
    68916942} 
    68926943 
    6893 bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors ) const 
     6944bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag ) const 
    68946945{ 
    68956946    CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry); 
     
    68996950            ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION); 
    69006951        else 
    6901             sLog.outErrorDb("Table `npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); 
     6952            sLog.outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); 
    69026953        return false; 
    69036954    } 
    69046955 
    6905     if(!(cInfo->npcflag & UNIT_NPC_FLAG_VENDOR)) 
     6956    if(!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR)) 
    69066957    { 
    69076958        if(!skip_vendors || skip_vendors->count(vendor_entry)==0) 
     
    69106961                ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION); 
    69116962            else 
    6912                 sLog.outErrorDb("Table `npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); 
     6963                sLog.outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); 
    69136964 
    69146965            if(skip_vendors) 
     
    69236974            ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id); 
    69246975        else 
    6925             sLog.outErrorDb("Table `npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id); 
     6976            sLog.outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id); 
    69266977        return false; 
    69276978    } 
     
    69326983            ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST,ExtendedCost); 
    69336984        else 
    6934             sLog.outErrorDb("Table `npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry); 
     6985            sLog.outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry); 
    69356986        return false; 
    69366987    } 
     
    69416992            ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount); 
    69426993        else 
    6943             sLog.outErrorDb( "Table `npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); 
     6994            sLog.outErrorDb( "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); 
    69446995        return false; 
    69456996    } 
     
    69497000            ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0"); 
    69507001        else 
    6951             sLog.outErrorDb( "Table `npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); 
     7002            sLog.outErrorDb( "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); 
    69527003        return false; 
    69537004    } 
     
    69627013            ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST,item_id); 
    69637014        else 
    6964             sLog.outErrorDb( "Table `npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry); 
     7015            sLog.outErrorDb( "Table `(game_event_)npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry); 
    69657016        return false; 
    69667017    } 
     
    69847035} 
    69857036 
    6986 bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value, int32 end_value) 
     7037bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value, int32 end_value) 
    69877038{ 
    69887039    if(start_value >= 0 || start_value <= end_value)        // start/end reversed for negative values 
     
    69947045 
    69957046    // for scripting localized strings allowed use _only_ negative entries 
    6996     return objmgr.LoadMangosStrings(db,table,end_value,start_value); 
    6997 } 
     7047    return objmgr.LoadTrinityStrings(db,table,end_value,start_value); 
     7048}