slp13at420
Mad Scientist
in this tutorial I will briefly explain how to turn this:
into this:
On a lot of servers you will see custom ItemExtendedCosts for custom items.
but many ppl don't want to download a patch when they are just scoping out a server.
When they try to purchase a custom item it will return a single error of something they don't have and need . But it wont tell you how much of what you need. kind of a pain in the ,, `neck`. so then the player will farm for the honor points since that's all it tells them they need. then what now I need arena? ugh ok off I go to farm arena for a while . now i'm back and what-the... I need an item now!!! ugh you know if it just told me everything I needed in the first place I could just farm for everything first then return to the vendor for my purchase.
Well I will show you how to make your server do this `Server-Side` in under 5 minutes with some very simple core edits.
We are going to edit \src\server\game\Entities\Player\player.cpp
so go ahead and open your solution and open player.cpp.
Then find the function:
its roughly around line 21,292 about 3/4 of the way down the file.
We will be working inside this function.
Scroll down until you find this `if` block:
this is where it will check for the required extended costs:
Then we will add a line to start off our list of required extended costs :
now we will add a detailed response for each Extended Cost requirement.
for Honor Points price we add a line:
We will keep the responces outside the check so it will allways post what is required and how much even after you have collected enough.
next we will remark out the center-of-screen response:
We will next edit Arena Points price the same way by remarking out the center-of-screen alert:
Again we will do the same thing for Pesonal Arena rating:
and remark out the center-of-screen alert and change the type of return:
Now if you would rather it only list what is left to farm then you would add the detailed responces inside the failed check block so only failed to have enough-for-requirement show as we do here with Honor Points Price:
For items you would place the 2 lines insode the faild check block like so:
Now all you need to do is compile your solution and startup your new updated worldserver.exe
and your players will start seeing:
Enjoy
yeeaaaa my first tut \o/
into this:
On a lot of servers you will see custom ItemExtendedCosts for custom items.
but many ppl don't want to download a patch when they are just scoping out a server.
When they try to purchase a custom item it will return a single error of something they don't have and need . But it wont tell you how much of what you need. kind of a pain in the ,, `neck`. so then the player will farm for the honor points since that's all it tells them they need. then what now I need arena? ugh ok off I go to farm arena for a while . now i'm back and what-the... I need an item now!!! ugh you know if it just told me everything I needed in the first place I could just farm for everything first then return to the vendor for my purchase.
Well I will show you how to make your server do this `Server-Side` in under 5 minutes with some very simple core edits.
We are going to edit \src\server\game\Entities\Player\player.cpp
so go ahead and open your solution and open player.cpp.
Then find the function:
Code:
[COLOR="#808080"]
bool Player::BuyItemFromVendorSlot(ObjectGuid vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot)
[/COLOR]
We will be working inside this function.
Scroll down until you find this `if` block:
Code:
[COLOR="#808080"]
if (crItem->ExtendedCost)
[/COLOR]
this is where it will check for the required extended costs:
Then we will add a line to start off our list of required extended costs :
Code:
[COLOR="#808080"]
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 false;
}
[COLOR="#DAA520"]
ChatHandler(GetSession()).PSendSysMessage("The `%s` requires:", pProto->Name1);
[/COLOR]
[/COLOR]
now we will add a detailed response for each Extended Cost requirement.
for Honor Points price we add a line:
Code:
[COLOR="#808080"]
ChatHandler(GetSession()).PSendSysMessage("The `%s` requires:", pProto->Name1);
[COLOR="#DAA520"]
if ((iece->reqhonorpoints * count) > 0) { ChatHandler(GetSession()).PSendSysMessage("Honor Points - %u/%u", GetHonorPoints(), (iece->reqhonorpoints * count)); };
if ((iece->reqarenapoints * count) > 0) { ChatHandler(GetSession()).PSendSysMessage("Arena Points - %u/%u", GetArenaPoints(), (iece->reqarenapoints * count)); };
if ((iece->reqpersonalarenarating) > 0) { ChatHandler(GetSession()).PSendSysMessage("Personal Arena Rating - %u/%u", GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot), (iece->reqpersonalarenarating)); };
for (uint8 i = 0; i < MAX_ITEM_EXTENDED_COST_REQUIREMENTS; ++i)
{
ItemTemplate const* iItem = sObjectMgr->GetItemTemplate(iece->reqitem[i]);
if (iItem) { ChatHandler(GetSession()).PSendSysMessage("%s - %u/%u", iItem->Name1, GetItemCount(iece->reqitem[i]), (iece->reqitemcount[i] * count)); };
}
[/COLOR]
// honor points price
[/COLOR]
next we will remark out the center-of-screen response:
Code:
[COLOR="#808080"]
// honor points price
if (GetHonorPoints() < (iece->reqhonorpoints * count))
{
[COLOR="#FFD700"]//[/COLOR]SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, NULL);
return false;
}
[/COLOR]
We will next edit Arena Points price the same way by remarking out the center-of-screen alert:
Code:
[COLOR="#808080"]
// arena points price
if (GetArenaPoints() < (iece->reqarenapoints * count))
{
[COLOR="#FFD700"]//[/COLOR]SendEquipError(EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, NULL, NULL);
return false;
}
[/COLOR]
Again we will do the same thing for Pesonal Arena rating:
Code:
[COLOR="#808080"]
// check for personal arena rating requirement
if (GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating)
{
// probably not the proper equip err
[COLOR="#FFD700"]//[/COLOR]SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, NULL, NULL);
return false;
}
[/COLOR]
and remark out the center-of-screen alert and change the type of return:
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);
return false;
}
}
[/COLOR]
Now if you would rather it only list what is left to farm then you would add the detailed responces inside the failed check block so only failed to have enough-for-requirement show as we do here with Honor Points Price:
Code:
[COLOR="#808080"]
// honor points price
if (GetHonorPoints() < (iece->reqhonorpoints * count))
{
[COLOR="#FFD700"]if ((iece->reqhonorpoints * count) > 0){ ChatHandler(GetSession()).PSendSysMessage("%u Honor Points.", (iece->reqhonorpoints * count)); };[/COLOR]
//SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, NULL);
return false;
}
[/COLOR]
For items you would place the 2 lines insode the faild check block like so:
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][COLOR="#FFD700"]ItemTemplate const* iItem = sObjectMgr->GetItemTemplate(iece->reqitem[i]);
if (iItem){ ChatHandler(GetSession()).PSendSysMessage("%u %s`s.", (iece->reqitemcount[i] * count), iItem->Name1); };[/COLOR]
[COLOR="#FFD700"]//[/COLOR]SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, NULL);
return false;
}
}
[/COLOR]
Now all you need to do is compile your solution and startup your new updated worldserver.exe
and your players will start seeing:
Enjoy
yeeaaaa my first tut \o/
Last edited: