Jump to content
  • 0

[Rquest]Instances


Archagnel

Question

Hello im doing one custom thing now but Im wondering how to create Instance for each player with stats that will be hold until shutdown/restart. For example im calling function DoSomething() in doDie from L2PcInstance in which I want to read or create if not exist Instance for each player(killer) with few statics for example I want hold there pvp stats, if something happens im raising it or reseting.

Im thinking to do something similar like they have done in l2jFrozen:

 

public class CustomPvpSystem{

 

  public CustomPvpSystem(L2PcInstance killer, L2PcInstance victim){

      this.setKiller(killer);

      this.setVictim(victim);

...

Pvp pvp = PvpTable.getInstance().getPvp(killer.getObjectId(), victim.getObjectId(), systemDay);

...

and in pvptable class:

...

private static PvpTable _instance = null;

...

  public static PvpTable getInstance(){

      if(_instance == null){

        _instance = new PvpTable();

      }

     

      return _instance;

  }

 

 

Will something like this work with this return instance ? Or can I do this easier?

 

And the second question, how can I random array ? For example I have ex[] = {1,2,3,4} and I want to random this array but inside, NOT like to get random from this array.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Hello im doing one custom thing now but Im wondering how to create Instance for each player with stats that will be hold until shutdown/restart. For example im calling function DoSomething() in doDie from L2PcInstance in which I want to read or create if not exist Instance for each player(killer) with few statics for example I want hold there pvp stats, if something happens im raising it or reseting.

Im thinking to do something similar like they have done in l2jFrozen:

 

public class CustomPvpSystem{

 

  public CustomPvpSystem(L2PcInstance killer, L2PcInstance victim){

      this.setKiller(killer);

      this.setVictim(victim);

...

Pvp pvp = PvpTable.getInstance().getPvp(killer.getObjectId(), victim.getObjectId(), systemDay);

...

and in pvptable class:

...

private static PvpTable _instance = null;

...

  public static PvpTable getInstance(){

      if(_instance == null){

        _instance = new PvpTable();

      }

     

      return _instance;

  }

 

 

Will something like this work with this return instance ? Or can I do this easier?

 

And the second question, how can I random array ? For example I have ex[] = {1,2,3,4} and I want to random this array but inside, NOT like to get random from this array.

 

Would you explain us more about this instance...

Becouse i'm 50% sure i can give you one already done, and you can modify it howeva you want...

Give me more info what exacly you wanna happend?

1v1 or?

Link to comment
Share on other sites

  • 0

It doesnt matter what Instance I want... i want to know it as a global issue, but I want to do something like this http://maxcheaters.com/forum/index.php?topic=228394.0 but i dont want to hold this: rewardConsecutiveKillCount in L2Pcinstance, I want to hold this in new java file. For example I create:

Rewards.java

here:

public class Rewards {

private int rewardConsecutiveKillCount = 0;

 

public void Increase() {

rewardConsecutiveKillCount++;

}

public int getCounts() {

return rewardConsecutiveKillCount;

}

 

}

I want something like this and where should call this function to get this for every player that killed someone to hold his counts (I know something like this would hold this only until restart) ?

Link to comment
Share on other sites

  • 0

If you want to safe it even after rr it must be  in database...

			rewardConsecutiveKillCount = "0":
		 con = L2DatabaseFactory.getInstance().getConnection()
		 setrewardConsecutiveKillCount = 0

 

I'm not good in java but this looks so/so to me :D

Link to comment
Share on other sites

  • 0

Arrays are static, once written they can't be edited. You must use a list, than you use shuffle() from Collections.

http://blog.ryanrampersad.com/2008/10/shuffle-an-array-in-java/

 


 

About your first question, I didn't really get it. Basically you have to create a new object filled with good parameters. Probably something like :

 

new CustomPvpSystem(killer, victim);

 

Check L2JFrozen and see how that class is used ?

Link to comment
Share on other sites

  • 0

I know how to write something to sql, thats not what I was asking for even I said I dont want it so u are just spamming.

 

I don't know if there is a way to safe something after restart without connection with database...

anyway gl ;)

Link to comment
Share on other sites

  • 0

I don't know if there is a way to safe something after restart without connection with database...

anyway gl ;)

Are u dumb or blind? Read what I have written before u post ok ?

Hello im doing one custom thing now but Im wondering how to create Instance for each player with stats that will be hold until shutdown/restart.

 

Anyway I did it, topic can be locked.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Posts

    • Good luck with ur server looks decent the legend is back 🙂
    • The Photoshop Pen Tool, denoted by a pen nib icon, is a versatile tool for precise selections and paths. Click to create anchor points, drag for curves, and close paths to make selections. Refine with the Direct Selection Tool. Useful for intricate designs, cutouts, and precise selections in just a few clicks.
    • My experience with the "Developer" Ban L2JDEV.   On September 22nd, after much effort, I made the terrible decision to work with this individual. At first, everything went smoothly, even pleasantly one could say. In summary, from September 22nd to the present date, he has delivered 2 versions of the pack. The first one seemed like a beta made by someone inexperienced in development. The second one was an even older version. The latest version delivered on December 1st is an older version of ACIS and has nothing to do with what I initially purchased. There were some "improvements" he claimed to have made regarding the drop system, which, in reality, doesn't work at all; it's a delay in time. He asked for 2 more days to add everything I wanted, and, adapting to that pack because time was running out, on December 5th, he claimed he was sick (classic). On December 6th, I informed him of some issues with his drop MOD. On December 7th, I began calling and messaging him to find out what was happening, but to this date, I have never received a response from him. He is always online but never shows up. I will leave a couple of YouTube links with the entire conversation from day one through Discord and WhatsApp, including images of payments and everything else, in case someone is interested in the matter. I know time and money won't be returned with this post, but besides venting, I would appreciate everyone's support in spreading this to prevent more people from being scammed by this individual.       Minha experiência com o "Desenvolvedor" Ban L2JDEV.   Em 22 de setembro, após muito esforço, tomei a terrível decisão de trabalhar com este indivíduo. No início, tudo correu bem, até agradavelmente, poderia-se dizer. Em resumo, do dia 22 de setembro até a presente data, ele entregou 2 versões do pacote. O primeiro parecia uma versão beta feita por alguém inexperiente no mundo do desenvolvimento. O segundo era uma versão ainda mais antiga. A última versão entregue em 1º de dezembro é uma versão mais antiga do ACIS e não tem nada a ver com o que eu comprei inicialmente. Houve algumas "melhorias" que ele afirmou ter feito no sistema de drop, que na realidade não funciona de maneira alguma; é um atraso no tempo. Ele pediu mais 2 dias para adicionar tudo o que eu queria, adaptando-me a esse pacote porque o tempo estava se esgotando. Em 5 de dezembro, ele respondeu que estava doente (clássico). Em 6 de dezembro, informei sobre alguns problemas com o MOD de drop dele. Em 7 de dezembro, comecei a ligar e escrever para saber o que estava acontecendo, mas até a presente data, nunca recebi uma resposta dele. Ele está sempre online, mas nunca se manifesta. Deixarei alguns links do YouTube com toda a conversa desde o primeiro dia pelo Discord e WhatsApp, incluindo imagens dos pagamentos e tudo o mais, caso alguém esteja interessado no assunto. Eu sei que o tempo e o dinheiro não serão recuperados com este post, mas além de desabafar, eu apreciaria o apoio de todos para divulgar isso e evitar que mais pessoas sejam enganadas por este indivíduo.         Mi experiencia con el "Desarrollador" Ban L2JDEV.   el 22 de septiembre después de mucho esfuerzo, tome la terrible decisión de trabajar con este individuo, al principio todo fue fluido, hasta agradable se podría decir. Haciendo resumen, desde el 22 de septiembre a la fecha, me ha entregado 2 versiones del pack, el primero que parecía beta hecha por algún pasante por el mundo del desarrollo. Y el segundo una versión mas antigua... la ultima versión entregada el 1ro de diciembre es una versión mas antigua del acis y no tenia nada que ver con lo que había comprado al principio, unas "mejoras" de parte de el con el tema del drop, cosa que no funciona para nada, es un retraso en el tiempo. Me pidió 2 días mas para agregar todo lo que yo quería, adaptándome a ese pack porque ya el tiempo me ganaba, el 5 de diciembre me responde que estuvo enfermo, clásica. El día 6 le informo de unos problemas con su MOD de drop. el día 7 empiezo a llamarlo y a escribirle para saber que pasaba, cosa que hasta la fecha nunca he tenido una respuesta de su parte. Siempre esta en lineal, solo no da la cara. Dejare un par de links de youtube, con toda la conversación desde el primer día por discord y WhatsApp, imagenes los pagos y todo el resto por si alguien esta interesado en el tema. Se que el tiempo ni el dinero serán retornados con este post, pero además de desahogarme, agradecería el apoyo de todos para regar esto y evitar que mas gente sea estafada por este individuo Links:       
    • THE PROBLEM SOLVED!    YOU CAN LOCK THE TOPIC!          Reset PC connection, and everything will be fine, if anyone will meet a problem like that. 
  • Topics

×
×
  • Create New...