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.
Hello. You may encounter the Push item fail error when trying to pick up an item dropped on the ground by a mob.
or
You can throw something out of your inventory and pick it up again, several times.
Probably this is a quantum dependency) I don't understand at what point this happens, sometimes two items one after another experience push item errors, and sometimes I don't have enough thousands of attempts to repeat this trick)
In any case, this is just a visual error and after the relog, the item appears in the inventory. I think first i need to disconnect the extender and check it on a bare server. I still need time to check this, maybe it's not even about the autoloot function.
https://youtu.be/6mcfmdImofE
-----------
In general, I would like to thank our wonderful Emca Eressea for her deep knowledge in programming and reverse engineering. And for the fact that her work is open to everyone, this is very amazing, and incredibly valuable.
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
Question
lazzytr
I want to give 1 GCM per hour to online players.
I am editing the java code I found for this, but it does not give an hourly reward.
package services;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ScheduledFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import l2f.gameserver.Config;
import l2f.gameserver.ThreadPoolManager;
import l2f.gameserver.database.mysql;
import l2f.gameserver.model.GameObjectsStorage;
import l2f.gameserver.model.Player;
import l2f.gameserver.scripts.ScriptFile;
/**
*
* @author Special
*/
public class AutoReward implements ScriptFile, Runnable
{
private static final Logger _log = LoggerFactory.getLogger(Player.class);
private static final int REWARD_DELAY = 3600000; // 1h.
private static final int REQUIRED_ONLINE = Config.DAILY_REWARD_REQUIRED_ONLINE * 3600000; // 1h.
private static final int NOT_REWARD_AFK_DELAY = Config.DAILY_REWARD_AFK_TIME * 60000; // 10 mins.(Config 10)
private static final DateFormat TIME_FORMAT = new SimpleDateFormat("HH");
private boolean CLEANED = false;
private ScheduledFuture<?> _task = null;
@Override
public void run()
{
if(CLEANED && time() >= Config.DAILY_REWARD_END_HOUR || time() < Config.DAILY_REWARD_START_HOUR)
CLEANED = false;
if(time() >= Config.DAILY_REWARD_START_HOUR && time() <= Config.DAILY_REWARD_END_HOUR)
{
for(Player player : GameObjectsStorage.getAllPlayersForIterate()) {
if(player.isOnline() && player.getUptime() >= REQUIRED_ONLINE
&& (System.currentTimeMillis() - player.getLastNotAfkTime()) > NOT_REWARD_AFK_DELAY) {
if(!isRewardedDB(player)) {
player.sendMessage("You have been rewarded for online time!");
setRewardDB(player);
}
}
}
}
if(CLEANED == false && time() <= Config.DAILY_REWARD_START_HOUR) {
CLEANED = true;
wipeRewardDB();
}
}
public static int time()
{
return Integer.parseInt(TIME_FORMAT.format(new Date(System.currentTimeMillis())));
}
public static boolean isRewardedDB(Player player) {
String value = Config.DAILY_REWARD_PROTECTION.equals("HWID") ? player.getHWID() : player.getIP();
if(player.getVar("daily_reward") != null)
return true;
if(mysql.get("SELECT value FROM character_variables WHERE name='daily_reward' AND value='"+value+"'") != null)
return true;
return false;
}
public static void setRewardDB(Player player) {
String value = Config.DAILY_REWARD_PROTECTION.equals("HWID") ? player.getHWID() : player.getIP();
mysql.set("INSERT INTO character_variables (obj_id, type, name, value, expire_time) VALUES (?,?,?,?,?)", player.getObjectId(), "user-var", "daily_reward", value, -1);
}
public static void wipeRewardDB() {
mysql.set("DELETE FROM `character_variables` WHERE `type`='user-var' and `name`='daily_reward'");
}
@Override
public void onLoad()
{
_log.info("Loaded Service: AutoReward");
if(_task == null)
_task = ThreadPoolManager.getInstance().scheduleAtFixedDelay(this, REWARD_DELAY, REWARD_DELAY);
}
@Override
public void onReload()
{
if(_task != null)
{
_task.cancel(true);
_task = null;
}
_task = ThreadPoolManager.getInstance().scheduleAtFixedDelay(this, REWARD_DELAY, REWARD_DELAY);
}
@Override
public void onShutdown()
{
//
}
}
1 answer 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.