Você não é registrado, por favor registre-se para ter acesso ao conteúdo completo.
Caso seja registrado, efetue login.
Esqueceu sua senha? Clique aqui
Recomendamos o uso do Mozilla Firefox para uma melhor visualização.    


Início Postados Hoje Marcar Fóruns Como Lidos Álbums Banidos SE Team Medalhas
Voltar   Secret Experience > Área L2J > [L2J] Downloads > [Lineage] Java Mods
Registrar Loteria VIPStaff SERegras do fórum Comunidade Arcade Postados Hoje Pesquisar Experience
   

Secret Experience.NET   Secret Experience Corporation - Welcome To The Real World
     Anúncios SE

Resposta
 
Ferramentas do Tópico Modos de Exibição
Antigo 29-09-2013, 11:12 AM   #1
Setokaiba
Jesus Te Ama, Mas EU Não!
 
Avatar de Setokaiba
 
Registrado em: Oct 2008
Localização: 45º 33º 34º N | 122º 41º 41º W DESTINATION: ANYWHERE Adidas
Posts: 4,133
Agradeceu: 837
Agradecido 6,058 Vezes em 2,106 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
Pontos: 20,442, Nível: 90
Pontos: 20,442, Nível: 90 Pontos: 20,442, Nível: 90 Pontos: 20,442, Nível: 90
Atividade: 99%
Atividade: 99% Atividade: 99% Atividade: 99%

Nome Real: Anderson Andrade

Inventório de Setokaiba Usuário possui 1x Lock Fan Usuário possui 1x Oakley Usuário possui 1x Apple Inc. Fan/User Usuário possui 1x Honda Usuário possui 1x Windows Seven User

Padrão L2Donator Manager Instance

Serve como um NPC de doações.

Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
Crie uma classe com.l2jfrozen.gameserver.model.actor.instance com o nome L2DonManagerInstance em cole o seguinte código.
Código: [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]
/*
 * 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 com.l2jfrozen.gameserver.model.actor.instance;
 
import java.io.*;
import java.util.StringTokenizer;
 
import javolution.text.TextBuilder;
 
import com.l2jfrozen.gameserver.ai.CtrlIntention;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
import com.l2jfrozen.gameserver.network.L2GameClient;
import com.l2jfrozen.gameserver.network.clientpackets.Say2;
import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
import com.l2jfrozen.gameserver.network.serverpackets.CreatureSay;
import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
 
/**
 * @author squallcs
 *
 */
public class L2DonManagerInstance extends L2FolkInstance
{
private static String _type;
 
public L2DonManagerInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}
 
@Override
public void onBypassFeedback(L2PcInstance player, String command)
{
if (command.startsWith("send_donate"))
{
StringTokenizer st = new StringTokenizer(command);
st.nextToken();
String msg = null;
String type = null;
type = st.nextToken();
msg = st.nextToken();
try
{
while (st.hasMoreTokens())
{
msg = msg + " " + st.nextToken();
}
 
sendDonate(player, type, msg);
}
catch (StringIndexOutOfBoundsException e)
{
}
}
}
 
static
{
new File("log/BugReports/").mkdirs();
}
 
private void sendDonate(L2PcInstance player, String command, String msg)
{
String type = command;
L2GameClient info = player.getClient().getConnection().getClient();
 
if (type.equals("Weapons"))
_type = "Weapons";
if (type.equals("Armors"))
_type = "Armors";
if (type.equals("Skills"))
_type = "Skills";
if (type.equals("EtcItems"))
_type = "EtcItems";
if (type.equals("Currency"))
_type = "Currency"; //you can expand this just use the same method for more categories
 
try
{
String fname = "log/DonateOrders/" + player.getName() + ".txt";
File file = new File(fname);
boolean exist = file.createNewFile();
if (!exist)
{
player.sendMessage("You have already ordered your gift, wait for a GM to get in contact with you.");
return;
}
FileWriter fstream = new FileWriter(fname);
BufferedWriter out = new BufferedWriter(fstream);
out.write("Character Info: " + info + "\r\nBug Type: " + _type + "\r\nMessage: " + msg);
player.sendMessage("Order has been delivered. A GM will be informed and get in contact with you soon.");
 
for (L2PcInstance allgms : L2World.getInstance().getAllGMs())
allgms.sendPacket(new CreatureSay(0, Say2.SHOUT, "Donator Manager", player.getName() + " has send a donation for the server, thanks for helping us with the billings."));
 
System.out.println("Character: " + player.getName() + " has donated.");
out.close();
}
catch (Exception e)
{
player.sendMessage("Something went wrong try again.");
}
}
 
