void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
    {
		CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE;
		if(pObject->GetTypeId()!=TYPEID_UNIT)
			return;
		
		switch(IntId)
        {
        case 1:
			{
				plr->Gossip_Complete();
				pCreature->CastSpell(plr, dbcSpell.LookupEntry(42711), true);
            }break;
		}
    }
	void GossipHello( ObjectPointer pObject, PlayerPointer pPlayer, bool AutoSend )
	{
		if ( pObject == NULL || pObject->GetTypeId() != TYPEID_ITEM || pPlayer == NULL )
			return;

		QuestLogEntry* QuestEntry = pPlayer->GetQuestLogForEntry( 9452 );
		if ( QuestEntry == NULL )
			return;

#ifndef BLIZZLIKE
		//if ( QuestEntry->GetMobCount( 0 ) >= QuestEntry->GetQuest()->required_mobcount[ 0 ] )
		//	return;
#endif
		if ( pPlayer->GetMapMgr() == NULLMAPMGR )
			return;

		// Meh, double object looking - we should find a way to remove this
		GameObjectPointer School = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords( pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 181616 );
		if ( School == NULLGOB || pPlayer->CalcDistance( School ) > 5.0f )
			return;

#ifdef BLIZZLIKE
		sEventMgr.AddEvent( School, &GameObject::Despawn, static_cast< uint32 >( 20000 ), EVENT_GAMEOBJECT_ITEM_SPAWN, 1000, 1, 0 );
#else
		School->Despawn( 20000 );
#endif
		pPlayer->CastSpell( pPlayer, dbcSpell.LookupEntry( TO_ITEM( pObject )->GetProto()->Spells[ 0 ].Id ), false );
		uint32 Chance = RandomUInt( 10 );
		if ( Chance <= 3 )
		{
			CreaturePointer NewCreature = sEAS.SpawnCreature( pPlayer, 17102, pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetOrientation(), 180000 );
			if ( NewCreature != NULLCREATURE )
			{
				NewCreature->GetAIInterface()->StopMovement( 500 );
				NewCreature->setAttackTimer( 1000, false );
				NewCreature->m_noRespawn = true;
			};

			return;
		};

		sEAS.AddItem( 23614, pPlayer );
		QuestEntry->SendUpdateAddKill( 1 );
		QuestEntry->UpdatePlayerFields();
		pPlayer->Gossip_Complete();
	};
Esempio n. 3
0
	void GossipSelectOption(ObjectPointer pObject, PlayerPointer plr, uint32 Id, uint32 IntId, const char * Code)
	{
		CreaturePointer  pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE;
		if(pObject==NULL)
			return;

		switch(IntId)
		{
		case 0: // Return to start
			GossipHello(pCreature, plr, true);
			break;
		case 1: // Give Item
			{
				plr->CastSpell(plr, dbcSpell.LookupEntry(23122),true);
				plr->Gossip_Complete();
				break;
			}
			break;
		}
	}
void InnkeeperGossip::GossipSelectOption(ObjectPointer pObject, PlayerPointer Plr, uint32 Id, uint32 IntId, const char * Code)
{
	CreaturePointer pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?(TO_CREATURE(pObject)):NULLCREATURE;
	if(pCreature==NULLCREATURE)
		return;

    switch(IntId)
    {
    case 1:     // VENDOR
        Plr->GetSession()->SendInventoryList(pCreature);
        break;
    case 2:     // BINDER
        Plr->GetSession()->SendInnkeeperBind(pCreature);
        break;
    case 3:     // WHAT CAN I DO ?
        // Prepare second menu
        GossipMenu *Menu;
        objmgr.CreateGossipMenuForPlayer(&Menu, pCreature->GetGUID(), 1853, Plr);
        Menu->AddItem(5, "Make this inn your home.", 2);
        Menu->SendTo(Plr);
        break;
	case 4:     // EVENT OF HALLOWEEN
		if(!Plr->HasAura(SPELL_TRICK_OR_TREATED))
		{
			pCreature->CastSpell(Plr, SPELL_TRICK_OR_TREATED, true);

			// either trick or treat, 50% chance
			if(rand()%2)
			{
				Plr->CastSpell(Plr, SPELL_TREAT, true);
			}
			else
			{
				int32 trickspell=0;
				switch (rand()%9)
				{
					case 0:
					    trickspell=24753;                       // cannot cast, random 30sec
						break;
					case 1:
						trickspell=24713;                       // lepper gnome costume
						break;
					case 2:
						if(Plr->getGender() == 0){
							trickspell=24735;                   // male ghost costume
						}else{
							trickspell=24736;                   // female ghostcostume
						}
	                    break;
	                case 3:
						if(Plr->getGender() == 0){
							trickspell=24711;                   // male ninja costume
						}else{
							trickspell=24710;                   // female ninja costume
						}
		                break;
	                case 4:
						if(Plr->getGender() == 0){
							trickspell=24708;                   // male pirate costume
						}else{
							trickspell=24709;                   // female pirate costume
						}
	                    break;
	                case 5:
	                    trickspell=24723;                       // skeleton costume
	                    break;
	            }
	            pCreature->CastSpell(Plr, trickspell, true);
			}	
		}
		Plr->Gossip_Complete();
        break;
    }
}