Skip to content

Commit

Permalink
Merge branch 'refactor/db' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/client/MapleCharacter.java
#	src/main/java/client/SkillFactory.java
#	src/main/java/client/inventory/PetDataFactory.java
#	src/main/java/gui/Icon.png
#	src/main/java/gui/ZlhssMS.java
#	src/main/java/handling/login/LoginInformationProvider.java
#	src/main/java/handling/world/guild/MapleGuildAlliance.java
#	src/main/java/provider/MapleDataProviderFactory.java
#	src/main/java/server/CashItemFactory.java
#	src/main/java/server/CashItemFactoryA.java
#	src/main/java/server/ItemMakerFactory.java
#	src/main/java/server/MapleCarnivalFactory.java
#	src/main/java/server/MapleItemInformationProvider.java
#	src/main/java/server/life/MapleLifeFactory.java
#	src/main/java/server/life/MobAttackInfoFactory.java
#	src/main/java/server/life/MobSkillFactory.java
#	src/main/java/server/maps/MapleMapFactory.java
#	src/main/java/server/maps/MapleReactorFactory.java
#	src/main/java/tools/CashShopDumper.java
#	src/main/java/tools/FixShopItemsPrice.java
#	src/main/java/tools/wztosql/DumpItems.java
#	src/main/java/tools/wztosql/DumpMobSkills.java
#	src/main/java/tools/wztosql/DumpNpcNames.java
#	src/main/java/tools/wztosql/DumpOxQuizData.java
#	src/main/java/tools/wztosql/DumpQuests.java
#	src/main/java/tools/wztosql/MonsterDropCreator.java
#	src/main/resources/Icon.png
#	src/main/resources/gui/Icon.png
#	启动服务端-GUI.bat
#	日志/logs/Log_Script_脚本异常.rtf
  • Loading branch information
mrzhqiang committed Sep 17, 2021
2 parents 9f9870e + 97783e1 commit b085f28
Show file tree
Hide file tree
Showing 3,352 changed files with 6,916,578 additions and 16,889 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
out
target
build

/logs
108 changes: 102 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>

<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>

<mysql-connector-java.version>8.0.25</mysql-connector-java.version>
<helper.version>2021.1.3</helper.version>
<jsoup.version>1.13.1</jsoup.version>
<ebean.version>12.11.3</ebean.version>
<guice.version>5.0.1</guice.version>
<slf4j-api.version>1.7.25</slf4j-api.version>
<logback.version>1.2.3</logback.version>

<junit.version>4.13</junit.version>
</properties>

