Ir para conteúdo
  • Cadastre-se

cauehbr

Membro
  • Total de itens

    6
  • Registro em

  • Última visita

Sobre cauehbr

cauehbr's Achievements

Aprendiz de Novato

Aprendiz de Novato (1/14)

0

Reputação

  1. Fiz sim tudo que vc falou mas nada com sucesso . muito obrigado pela ajuda vou tentar outros metodos para ver se consigo obrigado pela atençao aa isso de erro no gs
  2. E esse ?? ======================================================================== package com.l2jfrozen.gameserver.handler.admincommandhandlers; import java.sql.Connection; import java.sql.PreparedStatement; import java.util.Collection; import org.apache.log4j.Logger; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.cache.HtmCache; import com.l2jfrozen.gameserver.datatables.GmListTable; import com.l2jfrozen.gameserver.datatables.sql.ItemTable; import com.l2jfrozen.gameserver.handler.IAdminCommandHandler; import com.l2jfrozen.gameserver.model.L2Object; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; import com.l2jfrozen.gameserver.model.entity.Announcements; import com.l2jfrozen.gameserver.network.serverpackets.ExShowScreenMessage; import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jfrozen.gameserver.network.serverpackets.SocialAction; import com.l2jfrozen.gameserver.templates.L2Item; import com.l2jfrozen.util.CloseUtil; import com.l2jfrozen.util.database.L2DatabaseFactory; public class AdminDonator implements IAdminCommandHandler { private static String[] ADMIN_COMMANDS = { "admin_setdonator" }; protected static final Logger LOGGER = Logger.getLogger(AdminDonator.class); @Override public boolean useAdminCommand(final String command, final L2PcInstance activeChar) { /* * if(!AdminCommandAccessRights.getInstance().hasAccess(command, activeChar.getAccessLevel())){ return false; } if(Config.GMAUDIT) { Logger _logAudit = Logger.getLogger("gmaudit"); LogRecord record = new LogRecord(Level.INFO, command); record.setParameters(new Object[] { "GM: " + * activeChar.getName(), " to target [" + activeChar.getTarget() + "] " }); _logAudit.LOGGER(record); } */ if (activeChar == null) return false; if (command.startsWith("admin_setdonator")) { L2Object target = activeChar.getTarget(); if (target instanceof L2PcInstance) { L2PcInstance targetPlayer = (L2PcInstance) target; final boolean newDonator = !targetPlayer.isDonator(); if (newDonator) { targetPlayer.setDonator(true); targetPlayer.updateNameTitleColor(); updateDatabase(targetPlayer, true); sendMessages(true, targetPlayer, activeChar, false, true); targetPlayer.broadcastPacket(new SocialAction(targetPlayer.getObjectId(), 16)); targetPlayer.broadcastUserInfo(); targetPlayer.getInventory().addItem("", Config.DONATOR_ITEM, Config.DONATOR_ITEM_AMOUNT, targetPlayer, null); String htmFile = "data/html/donator.htm"; String htmContent = HtmCache.getInstance().getHtm(htmFile); NpcHtmlMessage infoHtml = new NpcHtmlMessage(1); infoHtml.setHtml(htmContent); targetPlayer.sendPacket(infoHtml); } else { targetPlayer.setDonator(false); targetPlayer.updateNameTitleColor(); updateDatabase(targetPlayer, false); sendMessages(false, targetPlayer, activeChar, false, true); targetPlayer.broadcastUserInfo(); } targetPlayer = null; } else { activeChar.sendMessage("Impossible to set a non Player Target as Donator."); LOGGER.info("GM: " + activeChar.getName() + " is trying to set a non Player Target as Donator."); return false; } target = null; } return true; } private void sendMessages(final boolean forNewDonator, final L2PcInstance player, final L2PcInstance gm, final boolean announce, final boolean notifyGmList) { if (forNewDonator) { final int item = Config.DONATOR_ITEM; final int amount = Config.DONATOR_ITEM_AMOUNT; final L2Item reward = ItemTable.getInstance().getTemplate(item); player.sendPacket(new ExShowScreenMessage(gm.getName() + " has granted Donator Status for you!", 4000)); gm.sendMessage("You've granted Donator Status for " + player.getName()); player.sendMessage("You have earned " + amount + " " + reward + " for Donator Status."); if (announce) { Announcements.getInstance().announceToAll(player.getName() + " has received Donator Status!"); } if (notifyGmList) { GmListTable.broadcastMessageToGMs("Warn: " + gm.getName() + " has set " + player.getName() + " as Donator !"); } } else { player.sendMessage(gm.getName() + " has revoked Donator Status from you!"); gm.sendMessage("You've revoked Donator Status from " + player.getName()); if (announce) { Announcements.getInstance().announceToAll(player.getName() + " has lost Donator Status!"); } if (notifyGmList) { GmListTable.broadcastMessageToGMs("Warn: " + gm.getName() + " has removed Donator Status of player" + player.getName()); } } } /** * @param player * @param newDonator */ private void updateDatabase(final L2PcInstance player, final boolean newDonator) { Connection con = null; try { // prevents any NPE. // ---------------- if (player == null) return; // Database Connection // -------------------------------- con = L2DatabaseFactory.getInstance().getConnection(false); PreparedStatement stmt = con.prepareStatement(newDonator ? INSERT_DATA : DEL_DATA); // if it is a new donator insert proper data // -------------------------------------------- if (newDonator) { stmt.setInt(1, player.getObjectId()); stmt.setString(2, player.getName()); stmt.setInt(3, player.isHero() ? 1 : 0); stmt.setInt(4, player.isNoble() ? 1 : 0); stmt.setInt(5, 1); stmt.execute(); stmt.close(); stmt = null; } else // deletes from database { stmt.setInt(1, player.getObjectId()); stmt.execute(); stmt.close(); stmt = null; } } catch (final Exception e) { if (Config.ENABLE_ALL_EXCEPTIONS) e.printStackTrace(); LOGGER.error("Error: could not update database: ", e); } finally { CloseUtil.close(con); } } // Updates That Will be Executed by MySQL // ---------------------------------------- String INSERT_DATA = "REPLACE INTO characters_custom_data (obj_Id, char_name, hero, noble, donator) VALUES (?,?,?,?,?)"; String DEL_DATA = "UPDATE characters_custom_data SET donator = 0 WHERE obj_Id=?"; /** * @return */ @Override public String[] getAdminCommandList() { return ADMIN_COMMANDS; } }
  3. vou testar jaja te falo consegui a sourcer dele ver se e isso que voce falou desculpe sou novo nisso. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * L2jFrozen Project - www.l2jfrozen.com * * 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 2, 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, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. * * [Hidden Content] */ package com.l2jfrozen.gameserver.handler; import java.util.Arrays; import javolution.util.FastMap; import org.apache.log4j.Logger; import com.l2jfrozen.Config; import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminAdmin; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminAio; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminAnnouncements; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminBBS; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminBan; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminBuffs; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCTFEngine; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCache; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminChangeAccessLevel; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCharSupervision; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminChristmas; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCreateItem; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminCursedWeapons; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminDelete; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminDonator; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminDoorControl; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminEditChar; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminEditNpc; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminEffects; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminEnchant; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminEventEngine; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminExpSp; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminFightCalculator; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminFortSiege; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminGeodata; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminGm; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminGmChat; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminHeal; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminHelpPage; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminInventory; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminInvul; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminKick; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminKill; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminLevel; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminLogin; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMammon; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminManor; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMassControl; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMassRecall; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMenu; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMobGroup; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminMonsterRace; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminNoble; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminOlympiad; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPForge; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPetition; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPledge; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminPolymorph; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminQuest; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminReload; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRepairChar; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRes; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminRideWyvern; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminScript; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSendDonate; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminShop; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminShutdown; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSiege; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSkill; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSpawn; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSurvey; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTarget; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTeleport; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTest; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTownWar; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminTvTEngine; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminUnblockIp; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminVip; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminWho; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminZone; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminClanFull; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSit; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminSendPmMessageAll; /** * This class ... * @version $Revision: 1.1.4.5 $ $Date: 2005/03/27 15:30:09 $ */ public class AdminCommandHandler { protected static final Logger LOGGER = Logger.getLogger(AdminCommandHandler.class); private static AdminCommandHandler _instance; private final FastMap<String, IAdminCommandHandler> _datatable; public static AdminCommandHandler getInstance() { if (_instance == null) { _instance = new AdminCommandHandler(); } return _instance; } private AdminCommandHandler() { _datatable = new FastMap<>(); registerAdminCommandHandler(new AdminAdmin()); registerAdminCommandHandler(new AdminInvul()); registerAdminCommandHandler(new AdminDelete()); registerAdminCommandHandler(new AdminKill()); registerAdminCommandHandler(new AdminTarget()); registerAdminCommandHandler(new AdminShop()); registerAdminCommandHandler(new AdminCTFEngine()); registerAdminCommandHandler(new AdminAnnouncements()); registerAdminCommandHandler(new AdminCreateItem()); registerAdminCommandHandler(new AdminHeal()); registerAdminCommandHandler(new AdminHelpPage()); registerAdminCommandHandler(new AdminShutdown()); registerAdminCommandHandler(new AdminSpawn()); registerAdminCommandHandler(new AdminSkill()); registerAdminCommandHandler(new AdminScript()); registerAdminCommandHandler(new AdminExpSp()); registerAdminCommandHandler(new AdminEventEngine()); registerAdminCommandHandler(new AdminGmChat()); registerAdminCommandHandler(new AdminEditChar()); registerAdminCommandHandler(new AdminGm()); registerAdminCommandHandler(new AdminTeleport()); registerAdminCommandHandler(new AdminRepairChar()); registerAdminCommandHandler(new AdminChangeAccessLevel()); registerAdminCommandHandler(new AdminChristmas()); registerAdminCommandHandler(new AdminBan()); registerAdminCommandHandler(new AdminPolymorph()); // registerAdminCommandHandler(new AdminBanChat()); registerAdminCommandHandler(new AdminReload()); registerAdminCommandHandler(new AdminKick()); registerAdminCommandHandler(new AdminMonsterRace()); registerAdminCommandHandler(new AdminEditNpc()); registerAdminCommandHandler(new AdminFightCalculator()); registerAdminCommandHandler(new AdminMenu()); registerAdminCommandHandler(new AdminSiege()); registerAdminCommandHandler(new AdminFortSiege()); registerAdminCommandHandler(new AdminPetition()); registerAdminCommandHandler(new AdminPForge()); registerAdminCommandHandler(new AdminBBS()); registerAdminCommandHandler(new AdminEffects()); registerAdminCommandHandler(new AdminDoorControl()); registerAdminCommandHandler(new AdminTest()); registerAdminCommandHandler(new AdminEnchant()); registerAdminCommandHandler(new AdminMassRecall()); registerAdminCommandHandler(new AdminMassControl()); registerAdminCommandHandler(new AdminMobGroup()); registerAdminCommandHandler(new AdminRes()); registerAdminCommandHandler(new AdminMammon()); registerAdminCommandHandler(new AdminUnblockIp()); registerAdminCommandHandler(new AdminPledge()); registerAdminCommandHandler(new AdminRideWyvern()); registerAdminCommandHandler(new AdminLogin()); registerAdminCommandHandler(new AdminCache()); registerAdminCommandHandler(new AdminLevel()); registerAdminCommandHandler(new AdminQuest()); registerAdminCommandHandler(new AdminZone()); registerAdminCommandHandler(new AdminCursedWeapons()); registerAdminCommandHandler(new AdminGeodata()); registerAdminCommandHandler(new AdminManor()); registerAdminCommandHandler(new AdminTownWar()); registerAdminCommandHandler(new AdminTvTEngine()); registerAdminCommandHandler(new AdminDonator()); registerAdminCommandHandler(new AdminNoble()); registerAdminCommandHandler(new AdminBuffs()); registerAdminCommandHandler(new AdminAio()); registerAdminCommandHandler(new AdminVip()); registerAdminCommandHandler(new AdminSendDonate()); registerAdminCommandHandler(new AdminCharSupervision()); registerAdminCommandHandler(new AdminInventory()); registerAdminCommandHandler(new AdminWho()); registerAdminCommandHandler(new AdminClanFull()); registerAdminCommandHandler(new AdminSit()); registerAdminCommandHandler(new AdminOlympiad()); registerAdminCommandHandler(new AdminSendPmMessageAll()); registerAdminCommandHandler(new AdminSurvey()); // L2OFF command // ATTENTION: adding new command handlers, you have to change the // sql file containing the access levels rights LOGGER.info("AdminCommandHandler: Loaded " + _datatable.size() + " handlers."); if (Config.DEBUG) { String[] commands = new String[_datatable.keySet().size()]; commands = _datatable.keySet().toArray(commands); Arrays.sort(commands); for (final String command : commands) { if (AdminCommandAccessRights.getInstance().accessRightForCommand(command) < 0) { LOGGER.info("ATTENTION: admin command " + command + " has not an access right"); } } } } public void registerAdminCommandHandler(final IAdminCommandHandler handler) { String[] ids = handler.getAdminCommandList(); for (final String element : ids) { if (Config.DEBUG) { LOGGER.info("Adding handler for command " + element); } if (_datatable.keySet().contains(new String(element))) { LOGGER.warn("Duplicated command \"" + element + "\" definition in " + handler.getClass().getName() + "."); } else { _datatable.put(element, handler); } } ids = null; } public IAdminCommandHandler getAdminCommandHandler(final String adminCommand) { String command = adminCommand; if (adminCommand.indexOf(" ") != -1) { command = adminCommand.substring(0, adminCommand.indexOf(" ")); } if (Config.DEBUG) { LOGGER.info("getting handler for command: " + command + " -> " + (_datatable.get(command) != null)); } return _datatable.get(command); } }
  4. Muito Obrigado pela resposta Voce Teria um tutorial ou alguma coisa que faça me ajudar com isso? O mais estranho e que no //setdonator ele fica mais no npc nao
  5. Vou la no npc troco o item mais quando saio do jogo em entro de novo o Status Donater sai ai tenho quer ir no npc de novo , eu quero que fique direto !!! Alguem poderia me ajudar Porfavor ! ! Atenção no //setdonator ele fica mais no npc nao !! ============================================================================================================================================================================ #Created By Cheed!!! import sys from com.l2jfrozen.gameserver.model.actor.instance import L2PcInstance from com.l2jfrozen.gameserver.model.actor.instance import L2NpcInstance from java.util import Iterator from com.l2jfrozen.util.database import L2DatabaseFactory from com.l2jfrozen.gameserver.model.quest import State from com.l2jfrozen.gameserver.model.quest import QuestState from com.l2jfrozen import Config from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest from com.l2jfrozen.gameserver.datatables import SkillTable from com.l2jfrozen.gameserver.network.serverpackets import SocialAction from com.l2jfrozen.gameserver.model.quest.jython import QuestJython as JQuest qn = "50029_DonatorSeller" NPC=[50029] #iD do item que sera a moeda. Moeda= 3436 ItemCount1=1 DIAS_Donator1= 2000 QuestId = 50029 QuestName = "DonatorSeller" QuestDesc = "custom" InitialHtml = "1.htm" print "INFO DonatorSeller==> ON" class Quest (JQuest) : def __init__(self,id,name,descr): JQuest.__init__(self,id,name,descr) def onAdvEvent (self,event,npc,player) : htmltext = event st = player.getQuestState(qn) if not st: return def doDonator(player,days) : st.getPlayer().setDonator(True) st.player.broadcastPacket(SocialAction(st.player.getObjectId(),16)) st.player.getAppearance().setNameColor(Config.DONATOR_NAME_COLOR) st.player.getAppearance().setTitleColor(Config.DONATOR_TITLE_COLOR) if event == "1" : if st.getPlayer().isDonator(): return "no.htm" else : if st.getQuestItemsCount(Moeda) >= ItemCount1 : st.takeItems(Moeda,ItemCount1) doDonator(st.player, DIAS_Donator1) st.player.sendMessage("Parabens Voce ganhou Status Donator") return "1.htm" else: st.player.sendMessage("Voce Nao Tem Itens Suficiente!") return "1.htm" return htmltext def onTalk (self,npc,player): htmltext = "<html><head><body>You can't buy while you are</body></html>
×
×
  • Criar Novo...

Important Information

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.