对Azerothcore进行重新构造(Rochet2)

Reforging (Rochet2) to AzerothCore

本文关键字:Rochet2 新构造 Azerothcore      更新时间:2023-10-16

是否有人已经成功地在AC上添加了Rochet2的Refor脚本?我的工作,但不完全。在字符登录时,脚本应在重新添加(配备的)项目上重新应用奖金,但似乎" player-> getItembyGuid()"找不到请求的项目,所以它没有返回。

三位一体代码(工作):

uint32 lowGUID = (*result)[0].GetUInt32();
Item* invItem = player->GetItemByGuid(ObjectGuid(HighGuid::Item, 0, lowGUID));
if (invItem) 
    player->_ApplyItemMods(invItem, invItem->GetSlot(), false);             
ReforgeData& data = player->reforgeMap[lowGUID];
data.increase = (*result)[1].GetUInt32();
data.decrease = (*result)[2].GetUInt32();
data.stat_value = (*result)[3].GetInt32();
if (invItem)
     player->_ApplyItemMods(invItem, invItem->GetSlot(), true);

aszerothcore代码(有效,但"如果(Invitem)"条件从未满足。

uint32 lowGUID = (*result)[0].GetUInt32();
Item* invItem = player->GetItemByGuid((uint64) MAKE_NEW_GUID(HIGHGUID_ITEM, 0, lowGUID));
if (invItem /*&& invItem->IsEquipped()*/)
      player->_ApplyItemMods(invItem, invItem->GetSlot(), false); 
ReforgeData& data = player->reforgeMap[lowGUID];
data.increase = (*result)[1].GetUInt32();
data.decrease = (*result)[2].GetUInt32();
data.stat_value = (*result)[3].GetInt32();
if (invItem /*&& invItem->IsEquipped()*/)
      player->_ApplyItemMods(invItem, invItem->GetSlot(), true);

make_new_guid()返回看起来像GUID的东西。

但我不知道为什么" player-> getItembyGuid()"找不到项目。

MAKE_NEW_GUID的参数顺序与ObjectGuid构造函数不同。因此,由于您的论点是错误的顺序,因此结果也是错误的,找不到项目。有关参数的正确顺序,请参见MAKE_NEW_GUID的定义和使用。