Skocz do zawartości

Featured Replies

Opublikowano

Jeśli chodzi o estetykę moim zdaniem średnio to wygląda, już lepiej jakby bg było oryginalnie i obok napisu Ekwipunek ikonka sortowania ale to tylko moja opinia i to kwestia kosmetyczna.

Opublikowano
6 minut temu, Tuike napisał(a):

Jeśli chodzi o estetykę moim zdaniem średnio to wygląda, już lepiej jakby bg było oryginalnie i obok napisu Ekwipunek ikonka sortowania ale to tylko moja opinia i to kwestia kosmetyczna.

aa widze Nerwia style XD

Opublikowano
1 minutę temu, ARK napisał(a):

aa widze Nerwia style XD

Ajj nigdy nie grałem na Nerwii chociaż miałem chęć ;d
Jakoś taki styl bardziej wydaje mi się estetyczny.

  • 3 tygodnie później...
  • 2 tygodnie później...
  • 3 miesiące temu...
  • 2 tygodnie później...
Opublikowano
8 godzin temu, ExoCarossa napisał(a):

coś więcej? :o

Warunki są tak dobrze napisane, że w przypadku autopotek zużytych prawie do zera przywraca ich wartości do full.

10 godzin temu, WhiteBambo88 napisał(a):

Fajny sposób na nieskończone auto potki xD

Może też zbugować wiele innych rzeczy :D

Warto też wspomnieć o "wycieku pamięci", który tutaj występuje

Edytowane przez KoYGeR

Opublikowano

Teraz powinno nie być kopiowania. Nie sprawdzałem, możecie dać znać


