41
Bug Reports / Re: problem with solved problem
« Last post by Galagard on April 30, 2024, 09:56:30 PM »Because this is the correct way... nothing more
why not be more simple?
geting out is enough than create a whole section for it.
Because this is the correct way... nothing more
why not be more simple?
geting out is enough than create a whole section for it.
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*
* http://www.gnu.org/copyleft/gpl.html
*/
package org.l2jmobius.gameserver.model.actor.instance;
import org.l2jmobius.gameserver.cache.HtmCache;
import org.l2jmobius.gameserver.data.xml.NpcData;
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
import org.l2jmobius.gameserver.model.StatSet;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
public class L2RaidBossStatusInstance extends Npc
{
private static final int[] RBOSSES = {25418,25434,25126};
private static int MBOSS = 25126;
public L2RaidBossStatusInstance(NpcTemplate template)
{
super(template);
}
@Override
public void showChatWindow(Player player)
{
generateFirstWindow(player);
}
private void generateFirstWindow(Player activeChar)
{
final StringBuilder sb = new StringBuilder();
for(int rboss : RBOSSES)
{
final int info = GrandBossManager.getInstance().getBossStatus(rboss);
String name = NpcData.getInstance().getTemplate(rboss).getName().toUpperCase();
if (info==0)
{
sb.append("<font color=\"b09979\">"+ name +" IS ALIVE!</font><br1>");
}
else if (info>0)
{
sb.append("<font color=\"FF0000\"> "+ name +" IS DEAD.</font><br1>");
}
else
{
final StatSet ss = GrandBossManager.getInstance().getStatSet(rboss);
final long respawnTime = ss.getLong("respawn_time");
sb.append("<font color=\"b09979\">"+name+"</font> "+ ConverTime(respawnTime) +" <font color=\"b09979\">TO RESPAWN.</font><br1>");
}
}
final int MbossInfo = GrandBossManager.getInstance().getBossStatus(MBOSS);
String m_name = NpcData.getInstance().getTemplate(MBOSS).getName().toUpperCase();
String mainBossInfo ="";
if (MbossInfo==0)
{
mainBossInfo = "WE SHOULD HAVE ACTED<br1><font color=\"b09979\">"+m_name+" IS ALIVE!</font><br1>";
}
else if (MbossInfo>0)
{
mainBossInfo = "IT'S ALL OVER<br1><font color=\"FF0000\"> "+m_name+" IS DEAD.</font><br1>";
}
else
{
final StatSet ss = GrandBossManager.getInstance().getStatSet(MBOSS);
final long respawnTime = ss.getLong("respawn_time");
mainBossInfo = "<font color=\"b09979\">"+ ConverTime(respawnTime) +"</font><br1>UNTIL OBLIVION OPEN!";
}
NpcHtmlMessage html = new NpcHtmlMessage(1);
html.setFile(activeChar, "path"); //FIXME: just set the path to your HTML (-KouGou) <--
html.replace("%objectId%", getObjectId());
html.replace("%bosslist%", sb.toString());
html.replace("%mboss%", mainBossInfo);
activeChar.sendPacket(html);
}
private static String ConverTime(long mseconds)
{
long remainder = mseconds;
long hours = (long)Math.ceil((mseconds/(60*60*1000)));
remainder = mseconds - (hours*60*60*1000);
long minutes = (long)Math.ceil((remainder / (60*1000)));
remainder = remainder -(minutes *(60*1000));
long seconds = (long)Math.ceil((remainder / 1000));
return hours+":"+minutes+":"+seconds;
}
public String getHtmlPath(int npcId, int val)
{
String filename;
if (val == 0)
filename = "data/html/mods/RaidBossStatus/" + npcId + ".htm";
else
filename = "data/html/mods/RaidBossStatus/" + npcId + "-" + val + ".htm";
if (HtmCache.getInstance().isLoadable(filename))
return filename;
return "data/html/mods/RaidBossStatus/" + npcId + ".htm";
}
}
package handlers.admincommandhandlers;
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.item.instance.Item;
public class AdminWipe implements IAdminCommandHandler {
private static final String[] ADMIN_COMMANDS = { "admin_wipe" };
@Override
public String[] getAdminCommandList() { return ADMIN_COMMANDS; }
@Override
public boolean useAdminCommand(String command, Player activeChar)
{
WorldObject target = activeChar.getTarget();
if (target == null) {
activeChar.sendMessage("Incorrect target");
return false;
}
Player player = target.getActingPlayer();
if (player == null || !player.isPlayer())
{
activeChar.sendMessage("Incorrect target");
return false;
}
if (command.equalsIgnoreCase("admin_wipe")) {
for (Item item : player.getInventory().getItems()) {
if (item.isEquipped() || item.getId() == 57 || item.getId() == 97145 || item.getId() == 91663) {
continue;
}
player.destroyItem("admin_wipe" , item , activeChar , true);
}
activeChar.sendMessage("Target's inventory has been cleared");
player.sendMessage("Inventory has been cleared");
return true;
}
return false;
}
}
AdminVitality.class,
+AdminWipe.class,
what you mean with "correct numbers"?i mean that when i changed min and max spawn time and killed raid, in database spawn time was still 1714360778573
Timestamp is formatted a Epoch time, it's used because precision, in milliseconds
is a local server? or hosted?