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];
|
(getNpc() - NpcId.GACHAPON_HENESYS) : getNpc() == NpcId.GACHAPON_NLC ? 8 : 9];
|
||||||
String map = c.getChannelServer().getMapFactory().getMap(mapId).getMapName();
|
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
|
if (item.getTier() > 0) { //Uncommon and Rare
|
||||||
Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.gachaponMessage(itemGained, map, getPlayer()));
|
Server.getInstance().broadcastMessage(c.getWorld(), PacketCreator.gachaponMessage(itemGained, map, getPlayer()));
|
||||||
|
|||||||
@@ -21,7 +21,10 @@
|
|||||||
*/
|
*/
|
||||||
package server.gachapon;
|
package server.gachapon;
|
||||||
|
|
||||||
|
import client.Character;
|
||||||
import constants.id.NpcId;
|
import constants.id.NpcId;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import server.ItemInformationProvider;
|
import server.ItemInformationProvider;
|
||||||
import tools.Randomizer;
|
import tools.Randomizer;
|
||||||
|
|
||||||
@@ -29,7 +32,7 @@ import tools.Randomizer;
|
|||||||
* @author Alan (SharpAceX)
|
* @author Alan (SharpAceX)
|
||||||
*/
|
*/
|
||||||
public class Gachapon {
|
public class Gachapon {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(Gachapon.class);
|
||||||
private static final Gachapon instance = new Gachapon();
|
private static final Gachapon instance = new Gachapon();
|
||||||
|
|
||||||
public static Gachapon getInstance() {
|
public static Gachapon getInstance() {
|
||||||
@@ -162,4 +165,9 @@ public class Gachapon {
|
|||||||
return id;
|
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;
|
package tools;
|
||||||
|
|
||||||
import client.Character;
|
import client.Character;
|
||||||
import server.ItemInformationProvider;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
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;
|
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);
|
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>
|
<Pattern>${standard-pattern}</Pattern>
|
||||||
</PatternLayout>
|
</PatternLayout>
|
||||||
</File>
|
</File>
|
||||||
|
|
||||||
|
<File name="GachaponFile" fileName="logs/gachapon.log">
|
||||||
|
<PatternLayout>
|
||||||
|
<Pattern>${standard-pattern}</Pattern>
|
||||||
|
</PatternLayout>
|
||||||
|
</File>
|
||||||
</Appenders>
|
</Appenders>
|
||||||
|
|
||||||
<Loggers>
|
<Loggers>
|
||||||
@@ -79,6 +85,9 @@
|
|||||||
<Logger name="server.ChatLogger" level="info" additivity="false">
|
<Logger name="server.ChatLogger" level="info" additivity="false">
|
||||||
<AppenderRef ref="ChatFile"/>
|
<AppenderRef ref="ChatFile"/>
|
||||||
</Logger>
|
</Logger>
|
||||||
|
<Logger name="server.gachapon.Gachapon" level="info" additivity="false">
|
||||||
|
<AppenderRef ref="GachaponFile"/>
|
||||||
|
</Logger>
|
||||||
|
|
||||||
<Logger name="com.zaxxer.hikari" level="info"/>
|
<Logger name="com.zaxxer.hikari" level="info"/>
|
||||||
<Logger name="io.netty" level="info"/>
|
<Logger name="io.netty" level="info"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user