Jump to content

Recommended Posts

Posted

So I was bored and I decide to do something to share it.

 

I'll explain a little:

 

So Basically the player talks to a NPC and he writes a msg with whatever he/she wants to report and this its gonna be sended to the administrator mail, so you can see whatever the report on your smartphone or on your pc or w/e.

 

also you need to put a valid gmail account in order to make this work, it doesnt work with yahoo or any of those, just with gmail you can read that in the code, so read it carefuly while you adding it.

 

You can extend it,its the very basic idea.

 

Created: Today.

Credits: Me

 

Thanks to vampir who help me to test the code.

 

### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: java/com/l2jserver/gameserver/model/actor/instance/L2MailReportInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2MailReportInstance.java	(revision 0)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2MailReportInstance.java	(revision 0)
@@ -0,0 +1,138 @@
+package com.l2jserver.gameserver.model.actor.instance;
+
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import javax.mail.Address;
+import javax.mail.Message;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import com.l2jserver.gameserver.instancemanager.InstanceManager;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+import javolution.text.TextBuilder;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
+
+/**
+ * version v1.1
+ * @author  Mhoska
+ */
+
+public class L2MailReportInstance extends L2NpcInstance {
+
+	public L2MailReportInstance(int objectId, L2NpcTemplate template) {
+		super(objectId, template);
+	}
+
+	@Override
+	public void showChatWindow(L2PcInstance player , int val){
+		if (player == null)
+			return;
+		
+		TextBuilder tb = new TextBuilder();
+		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
+
+		tb.append("<html><head><title>Reporter For MxC </title></head><body>");
+		tb.append("<center>Welcome " + player.getName() + "</center><br>");
+		tb.append("<center>This is not a toy If you use this and you arent</center><br>");
+		tb.append("<center>really sure of what you re doing</center><br>");
+		tb.append("<center>you could get punished</center><br>");
+		tb.append("<center></center><br>");
+		tb.append("<center></center><br>");
+		tb.append("<center>Now Please do your report.</center><br>");
+		tb.append("Report:<edit var=\"mes\" width=150 height=45><br><br>");
+		tb.append("<button value=\"Send Report\" action=\"bypass -h MailReport $mes\" width=204 height=20>");
+		tb.append("</body></html>");
+
+		html.setHtml(tb.toString());
+		player.sendPacket(html);
+	}
+	
+	@Override
+	@SuppressWarnings("null")
+	public void onBypassFeedback(L2PcInstance player, String command)
+	{
+		if (!canInteract(player))
+			return;
+		if (command.startsWith("MailReport")) {					
+			Long resendtime = InstanceManager.getInstance().getInstanceTime(player.getObjectId(), 99999);
+			   if (System.currentTimeMillis() < resendtime)
+			   {
+				   player.sendMessage("You did a report not too long ago, you gotta wait 24 hours");
+			   }
+				 else{
+			String value = command.substring(6);
+			StringTokenizer s = new StringTokenizer(value, " ");
+			String message = "";
+
+			try {
+				while (s.hasMoreTokens())
+					message = message + s.nextToken() + " ";
+
+				if (message == "" || message == null) {
+					player.sendMessage("Dont try to send a blank message.");
+					return;
+				}
+				if (message.length() < 30) {
+					player.sendMessage("You Must write at leas 30 characters.");
+					return;
+				}
+				if (message.length() > 1000) {
+					player.sendMessage("Maximun 1000 Characters, if you report isn't completed.");
+					player.sendMessage("please send us a new one.");
+					return;
+				}
+
+				try {
+					//Please use a Gmail email because this smtp is coded based on Gmail
+					//just add your real email data or this isn't going to work.
+					//you can set the string to. to any email adress you want to receive the reports.
+					String MyEmail = "trololo@gmail.com";
+					String MyPw = "trololo";
+					String to = "dum-beep-email@gmail.com";
+
+					Properties props = new Properties();
+					props.put("mail.smtps.host", "smtp.gmail.com");
+					props.put("mail.smtps.auth", "true");
+					props.put("mail.transport.protocol", "smtp");
+					props.put("mail.debug", "false");
+
+					Session mailSession = Session.getDefaultInstance(props);
+					Transport transport = mailSession.getTransport("smtps");
+
+					InternetAddress fromAddress = new InternetAddress(MyEmail);
+					InternetAddress toAddress = new InternetAddress(to);
+
+					Message simpleMessage = new MimeMessage(mailSession);
+
+					simpleMessage.setFrom(fromAddress);
+					simpleMessage.setRecipient(Message.RecipientType.TO,
+							toAddress);
+					simpleMessage.setSubject("Ingame Report from:"
+							+ player.getName());
+					simpleMessage.setText("The player Report is:" + message);
+
+					transport.connect("smtp.gmail.com", MyEmail, MyPw);
+					transport.sendMessage(simpleMessage,
+							new Address[] { toAddress });
+					transport.close();
+					
+					InstanceManager.getInstance().setInstanceTime(player.getObjectId(), 99999, ((System.currentTimeMillis() + 86400000)));
+					
+				} catch (Exception e) {
+					System.exit(1);
+				}
+
+			} catch (Exception e) {
+				player.sendMessage("Something gone wrong you gotta do your report again");
+				e.printStackTrace();
+			}
+		}
+		super.onBypassFeedback(player, command);
+	}
+  }
+}
\ No newline at end of file

 

