Removing multi-vendor Rochet2 patch

It caused compilation errors too
This commit is contained in:
yehonal 2016-06-27 00:19:46 +02:00
parent f6eefedcd5
commit bf139c3d34
8 changed files with 11 additions and 74 deletions

View file

@ -14584,8 +14584,8 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
break; break;
case GOSSIP_OPTION_VENDOR: case GOSSIP_OPTION_VENDOR:
{ {
VendorItemData const* vendorItems = itr->second.ActionMenuId ? nullptr : creature->GetVendorItems(); VendorItemData const* vendorItems = creature->GetVendorItems();
if (!itr->second.ActionMenuId && (!vendorItems || vendorItems->Empty())) if (!vendorItems || vendorItems->Empty())
{ {
sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry()); sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
canTalk = false; canTalk = false;
@ -14759,7 +14759,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
break; break;
case GOSSIP_OPTION_VENDOR: case GOSSIP_OPTION_VENDOR:
case GOSSIP_OPTION_ARMORER: case GOSSIP_OPTION_ARMORER:
GetSession()->SendListInventory(guid, menuItemData->GossipActionMenuId); GetSession()->SendListInventory(guid);
break; break;
case GOSSIP_OPTION_STABLEPET: case GOSSIP_OPTION_STABLEPET:
GetSession()->SendStablePet(guid); GetSession()->SendStablePet(guid);
@ -21533,8 +21533,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
return false; return false;
} }
VendorItemData const* vItems = creature->GetVendorItems();
VendorItemData const* vItems = GetSession()->GetCurrentVendor() ? sObjectMgr->GetNpcVendorItemList(GetSession()->GetCurrentVendor()) : creature->GetVendorItems();
if (!vItems || vItems->Empty()) if (!vItems || vItems->Empty())
{ {
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0); SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);

View file

@ -8540,9 +8540,8 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, bool persist /*= tru
return true; return true;
} }
bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* player, std::set<uint32>* /*skip_vendors*/, uint32 /*ORnpcflag*/) const bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* player, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
{ {
/*
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry); CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
if (!cInfo) if (!cInfo)
{ {
@ -8567,7 +8566,6 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
} }
return false; return false;
} }
*/
if (!sObjectMgr->GetItemTemplate(item_id)) if (!sObjectMgr->GetItemTemplate(item_id))
{ {

View file

@ -724,7 +724,7 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket & recvData)
SendListInventory(guid); SendListInventory(guid);
} }
void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry) void WorldSession::SendListInventory(uint64 vendorGuid)
{ {
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LIST_INVENTORY"); ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LIST_INVENTORY");
@ -744,9 +744,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry)
if (vendor->HasUnitState(UNIT_STATE_MOVING)) if (vendor->HasUnitState(UNIT_STATE_MOVING))
vendor->StopMoving(); vendor->StopMoving();
SetCurrentVendor(vendorEntry); VendorItemData const* items = vendor->GetVendorItems();
VendorItemData const* items = vendorEntry ? sObjectMgr->GetNpcVendorItemList(vendorEntry) : vendor->GetVendorItems();
if (!items) if (!items)
{ {
WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + 1); WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + 1);

View file