void CHARACTER::SortInventoryItems()
{
    if (IsDead() || GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
    {
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please close other windows before sorting your inventory."));
        return;
    }

    int lastSortInventoryPulse = GetSortInventoryPulse();
    int iPulse = thecore_pulse();

    if (lastSortInventoryPulse > iPulse)
    {
        int deltaInSeconds = ((lastSortInventoryPulse / PASSES_PER_SEC(1)) - (iPulse / PASSES_PER_SEC(1)));
        int minutes = deltaInSeconds / 60;
        int seconds = (deltaInSeconds - (minutes * 60));

        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please wait %d seconds to sort your inventory again."), seconds);
        return;
    }

    static std::vector<LPITEM> v;
    v.clear();

    LPITEM item;
    int size = INVENTORY_MAX_NUM;

   
    SetPosition(POS_FIGHTING);

    for (int i = 0; i < size; ++i)
    {
        if (!(item = GetInventoryItem(i)))
            continue;

        v.push_back(item);
        item->RemoveFromCharacter();
    }

    std::sort(v.begin(), v.end(), [](const LPITEM& a, const LPITEM& b)
    {
        return std::string(a->GetName()) < std::string(b->GetName());
    });

    for (auto& it : v)
    {
        if (it)
            AutoGiveItem(it, false);
    }

   
    SetSortInventoryPulse(thecore_pulse() + PASSES_PER_SEC(10));

   
    SetPosition(POS_STANDING);

    
    Save();

    ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Your inventory items have been sorted."));
}

jeszcze tutaj

void CHARACTER::SortInventoryItems()
{
	int lastSortInventoryPulse = GetSortInventoryPulse();
	int iPulse = thecore_pulse();

	if (lastSortInventoryPulse > iPulse)
	{
		int deltaInSeconds = ((lastSortInventoryPulse / PASSES_PER_SEC(1)) - (iPulse / PASSES_PER_SEC(1)));
		int minutes = deltaInSeconds / 60;
		int seconds = (deltaInSeconds - (minutes * 60));

		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please wait %d seconds to sort your inventory again."), seconds);
		return;
	}

	if (IsDead() || GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please close other windows before sorting your inventory."));
		return;
	}


	SetPosition(POS_FIGHTING);

	static std::vector<LPITEM> v;
	v.clear();

	LPITEM item;
	int size = INVENTORY_MAX_NUM;

	for (int i = 0; i < size; ++i)
	{
		if (!(item = GetInventoryItem(i)))
			continue;

		v.push_back(item);

		item->RemoveFromCharacter();
	}

	
	std::sort(v.begin(), v.end(), [](const LPITEM& a, const LPITEM& b)
	{
		return std::string(a->GetName()) < std::string(b->GetName());
	});

	for (auto& it : v)
	{
		if (it)
		{
		
			AutoGiveItem(it, false);
		}
	}

	SetSortInventoryPulse(thecore_pulse() + PASSES_PER_SEC(10));
	SetPosition(POS_STANDING);


	Save();

	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Your inventory items have been sorted."));
}

Edytowane przez MalikOo

Opublikowano
4 godziny temu, MalikOo napisał(a):

Teraz powinno nie być kopiowania. Nie sprawdzałem, możecie dać znać


void CHARACTER::SortInventoryItems()
{
    if (IsDead() || GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
    {
        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please close other windows before sorting your inventory."));
        return;
    }

    int lastSortInventoryPulse = GetSortInventoryPulse();
    int iPulse = thecore_pulse();

    if (lastSortInventoryPulse > iPulse)
    {
        int deltaInSeconds = ((lastSortInventoryPulse / PASSES_PER_SEC(1)) - (iPulse / PASSES_PER_SEC(1)));
        int minutes = deltaInSeconds / 60;
        int seconds = (deltaInSeconds - (minutes * 60));

        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please wait %d seconds to sort your inventory again."), seconds);
        return;
    }

    static std::vector<LPITEM> v;
    v.clear();

    LPITEM item;
    int size = INVENTORY_MAX_NUM;

   
    SetPosition(POS_FIGHTING);

    for (int i = 0; i < size; ++i)
    {
        if (!(item = GetInventoryItem(i)))
            continue;

        v.push_back(item);
        item->RemoveFromCharacter();
    }

    std::sort(v.begin(), v.end(), [](const LPITEM& a, const LPITEM& b)
    {
        return std::string(a->GetName()) < std::string(b->GetName());
    });

    for (auto& it : v)
    {
        if (it)
            AutoGiveItem(it, false);
    }

   
    SetSortInventoryPulse(thecore_pulse() + PASSES_PER_SEC(10));

   
    SetPosition(POS_STANDING);

    
    Save();

    ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Your inventory items have been sorted."));
}

jeszcze tutaj

void CHARACTER::SortInventoryItems()
{
	int lastSortInventoryPulse = GetSortInventoryPulse();
	int iPulse = thecore_pulse();

	if (lastSortInventoryPulse > iPulse)
	{
		int deltaInSeconds = ((lastSortInventoryPulse / PASSES_PER_SEC(1)) - (iPulse / PASSES_PER_SEC(1)));
		int minutes = deltaInSeconds / 60;
		int seconds = (deltaInSeconds - (minutes * 60));

		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please wait %d seconds to sort your inventory again."), seconds);
		return;
	}

	if (IsDead() || GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please close other windows before sorting your inventory."));
		return;
	}


	SetPosition(POS_FIGHTING);

	static std::vector<LPITEM> v;
	v.clear();

	LPITEM item;
	int size = INVENTORY_MAX_NUM;

	for (int i = 0; i < size; ++i)
	{
		if (!(item = GetInventoryItem(i)))
			continue;

		v.push_back(item);

		item->RemoveFromCharacter();
	}

	
	std::sort(v.begin(), v.end(), [](const LPITEM& a, const LPITEM& b)
	{
		return std::string(a->GetName()) < std::string(b->GetName());
	});

	for (auto& it : v)
	{
		if (it)
		{
		
			AutoGiveItem(it, false);
		}
	}

	SetSortInventoryPulse(thecore_pulse() + PASSES_PER_SEC(10));
	SetPosition(POS_STANDING);


	Save();

	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Your inventory items have been sorted."));
}

Teraz trochę dobrych praktyk:

void CHARACTER::SortInventoryItems()
{
	const uint32_t& last_inventory_sort_pulse = GetSortInventoryPulse();
	const uint32_t& cur_pulse = thecore_pulse();

	if (cur_pulse < last_inventory_sort_pulse)
	{
		const uint32_t& left_seconds = static_cast<uint32_t>((last_inventory_sort_pulse - cur_pulse) / PASSES_PER_SEC(1));
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please wait %d seconds to sort your inventory again."), left_seconds);
		return;
	}

	if (IsDead() || GetExchange() || GetMyShop() || GetShopOwner() || IsOpenSafebox() || IsCubeOpen())
	{
		ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Please close other windows before sorting your inventory."));
		return;
	}

	std::vector<LPITEM> v;
	LPITEM item;
	for (uint16_t i = 0; i < INVENTORY_MAX_NUM; ++i)
	{
		if ((item = GetInventoryItem(i)))
		{
			v.push_back(item);
			item->RemoveFromCharacter();
		}
	}

	std::sort(v.begin(), v.end(), [](const LPITEM& a, const LPITEM& b)
	{
		return std::string(a->GetName()) < std::string(b->GetName());
	});

	for (auto& it : v)
		AutoGiveItem(it, false);

	ChatPacket(CHAT_TYPE_INFO, LC_TEXT("Your inventory items have been sorted."));
	SetSortInventoryPulse(cur_pulse + PASSES_PER_SEC(10));
}

Dołącz do dyskusji

Możesz dodać zawartość już teraz a zarejestrować się później. Jeśli posiadasz już konto, zaloguj się aby dodać zawartość za jego pomocą.

Gość
Dodaj odpowiedź do tematu...