Index: /trunk/src/game/Creature.h
===================================================================
--- /trunk/src/game/Creature.h (revision 135)
+++ /trunk/src/game/Creature.h (revision 168)
@@ -113,5 +113,8 @@
     uint32 Icon;
     uint32 Action;
-    std::string Option;
+    uint32 BoxMoney;
+    bool Coded;
+    std::string OptionText;
+    std::string BoxText;
 };
 
@@ -167,7 +170,7 @@
     uint32  baseattacktime;
     uint32  rangeattacktime;
-    uint32  Flags;
+    uint32  unit_flags;                                     // enum UnitFlags mask values
     uint32  dynamicflags;
-    uint32  family;
+    uint32  family;                                         // enum CreatureFamily values for type==CREATURE_TYPE_BEAST, or 0 in another cases
     uint32  trainer_type;
     uint32  trainer_spell;
@@ -177,6 +180,6 @@
     float   maxrangedmg;
     uint32  rangedattackpower;
-    uint32  type;
-    uint32  flag1;
+    uint32  type;                                           // enum CreatureType values
+    uint32  type_flags;                                     // enum CreatureTypeFlags mask values
     uint32  lootid;
     uint32  pickpocketLootId;
@@ -206,4 +209,19 @@
     uint32 GetRandomValidModelId() const;
     uint32 GetFirstValidModelId() const;
+    
+    SkillType GetRequiredLootSkill() const
+    {
+        if(type_flags & CREATURE_TYPEFLAGS_HERBLOOT)
+            return SKILL_HERBALISM;
+        else if(type_flags & CREATURE_TYPEFLAGS_MININGLOOT)
+            return SKILL_MINING;
+        else
+            return SKILL_SKINNING;                          // normal case
+    }
+    
+    bool isTameable() const
+    {
+        return type == CREATURE_TYPE_BEAST && family != 0 && (type_flags & CREATURE_TYPEFLAGS_TAMEBLE);
+    }
 };
 
@@ -212,4 +230,10 @@
     std::vector<std::string> Name;
     std::vector<std::string> SubName;
+};
+
+struct NpcOptionLocale
+{
+    std::vector<std::string> OptionText;
+    std::vector<std::string> BoxText;
 };
 
@@ -474,6 +498,6 @@
         char const* GetScriptName() const;
 
-        void prepareGossipMenu( Player *pPlayer,uint32 gossipid );
-        void sendPreparedGossip( Player* player);
+        void prepareGossipMenu( Player *pPlayer, uint32 gossipid = 0 );
+        void sendPreparedGossip( Player* player );
         void OnGossipSelect(Player* player, uint32 option);
         void OnPoiSelect(Player* player, GossipOption const *gossip);
Index: /trunk/src/game/SpellEffects.cpp
===================================================================
--- /trunk/src/game/SpellEffects.cpp (revision 162)
+++ /trunk/src/game/SpellEffects.cpp (revision 168)
@@ -5556,11 +5556,5 @@
     int32 targetLevel = creature->getLevel();
 
-    uint32 skill;
-    if(creature->GetCreatureInfo()->flag1 & 256)
-        skill = SKILL_HERBALISM;                            // special case
-    else if(creature->GetCreatureInfo()->flag1 & 512)
-        skill = SKILL_MINING;                               // special case
-    else
-        skill = SKILL_SKINNING;                             // normal case
+    uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill(); 
 
     ((Player*)m_caster)->SendLoot(creature->GetGUID(),LOOT_SKINNING);
Index: /trunk/src/game/Chat.h
===================================================================
--- /trunk/src/game/Chat.h (revision 163)
+++ /trunk/src/game/Chat.h (revision 168)
@@ -192,4 +192,5 @@
         bool HandleReloadTrinityStringCommand(const char* args);
         bool HandleReloadNpcGossipCommand(const char* args);
+        bool HandleReloadNpcOptionCommand(const char* args);
         bool HandleReloadNpcTrainerCommand(const char* args);
         bool HandleReloadNpcVendorCommand(const char* args);