@ -101,7 +101,7 @@ m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerSave(fa
m_sessionDbcLocale(sWorld->GetDefaultDbcLocale()), m_sessionDbcLocale(sWorld->GetDefaultDbcLocale()),
m_sessionDbLocaleIndex(locale), m_sessionDbLocaleIndex(locale),
m_latency(0), m_clientTimeDelay(0), m_TutorialsChanged(false), recruiterId(recruiter), m_latency(0), m_clientTimeDelay(0), m_TutorialsChanged(false), recruiterId(recruiter),
isRecruiter(isARecruiter), m_currentVendorEntry(0), m_currentBankerGUID(0), timeWhoCommandAllowed(0), _lastAuctionListItemsMSTime(0), _lastAuctionListOwnerItemsMSTime(0), _skipQueue(skipQueue) isRecruiter(isARecruiter), m_currentBankerGUID(0), timeWhoCommandAllowed(0), _lastAuctionListItemsMSTime(0), _lastAuctionListOwnerItemsMSTime(0), _skipQueue(skipQueue)
{ {
memset(m_Tutorials, 0, sizeof(m_Tutorials)); memset(m_Tutorials, 0, sizeof(m_Tutorials));

View file

@ -228,9 +228,6 @@ class WorldSession
Player* GetPlayer() const { return _player; } Player* GetPlayer() const { return _player; }
std::string const& GetPlayerName() const; std::string const& GetPlayerName() const;
std::string GetPlayerInfo() const; std::string GetPlayerInfo() const;
uint32 GetCurrentVendor() const { return m_currentVendorEntry; }
void SetCurrentVendor(uint32 vendorEntry) { m_currentVendorEntry = vendorEntry; }
uint32 GetGuidLow() const; uint32 GetGuidLow() const;
void SetSecurity(AccountTypes security) { _security = security; } void SetSecurity(AccountTypes security) { _security = security; }
@ -272,7 +269,7 @@ class WorldSession
void SendTrainerList(uint64 guid); void SendTrainerList(uint64 guid);
void SendTrainerList(uint64 guid, std::string const& strTitle); void SendTrainerList(uint64 guid, std::string const& strTitle);
void SendListInventory(uint64 guid, uint32 vendorEntry = 0); void SendListInventory(uint64 guid);
void SendShowBank(uint64 guid); void SendShowBank(uint64 guid);
bool CanOpenMailBox(uint64 guid); bool CanOpenMailBox(uint64 guid);
void SendShowMailBox(uint64 guid); void SendShowMailBox(uint64 guid);
@ -1001,7 +998,6 @@ class WorldSession
uint32 recruiterId; uint32 recruiterId;
bool isRecruiter; bool isRecruiter;
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue; ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
uint32 m_currentVendorEntry;
uint64 m_currentBankerGUID; uint64 m_currentBankerGUID;
time_t timeWhoCommandAllowed; time_t timeWhoCommandAllowed;
uint32 _offlineTime; uint32 _offlineTime;

View file

@ -260,8 +260,7 @@ public:
return false; return false;
} }
char* addMulti = strtok(NULL, " "); uint32 vendor_entry = vendor ? vendor->GetEntry() : 0;
uint32 vendor_entry = addMulti ? handler->GetSession()->GetCurrentVendor() : vendor ? vendor->GetEntry() : 0;
if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer())) if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer()))
{ {
@ -484,8 +483,7 @@ public:
} }
uint32 itemId = atol(pitem); uint32 itemId = atol(pitem);
char* addMulti = strtok(NULL, " "); if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), itemId))
if (!sObjectMgr->RemoveVendorItem(addMulti ? handler->GetSession()->GetCurrentVendor() : vendor->GetEntry(), itemId))
{ {
handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId); handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId);
handler->SetSentErrorMessage(true); handler->SetSentErrorMessage(true);

View file

@ -1,10 +0,0 @@
SET @ENTRY = (SELECT max(entry)+1 FROM creature_template);
SET @MENU_ID = (SELECT max(menu_id)+1 FROM gossip_menu_option);
INSERT INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `dmgschool`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES
(@ENTRY, 1298, "Herbert", "MultiVendor", NULL, @MENU_ID, 10, 10, 0, 35, 129, 1, 1.14286, 1, 0, 0, 1500, 0, 1, 512, 2048, 8, 0, 0, 0, 0, 0, 7, 138412032, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 0, 0, 1, 0, 2, '');
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`) VALUES
(@MENU_ID, 0, 4, 'VendorTest 465', 3, 128, 465, 0, 0, 0, ''),
(@MENU_ID, 1, 9, 'VendorTest 54', 3, 128, 54, 0, 0, 0, ''),
(@MENU_ID, 2, 6, 'VendorTest 35574', 3, 128, 35574, 0, 0, 100, 'These goods are special, so pay up!');

View file

@ -1,42 +0,0 @@
#Multivendor [![Build Status](https://travis-ci.org/Rochet2/TrinityCore.svg?branch=multivendor)](https://travis-ci.org/Rochet2/TrinityCore)
####About
Allows you to show gossip options that show different vendors from npc_vendor.<br />
Source: http://rochet2.github.io/Multivendor.html
####Installation
Available as:
- Direct merge: https://github.com/Rochet2/TrinityCore/tree/multivendor
- Diff: https://github.com/Rochet2/TrinityCore/compare/TrinityCore:3.3.5...multivendor.diff
- Diff in github view: https://github.com/Rochet2/TrinityCore/compare/TrinityCore:3.3.5...multivendor
Using direct merge:
- open git bash to source location
- do `git remote add rochet2 https://github.com/Rochet2/TrinityCore.git`
- do `git pull rochet2 multivendor`
- use cmake and compile
Using diff:
- DO NOT COPY THE DIFF DIRECTLY! It causes apply to fail.
- download the diff by __right clicking__ the link and select __Save link as__
- place the downloaded `multivendor.diff` to the source root folder
- open git bash to source location
- do `git apply multivendor.diff`
- use cmake and compile
####Usage
Set your NPC to have gossip and vendor NPCflags (129)<br />
Add a gossip menu for him and add a new option to it.<br />
The option needs to have option_id set to 3 so it acts as a vendor button,<br />
npc_option_npcflag can be 1 or 128 (shows only if the NPC has vendor flag then)<br />
and the action_menu_id is the vendor entry from npc_vendor that you want to show to the player.<br />
YOU CAN also send menus from C++. All you need to do is to provide the vendor entry to the<br />
`void WorldSession::SendListInventory(ObjectGuid guid, uint32 vendorEntry)` function.
The npc add item command was modified so you can add items to multivendors as well.<br />
The last vendor window must have been the multivendor you want to add your item to.<br />
After opening the window you need to type `.npc add item #itemId <#maxcount><#incrtime><#extendedcost> 1`<br />
The 1 in the end specifies that you are adding the item to the multivendor currently open.<br />
Same thing works with `.npc delete item #itemId 1`