Jump to content

Pet Slot System


Recommended Posts

  • Moderator
Spoiler

void CPetActor::SetName()
{
	std::string petName = m_pkOwner->GetName();

	if (true == IsSummoned() && m_dwVnum == 34025)
	{
		petName += " - |cFFFF0049|H|hPhoenix de Foc";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34010)
	{
		petName += " - |cFFc9ff00|H|hBambi";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34003)
	{
		petName += " - |cFF009DFF|H|hPhoenix de Gheata";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34004)
	{
		petName += " - |cFF732222|H|hMicul Azrael";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34005)
	{
		petName += " - |cFF528508|H|hPorcusor";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34006)
	{
		petName += " - |cFF528508|H|hRufus";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34007)
	{
		petName += " - |cFF528508|H|hKhan";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34008)
	{
		petName += " - |cFF528508|H|hLeonidas";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34009)
	{
		petName += " - |cFFDCE627|H|hMicul Azrael (Aur)";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34011)
	{
		petName += " - |cFF009DFF|H|hKnuud";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34012)
	{
		petName += " - |cFF009DFF|H|hBao Bao";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34013)
	{
		petName += " - |cFF732222|H|hMini Executor";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34014)
	{
		petName += " - |cFFDCE627|H|hMini Executor (Aur)";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34015)
	{
		petName += " - |cFFc9ff00|H|hBoney";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34016)
	{
		petName += " - |cFFA1C718|H|hPhoenix de Jad";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34017)
	{
		petName += " - |cFF109EC7|H|hPorkie Polar";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34019)
	{
		petName += " - |cFF109EC7|H|hArctis Khan";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34020)
	{
		petName += " - |cFF109EC7|H|hLeonidas Alb";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34021)
	{
		petName += " - |cFFc9ff00|H|hSheldon";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34022)
	{
		petName += " - |cFFc9ff00|H|hChooper";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34023)
	{
		petName += " - |cFFC97D87|H|hPui de Pantera";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34028)
	{
		petName += " - |cFF109EC7|H|hFulg de Nea";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34029)
	{
		petName += " - |cFF109EC7|H|hClopotel de Nea";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34030)
	{
		petName += " - |cFFF42B07|H|hElf Rosu";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34031)
	{
		petName += " - |cFF34962B|H|hElf Verde";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34032)
	{
		petName += " - |cFF6B6B6B|H|hJiangshi Junior";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34033)
	{
		petName += " - |cFF237A00|H|hMr Jiangshi";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34034)
	{
		petName += " - |cFF16ACB8|H|hShiver";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34035)
	{
		petName += " - |cFF16ACB8|H|hSnivel";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34036)
	{
		petName += " - |cFFA210AB|H|hLiliacul Bruce";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34037)
	{
		petName += " - |cFFA210AB|H|hLiliacul Wayne";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34038)
	{
		petName += " - |cFF77B8EA|H|hRamblue";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34039)
	{
		petName += " - |cFFD58DEE|H|hEweriel";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34040)
	{
		petName += " - |cFF732222|H|hMicul Huashin";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34100)
	{
		petName += " - |cFFE13066|H|hSemiluna Rosie";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34101)
	{
		petName += " - |cFF6271E3|H|hSemiluna Albastra";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34102)
	{
		petName += " - |cFFE13066|H|hLanterna Rosie";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34103)
	{
		petName += " - |cFF6271E3|H|hLanterna Albastra";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34104)
	{
		petName += " - |cFFF91ECE|H|hValentinia";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34105)
	{
		petName += " - |cFF6271E3|H|hValentino";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34106)
	{
		petName += " - |cFFE13066|H|hAmoras";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34107)
	{
		petName += " - |cFFE13066|H|hInima Iute";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34108)
	{
		petName += " - |cFF13A575|H|hBonsai";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34109)
	{
		petName += " - |cFF13A575|H|hDonnie";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34110)
	{
		petName += " - |cFF13A575|H|hBonnie";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned())
	{
		petName += " Companiot";
		
		m_pkChar->SetName(petName);
	}

	m_name = petName;
}

 

You could do it with a map.

Hidden Content

    Give reaction to this post to see the hidden content.

Also you could use my C++ library (there exists python too) for coloring a string, much easier.

