hello friends I modified my code "l2 sunrise" to make sieges and wars territory are every week and not every two weeks, my question is what will happen if I do nothing of seven signs? I do not want to screw up at the very end.
these pieces of code I have changed, and also want to ask if I did well because honestly I'm not sure:
private void setNextSiegeDate()
{
final Calendar cal = getCastle().getSiegeDate();
if (cal.getTimeInMillis() < System.currentTimeMillis())
{
cal.setTimeInMillis(System.currentTimeMillis());
}
for (SiegeScheduleDate holder : SiegeScheduleData.getInstance().getScheduleDates())
{
cal.set(Calendar.DAY_OF_WEEK, holder.getDay());
cal.set(Calendar.HOUR_OF_DAY, holder.getHour());
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
if (cal.before(Calendar.getInstance()))
{
cal.add(Calendar.WEEK_OF_YEAR, 1); <-----------//////// HERE
}
if (CastleManager.getInstance().getSiegeDates(cal.getTimeInMillis()) < holder.getMaxConcurrent())
{
CastleManager.getInstance().registerSiegeDate(getCastle().getResidenceId(), cal.getTimeInMillis());
break;
}
}
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_ANNOUNCED_SIEGE_TIME);
sm.addCastleId(getCastle().getResidenceId());
Broadcast.toAllOnlinePlayers(sm);
_isRegistrationOver = false; // Allow registration for next siege
}
and this code for territory war:
public TerritoryWarSuperClass(int questId, String name, String descr)
{
super(questId, name, descr);
if (questId < 0)
{
// Outpost and Ward handled by the Super Class script
addSkillSeeId(36590);
// Calculate next TW date
final Calendar cal = Calendar.getInstance();
final long nextSiegeDate = GlobalVariablesManager.getInstance().getLong(TerritoryWarManager.GLOBAL_VARIABLE, 0);
if (nextSiegeDate > System.currentTimeMillis())
{
cal.setTimeInMillis(nextSiegeDate);
}
else
{
// Let's check if territory war date was in the past
if (cal.before(Calendar.getInstance()))
{
cal.setTimeInMillis(System.currentTimeMillis());
}
boolean hasOwnedCastle = CastleManager.getInstance().hasOwnedCastle();
cal.set(Calendar.DAY_OF_WEEK, hasOwnedCastle ? Calendar.SATURDAY : Calendar.SUNDAY);
cal.set(Calendar.HOUR_OF_DAY, hasOwnedCastle ? 20 : 22);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
if (cal.before(Calendar.getInstance()))
{
cal.add(Calendar.WEEK_OF_YEAR, 1); <-----------//////// HERE
}
GlobalVariablesManager.getInstance().set(TerritoryWarManager.GLOBAL_VARIABLE, cal.getTimeInMillis());
}
TerritoryWarManager.getInstance().setTWStartTimeInMillis(cal.getTimeInMillis());
_log.info(getClass().getSimpleName() + ": " + cal.getTime());
}
}
where it says " WEEK_OF_YEAR, 1 " (in both codes before was 2 so I figured they were weeks) change it, compile it, reset the tables in the database and has synchronized dates to this weekend (Saturday and Sunday) because in the configs at sunrise I can to put the day occurring the sieges between Saturday and Sunday but no date, just wanted to know if I did this modification well and that will happen with seven signs if I leave it as it is, I hope I explained well, thanks in advance.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
ADENA
500 K = 40e
1kk = 70e
3kk = 190e
ITEMS
staff of life = 150e
karmian set = 90e
elven jewls top D = 30e
Orcish Poleaxe+1 best C pole = 680e
any D grade armor on demand
discord
wiz0642_81242
❖Items that are sent by physical delivery are sent using someone else's data. That is, if you are not able to accept the parcel, we will not be able to return it. Please keep this in mind.
READY IN STOCK
PAYMENT SYSTEMS
4x4 io, Weststein, Paysafecard, Paysend, Genome, Conotoxia, Mybrocard, Payz Silver, Pockit UK, NagaPay, Volet com, SpectroCoin, SwissMoney, Yuh, Lydia / Sumeria, Ka.App, Wittix, Western Union, MyGuava, Xapo Bank, Bunq on emulator (DE, NL, FR, ES, IE ibans), Revolut on emulator (UK/EU), ICard, BlackCatCard, Vivid DE, Bankera, Bitsa, Wise EU/UK, N26 DE/ES on emulator, Skrill, Neteller, Trasta, Wirex, Lama, Paysera, Moneyjar
CRYPTOEXCHANGE
BINGX com, Bybit LVL 2, KuCoin, Binance LVL 2, Mexc, Latoken, Poloniex, Bitmart, Kraken, WhiteBit, Quppy, Nexo, Gate, OKX, Paybis, Paxful, Huobi (HTX), xcoins com, Bit2Me
BUSINESS ACCOUNTS
Stripe, Payoneer EU, Wise Business UK/EU, Revolut Business EU/UK, N26 Business DE, Wallester Business EU, Kraken Business Pro, Monzo Business, Vivid Business, Zen Business EU, Millennium Business PL, AirWallex EU/UK, Finom business, PayPal business, Payset business
NATIONAL BANKS / BANKS
BBVA, CommerzBank, ING, Santander, Kaspi Bank, Sberbank, AlfaBank, Tbank, Raiffeisen, mBank, Paribas, Bereke Bank, Kapital Bank
Question
b0rto
and this code for territory war:
where it says " WEEK_OF_YEAR, 1 " (in both codes before was 2 so I figured they were weeks) change it, compile it, reset the tables in the database and has synchronized dates to this weekend (Saturday and Sunday) because in the configs at sunrise I can to put the day occurring the sieges between Saturday and Sunday but no date, just wanted to know if I did this modification well and that will happen with seven signs if I leave it as it is, I hope I explained well, thanks in advance.
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.