Index: /trunk/src/game/OutdoorPvPZM.cpp
===================================================================
--- /trunk/src/game/OutdoorPvPZM.cpp (revision 102)
+++ /trunk/src/game/OutdoorPvPZM.cpp (revision 168)
@@ -401,10 +401,10 @@
         if(itr->second == ZM_ALLIANCE_FIELD_SCOUT && plr->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A)
         {
-            gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_ALLIANCE));
+            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_ALLIANCE));
             return true;
         }
         else if(itr->second == ZM_HORDE_FIELD_SCOUT && plr->GetTeam() == HORDE && m_BothControllingFaction == HORDE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_H)
         {
-            gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_HORDE));
+            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_HORDE));
             return true;
         }
Index: /trunk/src/game/QueryHandler.cpp
===================================================================
--- /trunk/src/game/QueryHandler.cpp (revision 123)
+++ /trunk/src/game/QueryHandler.cpp (revision 168)
@@ -182,5 +182,5 @@
         data << SubName;
         data << ci->IconName;                               // "Directions" for guard, string for Icons 2.3.0
-        data << (uint32)ci->flag1;                          // flags          wdbFeild7=wad flags1
+        data << (uint32)ci->type_flags;                          // flags          wdbFeild7=wad flags1
         data << (uint32)ci->type;
         data << (uint32)ci->family;                         // family         wdbFeild9
Index: /trunk/src/game/Chat.cpp
===================================================================
--- /trunk/src/game/Chat.cpp (revision 164)
+++ /trunk/src/game/Chat.cpp (revision 168)
@@ -232,4 +232,5 @@
 		{ "trinity_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadTrinityStringCommand, "", NULL },
 		{ "npc_gossip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL },
+        { "npc_option",                  SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadNpcOptionCommand,               "", NULL },
 		{ "npc_trainer", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcTrainerCommand, "", NULL },
 		{ "npc_vendor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL },
Index: /trunk/src/game/OutdoorPvPEP.cpp
===================================================================
--- /trunk/src/game/OutdoorPvPEP.cpp (revision 102)
+++ /trunk/src/game/OutdoorPvPEP.cpp (revision 168)
@@ -704,5 +704,5 @@
             gso.Action = GOSSIP_OPTION_OUTDOORPVP;
             gso.GossipId = 0;
-            gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_NPT));
+            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_NPT));
             gso.Id = 50;
             gso.Icon = 0;
@@ -712,5 +712,5 @@
             gso.Action = GOSSIP_OPTION_OUTDOORPVP;
             gso.GossipId = 0;
-            gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_EWT));
+            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_EWT));
             gso.Id = 50;
             gso.Icon = 0;
@@ -720,5 +720,5 @@
             gso.Action = GOSSIP_OPTION_OUTDOORPVP;
             gso.GossipId = 0;
-            gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_CGT));
+            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_CGT));
             gso.Id = 50;
             gso.Icon = 0;
Index: /trunk/src/game/ObjectMgr.h
===================================================================
--- /trunk/src/game/ObjectMgr.h (revision 149)
+++ /trunk/src/game/ObjectMgr.h (revision 168)
@@ -76,4 +76,5 @@
 
 typedef HM_NAMESPACE::hash_map<uint32, GameTele > GameTeleMap;
+typedef std::list<GossipOption> CacheNpcOptionList;
 
 struct ScriptInfo
@@ -142,4 +143,5 @@
 typedef HM_NAMESPACE::hash_map<uint32,PageTextLocale> PageTextLocaleMap;
 typedef HM_NAMESPACE::hash_map<uint32,TrinityStringLocale> TrinityStringLocaleMap;
+typedef HM_NAMESPACE::hash_map<uint32,NpcOptionLocale> NpcOptionLocaleMap;
 
 typedef std::multimap<uint32,uint32> QuestRelations;
@@ -538,4 +540,5 @@
         void LoadNpcTextLocales();
         void LoadPageTextLocales();
+        void LoadNpcOptionLocales();
         void LoadInstanceTemplate();
 
@@ -568,4 +571,5 @@
         void LoadGameTele();
 
+        void LoadNpcOptions();
         void LoadNpcTextId();
         void LoadVendors();
@@ -665,4 +669,11 @@
             return &itr->second;
         }