@Override
public void onAction(L2PcInstance player)
{
if (!canTarget(player))
{
return;
}
 
if (this != player.getTarget())
{
player.setTarget(this);
 
player.sendPacket(new MyTargetSelected(getObjectId(), 0));
 
player.sendPacket(new ValidateLocation(this));
}
else if (!canInteract(player))
{
player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
}
else
{
showHtmlWindow(player);
}
 
player.sendPacket(new ActionFailed());
}
 
private void showHtmlWindow(L2PcInstance activeChar)
{
NpcHtmlMessage nhm = new NpcHtmlMessage(5);
TextBuilder replyMSG = new TextBuilder("");
 
replyMSG.append("<html><title>Donator Instance</title>");
replyMSG.append("<body><br><br><center>");
replyMSG.append("<table border=0 height=10 bgcolor=\"444444\" width=240>");
replyMSG.append("<tr><td align=center><font color=\"00FFFF\">Hello " + activeChar.getName() + ".</font></td></tr>");
replyMSG.append("<tr><td align=center><font color=\"00FFFF\">There are no Gms online</font></td></tr>");
replyMSG.append("<tr><td align=center><font color=\"00FFFF\">and you want to help us by donating?</font></td></tr>");
replyMSG.append("</table><br>");
replyMSG.append("<img src=\"L2UI.SquareWhite\" width=280 height=1><br><br>");
replyMSG.append("<table width=250><tr>");
replyMSG.append("<td><font color=\"LEVEL\">Select Gift Category:</font></td>");
replyMSG.append("<td><combobox width=105 var=type list=Weapons;Armors;Skills;EtcItems;Currency></td>"); //this is the next step if you expand the categories just add your new ones with a ";" after the name
replyMSG.append("</tr></table><br><br>");
replyMSG.append("<multiedit var=\"msg\" width=250 height=50><br>");
replyMSG.append("<br><img src=\"L2UI.SquareWhite\" width=280 height=1><br><br><br><br><br><br><br>");
replyMSG.append("<button value=\"Send Order\" action=\"bypass -h npc_" + getObjectId() + "_send_donate $type $msg\" width=204 height=20 back=\"sek.cbui75\" fore=\"sek.cbui75\">");
replyMSG.append("</center></body></html>");
 
nhm.setHtml(replyMSG.toString());
activeChar.sendPacket(nhm);
 
activeChar.sendPacket(new ActionFailed());
}
 
}

Setokaiba está online agora  
Os Seguintes 2 Usuários disseram Obrigado(a) para Setokaiba por gostarem deste post :
CavaleiroNegro (30-09-2013), OzzyOsbourne (30-09-2013)
Links Patrocinados
Antigo 28-05-2014, 09:12 AM   #2
Ellikia
Membro - Soldado
 
Avatar de Ellikia
 
Registrado em: Mar 2014
Posts: 11
Agradeceu: 1
Agradecido 0 Vezes em 0 Posts
Achei Ruim:
Acharam ruim Vezes em Posts
Meu Estado:
Pontos: 255, Nível: 5
Pontos: 255, Nível: 5 Pontos: 255, Nível: 5 Pontos: 255, Nível: 5
Atividade: 33%
Atividade: 33% Atividade: 33% Atividade: 33%

Inventório de Ellikia

Padrão

tem imagem ?

Ellikia está offline   Responder com Citação
Resposta


Regras para Posts
Você não pode postar novos tópicos
Você não pode postar respostas
Você não pode postar anexos
Você não pode editar seus posts

Código [IMG] Sim
Código HTML Não

Ir para...


Horários baseados na GMT -3. Agora são 09:28 PM.