Skip to content
This repository was archived by the owner on Apr 29, 2020. It is now read-only.

Commit 0fddecd

Browse files
committed
PR: Added the C++ backbone for updating Digging Zones
1 parent 7afec44 commit 0fddecd

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

src/map/lua/luautils.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4428,6 +4428,23 @@ namespace luautils
44284428
return canDig;
44294429
}
44304430

4431+
int32 UpdateDigZones()
4432+
{
4433+
lua_prepscript("scripts/globals/chocobo_digging.lua");
4434+
4435+
if (prepFile(File, "updateDigZones"))
4436+
return false;
4437+
4438+
if (lua_pcall(LuaHandle, 0, 0, 0))
4439+
{
4440+
ShowError("luautils::UpdateDigZones: %s\n", lua_tostring(LuaHandle, -1));
4441+
lua_pop(LuaHandle, 1);
4442+
return false;
4443+
}
4444+
4445+
return 0;
4446+
}
4447+
44314448
/************************************************************************
44324449
* Loads a Lua function with a fallback hierarchy *
44334450
* *

src/map/lua/luautils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ namespace luautils
281281
int32 OnPlayerLevelDown(CCharEntity* PChar);
282282

283283
bool OnChocoboDig(CCharEntity* PChar, bool pre); // chocobo digging, pre = check
284+
int32 UpdateDigZones(); // updating chocobo digging zones with items
284285
bool LoadEventScript(CCharEntity* PChar, const char* functionName); // Utility method: checks for and loads a lua function for events
285286

286287
uint16 GetDespoilDebuff(uint16 itemId); // Ask the database for an effectId based on Item despoiled (returns 0 if not in db)

src/map/time_server.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,16 @@ int32 time_server(time_point tick,CTaskMgr::CTask* PTask)
7676

7777
CVanaTime::getInstance()->lastVHourlyUpdate = tick;
7878
}
79+
}
7980

81+
// every irl minute
82+
if (tick > (CVanaTime::getInstance()->lastMinute + 60s))
83+
{
84+
luautils::UpdateDigZones();
85+
CVanaTime::getInstance()->lastMinute = tick;
8086
}
8187

88+
8289
//Midnight
8390
if (CVanaTime::getInstance()->getSysHour() == 0 && CVanaTime::getInstance()->getSysMinute() == 0)
8491
{

src/map/vana_time.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class CVanaTime
9393
time_point lastVDailyUpdate;
9494
time_point lastConquestTally;
9595
time_point lastMidnight;
96+
time_point lastMinute;
9697

9798
private:
9899

0 commit comments

Comments
 (0)