All pastes #23130 Raw Edit

Untitled

public text v1 · immutable
#23130 ·published 2005-09-16 18:55 UTC
rendered paste body
Index: C:/eclipse/workspace/L2J/java/net/sf/l2j/gameserver/clientpackets/RequestActionUse.java
===================================================================
--- C:/eclipse/workspace/L2J/java/net/sf/l2j/gameserver/clientpackets/RequestActionUse.java	(revision 1063)
+++ C:/eclipse/workspace/L2J/java/net/sf/l2j/gameserver/clientpackets/RequestActionUse.java	(working copy)
@@ -19,7 +19,6 @@
 package net.sf.l2j.gameserver.clientpackets;
 
 import java.nio.ByteBuffer;
-import java.util.HashMap;
 import java.util.logging.Logger;
 
 import net.sf.l2j.Config;
@@ -29,6 +28,7 @@
 import net.sf.l2j.gameserver.model.L2Object;
 import net.sf.l2j.gameserver.model.L2PcInstance;
 import net.sf.l2j.gameserver.model.L2Skill;
+import net.sf.l2j.gameserver.SkillTable;
 import net.sf.l2j.gameserver.model.L2Summon;
 import net.sf.l2j.gameserver.model.L2World;
 import net.sf.l2j.gameserver.serverpackets.ActionFailed;
@@ -172,77 +172,119 @@
                 if (pet != null && pet.isMountable() && !activeChar.isMounted()) 
                 {
                     if (activeChar.isDead())
-                        {
+                    {
                         //A strider cannot be ridden when dead
                         SystemMessage msg = new SystemMessage(1009);
                         activeChar.sendPacket(msg);
-                        }
-                        else if (pet.isDead())
-                        {   
+                    }
+                    else if (pet.isDead())
+                    {   
                         //A dead strider cannot be ridden.
                         SystemMessage msg = new SystemMessage(1010);
                         activeChar.sendPacket(msg);
-                        }
-                        else if (pet.isInCombat())
-                        {
+                    }
+                    else if (pet.isInCombat())
+                    {
                         //A strider in battle cannot be ridden
                         SystemMessage msg = new SystemMessage(1011);
                         activeChar.sendPacket(msg);
-                        }
-                        else if (activeChar.isInCombat())
-                        {
+                    }
+                    else if (activeChar.isInCombat())
+                    {
                         //A strider cannot be ridden while in battle
                         SystemMessage msg = new SystemMessage(1012);
                         activeChar.sendPacket(msg);                        
-                        }                   
-                        else if (activeChar.isSitting() || activeChar.isMoving())
-                        {
+                    }                   
+                    else if (activeChar.isSitting() || activeChar.isMoving())
+                    {
                         //A strider can be ridden only when standing
                         SystemMessage msg = new SystemMessage(1013);
                         activeChar.sendPacket(msg);
-                        }
-                        else if (!pet.isDead() && !activeChar.isMounted())
-                        {
+                    }
+                    else if (!pet.isDead() && !activeChar.isMounted())
+                    {
                         Ride mount = new Ride(activeChar.getObjectId(), Ride.ACTION_MOUNT, pet.getTemplate().npcId);
                         activeChar.sendPacket(mount);
                         activeChar.broadcastPacket(mount);
                         activeChar.setMountType(mount.getMountType());
                         pet.unSummon(activeChar);
-                        }
+                    }
                 }
                 else if (activeChar.isMounted())
                 {
-                Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
-                activeChar.sendPacket(dismount);
-                activeChar.broadcastPacket(dismount);
-                activeChar.setMountType(0);
+					Ride dismount = new Ride(activeChar.getObjectId(), Ride.ACTION_DISMOUNT, 0);
+					activeChar.sendPacket(dismount);
+                    activeChar.broadcastPacket(dismount);
+                    activeChar.setMountType(0);
                 }
                 break;
