Перейти к содержанию
Авторизация  
Mi4man

Сервис Менеджер

Рекомендуемые сообщения

Приветливую, ребята помогите доделать на 100% сервис менеджер, может для вас и смешно будет , но мне не понятно такая фишка

сервис менеджер вытянул с Silentium устанавливаю на чистые aCis (хоть L2S на aCis ) не получается фиксануть сохранения ColorName или Title подобный баг был и на селентиум но там пофиксели, Selentium(у) в личку доставать не охото)) помогите а )

всё работает,гс не ругается только вот не сохраняет покраску (sql c characters в базу залил с розширением Color_Name Color_Title )

 

вот сам файл

 

package custom.ServicesManager;

 

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.SQLException;

import java.util.Calendar;

 

import java.util.logging.Logger;

 

import net.sf.l2j.Config;

import net.sf.l2j.L2DatabaseFactory;

import net.sf.l2j.gameserver.datatables.CharNameTable;

import net.sf.l2j.gameserver.datatables.ClanTable;

import net.sf.l2j.gameserver.datatables.SkillTable;

import net.sf.l2j.gameserver.model.actor.L2Npc;

import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;

import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;

import net.sf.l2j.gameserver.model.quest.Quest;

import net.sf.l2j.gameserver.model.quest.QuestState;

import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;

 

/**

* @author TrueMan

* @version 1.0

* @

* @Odaptor Mi4man

*/

public class ServicesManager extends Quest

{

private static final Logger _log = Logger.getLogger(ServicesManager.class.getName());

 

// ID НПЦ

private static final int ServicesNpcId = Config.SERVICE_NPC_ID;

 

// Продажа нубла

private static final int nobleItemId = Config.NOBLE_ITEM_ID;

private static final int nobleItemCount = Config.NOBLE_ITEM_COUNT;

 

// Продажа фул клан скилов

private static final int skillItemId = Config.FULL_SKILL_ITEM_ID;

private static final int skillItemCount = Config.FULL_SKILL_ITEM_COUNT;

 

// Смена ника

private static final int changeNameItemId = Config.CHANGE_NAME_ITEM_ID;

private static final int changeNameItemCount = Config.CHANGE_NAME_ITEM_COUNT;

 

// Покраска ника и титула

private static final int changeColorItemId = Config.CHANGE_COLOR_ITEM_ID;

private static final int changeColorItemCount = Config.CHANGE_COLOR_ITEM_COUNT;

 

// Смена имени клана

private static final int changeClanNameItemId = Config.CHANGE_CLAN_NAME_ITEM_ID;

private static long changeClanNameItemCount = Config.CHANGE_CLAN_NAME_ITEM_COUNT;

private static final int clanMinLevel = Config.CLAN_MIN_LEVEL;

 

// Продажа уровня клана

private static final int clanLevelItemsId6 = Config.CLAN_LEVEL6_ITEM_ID;

private static final int clanLevelItemsCount6 = Config.CLAN_LEVEL6_ITEM_COUNT;

private static final int clanLevelItemsId7 = Config.CLAN_LEVEL7_ITEM_ID;

private static final int clanLevelItemsCount7 = Config.CLAN_LEVEL7_ITEM_COUNT;

private static final int clanLevelItemsId8 = Config.CLAN_LEVEL8_ITEM_ID;

private static final int clanLevelItemsCount8 = Config.CLAN_LEVEL8_ITEM_COUNT;

 

// Репутация клана

private static final int clanReputationPointsItemId = Config.REPUTATION_ITEM_ID;

private static final int clanReputationPointsItemCount = Config.REPUTATION_ITEM_COUNT;

private static final int clanReputationPointsItemId1 = Config.REPUTATION_ITEM_ID1;

private static final int clanReputationPointsItemCount1 = Config.REPUTATION_ITEM_COUNT1;

private static final int clanReputationPointsItemId2 = Config.REPUTATION_ITEM_ID2;

private static final int clanReputationPointsItemCount2 = Config.REPUTATION_ITEM_COUNT2;

 

// Смена пола

private static final int changeGenderItemId = Config.CHANGE_GENDER_ITEM_ID;

private static final int changeGenderItemCount = Config.CHANGE_GENDER_ITEM_COUNT;

 

// Премиум

private static final int premiumItemId = Config.PREMIUM_ITEM_ID;

private static final int premiumItemCount = Config.PREMIUM_ITEM_COUNT;

 

public ServicesManager(int questId, String name, String descr)

{

super(questId, name, descr);

 

addStartNpc(ServicesNpcId);

addFirstTalkId(ServicesNpcId);

addTalkId(ServicesNpcId);

}

 

public static void main(String args[])

{

new ServicesManager(-1, ServicesManager.class.getSimpleName(), "custom");

}

 

@Override

public String onFirstTalk(L2Npc npc, L2PcInstance player)

{

if (player.getQuestState(getName()) == null)

{

newQuestState(player);

}

else if (player.isInCombat() || player.getPvpFlag() == 1 || player.getKarma() != 0 || OlympiadManager.getInstance().isRegistered(player) || player.isDead() || player.isFakeDeath())

{

return "Services-Blocked.htm";

}

 

return "Services.htm";

}

 

@Override

public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)

