⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stall 2.cpp.svn-base

📁 絲路server源碼 Silk Road server source
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
	{
		mcontrolPointAuras[Id] = SpawnGameObject(giaura>ID, mmapMgr>GetMapId(), ControlPointCoordinates[Id][0], ControlPointCoordinates[Id][1],
			ControlPointCoordinates[Id][2], ControlPointCoordinates[Id][3], 0, 35, 1.0f);

		mcontrolPointAuras[Id]>SetFloatValue(GAMEOBJECTROTATION02, ControlPointRotations[Id][0]);
		mcontrolPointAuras[Id]>SetFloatValue(GAMEOBJECTROTATION03, ControlPointRotations[Id][1]);
		mcontrolPointAuras[Id]>SetUInt32Value(GAMEOBJECTSTATE, 1);
		mcontrolPointAuras[Id]>SetUInt32Value(GAMEOBJECTTYPEID, 6);
		mcontrolPointAuras[Id]>SetUInt32Value(GAMEOBJECTANIMPROGRESS, 100);
		mcontrolPointAuras[Id]>bannerauraslot = Id;
		mcontrolPointAuras[Id]>PushToWorld(mmapMgr);
	}
	else
	{
		if(mcontrolPointAuras[Id]>IsInWorld())
			mcontrolPointAuras[Id]>RemoveFromWorld(false);

		// respawn the aura
		mcontrolPointAuras[Id]>SetNewGuid(mmapMgr>GenerateGameobjectGuid());
		mcontrolPointAuras[Id]>SetUInt32Value(OBJECTFIELDENTRY, giaura>ID);
		mcontrolPointAuras[Id]>SetUInt32Value(GAMEOBJECTDISPLAYID, giaura>DisplayID);
		mcontrolPointAuras[Id]>SetInfo(giaura);
		mcontrolPointAuras[Id]>PushToWorld(mmapMgr);
	}	
}

