Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- *@author Keal
- */
- //Dans Ancestra.java
- public static int DAY = 0;
- public static int MONTH = 0;
- //dans la méthode main()
- Date actDate = new Date();
- DateFormat dateFormat = new SimpleDateFormat("dd");
- String jour = dateFormat.format(actDate);
- dateFormat = new SimpleDateFormat("MM");
- String mois = dateFormat.format(actDate);
- Faith.DAY = Integer.parseInt(jour);
- Faith.MONTH = Integer.parseInt(mois);
- //Dans GameServer.java
- private Timer updateDateTimer;
- //Dans le constructeur GameServer:
- updateDateTimer = new Timer();
- updateDateTimer.schedule(new TimerTask()
- {
- @Override
- public void run()
- {
- Thread t = new Thread(new UpdateDateThread());
- t.start();
- }
- }, 86400000, 86400000);
- //Toujours dans GameServer
- public static class UpdateDateThread implements Runnable
- {
- @Override
- public void run()
- {
- Date actDate = new Date();
- DateFormat dateFormat = new SimpleDateFormat("dd");
- String jour = dateFormat.format(actDate);
- dateFormat = new SimpleDateFormat("MM");
- String mois = dateFormat.format(actDate);
- Faith.DAY = Integer.parseInt(jour);
- Faith.MONTH = Integer.parseInt(mois);
- if(Faith.MONTH == 2 && (Faith.DAY == 14 || Faith.DAY == 15) &&
- (Faith.MONTH == 10 && Faith.DAY == 31 || Faith.MONTH == 1 && Faith.DAY == 1))//On altère seulement le jour spécial et le lendemain
- {
- synchronized(World.getCartes())
- {
- for(Carte map : World.getCartes())
- {
- ArrayList<MobGrade> list = new ArrayList<MobGrade>();
- for(MobGrade mob : map.getMobPossibles())
- {
- int id = mob.getTemplate().getID();
- if(Faith.MONTH == 2 && Faith.DAY == 14)
- {
- if(id == 101) id = 1232;
- }else if(Faith.MONTH == 10 && Faith.DAY == 31)
- {
- if(id == 793) id = 101;
- if(id == 794) id = 98;
- }else
- {
- if(id == 793) id = 101;
- if(id == 794) id = 98;
- if(id == 1232) id = 101;
- }
- list.add(World.getMonstre(id).getGradeByLevel(mob.getLevel()));
- map.setMobPossibles(list);
- }
- }
- }
- }
- }
- }
- //Dans Carte.java
- //Dans le constructeur Carte il suffit de remplacer la boucle for (for(String mob : monsters.split("\\|"))) par:
- for(String mob : monsters.split("\\|"))
- {
- if(mob.equals(""))continue;
- int id = 0;
- int lvl = 0;
- try
- {
- id = Integer.parseInt(mob.split(",")[0]);
- lvl = Integer.parseInt(mob.split(",")[1]);
- }catch(NumberFormatException e){continue;};
- if(Faith.MONTH == 2 && Faith.DAY == 14)
- {
- if(id == 101) id = 1232;
- }else if(Faith.MONTH == 10 && Faith.DAY == 31)
- {
- if(id == 793) id = 101;
- if(id == 794) id = 98;
- }else
- {
- if(id == 793) id = 101;
- if(id == 794) id = 98;
- if(id == 1232) id = 101;
- }
- if(id == 0 || lvl == 0)continue;
- if(World.getMonstre(id) == null)continue;
- if(World.getMonstre(id).getGradeByLevel(lvl) == null)continue;
- _mobPossibles.add(World.getMonstre(id).getGradeByLevel(lvl));
- }
- public ArrayList<MobGrade> getMobPossibles()
- {
- return _mobPossibles;
- }
- public void setMobPossibles(ArrayList<MobGrade> list)
- {
- _mobPossibles = list;
- }
Advertisement
Add Comment
Please, Sign In to add comment