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

    • When you say bots allowed, it means we are allowed to use adrenaline ?
    • https://l2mayhem.ru/   The Mayhem Server is designed for players who want to enjoy the game without unnecessary stress or steep barriers. We focus on a comfortable gaming experience: the mechanics are adapted so that even newcomers can get up to speed quickly, while veterans will be happy to return to the beloved universe. On the server, character progression and content difficulty are well balanced: your character develops steadily, without the need to spend huge amounts of time on repetitive tasks. For players’ convenience, we’ve implemented autofarm - it lets you complete daily tasks efficiently. Moreover, bots are officially allowed on the server: they help automate routine actions, so you can focus on the most exciting parts of the game - sieges, PvP, clan wars, and crafting. The server’s atmosphere is friendly: the active community is always ready to offer advice, and the administration ensures order and fairness. Whether you’re looking for a relaxed leveling and world‑exploration experience or want to take part in intense events, everyone can find their own pace and playstyle here. Right now, the server features new activities: we’ve added new instances and locations with unique mechanics and rewards, as well as rare items that can only be obtained in these zones. This is a great chance to get powerful gear and stand out among other players.   Rates: - Grind: EXP/SP x3 (Raid Bosses: x3). - Loot: Drop/Spoil/Adena x3; Raid/Epic Raid drops x3. - Quests: All rewards x1.   Gameplay: - Accounts are created automatically. - Mammons is located in the Town of Giran. - Each character has access to the unlimited Auto Farm function. - Mass party functions activated by the party leader. - A pre-installed shortcut panel is provided for each new character. - The full list of chat commands is available on the Community Board. - Players have a x25 weight limit and an increased inventory capacity. - All buffs, dances, and songs last for 2 hours. - Spawn protection lasts 10 seconds after teleporting. - Treasure Chests have been removed from spawns. - Cursed Weapons have been removed from drops. - Common items can no longer be purchased or obtained as drops. - Mobs and Raid Bosses no longer use Cancel skill. - Equipment up to the Dynasty can be purchased with adena. - Shots up to S grade and consumables are available in the Community Board. - Offline shops are supported: simply set up a shop and type the .offline command in chat. - No drop penalty on Raid Bosses unless the player is over 5 levels higher than the boss; otherwise, the drop chance is reduced. - Mana Potions restore 1500 MP and have a 10‑second reuse time. Newbie Mana Potions restore 500 MP. - The Vitality, Nevit, and Recommendations systems have been disabled. - The store now offers a lower buy price for player‑sold items. - NPC Victor visits Town of Giran on Wednesdays and Saturdays for gear/doll upgrades and elemental exchange. - Once you hit level 40, every mob can drop one of three medals: Bronze, Silver, or Gold.   Premium: - +35% to EXP/SP, Adena, Seal Stones, Element Stones, and Epaulette drops. - Buffs, dances, and songs last 3 hours. - With Premium, players can get 3‑hour buffs by purchasing them from other players.   Enchanting: - The chance to successfully enchant gear is 65%. Safe enchantment is up to +3; the maximum enchant level is +20. - Elemental Stones: 50% chance. Elemental Crystals: 30% chance.   Skills: - Auto‑learn all skills and Forgotten Skills. - 30 buff slots, 12 Dance/Song slots. - Subclass max level raised to 85.   Quests: - 25 000 Adena is required to obtain the 1st class; 250 000 Adena for the 2nd class; 10 000 000 Adena for the 3rd class. - The subclass quest is not required. - The Freya quest is not required. - The Hard Freya quest is not required. - Access to Frintezza is granted only after completing the quest or upon having the purchased quest item. - Access to Baium is granted only after completing the quest or upon having the purchased quest item. - Access to Antharas is granted only after completing the quest or upon having the purchased quest item. - Access to Valakas is granted only after completing the quest or upon having the purchased quest item. - Hellbound progression is at level 1.   Olympiad: - Olympiads are held monthly. - Enchantment limit is +6. - Starting Olympiad requires 6 characters. - You need 15 battles to receive a reward. - Only non‑class battles are available.   Sieges/Territory Wars: - Flags are returned to their owners at the start of each Territory War, which occurs every 2 weeks. - A clan’s maximum number of captured flags in TW is 3.   Raid Bosses/Epic Bosses/Instance Features: - RB status is available on the Community Board. - Freya - 6-27 chars to enter. - Hard Freya - 6-27 chars to enter. - Frintezza - 6-45 chars to enter. - Ultra Daytime Zaken - 6-9 chars to enter. - Daytime Zaken - 6-9 chars to enter. - Nightly Zaken - 6-450 chars to enter. - Tiat - 9-45 chars to enter. - Beleth - 9 chars to enter. - Day/night restrictions for all Zaken instances have been removed. - Level‑limited zones: Ant Nest (levels 1–45), Sea of Spores (levels 1–56), Core (levels 1–56). - Almost all Raid Bosses listed in the Community Board drop an Enchanting Box with a 100% chance. - New Raid Bosses and their jewelry have been added. Teleport to these bosses via NPC Mirelle in Town of Giran. - New Instances: dolls, timed epic jewelry, and upgrade item for cloaks, bracelets, and accessories. Enter via NPC Ancient Portal in Town of Giran; 6-9 chars to enter.
    • Estou procurando cloacks do classic adaptadas para cliente interlude.
    • Good luck with your sales, but: Demo video. Show the siege, the olympiad, the tvt when you are selling something so complex and expensive.
    • 1.8 BILION NEW STOCK.70 E PER BILION DISCOUNT IF BUY ALL
  • 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..