{

String htmlText = event;

QuestState st = player.getQuestState(getName());

 

if (event.equals("setNoble"))

{

if (!player.isNoble())

{

if (st.getQuestItemsCount(nobleItemId) >= nobleItemCount)

{

st.takeItems(nobleItemId, nobleItemCount);

player.setNoble(true, true);

player.setTarget(player);

player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));

player.broadcastUserInfo();

return "NoblesseServices-Success.htm";

}

return "NoblesseServices-NoItems.htm";

}

return "NoblesseServices-AlredyNoble.htm";

}

else if (event.startsWith("levelUp"))

{

if (player.isClanLeader())

{

if (event.equals("levelUp6Clan"))

{

if (st.getQuestItemsCount(clanLevelItemsId6) >= clanLevelItemsCount6)

{

st.takeItems(clanLevelItemsId6, clanLevelItemsCount6);

player.getClan().changeLevel(6);

player.getClan().broadcastClanStatus();

player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");

player.setTarget(player);

player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));

return "ClanLevelUp.htm";

}

return "ClanLevelUp-NoItems.htm";

}

else if (event.equals("levelUp7Clan"))

{

if (st.getQuestItemsCount(clanLevelItemsId7) >= clanLevelItemsCount7)

{

st.takeItems(clanLevelItemsId7, clanLevelItemsCount7);

player.getClan().changeLevel(7);

player.getClan().broadcastClanStatus();

player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");

player.setTarget(player);

player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));

return "ClanLevelUp.htm";

}

return "ClanLevelUp-NoItems.htm";

}

else if (event.equals("levelUp8Clan"))

{

if (st.getQuestItemsCount(clanLevelItemsId8) >= clanLevelItemsCount8)

{

st.takeItems(clanLevelItemsId8, clanLevelItemsCount8);

player.getClan().changeLevel( 8);

player.getClan().broadcastClanStatus();

player.sendMessage("Your clan is now level " + player.getClan().getLevel() + ".");

player.setTarget(player);

player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));

return "ClanLevelUp.htm";

}

return "ClanLevelUp-NoItems.htm";

}

}

else

{

return "ClanLevelUp-NoLeader.htm";

}

}

else if (event.equals("setClanSkill"))

