Kaynağa Gözat

fixes #2912 entering olympiad with cubics given by somebody else

Sami 16 yıl önce
ebeveyn
işleme
0788939995

+ 11 - 5
L2_GameServer/java/net/sf/l2j/gameserver/Olympiad.java

@@ -48,6 +48,7 @@ import net.sf.l2j.gameserver.model.L2Skill;
 import net.sf.l2j.gameserver.model.L2Spawn;
 import net.sf.l2j.gameserver.model.L2Summon;
 import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2CubicInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
 import net.sf.l2j.gameserver.model.entity.Hero;
@@ -1968,15 +1969,20 @@ public class Olympiad
 						summon.unSummon(player);
 		    	}
                 
-                /*if (player.getCubics() != null)
+                if (player.getCubics() != null)
                 {
+                    boolean removed = false;
                     for(L2CubicInstance cubic : player.getCubics().values())
                     {
-                        cubic.stopAction();
-                        player.delCubic(cubic.getId());
+                        if (cubic.givenByOther())
+                        {
+                        	cubic.stopAction();
+                        	player.delCubic(cubic.getId());
+                        	removed = true;
+                        }
                     }
-                    player.getCubics().clear();
-                }*/
+                    if (removed) player.broadcastUserInfo();
+                }
 				
 				//Remove player from his party
 				if (player.getParty() != null)

+ 8 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2CubicInstance.java

@@ -80,13 +80,14 @@ public class L2CubicInstance
     protected int _activationtime;
     protected int _activationchance;
     protected boolean _active;
+    private boolean _givenByOther;
     
     protected List<L2Skill> _skills = new FastList<L2Skill>();
     
     private Future<?> _disappearTask;
     private Future<?> _actionTask;
     
-    public L2CubicInstance(L2PcInstance owner, int id, int level, int mAtk, int activationtime, int activationchance)
+    public L2CubicInstance(L2PcInstance owner, int id, int level, int mAtk, int activationtime, int activationchance, boolean givenByOther)
     {
         _owner = owner;
         _id = id;
@@ -94,6 +95,7 @@ public class L2CubicInstance
         _activationtime = activationtime * 1000;
         _activationchance = activationchance;
         _active = false;
+        _givenByOther = givenByOther;
 
         switch (_id)
         {
@@ -769,6 +771,11 @@ public class L2CubicInstance
 
         _target = target;
     }
+    
+    public boolean givenByOther()
+    {
+    	return _givenByOther;
+    }
 
     private class Heal implements Runnable
     {

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java

@@ -8575,11 +8575,11 @@ public final class L2PcInstance extends L2PlayableInstance
 	/**
 	 * Add a L2CubicInstance to the L2PcInstance _cubics.<BR><BR>
 	 */
-	public void addCubic(int id, int level, double matk, int activationtime, int activationchance)
+	public void addCubic(int id, int level, double matk, int activationtime, int activationchance, boolean givenByOther)
 	{
 		if (Config.DEBUG)
 			_log.info("L2PcInstance(" + getName() + "): addCubic(" + id + "|" + level + "|" + matk + ")");
-		L2CubicInstance cubic = new L2CubicInstance(this, id, level, (int) matk, activationtime, activationchance);
+		L2CubicInstance cubic = new L2CubicInstance(this, id, level, (int) matk, activationtime, activationchance, givenByOther);
 
 		_cubics.put(id, cubic);
 	}

+ 5 - 3
L2_GameServer/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillSummon.java

@@ -122,8 +122,10 @@ public class L2SkillSummon extends L2Skill
                     }
                     else
                     {
-
-						player.addCubic(_npcId, getLevel(), getPower(), getActivationTime(), getActivationChance());
+						if (player == activeChar)
+							player.addCubic(_npcId, getLevel(), getPower(), getActivationTime(), getActivationChance(), false);
+						else // given by other player
+							player.addCubic(_npcId, getLevel(), getPower(), getActivationTime(), getActivationChance(), true);
 						player.broadcastUserInfo();
                     }
 				}
@@ -145,7 +147,7 @@ public class L2SkillSummon extends L2Skill
                     activeChar.sendMessage("You already have such cubic");
                     return;
                 }
-                activeChar.addCubic(_npcId, getLevel(), getPower(), getActivationTime(), getActivationChance());
+                activeChar.addCubic(_npcId, getLevel(), getPower(), getActivationTime(), getActivationChance(), false);
 				activeChar.broadcastUserInfo();
 				return;
 			}