调整物品不允许被附魔时输出过多的消息
This commit is contained in:
parent
2cd5fffe0a
commit
b96a351035
@ -52,9 +52,17 @@ public:
|
||||
uint32 ItemID = item->GetEntry();
|
||||
if (sSm_ItemDisable_Enchantment->IsEnchantmentDisabled(player, ItemID))
|
||||
{
|
||||
// 如果物品不允许被附魔,则发送错误消息并阻止附魔操作
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("这个物品不能被附魔。");
|
||||
return false; // 由于 preventEnchant 设置为 true,返回 false 表示禁止附魔
|
||||
uint64 playerGUID = player->GetGUID().GetRawValue();
|
||||
uint32 currentTime = getMSTime();
|
||||
|
||||
// 只有距离上次消息超过3秒才发送新消息
|
||||
if (lastMessageTime.find(playerGUID) == lastMessageTime.end() ||
|
||||
currentTime - lastMessageTime[playerGUID] > 3000)
|
||||
{
|
||||
ChatHandler(player->GetSession()).PSendSysMessage("这个物品不能被附魔。");
|
||||
lastMessageTime[playerGUID] = currentTime;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -81,6 +89,9 @@ public:
|
||||
return true; // 默认允许附魔
|
||||
}
|
||||
*/
|
||||
private:
|
||||
std::unordered_map<uint64, uint32> lastMessageTime; // 玩家GUID -> 最后消息时间
|
||||
|
||||
};
|
||||
#include "AllSpellScript.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user