{

if (player.isClanLeader() && player.getClan().getLevel() == 8)

{

if (st.getQuestItemsCount(skillItemId) >= skillItemCount)

{

st.takeItems(skillItemId, skillItemCount);

player.setTarget(player);

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(370, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(371, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(372, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(373, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(374, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(375, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(376, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(377, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(378, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(379, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(380, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(381, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(382, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(383, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(384, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(385, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(386, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(387, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(388, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(389, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(390, 3));

st.getPlayer().getClan().addNewSkill(SkillTable.getInstance().getInfo(391, 1));

player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));

player.broadcastUserInfo();

return "ClanSkillServices-Success.htm";

}

return "ClanSkillServices-NoItems.htm";

}

return "ClanSkillServices-Error.htm";

}

else if (event.equals("changeGender"))

{

if (st.getQuestItemsCount(changeGenderItemId) >= changeGenderItemCount)

{

st.takeItems(changeGenderItemId, changeGenderItemCount);

player.getAppearance().setSex(player.getAppearance().getSex() ? false : true);

player.setTarget(player);

player.broadcastPacket(new MagicSkillUse(player, 5103, 1, 1000, 0));

player.broadcastUserInfo();

 

return "ChangeGender-Success.htm";

}

return "ChangeGender-NoItems.htm";

}

else if (event.startsWith("changeName"))

{

try

{

String newName = event.substring(11);

 

if (st.getQuestItemsCount(changeNameItemId) >= changeNameItemCount)

{

if (newName == null)

{

return "ChangeName.htm";

}

if (!newName.matches("^[a-zA-Z0-9]+$"))

{

player.sendMessage("Incorrect name. Please try again.");

return "ChangeName.htm";

}

else if (newName.equals(player.getName()))

{

player.sendMessage("Please, choose a different name.");

return "ChangeName.htm";

}

else if (CharNameTable.doesCharNameExist(newName))

{

player.sendMessage("The name " + newName + " already exists.");

return "ChangeName.htm";

}

else

{

st.takeItems(changeNameItemId, changeNameItemCount);

player.setName(newName);

player.store();

player.sendMessage("Your new character name is " + newName);

player.broadcastUserInfo();

player.getClan().broadcastClanStatus();

 

return "ChangeName-Success.htm";

}

}

return "ChangeName-NoItems.htm";

}

catch (Exception e)

{

player.sendMessage("Вы успешно сменили ник!");

return "ChangeName.htm";

}

}

 

else if (event.equals("Color1"))

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x993399);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

 

else if (event.equals("Color2"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x00CCCC);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color3"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x0099FF);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color4"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0xCC00CC);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color5"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x3366FF);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color6"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x0000CC);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color7"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x9999CC);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color8"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0xCC33FF);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color9"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0xCC99FF);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color10"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x003366);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color11"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x333366);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color12"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x990099);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color13"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x003399);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color14"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setNameColor(0x000000);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color15"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x000000);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color16"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x000090);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color17"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x0000ff);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color18"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x009000);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color19"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x00FF00);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color20"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x900000);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color21"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0xFF0000);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color22"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x009090);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color23"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x0090FF);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color24"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x00FFFF);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color25"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x900090);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color26"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x9000FF);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color27"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0xff00ff);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color28"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0x909000);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color29"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0xFFFF00);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

 

else if (event.equals("Color30"))

{

{

if (st.getQuestItemsCount(changeColorItemId) >= changeColorItemCount)

{

st.takeItems(changeColorItemId, changeColorItemCount);

st.getPlayer().getAppearance().setTitleColor(0xffffff);

player.broadcastUserInfo();

return "ColorServices-Success.htm";

}

return "ColorServices-NoItems.htm";

}

}

else if (event.startsWith("changeClanName"))

{

if (player.getClan() == null)

{

return "ChangeClanName-NoClan.htm";

}

try

{

String newClanName = event.substring(15);

 

if (st.getQuestItemsCount(changeClanNameItemId) >= changeClanNameItemCount)

{

if (newClanName == null)

{

return "ChangeClanName.htm";

}

if (!player.isClanLeader())

{

player.sendMessage("Only the clan leader can change the clan name.");

return "ChangeClanName.htm";

}

else if (player.getClan().getLevel() < clanMinLevel)

{

player.sendMessage("Your clan must be at least level " + clanMinLevel + " to change the name.");

return "ChangeClanName.htm";

}

else if (!newClanName.matches("^[a-zA-Z0-9]+$"))

{

player.sendMessage("Incorrect name. Please try again.");

return "ChangeClanName.htm";

}

else if (newClanName.equals(player.getClan().getName()))

{

player.sendMessage("Please, choose a different name.");

return "ChangeClanName.htm";

}

else if (ClanTable.getInstance().getClanByName(newClanName) != null)

{

player.sendMessage("The name " + newClanName + " already exists.");

return "ChangeClanName.htm";

}

else

{

st.takeItems(changeNameItemId, changeNameItemCount);

player.getClan().setName(newClanName);

 

try (Connection con = L2DatabaseFactory.getInstance().getConnection())

{

PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET clan_name=? WHERE clan_id=?");

statement.setString(1, newClanName);

statement.setInt(2, player.getClan().getClanId());

statement.execute();

statement.close();

}

catch (Exception e)

{

_log.info("Error updating clan name for player " + player.getName() + ". Error: " + e);

}

 

player.sendMessage("Your new clan name is " + newClanName);

player.getClan().broadcastClanStatus();

 

return "ChangeClanName-Success.htm";

}

}

return "ChangeClanName-NoItems.htm";

}

catch (Exception e)

{

player.sendMessage("Please, insert a correct name.");

return "ChangeClanName.htm";

}

}

else if (event.startsWith("crp"))

{

if (player.isClanLeader())

{

if (event.equals("crp1"))

{

if (st.getQuestItemsCount(clanReputationPointsItemId) >= clanReputationPointsItemCount)

{

st.takeItems(clanReputationPointsItemId, clanReputationPointsItemCount);

player.getClan().addReputationScore(5000);

player.getClan().broadcastClanStatus();

 

return "ClanLevelUp.htm";

}

return "ClanLevelUp-NoItems.htm";

}

else if (event.equals("crp2"))

{

if (st.getQuestItemsCount(clanReputationPointsItemId1) >= clanReputationPointsItemCount1)

{

st.takeItems(clanReputationPointsItemId1, clanReputationPointsItemCount1);

player.getClan().addReputationScore(10000);

player.getClan().broadcastClanStatus();

 

return "ClanLevelUp.htm";

}

return "ClanLevelUp-NoItems.htm";

}

else if (event.equals("crp3"))

{

if (st.getQuestItemsCount(clanReputationPointsItemId2) >= clanReputationPointsItemCount2)

{

st.takeItems(clanReputationPointsItemId1, clanReputationPointsItemCount1);

player.getClan().addReputationScore(20000);

player.getClan().broadcastClanStatus();

 

return "ClanLevelUp.htm";

}

return "ClanLevelUp-NoItems.htm";

}

}

}

else if (event.equals("premium1"))

{

if (st.getQuestItemsCount(premiumItemId) >= premiumItemCount)

{

st.takeItems(premiumItemId, premiumItemCount);

addPremiumService(24, player);

return "PremiumAccount-Success.htm";

}

return "PremiumAccount-NoItems.htm";

}

else if (event.equals("premium2"))

{

if (st.getQuestItemsCount(premiumItemId) >= (premiumItemCount * 2))

{

st.takeItems(premiumItemId, premiumItemCount * 2);

addPremiumService(24 * 3, player);

return "PremiumAccount-Success.htm";

}

return "PremiumAccount-NoItems.htm";

}

else if (event.equals("premium3"))

{

if (st.getQuestItemsCount(premiumItemId) >= (premiumItemCount * 3))

{

st.takeItems(premiumItemId, premiumItemCount * 3);

addPremiumService(24 * 7, player);

return "PremiumAccount-Success.htm";

}

return "PremiumAccount-NoItems.htm";

}

else if (event.equals("premium4"))

{

if (st.getQuestItemsCount(premiumItemId) >= (premiumItemCount * 3))

{

st.takeItems(premiumItemId, premiumItemCount * 3);

addPremiumService(24 * 14, player);

return "PremiumAccount-Success.htm";

}

return "PremiumAccount-NoItems.htm";

}

else if (event.equals("premium5"))

{

if (st.getQuestItemsCount(premiumItemId) >= (premiumItemCount * 3))

{

st.takeItems(premiumItemId, premiumItemCount * 3);

addPremiumService(24 * 30, player);

return "PremiumAccount-Success.htm";

}

return "PremiumAccount-NoItems.htm";

}

return htmlText;

}

 

private static void addPremiumService(int hours, L2PcInstance player)

{

try (Connection con = L2DatabaseFactory.getInstance().getConnection())

{

Calendar finishtime = Calendar.getInstance();

finishtime.setTimeInMillis(System.currentTimeMillis());

finishtime.set(Calendar.SECOND, 0);

finishtime.add(Calendar.HOUR, hours);

 

PreparedStatement statement = con.prepareStatement("UPDATE account_premium SET premium_service=?,enddate=? WHERE account_name=?");

statement.setInt(1, 1);

statement.setLong(2, finishtime.getTimeInMillis());

statement.setString(3, player.getAccountName());

statement.execute();

statement.close();

}

catch (SQLException e)

{

_log.info("EventPremiumNpc: Could not increase data");

}

}

}

 

 

вот для скачивания если нужно хз.... https://yadi.sk/d/jdH4z2gwUJQy3

 

P.s теме обязательно пофлудить и по тролить+)

Изменено пользователем Mi4man

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

ну надо и в ядре прописивать

где?

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Кто то фиксел этот баг=) подсказочку б

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Кто то фиксел этот баг=) подсказочку б