<dependencies>
Expand All @@ -24,26 +37,109 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.25</version>
<version>${mysql-connector-java.version}</version>
</dependency>
<dependency>
<groupId>com.github.mrzhqiang.helper</groupId>
<artifactId>helper</artifactId>
<version>${helper.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>${jsoup.version}</version>
</dependency>
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean</artifactId>
<version>${ebean.version}</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<version>${slf4j-api.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-core -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.25</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-test</artifactId>
<version>${ebean.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<repositories>
<repository>
<id>aliyun-nexus</id>
<url>https://maven.aliyun.com/repository/public</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<build>
<finalName>ms079</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<version>${maven-jar-plugin.version}</version>
</plugin>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>2.19</version>
<extensions>true</extensions>
<configuration>
<tiles>
<!-- other tiles ... -->
<tile>io.ebean.tile:enhancement:${ebean.version}</tile>
</tiles>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.ebean</groupId>
<artifactId>querybean-generator</artifactId>
<version>${ebean.version}</version>
</path>
<!-- other annotation processors -->
</annotationProcessorPaths>
</configuration>
</plugin>

<plugin>
Expand Down
79 changes: 43 additions & 36 deletions src/main/java/KinMS/PvP/MaplePvp.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
import client.PlayerStats;
import client.Skill;
import client.SkillFactory;
import com.github.mrzhqiang.maplestory.wz.element.data.Vector;
import handling.channel.ChannelServer;
import handling.channel.handler.AttackInfo;
import java.awt.Point;
import java.awt.Rectangle;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import server.MapleStatEffect;
import server.Randomizer;
import server.life.MapleLifeFactory;
Expand All @@ -20,6 +24,8 @@

public class MaplePvp {

private static final Logger LOGGER = LoggerFactory.getLogger(MaplePvp.class);

private static PvpAttackInfo parsePvpAttack(AttackInfo attack, MapleCharacter player, MapleStatEffect effect) {
PvpAttackInfo ret = new PvpAttackInfo();
double maxdamage = player.getLevel() + 100.0D;
Expand All @@ -32,61 +38,62 @@ private static PvpAttackInfo parsePvpAttack(AttackInfo attack, MapleCharacter pl
ret.attackCount = 1;
int pvpRange = attack.isCloseRangeAttack ? 35 : 70;
ret.facingLeft = (attack.animation < 0);
System.out.println("PVP伤害检查-A");
LOGGER.debug("PVP伤害检查-A");
if ((skillId != 0) && (effect != null)) {
System.out.println("PVP伤害检查-C");
LOGGER.debug("PVP伤害检查-C");
ret.skillDamage = (effect.getDamage());
ret.mobCount = Math.max(1, effect.getMobCount());
ret.attackCount = Math.max(effect.getBulletCount(), effect.getAttackCount());
ret.box = effect.calculateBoundingBox(player.getTruePosition(), ret.facingLeft, pvpRange);
System.out.println("PVP伤害检查-D");
LOGGER.debug("PVP伤害检查-D");
} else {
System.out.println("PVP伤害检查-E");
LOGGER.debug("PVP伤害检查-E");
ret.box = calculateBoundingBox(player.getTruePosition(), ret.facingLeft, pvpRange);
System.out.println("PVP伤害检查-F");
LOGGER.debug("PVP伤害检查-F");
}
System.out.println("PVP伤害检查-G");
LOGGER.debug("PVP伤害检查-G");
boolean mirror = (player.getBuffedValue(MapleBuffStat.SHADOWPARTNER) != null);
ret.attackCount *= (mirror ? 2 : 1);
maxdamage *= ret.skillDamage / 100.0D;
ret.maxDamage = (maxdamage * ret.attackCount);
System.out.println("PVP伤害检查-H");
LOGGER.debug("PVP伤害检查-H");
if (player.isGM()) {
player.dropMessage(6, "Pvp伤害解析 - 最大攻击: " + maxdamage + " 数量: " + ret.mobCount + " 次数: " + ret.attackCount + " 爆击: " + ret.critRate + " 无视: " + ret.ignoreDef + " 技能伤害: " + ret.skillDamage);
}
return ret;
}

private static Rectangle calculateBoundingBox(Point posFrom, boolean facingLeft, int range) {
Point lt = new Point(-70, -30);
Point rb = new Point(-10, 0);
Point myrb;
Point mylt;
private static Rectangle calculateBoundingBox(Vector posFrom, boolean facingLeft, int range) {
Vector lt = Vector.of(-70, -30);
Vector rb = Vector.of(-10, 0);
Vector myrb;
Vector mylt;
if (facingLeft) {
mylt = new Point(lt.x + posFrom.x - range, lt.y + posFrom.y);
myrb = new Point(rb.x + posFrom.x, rb.y + posFrom.y);
mylt = lt.plus(posFrom).minusX(range);
myrb = rb.plus(posFrom);
} else {
myrb = new Point(lt.x * -1 + posFrom.x + range, rb.y + posFrom.y);
mylt = new Point(rb.x * -1 + posFrom.x, lt.y + posFrom.y);
myrb = Vector.of(lt.x * -1 + posFrom.x + range, rb.y + posFrom.y);
mylt = Vector.of(rb.x * -1 + posFrom.x, lt.y + posFrom.y);
}
return new Rectangle(mylt.x, mylt.y, myrb.x - mylt.x, myrb.y - mylt.y);
}

public static boolean inArea(MapleCharacter chr) {
for (Rectangle rect : chr.getMap().getAreas()) {
if (rect.contains(chr.getTruePosition())) {
Vector position = chr.getTruePosition();
if (rect.contains(position.x, position.y)) {
return true;
}
}
return false;
}

private static void monsterBomb(MapleCharacter player, MapleCharacter attacked, MapleMap map, PvpAttackInfo attack) {
System.out.println("PVP伤害检查-L");
LOGGER.debug("PVP伤害检查-L");
if ((player == null) || (attacked == null) || (map == null)) {
return;
}
System.out.println("PVP伤害检查-M");
LOGGER.debug("PVP伤害检查-M");
double maxDamage = attack.maxDamage;
boolean isCritDamage = false;

Expand All @@ -104,12 +111,12 @@ private static void monsterBomb(MapleCharacter player, MapleCharacter attacked,
maxDamage /= 1.15D;
}

System.out.println("PVP伤害检查-N");
LOGGER.debug("PVP伤害检查-N");
if (Randomizer.nextInt(100) < attack.critRate) {
maxDamage *= 1.5D;
isCritDamage = true;
}
System.out.println("PVP伤害检查-O");
LOGGER.debug("PVP伤害检查-O");
int attackedDamage = (int) Math.floor(Math.random() * ((int) maxDamage * 0.35D) + (int) maxDamage * 0.65D);
int MAX_PVP_DAMAGE = (int) (player.getStat().getLimitBreak(player) / 100.0D);
int MIN_PVP_DAMAGE = 100;
Expand All @@ -119,14 +126,14 @@ private static void monsterBomb(MapleCharacter player, MapleCharacter attacked,
if (attackedDamage < MIN_PVP_DAMAGE) {
attackedDamage = MIN_PVP_DAMAGE;
}
System.out.println("PVP伤害检查-P");
LOGGER.debug("PVP伤害检查-P");
int hploss = attackedDamage;
int mploss = 0;
System.out.println("PVP伤害检查-Q:" + attackedDamage);
LOGGER.debug("PVP伤害检查-Q:" + attackedDamage);
if (attackedDamage > 0) {
System.out.println("PVP伤害检查-R");
LOGGER.debug("PVP伤害检查-R");
if (attacked.getBuffedValue(MapleBuffStat.MAGIC_GUARD) != null) {
System.out.println("PVP伤害检查-S");
LOGGER.debug("PVP伤害检查-S");
mploss = (int) (attackedDamage * (attacked.getBuffedValue(MapleBuffStat.MAGIC_GUARD).doubleValue() / 100.0D));
hploss -= mploss;
if (attacked.getBuffedValue(MapleBuffStat.INFINITY) != null) {
Expand All @@ -136,29 +143,29 @@ private static void monsterBomb(MapleCharacter player, MapleCharacter attacked,
hploss -= mploss;
}
attacked.addMPHP(-hploss, -mploss);
System.out.println("PVP伤害检查-T");
LOGGER.debug("PVP伤害检查-T");
} else {
System.out.println("PVP伤害检查-U");
LOGGER.debug("PVP伤害检查-U");
attacked.addHP(-hploss);
System.out.println("PVP伤害检查-V");
LOGGER.debug("PVP伤害检查-V");
}
}
System.out.println("PVP伤害检查-W");
LOGGER.debug("PVP伤害检查-W");
MapleMonster pvpMob = MapleLifeFactory.getMonster(9400711);
map.spawnMonsterOnGroundBelow(pvpMob, attacked.getPosition());
map.broadcastMessage(MaplePacketCreator.PVPdamagePlayer(attacked.getId(), 2, pvpMob.getId(), hploss));
System.out.println("PVP伤害检查-X");
LOGGER.debug("PVP伤害检查-X");
if (isCritDamage) {
player.dropMessage(6, "你对玩家 " + attacked.getName() + " 造成了 " + hploss + " 点爆击伤害! 对方血量: " + attacked.getStat().getHp() + "/" + attacked.getStat().getCurrentMaxHp());
attacked.dropMessage(6, "玩家 " + player.getName() + " 对你造成了 " + hploss + " 点爆击伤害!");
} else {
player.dropTopMsg("你对玩家 " + attacked.getName() + " 造成了 " + hploss + " 点伤害! 对方血量: " + attacked.getStat().getHp() + "/" + attacked.getStat().getCurrentMaxHp());
attacked.dropTopMsg("玩家 " + player.getName() + " 对你造成了 " + hploss + " 点伤害!");
}
System.out.println("PVP伤害检查-Y");
LOGGER.debug("PVP伤害检查-Y");
map.killMonster(pvpMob, player, false, false, (byte) 1);

System.out.println("PVP伤害检查-Z");
LOGGER.debug("PVP伤害检查-Z");
if ((attacked.getStat().getHp() <= 0) && (!attacked.isAlive())) {
int expReward = attacked.getLevel() * 10 * (attacked.getLevel() / player.getLevel());
int gpReward = (int) Math.floor(Math.random() * 10.0D + 10.0D);
Expand All @@ -178,15 +185,15 @@ private static void monsterBomb(MapleCharacter player, MapleCharacter attacked,
}

public static synchronized void doPvP(MapleCharacter player, MapleMap map, AttackInfo attack, MapleStatEffect effect) {
System.out.println("PVP伤害检查");
LOGGER.debug("PVP伤害检查");
PvpAttackInfo pvpAttack = parsePvpAttack(attack, player, effect);
System.out.println("PVP伤害检查-I");
LOGGER.debug("PVP伤害检查-I");
int mobCount = 0;
for (MapleCharacter attacked : player.getMap().getCharactersIntersect(pvpAttack.box)) {
System.out.println("PVP伤害检查-J");
LOGGER.debug("PVP伤害检查-J");
if ((attacked.getId() != player.getId()) && (attacked.isAlive()) && (!attacked.isHidden()) && (mobCount < pvpAttack.mobCount)) {
mobCount++;
System.out.println("PVP伤害检查-K");
LOGGER.debug("PVP伤害检查-K");
monsterBomb(player, attacked, map, pvpAttack);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/KinMS/db/CherryMSLotteryImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public int getTouNumbyType(int type) {
a = ps.executeUpdate();
System.out.println(ps.executeUpdate());
LOGGER.debug(ps.executeUpdate());
ps.close();
return a;
Expand Down
Loading

0 comments on commit b085f28

Please sign in to comment.