v1.1 update

 

I added a delay on the use of the report, 24 hours.

Posted

[Hidden post: You need 2 karma to see it. You currently have 0.]

It will be very good if make only with topic...

Sorry for spam, but i think its very usefull code.

Posted

[Hidden post: You need 2 karma to see it. You currently have 0.]

It will be very good if make only with topic...

Sorry for spam, but i think its very usefull code.

u have got 1 karma so u cant see it, dont spam the topic.

Posted

Nice spam! :)

I don't think that it is spam by the time he can normally see the post.

 

Anyway, your share is simple but really usefull. Great.

Posted

wut? I just encourage you to keep sharing things with us here in mxc. Is that so bad?

 

2 words :( i hate 2 words post, but np i got the point of your post. and thank you :)

 

Amazing good idea ,some ppl working and they cant stay always in pc to see all the message from players. Good Dude .

 

tyvm :)

I don't think that it is spam by the time he can normally see the post.

 

Anyway, your share is simple but really usefull. Great.

 

thanks for your kind words sir :)

Guest Elfocrash
Posted

Mhoska also mention that this will cuz terrible lag for the server if people do not rework the code working on a separate mailserver

Posted

Mhoska also mention that this will cuz terrible lag for the server if people do not rework the code working on a separate mailserver

 

oh yeah, it may cause lag.

 

but as i say its a pretty basic idea pussaaaay! haha

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • First, you need to understand what you're doing and what you want to achieve. You have to choose a server core. After that, decide what you want your server to include, code it, modify the client to fit your server, go public, and drink champagne.   If you know how to code, creating a server is relatively easy — a few months of work and you can make it happen. Modifying the client is a completely different story. There’s a lack of tutorials, tools, and source materials. I’m currently working on the client myself, and I’ve already spent over three weeks just trying to get started due to the lack of information. If you don’t have the knowledge and experience, you’ll need a team and a bag of money — but realistically, it just won’t succeed.
    • The server has been online and stable for over 2 months now, and we’re still going strong! No wipes, no shortcuts ~ just continuous work, daily fixes, events, and improvements to ensure the best possible experience.   Great News! 🔥 CHAPTER II IS COMING — GRACIA FINAL 🔥 On February 16, L2Elixir enters a new era. The server will be officially updated to Gracia Final, opening Chapter II of our journey. Expect new content, improvements, and surprises that will refresh the gameplay while keeping the classic Gracia Final spirit alive.   More challenges, more competition, and more reasons to log in.   📅 Update Date: February 16 ⚔️ Chapter II: Gracia Final This is not a reset. This is evolution.   Prepare yourselves — Chapter II begins soon.   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs    
    • Server owners, Top.MaxCheaters.com is now live and accepting Lineage 2 server listings. There is no voting, no rankings manipulation, and no paid advantages. Visibility is clean and equal, and early listings naturally appear at the top while the platform grows. If your server is active, it should already be listed. Submit here 👉https://Top.MaxCheaters.com This platform is part of the MaxCheaters.com network and is being built as a long-term reference point for the Lineage 2 community. — MaxCheaters.com Team
    • Hello! We are Genesis, small team that works on new Lineage 2 project. Our goal with this project is to create a fresh new place to play — built around real community feedback, with no aggressive pay-to-win donations and with carefully thought-out quality-of-life improvements, balance changes etc. We believe that even tho we all love this game, everyone has at least one or two things they would like to change in the game to make it more enjoyable. Thats why we want the comunity feedback to shape our server. Main information about the server: • Interlude Classic version • Rates: EXP x4 SP x2 Loot x2, Spoil x2 (not set in stone, might be changed) • Local & Server-Side Dualbox Protection • Complete, Clear Website with Integrated Account Panel (Game account creation, direct communication with support, bug reporting, voting and reward system) • Launcher – External Game Login System: manage all your accounts inside the launcher, “Play” button logs you directly into the game server Here are list of few changes we already added/decided to add to the server: • Reworked Client to fit interlude Era with upgraded Classic Ui • Custom Antibot system • Custom AntiDualBox System • Offline shops • Offline shop with buffs (available only in towns) • Mass Sweeper added to the game • Newbie buffs available all the way to lvl 76 (nothing crazy, but its free) • Slight balance change to Destroyer damage with Polearm and Cancel spell from SPS • PvP zones on every Epic spawn spot • Overbuffing blocked • And more! Since we put big focus on community feedback and suggestions, we are looking for people for our internal tests, that will discuss whether current changes „fit” into the game and maybe suggest some changes themselves. If what you’ve just read sounds interesting to you, if you want to help creating server fitted for you, join our server Discord. Help us to understand what Lineage 2 players in 2026 actually expect and need — so we can meet those expectations and avoid becoming just another server that dies a natural death.     Even if you’re not interested in playing right now, but you are a long-time Lineage 2 player, feel free to join our community. We would greatly appreciate your experience and feedback to help us improve and develop our project. Join the growing L2Genesis community: https://discord.gg/mcuHsQzNCm Also check our website: https://l2genesis.com/
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..