Это не баг, просто в акисах нету такого понятия как сохранения цвета ника/титула в прицепе чего и нет на офф, берите с любых сурсов более менее реализованых, вон последний сурс который Silentium кидал в шару, там поправлена проблема с сохранением цвета.

Изменено пользователем Mr.Smith
  • Upvote 1

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Сделай запись в базу в свои нужные ячейки только не забудь 'брать' цвет на входе в игру иначе будет стандартный цвет

  • Upvote 1

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

как-то так, а вообще google не отменяли.

 

 

Index: aCis_gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java

===================================================================

--- aCis_gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java (revision 203)

+++ aCis_gameserver/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java (working copy)

@@ -343,7 +343,8 @@

else

return false;

 

- player.getAppearance().setNameColor(Integer.decode("0x"+val));

+ //player.getAppearance().setNameColor(Integer.decode("0x"+val));

+ player.setNameColor(val);

player.sendMessage("Your name color has been changed by a GM.");

player.broadcastUserInfo();

}

@@ -366,7 +367,8 @@

else

return false;

 

- player.getAppearance().setTitleColor(Integer.decode("0x" + val));

+ //player.getAppearance().setTitleColor(Integer.decode("0x" + val));

+ player.setTitleColor(val);

player.sendMessage("Your title color has been changed by a GM.");

