Changeset 44 for trunk/src/game/Creature.cpp
- Timestamp:
- 11/19/08 13:27:40 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Creature.cpp
r37 r44 1 1 /* 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/> 3 5 * 4 6 * This program is free software; you can redistribute it and/or modify … … 9 11 * This program is distributed in the hope that it will be useful, 10 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 14 * GNU General Public License for more details. 13 15 * 14 16 * You should have received a copy of the GNU General Public License 15 17 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 19 */ 18 20 … … 43 45 #include "GridNotifiersImpl.h" 44 46 #include "CellImpl.h" 45 47 #include "OutdoorPvPMgr.h" 48 #include "GameEvent.h" 46 49 // apply implementation of the singletons 47 50 #include "Policies/SingletonImp.h" … … 253 256 SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, GetCreatureInfo()->faction_A); 254 257 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); 256 262 257 263 SetAttackTime(BASE_ATTACK, GetCreatureInfo()->baseattacktime); … … 742 748 case GOSSIP_OPTION_AUCTIONEER: 743 749 break; // no checks 750 case GOSSIP_OPTION_OUTDOORPVP: 751 if ( !sOutdoorPvPMgr.CanTalkTo(pPlayer,this,(*gso)) ) 752 cantalking = false; 753 break; 744 754 default: 745 755 sLog.outErrorDb("Creature %u (entry: %u) have unknown gossip option %u",GetGUIDLow(),GetEntry(),gso->Action); … … 776 786 777 787 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 778 791 779 792 // in case empty gossip menu open quest menu if any … … 817 830 player->PlayerTalkClass->CloseGossip(); 818 831 player->PlayerTalkClass->SendTalking( textid ); 832 break; 833 case GOSSIP_OPTION_OUTDOORPVP: 834 sOutdoorPvPMgr.HandleGossipOption(player, GetGUID(), option); 819 835 break; 820 836 case GOSSIP_OPTION_SPIRITHEALER: … … 965 981 uint32 Creature::GetNpcTextId() 966 982 { 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 967 988 if (!m_DBTableGuid) 968 989 return DEFAULT_GOSSIP_MESSAGE; … … 982 1003 } 983 1004 return NULL; 1005 } 1006 1007 void Creature::ResetGossipOptions() 1008 { 1009 m_gossipOptionLoaded = false; 1010 m_goptions.clear(); 984 1011 } 985 1012 … … 1672 1699 Creature* pCreature = NULL; 1673 1700 1674 CellPair p( MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));1701 CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); 1675 1702 Cell cell(p); 1676 1703 cell.data.Part.reserved = ALL_DISTRICT; 1677 1704 cell.SetNoCreate(); 1678 1705 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); 1683 1710 1684 1711 CellLock<GridReadGuard> cell_lock(cell, p); … … 1711 1738 1712 1739 { 1713 CellPair p( MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY()));1740 CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); 1714 1741 Cell cell(p); 1715 1742 cell.data.Part.reserved = ALL_DISTRICT; 1716 1743 cell.SetNoCreate(); 1717 1744 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); 1722 1749 1723 1750 CellLock<GridReadGuard> cell_lock(cell, p);