+        
+        NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const
+        {
+            NpcOptionLocaleMap::const_iterator itr = mNpcOptionLocaleMap.find(entry);
+            if(itr==mNpcOptionLocaleMap.end()) return NULL;
+            return &itr->second;
+        }
 
         GameObjectData const* GetGOData(uint32 guid) const
@@ -743,4 +754,6 @@
         bool AddGameTele(GameTele& data);
         bool DeleteGameTele(std::string name);
+        
+        CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; }
 
         uint32 GetNpcGossip(uint32 entry) const
@@ -875,4 +888,5 @@
         PageTextLocaleMap mPageTextLocaleMap;
         TrinityStringLocaleMap mTrinityStringLocaleMap;
+        NpcOptionLocaleMap mNpcOptionLocaleMap;
         RespawnTimes mCreatureRespawnTimes;
         RespawnTimes mGORespawnTimes;
@@ -885,4 +899,5 @@
         ConditionStore mConditions;
 
+        CacheNpcOptionList m_mCacheNpcOptionList;
         CacheNpcTextIdMap m_mCacheNpcTextIdMap;
         CacheVendorItemMap m_mCacheVendorItemMap;
Index: /trunk/src/game/World.cpp
===================================================================
--- /trunk/src/game/World.cpp (revision 149)
+++ /trunk/src/game/World.cpp (revision 168)
@@ -983,4 +983,5 @@
     objmgr.LoadNpcTextLocales();
     objmgr.LoadPageTextLocales();
+    objmgr.LoadNpcOptionLocales();
     objmgr.SetDBCLocaleIndex(GetDefaultDbcLocale());        // Get once for all the locale index of DBC language (console/broadcasts)
 
@@ -1161,4 +1162,7 @@
     sLog.outString( "Loading Npc Text Id..." );
     objmgr.LoadNpcTextId();                                 // must be after load Creature and NpcText
+    
+    sLog.outString( "Loading Npc Options..." );
+    objmgr.LoadNpcOptions();
 
     sLog.outString( "Loading vendors..." );
@@ -2473,5 +2477,8 @@
     ///- Delete kicked sessions at add new session
     for (std::set<WorldSession*>::iterator itr = m_kicked_sessions.begin(); itr != m_kicked_sessions.end(); ++itr)
+    {   
+        RemoveQueuedPlayer (*itr);
         delete *itr;
+    }
     m_kicked_sessions.clear();
 
Index: /trunk/src/game/Level2.cpp
===================================================================
--- /trunk/src/game/Level2.cpp (revision 163)
+++ /trunk/src/game/Level2.cpp (revision 168)
@@ -1797,5 +1797,6 @@
     {
         accId = objmgr.GetPlayerAccountIdByGUID(targetGUID);
-        Player plr(m_session);                              // use current session for temporary load
+        WorldSession session(0,NULL,SEC_PLAYER,0,0,LOCALE_enUS);
+        Player plr(&session);                               // use fake session for temporary load
         plr.MinimalLoadFromDB(NULL, targetGUID);
         money = plr.GetMoney();
@@ -4133,4 +4134,11 @@
 	Player *player = m_session->GetPlayer();
 	Creature *creatureTarget = getSelectedCreature();
+    
+	if(!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
+	{
+		PSendSysMessage(LANG_SELECT_CREATURE);
+		SetSentErrorMessage(true);
+		return false;
+	}
 
 	CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creatureTarget->GetEntry());
@@ -4149,11 +4157,4 @@
 		return false;
 	}
-	
-	if(!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER)
-	{
-		PSendSysMessage(LANG_SELECT_CREATURE);
-		SetSentErrorMessage(true);
-		return false;
-	}
 
 	// Everything looks OK, create new pet
Index: /trunk/src/game/CharacterHandler.cpp
===================================================================
--- /trunk/src/game/CharacterHandler.cpp (revision 149)
+++ /trunk/src/game/CharacterHandler.cpp (revision 168)
@@ -131,7 +131,8 @@
         do
         {
-            sLog.outDetail("Loading char guid %u from account %u.",(*result)[0].GetUInt32(),GetAccountId());
-
-            if(plr->MinimalLoadFromDB( result, (*result)[0].GetUInt32() ))
+            uint32 guidlow = (*result)[0].GetUInt32();
+            sLog.outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId());
+
+            if(plr->MinimalLoadFromDB( result, guidlow ))
             {
                 plr->BuildEnumData( result, &data );
@@ -156,16 +157,16 @@
          !sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) ?
     //   ------- Query Without Declined Names --------
