• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] CustomExtendedCosts

Status
Not open for further replies.

Lstm

Respected Member
Really, now I do not know if added in the script npc vendor that is custom also to make a check on the item and set the value of it or whether it was right on the source
 

slp13at420

Mad Scientist
If its never been seen on other servers then I would assume its a custom job for patchless custom costs.

but this is what your looking for:
7o3RtFf.png




and everyones going to get a good laugh when I show just how I just did this :)



delete the lines you added then scroll down a little bit until you find:
Code:
[COLOR="#808080"]
        // honor points price
		if (GetHonorPoints() < (iece->reqhonorpoints * count))
		{
			SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, NULL);
			return false;
		}
[/COLOR]

then replace with:
Code:
[COLOR="#808080"]
        // honor points price
		if (GetHonorPoints() < (iece->reqhonorpoints * count))
		{
[COLOR="#FFD700"]//[/COLOR]			SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, NULL);
			[COLOR="#FFD700"]ChatHandler(GetSession()).PSendSysMessage("The `%s` requires %u Honor Points.", pProto->Name1, (iece->reqhonorpoints * count));[/COLOR]
			return false;
		}
[/COLOR]

you can leave the `SendEquipError` un-remarked so you can continue to get the center-of-the-screen error.

And this will post like this for all the custom extended costs.

I added the name to the prompt today lol saw it just forgot to add it.

so basically I remarked 1 line:
Code:
[COLOR="#808080"]
//			SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, NULL);
[/COLOR]

and added 1 line:
Code:
[COLOR="#808080"]
			ChatHandler(GetSession()).PSendSysMessage("The `%s` requires %u Honor Points.", pProto->Name1, (iece->reqhonorpoints * count));
[/COLOR]

with name added:
DRDNBQg.png


again, you can add this to the other prices : arena points, arena rating, reputation faction...


Arena Points Price:
Code:
[COLOR="#808080"]
        // arena points price
        if (GetArenaPoints() < (iece->reqarenapoints * count))
        {
[COLOR="#FFD700"]//[/COLOR]			SendEquipError(EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, NULL, NULL);
[COLOR="#FFD700"]			ChatHandler(GetSession()).PSendSysMessage("The `%s` requires %u Arena Points.", pProto->Name1, (iece->reqarenapoints * count));[/COLOR]
			return false;
        }
[/COLOR]


require item will be handle a lil bit differently:

g3wZszm.png


Code:
[COLOR="#808080"]
        // item base price
        for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
        {
            if (iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count)))
            {
[COLOR="#FFD700"]//[/COLOR]				SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL);				
[COLOR="#FFD700"]				ItemTemplate const* item = sObjectMgr->GetItemTemplate(iece->reqitem[i]);[/COLOR]
				[COLOR="#FFD700"]ChatHandler(GetSession()).PSendSysMessage("The `%s` requires %u %s.", pProto->Name1, (iece->reqitemcount[i] * count), item->Name1);[/COLOR]
				return false;
            }
        }
[/COLOR]




you can also make that block of code "if (crItem->ExtendedCost)" to list everything rather than one at a time (player gets the required count of item then sees it now tells them it requires something else). it will tell you the first required but none of the rest due to the return false; but that can be rewrote to allow it to continue and check for the rest of the extendedcost requirements and Then return false/true.

R7qaO7s.png


Code:
[COLOR="#808080"]
    if (crItem->ExtendedCost)
    {
		bool return_type = true;
        ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost);
        if (!iece)
        {
            TC_LOG_ERROR("entities.player", "Item %u has wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost);
			return_type = false;
        }

        // honor points price
		if (GetHonorPoints() < (iece->reqhonorpoints * count))
		{
//			SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, NULL);
			ChatHandler(GetSession()).PSendSysMessage("The `%s` requires %u Honor Points.", pProto->Name1, (iece->reqhonorpoints * count));
			return_type = false;
		}

        // arena points price
        if (GetArenaPoints() < (iece->reqarenapoints * count))
        {
//			SendEquipError(EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, NULL, NULL);
			ChatHandler(GetSession()).PSendSysMessage("The `%s` requires %u Arena Points.", pProto->Name1, (iece->reqarenapoints * count));
			return_type = false;
        }

        // item base price
        for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
        {
            if (iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count)))
            {
//				SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL);
				ItemTemplate const* item = sObjectMgr->GetItemTemplate(iece->reqitem[i]);
				ChatHandler(GetSession()).PSendSysMessage("The `%s` requires %u %s.", pProto->Name1, (iece->reqitemcount[i] * count), item->Name1);
				return_type = false;
            }
        }

        // check for personal arena rating requirement
        if (GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating)
        {
            // probably not the proper equip err
//			SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, NULL, NULL);
			ChatHandler(GetSession()).PSendSysMessage("The `%s` requires %u Personal Arena Rating.", pProto->Name1, iece->reqpersonalarenarating);
			return_type = false;
        }
		return return_type;
    }
[/COLOR]



and mike drop, exit stage left. ;p
 
Last edited:

Lstm

Respected Member
Wow, I'm speechless ... it was exactly what I was looking for thanks again for the support, speechless!
:clap2: :clap2: :clap2: :clap2: :clap2: :clap2:
 

slp13at420

Mad Scientist
Wow, I'm speechless ... it was exactly what I was looking for thanks again for the support, speechless!
:clap2: :clap2: :clap2: :clap2: :clap2: :clap2:

no prob :) Enjoy :)

I may continue to clean this up and then make a little tutorial for this mod :tongue (2):




I also moved this thread to TrinityCore support client customization since its not related to Eluna and it seams more client related rather than scripting or core.

Also closed thread due to issue solved.
 
Last edited:
Status
Not open for further replies.
Top