All pastes #18712 Raw Edit

Miscellany

public java v1 · immutable
#18712 ·published 2005-07-28 17:37 UTC
rendered paste body
Index: java/net/sf/l2j/gameserver/model/L2Character.java===================================================================--- java/net/sf/l2j/gameserver/model/L2Character.java	(revision 550)+++ java/net/sf/l2j/gameserver/model/L2Character.java	(working copy)@@ -18,6 +18,8 @@  */ package net.sf.l2j.gameserver.model; +import java.sql.PreparedStatement;+import java.sql.ResultSet; import java.util.HashMap; import java.util.Iterator; import java.util.Random;@@ -28,6 +30,7 @@ import java.util.logging.Logger;  import net.sf.l2j.Config;+import net.sf.l2j.L2DatabaseFactory; import net.sf.l2j.gameserver.ClientScheduler; import net.sf.l2j.gameserver.GameTimeController; import net.sf.l2j.gameserver.ai.CtrlEvent;@@ -602,6 +605,46 @@ 		if (_affraid)  ae |= ABNORMAL_EFFECT_AFFRAID;         return ae;     }+    +    protected void consolePrint(String text) {+    	if ( Config.DEBUG == true ) { System.out.println(text); }+    }+    +    public int getClassIDOnly(int objectId) {+    	//L2PcInstance player = null;+        java.sql.Connection con = null;+        int classId = 0;+        //consolePrint("getClassIDOnly --- Lookup objectId: ("+objectId+")");+        try+        {+            con = L2DatabaseFactory.getInstance().getConnection();+            PreparedStatement statement = con.prepareStatement("SELECT `classid` FROM characters WHERE obj_id=?");+            statement.setInt(1, objectId);+            //consolePrint("getClassIDOnly --- statement: (SELECT `classid` FROM characters WHERE obj_id="+objectId+")");+            ResultSet rset = statement.executeQuery();+            //consolePrint("getClassIDOnly --- rset: ("+rset+")");+            +            while (rset.next())+            {+            	classId = rset.getInt("classid");+            	//consolePrint("getClassIDOnly --- classId("+rset.getInt("classid")+"): ("+classId+")");+                break;+            }+            +            rset.close();+            statement.close();+        }+        catch (Exception e)+        {+			_log.log(Level.WARNING, "could not get char data:", e);+        } +        finally +        {+            try { con.close(); } catch (Exception e) {}+        }+        //consolePrint("getClassIDOnly --- return: ("+classId+")");+        return classId;+    }  	public abstract void updateAbnormalEffect();