Tachi Posted March 10, 2015 Posted March 10, 2015 who can help me to import pvp/pk circle on 1 private project ..source acis video with code done but not mine :( this is code ### Eclipse Workspace Patch 1.0 #P L2jFrozen_GameServer_tests Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 488) +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -5845,6 +5845,7 @@ } setPvpFlag(0); // Clear the pvp flag + setTeam(0); // Unsummon Cubics if(_cubics.size() > 0) @@ -6698,6 +6699,7 @@ } //Update the character's title color if they reached any of the 5 PK levels. + setTeam(2); updatePkColor(getPkKills()); broadcastUserInfo(); Index: head-src/com/l2jfrozen/gameserver/model/L2Character.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/L2Character.java (revision 488) +++ head-src/com/l2jfrozen/gameserver/model/L2Character.java (working copy) @@ -189,6 +189,7 @@ private double _hpUpdateDecCheck = .0; private double _hpUpdateInterval = .0; private boolean _champion = false; + private int _team = 0; /** Table of Calculators containing all used calculator */ private Calculator[] _calculators; @@ -8161,6 +8162,7 @@ { _pvpFlagLasts = time; } + public long getPvpFlagLasts() { @@ -8170,10 +8172,24 @@ public void startPvPFlag() { updatePvPFlag(1); + setTeam(1); _PvPRegTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new PvPFlag(), 1000, 1000); } + /** + * @param i + */ + public void setTeam(int team) + { + _team = team; + } + + public int getTeam() + { + return _team; + } + public void stopPvpRegTask() { if(_PvPRegTask != null) @@ -8185,7 +8201,7 @@ public void stopPvPFlag() { stopPvpRegTask(); - + setTeam(0); updatePvPFlag(0); _PvPRegTask = null;
0 SweeTs Posted March 13, 2015 Posted March 13, 2015 Okay, I just checked the video to see what you want to achieve, since your posts mislead me, lol ### Eclipse Workspace Patch 1.0 #P aCis_gameserver Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 343) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -1312,6 +1312,7 @@ sendPacket(new RelationChanged(getPet(), getRelation(this), false)); broadcastRelationsChanges(); + broadcastUserInfo(); } @Override @@ -4228,7 +4229,10 @@ PvpFlagTaskManager.getInstance().add(this, Config.PVP_NORMAL_TIME); if (getPvpFlag() == 0) + { updatePvPFlag(1); + setTeam(1); + } } public void updatePvPStatus(L2Character target) @@ -4245,7 +4249,10 @@ PvpFlagTaskManager.getInstance().add(this, checkIfPvP(player) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME); if (getPvpFlag() == 0) + { updatePvPFlag(1); + setTeam(1); + } } } Index: java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java =================================================================== --- java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java (revision 343) +++ java/net/sf/l2j/gameserver/taskmanager/PvpFlagTaskManager.java (working copy) @@ -82,6 +82,7 @@ if (currentTime > timeLeft) { entry.getKey().updatePvPFlag(0); + entry.getKey().setTeam(0); iterator.remove(); } // Time almost runned out, update to blinking PvP flag.
0 SweeTs Posted March 10, 2015 Posted March 10, 2015 setTeam method already exist. Probably part of event engine to set teams, or custom zone which set the team - randomly or not - to ppl who enter to the zone.
0 Tachi Posted March 10, 2015 Author Posted March 10, 2015 i don't know a lot of java ..someone can help me to adapted this code for acis :(
0 Tessa Posted March 10, 2015 Posted March 10, 2015 In your case, a getter and setter with this names already exists... choose something different, and use this code: Index: java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java =================================================================== --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java (revision 1) +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java (working copy) @@ -192,9 +192,9 @@ writeD((int) _activeChar.getCurrentCp()); writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect()); - if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected())) + if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected()) || (_activeChar.getTeam() == 1)) writeC(0x01); // team circle around feet 1= Blue, 2 = red - else if (_activeChar.getTeam() == 2) + else if ((_activeChar.getTeam() == 2) || (_activeChar.getTeam() == 2)) writeC(0x02); // team circle around feet 1= Blue, 2 = red else writeC(0x00); // team circle around feet 1= Blue, 2 = red Index: java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java =================================================================== --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java (revision 1) +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java (working copy) @@ -247,9 +247,9 @@ writeD((int) _activeChar.getCurrentCp()); writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect()); - if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected())) + if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected()) || (_activeChar.getTeam() == 1)) writeC(0x01); // team circle around feet 1= Blue, 2 = red - else if (_activeChar.getTeam() == 2) + else if ((_activeChar.getTeam() == 2) || (_activeChar.getTeam() == 2)) writeC(0x02); // team circle around feet 1= Blue, 2 = red else writeC(0x00); // team circle around feet 1= Blue, 2 = red The circle is a part of the User / Char info packet.
0 Tachi Posted March 10, 2015 Author Posted March 10, 2015 (edited) In your case, a getter and setter with this names already exists... choose something different, and use this code: Index: java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java =================================================================== --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java (revision 1) +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java (working copy) @@ -192,9 +192,9 @@ writeD((int) _activeChar.getCurrentCp()); writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect()); - if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected())) + if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected()) || (_activeChar.getTeam() == 1)) writeC(0x01); // team circle around feet 1= Blue, 2 = red - else if (_activeChar.getTeam() == 2) + else if ((_activeChar.getTeam() == 2) || (_activeChar.getTeam() == 2)) writeC(0x02); // team circle around feet 1= Blue, 2 = red else writeC(0x00); // team circle around feet 1= Blue, 2 = red Index: java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java =================================================================== --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java (revision 1) +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java (working copy) @@ -247,9 +247,9 @@ writeD((int) _activeChar.getCurrentCp()); writeC(_activeChar.isMounted() ? 0 : _activeChar.getEnchantEffect()); - if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected())) + if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected()) || (_activeChar.getTeam() == 1)) writeC(0x01); // team circle around feet 1= Blue, 2 = red - else if (_activeChar.getTeam() == 2) + else if ((_activeChar.getTeam() == 2) || (_activeChar.getTeam() == 2)) writeC(0x02); // team circle around feet 1= Blue, 2 = red else writeC(0x00); // team circle around feet 1= Blue, 2 = red The circle is a part of the User / Char info packet. i add your code and when i hit don't have animations but dmg give... and after make karma get red cirlce if i change karma to 0 red cirlce don't disappear but pvp blu circle won't work and same problem no have animation :( Edited March 10, 2015 by Tachi
0 Tachi Posted March 10, 2015 Author Posted March 10, 2015 (edited) Why is it in L2Character? l2character.txt i fixed problem with gameserver ..but now nothing happened..no circle with yuo code ... Edited March 10, 2015 by Tachi
0 Tachi Posted March 11, 2015 Author Posted March 11, 2015 i make the code..but i have some problems where to add 0x00 in when players are with circle whats the correct broadcast to make all players able to see the color circles and where to place it
0 SweeTs Posted March 11, 2015 Posted March 11, 2015 updatePvPStatus(, onKillUpdatePvPKarma( .. Check mothers and ses how the flag / karma is working and follow the logic.
0 Tachi Posted March 12, 2015 Author Posted March 12, 2015 (edited) updatePvPStatus(, onKillUpdatePvPKarma( .. Check mothers and ses how the flag / karma is working and follow the logic. so code pvp circle work but after flag going off pvp circle is on ..and he wont remove.. what i need to to this is code on l2pcinstance public void updatePvPStatus(L2Character target) { final L2PcInstance player = target.getActingPlayer(); if (player == null) return; if (EventManager.getInstance().isRegistered(this) && EventManager.getInstance().isRunning()) return; if (isInDuel() && player.getDuelId() == getDuelId()) return; if ((!isInsideZone(ZoneId.PVP) || !target.isInsideZone(ZoneId.PVP)) && player.getKarma() == 0) { PvpFlagTaskManager.getInstance().add(this, System.currentTimeMillis() + ((checkIfPvP(player)) ? Config.PVP_PVP_TIME : Config.PVP_NORMAL_TIME)); if (getPvpFlag() == 0) { target.setTeam(2); player.setTeam(1); updatePvPFlag(1); } else { target.setTeam(0); player.setTeam(0); } // 1 of those 3 should work but only 1 broadcastRelationsChanges(); broadcastCharInfo(); broadcastUserInfo(); } } charinfo.java code if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected())) writeC(0x01); // team circle around feet 1= Blue, 2 = red else if (_activeChar.getTeam() == 2) writeC(0x02); // team circle around feet 1= Blue, 2 = red else writeC(0x00); // team circle around feet 1= Blue, 2 = red userinfo.java code if (_activeChar.getTeam() == 1 || (Config.PLAYER_SPAWN_PROTECTION > 0 && _activeChar.isSpawnProtected())) writeC(0x01); // team circle around feet 1= Blue, 2 = red else if (_activeChar.getTeam() == 2) writeC(0x02); // team circle around feet 1= Blue, 2 = red else writeC(0x00); // team circle around feet 1= Blue, 2 = red l2character.java code private int _team = 0; public void setTeam(int team) { _team = team; } public int getTeam() { return _team; } } Edited March 12, 2015 by Tachi
0 Tachi Posted March 13, 2015 Author Posted March 13, 2015 now work but not every time...some suggestions?
0 SweeTs Posted March 13, 2015 Posted March 13, 2015 How its supposed to work? Red circle for attacker and blue for victim? As I said track how flag works.
0 Tachi Posted March 13, 2015 Author Posted March 13, 2015 How its supposed to work? Red circle for attacker and blue for victim? As I said track how flag works. The problem is that blue circle not always work, and the red did not work
Question
Tachi
who can help me to import pvp/pk circle on 1 private project ..source acis
video with code done but not mine :(
this is code
16 answers to this question
Recommended Posts