player.broadcastUserInfo();

}

Index: aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java

===================================================================

--- aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 203)

+++ aCis_gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)

@@ -246,8 +246,8 @@

 

// Character SQL String Definitions:

private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";

- private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";

- private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";

+ private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,name_color=?,title_color=? WHERE obj_id=?";

+ private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,name_color,title_color FROM characters WHERE obj_id=?";

 

// Character Subclass SQL String Definitions:

private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";

@@ -641,6 +641,30 @@

private double _mpUpdateDecCheck = .0;

private double _mpUpdateInterval = .0;

+

+ private String _nameColor;

+ private String _titleColor;

+ public void setNameColor(String _color){

+ _nameColor = _color;

+ getAppearance().setNameColor(Integer.decode("0x"+_nameColor));

+ broadcastUserInfo();

+ }

+ public String getNameColor(){

+ return _nameColor;

+ }

+ public void setTitleColor(String _color){

+ _titleColor = _color;

+ getAppearance().setTitleColor(Integer.decode("0x"+_titleColor));

+ broadcastUserInfo();

+ }

+ public String getTitleColor(){

+ return _titleColor;

+ }

+

+

/** Char Coords from Client */

private int _clientX;

private int _clientY;

@@ -6183,6 +6207,9 @@

player.setNewbie(rset.getInt("newbie")==1);

player.setNoble(rset.getInt("nobless")==1);

 

+ player.setNameColor(rset.getString("name_color"));

+ player.setTitleColor(rset.getString("title_color"));

+

player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));

if (player.getClanJoinExpiryTime() < System.currentTimeMillis())

player.setClanJoinExpiryTime(0);

@@ -6653,7 +6680,9 @@

statement.setLong(48, getClanCreateExpiryTime());

statement.setString(49, getName());

statement.setLong(50, getDeathPenaltyBuffLevel());

- statement.setInt(51, getObjectId());

+ statement.setString(51, getNameColor());

+ statement.setString(52, getTitleColor());

+ statement.setInt(53, getObjectId());

 

statement.execute();

statement.close();

Index: aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java

===================================================================

--- aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 203)

+++ aCis_gameserver/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)

@@ -157,6 +157,9 @@

if (Config.PLAYER_SPAWN_PROTECTION > 0)

activeChar.setProtection(true);

 

+ activeChar.setNameColor(activeChar.getNameColor());

+ activeChar.setTitleColor(activeChar.getTitleColor());

+

activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());

 

// buff and status icons

 

 

Изменено пользователем METADOH
  • Upvote 1

Поделиться сообщением


Ссылка на сообщение
Поделиться на другие сайты

Для публикации сообщений создайте учётную запись или авторизуйтесь

Вы должны быть пользователем, чтобы оставить комментарий

Создать учетную запись

Зарегистрируйте новую учётную запись в нашем сообществе. Это очень просто!

Регистрация нового пользователя

Войти

Уже есть аккаунт? Войти в систему.

Войти
Авторизация  

  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

×
×
  • Создать...