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

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

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

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

Files:
1 modified

Legend:

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

    r37 r44  
    11/* 
    2  * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> 
     2 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> 
     3 * 
     4 * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> 
    35 * 
    46 * This program is free software; you can redistribute it and/or modify 
     
    911 * This program is distributed in the hope that it will be useful, 
    1012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
    1214 * GNU General Public License for more details. 
    1315 * 
    1416 * You should have received a copy of the GNU General Public License 
    1517 * along with this program; if not, write to the Free Software 
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
    1719 */ 
    1820 
     
    4345#include "GridNotifiersImpl.h" 
    4446#include "CellImpl.h" 
    45  
     47#include "OutdoorPvPMgr.h" 
     48#include "GameEvent.h" 
    4649// apply implementation of the singletons 
    4750#include "Policies/SingletonImp.h" 
     
    253256        SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, GetCreatureInfo()->faction_A); 
    254257 
    255     SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag); 
     258    if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) 
     259        SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag | gameeventmgr.GetNPCFlag(this)); 
     260    else 
     261        SetUInt32Value(UNIT_NPC_FLAGS,GetCreatureInfo()->npcflag); 
    256262 
    257263    SetAttackTime(BASE_ATTACK,  GetCreatureInfo()->baseattacktime); 
     
    742748                    case GOSSIP_OPTION_AUCTIONEER: 
    743749                        break;                              // no checks 
     750                    case GOSSIP_OPTION_OUTDOORPVP: 
     751                        if ( !sOutdoorPvPMgr.CanTalkTo(pPlayer,this,(*gso)) ) 
     752                            cantalking = false; 
     753                        break; 
    744754                    default: 
    745755                        sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetGUIDLow(),GetEntry(),gso->Action); 
     
    776786 
    777787    GossipMenu& gossipmenu = player->PlayerTalkClass->GetGossipMenu(); 
     788 
     789    if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) // if world event npc then 
     790        gameeventmgr.HandleWorldEventGossip(player, this);      // update world state with progress 
    778791 
    779792    // in case empty gossip menu open quest menu if any 
     
    817830            player->PlayerTalkClass->CloseGossip(); 
    818831            player->PlayerTalkClass->SendTalking( textid ); 
     832            break; 
     833        case GOSSIP_OPTION_OUTDOORPVP: 
     834            sOutdoorPvPMgr.HandleGossipOption(player, GetGUID(), option); 
    819835            break; 
    820836        case GOSSIP_OPTION_SPIRITHEALER: 
     
    965981uint32 Creature::GetNpcTextId() 
    966982{ 
     983    // don't cache / use cache in case it's a world event announcer 
     984    if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_WORLDEVENT) 
     985        if(uint32 textid = gameeventmgr.GetNpcTextId(m_DBTableGuid)) 
     986            return textid; 
     987 
    967988    if (!m_DBTableGuid) 
    968989        return DEFAULT_GOSSIP_MESSAGE; 
     
    9821003    } 
    9831004    return NULL; 
     1005} 
     1006 
     1007void Creature::ResetGossipOptions() 
     1008{ 
     1009    m_gossipOptionLoaded = false; 
     1010    m_goptions.clear(); 
    9841011} 
    9851012 
     
    16721699    Creature* pCreature = NULL; 
    16731700 
    1674     CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); 
     1701    CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); 
    16751702    Cell cell(p); 
    16761703    cell.data.Part.reserved = ALL_DISTRICT; 
    16771704    cell.SetNoCreate(); 
    16781705 
    1679     MaNGOS::NearestAssistCreatureInCreatureRangeCheck u_check(this,getVictim(),radius); 
    1680     MaNGOS::CreatureLastSearcher<MaNGOS::NearestAssistCreatureInCreatureRangeCheck> searcher(pCreature, u_check); 
    1681  
    1682     TypeContainerVisitor<MaNGOS::CreatureLastSearcher<MaNGOS::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer >  grid_creature_searcher(searcher); 
     1706    Trinity::NearestAssistCreatureInCreatureRangeCheck u_check(this,getVictim(),radius); 
     1707    Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(pCreature, u_check); 
     1708 
     1709    TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer >  grid_creature_searcher(searcher); 
    16831710 
    16841711    CellLock<GridReadGuard> cell_lock(cell, p); 
     
    17111738 
    17121739            { 
    1713                 CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); 
     1740                CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); 
    17141741                Cell cell(p); 
    17151742                cell.data.Part.reserved = ALL_DISTRICT; 
    17161743                cell.SetNoCreate(); 
    17171744 
    1718                 MaNGOS::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius); 
    1719                 MaNGOS::CreatureListSearcher<MaNGOS::AnyAssistCreatureInRangeCheck> searcher(assistList, u_check); 
    1720  
    1721                 TypeContainerVisitor<MaNGOS::CreatureListSearcher<MaNGOS::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer >  grid_creature_searcher(searcher); 
     1745                Trinity::AnyAssistCreatureInRangeCheck u_check(this, getVictim(), radius); 
     1746                Trinity::CreatureListSearcher<Trinity::AnyAssistCreatureInRangeCheck> searcher(assistList, u_check); 
     1747 
     1748                TypeContainerVisitor<Trinity::CreatureListSearcher<Trinity::AnyAssistCreatureInRangeCheck>, GridTypeMapContainer >  grid_creature_searcher(searcher); 
    17221749 
    17231750                CellLock<GridReadGuard> cell_lock(cell, p);