-    //          0                1                2                      3                      4                      5               6                     7                     8
-        "SELECT characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, characters.at_login, "
-    //   9                    10                     11
-        "character_pet.entry, character_pet.modelid, character_pet.level "
+    //          0                1                2                3                      4                      5               6                     7                     8
+        "SELECT characters.guid, characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, "
+    //   9                    10                   11                     12
+        "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level "
         "FROM characters LEFT JOIN character_pet ON characters.guid=character_pet.owner AND character_pet.slot='0' "
         "WHERE characters.account = '%u' ORDER BY characters.guid"
         :
     //   --------- Query With Declined Names ---------
-    //          0                1                2                      3                      4                      5               6                     7                     8
-        "SELECT characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, characters.at_login, "
-    //   9                    10                     11                   12
-        "character_pet.entry, character_pet.modelid, character_pet.level, genitive "
+    //          0                1                2                3                      4                      5               6                     7                     8
+        "SELECT characters.guid, characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, "
+    //   9                    10                   11                     12                   13
+        "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, genitive "
         "FROM characters LEFT JOIN character_pet ON characters.guid = character_pet.owner AND character_pet.slot='0' "
         "LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid "
Index: /trunk/src/game/WorldSession.cpp
===================================================================
--- /trunk/src/game/WorldSession.cpp (revision 149)
+++ /trunk/src/game/WorldSession.cpp (revision 168)
@@ -80,5 +80,4 @@
     }
     
-    sWorld.RemoveQueuedPlayer(this);
 }
 
Index: /trunk/src/game/Player.cpp
===================================================================
--- /trunk/src/game/Player.cpp (revision 149)
+++ /trunk/src/game/Player.cpp (revision 168)
@@ -1353,5 +1353,5 @@
     // always send the flag if declined names aren't used
     // to let the client select a default method of declining the name
-    if(!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) || (result && result->Fetch()[12].GetCppString() != ""))
+    if(!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) || (result && result->Fetch()[13].GetCppString() != ""))
         char_flags |= CHARACTER_FLAG_DECLINED;
 
@@ -1371,10 +1371,10 @@
             Field* fields = result->Fetch();
 
-            uint32 entry = fields[9].GetUInt32();
+            uint32 entry = fields[10].GetUInt32();
             CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(entry);
             if(cInfo)
             {
-                petDisplayId = fields[10].GetUInt32();
-                petLevel     = fields[11].GetUInt32();
+                petDisplayId = fields[11].GetUInt32();
+                petLevel     = fields[12].GetUInt32();
                 petFamily    = cInfo->family;
             }
@@ -13496,6 +13496,6 @@
     if(!result)
     {
-        //                                        0     1     2           3           4           5    6          7          8
-        result = CharacterDatabase.PQuery("SELECT data, name, position_x, position_y, position_z, map, totaltime, leveltime, at_login FROM characters WHERE guid = '%u'",guid);
+        //                                        0     1     2     3           4           5           6    7          8          9
+        result = CharacterDatabase.PQuery("SELECT guid, data, name, position_x, position_y, position_z, map, totaltime, leveltime, at_login FROM characters WHERE guid = '%u'",guid);
         if(!result) return false;
     }
@@ -13504,5 +13504,5 @@
     Field *fields = result->Fetch();
 