#include "cff.h"
std::string text = CFF::format("Metin2", "green");
std::string text = CFF::format(std::to_string(8000), "banana");
std::string text = CFF::format(std::to_string(412.55), "red");
std::string text = CFF::format("Pending", "#113355");
std::string text = CFF::format("Item name:", "springgreen", CFF::FLAG_NEW_TAB) + CFF::format(pItemData->GetName(), "chocolate");

std::vector<string> text = CFF::multi_format({"a", "b", "c"}, "red"); // text[0], text[1], text[2]

 

Edited by VegaS™
  • Metin2 Dev 2
  • Love 6
  • Good 2
  • Lmao 1
Link to post
void CPetActor::SetName()
{
	char buf[64];
	if (0 != m_pkOwner && 0 != m_pkOwner->GetName())
		snprintf(buf, sizeof(buf), "%s - %s", m_pkOwner->GetName(), m_pkChar->GetMobTable().szLocaleName);
	else
		snprintf(buf, sizeof(buf), "%s", m_pkChar->GetMobTable().szLocaleName);

	if (true == IsSummoned())
		m_pkChar->SetName(buf);
	
	m_name = buf;
}

 

Link to post
  • 2 weeks later...
On 12/12/2019 at 12:43 AM, VegaS™ said:
  Reveal hidden contents

void CPetActor::SetName()
{
	std::string petName = m_pkOwner->GetName();

	if (true == IsSummoned() && m_dwVnum == 34025)
	{
		petName += " - |cFFFF0049|H|hPhoenix de Foc";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34010)
	{
		petName += " - |cFFc9ff00|H|hBambi";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34003)
	{
		petName += " - |cFF009DFF|H|hPhoenix de Gheata";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34004)
	{
		petName += " - |cFF732222|H|hMicul Azrael";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34005)
	{
		petName += " - |cFF528508|H|hPorcusor";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34006)
	{
		petName += " - |cFF528508|H|hRufus";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34007)
	{
		petName += " - |cFF528508|H|hKhan";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34008)
	{
		petName += " - |cFF528508|H|hLeonidas";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34009)
	{
		petName += " - |cFFDCE627|H|hMicul Azrael (Aur)";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34011)
	{
		petName += " - |cFF009DFF|H|hKnuud";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34012)
	{
		petName += " - |cFF009DFF|H|hBao Bao";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34013)
	{
		petName += " - |cFF732222|H|hMini Executor";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34014)
	{
		petName += " - |cFFDCE627|H|hMini Executor (Aur)";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34015)
	{
		petName += " - |cFFc9ff00|H|hBoney";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34016)
	{
		petName += " - |cFFA1C718|H|hPhoenix de Jad";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34017)
	{
		petName += " - |cFF109EC7|H|hPorkie Polar";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34019)
	{
		petName += " - |cFF109EC7|H|hArctis Khan";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34020)
	{
		petName += " - |cFF109EC7|H|hLeonidas Alb";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34021)
	{
		petName += " - |cFFc9ff00|H|hSheldon";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34022)
	{
		petName += " - |cFFc9ff00|H|hChooper";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34023)
	{
		petName += " - |cFFC97D87|H|hPui de Pantera";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34028)
	{
		petName += " - |cFF109EC7|H|hFulg de Nea";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34029)
	{
		petName += " - |cFF109EC7|H|hClopotel de Nea";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34030)
	{
		petName += " - |cFFF42B07|H|hElf Rosu";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34031)
	{
		petName += " - |cFF34962B|H|hElf Verde";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34032)
	{
		petName += " - |cFF6B6B6B|H|hJiangshi Junior";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34033)
	{
		petName += " - |cFF237A00|H|hMr Jiangshi";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34034)
	{
		petName += " - |cFF16ACB8|H|hShiver";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34035)
	{
		petName += " - |cFF16ACB8|H|hSnivel";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34036)
	{
		petName += " - |cFFA210AB|H|hLiliacul Bruce";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34037)
	{
		petName += " - |cFFA210AB|H|hLiliacul Wayne";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34038)
	{
		petName += " - |cFF77B8EA|H|hRamblue";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34039)
	{
		petName += " - |cFFD58DEE|H|hEweriel";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34040)
	{
		petName += " - |cFF732222|H|hMicul Huashin";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34100)
	{
		petName += " - |cFFE13066|H|hSemiluna Rosie";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34101)
	{
		petName += " - |cFF6271E3|H|hSemiluna Albastra";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34102)
	{
		petName += " - |cFFE13066|H|hLanterna Rosie";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34103)
	{
		petName += " - |cFF6271E3|H|hLanterna Albastra";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34104)
	{
		petName += " - |cFFF91ECE|H|hValentinia";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34105)
	{
		petName += " - |cFF6271E3|H|hValentino";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34106)
	{
		petName += " - |cFFE13066|H|hAmoras";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34107)
	{
		petName += " - |cFFE13066|H|hInima Iute";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34108)
	{
		petName += " - |cFF13A575|H|hBonsai";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34109)
	{
		petName += " - |cFF13A575|H|hDonnie";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned() && m_dwVnum == 34110)
	{
		petName += " - |cFF13A575|H|hBonnie";
		
		m_pkChar->SetName(petName);
	}
	else if (true == IsSummoned())
	{
		petName += " Companiot";
		
		m_pkChar->SetName(petName);
	}

	m_name = petName;
}

 

