mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-08-01 01:15:59 -04:00
64 lines
1.3 KiB
Plaintext
64 lines
1.3 KiB
Plaintext
/***** INCLUDES ********************************************************/
|
|
include library.scheduled_drop;
|
|
include library.utils;
|
|
|
|
messageHandler clearPromotions()
|
|
{
|
|
string [] promotions = scheduled_drop.getSchedulerPromotions();
|
|
|
|
for(int i = 0, j = promotions.length; i < j; i++)
|
|
{
|
|
removeObjVar(self, "tcg." + promotions[i] + ".count");
|
|
}
|
|
|
|
scheduled_drop.removeClusterPromotions();
|
|
|
|
scheduled_drop.setLastClusterUpdateTime(getCalendarTime());
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler setPromotion()
|
|
{
|
|
if(params == null)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
string promotion = params.getString("promotion");
|
|
int promotionCount = params.getInt("promotionMaxDrops");
|
|
|
|
if(!hasObjVar(self, "tcg." + promotion + ".count"))
|
|
{
|
|
setObjVar(self, "tcg." + promotion + ".count", promotionCount);
|
|
}
|
|
|
|
scheduled_drop.setLastClusterUpdateTime(getCalendarTime());
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
messageHandler reducePromotion()
|
|
{
|
|
if(params == null)
|
|
{
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
string promotion = params.getString("promotionName");
|
|
|
|
if(hasObjVar(self, "tcg." + promotion + ".count"))
|
|
{
|
|
int promotionCount = getIntObjVar(self, "tcg." + promotion + ".count");
|
|
|
|
if(promotionCount > 0)
|
|
{
|
|
promotionCount--;
|
|
|
|
setObjVar(self, "tcg." + promotion + ".count", promotionCount);
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|