-    if(!LoadValues( fields[0].GetString()))
+    if(!LoadValues( fields[1].GetString()))
     {
         sLog.outError("ERROR: Player #%d have broken data in `data` field. Can't be loaded.",GUID_LOPART(guid));
@@ -13514,14 +13514,14 @@
     SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
 
-    m_name = fields[1].GetCppString();
-
-    Relocate(fields[2].GetFloat(),fields[3].GetFloat(),fields[4].GetFloat());
-    SetMapId(fields[5].GetUInt32());
+    m_name = fields[2].GetCppString();
+
+    Relocate(fields[3].GetFloat(),fields[4].GetFloat(),fields[5].GetFloat());
+    SetMapId(fields[6].GetUInt32());
     // the instance id is not needed at character enum
 
-    m_Played_time[0] = fields[6].GetUInt32();
-    m_Played_time[1] = fields[7].GetUInt32();
-
-    m_atLoginFlags = fields[8].GetUInt32();
+    m_Played_time[0] = fields[7].GetUInt32();
+    m_Played_time[1] = fields[8].GetUInt32();
+
+    m_atLoginFlags = fields[9].GetUInt32();
 
     // I don't see these used anywhere ..
Index: /trunk/src/game/NPCHandler.cpp
===================================================================
--- /trunk/src/game/NPCHandler.cpp (revision 102)
+++ /trunk/src/game/NPCHandler.cpp (revision 168)
@@ -298,6 +298,6 @@
     {
         _player->TalkedToCreature(unit->GetEntry(),unit->GetGUID());
-        unit->prepareGossipMenu(_player,0);
-        unit->sendPreparedGossip( _player );
+        unit->prepareGossipMenu(_player);
+        unit->sendPreparedGossip(_player);
     }
 }
@@ -339,11 +339,13 @@
     {
 
-        if(!Script->GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str()) )
-            unit->OnGossipSelect( _player, option );
+        if (!Script->GossipSelectWithCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str()))
+            unit->OnGossipSelect (_player, option);
     }
     else
 
-    if(!Script->GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option )) )
-        unit->OnGossipSelect( _player, option );
+    {
+        if (!Script->GossipSelect (_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction (option)))
+            unit->OnGossipSelect (_player, option);
+    }
 }
 
Index: /trunk/src/game/Spell.cpp
===================================================================
--- /trunk/src/game/Spell.cpp (revision 157)
+++ /trunk/src/game/Spell.cpp (revision 168)
@@ -3670,11 +3670,5 @@
                 }
 
-                uint32 skill;
-                if(creature->GetCreatureInfo()->flag1 & 256)
-                    skill = SKILL_HERBALISM;                // special case
-                else if(creature->GetCreatureInfo()->flag1 & 512)
-                    skill = SKILL_MINING;                   // special case
-                else
-                    skill = SKILL_SKINNING;                 // normal case
+                uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();
 
                 int32 skillValue = ((Player*)m_caster)->GetSkillValue(skill);
@@ -3968,10 +3962,6 @@
                         return SPELL_FAILED_HIGHLEVEL;
 
-                    CreatureInfo const *cinfo = ((Creature*)m_targets.getUnitTarget())->GetCreatureInfo();
-                    if( cinfo->type != CREATURE_TYPE_BEAST )
-                        return SPELL_FAILED_BAD_TARGETS;
-
                     // use SMSG_PET_TAME_FAILURE?
-                    if( !(cinfo->flag1 & 1) || !(cinfo->family) )
+                    if (!((Creature*)m_targets.getUnitTarget())->GetCreatureInfo()->isTameable ())
                         return SPELL_FAILED_BAD_TARGETS;
 
Index: /trunk/src/game/QuestHandler.cpp
===================================================================
--- /trunk/src/game/QuestHandler.cpp (revision 102)
+++ /trunk/src/game/QuestHandler.cpp (revision 168)
@@ -106,6 +106,6 @@
         return;
 
-    pCreature->prepareGossipMenu(_player,0);
-    pCreature->sendPreparedGossip( _player );
+    pCreature->prepareGossipMenu(_player);
+    pCreature->sendPreparedGossip(_player);
 }
 
Index: /trunk/src/game/SharedDefines.h
===================================================================
--- /trunk/src/game/SharedDefines.h (revision 139)
+++ /trunk/src/game/SharedDefines.h (revision 168)
@@ -1601,4 +1601,11 @@
 };
 
