Beispiel #1
0
void Vehicle::SendSpells(uint32 entry, Player* plr)
{
	CreatureProtoVehicle* acc = CreatureProtoVehicleStorage.LookupEntry(GetEntry());
	if(!acc)
	{
		WorldPacket data(SMSG_PET_SPELLS, 12);
		data << uint64(0);
		data << uint32(0);
		plr->GetSession()->SendPacket(&data);
		return;
	}

	uint8 count = 0;

	WorldPacket data(SMSG_PET_SPELLS, 60);
	data << uint64(GetGUID());
	data << uint16(0);
	data << uint32(0);
	data << uint32(0x00000101);

	for (uint32 i = 0; i < 6; i++)
	{
		uint32 spellId = acc->VehicleSpells[i];
		if (!spellId)
			continue;

		SpellEntry const *spellInfo = dbcSpell.LookupEntryForced( spellId );
		if (!spellInfo)
			continue;
		if(spellInfo->Attributes & ATTRIBUTES_PASSIVE)
		{
			CastSpell(GetGUID(), spellId, true);
			data << uint16(0) << uint8(0) << uint8(i+8);
		}
		else
		{
			if(spellInfo->SpellDifficulty && GetMapMgr()->pInstance)
			{
				SpellDifficultyEntry * sd = dbcSpellDifficulty.LookupEntry(spellInfo->SpellDifficulty);
				if( sd->SpellId[GetMapMgr()->iInstanceMode] == 0 )
				{
					uint32 mode;
					if( GetMapMgr()->iInstanceMode == 3 )
						mode = 1;
					else
						mode = 0;

					if( sd->SpellId[mode] == 0 )
						spellId = sd->SpellId[0];
				}
				else
					spellId = sd->SpellId[GetMapMgr()->iInstanceMode];
			}
			switch(spellId)
			{
			case 62286: // Tar
			case 62308: // Ram
			case 62522: // Electroshock!
				{
					if(IsInInstance())
					{
						if(dbcMap.LookupEntry(GetMapId())->israid()) // Difficulty Check
						{
							if(plr->iRaidType > MODE_10PLAYER_NORMAL)
							{
								data << uint32(0);
								continue;
							}
						}
					}
					data << uint32(MAKE_ACTION_BUTTON(spellId,i+8));
					++count;
				}break;

			default:
				data << uint32(MAKE_ACTION_BUTTON(spellId,i+8));
				++count;
				break;
			}
		}
	}

	for(uint8 i = 6; i < 10; i++)
	{
		data << uint16(0) << uint8(0) << uint8(i+8);
	}

	data << count; // spells count
	data << uint8(0);
	plr->GetSession()->SendPacket(&data);
}
Beispiel #2
0
void IsleOfConquest::BuildVehicleSpellList(Creature *c, WorldPacket & data)
{
	#define MAKE_ACTION_BUTTON(A,T) uint32(uint32(A) | (uint32(T) << 24))
	if(c == NULL || !c->IsInWorld())
	{
		sLog.outError("IOC attempted to build a vehicle spell list for a nonexistant/not in world creature.");
		return;
	}
	uint32 spellcount = 0;
	Unit * controller = c->GetMapMgrUnit(c->GetCharmedByGUID());
	if(controller == NULL || !controller->IsInWorld())
	{
		sLog.outError("IOC attempted to build a vehicle spell list for a nonexistant/not in world controller.");
		return;
	}
	c->SetFaction(controller->GetFaction());
	switch(c->GetEntry())
	{
		case KEEP_CANNON:
		case CATAPULT:
		{
			spellcount = 2;
		}break;

		case DEMOLISHER:
		{
			spellcount = ActiveBonuses[c->GetTeam()][5] ? 1 : 2;
		}break;

		case FLAME_TURRET_A:
		case FLAME_TURRET_H:
		{
			spellcount = 1;
		}break;

		case SIEGE_ENGINE_A:
		case SIEGE_ENGINE_H:
		{
			spellcount = 2;
		}break;

		case SIEGE_TURRET_A:
		case SIEGE_TURRET_H:
		{
			spellcount = 2;
		}break;
		default:
		{
			sLog.outError("Unhandled vehicle attempting to build spell list. Entry: %u");
			return;
		}
	}
	data << uint64(c->GetGUID());
	data << uint16(c->GetCreatureInfo()->Family);
	data << uint32(0);
	data << uint32( 0x8000101 );
	uint8 count = 0;
	for (uint32 i = 0; i < 10; i++)
	{
		uint32 spellId = c->GetProto()->AISpells[i];

		SpellEntry const *spellInfo = dbcSpell.LookupEntryForced( spellId );
		if (!spellInfo || spellInfo->Id == 1 || i >= spellcount)
		{
			data << uint16(0) << uint8(0) << uint8(i+8);
		}
		else
		{
			data << uint32(MAKE_ACTION_BUTTON(spellId,i+8));
			++count;
		}
	}
	data << count; // spells count
	data << uint8(0);
}