Refactor gachapon logging
This commit is contained in:
@@ -413,7 +413,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
|
||||
(getNpc() - NpcId.GACHAPON_HENESYS) : getNpc() == NpcId.GACHAPON_NLC ? 8 : 9];
|
||||
String map = c.getChannelServer().getMapFactory().getMap(mapId).getMapName();
|
||||
|
||||
LogHelper.logGacha(getPlayer(), item.getId(), map);
|
||||
Gachapon.log(getPlayer(), item.getId(), map);
|
||||
|
||||
if (item.getTier() > 0) { //Uncommon and Rare
|
||||
Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.gachaponMessage(itemGained, map, getPlayer()));
|
||||
|
||||
@@ -21,7 +21,10 @@
|
||||
*/
|
||||
package server.gachapon;
|
||||
|
||||
import client.Character;
|
||||
import constants.id.NpcId;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import server.ItemInformationProvider;
|
||||
import tools.Randomizer;
|
||||
|
||||
@@ -29,7 +32,7 @@ import tools.Randomizer;
|
||||
* @author Alan (SharpAceX)
|
||||
*/
|
||||
public class Gachapon {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(Gachapon.class);
|
||||
private static final Gachapon instance = new Gachapon();
|
||||
|
||||
public static Gachapon getInstance() {
|
||||
@@ -162,4 +165,9 @@ public class Gachapon {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
public static void log(Character player, int itemId, String map) {
|
||||
String itemName = ItemInformationProvider.getInstance().getName(itemId);
|
||||
log.info("{} got a {} ({}) from the {} gachapon.", player.getName(), itemName, itemId, map);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package tools;
|
||||
|
||||
import client.Character;
|
||||
import server.ItemInformationProvider;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@@ -23,11 +22,4 @@ public class LogHelper {
|
||||
String log = player.getName() + (gotPrize ? " used a maple leaf to buy " + operation : " redeemed " + operation + " VP for a leaf") + " - " + timeStamp;
|
||||
FilePrinter.print(FilePrinter.LOG_LEAF, log);
|
||||
}
|
||||
|
||||
public static void logGacha(Character player, int itemid, String map) {
|
||||
String itemName = ItemInformationProvider.getInstance().getName(itemid);
|
||||
String timeStamp = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss").format(new Date());
|
||||
String log = player.getName() + " got a " + itemName + "(" + itemid + ") from the " + map + " gachapon. - " + timeStamp;
|
||||
FilePrinter.print(FilePrinter.LOG_GACHAPON, log);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,12 @@
|
||||
<Pattern>${standard-pattern}</Pattern>
|
||||
</PatternLayout>
|
||||
</File>
|
||||
|
||||
<File name="GachaponFile" fileName="logs/gachapon.log">
|
||||
<PatternLayout>
|
||||
<Pattern>${standard-pattern}</Pattern>
|
||||
</PatternLayout>
|
||||
</File>
|
||||
</Appenders>
|
||||
|
||||
<Loggers>
|
||||
@@ -79,6 +85,9 @@
|
||||
<Logger name="server.ChatLogger" level="info" additivity="false">
|
||||
<AppenderRef ref="ChatFile"/>
|
||||
</Logger>
|
||||
<Logger name="server.gachapon.Gachapon" level="info" additivity="false">
|
||||
<AppenderRef ref="GachaponFile"/>
|
||||
</Logger>
|
||||
|
||||
<Logger name="com.zaxxer.hikari" level="info"/>
|
||||
<Logger name="io.netty" level="info"/>
|
||||
|
||||
Reference in New Issue
Block a user