+enum CreatureTypeFlags
+{
+    CREATURE_TYPEFLAGS_TAMEBLE    = 0x0001,
+    CREATURE_TYPEFLAGS_HERBLOOT   = 0x0100,
+    CREATURE_TYPEFLAGS_MININGLOOT = 0x0200,
+};
+
 enum CreatureEliteType
 {
Index: /trunk/src/game/Creature.cpp
===================================================================
--- /trunk/src/game/Creature.cpp (revision 161)
+++ /trunk/src/game/Creature.cpp (revision 168)
@@ -288,5 +288,5 @@
     SetAttackTime(RANGED_ATTACK,GetCreatureInfo()->rangeattacktime);
 
-    SetUInt32Value(UNIT_FIELD_FLAGS,GetCreatureInfo()->Flags);
+    SetUInt32Value(UNIT_FIELD_FLAGS,GetCreatureInfo()->unit_flags);
     SetUInt32Value(UNIT_DYNAMIC_FLAGS,GetCreatureInfo()->dynamicflags);
 
@@ -698,10 +698,7 @@
     LoadGossipOptions();
 
-    GossipOption* gso;
-    GossipOption* ingso;
-
     for( GossipOptionList::iterator i = m_goptions.begin( ); i != m_goptions.end( ); i++ )
     {
-        gso=&*i;
+        GossipOption* gso=&*i;
         if(gso->GossipId == gossipid)
         {
@@ -775,13 +772,27 @@
                         break;
                     default:
-                        sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetGUIDLow(),GetEntry(),gso->Action);
+                        sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetDBTableGUIDLow(),GetEntry(),gso->Action);
                         break;
                 }
             }
 
-            if(!gso->Option.empty() && cantalking )
-            {                                               //note for future dev: should have database fields for BoxMessage & BoxMoney
-                pm->GetGossipMenu().AddMenuItem((uint8)gso->Icon,gso->Option, gossipid,gso->Action,"",0,false);
-                ingso=gso;
+            //note for future dev: should have database fields for BoxMessage & BoxMoney
+            if(!gso->OptionText.empty() && cantalking)
+            {
+                std::string OptionText = gso->OptionText;
+                std::string BoxText = gso->BoxText;
+                int loc_idx = pPlayer->GetSession()->GetSessionDbLocaleIndex();
+                if (loc_idx >= 0)
+                {
+                    NpcOptionLocale const *no = objmgr.GetNpcOptionLocale(gso->Id);
+                    if (no)
+                    {
+                        if (no->OptionText.size() > loc_idx && !no->OptionText[loc_idx].empty())
+                            OptionText=no->OptionText[loc_idx];
+                        if (no->BoxText.size() > loc_idx && !no->BoxText[loc_idx].empty())
+                            BoxText=no->BoxText[loc_idx];
+                    }
+                }
+                pm->GetGossipMenu().AddMenuItem((uint8)gso->Icon,OptionText, gossipid,gso->Action,BoxText,gso->BoxMoney,gso->Coded);
             }
         }
@@ -836,5 +847,4 @@
 
     GossipOption const *gossip=GetGossipOption( action );
-    uint32 textid;
     if(!gossip)
     {
@@ -844,5 +854,5 @@
             return;
     }
-    textid=GetGossipTextId( action, zoneid);
+    uint32 textid=GetGossipTextId( action, zoneid);
     if(textid==0)
         textid=GetNpcTextId();
@@ -936,5 +946,5 @@
         uint16 areaflag=map->GetAreaFlag(GetPositionX(),GetPositionY());
         uint32 zoneid=Map::GetZoneId(areaflag,mapid);
