L2JMobius

C6 Setdonator problem

FanaticoLineage2 · 5 · 5218

Offline FanaticoLineage2

  • Heir
  • **
    • Posts: 13
Hola, quería informar que al poner //setdonator 7 (para que se salga en 7 días) el status  donator o vip, el personaje al tirar restart se le sale este status, es decir, no se le va en 7 días, si no, al tirar restart el personaje o el servidor, no queda guardado en ningún lado de la base de datos.


Hello, I wanted to inform you that when you put // setdonator 7 (so that it goes out in 7 days) the status donator or vip, the character when you start restart leaves this status, that is, it does not go away in 7 days, if not When you restart the character or the server, it is not saved anywhere in the database.


I am using the google translator, sorry for my english.   :-[


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 328
Hello,

I think that only AIO has a duration. Donator is just //setdonator without any other argument.

You must edit the database structure and also check the donator's end date, just like it is for AIO buffers.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011
For Interlude //setdonator [days] is an option that was recently added on the subscriber version.
The free verson still uses true / false and honestly that might not work as well.


Online G-hamsteR

  • Viscount
  • *****
    • Posts: 328
I'm posting my solution. I didn't modify the //setdonator command, since I wanted to grant yourself the donator status using my website, but this is the easy party.

First, run this SQL command:
Code: [Select]
ALTER TABLE `characters_custom_data` ADD COLUMN `donator_end_date`  int(11) UNSIGNED NULL AFTER `hero_end_date`;
Then apply these patches (or make the changes manually, because my files are edited)

gameserver/handler/admincommandhandlers/AdminDonator.java:
Code: [Select]
### Eclipse Workspace Patch 1.0
#P L2J_Mobius_C6_Interlude
diff --git java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java
index 1cd8f34..9a69bda 100644
--- java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java
+++ java/org/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java
@@ -153,7 +153,7 @@
  }
 
  String INSERT_DATA = "REPLACE INTO characters_custom_data (obj_Id, char_name, hero, noble, donator) VALUES (?,?,?,?,?)";
- String DEL_DATA = "UPDATE characters_custom_data SET donator = 0 WHERE obj_Id=?";
+ String DEL_DATA = "UPDATE characters_custom_data SET donator = 0, donator_end_date = null WHERE obj_Id=?";
 
  @Override
  public String[] getAdminCommandList()

gameserver/model/actor/instance/PlayerInstance.java:
Code: [Select]
### Eclipse Workspace Patch 1.0
#P L2J_Mobius_C6_Interlude
diff --git java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index bf98275..3df945d 100644
--- java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -239,7 +239,7 @@
  /** SQL queries */
  private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,pc_point=?,name_color=?,title_color=?,aio=?,aio_end=? WHERE obj_id=?";
  private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon,punish_level,punish_timer,newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,pc_point,name_color,title_color,first_log,aio,aio_end FROM characters WHERE obj_id=?";
- private static final String STATUS_DATA_GET = "SELECT hero, noble, donator, hero_end_date FROM characters_custom_data WHERE obj_Id = ?";
+ private static final String STATUS_DATA_GET = "SELECT hero, noble, donator, hero_end_date, donator_end_date FROM characters_custom_data WHERE obj_Id = ?";
  private static final String RESTORE_SKILLS_FOR_CHAR_ALT_SUBCLASS = "SELECT skill_id,skill_level FROM character_skills WHERE char_obj_id=? ORDER BY (skill_level+0)";
  private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
  private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";

@@ -15014,6 +15025,7 @@
  int hero = 0;
  int noble = 0;
  int donator = 0;
+ long donatorEnd = 0;
  long heroEnd = 0;
 
  try (Connection con = DatabaseFactory.getConnection())
@@ -15029,6 +15041,7 @@
  noble = rset.getInt("noble");
  donator = rset.getInt("donator");
  heroEnd = rset.getLong("hero_end_date");
+ donatorEnd = rset.getLong("donator_end_date");
  }
  rset.close();
  statement.close();
@@ -15054,7 +15067,7 @@
  setNoble(true);
  }
 
- if (donator > 0)
+ if ((donator > 0) && ((donatorEnd * 1000) > System.currentTimeMillis()))
  {
  setDonator(true);
  }

The only thing that is missing, is to edit gameserver/handler/admincommandhandlers/AdminDonator.java and do the following:

Check for a second argument, which is an int for days. Multiply this int with 86400, which is the amount in seconds. Then add this amount to the current timestamp. Eg current timestamp is 1595965496. So for +7 days, it would be 1596570296. Then just save this to the donator_end_date column from the updateDatabase function.

I hope this helps.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16011
characters_custom_data is dropped from the subscribers version.
You better use character variables.