mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 01:37:00 +00:00
Merge branch 'master' into 303
This commit is contained in:
commit
8d733e8f8a
30 changed files with 547 additions and 161 deletions
|
|
@ -671,12 +671,9 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid )
|
|||
// lazy loading single time at use
|
||||
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)
|
||||
{
|
||||
bool cantalking=true;
|
||||
|
|
@ -744,15 +741,29 @@ void Creature::prepareGossipMenu( Player *pPlayer,uint32 gossipid )
|
|||
case GOSSIP_OPTION_AUCTIONEER:
|
||||
break; // no checks
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -800,8 +811,8 @@ void Creature::OnGossipSelect(Player* player, uint32 option)
|
|||
uint32 action=gossipmenu.GetItem(option).m_gAction;
|
||||
uint32 zoneid=GetZoneId();
|
||||
uint64 guid=GetGUID();
|
||||
|
||||
GossipOption const *gossip=GetGossipOption( action );
|
||||
uint32 textid;
|
||||
if(!gossip)
|
||||
{
|
||||
zoneid=0;
|
||||
|
|
@ -809,7 +820,8 @@ void Creature::OnGossipSelect(Player* player, uint32 option)
|
|||
if(!gossip)
|
||||
return;
|
||||
}
|
||||
textid=GetGossipTextId( action, zoneid);
|
||||
|
||||
uint32 textid=GetGossipTextId( action, zoneid);
|
||||
if(textid==0)
|
||||
textid=GetNpcTextId();
|
||||
|
||||
|
|
@ -898,7 +910,7 @@ void Creature::OnPoiSelect(Player* player, GossipOption const *gossip)
|
|||
Map const* map=MapManager::Instance().GetBaseMap( mapid );
|
||||
uint16 areaflag=map->GetAreaFlag(GetPositionX(),GetPositionY());
|
||||
uint32 zoneid=Map::GetZoneId(areaflag,mapid);
|
||||
std::string areaname= gossip->Option;
|
||||
std::string areaname= gossip->OptionText;
|
||||
/*
|
||||
uint16 pflag;
|
||||
|
||||
|
|
@ -992,24 +1004,10 @@ void Creature::LoadGossipOptions()
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue