Minor bug fixes and added DummyStorageMedium

This commit is contained in:
Joe0 2011-12-01 21:17:36 -06:00
parent 889835ae21
commit cde9adddd5
5 changed files with 187 additions and 4 deletions

View File

@ -9,7 +9,7 @@
<delete file="${jar}" />
<delete dir="${build}" />
<mkdir dir="${build}" />
<javac srcdir="${src}" destdir="${build}" debug="on" target="1.6">
<javac srcdir="${src}" destdir="${build}" debug="on">
<classpath>
<pathelement location="${lib}/mina.jar" />
<pathelement location="${lib}/xpp3.jar" />

View File

@ -11,5 +11,5 @@
<entry key="queryip">localhost</entry>
<entry key="queryport">8186</entry>
<entry key="authURL">http://localhost/auth.php</entry>
<entry key="storage-medium">org.moparscape.msc.ls.persistence.impl.MySQL</entry>
<entry key="storage-medium">org.moparscape.msc.ls.persistence.impl.DummyStorageMedium</entry>
</properties>

View File

@ -36,7 +36,7 @@ public class PlayerSaveHandler implements PacketHandler {
//save.setPoints(p.readInt());
for (int i = 0; i < 18; i++) {
save.setStat(i, p.readInt(), p.readShort());
save.setStat(i, (int) p.readLong(), p.readShort());
}
int invCount = p.readShort();

View File

@ -0,0 +1,183 @@
package org.moparscape.msc.ls.persistence.impl;
import java.util.Arrays;
import java.util.List;
import org.moparscape.msc.ls.model.PlayerSave;
import org.moparscape.msc.ls.persistence.StorageMedium;
import org.moparscape.msc.ls.util.Config;
public class DummyStorageMedium implements StorageMedium {
@Override
public boolean savePlayer(PlayerSave s) {
return true;
}
@Override
public void shutdown() {
}
@Override
public void logTrade(long from, long to, int item, long amount, int x,
int y, int type, long date) {
}
@Override
public void logReport(long user, long reported, byte reason, int x, int y,
String status) {
}
@Override
public void resetOnlineFlag(int world) {
}
@Override
public void logKill(long user, long killed, byte type) {
}
@Override
public void addFriend(long user, long friend) {
}
@Override
public boolean addFriend_isOnline0(long user, long friend) {
return false;
}
@Override
public boolean addFriend_isOnline1(long friend, long user) {
return false;
}
@Override
public void removeFriend(long user, long friend) {
}
@Override
public boolean removeFriend_isOnline(long user) {
return false;
}
@Override
public void addIgnore(long user, long friend) {
}
@Override
public void removeIgnore(long user, long friend) {
}
@Override
public List<Long> getFriendsOnline(long user) {
return null;
}
@Override
public void chatBlock(int on, long user) {
}
@Override
public void privateBlock(int on, long user) {
}
@Override
public List<Long> getPrivateBlockFriendsOnline(long user) {
return null;
}
@Override
public void tradeBlock(int on, long user) {
}
@Override
public void duelBlock(int on, long user) {
}
@Override
public boolean playerExists(long user) {
return true;
}
@Override
public boolean isBanned(long user) {
return false;
}
@Override
public int getGroupID(long user) {
// Dev mode
return 11;
}
@Override
public long getOwner(long user) {
return 0;
}
@Override
public void setOnlineFlag(int id, long user) {
}
@Override
public boolean ban(boolean setBanned, long user) {
return false;
}
@Override
public void logBan(long user, long modhash) {
}
@Override
public void setGameSettings(int idx, boolean on, long user) {
}
@Override
public PlayerSave loadPlayer(long user) {
PlayerSave save = new PlayerSave(user);
save.setLocation(213, 452);
save.setAppearance((byte) 2, (byte) 8, (byte) 14, (byte) 0, (byte) 1,
(byte) 2, true, 0l);
int[] arrayOfOnes = new int[Config.statArray.length];
Arrays.fill(arrayOfOnes, 1);
save.setExp(arrayOfOnes.clone());
save.setCurStats(arrayOfOnes.clone());
return save;
}
@Override
public void logLogin(long user, String ip) {
}
@Override
public void logIn(String ip, long user) {
}
}

View File

@ -108,7 +108,7 @@ public class MySQL implements StorageMedium {
conn.updateQuery(query.substring(0, query.length() - 1)
+ " WHERE `user`=" + s.getUser());
System.out.println(s.getEventCD());
updateLongs(Statements.save_SetEventCD, s.getEventCD() / 1000, s.getUser());
return true;