예제 #1
0
wstring FactoryModule::GetInfo(bool xml)
{
	wstring info;
	if (xml)
	{
		info += FACTORY_NAMES[type]; 
		info += L"</TEXT><PARA/><TEXT>      Pending " + stows(itos(build_queue.size())) + L" items</TEXT>";
		if (active_recipe.nickname)
		{
			info += L"<PARA/><TEXT>      Building " + active_recipe.infotext + L". Waiting for:</TEXT>";
		
			for (map<uint,uint>::iterator i = active_recipe.consumed_items.begin();
				i != active_recipe.consumed_items.end(); ++i)
			{
				uint good = i->first;
				uint quantity = i->second;
				
				const GoodInfo *gi = GoodList::find_by_id(good);
				if (gi)
				{
					info += L"<PARA/><TEXT>      - " + stows(itos(quantity)) + L"x " + HkGetWStringFromIDS(gi->iIDSName);
					if (quantity > 0 && base->HasMarketItem(good) < active_recipe.cooking_rate)
						info += L" [Out of stock]";
					info += L"</TEXT>";
				}
			}
		}
		info += L"<TEXT>";
	}
	else
	{
		info += FACTORY_NAMES[type];
		info += L" - Pending " + stows(itos(build_queue.size())) + L" items ";
		if (active_recipe.nickname)
		{
			info = L" - Building " + active_recipe.infotext + L". Waiting for:";
		
			for (map<uint,uint>::iterator i = active_recipe.consumed_items.begin();
				i != active_recipe.consumed_items.end(); ++i)
			{
				uint good = i->first;
				uint quantity = i->second;
				
				const GoodInfo *gi = GoodList::find_by_id(good);
				if (gi)
				{
					info += L" " + stows(itos(quantity)) + L"x " + HkGetWStringFromIDS(gi->iIDSName);
				}
			}
		}
	}

	return info;
}
예제 #2
0
wstring BuildModule::GetInfo(bool xml)
{
	wstring info;
	if (xml)
	{
		info = L"<TEXT>Constructing " + active_recipe.infotext + L". Waiting for:</TEXT>";

		for (map<uint,uint>::iterator i = active_recipe.consumed_items.begin();
			i != active_recipe.consumed_items.end(); ++i)
		{
			uint good = i->first;
			uint quantity = i->second;
			
			const GoodInfo *gi = GoodList::find_by_id(good);
			if (gi)
			{
				info += L"<PARA/><TEXT>      - " + stows(itos(quantity)) + L"x " + HkGetWStringFromIDS(gi->iIDSName);
				if (base->HasMarketItem(good) < quantity)
					info += L" [Out of stock]";
				info += L"</TEXT>";
			}
		}
	}
	else
	{
		info = L"Constructing " + active_recipe.infotext + L". Waiting for: ";

		for (map<uint,uint>::iterator i = active_recipe.consumed_items.begin();
			i != active_recipe.consumed_items.end(); ++i)
		{
			uint good = i->first;
			uint quantity = i->second;
			
			const GoodInfo *gi = GoodList::find_by_id(good);
			if (gi)
			{
				info += stows(itos(quantity)) + L"x" + HkGetWStringFromIDS(gi->iIDSName) + L" ";
			}
		}
	}

	return info;
}
예제 #3
0
파일: SiegeGun.cpp 프로젝트: dsyalex/FLHook
void Siege::SiegeGunDeploy(uint client, const wstring &args)
{
	// Abort processing if this is not a "heavy lifter"
	uint shiparch;
	pub::Player::GetShipID(client, shiparch);
	if (set_construction_shiparch != 0 && shiparch != set_construction_shiparch)
	{
		PrintUserCmdText(client, L"ERR Need deployment ship");
		return;
	}

	uint ship;
	pub::Player::GetShip(client, ship);
	if (!ship)
	{
		PrintUserCmdText(client, L"ERR Not in space");
		return;
	}

	// If the ship is moving, abort the processing.
	Vector dir1;
	Vector dir2;
	pub::SpaceObj::GetMotion(ship, dir1, dir2);
	if (dir1.x>5 || dir1.y>5 || dir1.z>5)
	{
		PrintUserCmdText(client, L"ERR Ship is moving");
		return;
	}

	int min = 100;
	int max = 5000;
	int randomsiegeint = min + (rand() % (int)(max - min + 1));

	string randomname = "Siege Cannon AX-" + randomsiegeint;

	// Check for conflicting base name
	if (GetPlayerBase(CreateID(PlayerBase::CreateBaseNickname(randomname).c_str())))
	{
		PrintUserCmdText(client, L"ERR Deployment error, please reiterate.");
		return;
	}

	// Check that the ship has the requires commodities.
	int hold_size;
	list<CARGO_INFO> cargo;
	HkEnumCargo((const wchar_t*)Players.GetActiveCharacterName(client), cargo, hold_size);
	for (map<uint, uint>::iterator i = construction_items.begin(); i != construction_items.end(); ++i)
	{
		bool material_available = false;
		uint good = i->first;
		uint quantity = i->second;
		for (list<CARGO_INFO>::iterator ci = cargo.begin(); ci != cargo.end(); ++ci)
		{
			if (ci->iArchID == good && ci->iCount >= (int)quantity)
			{
				material_available = true;
				pub::Player::RemoveCargo(client, ci->iID, quantity);
			}
		}
		if (material_available == false)
		{
			PrintUserCmdText(client, L"ERR Construction failed due to insufficient raw material.");
			for (i = construction_items.begin(); i != construction_items.end(); ++i)
			{
				const GoodInfo *gi = GoodList::find_by_id(i->first);
				if (gi)
				{
					PrintUserCmdText(client, L"|  %ux %s", i->second, HkGetWStringFromIDS(gi->iIDSName).c_str());
				}
			}
			return;
		}
	}

	wstring charname = (const wchar_t*)Players.GetActiveCharacterName(client);
	AddLog("NOTICE: Base created %s by %s (%s)",
		randomname.c_str(),
		wstos(charname).c_str(),
		wstos(HkGetAccountID(HkGetAccountByCharname(charname))).c_str());

	wstring password = L"hastesucks";
	wstring basename = stows(randomname);

	PlayerBase *newbase = new PlayerBase(client, password, basename);
	player_bases[newbase->base] = newbase;
	newbase->basetype = "siegegun";
	newbase->basesolar = "depot";
	newbase->baseloadout = "depot";
	newbase->defense_mode = 1;

	for (map<string, ARCHTYPE_STRUCT>::iterator iter = mapArchs.begin(); iter!=mapArchs.end(); iter++)
	{

		ARCHTYPE_STRUCT &thearch = iter->second;
		if (iter->first == newbase->basetype) 
		{					
			newbase->invulnerable = thearch.invulnerable;
			newbase->logic = thearch.logic;
		}
	}

	newbase->Spawn();
	newbase->Save();

	PrintUserCmdText(client, L"OK: Siege Cannon deployed");
	PrintUserCmdText(client, L"Default administration password is %s", password.c_str());
}