Hello. Well, I'm trying to addapt gracia final faction engine to interlude and I almost did it, but I got two errors and I have no idea how to fix that.
Errors:
[javac] D:\workspace\claw\gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2TpFlagInstance.java:250: cannot find symbol
[javac] symbol : method reduceCurrentHp(double,net.sf.l2j.gameserver.model.actor.L2Character,net.sf.l2j.gameserver.model.L2Skill)
[javac] location: class net.sf.l2j.gameserver.model.actor.L2Npc
[javac] super.reduceCurrentHp(damage, attacker, skill);
[javac] ^
[javac] D:\workspace\claw\gameserver\java\net\sf\l2j\gameserver\model\actor\instance\L2TpFlagInstance.java:236: method does not override or implement a method from a supertype
[javac] @Override
[javac] ^
[javac] 2 errors
And here is code:
package net.sf.l2j.gameserver.model.actor.instance;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Logger;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.ai.CtrlIntention;
import net.sf.l2j.gameserver.datatables.NpcTable;
import net.sf.l2j.gameserver.idfactory.IdFactory;
import net.sf.l2j.gameserver.model.L2Skill;
import net.sf.l2j.gameserver.model.actor.L2Character;
import net.sf.l2j.gameserver.model.actor.L2Npc;
import net.sf.l2j.gameserver.model.entity.FactionMaps;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
import net.sf.l2j.gameserver.util.Broadcast;
public class L2TpFlagInstance extends L2Npc
{
private final static Logger _log = Logger.getLogger(L2FactTeleporterInstance.class.getName());
private int _faction=0;
private int _occupayable=0;
private String _title = "";
private String _flagPlace = "";
public L2TpFlagInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
}
public static void spawnFlags()
{
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM faction_crystals WHERE mapId=?");
statement.setInt(1, FactionMaps.getMapId());
ResultSet rset = statement.executeQuery();
while (rset.next())
{
String _titlea = "";
if (rset.getInt("factionId") == 1)
_titlea = "Blue";
else if (rset.getInt("factionId") == 2)
_titlea = "Red";
L2TpFlagInstance flag = new L2TpFlagInstance(IdFactory.getInstance().getNextId(),NpcTable.getInstance().getTemplate(31217));
flag.setTitle(_titlea);
flag.setCurrentHpMp(flag.getMaxHp(), flag.getMaxMp());
flag.setHeading(0);
flag.setName(rset.getString("flagName"));
flag.setFlagName(rset.getString("flagName"));
flag.setFlagFactionId(rset.getInt("factionId"));
flag.spawnMe(rset.getInt("x"),rset.getInt("y"),rset.getInt("z") + 50);
if (rset.getInt("factionId") != 0)
{
if (rset.getInt("factionId") == 1)
L2FactTeleporterInstance._tpBlueFlags.add(flag);
else
L2FactTeleporterInstance._tpRedFlags.add(flag);
flag.setIsInvul(true);
flag.setIsUnoccupayable(1);
}
_log.info("Spawned crystal: " + rset.getString("flagName"));
}
rset.close();
statement.close();
}
catch (Exception e)
{
_log.warning("Kazkas blogai su kristalais faction:" + e);
}
finally
{
try {con.close();} catch (Exception e){}
}
Announcements.getInstance().announceToAll("Spawned faction map: " + FactionMaps.getMapName());
}
public void setFlagName(String a)
{
_flagPlace = a;
}
public String getFlagName()
{
return _flagPlace;
}
@Override
public boolean isAttackable()
{
return true;
}
@Override
public boolean isAutoAttackable(L2Character attacker)
{
return true;
}
@Override
public boolean doDie(L2Character killer)
{
if (!super.doDie(killer))
return false;
if (getFlagFactionId() == 1)
L2FactTeleporterInstance._tpBlueFlags.remove(this);
else if (getFlagFactionId() == 2)
L2FactTeleporterInstance._tpRedFlags.remove(this);
L2PcInstance player = null;
int _faktjon = 0;
String _name = "";
if (killer instanceof L2PcInstance)
player = (L2PcInstance) killer;
else if (killer instanceof L2SummonInstance)
player = ((L2SummonInstance) killer).getOwner();
_faktjon = player.getFactionId();
if (_faktjon == 1)
_title = "Blue";
else
_title = "Red";
L2TpFlagInstance flag = new L2TpFlagInstance(IdFactory.getInstance().getNextId(),NpcTable.getInstance().getTemplate(31217));
_name = this.getName();
flag.setTitle(_title);
flag.setCurrentHpMp(flag.getMaxHp(), flag.getMaxMp());
flag.setHeading(0);
flag.setName(_name);
flag.setFlagName(_name);
flag.setIsUnoccupayable(0);
flag.setFlagFactionId(_faktjon);
flag.spawnMe(this.getX(), this.getY(), this.getZ());
deleteMe();
if (_faktjon == 1)
L2FactTeleporterInstance._tpBlueFlags.add(flag);
else
L2FactTeleporterInstance._tpRedFlags.add(flag);
Broadcast.sendMessToAllFactionPlayers(_title + " faction member " + player.getName() + " has occupied " + _flagPlace + " crystal.");
return true;
}
@Override
public void onForcedAttack(L2PcInstance player)
{
onAction(player);
}
public void setIsUnoccupayable(int a)
{
_occupayable = a;
}
public int isUnoccupayable()
{
return _occupayable;
}
@Override
public void onAction(L2PcInstance player)
{
if (player == null || !canTarget(player))
return;
// Check if the L2PcInstance already target the L2NpcInstance
if (this != player.getTarget()/* && player.inWorld() == 1*/)
{
// Set the target of the L2PcInstance player
player.setTarget(this);
// Send a Server->Client packet MyTargetSelected to the L2PcInstance player
MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel() - getLevel());
player.sendPacket(my);
// Send a Server->Client packet StatusUpdate of the L2NpcInstance to the L2PcInstance to update its HP bar
StatusUpdate su = new StatusUpdate(getObjectId());
su.addAttribute(StatusUpdate.CUR_HP, (int)getStatus().getCurrentHp() );
su.addAttribute(StatusUpdate.MAX_HP, getMaxHp() );
player.sendPacket(su);
// Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client
player.sendPacket(new ValidateLocation(this));
}
else
{
if (isAutoAttackable(player) && Math.abs(player.getZ() - getZ()) < 100)
player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
else
{
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
player.sendPacket(ActionFailed.STATIC_PACKET);
}
}
}
public int getFlagFactionId()
{
return _faction;
}
public void setFlagFactionId(int i)
{
_faction = i;
}
@Override
public void reduceCurrentHp(double damage, L2Character attacker, L2Skill skill)
{
L2PcInstance plajor = null;
boolean cord = false;
if (attacker instanceof L2PcInstance)
plajor = (L2PcInstance) attacker;
else if (attacker instanceof L2SummonInstance)
plajor = ((L2SummonInstance) attacker).getOwner();
if (/*plajor.inWorld() == 1 && */plajor.getFactionId() != getFlagFactionId())
cord = true;
if (cord)
super.reduceCurrentHp(damage, attacker, skill);
}
}
Hello everyone, people often ask me how to help me.
Here I will describe the general principle of how to create a simple window for ui (unity l2)
Here I am looking at an already created ActionWindows window
1. Assets\Resources\Data\UI\_Elements\Game
2.
Let's call it ActionWindows
3. Let's go to the newly created window
4.as you can see it is empty. But we already have a ready-made window template so that we don’t have to assemble it again every time. We will connect a ready-made design for a new window
5. open the window code
6.
7. Add new code
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xmlns="UnityEngine.UIElements" editor-extension-mode="False">
<ui:Template name="DefaultWindowsAction" src="project://database/Assets/Resources/Data/UI/_Elements/Template/DefaultWindowsAction.uxml?fileID=9197481963319205126&guid=2fdd4636702f00a4e98644cfa7468b14&type=3#DefaultWindowsAction" />
<ui:Instance name="defaultWindowsAction" template="DefaultWindowsAction" style="width: 317px; height: 575px; position: absolute;">
<AttributeOverrides element-name="windows-name-label" text="Actions" />
<ui:VisualElement name="Background" class="background_over" style="flex-grow: 1; min-width: auto; min-height: auto; justify-content: flex-start; align-items: flex-start; position: absolute; background-image: resource('Data/UI/Window/Frame_DF_Large_Bg_Darker_Center_Alpha'); height: 91%; top: 38px; width: 95%; left: 8px; display: flex; visibility: visible; overflow: visible; opacity: 1;" />
<ui:GroupBox name="BoxHeader" class="drag-area" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-bottom: 0; padding-left: 0; position: absolute; top: 15px; align-self: stretch; height: 4%; width: 88%;" />
</ui:Instance>
</ui:UXML>
8.We take a template
project://database/Assets/Resources/Data/UI/_Elements/Template/DefaultWindowsAction.uxml
9. This piece of code can be taken from other windows so as not to write every time
10. Save
11.Drag the GroupBox node
12.
Changing its position settings
I can change all the settings from the editor. But if you knew, then a very similar technology to CSS is better
if you open the window code you can notice everything is the same as in css
you can create settings in the window code or use a file with all the styles
Assets\Resources\Data\UI\_Elements\L2StyleSheet.uss
In the next issue we will write code to connect it to the game logic. Unless of course you delete the article.
Question
DarthVader
Hello. Well, I'm trying to addapt gracia final faction engine to interlude and I almost did it, but I got two errors and I have no idea how to fix that.
Errors:
And here is code:
::)
2 answers to this question
Recommended Posts