Hello,
I'm back to PW Development (been busy a lot since I was busy with lots of Universities tasks given, damn)
Here are the constructors, methods, behaviors, operational commands for classname GameDB and Faction related. Other than that, view bottom for more classes. All credits to me
Class Name : RoleBean (For Character/Role Information)
PHP Code:
package protocol;import com.goldhuman.Common.Octets;import com.goldhuman.IO.Protocol.Rpc.Data.DataVector;
public class RoleBean{
public static final int MAGIC_CLASS = 5;
public User user;
public GRoleBase base;
public GRoleStatus status;
public GRolePocket pocket;
public Rpc.Data.DataVector equipment;
public GRoleStorehouse storehouse;
public GRoleTask task;
public extend_prop ep = new extend_prop();
public RoleBean() {
this.user = new User();
this.base = new GRoleBase();
this.status = new GRoleStatus();
this.pocket = new GRolePocket();
this.equipment = new Rpc.Data.DataVector(new GRoleInventory());
this.storehouse = new GRoleStorehouse();
this.task = new GRoleTask();
}
public String getLogString()
{
String n = "";
try { n = this.base.name.getString(); } catch (Exception e) { e.printStackTrace(); }
return new String("roleid=" + this.base.id + ",name=" + n + ",level=" + this.status.level + ",level2=" + this.status.level2 + ",exp=" + this.status.exp + ",sp=" + this.status.sp + ",pp=" + this.status.pp + ",money=" + this.pocket.money);
}
public boolean SetGRoleStatus(GRoleStatus status)
{
if (null == status) {
return false;
}
this.status = status;
this.ep = new extend_prop();
return this.ep.set(status.property.getBytes());
}
public GRoleStatus GetGRoleStatus()
{
this.status.property.replace(this.ep.getBytes());
return this.status;
}
public static String ClsName(int cls)
{
switch (cls) {
case 0:
return "武侠";
case 1:
return "法师";
case 2:
return "僧侣";
case 3:
return "妖精";
case 4:
return "妖兽";
case 5:
return "魅灵";
case 6:
return "羽芒";
case 7:
return "羽灵";
}return "未知";
}
public static String GenderName(byte gender)
{
return gender > 0 ? "女" : "男";
}
public static String StatusName(int status)
{
if (1 == status)
return "正常";
if (2 == status)
return "必须删除";
if (3 == status) {
return "准备删除";
}
return "未知";
}
public class extend_prop
{
public static final int MAGIC_CLASS = 5;
public int vitality;
public int energy;
public int strength;
public int agility;
public int max_hp;
public int max_mp;
public int hp_gen;
public int mp_gen;
public float walk_speed;
public float run_speed;
public float swim_speed;
public float flight_speed;
public int attack;
public int damage_low;
public int damage_high;
public int attack_speed;
public float attack_range;
public int[] addon_damage_low;
public int[] addon_damage_high;
public int damage_magic_low;
public int damage_magic_high;
public int[] resistance;
public int defense;
public int armor;
public int max_ap;
public extend_prop()
{
this.addon_damage_low = new int[5];
this.addon_damage_high = new int[5];
this.resistance = new int[5];
}
private int getInt(byte b1, byte b2, byte b3, byte b4)
{
int izero = 0;
return 0xFF000000 & b4 << 24 | 0xFF0000 & b3 << 16 | 0xFF00 & b2 << 8 | 0xFF & b1;
}
private byte[] getBytes(int i)
{
byte[] bts = new byte[4];
bts[0] = (byte)(0xFF & i);
bts[1] = (byte)(0xFF & i >> 8);
bts[2] = (byte)(0xFF & i >> 16);
bts[3] = (byte)(0xFF & i >> 24);
return bts;
}
private byte[] getByteArray(int[] ia) {
int n = ia.length;
byte[] bts = new byte[n * 4];
for (int i = 0; i < n; i++)
{
byte[] tbts = getBytes(ia[i]);
bts[(i * 4)] = tbts[0];
bts[(i * 4 + 1)] = tbts[1];
bts[(i * 4 + 2)] = tbts[2];
bts[(i * 4 + 3)] = tbts[3];
}
return bts;
}
private int[] getIntArray(byte[] p) {
int n = p.length / 4;
int[] ip = new int[n];
for (int i = 0; i < n; i++)
{
ip[i] = getInt(p[(i * 4)], p[(i * 4 + 1)], p[(i * 4 + 2)], p[(i * 4 + 3)]);
}
return ip;
}
public boolean set(byte[] p) {
if ((null == p) || (p.length < 144) || (p.length > 148))
return false;
int[] ip = getIntArray(p);
this.vitality = ip[0];
this.energy = ip[1];
this.strength = ip[2];
this.agility = ip[3];
this.max_hp = ip[4];
this.max_mp = ip[5];
this.attack = ip[12];
this.damage_low = ip[13];
this.damage_high = ip[14];
for (int i = 0; i < 5; i++)
{
this.addon_damage_low[i] = ip[(17 + i * 2)];
this.addon_damage_high[i] = ip[(18 + i * 2)];
}
this.damage_magic_low = ip[27];
this.damage_magic_high = ip[28];
for (int i = 0; i < 5; i++)
{
this.resistance[i] = ip[(29 + i)];
}
this.defense = ip[34];
this.armor = ip[35];
if (p.length >= 148)
this.max_ap = ip[36];
return true;
}
public byte[] getBytes() {
int[] ip = new int[37];
ip[0] = this.vitality;
ip[1] = this.energy;
ip[2] = this.strength;
ip[3] = this.agility;
ip[4] = this.max_hp;
ip[5] = this.max_mp;
ip[12] = this.attack;
ip[13] = this.damage_low;
ip[14] = this.damage_high;
for (int i = 0; i < 5; i++)
{
ip[(17 + i * 2)] = this.addon_damage_low[i];
ip[(18 + i * 2)] = this.addon_damage_high[i];
}
ip[27] = this.damage_magic_low;
ip[28] = this.damage_magic_high;
for (int i = 0; i < 5; i++)
{
ip[(29 + i)] = this.resistance[i];
}
ip[34] = this.defense;
ip[35] = this.armor;
ip[36] = this.max_ap;
return getByteArray(ip);
}
}
}/* Location: D:\PW\MarHazK\
* Qualified Name: com.goldhuman.service.interfaces.RoleBean
*/
PHP Code:
package protocol;import com.goldhuman.Common.Octets;import com.goldhuman.IO.PollIO;import com.goldhuman.IO.Protocol.Protocol;import com.goldhuman.IO.Protocol.Rpc;import com.goldhuman.IO.Protocol.Rpc.Data.DataVector;
public class GameDB{
public static final Object locker = new Object();
public static ClientManager mgr = new ClientManager();
public static void init()
throws InterruptedException
{
synchronized (mgr)
{
if (null == mgr.s)
{
Protocol.Client(mgr);
mgr.wait();
}
}
}
public static Rpc.Data.DataVector getRolelist(int userid) throws Exception {
init();
if (null == mgr.s)
return null;
synchronized (locker)
{
GetUserRolesArg arg = new GetUserRolesArg();
arg.userid = userid;
GetUserRoles rpc = (GetUserRoles)Rpc.Call("GetUserRoles", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(getRolelist)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getRoleList)");
if ((0 != rpc.retcode) || (rpc.userid == -1))
return null;
return rpc.roles;
}
}
public static int getRoleIdByName(String rolename) throws Exception {
init();
if (null == mgr.s)
return -1;
synchronized (locker)
{
GetRoleIdArg arg = new GetRoleIdArg();
arg.rolename.setString(rolename);
GetRoleId rpc = (GetRoleId)Rpc.Call("GetRoleId", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(getRoleIdByName)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getRoleIdByName)");
return rpc.roleid;
}
}
public static int canChangeRolename(String rolename, int setcanchange) throws Exception {
init();
if (null == mgr.s)
return -1;
synchronized (locker)
{
CanChangeRolenameArg arg = new CanChangeRolenameArg();
arg.rolename.setString(rolename);
arg.setcanchange = setcanchange;
CanChangeRolename rpc = (CanChangeRolename)Rpc.Call("CanChangeRolename", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(canChangeRolename)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(canChangeRolename)");
return rpc.retcode;
}
}
public static int clearStorehousePasswd(int roleid, String rolename) throws Exception {
init();
if (null == mgr.s) {
return -1;
}
synchronized (locker)
{
ClearStorehousePasswdArg arg = new ClearStorehousePasswdArg();
arg.roleid = roleid;
arg.rolename.setString(rolename);
ClearStorehousePasswd rpc = (ClearStorehousePasswd)Rpc.Call("ClearStorehousePasswd", arg);
if (!mgr.Send(mgr.s, rpc)) return -1;
PollIO.WakeUp();
locker.wait();
return rpc.retcode;
}
}
public static int renameRole(int roleid, String oldname, String newname) throws Exception {
init();
if (null == mgr.s) {
return -1;
}
synchronized (locker)
{
RenameRoleArg arg = new RenameRoleArg();
arg.roleid = roleid;
arg.oldname.setString(oldname);
arg.newname.setString(newname);
RenameRole rpc = (RenameRole)Rpc.Call("RenameRole", arg);
if (!mgr.Send(mgr.s, rpc)) return -1;
PollIO.WakeUp();
locker.wait();
return rpc.retcode;
}
}
public static int DBVerifyMaster(String rolename, String factionname) throws Exception {
init();
if (null == mgr.s)
return -1;
synchronized (locker)
{
DBVerifyMasterArg arg = new DBVerifyMasterArg();
arg.name.setString(rolename);
arg.faction.setString(factionname);
DBVerifyMaster rpc = (DBVerifyMaster)Rpc.Call("DBVerifyMaster", arg);
if (!mgr.Send(mgr.s, rpc)) return -1;
PollIO.WakeUp();
locker.wait();
return rpc.retcode;
}
}
public static boolean deleteRolePermanent(int roleid) throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return false;
}
synchronized (locker)
{
DBDeleteRoleArg arg = new DBDeleteRoleArg();
arg.roleid = roleid;
DBDeleteRole rpc = (DBDeleteRole)Rpc.Call("DBDeleteRole", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(deleteRolePermanent)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(deleteRolePermanent)");
return 0 == rpc.retcode;
}
}
public static int createRole(int userid, XmlRole.Role role)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return -1;
}
synchronized (locker)
{
DBCreateRoleArg arg = new DBCreateRoleArg();
arg.roleid = userid;
arg.roleinfo.roleid = role.base.id;
arg.roleinfo.gender = role.base.gender;
arg.roleinfo.race = (byte)role.base.race;
arg.roleinfo.occupation = (byte)role.base.cls;
arg.roleinfo.level = role.status.level;
arg.roleinfo.name = role.base.name;
DBCreateRole rpc = (DBCreateRole)Rpc.Call("DBCreateRole", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(createRole)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(createRole)");
if (0 == rpc.retcode)
{
role.base.id = rpc.roleid;
return rpc.roleid;
}
return rpc.retcode > 0 ? -rpc.retcode : rpc.retcode;
}
}
public static boolean moveRole(int roleid, int newuserid)
throws InterruptedException, Exception
{
XmlRole.Role role = XmlRole.getRoleFromDB(roleid);
if (null == role)
{
throw new Exception("GameDB moveRole. get roleid failed. roleid=" + roleid);
}
if (createRole(newuserid, role) < 0)
{
throw new Exception("GameDB moveRole. create new role failed. newuserid=" + newuserid);
}
if (!XmlRole.putRoleToDB(role.base.id, role))
{
if (!deleteRolePermanent(role.base.id)) {
throw new Exception("GameDB moveRole, put new role error and not left not delete. newroleid=" + role.base.id + "oldroleid=" + roleid);
}
throw new Exception("GameDB moveRole. put new role failed. newroleid=" + role.base.id);
}
if (!deleteRolePermanent(roleid))
{
if (!deleteRolePermanent(role.base.id)) {
throw new Exception("GameDB moveRole, delete old role err and new role not delete. newroleid=" + role.base.id + "oldroleid=" + roleid);
}
throw new Exception("GameDB moveRole, delete old role failed. old roleid=" + roleid);
}
return true;
}
public static boolean putUser(int userid, User user)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return false;
}
if (null == user) return false;
synchronized (locker)
{
UserPair arg = new UserPair();
arg.key.id = userid;
arg.value = user;
PutUser rpc = (PutUser)Rpc.Call("PutUser", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putUser)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(putUser)");
return 0 == rpc.retcode;
}
}
public static boolean putRoleBase(int roleid, GRoleBase base)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return false;
}
if (null == base) return false;
synchronized (locker)
{
RoleBasePair arg = new RoleBasePair();
arg.key.id = roleid;
arg.value = base;
PutRoleBase rpc = (PutRoleBase)Rpc.Call("PutRoleBase", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleBase)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(putRoleBase)");
return 0 == rpc.retcode;
}
}
public static boolean putRoleStatus(int roleid, GRoleStatus status)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return false;
}
if (null == status) return false;
synchronized (locker)
{
RoleStatusPair arg = new RoleStatusPair();
arg.key.id = roleid;
arg.value = status;
PutRoleStatus rpc = (PutRoleStatus)Rpc.Call("PutRoleStatus", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleStatus)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(putRoleStatus)");
return 0 == rpc.retcode;
}
}
public static boolean putRolePocket(int roleid, GRolePocket pocket)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return false;
}
if (null == pocket) return false;
synchronized (locker)
{
RolePocketPair arg = new RolePocketPair();
arg.key.id = roleid;
arg.value = pocket;
PutRolePocket rpc = (PutRolePocket)Rpc.Call("PutRolePocket", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRolePocket)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(putRolePocket)");
return 0 == rpc.retcode;
}
}
public static boolean putRoleEquipment(int roleid, Rpc.Data.DataVector equipment)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return false;
}
if (null == equipment) return false;
synchronized (locker)
{
RoleEquipmentPair arg = new RoleEquipmentPair();
arg.key.id = roleid;
arg.equipment = equipment;
PutRoleEquipment rpc = (PutRoleEquipment)Rpc.Call("PutRoleEquipment", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleEquipment)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(putRoleEquipment)");
return 0 == rpc.retcode;
}
}
public static boolean putRoleStorehouse(int roleid, GRoleStorehouse storehouse)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return false;
}
if (null == storehouse) return false;
synchronized (locker)
{
RoleStorehousePair arg = new RoleStorehousePair();
arg.key.id = roleid;
arg.value = storehouse;
PutRoleStorehouse rpc = (PutRoleStorehouse)Rpc.Call("PutRoleStorehouse", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleStorehouse)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(putRoleStorehouse)");
return 0 == rpc.retcode;
}
}
public static boolean putRoleTask(int roleid, GRoleTask task)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return false;
}
if (null == task) return false;
synchronized (locker)
{
RoleTaskPair arg = new RoleTaskPair();
arg.key.id = roleid;
arg.value = task;
PutRoleTask rpc = (PutRoleTask)Rpc.Call("PutRoleTask", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleTask)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(putRoleTask)");
return 0 == rpc.retcode;
}
}
public static User getUser(int userid)
throws Exception
{
init();
if (null == mgr.s)
return null;
synchronized (locker)
{
UserID arg = new UserID();
arg.id = userid;
GetUser rpc = (GetUser)Rpc.Call("GetUser", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(getUser)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getUser)");
if (0 != rpc.retcode)
return null;
return rpc.user;
}
}
public static GRoleBase getRoleBase(int roleid) throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return null;
}
synchronized (locker)
{
RoleId arg = new RoleId();
arg.id = roleid;
GetRoleBase rpc = (GetRoleBase)Rpc.Call("GetRoleBase", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleBase)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getRoleBase)");
return rpc.base;
}
}
public static GRoleStatus getRoleStatus(int roleid) throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return null;
}
synchronized (locker)
{
RoleId arg = new RoleId();
arg.id = roleid;
GetRoleStatus rpc = (GetRoleStatus)Rpc.Call("GetRoleStatus", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(getRoleStatus)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getRoleStatus)");
return rpc.status;
}
}
public static GRolePocket getRolePocket(int roleid) throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return null;
}
synchronized (locker)
{
RoleId arg = new RoleId();
arg.id = roleid;
GetRolePocket rpc = (GetRolePocket)Rpc.Call("GetRolePocket", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(getRolePocket)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getRolePocket)");
return rpc.pocket;
}
}
public static Rpc.Data.DataVector getRoleEquipment(int roleid)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return null;
}
synchronized (locker)
{
RoleId arg = new RoleId();
arg.id = roleid;
GetRoleEquipment rpc = (GetRoleEquipment)Rpc.Call("GetRoleEquipment", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleEquipment)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getRoleEquipment)");
return rpc.equipment;
}
}
public static GRoleStorehouse getRoleStorehouse(int roleid)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return null;
}
synchronized (locker)
{
RoleId arg = new RoleId();
arg.id = roleid;
GetRoleStorehouse rpc = (GetRoleStorehouse)Rpc.Call("GetRoleStorehouse", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleStorehouse)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getRoleStorehouse)");
return rpc.storehouse;
}
}
public static GRoleTask getRoleTask(int roleid)
throws InterruptedException, Exception
{
init();
if (null == mgr.s) {
return null;
}
synchronized (locker)
{
RoleId arg = new RoleId();
arg.id = roleid;
GetRoleTask rpc = (GetRoleTask)Rpc.Call("GetRoleTask", arg);
if (!mgr.Send(mgr.s, rpc)) throw new Exception("网络连接未建立。(putRoleTask)");
PollIO.WakeUp();
locker.wait();
if (4 == rpc.retcode) throw new Exception("网络通讯超时。(getRoleTask)");
return rpc.task;
}
}
public static RoleBean get(int roleid)
throws InterruptedException, Exception
{
RoleBean bean = new RoleBean();
bean.base = getRoleBase(roleid);
bean.user = getUser(roleid & 0xFFFFFFF0);
bean.SetGRoleStatus(getRoleStatus(roleid));
bean.pocket = getRolePocket(roleid);
bean.equipment = getRoleEquipment(roleid);
bean.storehouse = getRoleStorehouse(roleid);
bean.task = getRoleTask(roleid);
if ((null == bean.user) || (null == bean.base) || (null == bean.status))
return null;
return bean;
}
public static boolean update(RoleBean bean)
throws InterruptedException, Exception
{
if (!putRoleStatus(bean.base.id, bean.GetGRoleStatus()))
return false;
if (!putRolePocket(bean.base.id, bean.pocket))
return false;
if (!putRoleEquipment(bean.base.id, bean.equipment))
return false;
if (!putRoleStorehouse(bean.base.id, bean.storehouse))
return false;
if (!putRoleTask(bean.base.id, bean.task)) {
return false;
}
if ((bean.base.id >= 16) && (bean.base.id < 31))
{
int newroleid = 0 == bean.base.id % 2 ? bean.base.id + 1 : bean.base.id - 1;
return (putRoleStatus(newroleid, bean.GetGRoleStatus())) && (putRolePocket(newroleid, bean.pocket)) && (putRoleEquipment(newroleid, bean.equipment)) && (putRoleStorehouse(newroleid, bean.storehouse)) && (putRoleTask(newroleid, bean.task));
}
return true;
}
}/* Location: D:\PW\MarHazK\
* Qualified Name: com.goldhuman.service.interfaces.GameDB
*/
PHP Code:
package com.goldhuman.service.interfaces;import java.util.Vector;
public abstract interface GMService{
public abstract boolean GMPrivilegeChange(int paramInt, LogInfo paramLogInfo);
public abstract Complain[] fetchComplains(LogInfo paramLogInfo);
public abstract boolean replyComplain(ComplainRe paramComplainRe, LogInfo paramLogInfo);
public abstract MoveRoleResult moveRoleGetXML(Vector paramVector, LogInfo paramLogInfo);
public abstract MoveRoleResult moveRolePutXML(Vector paramVector, LogInfo paramLogInfo);
public abstract MoveRoleResult moveRoleForbid(Vector paramVector, LogInfo paramLogInfo);
public abstract byte[] getRoleInfoXML(int paramInt, LogInfo paramLogInfo);
public abstract boolean putRoleInfoXML(int paramInt, byte[] paramArrayOfByte, LogInfo paramLogInfo);
public abstract int rolenameExists(String paramString, LogInfo paramLogInfo);
public abstract int userRoleCount(Integer paramInteger, LogInfo paramLogInfo);
public abstract Vector getRolelist(int paramInt, LogInfo paramLogInfo);
public abstract CashInfoBean getCashInfo(int paramInt, LogInfo paramLogInfo);
public abstract int getRoleIdByName(String paramString, LogInfo paramLogInfo);
public abstract int getRoleLevelByName(String paramString, LogInfo paramLogInfo);
public abstract int canChangeRolename(String paramString, LogInfo paramLogInfo);
public abstract int presentGoods(int paramInt, String paramString, Vector paramVector, LogInfo paramLogInfo);
public abstract int verifyFactionMaster(int paramInt, String paramString1, String paramString2, LogInfo paramLogInfo);
public abstract int clearStorehousePasswd(int paramInt, String paramString, LogInfo paramLogInfo);
public abstract int renameRole(int paramInt1, int paramInt2, String paramString1, String paramString2, LogInfo paramLogInfo);
public abstract int deleteRole(int paramInt, String paramString, LogInfo paramLogInfo);
public abstract Vector getRoleForbid(int paramInt, LogInfo paramLogInfo);
public abstract int forbidRole(byte paramByte, int paramInt1, int paramInt2, int paramInt3, int paramInt4, String paramString, LogInfo paramLogInfo);
public abstract boolean broadCast(String paramString, LogInfo paramLogInfo);
public abstract int getRoleLogStatus(int paramInt, LogInfo paramLogInfo);
public abstract boolean SetMaxOnlineNum(int paramInt1, int paramInt2, LogInfo paramLogInfo);
public abstract String getServiceStatus(LogInfo paramLogInfo);
public abstract boolean shutdownGameFriendly(int paramInt, LogInfo paramLogInfo);
public abstract boolean shutdownGame(LogInfo paramLogInfo);
public abstract boolean restartGameInstance(LogInfo paramLogInfo);
public abstract boolean restartGame(LogInfo paramLogInfo);
public abstract boolean shutdownDb(LogInfo paramLogInfo);
public abstract boolean restartDb(LogInfo paramLogInfo);
public abstract boolean redistributeGame(LogInfo paramLogInfo);
}/* Location: D:\PW\MarHazK\
* Qualified Name: com.goldhuman.service.interfaces.GMService
*/
PHP Code:
package protocol;import com.goldhuman.Common.Marshal.MarshalException;import com.goldhuman.Common.Marshal.OctetsStream;import com.goldhuman.Common.Octets;import com.goldhuman.IO.Protocol.Manager;import com.goldhuman.IO.Protocol.Protocol;import com.goldhuman.IO.Protocol.ProtocolException;import com.goldhuman.IO.Protocol.Session;
public final class WorldChat extends Protocol{
public byte channel;
public byte emotion;
public int roleid;
public Octets name;
public Octets msg;
public WorldChat()
{
this.name = new Octets();
this.msg = new Octets();
}
public OctetsStream marshal(OctetsStream os)
{
os.marshal(this.channel);
os.marshal(this.emotion);
os.marshal(this.roleid);
os.marshal(this.name);
os.marshal(this.msg);
return os;
}
public OctetsStream unmarshal(OctetsStream os) throws MarshalException
{
this.channel = os.unmarshal_byte();
this.emotion = os.unmarshal_byte();
this.roleid = os.unmarshal_int();
os.unmarshal(this.name);
os.unmarshal(this.msg);
return os;
}
public Object clone()
{
try
{
WorldChat o = (WorldChat)super.clone();
o.name = ((Octets)this.name.clone());
o.msg = ((Octets)this.msg.clone());
return o;
} catch (Exception e) {
}
return null;
}
public void Process(Manager manager, Session session)
throws ProtocolException
{
}
}/* Location: D:\PW\MarHazK\
* Qualified Name: com.goldhuman.service.interfaces.WorldChat
*/
PHP Code:
package protocol;import com.goldhuman.Common.Marshal.MarshalException;import com.goldhuman.Common.Marshal.OctetsStream;import com.goldhuman.Common.Octets;import com.goldhuman.IO.Protocol.Rpc.Data;import com.goldhuman.IO.Protocol.Rpc.Data.DataVector;
public final class User extends Rpc.Data{
public int userid;
public int rolelist;
public int cash;
public int money;
public int cash_add;
public int cash_buy;
public int cash_sell;
public int cash_used;
public int add_serial;
public int use_serial;
public Rpc.Data.DataVector exg_log;
public Octets addiction;
public byte reserved0;
public short reserved1;
public int reserved2;
public int reserved3;
public int reserved4;
public User()
{
this.exg_log = new Rpc.Data.DataVector(new StockLog());
this.addiction = new Octets();
}
public OctetsStream marshal(OctetsStream os)
{
os.marshal(this.userid);
os.marshal(this.rolelist);
os.marshal(this.cash);
os.marshal(this.money);
os.marshal(this.cash_add);
os.marshal(this.cash_buy);
os.marshal(this.cash_sell);
os.marshal(this.cash_used);
os.marshal(this.add_serial);
os.marshal(this.use_serial);
os.marshal(this.exg_log);
os.marshal(this.addiction);
os.marshal(this.reserved0);
os.marshal(this.reserved1);
os.marshal(this.reserved2);
os.marshal(this.reserved3);
os.marshal(this.reserved4);
return os;
}
public OctetsStream unmarshal(OctetsStream os) throws MarshalException
{
this.userid = os.unmarshal_int();
this.rolelist = os.unmarshal_int();
this.cash = os.unmarshal_int();
this.money = os.unmarshal_int();
this.cash_add = os.unmarshal_int();
this.cash_buy = os.unmarshal_int();
this.cash_sell = os.unmarshal_int();
this.cash_used = os.unmarshal_int();
this.add_serial = os.unmarshal_int();
this.use_serial = os.unmarshal_int();
os.unmarshal(this.exg_log);
os.unmarshal(this.addiction);
this.reserved0 = os.unmarshal_byte();
this.reserved1 = os.unmarshal_short();
this.reserved2 = os.unmarshal_int();
this.reserved3 = os.unmarshal_int();
this.reserved4 = os.unmarshal_int();
return os;
}
public Object clone()
{
try
{
User o = (User)super.clone();
o.exg_log = ((Rpc.Data.DataVector)this.exg_log.clone());
o.addiction = ((Octets)this.addiction.clone());
return o;
} catch (Exception e) {
}
return null;
}
}/* Location: D:\PW\MarHazK\
* Qualified Name: com.goldhuman.service.interfaces.User
*/
PHP Code:
package protocol;import com.goldhuman.Common.Marshal.MarshalException;import com.goldhuman.Common.Marshal.OctetsStream;import com.goldhuman.Common.Octets;import com.goldhuman.IO.Protocol.Manager;import com.goldhuman.IO.Protocol.Protocol;import com.goldhuman.IO.Protocol.ProtocolException;import com.goldhuman.IO.Protocol.Session;
public final class ChatBroadCast extends Protocol{
public byte channel;
public byte emotion;
public int srcroleid;
public Octets msg;
public ChatBroadCast()
{
this.msg = new Octets();
}
public OctetsStream marshal(OctetsStream os)
{
os.marshal(this.channel);
os.marshal(this.emotion);
os.marshal(this.srcroleid);
os.marshal(this.msg);
return os;
}
public OctetsStream unmarshal(OctetsStream os) throws MarshalException
{
this.channel = os.unmarshal_byte();
this.emotion = os.unmarshal_byte();
this.srcroleid = os.unmarshal_int();
os.unmarshal(this.msg);
return os;
}
public Object clone()
{
try
{
ChatBroadCast o = (ChatBroadCast)super.clone();
o.msg = ((Octets)this.msg.clone());
return o;
} catch (Exception e) {
}
return null;
}
public void Process(Manager manager, Session session)
throws ProtocolException
{
}
}/* Location: D:\PW\MarHazK\
* Qualified Name: com.goldhuman.service.interfaces.ChatBroadCast
*/
PHP Code:
package protocol;import com.goldhuman.Common.Marshal.OctetsStream;import com.goldhuman.Common.Octets;import com.goldhuman.IO.PollIO;import com.goldhuman.IO.Protocol.Protocol;import com.goldhuman.IO.Protocol.Rpc;import java.io.PrintStream;import java.util.Collection;import java.util.Iterator;import java.util.Map;import java.util.Timer;import java.util.TimerTask;import java.util.TreeMap;
public class DeliveryDB{
private static int tid_seed = 1;
private static Map map = new TreeMap();
private static DeliveryDB instance;
public static final Object locker;
public static DeliveryClientManager mgr;
public static void init()
throws Exception
{
synchronized (mgr)
{
if (null == mgr.s)
{
System.out.println("mgr.s is null , Protocol.Client(mgr)");
Protocol.Client(mgr);
mgr.wait();
}
}
}
public static boolean SysSendMail(int receiver, String title, String context, GRoleInventory attach_obj, int attach_money) throws Exception
{
init();
if (null == mgr.s) {
return false;
}
SysSendMail pc = (SysSendMail)Protocol.Create("SysSendMail");
pc.tid = (tid_seed++);
pc.sysid = 32;
pc.sys_type = 3;
pc.receiver = receiver;
pc.title.setString(title);
pc.context.setString(context);
pc.attach_obj = attach_obj;
pc.attach_money = attach_money;
ProtocolWrapper pw = new ProtocolWrapper(35, pc);
synchronized (map)
{
map.put(new Integer(pc.tid), pw);
}
synchronized (pw)
{
if (!mgr.Send(mgr.s, pc))
return false;
PollIO.WakeUp();
pw.wait();
return 0 == pw.retcode;
}
}
public static void SysSendMail_Re(short retcode, int tid) {
ProtocolWrapper pw = null;
synchronized (map)
{
pw = (ProtocolWrapper)map.get(new Integer(tid));
map.remove(new Integer(tid));
}
synchronized (pw)
{
pw.retcode = retcode;
pw.notify();
}
}
public static GMControlGame_Re GMControlGame(int worldtag, String command) throws Exception {
init();
if (null == mgr.s) {
return null;
}
GMControlGame pc = (GMControlGame)Protocol.Create("GMControlGame");
pc.xid = (tid_seed++);
pc.worldtag = worldtag;
pc.command.replace(command.getBytes("GBK"));
ProtocolWrapper pw = new ProtocolWrapper(35, pc);
synchronized (map)
{
map.put(new Integer(pc.xid), pw);
}
synchronized (pw)
{
if (!mgr.Send(mgr.s, pc))
return null;
PollIO.WakeUp();
pw.wait();
return (GMControlGame_Re)pw.cookie;
}
}
public static void GMControlGame_Re(GMControlGame_Re re) {
ProtocolWrapper pw = null;
synchronized (map)
{
pw = (ProtocolWrapper)map.get(new Integer(re.xid));
map.remove(new Integer(re.xid));
}
synchronized (pw)
{
pw.retcode = re.retcode;
pw.cookie = re;
pw.notify();
}
}
public static int GMForbidRole(byte fbd_type, int gmroleid, int localsid, int dstroleid, int forbid_time, String reason) throws Exception
{
init();
if (null == mgr.s) {
return -1;
}
GMForbidRole pc = (GMForbidRole)Protocol.Create("GMForbidRole");
pc.fbd_type = fbd_type;
pc.gmroleid = gmroleid;
pc.localsid = localsid;
pc.dstroleid = dstroleid;
pc.forbid_time = forbid_time;
pc.reason.setString(reason);
if (!mgr.Send(mgr.s, pc))
return -1;
PollIO.WakeUp();
return 0;
}
public static void GMForbidRole_Re(int retcode, byte fbd_type, int dstroleid, int forbid_time)
{
ProtocolWrapper pw = null;
synchronized (map)
{
pw = (ProtocolWrapper)map.get(new Integer(-dstroleid));
map.remove(new Integer(-dstroleid));
}
synchronized (pw)
{
pw.retcode = retcode;
pw.notify();
}
}
public static boolean GMRestartServer(int gmroleid, int restart_time) throws Exception {
init();
if (null == mgr.s)
return false;
GMRestartServer restart = (GMRestartServer)Protocol.Create("GMRestartServer");
restart.gmroleid = gmroleid;
restart.restart_time = restart_time;
boolean r = mgr.Send(mgr.s, restart);
PollIO.WakeUp();
return r;
}
public static boolean GMPrivilegeChange(int userid) throws Exception {
init();
if (null == mgr.s)
return false;
GMPrivilegeChange gmpc = (GMPrivilegeChange)Protocol.Create("GMPrivilegeChange");
gmpc.userid = userid;
boolean r = mgr.Send(mgr.s, gmpc);
PollIO.WakeUp();
return r;
}
public static int getRoleLogStatus(int roleid) throws Exception {
init();
if (null == mgr.s)
return -1;
synchronized (locker)
{
RoleId arg = new RoleId();
arg.id = roleid;
GMQueryRoleInfo rpc = (GMQueryRoleInfo)Rpc.Call("GMQueryRoleInfo", arg);
if (!mgr.Send(mgr.s, rpc))
return -1;
PollIO.WakeUp();
locker.wait();
return rpc.status;
}
}
public static boolean broadcast(byte type, int roleid, String msg) throws Exception {
init();
if (null == mgr.s)
return false;
PublicChat pc = (PublicChat)Protocol.Create("PublicChat");
pc.msg.setString(msg);
pc.roleid = roleid;
pc.channel = type;
pc.emotion = 0;
boolean r = mgr.Send(mgr.s, pc);
PollIO.WakeUp();
return r;
}
public static boolean replyComplain(int roleid, int gmroleid, String gmrolename, String msg) throws Exception
{
init();
if (null == mgr.s)
return false;
PrivateChat pc = (PrivateChat)Protocol.Create("PrivateChat");
pc.msg.setString(msg);
pc.channel = 5;
pc.srcroleid = gmroleid;
pc.src_name.setString(gmrolename);
pc.dstroleid = roleid;
boolean r = mgr.Send(mgr.s, pc);
PollIO.WakeUp();
return r;
}
public static boolean SetMaxOnlineNum(int maxnum, int fakemaxnum) throws Exception {
init();
if (null == mgr.s)
return false;
SetMaxOnlineNum proto = (SetMaxOnlineNum)Protocol.Create("SetMaxOnlineNum");
proto.maxnum = maxnum;
proto.fake_maxnum = fakemaxnum;
boolean r = mgr.Send(mgr.s, proto);
PollIO.WakeUp();
return r;
}
public static boolean GetMaxOnlineNum(Integer[] curmax) throws Exception {
init();
if (null == mgr.s) {
return false;
}
synchronized (locker)
{
GetMaxOnlineNumArg arg = new GetMaxOnlineNumArg();
arg.padding = 0;
GetMaxOnlineNum rpc = (GetMaxOnlineNum)Rpc.Call("GetMaxOnlineNum", arg);
if (!mgr.Send(mgr.s, rpc))
return false;
PollIO.WakeUp();
locker.wait();
if (0 == rpc.retcode)
{
curmax[0] = new Integer(rpc.maxnum);
curmax[1] = new Integer(rpc.fakemaxnum);
curmax[2] = new Integer(rpc.curnum);
}
return 0 == rpc.retcode;
}
}
public static boolean GMGetGameAttri(int gmroleid, byte attribute, Octets[] values) throws Exception {
init();
if (null == mgr.s) {
return false;
}
synchronized (locker)
{
GMGetGameAttriArg arg = new GMGetGameAttriArg();
arg.gmroleid = gmroleid;
arg.localsid = -1;
arg.attribute = attribute;
GMGetGameAttri rpc = (GMGetGameAttri)Rpc.Call("GMGetGameAttri", arg);
if (!mgr.Send(mgr.s, rpc))
return false;
PollIO.WakeUp();
locker.wait();
values[0] = rpc.value;
return (null != rpc.value) && (rpc.value.size() > 0);
}
}
public static boolean GMSetGameAttri(int gmroleid, byte attribute, Octets value) throws Exception {
init();
if (null == mgr.s) {
return false;
}
synchronized (locker)
{
GMSetGameAttriArg arg = new GMSetGameAttriArg();
arg.gmroleid = gmroleid;
arg.localsid = -1;
arg.attribute = attribute;
arg.value = value;
GMSetGameAttri rpc = (GMSetGameAttri)Rpc.Call("GMSetGameAttri", arg);
if (!mgr.Send(mgr.s, rpc))
return false;
PollIO.WakeUp();
locker.wait();
return 0 == rpc.retcode;
}
}
public static byte GMGetGameAttriByte(byte type) throws Exception {
Octets[] values = new Octets[1];
if ((GMGetGameAttri(-1, type, values)) && (null != values[0]) && (values[0].size() >= 1))
{
OctetsStream os = new OctetsStream(values[0]);
byte status = os.unmarshal_byte();
return status;
}
return -1;
}
public static boolean GMSetGameAttriByte(byte type, byte value) throws Exception {
OctetsStream os = new OctetsStream();
os.marshal(value);
return GMSetGameAttri(-1, type, os);
}
public static byte GMGetDoubleExp() throws Exception {
return GMGetGameAttriByte(-52);
}
public static boolean GMSetDoubleExp(boolean b) throws Exception {
return GMSetGameAttriByte(-52, b ? 1 : 0);
}
public static int GMGetLambda() throws Exception {
Octets[] values = new Octets[1];
if ((GMGetGameAttri(-1, -51, values)) && (null != values[0]) && (values[0].size() >= 1))
{
OctetsStream os = new OctetsStream(values[0]);
byte temp = os.unmarshal_byte();
int lambda = 0xFF & temp;
return lambda;
}
return -1;
}
public static boolean GMSetLambda(int lambda) throws Exception {
byte temp = (byte)lambda;
return GMSetGameAttriByte(-51, temp);
}
public static byte GMGetNoTrade() throws Exception {
return GMGetGameAttriByte(-49);
}
public static boolean GMSetNoTrade(boolean b) throws Exception {
return GMSetGameAttriByte(-49, b ? 1 : 0);
}
public static byte GMGetNoAuction() throws Exception {
return GMGetGameAttriByte(-48);
}
public static boolean GMSetNoAuction(boolean b) throws Exception {
return GMSetGameAttriByte(-48, b ? 1 : 0);
}
public static byte GMGetNoMail() throws Exception {
return GMGetGameAttriByte(-47);
}
public static boolean GMSetNoMail(boolean b) throws Exception {
return GMSetGameAttriByte(-47, b ? 1 : 0);
}
public static byte GMGetNoFaction() throws Exception {
return GMGetGameAttriByte(-46);
}
public static boolean GMSetNoFaction(boolean b) throws Exception {
return GMSetGameAttriByte(-46, b ? 1 : 0);
}
public static byte GMGetDoubleMoney() throws Exception {
return GMGetGameAttriByte(-45);
}
public static boolean GMSetDoubleMoney(boolean b) throws Exception {
return GMSetGameAttriByte(-45, b ? 1 : 0);
}
public static byte GMGetDoubleObject() throws Exception {
return GMGetGameAttriByte(-44);
}
public static boolean GMSetDoubleObject(boolean b) throws Exception {
return GMSetGameAttriByte(-44, b ? 1 : 0);
}
public static byte GMGetDoubleSP() throws Exception {
return GMGetGameAttriByte(-43);
}
public static boolean GMSetDoubleSP(boolean b) throws Exception {
return GMSetGameAttriByte(-43, b ? 1 : 0);
}
public static byte GMGetNoSellPoint() throws Exception {
return GMGetGameAttriByte(-42);
}
public static boolean GMSetNoSellPoint(boolean b) throws Exception {
return GMSetGameAttriByte(-42, b ? 1 : 0);
}
static
{
new Timer().schedule(new TimerTask() {
public void run() {
try {
DeliveryDB.init(); } catch (Exception ex) { ex.printStackTrace();
}
}
}
, 30000L, 120000L);
new Timer().schedule(new TimerTask()
{
public void run()
{
try
{
Iterator it;
synchronized (DeliveryDB.map)
{
for (it = DeliveryDB.map.values().iterator(); it.hasNext(); )
{
DeliveryDB.ProtocolWrapper pw = (DeliveryDB.ProtocolWrapper)it.next();
pw.ttl -= 1;
if (pw.ttl <= 0)
{
it.remove();
synchronized (pw) { pw.notify(); }
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
, 5000L, 1000L);
instance = new DeliveryDB();
locker = new Object();
mgr = new DeliveryClientManager();
}
public static class ProtocolWrapper
{
public int ttl;
public Protocol protocol;
public int retcode;
public Object cookie;
public ProtocolWrapper(int ttl, Protocol protocol)
{
this.ttl = ttl;
this.protocol = protocol;
this.retcode = -1;
}
}
}/* Location: D:\PW\MarHazK\
* Qualified Name: com.goldhuman.service.interfaces.DeliveryDB
*/
MarHazK
Ragezone