-        std::string areaname= gossip->Option;
+        std::string areaname= gossip->OptionText;
         /*
         uint16 pflag;
@@ -1041,22 +1051,8 @@
     uint32 npcflags=GetUInt32Value(UNIT_NPC_FLAGS);
 
-    QueryResult *result = WorldDatabase.PQuery( "SELECT id,gossip_id,npcflag,icon,action,option_text FROM npc_option WHERE (npcflag & %u)<>0", npcflags );
-
-    if(!result)
-        return;
-
-    GossipOption go;
-    do
-    {
-        Field *fields = result->Fetch();
-        go.Id= fields[0].GetUInt32();
-        go.GossipId = fields[1].GetUInt32();
-        go.NpcFlag=fields[2].GetUInt32();
-        go.Icon=fields[3].GetUInt32();
-        go.Action=fields[4].GetUInt32();
-        go.Option=fields[5].GetCppString();
-        addGossipOption(go);
-    }while( result->NextRow() );
-    delete result;
+    CacheNpcOptionList const& noList = objmgr.GetNpcOptions ();
+    for (CacheNpcOptionList::const_iterator i = noList.begin (); i != noList.end (); ++i)
+        if(i->NpcFlag & npcflags)
+            addGossipOption(*i);
 
     m_gossipOptionLoaded = true;
Index: /trunk/src/game/ObjectMgr.cpp
===================================================================
--- /trunk/src/game/ObjectMgr.cpp (revision 149)
+++ /trunk/src/game/ObjectMgr.cpp (revision 168)
@@ -623,4 +623,72 @@
     sLog.outString();
     sLog.outString( ">> Loaded %u creature locale strings", mCreatureLocaleMap.size() );
+}
+
+void ObjectMgr::LoadNpcOptionLocales()
+{
+    mNpcOptionLocaleMap.clear();                              // need for reload case
+
+    QueryResult *result = WorldDatabase.Query("SELECT entry,"
+        "option_text_loc1,box_text_loc1,option_text_loc2,box_text_loc2,"
+        "option_text_loc3,box_text_loc3,option_text_loc4,box_text_loc4,"
+        "option_text_loc5,box_text_loc5,option_text_loc6,box_text_loc6,"
+        "option_text_loc7,box_text_loc7,option_text_loc8,box_text_loc8 "
+        "FROM locales_npc_option");
+
+    if(!result)
+    {
+        barGoLink bar(1);
+
+        bar.step();
+
+        sLog.outString("");
+        sLog.outString(">> Loaded 0 npc_option locale strings. DB table `locales_npc_option` is empty.");
+        return;
+    }
+
+    barGoLink bar(result->GetRowCount());
+
+    do
+    {
+        Field *fields = result->Fetch();
+        bar.step();
+
+        uint32 entry = fields[0].GetUInt32();
+
+        NpcOptionLocale& data = mNpcOptionLocaleMap[entry];
+
+        for(int i = 1; i < MAX_LOCALE; ++i)
+        {
+            std::string str = fields[1+2*(i-1)].GetCppString();
+            if(!str.empty())
+            {
+                int idx = GetOrNewIndexForLocale(LocaleConstant(i));
+                if(idx >= 0)
+                {
+                    if(data.OptionText.size() <= idx)
+                        data.OptionText.resize(idx+1);
+
+                    data.OptionText[idx] = str;
+                }
+            }
+            str = fields[1+2*(i-1)+1].GetCppString();
+            if(!str.empty())
+            {
+                int idx = GetOrNewIndexForLocale(LocaleConstant(i));
+                if(idx >= 0)
+                {
+                    if(data.BoxText.size() <= idx)
+                        data.BoxText.resize(idx+1);
+
+                    data.BoxText[idx] = str;
+                }
+            }
+        }
+    } while (result->NextRow());
+
+    delete result;
+
+    sLog.outString();
+    sLog.outString( ">> Loaded %u npc_option locale strings", mNpcOptionLocaleMap.size() );
 }
 
@@ -7077,4 +7145,55 @@
 }
 
+void ObjectMgr::LoadNpcOptions()
+{
+    m_mCacheNpcOptionList.clear();                          // For reload case
+
+    QueryResult *result = WorldDatabase.Query(
+        //      0  1         2       3    4      5         6     7           8
+        "SELECT id,gossip_id,npcflag,icon,action,box_money,coded,option_text,box_text "
+        "FROM npc_option");
+    if( !result )
+    {
+        barGoLink bar( 1 );
+
+        bar.step();
+
+        sLog.outString();
+        sLog.outErrorDb(">> Loaded `npc_option`, table is empty!");
+        return;
+    }
+
+    barGoLink bar( result->GetRowCount() );
+
+    uint32 count = 0;
+
+    do
+    {
+        bar.step();
+
+        Field* fields = result->Fetch();
+
+        GossipOption go;
+        go.Id               = fields[0].GetUInt32();
+        go.GossipId         = fields[1].GetUInt32();
+        go.NpcFlag          = fields[2].GetUInt32();
+        go.Icon             = fields[3].GetUInt32();
+        go.Action           = fields[4].GetUInt32();
+        go.BoxMoney         = fields[5].GetUInt32();
+        go.Coded            = fields[6].GetUInt8()!=0;
+        go.OptionText       = fields[7].GetCppString();
+        go.BoxText          = fields[8].GetCppString();
+
+        m_mCacheNpcOptionList.push_back(go);
+
+        ++count;
+
+    } while (result->NextRow());
+    delete result;
+
+    sLog.outString();
+    sLog.outString( ">> Loaded %d npc_option entries", count );
+}
+
 void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb)
 {
Index: /trunk/src/trinitycore/trinitycore.conf.dist
===================================================================
--- /trunk/src/trinitycore/trinitycore.conf.dist (revision 78)
+++ /trunk/src/trinitycore/trinitycore.conf.dist (revision 168)
@@ -245,5 +245,5 @@
 #    WorldLogFile
 #        Packet logging file for the worldserver
-#        Default: "world.log"
+#        Default: ""
 #
 #    DBErrorLogFile
@@ -302,5 +302,5 @@
 LogFilter_CreatureMoves = 1
 LogFilter_VisibilityChanges = 1
-WorldLogFile = "world.log"
+WorldLogFile = ""
 DBErrorLogFile = "db_errors.log"
 CharLogFile = "characters.log"
Index: /trunk/sql/updates/176_world.sql
===================================================================
--- /trunk/sql/updates/176_world.sql (revision 168)
+++ /trunk/sql/updates/176_world.sql (revision 168)
@@ -0,0 +1,32 @@
+ALTER TABLE `npc_option`
+  CHANGE COLUMN `id` `id` mediumint(8) unsigned NOT NULL default '0',
+  CHANGE COLUMN `gossip_id` `gossip_id` mediumint(8) unsigned NOT NULL default '0',
+  CHANGE COLUMN `action` `action` mediumint(8) unsigned NOT NULL default '0',
+  ADD COLUMN `box_money` int(10) unsigned NOT NULL default '0' AFTER `action`,
+  ADD COLUMN `coded` tinyint(3) unsigned NOT NULL default '0' AFTER `box_money`,
+  ADD COLUMN `box_text` text AFTER `option_text`;
+
+CREATE TABLE `locales_npc_option` (
+  `entry` mediumint(8) unsigned NOT NULL default '0',
+  `option_text_loc1` text,
+  `option_text_loc2` text,
+  `option_text_loc3` text,
+  `option_text_loc4` text,
+  `option_text_loc5` text,
+  `option_text_loc6` text,
+  `option_text_loc7` text,
+  `option_text_loc8` text,
+  `box_text_loc1` text,
+  `box_text_loc2` text,
+  `box_text_loc3` text,
+  `box_text_loc4` text,
+  `box_text_loc5` text,
+  `box_text_loc6` text,
+  `box_text_loc7` text,
+  `box_text_loc8` text,
+  PRIMARY KEY  (`entry`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+ALTER TABLE `creature_template`
+  CHANGE COLUMN `flags` `unit_flags` int(10) unsigned NOT NULL default '0',
+  CHANGE COLUMN `flag1` `type_flags` int(10) unsigned NOT NULL default '0';
Index: /trunk/contrib/extractor/libmpq/common.h
===================================================================
--- /trunk/contrib/extractor/libmpq/common.h (revision 2)
+++ /trunk/contrib/extractor/libmpq/common.h (revision 168)
@@ -50,4 +50,10 @@
 #endif
 
+#ifdef O_LARGEFILE
+    #define MPQ_FILE_OPEN_FLAGS (O_RDONLY | O_BINARY | O_LARGEFILE)
+#else
+    #define MPQ_FILE_OPEN_FLAGS (O_RDONLY | O_BINARY)
+#endif
+
 #ifndef min
 	#define min(a, b) ((a < b) ? a : b)
Index: /trunk/contrib/extractor/libmpq/mpq.cpp
===================================================================
--- /trunk/contrib/extractor/libmpq/mpq.cpp (revision 149)
+++ /trunk/contrib/extractor/libmpq/mpq.cpp (revision 168)
@@ -60,5 +60,5 @@
 
 	/* Check if file exists and is readable */
-	fd = _open((char *)mpq_filename, O_RDONLY | O_BINARY | O_LARGEFILE);
+	fd = _open((char *)mpq_filename, MPQ_FILE_OPEN_FLAGS);
 	if (fd == LIBMPQ_EFILE) {
 		return LIBMPQ_EFILE;
