Hey
After i moved to Trinitycore, a few of my scripts wouldn't work.. and i've been trying to find a way to make them work so decided to come here and ask if people can do a conversion for me...
-- VIP Only Gear
Script
Code:
// VIP ITEM STUFF
QueryResult * resultVipCheck = CharacterDatabase.Query("SELECT vip_level FROM logon.accounts WHERE acct='%u'", m_pOwner->GetSession()->GetAccountId());
QueryResult * resultItemCheck = WorldDatabase.Query("SELECT vip_lvl FROM vip_items WHERE itemid='%u'", proto->ItemId);
if(!resultItemCheck)
return false;
do
{
Field * VipCheck = resultVipCheck->Fetch(); // resulted vip level int
Field * ItemCheck = resultItemCheck->Fetch(); // resulted vip level required for item int
if(ItemCheck[0].GetUInt32() == ItemCheck[0].GetUInt32()) // if item has vip lvl
{
if(VipCheck[0].GetUInt32() == 0)
return INV_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
if(VipCheck[0].GetUInt32() == ItemCheck[0].GetUInt32())
{}
else
return INV_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;
}
}while(resultItemCheck->NextRow());
// VIP ITEM STUFF
SQL
Code:
DROP TABLE IF EXISTS `vip_items`;
CREATE TABLE IF NOT EXISTS `vip_items` (
`itemid` int(10) NOT NULL,
`vip_lvl` int(10) DEFAULT '0',
PRIMARY KEY (`itemid`),
UNIQUE KEY `itemid` (`itemid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='The stored table for vip items';
Whats supposed to happen?
Items listed in the "vip_items" require somoneones account in "logon" (Arc) to have a "1" inside vip_level or they cannot equip the item
- Need it to happen but the script to be converted to TrinityCore
-- Custom Error message
script
Code:
// VIP VENDOR STUFF
if((error = _player->GetItemInterface()->CanAffordItem(it, amount, unit)) != 0)
{
QueryResult * resultVendorString = WorldDatabase.Query("SELECT string FROM vip_vendors WHERE npc_id='%u'", unit->GetEntry());
QueryResult * resultSideString = WorldDatabase.Query("SELECT side FROM vip_vendors WHERE npc_id='%u'", unit->GetEntry());
if(!resultVendorString)
{
_player->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, error);
return;
}
else
{
Field * VendorString = resultVendorString->Fetch();
Field * SideString = resultSideString->Fetch();
if(SideString[0].GetUInt32() == 1) // if chatbox
{
_player->BroadcastMessage("%s", VendorString->GetString());
}
if(SideString[0].GetUInt32() == 2) // if area trigger
{
_player->SendAreaTriggerMessage("%s", VendorString->GetString());
}
if(SideString[0].GetUInt32() == 3) // if both sides
{
_player->BroadcastMessage("%s", VendorString->GetString());
_player->SendAreaTriggerMessage("%s", VendorString->GetString());
}
return;
}
}
// VIP VENDOR STUFF
SQL
Code:
DROP TABLE IF EXISTS `vip_vendors`;
CREATE TABLE IF NOT EXISTS `vip_vendors` (
`npc_id` int(10) NOT NULL DEFAULT '0',
`string` varchar(255) DEFAULT 'default string; please edit',
`side` int(11) NOT NULL DEFAULT '1' COMMENT '1: chatbox, 2: area trigger, 3: both sides'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Whats supposed to happen?
When a player tries to buy an item (listed in vip_vendor) without having the required item, it will post up a string, depending on the "side" 1 being chat box, 2 being an area trigger and 3 being both ..
-- Willing to pay for the conversion (10-15$) since they'll both be released, and maybe a skyfire conversion..
Thanks