Jump to content

Recommended Posts

Posted

/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package handlers.voicedcommandhandlers;

import javolution.text.TextBuilder;

import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Logger;

import net.sf.l2j.Base64;
import net.sf.l2j.Config;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.communitybbs.Manager.RegionBBSManager;
import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
import net.sf.l2j.gameserver.model.L2World;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
import net.sf.l2j.gameserver.network.serverpackets.PartySmallWindowAll;
import net.sf.l2j.gameserver.network.serverpackets.PartySmallWindowDeleteAll;

/**
* 
* @author TheEnd
*
*/
public class UserControlPanel implements IVoicedCommandHandler
{
private static final String[] _voicedCommands =
{
	"ucp",
	"ucep_changename",
	"ucp_hero",
	"ucp_titile",
	"ucp_nokarma",
	"ucp_revive",
	"ucp_NameGreen",
	"ucp_NameRed",
	"ucp_NameBlue",
	"ucp_NameYellow",
	"ucp_noble",
	"ucp_rep"
};

public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
{
	if (command.equalsIgnoreCase("ucp"))
	{
		activeChar.sendMessage("Uses:ucep_changename,ucp_hero,ucp_titile,ucp_nokarma,ucp_revive,ucp_NameGreen,ucp_NameRed,ucp_NameBlue,ucp_NameYellow,ucp_noble,ucp_rep");
	}
	else if (command.startsWith("ucp_changename"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		try
		{
			String val = command.substring(17);
			L2World.getInstance().removeFromAllPlayers(activeChar);
			activeChar.setName(val);
			activeChar.store();
			L2World.getInstance().addToAllPlayers(activeChar);

			activeChar.sendMessage("Your name has  changed.");
			activeChar.broadcastUserInfo();

			if (activeChar.isInParty())
			{
				// Delete party window for other party members
				activeChar.getParty().broadcastToPartyMembers(activeChar, new PartySmallWindowDeleteAll());
				for (L2PcInstance member : activeChar.getParty().getPartyMembers())
				{
					// And re-add
					if (member != activeChar)
						member.sendPacket(new PartySmallWindowAll(member, activeChar.getParty()));
				}
			}
			if (activeChar.getClan() != null)
			{
				activeChar.getClan().broadcastClanStatus();
			}

			RegionBBSManager.getInstance().changeCommunityBoard();
		}
		catch (StringIndexOutOfBoundsException e)
		{ //Case of empty character name
			activeChar.sendMessage("Wrong Usage");
		}



	}
	else if (command.equalsIgnoreCase("ucp_hero"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		activeChar.setHero(true);
	}
	else if(command.equalsIgnoreCase("ucp_title"))
	{
		String val = command.substring(17);
		activeChar.setTitle(val);
	}
	else if (command.equalsIgnoreCase("ucp_nokarma"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		activeChar.setKarma(0);
	}
	else if (command.equalsIgnoreCase("ucp_revive"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		activeChar.doRevive();
		activeChar.setCurrentHp(100);
	}
	else if (command.equalsIgnoreCase("ucp_NameGreen"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		activeChar.getAppearance().setNameColor(127, 255, 0);
	}
	else if (command.equalsIgnoreCase("ucp_NameRed"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		activeChar.getAppearance().setNameColor(255, 69, 0);	
	}
	else if (command.equalsIgnoreCase("ucp_NameBlue"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		activeChar.getAppearance().setNameColor(92, 172, 238);	
	}
	else if (command.equalsIgnoreCase("ucp_NameYellow"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		activeChar.getAppearance().setNameColor(255, 215, 0);	
	}
	else if (command.equalsIgnoreCase("ucp_noble"))
	{
		if(activeChar.isNoble())
           {
               activeChar.sendMessage("You Are Already  Noblesse!");
           } 
		else
           {
			InventoryUpdate iu = new InventoryUpdate();
			activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
               activeChar.setNoble(true);
               activeChar.sendMessage("You Are Now a Noble.");
               activeChar.broadcastUserInfo();
               		}
	}
	else if (command.equalsIgnoreCase("ucp_rep"))
	{
		InventoryUpdate iu = new InventoryUpdate();
		activeChar.getInventory().destroyItemByItemId("Item", x, y, activeChar, activeChar.getTarget());
		activeChar.getClan().setReputationScore(5000, true);
	}
	return true;
}


public String[] getVoicedCommandList()
{
	return _voicedCommands;
}
}

make a file UserAccountControl.java

I made it for Fun so It isnt tested....

x= item ID

y= amount

 

 

Posted

Yea, nice work TheEnd..also you could make config for X/Y..but without its also good.

 

Good Job  ;)

 

hmm seems intresting but what it does ? ;D

 

Read the code.

Posted

Yea, nice work TheEnd..also you could make config for X/Y..but without its also good.

 

Good Job  ;)

 

Read the code.

yes But I would need 2 Configs for every command :D

Posted

yes But I would need 2 Configs for every command :D

its possible to be done only with 1 config for all the commands... just think how

  • 4 weeks later...
  • 2 months later...
Posted

[quote name="TheEnd" post="640989" timestamp="1254227143"]
public class UserControlPanel implements IVoicedCommandHandler
{
private static final String[] _voicedCommands =
{
	"ucp",
	"ucep_changename",
	"ucp_hero",
	"ucp_titile",              <---------------------------------------------- title
	"ucp_nokarma",
	"ucp_revive",
	"ucp_NameGreen",
	"ucp_NameRed",
	"ucp_NameBlue",
	"ucp_NameYellow",
	"ucp_noble",
	"ucp_rep"
};
[/quote]

 

 

however well done ;)

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

    • Inventory restock: Premium business accounts are now available.   ✔ Wallester Business EU 🇪🇺|💳 Unlimited virtual cards, physical cards, 🏦 multi-currency IBAN, ₿ crypto & stablecoin deposits. ✔ Stripe Business UK 🇬🇧|💳 Instant virtual cards (Visa/Mastercard), high-conversion checkout, multi-currency payouts, ₿ crypto payments, no-code payment links. ✔ Mercury Business US 🇺🇸|🏦 US checking & savings, 💳 unlimited virtual cards, domestic & International wires, native stablecoin settlement. ✔ Payset Business EU 🇪🇺|🏦 Multiple IBANs, UK sort code, SEPA Instant, 💳 unlimited virtual cards, multi-currency accounts. ✔ Novo Business US 🇺🇸|🏦 Business checking account, ACH payments & invoicing, 💳 virtual & physical cards, novo boost.
    • Let me see if I understand correctly, older gentlemen, when a newcomer shows up to create modern things with the help of AI, doing what you charge them to do, you point the finger and laugh. I believe that's why everything is stagnant. The product isn't for programming experts, it's for newcomers. Don't buy from you if they can do it themselves using this base. You're going to deliver a similar product, maybe even worse than this one, so why are you complaining? PowerShell, as you well know, started with it, then came new platforms and new apps, new creation models, all with different languages; I chose the simplest one for my taste. This is about being organized and knowing how to choose the right words for each situation. It's not 100%, but it already gives a good impression. Nothing is 100%, so a topic written by AI, and all the code that you charge an absurd amount for to prohibit and sell hacks, could be open source so that everyone can create new practices, new models, new information for passing packets, prohibiting the use of cheats that cause server owners to break so much. Let's remember that the Admin doesn't always shut down the server; it's the players who find problems and take advantage by buying and reselling items, and they say that the GM shuts down the server every week, but that's a lie. What they do is duplicate items with packages and sell them, but perhaps this could give some future developers a starting point to create their own protection following the model in the initial documentation. Because none of you answer a question from a newbie, you think you're superior because you have knowledge, but with AI, people like that can have the same knowledge as you, but with less practice. And if they practice a lot, 10,000 hours, they can be as good as all of you older developers in the L2J field.
  • 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..