-            }            
-            case 43:
+			}
+            case 32: //Wild Hog Cannon - Mode Change
             {
-                L2Object target = activeChar.getTarget();
+                /*L2Object target = activeChar.getTarget();
                 L2Summon pet = activeChar.getPet();
                 if (target != null && pet != null && pet != target && activeChar != target)
                 {
-                    if ((pet.withinZones(L2World.zones) || target.withinZones(L2World.zones))  && (activeChar.getAccessLevel() < Config.GM_PEACEATTACK))
-                    {
-                        activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IN_PEACEZONE));
-                        return;
-                    }
-
-                    if (target.isAutoAttackable(activeChar) || _ctrlPressed)
-                    {
-                        HashMap<Integer, L2Skill> skills = pet.getTemplate().getSkills();
-                        if(skills.size() != 0)
-                        {
-                            pet.setTarget(activeChar.getTarget());
-                            pet.useMagic((L2Skill)skills.values().toArray()[0]);
-                        }
-                    }
-                }
+                    L2Skill skill = SkillTable.getInstance().getInfo(1259,1);
+                    UseSkill(activeChar, pet, target, skill);
+                }*/
                 break;
             }
+            case 36: //Toxic Smoke
+            {
+                UseSkill(4036);
+                break;
+            }
+            case 39: //Parasite Burst
+            {
+                UseSkill(4138);
+                break;
+            }
+            case 41: //Wild Hog Cannon - Attack
+            {
+                UseSkill(4230);
+                break;
+            }
+            case 42: //Self Damage Shield
+            {
+                UseSkill(4378);
+                break;
+            }
+            case 43: //Whirpool
+            {
+                UseSkill(4137);
+                break;
+            }
+            case 44: //Boom Attack
+            {
+                UseSkill(4139);
+                break;
+            }
+            case 45: //Master Recharge
+            {
+                UseSkill(4025);
+                break;
+            }
+            case 46: //Mega Storm Strike
+            {
+                UseSkill(4001);
+                break;
+            }
+            case 47: //Steal Blood
+            {
+                UseSkill(4002);
+                break;
+            }
+            case 48: //Mech. Cannon
+            {
+                UseSkill(4068);
+                break;
+            }
+            case 1000: //Siege Hammer
+            {
+                UseSkill(4079);
+                break;
+            }
             default:
             {
                 _log.warning("unhandled action type "+_actionId);
@@ -253,6 +295,49 @@
 	/* (non-Javadoc)
 	 * @see net.sf.l2j.gameserver.clientpackets.ClientBasePacket#getType()
 	 */
+    
+    private void UseSkill(int skillId)
+    {
+        L2PcInstance activeChar = getClient().getActiveChar();
+        L2Object target = activeChar.getTarget();
+        L2Summon pet = activeChar.getPet();
+        if (target != null && pet != null && pet != target && activeChar != target)
+        {
+            int skillLvl = activeChar.getPet().getSkillLevel(skillId);
+            L2Skill skill = SkillTable.getInstance().getInfo(skillId,skillLvl);
+            if ((pet.withinZones(L2World.zones) || target.withinZones(L2World.zones))  && (activeChar.getAccessLevel() < Config.GM_PEACEATTACK))
+            {
+                activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IN_PEACEZONE));
+                return;
+            }
+            if (target.isAutoAttackable(activeChar) || _ctrlPressed)
+            {
+                if(skill != null)
+                {
+                    pet.setTarget(target);
+                    pet.useMagic(skill);
+                }
+            }
+        }
+    }
+    
+/*    private void UseSkill(L2PcInstance activeChar, L2Summon pet, L2Object target, L2Skill skill)
+    {
+        if ((pet.withinZones(L2World.zones) || target.withinZones(L2World.zones))  && (activeChar.getAccessLevel() < Config.GM_PEACEATTACK))
+        {
+            activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IN_PEACEZONE));
+            return;
+        }
+        if (target.isAutoAttackable(activeChar) || _ctrlPressed)
+        {
+            if(skill != null)
+            {
+                pet.setTarget(target);
+                pet.useMagic(skill);
+            }
+        }
+    }*/
+    
 	public String getType()
 	{
 		return _C__45_REQUESTACTIONUSE;