mirror of
https://github.com/azerothcore/mod-transmog
synced 2025-11-29 22:48:30 +08:00
ObjectGuid: Part I. (#44)
Co-authored-by: UltraNix <ultranix@gmail.com>
This commit is contained in:
@@ -28,7 +28,7 @@ void Transmogrification::PresetTransmog(Player* player, Item* itemTransmogrified
|
|||||||
itemTransmogrified->ClearSoulboundTradeable(player);
|
itemTransmogrified->ClearSoulboundTradeable(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transmogrification::LoadPlayerSets(uint64 pGUID)
|
void Transmogrification::LoadPlayerSets(ObjectGuid pGUID)
|
||||||
{
|
{
|
||||||
sLog->outDebug(LOG_FILTER_MODULES, "Transmogrification::LoadPlayerSets");
|
sLog->outDebug(LOG_FILTER_MODULES, "Transmogrification::LoadPlayerSets");
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ void Transmogrification::LoadPlayerSets(uint64 pGUID)
|
|||||||
|
|
||||||
presetByName[pGUID].clear();
|
presetByName[pGUID].clear();
|
||||||
|
|
||||||
QueryResult result = CharacterDatabase.PQuery("SELECT `PresetID`, `SetName`, `SetData` FROM `custom_transmogrification_sets` WHERE Owner = %u", GUID_LOPART(pGUID));
|
QueryResult result = CharacterDatabase.PQuery("SELECT `PresetID`, `SetName`, `SetData` FROM `custom_transmogrification_sets` WHERE Owner = %u", pGUID.GetCounter());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
@@ -56,7 +56,7 @@ void Transmogrification::LoadPlayerSets(uint64 pGUID)
|
|||||||
break;
|
break;
|
||||||
if (slot >= EQUIPMENT_SLOT_END)
|
if (slot >= EQUIPMENT_SLOT_END)
|
||||||
{
|
{
|
||||||
sLog->outError("Item entry (FakeEntry: %u, playerGUID: %u, slot: %u, presetId: %u) has invalid slot, ignoring.", entry, GUID_LOPART(pGUID), slot, uint32(PresetID));
|
sLog->outError("Item entry (FakeEntry: %u, player: %s, slot: %u, presetId: %u) has invalid slot, ignoring.", entry, pGUID.ToString().c_str(), slot, uint32(PresetID));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (sObjectMgr->GetItemTemplate(entry))
|
if (sObjectMgr->GetItemTemplate(entry))
|
||||||
@@ -75,7 +75,7 @@ void Transmogrification::LoadPlayerSets(uint64 pGUID)
|
|||||||
else // should be deleted on startup, so this never runs (shouldnt..)
|
else // should be deleted on startup, so this never runs (shouldnt..)
|
||||||
{
|
{
|
||||||
presetById[pGUID].erase(PresetID);
|
presetById[pGUID].erase(PresetID);
|
||||||
CharacterDatabase.PExecute("DELETE FROM `custom_transmogrification_sets` WHERE Owner = %u AND PresetID = %u", GUID_LOPART(pGUID), PresetID);
|
CharacterDatabase.PExecute("DELETE FROM `custom_transmogrification_sets` WHERE Owner = %u AND PresetID = %u", pGUID.GetCounter(), PresetID);
|
||||||
}
|
}
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ int32 Transmogrification::GetSetCopperCost() const
|
|||||||
return SetCopperCost;
|
return SetCopperCost;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transmogrification::UnloadPlayerSets(uint64 pGUID)
|
void Transmogrification::UnloadPlayerSets(ObjectGuid pGUID)
|
||||||
{
|
{
|
||||||
for (presetData::iterator it = presetById[pGUID].begin(); it != presetById[pGUID].end(); ++it)
|
for (presetData::iterator it = presetById[pGUID].begin(); it != presetById[pGUID].end(); ++it)
|
||||||
it->second.clear();
|
it->second.clear();
|
||||||
@@ -247,7 +247,7 @@ std::string Transmogrification::GetItemLink(uint32 entry, WorldSession* session)
|
|||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Transmogrification::GetFakeEntry(uint64 itemGUID) const
|
uint32 Transmogrification::GetFakeEntry(ObjectGuid itemGUID) const
|
||||||
{
|
{
|
||||||
sLog->outDebug(LOG_FILTER_MODULES, "Transmogrification::GetFakeEntry");
|
sLog->outDebug(LOG_FILTER_MODULES, "Transmogrification::GetFakeEntry");
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ uint32 Transmogrification::GetFakeEntry(uint64 itemGUID) const
|
|||||||
if (itr == dataMap.end()) return 0;
|
if (itr == dataMap.end()) return 0;
|
||||||
transmogMap::const_iterator itr2 = entryMap.find(itr->second);
|
transmogMap::const_iterator itr2 = entryMap.find(itr->second);
|
||||||
if (itr2 == entryMap.end()) return 0;
|
if (itr2 == entryMap.end()) return 0;
|
||||||
transmogData::const_iterator itr3 = itr2->second.find(itemGUID);
|
transmog2Data::const_iterator itr3 = itr2->second.find(itemGUID);
|
||||||
if (itr3 == itr2->second.end()) return 0;
|
if (itr3 == itr2->second.end()) return 0;
|
||||||
return itr3->second;
|
return itr3->second;
|
||||||
}
|
}
|
||||||
@@ -276,20 +276,20 @@ void Transmogrification::DeleteFakeEntry(Player* player, uint8 /*slot*/, Item* i
|
|||||||
{
|
{
|
||||||
//if (!GetFakeEntry(item))
|
//if (!GetFakeEntry(item))
|
||||||
// return false;
|
// return false;
|
||||||
DeleteFakeFromDB(itemTransmogrified->GetGUID(), trans);
|
DeleteFakeFromDB(itemTransmogrified->GetGUID().GetCounter(), trans);
|
||||||
UpdateItem(player, itemTransmogrified);
|
UpdateItem(player, itemTransmogrified);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transmogrification::SetFakeEntry(Player* player, uint32 newEntry, uint8 /*slot*/, Item* itemTransmogrified)
|
void Transmogrification::SetFakeEntry(Player* player, uint32 newEntry, uint8 /*slot*/, Item* itemTransmogrified)
|
||||||
{
|
{
|
||||||
uint64 itemGUID = itemTransmogrified->GetGUID();
|
ObjectGuid itemGUID = itemTransmogrified->GetGUID();
|
||||||
entryMap[player->GetGUID()][itemGUID] = newEntry;
|
entryMap[player->GetGUID()][itemGUID] = newEntry;
|
||||||
dataMap[itemGUID] = player->GetGUID();
|
dataMap[itemGUID] = player->GetGUID();
|
||||||
CharacterDatabase.PExecute("REPLACE INTO custom_transmogrification (GUID, FakeEntry, Owner) VALUES (%u, %u, %u)", GUID_LOPART(itemGUID), newEntry, player->GetGUIDLow());
|
CharacterDatabase.PExecute("REPLACE INTO custom_transmogrification (GUID, FakeEntry, Owner) VALUES (%u, %u, %u)", itemGUID.GetCounter(), newEntry, player->GetGUID().GetCounter());
|
||||||
UpdateItem(player, itemTransmogrified);
|
UpdateItem(player, itemTransmogrified);
|
||||||
}
|
}
|
||||||
|
|
||||||
TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, uint64 itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost)
|
TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, ObjectGuid itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost)
|
||||||
{
|
{
|
||||||
int32 cost = 0;
|
int32 cost = 0;
|
||||||
// slot of the transmogrified item
|
// slot of the transmogrified item
|
||||||
@@ -349,7 +349,8 @@ TransmogAcoreStrings Transmogrification::Transmogrify(Player* player, uint64 ite
|
|||||||
if (cost) // 0 cost if reverting look
|
if (cost) // 0 cost if reverting look
|
||||||
{
|
{
|
||||||
if (cost < 0)
|
if (cost < 0)
|
||||||
sLog->outDebug(LOG_FILTER_MODULES, "Transmogrification::Transmogrify - %s (%u) transmogrification invalid cost (non negative, amount %i). Transmogrified %u with %u", player->GetName().c_str(), player->GetGUIDLow(), -cost, itemTransmogrified->GetEntry(), itemTransmogrifier->GetEntry());
|
sLog->outDebug(LOG_FILTER_MODULES, "Transmogrification::Transmogrify - %s (%s) transmogrification invalid cost (non negative, amount %i). Transmogrified %u with %u",
|
||||||
|
player->GetName().c_str(), player->GetGUID().ToString().c_str(), -cost, itemTransmogrified->GetEntry(), itemTransmogrifier->GetEntry());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!player->HasEnoughMoney(cost))
|
if (!player->HasEnoughMoney(cost))
|
||||||
@@ -667,8 +668,10 @@ void Transmogrification::LoadConfig(bool reload)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transmogrification::DeleteFakeFromDB(uint64 itemGUID, SQLTransaction* trans)
|
void Transmogrification::DeleteFakeFromDB(ObjectGuid::LowType itemLowGuid, SQLTransaction* trans)
|
||||||
{
|
{
|
||||||
|
ObjectGuid itemGUID = ObjectGuid::Create<HighGuid::Item>(itemLowGuid);
|
||||||
|
|
||||||
if (dataMap.find(itemGUID) != dataMap.end())
|
if (dataMap.find(itemGUID) != dataMap.end())
|
||||||
{
|
{
|
||||||
if (entryMap.find(dataMap[itemGUID]) != entryMap.end())
|
if (entryMap.find(dataMap[itemGUID]) != entryMap.end())
|
||||||
@@ -676,9 +679,9 @@ void Transmogrification::DeleteFakeFromDB(uint64 itemGUID, SQLTransaction* trans
|
|||||||
dataMap.erase(itemGUID);
|
dataMap.erase(itemGUID);
|
||||||
}
|
}
|
||||||
if (trans)
|
if (trans)
|
||||||
(*trans)->PAppend("DELETE FROM custom_transmogrification WHERE GUID = %u", GUID_LOPART(itemGUID));
|
(*trans)->PAppend("DELETE FROM custom_transmogrification WHERE GUID = %u", itemLowGuid);
|
||||||
else
|
else
|
||||||
CharacterDatabase.PExecute("DELETE FROM custom_transmogrification WHERE GUID = %u", GUID_LOPART(itemGUID));
|
CharacterDatabase.PExecute("DELETE FROM custom_transmogrification WHERE GUID = %u", itemGUID.GetCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Transmogrification::GetEnableTransmogInfo() const
|
bool Transmogrification::GetEnableTransmogInfo() const
|
||||||
|
|||||||
@@ -39,8 +39,9 @@ enum TransmogAcoreStrings // Language.h might have same entries, appears when ex
|
|||||||
class Transmogrification
|
class Transmogrification
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef unordered_map<uint64, uint64> transmogData;
|
typedef unordered_map<ObjectGuid, ObjectGuid> transmogData;
|
||||||
typedef unordered_map<uint64, transmogData> transmogMap;
|
typedef unordered_map<ObjectGuid, uint32> transmog2Data;
|
||||||
|
typedef unordered_map<ObjectGuid, transmog2Data> transmogMap;
|
||||||
transmogMap entryMap; // entryMap[pGUID][iGUID] = entry
|
transmogMap entryMap; // entryMap[pGUID][iGUID] = entry
|
||||||
transmogData dataMap; // dataMap[iGUID] = pGUID
|
transmogData dataMap; // dataMap[iGUID] = pGUID
|
||||||
|
|
||||||
@@ -50,10 +51,10 @@ public:
|
|||||||
|
|
||||||
typedef std::map<uint8, uint32> slotMap;
|
typedef std::map<uint8, uint32> slotMap;
|
||||||
typedef std::map<uint8, slotMap> presetData;
|
typedef std::map<uint8, slotMap> presetData;
|
||||||
typedef unordered_map<uint64, presetData> presetDataMap;
|
typedef unordered_map<ObjectGuid, presetData> presetDataMap;
|
||||||
presetDataMap presetById; // presetById[pGUID][presetID][slot] = entry
|
presetDataMap presetById; // presetById[pGUID][presetID][slot] = entry
|
||||||
typedef std::map<uint8, std::string> presetIdMap;
|
typedef std::map<uint8, std::string> presetIdMap;
|
||||||
typedef unordered_map<uint64, presetIdMap> presetNameMap;
|
typedef unordered_map<ObjectGuid, presetIdMap> presetNameMap;
|
||||||
presetNameMap presetByName; // presetByName[pGUID][presetID] = presetName
|
presetNameMap presetByName; // presetByName[pGUID][presetID] = presetName
|
||||||
|
|
||||||
void PresetTransmog(Player* player, Item* itemTransmogrified, uint32 fakeEntry, uint8 slot);
|
void PresetTransmog(Player* player, Item* itemTransmogrified, uint32 fakeEntry, uint8 slot);
|
||||||
@@ -68,8 +69,8 @@ public:
|
|||||||
float GetSetCostModifier() const;
|
float GetSetCostModifier() const;
|
||||||
int32 GetSetCopperCost() const;
|
int32 GetSetCopperCost() const;
|
||||||
|
|
||||||
void LoadPlayerSets(uint64 pGUID);
|
void LoadPlayerSets(ObjectGuid pGUID);
|
||||||
void UnloadPlayerSets(uint64 pGUID);
|
void UnloadPlayerSets(ObjectGuid pGUID);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool EnableTransmogInfo;
|
bool EnableTransmogInfo;
|
||||||
@@ -120,19 +121,19 @@ public:
|
|||||||
const char * GetSlotName(uint8 slot, WorldSession* session) const;
|
const char * GetSlotName(uint8 slot, WorldSession* session) const;
|
||||||
std::string GetItemLink(Item* item, WorldSession* session) const;
|
std::string GetItemLink(Item* item, WorldSession* session) const;
|
||||||
std::string GetItemLink(uint32 entry, WorldSession* session) const;
|
std::string GetItemLink(uint32 entry, WorldSession* session) const;
|
||||||
uint32 GetFakeEntry(uint64 itemGUID) const;
|
uint32 GetFakeEntry(ObjectGuid itemGUID) const;
|
||||||
void UpdateItem(Player* player, Item* item) const;
|
void UpdateItem(Player* player, Item* item) const;
|
||||||
void DeleteFakeEntry(Player* player, uint8 slot, Item* itemTransmogrified, SQLTransaction* trans = NULL);
|
void DeleteFakeEntry(Player* player, uint8 slot, Item* itemTransmogrified, SQLTransaction* trans = NULL);
|
||||||
void SetFakeEntry(Player* player, uint32 newEntry, uint8 slot, Item* itemTransmogrified);
|
void SetFakeEntry(Player* player, uint32 newEntry, uint8 slot, Item* itemTransmogrified);
|
||||||
|
|
||||||
TransmogAcoreStrings Transmogrify(Player* player, uint64 itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost = false);
|
TransmogAcoreStrings Transmogrify(Player* player, ObjectGuid itemGUID, uint8 slot, /*uint32 newEntry, */bool no_cost = false);
|
||||||
bool CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* destination, ItemTemplate const* source) const;
|
bool CanTransmogrifyItemWithItem(Player* player, ItemTemplate const* destination, ItemTemplate const* source) const;
|
||||||
bool SuitableForTransmogrification(Player* player, ItemTemplate const* proto) const;
|
bool SuitableForTransmogrification(Player* player, ItemTemplate const* proto) const;
|
||||||
// bool CanBeTransmogrified(Item const* item);
|
// bool CanBeTransmogrified(Item const* item);
|
||||||
// bool CanTransmogrify(Item const* item);
|
// bool CanTransmogrify(Item const* item);
|
||||||
uint32 GetSpecialPrice(ItemTemplate const* proto) const;
|
uint32 GetSpecialPrice(ItemTemplate const* proto) const;
|
||||||
|
|
||||||
void DeleteFakeFromDB(uint64 itemGUID, SQLTransaction* trans = NULL);
|
void DeleteFakeFromDB(ObjectGuid::LowType itemLowGuid, SQLTransaction* trans = NULL);
|
||||||
float GetScaledCostModifier() const;
|
float GetScaledCostModifier() const;
|
||||||
int32 GetCopperCost() const;
|
int32 GetCopperCost() const;
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// action = presetID
|
// action = presetID
|
||||||
CharacterDatabase.PExecute("DELETE FROM `custom_transmogrification_sets` WHERE Owner = %u AND PresetID = %u", player->GetGUIDLow(), action);
|
CharacterDatabase.PExecute("DELETE FROM `custom_transmogrification_sets` WHERE Owner = %u AND PresetID = %u", player->GetGUID().GetCounter(), action);
|
||||||
sT->presetById[player->GetGUID()][action].clear();
|
sT->presetById[player->GetGUID()][action].clear();
|
||||||
sT->presetById[player->GetGUID()].erase(action);
|
sT->presetById[player->GetGUID()].erase(action);
|
||||||
sT->presetByName[player->GetGUID()].erase(action);
|
sT->presetByName[player->GetGUID()].erase(action);
|
||||||
@@ -220,7 +220,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// sender = slot, action = display
|
// sender = slot, action = display
|
||||||
TransmogAcoreStrings res = sT->Transmogrify(player, MAKE_NEW_GUID(action, 0, HIGHGUID_ITEM), sender);
|
TransmogAcoreStrings res = sT->Transmogrify(player, ObjectGuid::Create<HighGuid::Item>(action), sender);
|
||||||
if (res == LANG_ERR_TRANSMOG_OK)
|
if (res == LANG_ERR_TRANSMOG_OK)
|
||||||
session->SendAreaTriggerMessage("%s",GTS(LANG_ERR_TRANSMOG_OK));
|
session->SendAreaTriggerMessage("%s",GTS(LANG_ERR_TRANSMOG_OK));
|
||||||
else
|
else
|
||||||
@@ -291,7 +291,7 @@ public:
|
|||||||
sT->presetById[player->GetGUID()][presetID][it->first] = it->second;
|
sT->presetById[player->GetGUID()][presetID][it->first] = it->second;
|
||||||
}
|
}
|
||||||
sT->presetByName[player->GetGUID()][presetID] = name; // Make sure code doesnt mess up SQL!
|
sT->presetByName[player->GetGUID()][presetID] = name; // Make sure code doesnt mess up SQL!
|
||||||
CharacterDatabase.PExecute("REPLACE INTO `custom_transmogrification_sets` (`Owner`, `PresetID`, `SetName`, `SetData`) VALUES (%u, %u, \"%s\", \"%s\")", player->GetGUIDLow(), uint32(presetID), name.c_str(), ss.str().c_str());
|
CharacterDatabase.PExecute("REPLACE INTO `custom_transmogrification_sets` (`Owner`, `PresetID`, `SetName`, `SetData`) VALUES (%u, %u, \"%s\", \"%s\")", player->GetGUID().GetCounter(), uint32(presetID), name.c_str(), ss.str().c_str());
|
||||||
if (cost)
|
if (cost)
|
||||||
player->ModifyMoney(-cost);
|
player->ModifyMoney(-cost);
|
||||||
break;
|
break;
|
||||||
@@ -330,7 +330,7 @@ public:
|
|||||||
if (sT->GetFakeEntry(oldItem->GetGUID()) == newItem->GetEntry())
|
if (sT->GetFakeEntry(oldItem->GetGUID()) == newItem->GetEntry())
|
||||||
continue;
|
continue;
|
||||||
++limit;
|
++limit;
|
||||||
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(newItem->GetEntry(), 30, 30, -18, 0) + sT->GetItemLink(newItem, session), slot, newItem->GetGUIDLow(), "Using this item for transmogrify will bind it to you and make it non-refundable and non-tradeable.\nDo you wish to continue?\n\n" + sT->GetItemIcon(newItem->GetEntry(), 40, 40, -15, -10) + sT->GetItemLink(newItem, session) + ss.str(), price, false);
|
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(newItem->GetEntry(), 30, 30, -18, 0) + sT->GetItemLink(newItem, session), slot, newItem->GetGUID().GetCounter(), "Using this item for transmogrify will bind it to you and make it non-refundable and non-tradeable.\nDo you wish to continue?\n\n" + sT->GetItemIcon(newItem->GetEntry(), 40, 40, -15, -10) + sT->GetItemLink(newItem, session) + ss.str(), price, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
|
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
|
||||||
@@ -350,7 +350,7 @@ public:
|
|||||||
if (sT->GetFakeEntry(oldItem->GetGUID()) == newItem->GetEntry())
|
if (sT->GetFakeEntry(oldItem->GetGUID()) == newItem->GetEntry())
|
||||||
continue;
|
continue;
|
||||||
++limit;
|
++limit;
|
||||||
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(newItem->GetEntry(), 30, 30, -18, 0) + sT->GetItemLink(newItem, session), slot, newItem->GetGUIDLow(), "Using this item for transmogrify will bind it to you and make it non-refundable and non-tradeable.\nDo you wish to continue?\n\n" + sT->GetItemIcon(newItem->GetEntry(), 40, 40, -15, -10) + sT->GetItemLink(newItem, session) + ss.str(), price, false);
|
AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, sT->GetItemIcon(newItem->GetEntry(), 30, 30, -18, 0) + sT->GetItemLink(newItem, session), slot, newItem->GetGUID().GetCounter(), "Using this item for transmogrify will bind it to you and make it non-refundable and non-tradeable.\nDo you wish to continue?\n\n" + sT->GetItemIcon(newItem->GetEntry(), 40, 40, -15, -10) + sT->GetItemLink(newItem, session) + ss.str(), price, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,8 @@ class PS_Transmogrification : public PlayerScript
|
|||||||
public:
|
public:
|
||||||
PS_Transmogrification() : PlayerScript("Player_Transmogrify") { }
|
PS_Transmogrification() : PlayerScript("Player_Transmogrify") { }
|
||||||
|
|
||||||
void OnAfterSetVisibleItemSlot(Player* player, uint8 slot, Item *item) {
|
void OnAfterSetVisibleItemSlot(Player* player, uint8 slot, Item *item)
|
||||||
|
{
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -375,20 +376,21 @@ public:
|
|||||||
player->SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), entry);
|
player->SetUInt32Value(PLAYER_VISIBLE_ITEM_1_ENTRYID + (slot * 2), entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnAfterMoveItemFromInventory(Player* /*player*/, Item* it, uint8 /*bag*/, uint8 /*slot*/, bool /*update*/) {
|
void OnAfterMoveItemFromInventory(Player* /*player*/, Item* it, uint8 /*bag*/, uint8 /*slot*/, bool /*update*/)
|
||||||
sT->DeleteFakeFromDB(it->GetGUIDLow());
|
{
|
||||||
|
sT->DeleteFakeFromDB(it->GetGUID().GetCounter());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnLogin(Player* player)
|
void OnLogin(Player* player)
|
||||||
{
|
{
|
||||||
uint64 playerGUID = player->GetGUID();
|
ObjectGuid playerGUID = player->GetGUID();
|
||||||
sT->entryMap.erase(playerGUID);
|
sT->entryMap.erase(playerGUID);
|
||||||
QueryResult result = CharacterDatabase.PQuery("SELECT GUID, FakeEntry FROM custom_transmogrification WHERE Owner = %u", player->GetGUIDLow());
|
QueryResult result = CharacterDatabase.PQuery("SELECT GUID, FakeEntry FROM custom_transmogrification WHERE Owner = %u", player->GetGUID().GetCounter());
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
uint64 itemGUID = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_ITEM);
|
ObjectGuid itemGUID = ObjectGuid::Create<HighGuid::Item>((*result)[0].GetUInt32());
|
||||||
uint32 fakeEntry = (*result)[1].GetUInt32();
|
uint32 fakeEntry = (*result)[1].GetUInt32();
|
||||||
if (sObjectMgr->GetItemTemplate(fakeEntry))
|
if (sObjectMgr->GetItemTemplate(fakeEntry))
|
||||||
{
|
{
|
||||||
@@ -417,8 +419,8 @@ public:
|
|||||||
|
|
||||||
void OnLogout(Player* player)
|
void OnLogout(Player* player)
|
||||||
{
|
{
|
||||||
uint64 pGUID = player->GetGUID();
|
ObjectGuid pGUID = player->GetGUID();
|
||||||
for (Transmogrification::transmogData::const_iterator it = sT->entryMap[pGUID].begin(); it != sT->entryMap[pGUID].end(); ++it)
|
for (Transmogrification::transmog2Data::const_iterator it = sT->entryMap[pGUID].begin(); it != sT->entryMap[pGUID].end(); ++it)
|
||||||
sT->dataMap.erase(it->first);
|
sT->dataMap.erase(it->first);
|
||||||
sT->entryMap.erase(pGUID);
|
sT->entryMap.erase(pGUID);
|
||||||
|
|
||||||
@@ -456,12 +458,14 @@ public:
|
|||||||
class global_transmog_script : public GlobalScript {
|
class global_transmog_script : public GlobalScript {
|
||||||
public:
|
public:
|
||||||
global_transmog_script() : GlobalScript("global_transmog_script") { }
|
global_transmog_script() : GlobalScript("global_transmog_script") { }
|
||||||
|
|
||||||
void OnItemDelFromDB(SQLTransaction& trans, uint32 itemGuid) {
|
void OnItemDelFromDB(SQLTransaction& trans, ObjectGuid::LowType itemGuid)
|
||||||
|
{
|
||||||
sT->DeleteFakeFromDB(itemGuid, &trans);
|
sT->DeleteFakeFromDB(itemGuid, &trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnMirrorImageDisplayItem(const Item *item, uint32 &display) {
|
void OnMirrorImageDisplayItem(const Item *item, uint32 &display)
|
||||||
|
{
|
||||||
if (uint32 entry = sTransmogrification->GetFakeEntry(item->GetGUID()))
|
if (uint32 entry = sTransmogrification->GetFakeEntry(item->GetGUID()))
|
||||||
display=uint32(sObjectMgr->GetItemTemplate(entry)->DisplayInfoID);
|
display=uint32(sObjectMgr->GetItemTemplate(entry)->DisplayInfoID);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user