no message

This commit is contained in:
雪风 2025-03-30 12:53:04 +08:00
parent 6451e23396
commit 3da8d6e324
13 changed files with 312 additions and 97 deletions

View File

@ -1,9 +1,12 @@
package client;
import cn.hutool.core.util.RandomUtil;
import com.alibaba.fastjson.JSONObject;
import gui.tw.diaoyu.BL;
import gui.tw.diaoyu.DiaoyuItem;
import gui.tw.rw.XuanShangRenWu;
import gui.tw.rw.rwConfig;
import handling.channel.handler.DamageParse;
import provider.MapleDataTool;
import server.life.MapleLifeFactory;
import server.shops.MaplePlayerShopItem;
@ -5321,20 +5324,21 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject implements Se
return this.guildrank;
}
public int getCombat() {
public String getCombat() {
final short[] TemporaryGroup = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -15, -16, -17, -18, -19, -26, -27, -28, -29, -101, -102, -103, -104, -105, -106, -107, -108, -109, -110, -111, -112, -113, -114, -115, -116, -118, -119, -121, -127, -128};
int Num = 0;
BigInteger Num = BigInteger.ZERO;
for (short i = 0; i < TemporaryGroup.length; ++i) {
final IEquip equip = (IEquip) this.getInventory(MapleInventoryType.EQUIPPED).getItem(TemporaryGroup[i]);
if (equip != null) {
if (((Integer) Start.ConfigValuesMap.get("战力修正")).intValue() > 0) {
Num += this.RuinStat1(equip);
} else {
Num += this.RuinStat(equip);
Num = Num.add( BigInteger.valueOf(this.RuinStat(equip)));
}
}
}
return Num;
Num = Num.add((this.getQG()).divide(BigInteger.valueOf(100)));
Num = Num.add((this.getQGjs()).multiply(BigInteger.valueOf(100)));
Num = Num.add((this.getDD()).multiply(BigInteger.valueOf(666)));
Num = Num.add((this.getDB()).multiply(BigInteger.valueOf(1000)));
return DamageParse.process(Num.toString());
}
public int getComStr() {
@ -5498,7 +5502,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject implements Se
}
public int RuinStat(final IEquip equip) {
return equip.getStr() + equip.getDex() + equip.getInt() + equip.getLuk() + equip.getWatk() + equip.getMatk() + equip.getMdef() + equip.getWdef() + equip.getUpgradeSlots() + equip.getLevel();
return equip.getStr() + equip.getDex() + equip.getInt() + equip.getLuk() + equip.getWatk() + equip.getMatk() ;
}
public int RuinStat1(final IEquip equip) {
@ -12161,19 +12165,34 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject implements Se
public void jqxsrw() {
if (Start.xsRW.get(this.id) ==null){
xsRw();
}
}
public XuanShangRenWu getRw(){
return Start.xsRW.get(this.id);
}
public void xsRw(){
XuanShangRenWu xsRW = new XuanShangRenWu();
xsRW.setAccount(this.c.getAccountName());
xsRW.setAccount(this.client.getAccountName());
xsRW.setName(this.name);
xsRW.setCid(this.id);
xsRW.setMobId(100101);
xsRW.setMaxNum(600);
xsRW.setMobNum(0);
String string = MapleDataTool.getString((100101 + "/name"), MapleLifeFactory.mobStringData, "未知怪物");
xsRW.setMobNName(string);
rwConfig rwConfig = RandomUtil.randomEle(Start.xsRWConfig);
xsRW.setMaxNum(rwConfig.getMaxNum());
xsRW.setMobId(rwConfig.getMobId());
String mobName = MapleDataTool.getString((rwConfig.getMobId() + "/name"), MapleLifeFactory.mobStringData, "未知怪物");
xsRW.setMobName(mobName);
Start.xsRW.put(this.id,xsRW);
}
public void deleteRw(){
Start.xsRW.remove(this.id);
}
public int getRwMobId(){
@ -12187,7 +12206,7 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject implements Se
if (Start.xsRW.get(this.id) !=null) {
Start.xsRW.get(this.id).setMobId(MobId);
String string = MapleDataTool.getString((100101 + "/name"), MapleLifeFactory.mobStringData, "未知怪物");
Start.xsRW.get(this.id).setMobNName(string);
Start.xsRW.get(this.id).setMobName(string);
}
}
@ -12204,4 +12223,24 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject implements Se
}
}
//字符串相加方法
public static String addStrings(String str1, String str2) {
BigInteger bigInteger = new BigInteger(str1);
BigInteger bigInteger1 = new BigInteger(str2);
return bigInteger.add(bigInteger1).toString();
}
//相乘
public static String multiplyStrings(String str1, String str2) {
BigInteger bigInteger = new BigInteger(str1);
BigInteger bigInteger1 = new BigInteger(str2);
return bigInteger.multiply(bigInteger1).toString();
}
//
public static String divideStrings(String str1, String str2) {
BigInteger bigInteger = new BigInteger(str1);
BigInteger bigInteger1 = new BigInteger(str2);
return bigInteger.divide(bigInteger1).toString();
}
}

