添加 ResetDayLimitItemScript 以重置 [重置_物品_每日上限] 状态
This commit is contained in:
parent
61eacc9c67
commit
f7a532aec9
@ -9,6 +9,7 @@
|
||||
#include "SpellScript.h"
|
||||
#include "SpellScriptLoader.h"
|
||||
#include "Chat.h"
|
||||
#include "WorldScript.h"
|
||||
|
||||
#include "mod_DataLoader/DataLoader.h"
|
||||
#include "mod_CommonFunc/CommonFunc.h"
|
||||
@ -35,6 +36,7 @@
|
||||
#include <ServerAnnounce.h>
|
||||
#include <SpellMgr.h>
|
||||
#include <CustomCommand.h>
|
||||
#include <GameTime.h>
|
||||
|
||||
std::unordered_map<uint32/*entry*/, UIItemEntryTemplate> UIItemEntryMap;
|
||||
|
||||
@ -1951,21 +1953,8 @@ bool ItemMod::HasTransFlag(Item* item)
|
||||
return flag;
|
||||
}
|
||||
|
||||
// 徽章掉落方式
|
||||
//bool ItemMod::IsCurrencyLike(uint32 itemid)
|
||||
//{
|
||||
// if (std::find(CurrencyLikeItemVec.begin(), CurrencyLikeItemVec.end(), itemid) != CurrencyLikeItemVec.end())
|
||||
// return true;
|
||||
//
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
void ItemMod::ResetDayLimitItem()
|
||||
{
|
||||
//WorldSessionMgr::SessionMap const& smap = sWorld->GetAllSessions();
|
||||
//for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
|
||||
|
||||
WorldSessionMgr::SessionMap const& sessionMap = sWorldSessionMgr->GetAllSessions();
|
||||
for (WorldSessionMgr::SessionMap::const_iterator itr = sessionMap.begin(); itr != sessionMap.end(); ++itr)
|
||||
if (Player* player = itr->second->GetPlayer()) {
|
||||
@ -1974,8 +1963,6 @@ void ItemMod::ResetDayLimitItem()
|
||||
return;
|
||||
playerData->PDayLimitItemMap.clear();
|
||||
}
|
||||
|
||||
//CustomCharacterDataPreparedStatement* stmt = CustomCharacterData.GetPreparedStatement(CHAR_DEL_ITEM_DAY); //以改变预处理
|
||||
sCustomCharacterDataConnection.TruncateCharacterDayItem(); //用这个代替
|
||||
}
|
||||
|
||||
@ -3324,10 +3311,26 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class ResetDayLimitItemScript : public WorldScript
|
||||
{
|
||||
public:
|
||||
ResetDayLimitItemScript() : WorldScript("ResetDayLimitItemScript") {}
|
||||
|
||||
void OnUpdate(uint32 diff) override
|
||||
{
|
||||
// 检查是否到了每日重置时间
|
||||
if (sWorld->GetNextDailyQuestsResetTime() <= GameTime::GetGameTime())
|
||||
{
|
||||
sItemMod->ResetDayLimitItem();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_ITEM_MOD()
|
||||
{
|
||||
new item_mod_playerscript();
|
||||
new spell_item_mod();
|
||||
new sigil_item_upgrade();
|
||||
new CustomItemUseScript(); //使用物品
|
||||
new CustomItemUseScript(); // 使用物品
|
||||
new ResetDayLimitItemScript(); // 重置_物品_每日上限
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user