You could do it with a map.

#include "cff.h"
using TPetName = std::map<uint32_t, std::tuple<std::string, std::string>>;
static const TPetName map_pet_names =
{
	{ 34003, {"Phoenix de Gheata", "#009DFF"} },
	{ 34004, {"Micul Azrael", "#732222"} },
	{ 34005, {"Porcusor", "#528508"} },
};

void CPetActor::SetName()
{
	std::string& stPetName = m_pkOwner->GetName();
	const auto& it = map_pet_names.find(m_dwVnum);
	if (it != map_pet_names.end())
		stPetName.append(CFF::format(std::get<0>(it->second), std::get<1>(it->second)));
	
	m_pkChar->SetName(stPetName);
}

Also you could use my C++ library (there exists python too) for coloring a string, much easier.

#include "cff.h"
std::string text = CFF::format("Metin2", "green");
std::string text = CFF::format(std::to_string(8000), "banana");
std::string text = CFF::format(std::to_string(412.55), "red");
std::string text = CFF::format("Pending", "#113355");
std::string text = CFF::format("Item name:", "springgreen", CFF::FLAG_NEW_TAB) + CFF::format(pItemData->GetName(), "chocolate");

std::vector<string> text = CFF::multi_format({"a", "b", "c"}, "red"); // text[0], text[1], text[2]

 

computepoints(); on this system Why is it used? Does the need to use?

Link to post
  • 1 year later...
On 12/11/2019 at 10:43 PM, VegaS™ said:

You could do it with a map.

Hidden Content

 

#include "cff.h"
using TPetName = std::map<uint32_t, std::tuple<std::string, std::string>>;
static const TPetName map_pet_names =
{
	{ 34003, {"Phoenix de Gheata", "#009DFF"} },
	{ 34004, {"Micul Azrael", "#732222"} },
	{ 34005, {"Porcusor", "#528508"} },
};

void CPetActor::SetName()
{
	std::string& stPetName = m_pkOwner->GetName();
	const auto& it = map_pet_names.find(m_dwVnum);
	if (it != map_pet_names.end())
		stPetName.append(CFF::format(std::get<0>(it->second), std::get<1>(it->second)));
	
	m_pkChar->SetName(stPetName);
}

 

 

And how could this be made without the color part?

Just like this for example:

{
    { 34003, {"Phoenix de Gheata"} },
    { 34004, {"Micul Azrael"} },
    { 34005, {"Porcusor"} },
};

Link to post
  • Moderator
Posted (edited)
34 minutes ago, Cripplez said:

And how could this be made without the color part?

Just like this for example:

{
    { 34003, {"Phoenix de Gheata"} },
    { 34004, {"Micul Azrael"} },
    { 34005, {"Porcusor"} },
};

Replace: (default function)

void CPetActor::SetName(const char* name)
{
	std::string petName = m_pkOwner->GetName();

	if (0 != m_pkOwner && 0 == name && 0 != m_pkOwner->GetName())
	{
		petName += "'s Pet";
	}
	else
		petName += name;

	if (true == IsSummoned())
		m_pkChar->SetName(petName);

	m_name = petName;
}

With:

void CPetActor::SetName(const char* name)
{
	if (!m_pkOwner || !m_pkChar)
		return;
	
	char petName[CHARACTER_NAME_MAX_LEN * 2 + 1];
	snprintf(petName, sizeof(petName), "%s - %s", m_pkOwner->GetName(), m_pkChar->GetName());
	if (IsSummoned())
		m_pkChar->SetName(petName);
}

 

Edited by VegaS™
  • Love 1
  • Good 1
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.