예제 #1
0
파일: Character.cs 프로젝트: karliky/wowwow
		/// <summary>
		/// Gossip dialog
		/// New, support quests
		/// changed: 01.10.05
		/// </summary>
		public void SendGossip( Mobile from, int textId, GMenu gMenu, GQMenu gqMenu )
		{
			if ( _gossipOpened ) EndGossip();

			int offset = 4; 
			Converter.ToBytes( (ulong)from.Guid,			tempBuff, ref offset );	// npcGuId
			Converter.ToBytes( (uint)textId,				tempBuff, ref offset );	// TextId
			
			if ( gMenu != null && gMenu.Count > 0 )
			{
				Converter.ToBytes( (int)gMenu.Count,		tempBuff, ref offset );	// Amount of menu items
				GMenuItem[] items = gMenu.Items;
				for ( int i = 0; i< items.Length; i++ )
				{
					GMenuItem item = items[i];
					Converter.ToBytes( (uint)item.MenuId,	tempBuff, ref offset );	// Menu Id
					Converter.ToBytes( (byte)item.Icon,		tempBuff, ref offset );	// Icon Type
					Converter.ToBytes( (byte)item.InputBox,	tempBuff, ref offset );	// Box for input code
					Converter.ToBytes( (string)item.Text,	tempBuff, ref offset );	// Text for menu
					Converter.ToBytes( (byte)0,				tempBuff, ref offset );
				}
			}
			else Converter.ToBytes( (int)0,					tempBuff, ref offset );

			if ( gqMenu != null && gqMenu.Count > 0 ) // Responce OpCodes.CMSG_QUESTGIVER_QUERY_QUEST
			{
				Converter.ToBytes( (int)gqMenu.Count,		tempBuff, ref offset );	// Amount
				GQMenuItem[] items = gqMenu.Items;
				for ( int i = 0; i< items.Length; i++ )
				{
					GQMenuItem item = items[i];
					Converter.ToBytes( (uint)item.MenuId,	tempBuff, ref offset );	// Quest menu id / QuestId
					Converter.ToBytes( (uint)item.Icon,		tempBuff, ref offset );	// IconType
					Converter.ToBytes( (uint)0,				tempBuff, ref offset );	// padding (always 0)
					Converter.ToBytes( (string)item.Text,	tempBuff, ref offset );	// text for menu
					Converter.ToBytes( (byte)0,				tempBuff, ref offset );
				}
			}
			else Converter.ToBytes( (int)0,					tempBuff, ref offset );	// Amount
			Converter.ToBytes( (int)0,						tempBuff, ref offset );	// Unknown (0)
			
			Send( OpCodes.SMSG_GOSSIP_MESSAGE, tempBuff, offset );
			( from as BaseCreature ).npcMenuId = textId;
		}
예제 #2
0
파일: BaseNPC.cs 프로젝트: karliky/wowwow
        /// <summary>
        /// General Dialogs from character
        /// changed: 01.10.05
        /// </summary>
        public override void OnHello( Character c )
        {
            if ( Reputation( c ) > 0.5f )
            {
                GMenu gMenu = new GMenu();
                GQMenu gQMenu = new GQMenu();

                if ( HaveQuests )
                {
                    if ( HaveRewardOnHello( c ) ) return;			// if ready Rewarded onHello

                    BaseQuest[] Qlist = GetQuestsFor( c );			// get all quests for this character

                    if ( Qlist.Length == 1 )
                    {
                        DoQuestEvents( c, Qlist[0] );
                        return;
                    }
                    for ( int i = 0; i< Qlist.Length; i++ )
                    {
                        gQMenu.Add( (uint)Qlist[i].Id, Qlist[i].QuestStatus( this, c ), Qlist[i].Name );
                    }
                    if ( OnlyQuests )
                    {
                        if ( gQMenu.Count > 0 )
                        {
                            c.QuestList( this, GetRndQLMessage, GetQLEmote, Qlist );
                        }
                        else
                        {
                            c.SendGossip( this, (int)NPCMenuId.Hello, null, null );
                            //c.ResponseMessage( this, (int)NPCMenuId.Hello, Message_Hello );
                        }
                        return;
                    }
                }

                if ( Taxi )			gMenu.Add( (int)NPCSubMenuId.Taxi,		GMenuIcons.Taxi,		false, Dialog_Taxi );
                if ( Vendor )		gMenu.Add( (int)NPCSubMenuId.Vendor,	GMenuIcons.Vendor,	false, Dialog_Vendor );
                if ( Trainer )		gMenu.Add( (int)NPCSubMenuId.Trainer,	GMenuIcons.Trainer,	false, Dialog_Teach );
                if ( Banker )		gMenu.Add( (int)NPCSubMenuId.Banker,	GMenuIcons.Banker,	false, Dialog_Bank );
                if ( InKeeper )
                {
                    gMenu.Add( (int)NPCSubMenuId.Vendor,		GMenuIcons.Vendor,	false, Dialog_Vendor );
                    gMenu.Add( (int)NPCSubMenuId.InKeeperBind,	GMenuIcons.Binder,	false, Dialog_Inkeeper_Bind );
                    //NPCSubMenuId.InKeeperMsg
                }

                if ( gMenu.Count > 0 || gQMenu.Count > 0 )
                {
                    c.SendGossip( this, (int)NPCMenuId.MainMenu, gMenu, gQMenu );
                }
                else
                {
                    c.SendGossip( this, (int)NPCMenuId.Hello, null, null );
                    //c.ResponseMessage( this, (int)NPCMenuId.Hello, Message_Hello );
                }
            }
            else c.SendGossip( this, (int)NPCMenuId.HelloBad, null, null );//*/
            //else c.ResponseMessage( this, (int)NPCMenuId.HelloBad, "Get lost skum.." );
        }