void ArathiBasin::OnCreate()
{
	// _EUROPEANS Gate
	GameObject *gate = SpawnGameObject(180255, 529, 1284.597290f, 1281.166626f, 15.977916f, 0.706859f, 32, 114, 1.5799990f);
	gate>SetFloatValue(GAMEOBJECTROTATION,0.0129570f);
	gate>SetFloatValue(GAMEOBJECTROTATION01,0.0602880f);
	gate>SetFloatValue(GAMEOBJECTROTATION02,0.3449600f);
	gate>SetFloatValue(GAMEOBJECTROTATION03,0.9365900f);
	gate>PushToWorld(mmapMgr);
	mgates.pushback(gate);

	// _CHINESE gate
	gate = SpawnGameObject(180256, 529, 708.0902710f, 708.4479370f, 17.3898964f, 2.3910990f, 32, 114, 1.5699990f);
	gate>SetFloatValue(GAMEOBJECTROTATION,0.0502910f);
	gate>SetFloatValue(GAMEOBJECTROTATION01,0.0151270f);
	gate>SetFloatValue(GAMEOBJECTROTATION02,0.9292169f);
	gate>SetFloatValue(GAMEOBJECTROTATION03,0.3657840f);
	gate>PushToWorld(mmapMgr);
	mgates.pushback(gate);

	// spawn (default) control points
	SpawnControlPoint(ABCONTROLPOINTSTABLE,		ABSPAWNTYPENEUTRAL);
	SpawnControlPoint(ABCONTROLPOINTBLACKSMITH,	ABSPAWNTYPENEUTRAL);
	SpawnControlPoint(ABCONTROLPOINTLUMBERMILL,	ABSPAWNTYPENEUTRAL);
	SpawnControlPoint(ABCONTROLPOINTMINE,		ABSPAWNTYPENEUTRAL);
	SpawnControlPoint(ABCONTROLPOINTFARM,		ABSPAWNTYPENEUTRAL);

	// spawn buffs
	SpawnBuff(ABBUFFSTABLES);
	SpawnBuff(ABBUFFBLACKSMITH);
	SpawnBuff(ABBUFFLUMBERMILL);
	SpawnBuff(ABBUFFMINE);
	SpawnBuff(ABBUFFFARM);

	// spawn the h/a base spirit guides
	AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[0][0],NoBaseGYLocations[0][1],NoBaseGYLocations[0][2], 0.0f, 0));
	AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[1][0],NoBaseGYLocations[1][1],NoBaseGYLocations[1][2], 0.0f, 1));

	// urrrgh worldstates
	SetWorldState(0x8D8, 0x00);
	SetWorldState(0x8D7, 0x00);
	SetWorldState(0x8D6, 0x00);
	SetWorldState(0x8D5, 0x00);
	SetWorldState(0x8D4, 0x00);
	SetWorldState(0x8D3, 0x00);

	// AB world state's
	// unknowns, need more research
	SetWorldState(0x7A3, 1800); // unknown
	SetWorldState(0x745, 0x02); // unknown

	// Icon stuff for on the map
	SetWorldState(ABSHOWBACKSMITHICON, 			 0x01);
	SetWorldState(ABSHOWFARMICON, 				  0x01);
	SetWorldState(ABSHOWLUMBERMILLICON, 			0x01);
	SetWorldState(ABSHOWGOLDMINEICON, 			 0x01);
	SetWorldState(ABSHOWSTABLEICON, 			0x01);

	// LumberMill
	SetWorldState(ABCAPTURINGLUMBERMILL_CHINESE, 	   0x00);
	SetWorldState(ABCAPTURINGLUMBERMILL_EUROPEANS, 	0x00);
	SetWorldState(ABCAPTUREDLUMBERMILL_CHINESE, 		0x00);
	SetWorldState(ABCAPTUREDLUMBERMILL_EUROPEANS, 	 0x00);

	// GoldMine
	SetWorldState(ABCAPTURINGGOLDMINE_CHINESE, 		 0x00);
	SetWorldState(ABCAPTURINGGOLDMINE_EUROPEANS, 	  0x00);
	SetWorldState(ABCAPTUREDGOLDMINE_CHINESE, 		  0x00);
	SetWorldState(ABCAPTUREDGOLDMINE_EUROPEANS, 	   0x00);

	// BlackSmith
	SetWorldState(ABCAPTURINGBLACKSMITH_CHINESE, 	   0x00);
	SetWorldState(ABCAPTURINGBLACKSMITH_EUROPEANS, 	0x00);
	SetWorldState(ABCAPTUREDBLACKSMITH_CHINESE, 		0x00);
	SetWorldState(ABCAPTUREDBLACKSMITH_EUROPEANS, 	 0x00);

	SetWorldState(ABMAXSCORE, 						RESOURCESWINVAL);
	SetWorldState(AB_EUROPEANSCAPTUREBASE, 			 0x00);
	SetWorldState(AB_CHINESECAPTUREBASE, 				0x00);
	SetWorldState(AB_CHINESERESOURCES, 				  0x00);
	SetWorldState(AB_EUROPEANSRESOURCES, 			   0x00);

	// Farm
	SetWorldState(ABCAPTURINGFARM_EUROPEANS, 		 0x00);
	SetWorldState(ABCAPTURINGFARM_CHINESE, 			 0x00);
	SetWorldState(ABCAPTUREDFARM_CHINESE, 			  0x00);
	SetWorldState(ABCAPTUREDFARM_EUROPEANS, 		   0x00);

	// Stables
	SetWorldState(ABCAPTURINGSTABLES_CHINESE, 		  0x00);
	SetWorldState(ABCAPTURINGSTABLES_EUROPEANS, 	   0x00);
	SetWorldState(ABCAPTUREDSTABLES_CHINESE, 		   0x00);
	SetWorldState(ABCAPTUREDSTABLES_EUROPEANS, 		0x00);
}

void ArathiBasin::OnStart()
{
	for(uint32 i = 0; i < 2; ++i) {
		for(set<Player*>::iterator itr = mplayers[i].begin(); itr != mplayers[i].end(); ++itr) {
			(*itr)>RemoveAura(BGPREPARATION);
		}
	}

	// open gates
	for(list<GameObject*>::iterator itr = mgates.begin(); itr != mgates.end(); ++itr)
	{
		(*itr)>SetUInt32Value(GAMEOBJECTFLAGS, 64);
		(*itr)>SetUInt32Value(GAMEOBJECTSTATE, 0);
	}

	/* correct?  burlex */
	PlaySoundToAll(SOUNDBATTLEGROUNDBEGIN);

	mstarted = true;
}

