[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.

--HG--
branch : trunk
This commit is contained in:
Seline committed 2008-10-14 11:57:03 -05:00
1 parent 222cbfd464
commit 2265aef916
463 files changed
+10750 -7723

No files matched your search

+119 -68
View File
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
*
* Thanks to the original authors: MaNGOS <http://www.mangosproject.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -8,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "Common.h"
@@ -322,7 +324,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction )
if(bidder_security > SEC_PLAYER ) // not do redundant DB requests
{
if(!GetPlayerNameByGUID(bidder_guid,bidder_name))
bidder_name = GetMangosStringForDBCLocale(LANG_UNKNOWN);
bidder_name = GetTrinityStringForDBCLocale(LANG_UNKNOWN);
}
}
@@ -330,7 +332,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction )
{
std::string owner_name;
if(!GetPlayerNameByGUID(auction->owner,owner_name))
owner_name = GetMangosStringForDBCLocale(LANG_UNKNOWN);
owner_name = GetTrinityStringForDBCLocale(LANG_UNKNOWN);
uint32 owner_accid = GetPlayerAccountIdByGUID(auction->owner);
@@ -1019,7 +1021,7 @@ void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
{
if(mask & 1)
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid,i)][cell_id];
@@ -1035,7 +1037,7 @@ void ObjectMgr::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
{
if(mask & 1)
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid,i)][cell_id];
@@ -1089,6 +1091,7 @@ void ObjectMgr::LoadGameobjects()
data.spawntimesecs = fields[11].GetInt32();
data.animprogress = fields[12].GetUInt32();
data.go_state = fields[13].GetUInt32();
data.ArtKit = 0;
data.spawnMask = fields[14].GetUInt8();
int16 gameEvent = fields[15].GetInt16();
@@ -1118,7 +1121,7 @@ void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
{
if(mask & 1)
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid,i)][cell_id];
@@ -1134,7 +1137,7 @@ void ObjectMgr::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data
{
if(mask & 1)
{
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
CellPair cell_pair = Trinity::ComputeCellPair(data->posX, data->posY);
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
CellObjectGuids& cell_guids = mMapObjectGuids[MAKE_PAIR32(data->mapid,i)][cell_id];
@@ -1841,7 +1844,7 @@ void ObjectMgr::LoadPetLevelInfo()
if(current_level > 255) // hardcoded level maximum
sLog.outErrorDb("Wrong (> 255) level %u in `pet_levelstats` table, ignoring.",current_level);
else
sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `pet_levelstats` table, ignoring.",current_level);
sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `pet_levelstats` table, ignoring.",current_level);
continue;
}
else if(current_level < 1)
@@ -2079,11 +2082,11 @@ void ObjectMgr::LoadPlayerInfo()
// Load playercreate spells
{
QueryResult *result = NULL;
if(sWorld.getConfig(CONFIG_START_ALL_SPELLS))
result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom");
else
result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell");
QueryResult *result = NULL;
if(sWorld.getConfig(CONFIG_START_ALL_SPELLS))
result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell_custom");
else
result = WorldDatabase.Query("SELECT race, class, Spell, Active FROM playercreateinfo_spell");
uint32 count = 0;
@@ -2223,7 +2226,7 @@ void ObjectMgr::LoadPlayerInfo()
if(current_level > 255) // hardcoded level maximum
sLog.outErrorDb("Wrong (> 255) level %u in `player_classlevelstats` table, ignoring.",current_level);
else
sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `player_classlevelstats` table, ignoring.",current_level);
sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `player_classlevelstats` table, ignoring.",current_level);
continue;
}
@@ -2318,7 +2321,7 @@ void ObjectMgr::LoadPlayerInfo()
if(current_level > 255) // hardcoded level maximum
sLog.outErrorDb("Wrong (> 255) level %u in `player_levelstats` table, ignoring.",current_level);
else
sLog.outDetail("Unused (> MaxPlayerLevel in mangosd.conf) level %u in `player_levelstats` table, ignoring.",current_level);
sLog.outDetail("Unused (> MaxPlayerLevel in Trinityd.conf) level %u in `player_levelstats` table, ignoring.",current_level);
continue;
}
@@ -2803,19 +2806,19 @@ void ObjectMgr::LoadQuests()
sLog.outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.",qinfo->GetQuestId(),qinfo->GetQuestMethod());
}
if (qinfo->QuestFlags & ~QUEST_MANGOS_FLAGS_DB_ALLOWED)
if (qinfo->QuestFlags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED)
{
sLog.outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u",
qinfo->GetQuestId(),qinfo->QuestFlags,QUEST_MANGOS_FLAGS_DB_ALLOWED >> 16);
qinfo->QuestFlags &= QUEST_MANGOS_FLAGS_DB_ALLOWED;
qinfo->GetQuestId(),qinfo->QuestFlags,QUEST_TRINITY_FLAGS_DB_ALLOWED >> 16);
qinfo->QuestFlags &= QUEST_TRINITY_FLAGS_DB_ALLOWED;
}
if(qinfo->QuestFlags & QUEST_FLAGS_DAILY)
{
if(!(qinfo->QuestFlags & QUEST_MANGOS_FLAGS_REPEATABLE))
if(!(qinfo->QuestFlags & QUEST_TRINITY_FLAGS_REPEATABLE))
{
sLog.outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.",qinfo->GetQuestId());
qinfo->QuestFlags |= QUEST_MANGOS_FLAGS_REPEATABLE;
qinfo->QuestFlags |= QUEST_TRINITY_FLAGS_REPEATABLE;
}
}
@@ -3028,7 +3031,7 @@ void ObjectMgr::LoadQuests()
// no changes, quest can't be done for this requirement
}
qinfo->SetFlag(QUEST_MANGOS_FLAGS_DELIVER);
qinfo->SetFlag(QUEST_TRINITY_FLAGS_DELIVER);
if(!sItemStorage.LookupEntry<ItemPrototype>(id))
{
@@ -3145,12 +3148,12 @@ void ObjectMgr::LoadQuests()
if(found)
{
if(!qinfo->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
if(!qinfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
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);
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);
// this will prevent quest completing without objective
const_cast<Quest*>(qinfo)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
const_cast<Quest*>(qinfo)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
}
}
else
@@ -3184,7 +3187,7 @@ void ObjectMgr::LoadQuests()
{
// In fact SpeakTo and Kill are quite same: either you can speak to mob:SpeakTo or you can't:Kill/Cast
qinfo->SetFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO);
qinfo->SetFlag(QUEST_TRINITY_FLAGS_KILL_OR_CAST | QUEST_TRINITY_FLAGS_SPEAKTO);
if(!qinfo->ReqCreatureOrGOCount[j])
{
@@ -3373,10 +3376,10 @@ void ObjectMgr::LoadQuests()
if(qinfo->ExclusiveGroup)
mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId()));
if(qinfo->LimitTime)
qinfo->SetFlag(QUEST_MANGOS_FLAGS_TIMED);
qinfo->SetFlag(QUEST_TRINITY_FLAGS_TIMED);
}
// check QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
// check QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i);
@@ -3396,12 +3399,12 @@ void ObjectMgr::LoadQuests()
if(!quest)
continue;
if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
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);
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);
// this will prevent quest completing without objective
const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
}
}
}
@@ -3658,7 +3661,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
continue;
}
if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
if(!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
{
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);
continue;
@@ -3668,7 +3671,7 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
case SCRIPT_COMMAND_TEMP_SUMMON_CREATURE:
{
if(!MaNGOS::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
if(!Trinity::IsValidMapCoord(tmp.x,tmp.y,tmp.z,tmp.o))
{
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);
continue;
@@ -3743,12 +3746,12 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
continue;
}
if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
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);
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);
// this will prevent quest completing without objective
const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
// continue; - quest objective requiremet set and command can be allowed
}
@@ -4377,12 +4380,12 @@ void ObjectMgr::LoadQuestAreaTriggers()
continue;
}
if(!quest->HasFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT))
if(!quest->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT))
{
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);
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);
// this will prevent quest completing without objective
const_cast<Quest*>(quest)->SetFlag(QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT);
const_cast<Quest*>(quest)->SetFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT);
// continue; - quest modified to required obkective and trigger can be allowed.
}
@@ -4801,6 +4804,54 @@ bool ObjectMgr::AddGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inD
return true;
}
void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool inDB)
{
GraveYardMap::iterator graveLow = mGraveYardMap.lower_bound(zoneId);
GraveYardMap::iterator graveUp = mGraveYardMap.upper_bound(zoneId);
if(graveLow==graveUp)
{
//sLog.outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.",zoneId,team);
return;
}
bool found = false;
GraveYardMap::iterator itr;
for(itr = graveLow; itr != graveUp; ++itr)
{
GraveYardData & data = itr->second;
// skip not matching safezone id
if(data.safeLocId != id)
continue;
// skip enemy faction graveyard at same map (normal area, city, or battleground)
// team == 0 case can be at call from .neargrave
if(data.team != 0 && team != 0 && data.team != team)
continue;
found = true;
break;
}
// no match, return
if(!found)
return;
// remove from links
mGraveYardMap.erase(itr);
// remove link from DB
if(inDB)
{
WorldDatabase.PExecute("DELETE FROM game_graveyard_zone WHERE id = '%u' AND ghost_zone = '%u' AND faction = '%u'",id,zoneId,team);
}
return;
}
void ObjectMgr::LoadAreaTriggerTeleports()
{
mAreaTriggers.clear(); // need for reload case
@@ -6146,16 +6197,16 @@ void ObjectMgr::LoadGameObjectForQuests()
sLog.outString( ">> Loaded %u GameObject for quests", count );
}
bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value)
bool ObjectMgr::LoadTrinityStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value)
{
// cleanup affected map part for reloading case
for(MangosStringLocaleMap::iterator itr = mMangosStringLocaleMap.begin(); itr != mMangosStringLocaleMap.end();)
for(TrinityStringLocaleMap::iterator itr = mTrinityStringLocaleMap.begin(); itr != mTrinityStringLocaleMap.end();)
{
if(itr->first >= min_value && itr->first <= max_value)
{
MangosStringLocaleMap::iterator itr2 = itr;
TrinityStringLocaleMap::iterator itr2 = itr;
++itr;
mMangosStringLocaleMap.erase(itr2);
mTrinityStringLocaleMap.erase(itr2);
}
else
++itr;
@@ -6171,7 +6222,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
sLog.outString("");
if(min_value > 0) // error only in case internal strings
sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Cannot continue.",table);
sLog.outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.",table);
else
sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.",table);
return false;
@@ -6201,7 +6252,7 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
continue;
}
MangosStringLocale& data = mMangosStringLocaleMap[entry];
TrinityStringLocale& data = mTrinityStringLocaleMap[entry];
if(data.Content.size() > 0)
{
@@ -6236,19 +6287,19 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
delete result;
sLog.outString();
if(min_value > 0) // internal mangos strings
sLog.outString( ">> Loaded %u MaNGOS strings from table %s", count,table);
if(min_value > 0) // internal Trinity strings
sLog.outString( ">> Loaded %u Trinity strings from table %s", count,table);
else
sLog.outString( ">> Loaded %u string templates from %s", count,table);
return true;
}
const char *ObjectMgr::GetMangosString(int32 entry, int locale_idx) const
const char *ObjectMgr::GetTrinityString(int32 entry, int locale_idx) const
{
// locale_idx==-1 -> default, locale_idx >= 0 in to idx+1
// Content[0] always exist if exist MangosStringLocale
if(MangosStringLocale const *msl = GetMangosStringLocale(entry))
// Content[0] always exist if exist TrinityStringLocale
if(TrinityStringLocale const *msl = GetTrinityStringLocale(entry))
{
if(msl->Content.size() > locale_idx+1 && !msl->Content[locale_idx+1].empty())
return msl->Content[locale_idx+1].c_str();
@@ -6257,9 +6308,9 @@ const char *ObjectMgr::GetMangosString(int32 entry, int locale_idx) const
}
if(entry > 0)
sLog.outErrorDb("Entry %i not found in `mangos_string` table.",entry);
sLog.outErrorDb("Entry %i not found in `trinity_string` table.",entry);
else
sLog.outErrorDb("Mangos string entry %i not found in DB.",entry);
sLog.outErrorDb("Trinity string entry %i not found in DB.",entry);
return "<error>";
}
@@ -6868,15 +6919,15 @@ void ObjectMgr::LoadNpcTextId()
sLog.outString( ">> Loaded %d NpcTextId ", count );
}
void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost )
void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb)
{
VendorItemData& vList = m_mCacheVendorItemMap[entry];
vList.AddItem(item,maxcount,incrtime,extendedcost);
WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost);
if(savetodb) WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",entry, item, maxcount,incrtime,extendedcost);
}
bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item )
bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item, bool savetodb)
{
CacheVendorItemMap::iterator iter = m_mCacheVendorItemMap.find(entry);
if(iter == m_mCacheVendorItemMap.end())
@@ -6886,11 +6937,11 @@ bool ObjectMgr::RemoveVendorItem( uint32 entry,uint32 item )
return false;
iter->second.RemoveItem(item);
WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item);
if(savetodb) WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item);
return true;
}
bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors ) const
bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag ) const
{
CreatureInfo const* cInfo = GetCreatureTemplate(vendor_entry);
if(!cInfo)
@@ -6898,18 +6949,18 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m
if(pl)
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
sLog.outErrorDb("Table `npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
sLog.outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
return false;
}
if(!(cInfo->npcflag & UNIT_NPC_FLAG_VENDOR))
if(!((cInfo->npcflag | ORnpcflag) & UNIT_NPC_FLAG_VENDOR))
{
if(!skip_vendors || skip_vendors->count(vendor_entry)==0)
{
if(pl)
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
else
sLog.outErrorDb("Table `npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
sLog.outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
if(skip_vendors)
skip_vendors->insert(vendor_entry);
@@ -6922,7 +6973,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m
if(pl)
ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
else
sLog.outErrorDb("Table `npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id);
sLog.outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore",vendor_entry,item_id);
return false;
}
@@ -6931,7 +6982,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m
if(pl)
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST,ExtendedCost);
else
sLog.outErrorDb("Table `npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry);
sLog.outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore",item_id,ExtendedCost,vendor_entry);
return false;
}
@@ -6940,7 +6991,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m
if(pl)
ChatHandler(pl).PSendSysMessage("MaxCount!=0 (%u) but IncrTime==0", maxcount);
else
sLog.outErrorDb( "Table `npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
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);
return false;
}
else if(maxcount==0 && incrtime > 0)
@@ -6948,7 +6999,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m
if(pl)
ChatHandler(pl).PSendSysMessage("MaxCount==0 but IncrTime<>=0");
else
sLog.outErrorDb( "Table `npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
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);
return false;
}
@@ -6961,7 +7012,7 @@ bool ObjectMgr::IsVendorItemValid( uint32 vendor_entry, uint32 item_id, uint32 m
if(pl)
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST,item_id);
else
sLog.outErrorDb( "Table `npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry);
sLog.outErrorDb( "Table `(game_event_)npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry);
return false;
}
@@ -6983,7 +7034,7 @@ const char* GetAreaTriggerScriptNameById(uint32 id)
return objmgr.GetAreaTriggerScriptName(id);
}
bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value, int32 end_value)
bool LoadTrinityStrings(DatabaseType& db, char const* table,int32 start_value, int32 end_value)
{
if(start_value >= 0 || start_value <= end_value) // start/end reversed for negative values
{
@@ -6993,5 +7044,5 @@ bool LoadMangosStrings(DatabaseType& db, char const* table,int32 start_value, in
}
// for scripting localized strings allowed use _only_ negative entries
return objmgr.LoadMangosStrings(db,table,end_value,start_value);
return objmgr.LoadTrinityStrings(db,table,end_value,start_value);
}