View File

@ -633,7 +633,9 @@ public class PlayerStats implements Serializable {
sxbl(chra);
if (!first_login) {
chra.jqxsrw();
}
dsbbh++;
// if (!first_login) {
// for (AotuNpc npc : Start.aotuNpcs) {

View File

@ -3,6 +3,7 @@ package gui;
QQ327321366
*/
import java.sql.*;
import java.util.LinkedList;
import java.util.HashMap;
@ -14,13 +15,12 @@ import gui.tw.BsConfig;
import gui.tw.diaoyu.DiaoyuConfig;
import gui.tw.ZLConfig;
import gui.tw.rw.XuanShangRenWu;
import gui.tw.rw.rwConfig;
import server.MapleInventoryManipulator;
import client.inventory.Equip;
import handling.world.World.Broadcast;
import tools.MaplePacketCreator;
import java.sql.ResultSet;
import constants.tzjc;
import ppSetting.Game;
import client.LoginCrypto;
@ -63,10 +63,6 @@ import server.Timer.WorldTimer;
import handling.world.World;
import constants.ServerConfig;
import java.sql.PreparedStatement;
import java.sql.Connection;
import java.sql.SQLException;
import tools.FileoutputUtil;
import database.DBConPool;
@ -85,6 +81,7 @@ import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.stream.Collectors;
import tools.MacAddressTool;
@ -111,6 +108,7 @@ public class Start {
public static List<AotuNpc> aotuNpcs = new ArrayList<>();
public static Map<Integer, XuanShangRenWu> xsRW = new HashMap<>();
public static List<rwConfig> xsRWConfig = new ArrayList<>();
public static String[] shxs= {"", "亿", "", "", "","", "", "", "", "", "", "","恒河沙", "阿僧祇", "那由他", "不可思议", "无量", "古戈尔","频菠萝", "矜羯罗","不可说不可说转","超限数",
@ -484,11 +482,138 @@ public class Start {
Game.服务端启动中 = 1;
ppms.配置同步到界面();
tzjc.sr_tz();
initXSRW();
Start.xsRW=getAllXuanShangRenWu().stream().collect(Collectors.toMap(
XuanShangRenWu::getCid,
xsrw -> xsrw
));
System.out.println("[" + FileoutputUtil.CurrentReadable_Time() + "][信息]:悬赏任务数据加载完毕");
System.out.println("[" + FileoutputUtil.CurrentReadable_Time() + "][信息]服务器端已经启动完毕。");
System.out.println("[" + FileoutputUtil.CurrentReadable_Time() + "][========================================]");
}
}
public static void initXSRW() {
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = (Connection) DBConPool.getInstance().getDataSource().getConnection();
// 检查表是否已存在
boolean tableExists = false;
DatabaseMetaData meta = con.getMetaData();
rs = meta.getTables(null, null, "xuanshangrenwu", new String[] {"TABLE"});
if (rs.next()) {
tableExists = true;
}
rs.close();
if (!tableExists) {
// 创建表的SQL语句
String createTableSQL = "CREATE TABLE xuanshangrenwu ("
+ "cid INT NOT NULL, "
+ "account VARCHAR(255), "
+ "name VARCHAR(255), "
+ "mobId INT, "
+ "mobName VARCHAR(255), "
+ "mobNum INT, "
+ "maxNum INT, "
+ "PRIMARY KEY (cid))";
ps = con.prepareStatement(createTableSQL);
ps.executeUpdate();
ps.close();
System.out.println("[" + FileoutputUtil.CurrentReadable_Time() + "][信息]:悬赏任务数据库表创建完毕");
} else {
}
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
DBConPool.cleanUP(rs, ps, con);
}
}
public static boolean clearAndSaveAll() {
Connection con = null;
PreparedStatement deletePs = null;
PreparedStatement insertPs = null;
try {
con = DBConPool.getInstance().getDataSource().getConnection();
String truncateSql = "TRUNCATE TABLE XuanShangRenWu";
deletePs = con.prepareStatement(truncateSql);
deletePs.executeUpdate();
deletePs.close();
String insertSql = "INSERT INTO XuanShangRenWu (cid, account, name, mobId, mobName, mobNum, maxNum) " +
"VALUES (?, ?, ?, ?, ?, ?, ?)";
insertPs = con.prepareStatement(insertSql);
for (XuanShangRenWu xsrw : xsRW.values()) {
insertPs.setInt(1, xsrw.getCid());
insertPs.setString(2, xsrw.getAccount());
insertPs.setString(3, xsrw.getName());
insertPs.setInt(4, xsrw.getMobId());
insertPs.setString(5, xsrw.getMobName());
insertPs.setInt(6, xsrw.getMobNum());
insertPs.setInt(7, xsrw.getMaxNum());
insertPs.addBatch(); // 添加到批处理
}
// 执行批处理
int[] results = insertPs.executeBatch();
// con.commit(); // 提交事务
return true;
} catch (SQLException ex) {
ex.printStackTrace();
return false;
} finally {
DBConPool.cleanUP(null, insertPs, con); // 关闭资源
}
}
public static List<XuanShangRenWu> getAllXuanShangRenWu() {
List<XuanShangRenWu> resultList = new ArrayList<>();
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = DBConPool.getInstance().getDataSource().getConnection();
String sql = "SELECT cid, account, name, mobId, mobName, mobNum, maxNum FROM XuanShangRenWu";
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
while (rs.next()) {
XuanShangRenWu xsrw = new XuanShangRenWu();
xsrw.setCid(rs.getInt("cid"));
xsrw.setAccount(rs.getString("account"));
xsrw.setName(rs.getString("name"));
xsrw.setMobId(rs.getInt("mobId"));
xsrw.setMobName(rs.getString("mobName"));
xsrw.setMobNum(rs.getInt("mobNum"));
xsrw.setMaxNum(rs.getInt("maxNum"));
resultList.add(xsrw);
}
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
DBConPool.cleanUP(rs, ps, con);
}
return resultList;
}
public static void 回收内存(final int time) {
WorldTimer.getInstance().register((Runnable) new Runnable() {
@Override

View File

@ -17,6 +17,7 @@ import tools.StringUtil;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.image.BufferedImage;
import java.io.File;
import java.sql.*;
import java.util.ArrayList;
@ -548,10 +549,9 @@ public class Drop {
}
public static void main(String[] args) {
List<Drop> qqs = getMobBLs();
exportData("E:\\MXD\\cs.txt", qqs);
importDataQQ("E:\\MXD\\cs.txt");
MapleData monsterData = MapleLifeFactory.data.getData(StringUtil.getLeftPaddedStr(100102 + ".img", '0', 11));
String string = MapleDataTool.getString((100101 + "/name"), MapleLifeFactory.mobStringData, "MISSINGNO");
System.out.println(string);
}

View File

@ -1,5 +1,13 @@
package gui.tw.rw;
import gui.Start;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import static cn.hutool.core.text.CharSequenceUtil.containsIgnoreCase;
public class XuanShangRenWu {
int cid;
@ -10,7 +18,7 @@ public class XuanShangRenWu {
int mobId;
String mobNName;
String mobName;
int mobNum;
@ -48,12 +56,12 @@ public class XuanShangRenWu {
this.mobId = mobId;
}
public String getMobNName() {
return mobNName;
public String getMobName() {
return mobName;
}
public void setMobNName(String mobNName) {
this.mobNName = mobNName;
public void setMobName(String mobNName) {
this.mobName = mobNName;
}
public int getMobNum() {
@ -71,4 +79,25 @@ public class XuanShangRenWu {
public void setMaxNum(int maxNum) {
this.maxNum = maxNum;
}
public static List<XuanShangRenWu> fuzzySearch( String keyword) {
List<XuanShangRenWu> list = new ArrayList<>(Start.xsRW.values());
if (keyword == null || keyword.trim().isEmpty()) {
return list; // 如果关键词为空返回所有
}
String lowerKeyword = keyword.toLowerCase();
return list.stream()
.filter(item ->
containsIgnoreCase(String.valueOf(item.cid), lowerKeyword) ||
containsIgnoreCase(item.account, lowerKeyword) ||
containsIgnoreCase(item.name, lowerKeyword) ||
containsIgnoreCase(String.valueOf(item.mobId), lowerKeyword) ||
containsIgnoreCase(item.mobName, lowerKeyword) ||
containsIgnoreCase(String.valueOf(item.mobNum), lowerKeyword) ||
containsIgnoreCase(String.valueOf(item.maxNum), lowerKeyword)
)
.collect(Collectors.toList());
}
}

View File

@ -7,4 +7,29 @@ public class rwConfig {
int mobId;
int maxNum;
public int getRwId() {
return rwId;
}
public void setRwId(int rwId) {
this.rwId = rwId;
}
public int getMobId() {
return mobId;
}
public void setMobId(int mobId) {
this.mobId = mobId;
}
public int getMaxNum() {
return maxNum;
}
public void setMaxNum(int maxNum) {
this.maxNum = maxNum;
}
}

View File

@ -37,6 +37,7 @@ import gui.tw.diaoyu.BL;
import gui.tw.diaoyu.DiaoYuMap;
import gui.tw.diaoyu.DiaoyuItem;
import gui.tw.ZLConfig;
import gui.tw.rw.rwConfig;
import org.netbeans.lib.awtextra.AbsoluteConstraints;
import java.awt.Component;
@ -1087,6 +1088,12 @@ public class 特殊控制台 extends JFrame {
JSONObject jsonObject4 = JSONObject.parseObject(result6);
Start.aotuNpcs = jsonObject4.getJSONArray("npc").toJavaList(AotuNpc.class);
fileReader = new FileReader(property + "\\配置文件\\悬赏任务.ini");
String result7 = fileReader.readString();
JSONObject jsonObject5 = JSONObject.parseObject(result7);
Start.xsRWConfig = jsonObject5.getJSONArray("rw").toJavaList(rwConfig.class);
}catch (Exception e){
e.printStackTrace();
}
@ -1147,7 +1154,9 @@ public class 特殊控制台 extends JFrame {
fileWriter.write(jsonString3);
fileWriter = new FileWriter(new File(property + "\\配置文件\\定时访问npc.ini"));
fileWriter.write(JSON.toJSONString(Start.aotuNpcs));
JSONObject jsonObject4 = new JSONObject();
jsonObject4.put("npc", JSON.toJSONString(Start.aotuNpcs));
fileWriter.write(jsonObject4.toString());
}

View File

@ -161,7 +161,7 @@ public abstract class AbstractPlayerInteraction {
this.getPlayer().setBossLog1(bossid, number);
}
public int getCombat() {
public String getCombat() {
return this.getPlayer().getCombat();
}
@ -1229,7 +1229,7 @@ public abstract class AbstractPlayerInteraction {
if (this.getParty() != null) {
for (final MaplePartyCharacter partyCharacter : this.getParty().getMembers()) {
final MapleCharacter player = this.getChannelServer().getPlayerStorage().getCharacterById(partyCharacter.getId());
if (player != null && player.getCombat() < a) {
if (player != null && Integer.parseInt(player.getCombat()) < a) {
return false;
}
}
@ -1243,7 +1243,7 @@ public abstract class AbstractPlayerInteraction {
}
for (final MaplePartyCharacter partyCharacter : this.getParty().getMembers()) {
final MapleCharacter player = this.getChannelServer().getPlayerStorage().getCharacterById(partyCharacter.getId());
if (player != null && player.getCombat() < a) {
if (player != null && Integer.parseInt(player.getCombat()) < a) {
return partyCharacter;
}
}

View File

@ -3,6 +3,7 @@ package server;
import java.util.Set;
import java.util.Iterator;
import gui.Start;
import handling.cashshop.CashShopServer;
import handling.login.LoginServer;
import handling.world.World.Family;
@ -96,6 +97,10 @@ public class ShutdownServer implements Runnable, ShutdownServerMBean {
} catch (Exception e2) {
System.out.println("[" + FileoutputUtil.CurrentReadable_Time() + "][信息]:购物商城服务器关闭失败" + e2);
}
Start.clearAndSaveAll();
System.out.println("[" + FileoutputUtil.CurrentReadable_Time() + "][信息]:悬赏任务进度保存完毕");
System.out.println("[" + FileoutputUtil.CurrentReadable_Time() + "][信息]:服务端已经完全关闭了请点击右上角的xx按钮关闭.");
System.out.println("[" + FileoutputUtil.CurrentReadable_Time() + "][========================================]");
}

View File

@ -38,6 +38,9 @@ public class OverrideMonsterStats {
this.hp = hp;
}
public int getMp() {
return this.mp;
}

View File

@ -1,5 +1,6 @@
package server.maps;
import gui.tw.rw.XuanShangRenWu;
import server.ServerProperties;
import server.MapleCarnivalFactory.MCSkill;
import server.MapleCarnivalFactory;
@ -1072,13 +1073,24 @@ public final class MapleMap {
}
this.dropFromMonster(drop, monster);
XuanShangRenWu xuanShangRenWu = Start.xsRW.get(chr.getId());
if (xuanShangRenWu != null&&xuanShangRenWu.getMobId()==mobid &&xuanShangRenWu.getMobNum()<xuanShangRenWu.getMaxNum()){
xuanShangRenWu.setMobNum(xuanShangRenWu.getMobNum() + 1);
chr.dropMessage(-1, xuanShangRenWu.getMobName() +xuanShangRenWu.getMobNum() +"/"+xuanShangRenWu.getMaxNum());
}
//贪玩鞭尸
int bsjl = chr.getBSJL();
int bsjl2 = Randomizer.rand(0, 10000);
if (bsjl2 < bsjl) {
String mapName1 = chr.getMap().getMapName();
Broadcast.broadcastMessage(MaplePacketCreator.serverNotice(5, "恭喜[" + chr.getName() + "]在"+mapName1+"击杀怪物后触发鞭尸,怪物二次大爆!"));
chr.dropMessage(-1, "击杀["+monster.getStats().getName()+"]触发鞭尸,怪物二次大爆!");
if (monster.getStats().isBoss()) {
Broadcast.broadcastMessage(MaplePacketCreator.serverNotice(5, "[" + chr.getName() + "]击杀["+monster.getStats().getName()+"]触发鞭尸,怪物二次大爆!"));
}
this.dropFromMonster(drop, monster);
}
int bs = chr.getBs();

View File

@ -880,24 +880,6 @@ public class MaplePacketCreator {
mplew.write((int) chr.getLevel());
mplew.writeMapleAsciiString(chr.getName());
String xl = "";
if (chr.getCombat() <= 1000)
xl = "[青铜]";
else if (chr.getCombat() > 1000 && chr.getCombat() <= 5000)
xl = "[白银]";
else if (chr.getCombat() > 5000 && chr.getCombat() <= 10000)
xl = "[黄金]";
else if (chr.getCombat() > 10000 && chr.getCombat() <= 50000)
xl = "[铂金]";
else if (chr.getCombat() > 50000 && chr.getCombat() <= 100000)
xl = "[钻石]";
else if (chr.getCombat() > 100000 && chr.getCombat() <= 500000)
xl = "[大师]";
else if (chr.getCombat() > 500000 && chr.getCombat() <= 600000)
xl = "[☆王者☆]";
else if (chr.getCombat() > 600000 && chr.getCombat() <= 1000000)
xl = "[☆超级王者☆]";
else if (chr.getCombat() > 1100000)
xl = "[☆宇宙王者☆]";
String name="";
@ -2868,24 +2850,7 @@ public class MaplePacketCreator {
mplew.write(1);
mplew.writeInt(0);
String xl = "";
if (c.getCombat() <= 1000)
xl = "[青铜]";
else if (c.getCombat() > 1000 && c.getCombat() <= 5000)
xl = "[白银]";
else if (c.getCombat() > 5000 && c.getCombat() <= 10000)
xl = "[黄金]";
else if (c.getCombat() > 10000 && c.getCombat() <= 50000)
xl = "[铂金]";
else if (c.getCombat() > 50000 && c.getCombat() <= 100000)
xl = "[钻石]";
else if (c.getCombat() > 100000 && c.getCombat() <= 500000)
xl = "[王者]";
else if (c.getCombat() > 500000 && c.getCombat() <= 600000)
xl = "[☆大师☆]";
else if (c.getCombat() > 600000 && c.getCombat() <= 1000000)
xl = "[☆超级王者☆]";
else if (c.getCombat() > 1100000)
xl = "[☆宇宙王者☆]";
String name="";
if (Start.zlkg == 1) {
@ -2943,24 +2908,24 @@ public class MaplePacketCreator {
public static void getGuildInfo(final MaplePacketLittleEndianWriter mplew, final MapleGuild guild, final MapleCharacter c) {
mplew.writeInt(guild.getId());
String xl = "";
if (c.getCombat() <= 1000)
xl = "[青铜]";
else if (c.getCombat() > 1000 && c.getCombat() <= 5000)
xl = "[白银]";
else if (c.getCombat() > 5000 && c.getCombat() <= 10000)
xl = "[黄金]";
else if (c.getCombat() > 10000 && c.getCombat() <= 50000)
xl = "[铂金]";
else if (c.getCombat() > 50000 && c.getCombat() <= 100000)
xl = "[钻石]";
else if (c.getCombat() > 100000 && c.getCombat() <= 500000)
xl = "[大师]";
else if (c.getCombat() > 500000 && c.getCombat() <= 600000)
xl = "[☆王者☆]";
else if (c.getCombat() > 600000 && c.getCombat() <= 1000000)
xl = "[☆超级王者☆]";
else if (c.getCombat() > 1100000)
xl = "[☆宇宙王者☆]";
// if (c.getCombat() <= 1000)
// xl = "[青铜]";
// else if (c.getCombat() > 1000 && c.getCombat() <= 5000)
// xl = "[白银]";
// else if (c.getCombat() > 5000 && c.getCombat() <= 10000)
// xl = "[黄金]";
// else if (c.getCombat() > 10000 && c.getCombat() <= 50000)
// xl = "[铂金]";
// else if (c.getCombat() > 50000 && c.getCombat() <= 100000)
// xl = "[钻石]";
// else if (c.getCombat() > 100000 && c.getCombat() <= 500000)
// xl = "[大师]";
// else if (c.getCombat() > 500000 && c.getCombat() <= 600000)
// xl = "[☆王者☆]";
// else if (c.getCombat() > 600000 && c.getCombat() <= 1000000)
// xl = "[☆超级王者☆]";
// else if (c.getCombat() > 1100000)
// xl = "[☆宇宙王者☆]";
String name="";
if (Start.zlkg == 1) {
int 转生次数 = c.getAccountidLogByCid("飞升");

View File

@ -482,6 +482,7 @@ public class PacketHelper {
mplew.writeUTF8(equip.getdd());
mplew.writeUTF8(equip.getdb());
mplew.writeUTF8(equip.getqg());
mplew.writeUTF8(equip.getqgjs());
} else {
mplew.writeShort((int) item.getQuantity());
mplew.writeMapleAsciiString(item.getOwner());