Changeset 168

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

[svn] *** Source Mangos ***
*Load npc_options at server startup, use cached data at creature gossip menu init.
* Also new .reload table command added
*Implement npc_option localization support, also store in DB BoxText/BoxMoney/Coded?
* Use characters.guid instead low guid value from characters.data in charcter enum data prepering for client.
* Fixed crash at .pinfo command use from console.
* Fixed windows ad.exe build
*Creature related code and DB cleanups.
* Rename 2 creature_template fields to more clean names and related code update also.
* Use enum values instead raw values for type_flags, use halper functions instead code repeating.
* Move tamed pet creating code to new function.

** Small code changes to make things compliant with above changes.
** Another rev with big changes so test away.

Original author: KingPin?
Date: 2008-11-05 09:22:56-06:00

Location:
trunk
Files:
1 added
22 modified

Legend:

Unmodified
Added
Removed
  • trunk/contrib/extractor/libmpq/common.h

    r2 r168  
    5050#endif 
    5151 
     52#ifdef O_LARGEFILE 
     53    #define MPQ_FILE_OPEN_FLAGS (O_RDONLY | O_BINARY | O_LARGEFILE) 
     54#else 
     55    #define MPQ_FILE_OPEN_FLAGS (O_RDONLY | O_BINARY) 
     56#endif 
     57 
    5258#ifndef min 
    5359        #define min(a, b) ((a < b) ? a : b) 
  • trunk/contrib/extractor/libmpq/mpq.cpp

    r149 r168  
    6060 
    6161        /* Check if file exists and is readable */ 
    62         fd = _open((char *)mpq_filename, O_RDONLY | O_BINARY | O_LARGEFILE); 
     62        fd = _open((char *)mpq_filename, MPQ_FILE_OPEN_FLAGS); 
    6363        if (fd == LIBMPQ_EFILE) { 
    6464                return LIBMPQ_EFILE; 
  • trunk/src/game/CharacterHandler.cpp

    r149 r168  
    131131        do 
    132132        { 
    133             sLog.outDetail("Loading char guid %u from account %u.",(*result)[0].GetUInt32(),GetAccountId()); 
    134  
    135             if(plr->MinimalLoadFromDB( result, (*result)[0].GetUInt32() )) 
     133            uint32 guidlow = (*result)[0].GetUInt32(); 
     134            sLog.outDetail("Loading char guid %u from account %u.",guidlow,GetAccountId()); 
     135 
     136            if(plr->MinimalLoadFromDB( result, guidlow )) 
    136137            { 
    137138                plr->BuildEnumData( result, &data ); 
     
    156157         !sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) ? 
    157158    //   ------- Query Without Declined Names -------- 
    158     //          0                1                2                      3                      4                      5               6                     7                     8 
    159         "SELECT characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, characters.at_login, " 
    160     //   9                    10                     11 
    161         "character_pet.entry, character_pet.modelid, character_pet.level " 
     159    //          0                1                2                3                      4                      5               6                     7                     8 
     160        "SELECT characters.guid, characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, " 
     161    //   9                    10                   11                     12 
     162        "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level " 
    162163        "FROM characters LEFT JOIN character_pet ON characters.guid=character_pet.owner AND character_pet.slot='0' " 
    163164        "WHERE characters.account = '%u' ORDER BY characters.guid" 
    164165        : 
    165166    //   --------- Query With Declined Names --------- 
    166     //          0                1                2                      3                      4                      5               6                     7                     8 
    167         "SELECT characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, characters.at_login, " 
    168     //   9                    10                     11                   12 
    169         "character_pet.entry, character_pet.modelid, character_pet.level, genitive " 
     167    //          0                1                2                3                      4                      5               6                     7                     8 
     168        "SELECT characters.guid, characters.data, characters.name, characters.position_x, characters.position_y, characters.position_z, characters.map, characters.totaltime, characters.leveltime, " 
     169    //   9                    10                   11                     12                   13 
     170        "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, genitive " 
    170171        "FROM characters LEFT JOIN character_pet ON characters.guid = character_pet.owner AND character_pet.slot='0' " 
    171172        "LEFT JOIN character_declinedname ON characters.guid = character_declinedname.guid " 
  • trunk/src/game/Chat.cpp

    r164 r168  
    232232                { "trinity_string", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadTrinityStringCommand, "", NULL }, 
    233233                { "npc_gossip", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcGossipCommand, "", NULL }, 
     234        { "npc_option",                  SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadNpcOptionCommand,               "", NULL }, 
    234235                { "npc_trainer", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcTrainerCommand, "", NULL }, 
    235236                { "npc_vendor", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadNpcVendorCommand, "", NULL }, 
  • trunk/src/game/Chat.h

    r163 r168  
    192192        bool HandleReloadTrinityStringCommand(const char* args); 
    193193        bool HandleReloadNpcGossipCommand(const char* args); 
     194        bool HandleReloadNpcOptionCommand(const char* args); 
    194195        bool HandleReloadNpcTrainerCommand(const char* args); 
    195196        bool HandleReloadNpcVendorCommand(const char* args); 
  • trunk/src/game/Creature.cpp

    r161 r168  
    288288    SetAttackTime(RANGED_ATTACK,GetCreatureInfo()->rangeattacktime); 
    289289 
    290     SetUInt32Value(UNIT_FIELD_FLAGS,GetCreatureInfo()->Flags); 
     290    SetUInt32Value(UNIT_FIELD_FLAGS,GetCreatureInfo()->unit_flags); 
    291291    SetUInt32Value(UNIT_DYNAMIC_FLAGS,GetCreatureInfo()->dynamicflags); 
    292292 
     
    698698    LoadGossipOptions(); 
    699699 
    700     GossipOption* gso; 
    701     GossipOption* ingso; 
    702  
    703700    for( GossipOptionList::iterator i = m_goptions.begin( ); i != m_goptions.end( ); i++ ) 
    704701    { 
    705         gso=&*i; 
     702        GossipOption* gso=&*i; 
    706703        if(gso->GossipId == gossipid) 
    707704        { 
     
    775772                        break; 
    776773                    default: 
    777                         sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetGUIDLow(),GetEntry(),gso->Action); 
     774                        sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetDBTableGUIDLow(),GetEntry(),gso->Action); 
    778775                        break; 
    779776                } 
    780777            } 
    781778 
    782             if(!gso->Option.empty() && cantalking ) 
    783             {                                               //note for future dev: should have database fields for BoxMessage & BoxMoney 
    784                 pm->GetGossipMenu().AddMenuItem((uint8)gso->Icon,gso->Option, gossipid,gso->Action,"",0,false); 
    785                 ingso=gso; 
     779            //note for future dev: should have database fields for BoxMessage & BoxMoney 
     780            if(!gso->OptionText.empty() && cantalking) 
     781            { 
     782                std::string OptionText = gso->OptionText; 
     783                std::string BoxText = gso->BoxText; 
     784                int loc_idx = pPlayer->GetSession()->GetSessionDbLocaleIndex(); 
     785                if (loc_idx >= 0) 
     786                { 
     787                    NpcOptionLocale const *no = objmgr.GetNpcOptionLocale(gso->Id); 
     788                    if (no) 
     789                    { 
     790                        if (no->OptionText.size() > loc_idx && !no->OptionText[loc_idx].empty()) 
     791                            OptionText=no->OptionText[loc_idx]; 
     792                        if (no->BoxText.size() > loc_idx && !no->BoxText[loc_idx].empty()) 
     793                            BoxText=no->BoxText[loc_idx]; 
     794                    } 
     795                } 
     796                pm->GetGossipMenu().AddMenuItem((uint8)gso->Icon,OptionText, gossipid,gso->Action,BoxText,gso->BoxMoney,gso->Coded); 
    786797            } 
    787798        } 
     
    836847 
    837848    GossipOption const *gossip=GetGossipOption( action ); 
    838     uint32 textid; 
    839849    if(!gossip) 
    840850    { 
     
    844854            return; 
    845855    } 
    846     textid=GetGossipTextId( action, zoneid); 
     856    uint32 textid=GetGossipTextId( action, zoneid); 
    847857    if(textid==0) 
    848858        textid=GetNpcTextId(); 
     
    936946        uint16 areaflag=map->GetAreaFlag(GetPositionX(),GetPositionY()); 
    937947        uint32 zoneid=Map::GetZoneId(areaflag,mapid); 
    938         std::string areaname= gossip->Option; 
     948        std::string areaname= gossip->OptionText; 
    939949        /* 
    940950        uint16 pflag; 
     
    10411051    uint32 npcflags=GetUInt32Value(UNIT_NPC_FLAGS); 
    10421052 
    1043     QueryResult *result = WorldDatabase.PQuery( "SELECT id,gossip_id,npcflag,icon,action,option_text FROM npc_option WHERE (npcflag & %u)<>0", npcflags ); 
    1044  
    1045     if(!result) 
    1046         return; 
    1047  
    1048     GossipOption go; 
    1049     do 
    1050     { 
    1051         Field *fields = result->Fetch(); 
    1052         go.Id= fields[0].GetUInt32(); 
    1053         go.GossipId = fields[1].GetUInt32(); 
    1054         go.NpcFlag=fields[2].GetUInt32(); 
    1055         go.Icon=fields[3].GetUInt32(); 
    1056         go.Action=fields[4].GetUInt32(); 
    1057         go.Option=fields[5].GetCppString(); 
    1058         addGossipOption(go); 
    1059     }while( result->NextRow() ); 
    1060     delete result; 
     1053    CacheNpcOptionList const& noList = objmgr.GetNpcOptions (); 
     1054    for (CacheNpcOptionList::const_iterator i = noList.begin (); i != noList.end (); ++i) 
     1055        if(i->NpcFlag & npcflags) 
     1056            addGossipOption(*i); 
    10611057 
    10621058    m_gossipOptionLoaded = true; 
  • trunk/src/game/Creature.h

    r135 r168  
    113113    uint32 Icon; 
    114114    uint32 Action; 
    115     std::string Option; 
     115    uint32 BoxMoney; 
     116    bool Coded; 
     117    std::string OptionText; 
     118    std::string BoxText; 
    116119}; 
    117120 
     
    167170    uint32  baseattacktime; 
    168171    uint32  rangeattacktime; 
    169     uint32  Flags; 
     172    uint32  unit_flags;                                     // enum UnitFlags mask values 
    170173    uint32  dynamicflags; 
    171     uint32  family; 
     174    uint32  family;                                         // enum CreatureFamily values for type==CREATURE_TYPE_BEAST, or 0 in another cases 
    172175    uint32  trainer_type; 
    173176    uint32  trainer_spell; 
     
    177180    float   maxrangedmg; 
    178181    uint32  rangedattackpower; 
    179     uint32  type; 
    180     uint32  flag1; 
     182    uint32  type;                                           // enum CreatureType values 
     183    uint32  type_flags;                                     // enum CreatureTypeFlags mask values 
    181184    uint32  lootid; 
    182185    uint32  pickpocketLootId; 
     
    206209    uint32 GetRandomValidModelId() const; 
    207210    uint32 GetFirstValidModelId() const; 
     211     
     212    SkillType GetRequiredLootSkill() const 
     213    { 
     214        if(type_flags & CREATURE_TYPEFLAGS_HERBLOOT) 
     215            return SKILL_HERBALISM; 
     216        else if(type_flags & CREATURE_TYPEFLAGS_MININGLOOT) 
     217            return SKILL_MINING; 
     218        else 
     219            return SKILL_SKINNING;                          // normal case 
     220    } 
     221     
     222    bool isTameable() const 
     223    { 
     224        return type == CREATURE_TYPE_BEAST && family != 0 && (type_flags & CREATURE_TYPEFLAGS_TAMEBLE); 
     225    } 
    208226}; 
    209227 
     
    212230    std::vector<std::string> Name; 
    213231    std::vector<std::string> SubName; 
     232}; 
     233 
     234struct NpcOptionLocale 
     235{ 
     236    std::vector<std::string> OptionText; 
     237    std::vector<std::string> BoxText; 
    214238}; 
    215239 
     
    474498        char const* GetScriptName() const; 
    475499 
    476         void prepareGossipMenu( Player *pPlayer,uint32 gossipid ); 
    477         void sendPreparedGossip( Player* player); 
     500        void prepareGossipMenu( Player *pPlayer, uint32 gossipid = 0 ); 
     501        void sendPreparedGossip( Player* player ); 
    478502        void OnGossipSelect(Player* player, uint32 option); 
    479503        void OnPoiSelect(Player* player, GossipOption const *gossip); 
  • trunk/src/game/Level2.cpp

    r163 r168  
    17971797    { 
    17981798        accId = objmgr.GetPlayerAccountIdByGUID(targetGUID); 
    1799         Player plr(m_session);                              // use current session for temporary load 
     1799        WorldSession session(0,NULL,SEC_PLAYER,0,0,LOCALE_enUS); 
     1800        Player plr(&session);                               // use fake session for temporary load 
    18001801        plr.MinimalLoadFromDB(NULL, targetGUID); 
    18011802        money = plr.GetMoney(); 
     
    41334134        Player *player = m_session->GetPlayer(); 
    41344135        Creature *creatureTarget = getSelectedCreature(); 
     4136     
     4137        if(!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) 
     4138        { 
     4139                PSendSysMessage(LANG_SELECT_CREATURE); 
     4140                SetSentErrorMessage(true); 
     4141                return false; 
     4142        } 
    41354143 
    41364144        CreatureInfo const* cInfo = objmgr.GetCreatureTemplate(creatureTarget->GetEntry()); 
     
    41494157                return false; 
    41504158        } 
    4151          
    4152         if(!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) 
    4153         { 
    4154                 PSendSysMessage(LANG_SELECT_CREATURE); 
    4155                 SetSentErrorMessage(true); 
    4156                 return false; 
    4157         } 
    41584159 
    41594160        // Everything looks OK, create new pet 
  • trunk/src/game/NPCHandler.cpp

    r102 r168  
    298298    { 
    299299        _player->TalkedToCreature(unit->GetEntry(),unit->GetGUID()); 
    300         unit->prepareGossipMenu(_player,0); 
    301         unit->sendPreparedGossip( _player ); 
     300        unit->prepareGossipMenu(_player); 
     301        unit->sendPreparedGossip(_player); 
    302302    } 
    303303} 
     
    339339    { 
    340340 
    341         if(!Script->GossipSelectWithCode( _player, unit, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str()) ) 
    342             unit->OnGossipSelect( _player, option ); 
     341        if (!Script->GossipSelectWithCode(_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction( option ), code.c_str())) 
     342            unit->OnGossipSelect (_player, option); 
    343343    } 
    344344    else 
    345345 
    346     if(!Script->GossipSelect( _player, unit, _player->PlayerTalkClass->GossipOptionSender( option ), _player->PlayerTalkClass->GossipOptionAction( option )) ) 
    347         unit->OnGossipSelect( _player, option ); 
     346    { 
     347        if (!Script->GossipSelect (_player, unit, _player->PlayerTalkClass->GossipOptionSender (option), _player->PlayerTalkClass->GossipOptionAction (option))) 
     348            unit->OnGossipSelect (_player, option); 
     349    } 
    348350} 
    349351 
  • trunk/src/game/ObjectMgr.cpp

    r149 r168  
    623623    sLog.outString(); 
    624624    sLog.outString( ">> Loaded %u creature locale strings", mCreatureLocaleMap.size() ); 
     625} 
     626 
     627void ObjectMgr::LoadNpcOptionLocales() 
     628{ 
     629    mNpcOptionLocaleMap.clear();                              // need for reload case 
     630 
     631    QueryResult *result = WorldDatabase.Query("SELECT entry," 
     632        "option_text_loc1,box_text_loc1,option_text_loc2,box_text_loc2," 
     633        "option_text_loc3,box_text_loc3,option_text_loc4,box_text_loc4," 
     634        "option_text_loc5,box_text_loc5,option_text_loc6,box_text_loc6," 
     635        "option_text_loc7,box_text_loc7,option_text_loc8,box_text_loc8 " 
     636        "FROM locales_npc_option"); 
     637 
     638    if(!result) 
     639    { 
     640        barGoLink bar(1); 
     641 
     642        bar.step(); 
     643 
     644        sLog.outString(""); 
     645        sLog.outString(">> Loaded 0 npc_option locale strings. DB table `locales_npc_option` is empty."); 
     646        return; 
     647    } 
     648 
     649    barGoLink bar(result->GetRowCount()); 
     650 
     651    do 
     652    { 
     653        Field *fields = result->Fetch(); 
     654        bar.step(); 
     655 
     656        uint32 entry = fields[0].GetUInt32(); 
     657 
     658        NpcOptionLocale& data = mNpcOptionLocaleMap[entry]; 
     659 
     660        for(int i = 1; i < MAX_LOCALE; ++i) 
     661        { 
     662            std::string str = fields[1+2*(i-1)].GetCppString(); 
     663            if(!str.empty()) 
     664            { 
     665                int idx = GetOrNewIndexForLocale(LocaleConstant(i)); 
     666                if(idx >= 0) 
     667                { 
     668                    if(data.OptionText.size() <= idx) 
     669                        data.OptionText.resize(idx+1); 
     670 
     671                    data.OptionText[idx] = str; 
     672                } 
     673            } 
     674            str = fields[1+2*(i-1)+1].GetCppString(); 
     675            if(!str.empty()) 
     676            { 
     677                int idx = GetOrNewIndexForLocale(LocaleConstant(i)); 
     678                if(idx >= 0) 
     679                { 
     680                    if(data.BoxText.size() <= idx) 
     681                        data.BoxText.resize(idx+1); 
     682 
     683                    data.BoxText[idx] = str; 
     684                } 
     685            } 
     686        } 
     687    } while (result->NextRow()); 
     688 
     689    delete result; 
     690 
     691    sLog.outString(); 
     692    sLog.outString( ">> Loaded %u npc_option locale strings", mNpcOptionLocaleMap.size() ); 
    625693} 
    626694 
     
    70777145} 
    70787146 
     7147void ObjectMgr::LoadNpcOptions() 
     7148{ 
     7149    m_mCacheNpcOptionList.clear();                          // For reload case 
     7150 
     7151    QueryResult *result = WorldDatabase.Query( 
     7152        //      0  1         2       3    4      5         6     7           8 
     7153        "SELECT id,gossip_id,npcflag,icon,action,box_money,coded,option_text,box_text " 
     7154        "FROM npc_option"); 
     7155    if( !result ) 
     7156    { 
     7157        barGoLink bar( 1 ); 
     7158 
     7159        bar.step(); 
     7160 
     7161        sLog.outString(); 
     7162        sLog.outErrorDb(">> Loaded `npc_option`, table is empty!"); 
     7163        return; 
     7164    } 
     7165 
     7166    barGoLink bar( result->GetRowCount() ); 
     7167 
     7168    uint32 count = 0; 
     7169 
     7170    do 
     7171    { 
     7172        bar.step(); 
     7173 
     7174        Field* fields = result->Fetch(); 
     7175 
     7176        GossipOption go; 
     7177        go.Id               = fields[0].GetUInt32(); 
     7178        go.GossipId         = fields[1].GetUInt32(); 
     7179        go.NpcFlag          = fields[2].GetUInt32(); 
     7180        go.Icon             = fields[3].GetUInt32(); 
     7181        go.Action           = fields[4].GetUInt32(); 
     7182        go.BoxMoney         = fields[5].GetUInt32(); 
     7183        go.Coded            = fields[6].GetUInt8()!=0; 
     7184        go.OptionText       = fields[7].GetCppString(); 
     7185        go.BoxText          = fields[8].GetCppString(); 
     7186 
     7187        m_mCacheNpcOptionList.push_back(go); 
     7188 
     7189        ++count; 
     7190 
     7191    } while (result->NextRow()); 
     7192    delete result; 
     7193 
     7194    sLog.outString(); 
     7195    sLog.outString( ">> Loaded %d npc_option entries", count ); 
     7196} 
     7197 
    70797198void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost, bool savetodb) 
    70807199{ 
  • trunk/src/game/ObjectMgr.h

    r149 r168  
    7676 
    7777typedef HM_NAMESPACE::hash_map<uint32, GameTele > GameTeleMap; 
     78typedef std::list<GossipOption> CacheNpcOptionList; 
    7879 
    7980struct ScriptInfo 
     
    142143typedef HM_NAMESPACE::hash_map<uint32,PageTextLocale> PageTextLocaleMap; 
    143144typedef HM_NAMESPACE::hash_map<uint32,TrinityStringLocale> TrinityStringLocaleMap; 
     145typedef HM_NAMESPACE::hash_map<uint32,NpcOptionLocale> NpcOptionLocaleMap; 
    144146 
    145147typedef std::multimap<uint32,uint32> QuestRelations; 
     
    538540        void LoadNpcTextLocales(); 
    539541        void LoadPageTextLocales(); 
     542        void LoadNpcOptionLocales(); 
    540543        void LoadInstanceTemplate(); 
    541544 
     
    568571        void LoadGameTele(); 
    569572 
     573        void LoadNpcOptions(); 
    570574        void LoadNpcTextId(); 
    571575        void LoadVendors(); 
     
    665669            return &itr->second; 
    666670        } 
     671         
     672        NpcOptionLocale const* GetNpcOptionLocale(uint32 entry) const 
     673        { 
     674            NpcOptionLocaleMap::const_iterator itr = mNpcOptionLocaleMap.find(entry); 
     675            if(itr==mNpcOptionLocaleMap.end()) return NULL; 
     676            return &itr->second; 
     677        } 
    667678 
    668679        GameObjectData const* GetGOData(uint32 guid) const 
     
    743754        bool AddGameTele(GameTele& data); 
    744755        bool DeleteGameTele(std::string name); 
     756         
     757        CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } 
    745758 
    746759        uint32 GetNpcGossip(uint32 entry) const 
     
    875888        PageTextLocaleMap mPageTextLocaleMap; 
    876889        TrinityStringLocaleMap mTrinityStringLocaleMap; 
     890        NpcOptionLocaleMap mNpcOptionLocaleMap; 
    877891        RespawnTimes mCreatureRespawnTimes; 
    878892        RespawnTimes mGORespawnTimes; 
     
    885899        ConditionStore mConditions; 
    886900 
     901        CacheNpcOptionList m_mCacheNpcOptionList; 
    887902        CacheNpcTextIdMap m_mCacheNpcTextIdMap; 
    888903        CacheVendorItemMap m_mCacheVendorItemMap; 
  • trunk/src/game/OutdoorPvPEP.cpp

    r102 r168  
    704704            gso.Action = GOSSIP_OPTION_OUTDOORPVP; 
    705705            gso.GossipId = 0; 
    706             gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_NPT)); 
     706            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_NPT)); 
    707707            gso.Id = 50; 
    708708            gso.Icon = 0; 
     
    712712            gso.Action = GOSSIP_OPTION_OUTDOORPVP; 
    713713            gso.GossipId = 0; 
    714             gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_EWT)); 
     714            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_EWT)); 
    715715            gso.Id = 50; 
    716716            gso.Icon = 0; 
     
    720720            gso.Action = GOSSIP_OPTION_OUTDOORPVP; 
    721721            gso.GossipId = 0; 
    722             gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_CGT)); 
     722            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_EP_FLIGHT_CGT)); 
    723723            gso.Id = 50; 
    724724            gso.Icon = 0; 
  • trunk/src/game/OutdoorPvPZM.cpp

    r102 r168  
    401401        if(itr->second == ZM_ALLIANCE_FIELD_SCOUT && plr->GetTeam() == ALLIANCE && m_BothControllingFaction == ALLIANCE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_A) 
    402402        { 
    403             gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_ALLIANCE)); 
     403            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_ALLIANCE)); 
    404404            return true; 
    405405        } 
    406406        else if(itr->second == ZM_HORDE_FIELD_SCOUT && plr->GetTeam() == HORDE && m_BothControllingFaction == HORDE && !m_FlagCarrierGUID && m_GraveYardState != ZM_GRAVEYARD_H) 
    407407        { 
    408             gso.Option.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_HORDE)); 
     408            gso.OptionText.assign(objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_ZM_GOSSIP_HORDE)); 
    409409            return true; 
    410410        } 
  • trunk/src/game/Player.cpp

    r149 r168  
    13531353    // always send the flag if declined names aren't used 
    13541354    // to let the client select a default method of declining the name 
    1355     if(!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) || (result && result->Fetch()[12].GetCppString() != "")) 
     1355    if(!sWorld.getConfig(CONFIG_DECLINED_NAMES_USED) || (result && result->Fetch()[13].GetCppString() != "")) 
    13561356        char_flags |= CHARACTER_FLAG_DECLINED; 
    13571357 
     
    13711371            Field* fields = result->Fetch(); 
    13721372 
    1373             uint32 entry = fields[9].GetUInt32(); 
     1373            uint32 entry = fields[10].GetUInt32(); 
    13741374            CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(entry); 
    13751375            if(cInfo) 
    13761376            { 
    1377                 petDisplayId = fields[10].GetUInt32(); 
    1378                 petLevel     = fields[11].GetUInt32(); 
     1377                petDisplayId = fields[11].GetUInt32(); 
     1378                petLevel     = fields[12].GetUInt32(); 
    13791379                petFamily    = cInfo->family; 
    13801380            } 
     
    1349613496    if(!result) 
    1349713497    { 
    13498         //                                        0     1     2           3           4           5    6          7          8 
    13499         result = CharacterDatabase.PQuery("SELECT data, name, position_x, position_y, position_z, map, totaltime, leveltime, at_login FROM characters WHERE guid = '%u'",guid); 
     13498        //                                        0     1     2     3           4           5           6    7          8          9 
     13499        result = CharacterDatabase.PQuery("SELECT guid, data, name, position_x, position_y, position_z, map, totaltime, leveltime, at_login FROM characters WHERE guid = '%u'",guid); 
    1350013500        if(!result) return false; 
    1350113501    } 
     
    1350413504    Field *fields = result->Fetch(); 
    1350513505 
    13506     if(!LoadValues( fields[0].GetString())) 
     13506    if(!LoadValues( fields[1].GetString())) 
    1350713507    { 
    1350813508        sLog.outError("ERROR: Player #%d have broken data in `data` field. Can't be loaded.",GUID_LOPART(guid)); 
     
    1351413514    SetUInt64Value(OBJECT_FIELD_GUID, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); 
    1351513515 
    13516     m_name = fields[1].GetCppString(); 
    13517  
    13518     Relocate(fields[2].GetFloat(),fields[3].GetFloat(),fields[4].GetFloat()); 
    13519     SetMapId(fields[5].GetUInt32()); 
     13516    m_name = fields[2].GetCppString(); 
     13517 
     13518    Relocate(fields[3].GetFloat(),fields[4].GetFloat(),fields[5].GetFloat()); 
     13519    SetMapId(fields[6].GetUInt32()); 
    1352013520    // the instance id is not needed at character enum 
    1352113521 
    13522     m_Played_time[0] = fields[6].GetUInt32(); 
    13523     m_Played_time[1] = fields[7].GetUInt32(); 
    13524  
    13525     m_atLoginFlags = fields[8].GetUInt32(); 
     13522    m_Played_time[0] = fields[7].GetUInt32(); 
     13523    m_Played_time[1] = fields[8].GetUInt32(); 
     13524 
     13525    m_atLoginFlags = fields[9].GetUInt32(); 
    1352613526 
    1352713527    // I don't see these used anywhere .. 
  • trunk/src/game/QueryHandler.cpp

    r123 r168  
    182182        data << SubName; 
    183183        data << ci->IconName;                               // "Directions" for guard, string for Icons 2.3.0 
    184         data << (uint32)ci->flag1;                          // flags          wdbFeild7=wad flags1 
     184        data << (uint32)ci->type_flags;                          // flags          wdbFeild7=wad flags1 
    185185        data << (uint32)ci->type; 
    186186        data << (uint32)ci->family;                         // family         wdbFeild9 
  • trunk/src/game/QuestHandler.cpp

    r102 r168  
    106106        return; 
    107107 
    108     pCreature->prepareGossipMenu(_player,0); 
    109     pCreature->sendPreparedGossip( _player ); 
     108    pCreature->prepareGossipMenu(_player); 
     109    pCreature->sendPreparedGossip(_player); 
    110110} 
    111111 
  • trunk/src/game/SharedDefines.h

    r139 r168  
    16011601}; 
    16021602 
     1603enum CreatureTypeFlags 
     1604{ 
     1605    CREATURE_TYPEFLAGS_TAMEBLE    = 0x0001, 
     1606    CREATURE_TYPEFLAGS_HERBLOOT   = 0x0100, 
     1607    CREATURE_TYPEFLAGS_MININGLOOT = 0x0200, 
     1608}; 
     1609 
    16031610enum CreatureEliteType 
    16041611{ 
  • trunk/src/game/Spell.cpp

    r157 r168  
    36703670                } 
    36713671 
    3672                 uint32 skill; 
    3673                 if(creature->GetCreatureInfo()->flag1 & 256) 
    3674                     skill = SKILL_HERBALISM;                // special case 
    3675                 else if(creature->GetCreatureInfo()->flag1 & 512) 
    3676                     skill = SKILL_MINING;                   // special case 
    3677                 else 
    3678                     skill = SKILL_SKINNING;                 // normal case 
     3672                uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill(); 
    36793673 
    36803674                int32 skillValue = ((Player*)m_caster)->GetSkillValue(skill); 
     
    39683962                        return SPELL_FAILED_HIGHLEVEL; 
    39693963 
    3970                     CreatureInfo const *cinfo = ((Creature*)m_targets.getUnitTarget())->GetCreatureInfo(); 
    3971                     if( cinfo->type != CREATURE_TYPE_BEAST ) 
    3972                         return SPELL_FAILED_BAD_TARGETS; 
    3973  
    39743964                    // use SMSG_PET_TAME_FAILURE? 
    3975                     if( !(cinfo->flag1 & 1) || !(cinfo->family) ) 
     3965                    if (!((Creature*)m_targets.getUnitTarget())->GetCreatureInfo()->isTameable ()) 
    39763966                        return SPELL_FAILED_BAD_TARGETS; 
    39773967 
  • trunk/src/game/SpellEffects.cpp

    r162 r168  
    55565556    int32 targetLevel = creature->getLevel(); 
    55575557 
    5558     uint32 skill; 
    5559     if(creature->GetCreatureInfo()->flag1 & 256) 
    5560         skill = SKILL_HERBALISM;                            // special case 
    5561     else if(creature->GetCreatureInfo()->flag1 & 512) 
    5562         skill = SKILL_MINING;                               // special case 
    5563     else 
    5564         skill = SKILL_SKINNING;                             // normal case 
     5558    uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();  
    55655559 
    55665560    ((Player*)m_caster)->SendLoot(creature->GetGUID(),LOOT_SKINNING); 
  • trunk/src/game/World.cpp

    r149 r168  
    983983    objmgr.LoadNpcTextLocales(); 
    984984    objmgr.LoadPageTextLocales(); 
     985    objmgr.LoadNpcOptionLocales(); 
    985986    objmgr.SetDBCLocaleIndex(GetDefaultDbcLocale());        // Get once for all the locale index of DBC language (console/broadcasts) 
    986987 
     
    11611162    sLog.outString( "Loading Npc Text Id..." ); 
    11621163    objmgr.LoadNpcTextId();                                 // must be after load Creature and NpcText 
     1164     
     1165    sLog.outString( "Loading Npc Options..." ); 
     1166    objmgr.LoadNpcOptions(); 
    11631167 
    11641168    sLog.outString( "Loading vendors..." ); 
     
    24732477    ///- Delete kicked sessions at add new session 
    24742478    for (std::set<WorldSession*>::iterator itr = m_kicked_sessions.begin(); itr != m_kicked_sessions.end(); ++itr) 
     2479    {    
     2480        RemoveQueuedPlayer (*itr); 
    24752481        delete *itr; 
     2482    } 
    24762483    m_kicked_sessions.clear(); 
    24772484 
  • trunk/src/game/WorldSession.cpp

    r149 r168  
    8080    } 
    8181     
    82     sWorld.RemoveQueuedPlayer(this); 
    8382} 
    8483 
  • trunk/src/trinitycore/trinitycore.conf.dist

    r78 r168  
    245245#    WorldLogFile 
    246246#        Packet logging file for the worldserver 
    247 #        Default: "world.log" 
     247#        Default: "" 
    248248# 
    249249#    DBErrorLogFile 
     
    302302LogFilter_CreatureMoves = 1 
    303303LogFilter_VisibilityChanges = 1 
    304 WorldLogFile = "world.log" 
     304WorldLogFile = "" 
    305305DBErrorLogFile = "db_errors.log" 
    306306CharLogFile = "characters.log"