ArathiBasin::ArathiBasin(MapMgr * mgr, uint32 id, uint32 lgroup, uint32 t) : CBattleground(mgr,id,lgroup,t)
{
	uint32 i;
	mplayerCountPerTeam=15;

	for(i = 0; i < ABNUMCONTROLPOINTS; ++i)
	{
		mbuffs[i] = NULL;
		mcontrolPointAuras[i] = NULL;
		mcontrolPoints[i] = NULL;
		mspiritGuides[i] = NULL;
		mbasesAssaultedBy[i] = 1;
		mbasesOwnedBy[i] = 1;
	}

	for(i = 0; i < 2; ++i)
	{
		mresources[i] = 0;
		mcapturedBases[i] = 0;
		mlastHonorGainResources[i] = 0;
		mnearingVictory[i] = false;
	}
}

ArathiBasin::~ArathiBasin()
{
	// gates are always spawned, so mapmgr will clean them up
	for(uint32 i = 0; i < ABNUMCONTROLPOINTS; ++i)
	{
		// buffs may not be spawned, so delete them if they're not
		if(mbuffs[i] != NULL)
		{
			mbuffs[i]>mbattleground = NULL;
			if( !mbuffs[i]>IsInWorld() )
				delete mbuffs[i];
		}

		if(mcontrolPoints[i] != NULL)
		{
			mcontrolPoints[i]>mbattleground = NULL;
			if( !mcontrolPoints[i]>IsInWorld() )
				delete mcontrolPoints[i];
		}

		if(mcontrolPointAuras[i])
		{
			mcontrolPointAuras[i]>mbattleground = NULL;
			if( !mcontrolPointAuras[i]>IsInWorld() )
				delete mcontrolPointAuras[i];
		}
	}
}

void ArathiBasin::EventUpdateResources(uint32 Team)
{
	uint32 resourcefields[2] = { AB_EUROPEANSRESOURCES, AB_CHINESERESOURCES };

	uint32 currentresources = mresources[Team];
	uint32 currentbases = mcapturedBases[Team];

	if(currentbases>5)
		currentbases=5;

	// figure out how much resources we have to add to that team based on the number of captured bases.
	currentresources += (PointBonusPerUpdate[currentbases]);

	// did it change?
	if(currentresources == mresources[Team])
		return;

	// check for overflow
	if(currentresources > RESOURCESWINVAL)
		currentresources = RESOURCESWINVAL;

	mresources[Team] = currentresources;
	if((currentresources  mlastHonorGainResources[Team]) >= RESOURCESTOGAINBH)
	{
		mmainLock.Acquire();
		for(set<Player*>::iterator itr = mplayers[Team].begin(); itr != mplayers[Team].end(); ++itr)
			(*itr)>mbgScore.BonusHonor += BASEBHGAIN;

		UpdatePvPData();
		mmainLock.Release();
	}

	// update the world states
	SetWorldState(resourcefields[Team], currentresources);

	if(currentresources >= RESOURCESWARNINGTHRESHOLD && !mnearingVictory[Team])
	{
		mnearingVictory[Team] = true;
		SendChatMessage(Team ? CHATMSGBGEVENT_CHINESE : CHATMSGBGEVENT_EUROPEANS, (uint64)0, "The %s has gathered %u resources and is nearing victory!", Team ? "_CHINESE" : "_EUROPEANS", currentresources);
		uint32 sound = SOUND_EUROPEANSBGALMOSTEND  Team;
		PlaySoundToAll(sound);
	}

	// check for winning condition
	if(currentresources == RESOURCESWINVAL)
	{
		mended = true;
		mwinningteam = Team;
		mnextPvPUpdateTime = 0;

		sEventMgr.RemoveEvents(this);
		sEventMgr.AddEvent(((CBattleground*)this), &CBattleground::Close, EVENTBATTLEGROUNDCLOSE, 120000, 1,0);

		/* add the marks of honor to all players */
		mmainLock.Acquire();

		SKILLSEntry * winnerSKILLS = dbcSKILLS.LookupEntry(24953);
		SKILLSEntry * loserSKILLS = dbcSKILLS.LookupEntry(24952);
		for(uint32 i = 0; i < 2; ++i)
		{
			for(set<Player*>::iterator itr = mplayers[i].begin(); itr != mplayers[i].end(); ++itr)
			{
				(*itr)>Root();
				if(i == mwinningteam)
					(*itr)>CastSKILLS((*itr), winnerSKILLS, true);
				else
					(*itr)>CastSKILLS((*itr), loserSKILLS, true);
			}
		}
		mmainLock.Release();
	}
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -