forked from MagicBane/Server
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55fea8a20b | ||
|
|
19c6baf927 | ||
|
|
4130a767dc | ||
|
|
4f60b228d5 | ||
|
|
69aa91d403 |
+8203
File diff suppressed because one or more lines are too long
+6
-20
@@ -139,8 +139,8 @@ public class Enum {
|
||||
HALFGIANTMALE(2010, MonsterType.HalfGiant, RunSpeed.STANDARD, CharacterSex.MALE, 1.15f),
|
||||
HUMANMALE(2011, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||
HUMANFEMALE(2012, MonsterType.Human, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.MALE, 1.1f),
|
||||
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.IREKEI, CharacterSex.FEMALE, 1.1f),
|
||||
IREKEIMALE(2013, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.MALE, 1.1f),
|
||||
IREKEIFEMALE(2014, MonsterType.Irekei, RunSpeed.STANDARD, CharacterSex.FEMALE, 1.1f),
|
||||
SHADEMALE(2015, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.MALE, 1),
|
||||
SHADEFEMALE(2016, MonsterType.Shade, RunSpeed.STANDARD, CharacterSex.FEMALE, 1),
|
||||
MINOMALE(2017, MonsterType.Minotaur, RunSpeed.MINOTAUR, CharacterSex.MALE, 1.3f),
|
||||
@@ -172,8 +172,6 @@ public class Enum {
|
||||
}
|
||||
|
||||
public static RaceType getRaceTypebyRuneID(int runeID) {
|
||||
if(runeID == 1999)
|
||||
return _raceTypeByID.get(2017);
|
||||
return _raceTypeByID.get(runeID);
|
||||
}
|
||||
|
||||
@@ -210,8 +208,7 @@ public class Enum {
|
||||
SENTINEL(0, 0, 0, 0, 0, 0, 0),
|
||||
STANDARD(6.1900001f, 13.97f, 4.2199998f, 13.97f, 6.3299999f, 18.379999f, 6.5f),
|
||||
CENTAUR(6.1900001f, 16.940001f, 5.5500002f, 16.940001f, 6.3299999f, 18.379999f, 6.5f),
|
||||
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f),
|
||||
IREKEI(6.35f, 15.25f, 4.2199998f, 14.5f, 6.3299999f, 18.379999f, 6.5f);
|
||||
MINOTAUR(6.6300001f, 15.95f, 4.2199998f, 15.95f, 6.3299999f, 18.379999f, 6.5f);
|
||||
|
||||
private float walkStandard;
|
||||
private float walkCombat;
|
||||
@@ -960,17 +957,6 @@ public class Enum {
|
||||
Wizardry;
|
||||
|
||||
public static SourceType GetSourceType(String modName) {
|
||||
switch(modName){
|
||||
case "Slashing":
|
||||
modName = "Slash";
|
||||
break;
|
||||
case "Crushing":
|
||||
modName = "Crush";
|
||||
break;
|
||||
case "Piercing":
|
||||
modName = "Pierce";
|
||||
break;
|
||||
}
|
||||
SourceType returnMod;
|
||||
if (modName.isEmpty())
|
||||
return SourceType.None;
|
||||
@@ -2320,9 +2306,9 @@ public class Enum {
|
||||
|
||||
public enum CityBoundsType {
|
||||
|
||||
GRID(544),
|
||||
ZONE(672),
|
||||
PLACEMENT(673);
|
||||
GRID(640),
|
||||
ZONE(875),
|
||||
PLACEMENT(876);
|
||||
|
||||
public final float extents;
|
||||
|
||||
|
||||
@@ -521,12 +521,9 @@ public enum InterestManager implements Runnable {
|
||||
|
||||
// Update loaded upbjects lists
|
||||
|
||||
player.isBoxed = PlayerCharacter.checkIfBoxed(player);
|
||||
player.setDirtyLoad(true);
|
||||
updateStaticList(player, origin);
|
||||
updateMobileList(player, origin);
|
||||
if(player.level < 10)
|
||||
player.setLevel((short) 10);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -95,26 +95,7 @@ public class dbCityHandler extends dbHandlerBase {
|
||||
|
||||
return objectList;
|
||||
}
|
||||
public Integer GET_CAPITAL_CITY_COUNT() {
|
||||
|
||||
int cityCount = 0;
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM obj_city;")) {
|
||||
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
while(rs.next()){
|
||||
if(rs.getInt("isNpc") == 0)
|
||||
if(DbManager.BuildingQueries.GET_BUILDINGBYUUID(rs.getInt("treeOfLifeUUID")).getRank() == 8)
|
||||
cityCount++;
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
|
||||
return cityCount;
|
||||
}
|
||||
public ArrayList<City> GET_CITIES_BY_ZONE(final int objectUUID) {
|
||||
|
||||
ArrayList<City> cityList = new ArrayList<>();
|
||||
|
||||
@@ -32,6 +32,7 @@ public abstract class dbHandlerBase {
|
||||
try {
|
||||
if (rs.next()) {
|
||||
abstractGameObject = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||
|
||||
DbManager.addToCache(abstractGameObject);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -60,17 +61,8 @@ public abstract class dbHandlerBase {
|
||||
if (DbManager.inCache(localObjectType, id)) {
|
||||
objectList.add((T) DbManager.getFromCache(localObjectType, id));
|
||||
} else {
|
||||
try{
|
||||
if(rs.getInt("mineLiveHour") == 1)
|
||||
continue;
|
||||
}catch(Exception e){
|
||||
//not a mine
|
||||
}
|
||||
AbstractGameObject toAdd = localClass.getConstructor(ResultSet.class).newInstance(rs);
|
||||
DbManager.addToCache(toAdd);
|
||||
if(toAdd.getObjectType().equals(GameObjectType.Zone) && rs.getInt("canLoad") == 0){
|
||||
continue;
|
||||
}
|
||||
objectList.add((T) toAdd);
|
||||
|
||||
if (toAdd != null && toAdd instanceof AbstractWorldObject)
|
||||
|
||||
@@ -496,18 +496,4 @@ public class dbItemHandler extends dbHandlerBase {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean UPDATE_NUM_ITEMS(final Item item, int newValue) {
|
||||
if (item.getItemBase().getType().equals(ItemType.GOLD))
|
||||
return false;
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("UPDATE `obj_item` SET `item_numberOfItems`=? WHERE `UID`=?")) {
|
||||
preparedStatement.setInt(1, newValue);
|
||||
preparedStatement.setLong(2, item.getObjectUUID());
|
||||
return (preparedStatement.executeUpdate() > 0);
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import engine.Enum.GameObjectType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
@@ -32,6 +31,7 @@ public class AddNPCCmd extends AbstractDevCmd {
|
||||
int contractID;
|
||||
String name = "";
|
||||
int level = 0;
|
||||
|
||||
if (words.length < 2) {
|
||||
this.sendUsage(pc);
|
||||
return;
|
||||
@@ -39,54 +39,59 @@ public class AddNPCCmd extends AbstractDevCmd {
|
||||
try {
|
||||
contractID = Integer.parseInt(words[0]);
|
||||
level = Integer.parseInt(words[1]);
|
||||
|
||||
for (int i = 2; i < words.length; i++) {
|
||||
name += words[i];
|
||||
if (i + 1 < words.length)
|
||||
name += "";
|
||||
}
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
throwbackError(pc,
|
||||
"Failed to parse supplied contractID or level to an Integer.");
|
||||
return; // NaN
|
||||
}
|
||||
|
||||
Contract contract = DbManager.ContractQueries.GET_CONTRACT(contractID);
|
||||
|
||||
if (contract == null || level < 1 || level > 75) {
|
||||
throwbackError(pc,
|
||||
"Invalid addNPC Command. Need contract ID, and level");
|
||||
return; // NaN
|
||||
}
|
||||
|
||||
// Pick a random name
|
||||
if (name.isEmpty())
|
||||
name = NPCManager.getPirateName(contract.getMobbaseID());
|
||||
|
||||
Zone zone = ZoneManager.findSmallestZone(pc.getLoc());
|
||||
|
||||
if (zone == null) {
|
||||
throwbackError(pc, "Failed to find zone to place npc in.");
|
||||
return;
|
||||
}
|
||||
Building building = null;
|
||||
|
||||
if (target != null)
|
||||
if (target.getObjectType() == GameObjectType.Building) {
|
||||
building = (Building)target;
|
||||
Building parentBuilding = (Building) target;
|
||||
BuildingManager.addHirelingForWorld(parentBuilding, pc, parentBuilding.getLoc(), parentBuilding.getParentZone(), contract, level);
|
||||
return;
|
||||
}
|
||||
NPC created;
|
||||
Guild guild = null;
|
||||
Vector3fImmutable loc;
|
||||
if(building != null){
|
||||
guild = building.getGuild();
|
||||
loc = building.loc;
|
||||
} else{
|
||||
loc = pc.loc;
|
||||
}
|
||||
created = NPC.createNPC(name, contractID, loc, guild, zone, (short)level, building);
|
||||
created.bindLoc = loc;
|
||||
if(building != null) {
|
||||
created.buildingUUID = building.getObjectUUID();
|
||||
created.building = building;
|
||||
NPCManager.slotCharacterInBuilding(created);
|
||||
|
||||
NPC npc = NPC.createNPC(name, contractID,
|
||||
pc.getLoc(), null, zone, (short) level, null);
|
||||
|
||||
if (npc != null) {
|
||||
WorldGrid.addObject(npc, pc);
|
||||
ChatManager.chatSayInfo(pc,
|
||||
"NPC with ID " + npc.getDBID() + " added");
|
||||
this.setResult(String.valueOf(npc.getDBID()));
|
||||
} else {
|
||||
throwbackError(pc, "Failed to create npc of contract type "
|
||||
+ contractID);
|
||||
Logger.error(
|
||||
"Failed to create npc of contract type " + contractID);
|
||||
}
|
||||
created.setLoc(created.bindLoc);
|
||||
created.updateDatabase();
|
||||
throwbackInfo(pc, "Created NPC with UUID: " + created.getObjectUUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.devcmd.cmds;
|
||||
|
||||
import engine.devcmd.AbstractDevCmd;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
/**
|
||||
* ./hotzone <- display the current hotzone & time remaining
|
||||
* ./hotzone random <- change hotzone to random new zone
|
||||
*/
|
||||
|
||||
public class HotzoneCmd extends AbstractDevCmd {
|
||||
|
||||
public HotzoneCmd() {
|
||||
super("hotzone");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void _doCmd(PlayerCharacter playerCharacter, String[] words,
|
||||
AbstractGameObject target) {
|
||||
|
||||
StringBuilder data = new StringBuilder();
|
||||
String outString;
|
||||
|
||||
for (String s : words) {
|
||||
data.append(s);
|
||||
data.append(' ');
|
||||
}
|
||||
|
||||
String input = data.toString().trim();
|
||||
|
||||
if (input.length() == 0) {
|
||||
outString = "Current hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
|
||||
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
||||
throwbackInfo(playerCharacter, outString);
|
||||
return;
|
||||
}
|
||||
|
||||
if (input.equalsIgnoreCase("random")) {
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
outString = "New hotZone: " + ZoneManager.hotZone.getName() + "\r\n";
|
||||
outString += "Available hotZones: " + ZoneManager.availableHotZones();
|
||||
throwbackInfo(playerCharacter, outString);
|
||||
return;
|
||||
}
|
||||
|
||||
if (input.equalsIgnoreCase("reset")) {
|
||||
ZoneManager.resetHotZones();
|
||||
throwbackInfo(playerCharacter, "Available hotZones: " + ZoneManager.availableHotZones());
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getHelpString() {
|
||||
return "Use no arguments to see the current hotzone or \"random\" to change it randomly.";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String _getUsageString() {
|
||||
return "'./hotzone [random]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -337,8 +337,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "Swimming : " + targetPC.isSwimming();
|
||||
output += newline;
|
||||
output += "isMoving : " + targetPC.isMoving();
|
||||
output += newline;
|
||||
output += "Zerg Multiplier : " + targetPC.ZergMultiplier;
|
||||
|
||||
break;
|
||||
|
||||
case NPC:
|
||||
|
||||
@@ -16,7 +16,6 @@ import engine.objects.AbstractGameObject;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.workthreads.HalfHourlyJobThread;
|
||||
import engine.workthreads.HourlyJobThread;
|
||||
|
||||
/**
|
||||
@@ -42,10 +41,10 @@ public class MineActiveCmd extends AbstractDevCmd {
|
||||
String trigger = args[0];
|
||||
switch (trigger) {
|
||||
case "true":
|
||||
HalfHourlyJobThread.mineWindowOpen(mine);
|
||||
HourlyJobThread.mineWindowOpen(mine);
|
||||
break;
|
||||
case "false":
|
||||
HalfHourlyJobThread.mineWindowClose(mine);
|
||||
HourlyJobThread.mineWindowClose(mine);
|
||||
break;
|
||||
default:
|
||||
this.sendUsage(pcSender);
|
||||
|
||||
@@ -10,8 +10,6 @@ import java.util.ArrayList;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
|
||||
public int simCount = 250;
|
||||
public SimulateBootyCmd() {
|
||||
super("bootysim");
|
||||
}
|
||||
@@ -27,7 +25,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
|
||||
String output;
|
||||
|
||||
output = "Booty Simulation: Rolls:" + simCount + newline;
|
||||
output = "Booty Simulation:" + newline;
|
||||
|
||||
Mob mob = (Mob) target;
|
||||
output += "Name: " + mob.getName() + newline;
|
||||
@@ -53,7 +51,7 @@ public class SimulateBootyCmd extends AbstractDevCmd {
|
||||
int failures = 0;
|
||||
int goldAmount = 0;
|
||||
|
||||
for (int i = 0; i < simCount; ++i) {
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
|
||||
try {
|
||||
mob.loadInventory();
|
||||
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
# Account Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbAccountHandler` class. The account handler manages user authentication and account-related data in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbAccountHandler.java`
|
||||
**Class:** `dbAccountHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Account Table
|
||||
- **Table Name:** `obj_account`
|
||||
- **Description:** Core account information including login credentials, status, and account details
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- username
|
||||
- password
|
||||
- email
|
||||
- accountStatus
|
||||
- lastLogin
|
||||
- creationDate
|
||||
- isBanned
|
||||
- banReason
|
||||
- isDeleted
|
||||
- deletedDate
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_account_wipe` | Account wipe history records | AccountID → obj_account.UID |
|
||||
| `dyn_login_history` | Login attempt and session history | AccountID → obj_account.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Account by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_account` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbAccountHandler.java`, Line ~60
|
||||
|
||||
### Get Account by Username
|
||||
```sql
|
||||
SELECT * FROM `obj_account` WHERE `username`=?
|
||||
```
|
||||
**File:** `dbAccountHandler.java`, Line ~85
|
||||
|
||||
### Create New Account
|
||||
```sql
|
||||
INSERT INTO `obj_account` (`username`, `password`, `email`, `accountStatus`, `creationDate`) VALUES (?, ?, ?, ?, ?)
|
||||
```
|
||||
**File:** `dbAccountHandler.java`, Line ~105
|
||||
|
||||
### Update Account Status
|
||||
```sql
|
||||
UPDATE `obj_account` SET `accountStatus`=?, `lastLogin`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbAccountHandler.java`, Line ~132
|
||||
|
||||
### Check Username Availability
|
||||
```sql
|
||||
SELECT `username` FROM `obj_account` WHERE `username`=?
|
||||
```
|
||||
**File:** `dbAccountHandler.java`, Line ~158
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Account to Character:** One-to-many (via `obj_character.accountID` field)
|
||||
2. **Account to Account Wipe History:** One-to-many (via `obj_account_wipe.AccountID`)
|
||||
3. **Account to Login History:** One-to-many (via `dyn_login_history.AccountID`)
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `username` | `obj_account.username` | Unique account username |
|
||||
| `password` | `obj_account.password` | Encrypted password |
|
||||
| `email` | `obj_account.email` | Account email address |
|
||||
| `accountStatus` | `obj_account.accountStatus` | Current account status |
|
||||
| `lastLogin` | `obj_account.lastLogin` | Timestamp of last login |
|
||||
| `creationDate` | `obj_account.creationDate` | Account creation date |
|
||||
| `isBanned` | `obj_account.isBanned` | Boolean flag for banned status |
|
||||
| `banReason` | `obj_account.banReason` | Reason for ban |
|
||||
| `isDeleted` | `obj_account.isDeleted` | Boolean flag for deleted status |
|
||||
| `deletedDate` | `obj_account.deletedDate` | Timestamp of deletion |
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
# dbBaneHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbBaneHandler` class. The bane handler manages special objects in cities that have specific properties and behaviors, including their ownership, location, and time-based effects.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbBaneHandler.java`
|
||||
**Class:** `dbBaneHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Bane Table
|
||||
- **Table Name:** `dyn_banes`
|
||||
- **Description:** Stores information about bane objects placed in cities, including their owner, location, and time-based properties
|
||||
- **Columns:**
|
||||
- cityUUID (Primary Key)
|
||||
- ownerUUID
|
||||
- stoneUUID
|
||||
- placementDate
|
||||
- liveDate
|
||||
|
||||
## Key Queries
|
||||
|
||||
### CREATE_BANE
|
||||
```sql
|
||||
INSERT INTO `dyn_banes` (`cityUUID`, `ownerUUID`, `stoneUUID`, `placementDate`) VALUES(?,?,?,?)
|
||||
```
|
||||
**File:** `dbBaneHandler.java`, Line ~17
|
||||
|
||||
### LOAD_BANE
|
||||
```sql
|
||||
SELECT * FROM `dyn_banes` WHERE `dyn_banes`.`cityUUID` = ?
|
||||
```
|
||||
**File:** `dbBaneHandler.java`, Line ~30
|
||||
|
||||
### SET_BANE_TIME
|
||||
```sql
|
||||
UPDATE `dyn_banes` SET `liveDate`=? WHERE `cityUUID`=?
|
||||
```
|
||||
**File:** `dbBaneHandler.java`, Line ~45
|
||||
|
||||
### REMOVE_BANE
|
||||
```sql
|
||||
DELETE FROM `dyn_banes` WHERE `cityUUID` = ?
|
||||
```
|
||||
**File:** `dbBaneHandler.java`, Line ~57
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Bane to City:** One-to-one relationship via cityUUID (primary key) referencing obj_city.UID
|
||||
2. **Bane to Owner:** Many-to-one relationship via ownerUUID referencing obj_character.UID
|
||||
3. **Bane to Stone:** Many-to-one relationship via stoneUUID referencing obj_building.UID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `cityUUID` | `dyn_banes.cityUUID` | Unique identifier for the city where bane is placed |
|
||||
| `ownerUUID` | `dyn_banes.ownerUUID` | Character UID of the owner of this bane |
|
||||
| `stoneUUID` | `dyn_banes.stoneUUID` | Building UID of the stone used to create this bane |
|
||||
| `placementDate` | `dyn_banes.placementDate` | Timestamp when bane was placed |
|
||||
| `liveDate` | `dyn_banes.liveDate` | Timestamp for when bane becomes active |
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
# dbBaseClassHandler Documentation
|
||||
|
||||
## Overview
|
||||
The `dbBaseClassHandler` is responsible for managing base class data in the Magicbane database. Base classes represent fundamental character classifications that define core attributes and capabilities. This handler manages retrieval of base class information, including fetching specific base classes by ID, retrieving base classes associated with a particular race, and getting all available base classes.
|
||||
|
||||
## Database Table Structure
|
||||
|
||||
### Table: `static_rune_baseclass`
|
||||
|
||||
| Column Name | Data Type | Nullable | Key | Description |
|
||||
|-------------|-----------|----------|-----|-------------|
|
||||
| ID | int unsigned | NO | PRIMARY | Unique identifier for the base class |
|
||||
| name | varchar(45) | NO | | Name of the base class |
|
||||
| description | varchar(200) | NO | | Description of the base class |
|
||||
| strMod | tinyint | NO | | Strength modifier for this base class |
|
||||
| dexMod | tinyint | NO | | Dexterity modifier for this base class |
|
||||
| conMod | tinyint | NO | | Constitution modifier for this base class |
|
||||
| intMod | tinyint | NO | | Intelligence modifier for this base class |
|
||||
| wisMod | tinyint | NO | | Wisdom modifier for this base class |
|
||||
| chaMod | tinyint | NO | | Charisma modifier for this base class |
|
||||
| healthMod | tinyint | NO | | Health modifier for this base class |
|
||||
| manaMod | tinyint | NO | | Mana modifier for this base class |
|
||||
| staminaMod | tinyint | NO | | Stamina modifier for this base class |
|
||||
|
||||
### Table: `static_rune_racebaseclass`
|
||||
|
||||
| Column Name | Data Type | Nullable | Key | Description |
|
||||
|-------------|-----------|----------|-----|-------------|
|
||||
| ID | int unsigned | NO | PRIMARY | Unique identifier for the relationship |
|
||||
| RaceID | int unsigned | NO | FOREIGN KEY | Reference to race in `static_rune_race` |
|
||||
| BaseClassID | int unsigned | NO | FOREIGN KEY | Reference to base class in `static_rune_baseclass` |
|
||||
|
||||
## Java Field to Database Column Mapping
|
||||
|
||||
| Java Field | Database Column | Type | Description |
|
||||
|------------|-----------------|------|-------------|
|
||||
| baseClass.getId() | ID | int unsigned | Base class unique identifier |
|
||||
| baseClass.getName() | name | varchar(45) | Base class name |
|
||||
| baseClass.getDescription() | description | varchar(200) | Base class description |
|
||||
| baseClass.getStrMod() | strMod | tinyint | Strength modifier |
|
||||
| baseClass.getDexMod() | dexMod | tinyint | Dexterity modifier |
|
||||
| baseClass.getConMod() | conMod | tinyint | Constitution modifier |
|
||||
| baseClass.getIntMod() | intMod | tinyint | Intelligence modifier |
|
||||
| baseClass.getWisMod() | wisMod | tinyint | Wisdom modifier |
|
||||
| baseClass.getChaMod() | chaMod | tinyint | Charisma modifier |
|
||||
| baseClass.getHealthMod() | healthMod | tinyint | Health modifier |
|
||||
| baseClass.getManaMod() | manaMod | tinyint | Mana modifier |
|
||||
| baseClass.getStaminaMod() | staminaMod | tinyint | Stamina modifier |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### GET_BASE_CLASS
|
||||
- **Query**: `SELECT * FROM \`static_rune_baseclass\` WHERE \`ID\`=?`
|
||||
- **Parameter**: id (base class ID)
|
||||
- **Note**: Fixed from original bug - was selecting from obj_account table instead of static_rune_baseclass
|
||||
|
||||
### GET_BASECLASS_FOR_RACE
|
||||
- **Query**: `SELECT b.* FROM \`static_rune_baseclass\` b, \`static_rune_racebaseclass\` r WHERE b.\`ID\` = r.\`BaseClassID\` && r.\`RaceID\` = ?`
|
||||
- **Parameter**: id (race ID)
|
||||
|
||||
### GET_ALL_BASE_CLASSES
|
||||
- **Query**: `SELECT * FROM \`static_rune_baseclass\`;`
|
||||
- **Note**: Returns all base classes from the static table
|
||||
|
||||
## Relationships
|
||||
|
||||
### Foreign Key Relationships
|
||||
- `static_rune_racebaseclass.BaseClassID` references `static_rune_baseclass.ID`
|
||||
- `static_rune_racebaseclass.RaceID` references `static_rune_race.ID`
|
||||
|
||||
### Associated Objects
|
||||
- **BaseClass**: Core character classification data
|
||||
- **Race**: Associated races that can use specific base classes (via `static_rune_racebaseclass`)
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
# dbBlueprintHandler Documentation
|
||||
|
||||
## Overview
|
||||
The `dbBlueprintHandler` is responsible for managing building blueprint data and door number mappings in the Magicbane database. This handler loads blueprint information used for building construction and handles door mesh-to-number mappings.
|
||||
|
||||
## Database Table Structure
|
||||
|
||||
### Table: `static_building_blueprint`
|
||||
|
||||
| Column Name | Data Type | Nullable | Key | Description |
|
||||
|-------------|-----------|----------|-----|-------------|
|
||||
| Rank0UUID | bigint unsigned | NO | PRIMARY | Unique identifier for the blueprint (rank 0) |
|
||||
| MeshName | varchar(100) | NO | | Name of the mesh used for the building |
|
||||
| BuildingGroup | enum | NO | | Group classification of the building type |
|
||||
| MaintGroup | varchar(45) | YES | | Maintenance group associated with the building |
|
||||
| Rank1UUID | bigint unsigned | YES | | UUID for rank 1 upgrade |
|
||||
| Rank2UUID | bigint unsigned | YES | | UUID for rank 2 upgrade |
|
||||
| Rank3UUID | bigint unsigned | YES | | UUID for rank 3 upgrade |
|
||||
| Rank4UUID | bigint unsigned | YES | | UUID for rank 4 upgrade |
|
||||
| Rank5UUID | bigint unsigned | YES | | UUID for rank 5 upgrade |
|
||||
| Rank6UUID | bigint unsigned | YES | | UUID for rank 6 upgrade |
|
||||
| Rank7UUID | bigint unsigned | YES | | UUID for rank 7 upgrade |
|
||||
| UpgradeCost | int | YES | | Cost to upgrade the building |
|
||||
| UpgradeTime | int | YES | | Time required to upgrade the building |
|
||||
| MaxHP | int | YES | | Maximum hit points of the building |
|
||||
| MaxGold | int | YES | | Maximum gold storage capacity |
|
||||
| MaxLevel | int | YES | | Maximum level for this building |
|
||||
| MaxRank | int | YES | | Maximum rank for this building |
|
||||
| MinLevel | int | YES | | Minimum level required to build |
|
||||
| Scale | float | YES | | Scale factor for the building mesh |
|
||||
| SizeX | float | YES | | X dimension size |
|
||||
| SizeY | float | YES | | Y dimension size |
|
||||
| SizeZ | float | YES | | Z dimension size |
|
||||
| DoorCount | int | YES | | Number of doors in this building |
|
||||
| MaxDoorCount | int | YES | | Maximum number of doors allowed |
|
||||
| IsWall | tinyint(1) | YES | | Flag indicating if building is a wall |
|
||||
| IsGate | tinyint(1) | YES | | Flag indicating if building is a gate |
|
||||
| IsTower | tinyint(1) | YES | | Flag indicating if building is a tower |
|
||||
| IsKeep | tinyint(1) | YES | | Flag indicating if building is a keep |
|
||||
| IsFortress | tinyint(1) | YES | | Flag indicating if building is a fortress |
|
||||
| IsCastle | tinyint(1) | YES | | Flag indicating if building is a castle |
|
||||
| IsBarracks | tinyint(1) | YES | | Flag indicating if building is barracks |
|
||||
| IsChurch | tinyint(1) | YES | | Flag indicating if building is a church |
|
||||
| IsForge | tinyint(1) | YES | | Flag indicating if building is a forge |
|
||||
| IsSpire | tinyint(1) | YES | | Flag indicating if building is a spire |
|
||||
| IsShrine | tinyint(1) | YES | | Flag indicating if building is a shrine |
|
||||
| IsRunegate | tinyint(1) | YES | | Flag indicating if building is a runegate |
|
||||
| IsMine | tinyint(1) | YES | | Flag indicating if building is a mine |
|
||||
| IsWarehouse | tinyint(1) | YES | | Flag indicating if building is a warehouse |
|
||||
|
||||
### Table: `static_building_doors`
|
||||
|
||||
| Column Name | Data Type | Nullable | Key | Description |
|
||||
|-------------|-----------|----------|-----|-------------|
|
||||
| doorMeshUUID | int | NO | PRIMARY | Unique identifier for the door mesh |
|
||||
| doorNumber | int | NO | | Door number associated with this mesh |
|
||||
|
||||
## Java Field to Database Column Mapping
|
||||
|
||||
| Java Field | Database Column | Type | Description |
|
||||
|------------|-----------------|------|-------------|
|
||||
| blueprint.getBlueprintUUID() | Rank0UUID | bigint unsigned | Blueprint unique identifier |
|
||||
| blueprint.getMeshName() | MeshName | varchar(100) | Name of the building mesh |
|
||||
| blueprint.getBuildingGroup() | BuildingGroup | enum | Group classification of the building |
|
||||
| blueprint.getMaintGroup() | MaintGroup | varchar(45) | Maintenance group for this building |
|
||||
| blueprint.getRank1UUID() | Rank1UUID | bigint unsigned | UUID for rank 1 upgrade |
|
||||
| blueprint.getRank2UUID() | Rank2UUID | bigint unsigned | UUID for rank 2 upgrade |
|
||||
| blueprint.getRank3UUID() | Rank3UUID | bigint unsigned | UUID for rank 3 upgrade |
|
||||
| blueprint.getRank4UUID() | Rank4UUID | bigint unsigned | UUID for rank 4 upgrade |
|
||||
| blueprint.getRank5UUID() | Rank5UUID | bigint unsigned | UUID for rank 5 upgrade |
|
||||
| blueprint.getRank6UUID() | Rank6UUID | bigint unsigned | UUID for rank 6 upgrade |
|
||||
| blueprint.getRank7UUID() | Rank7UUID | bigint unsigned | UUID for rank 7 upgrade |
|
||||
| blueprint.getUpgradeCost() | UpgradeCost | int | Cost to upgrade the building |
|
||||
| blueprint.getUpgradeTime() | UpgradeTime | int | Time required to upgrade |
|
||||
| blueprint.getMaxHP() | MaxHP | int | Maximum hit points |
|
||||
| blueprint.getMaxGold() | MaxGold | int | Maximum gold storage |
|
||||
| blueprint.getMaxLevel() | MaxLevel | int | Maximum level for this building |
|
||||
| blueprint.getMaxRank() | MaxRank | int | Maximum rank |
|
||||
| blueprint.getMinLevel() | MinLevel | int | Minimum level required |
|
||||
| blueprint.getScale() | Scale | float | Scale factor for mesh |
|
||||
| blueprint.getSizeX() | SizeX | float | X dimension size |
|
||||
| blueprint.getSizeY() | SizeY | float | Y dimension size |
|
||||
| blueprint.getSizeZ() | SizeZ | float | Z dimension size |
|
||||
| blueprint.getDoorCount() | DoorCount | int | Number of doors |
|
||||
| blueprint.getMaxDoorCount() | MaxDoorCount | int | Maximum number of doors |
|
||||
| blueprint.getIsWall() | IsWall | tinyint(1) | Wall flag |
|
||||
| blueprint.getIsGate() | IsGate | tinyint(1) | Gate flag |
|
||||
| blueprint.getIsTower() | IsTower | tinyint(1) | Tower flag |
|
||||
| blueprint.getIsKeep() | IsKeep | tinyint(1) | Keep flag |
|
||||
| blueprint.getIsFortress() | IsFortress | tinyint(1) | Fortress flag |
|
||||
| blueprint.getIsCastle() | IsCastle | tinyint(1) | Castle flag |
|
||||
| blueprint.getIsBarracks() | IsBarracks | tinyint(1) | Barracks flag |
|
||||
| blueprint.getIsChurch() | IsChurch | tinyint(1) | Church flag |
|
||||
| blueprint.getIsForge() | IsForge | tinyint(1) | Forge flag |
|
||||
| blueprint.getIsSpire() | IsSpire | tinyint(1) | Spire flag |
|
||||
| blueprint.getIsShrine() | IsShrine | tinyint(1) | Shrine flag |
|
||||
| blueprint.getIsRunegate() | IsRunegate | tinyint(1) | Runegate flag |
|
||||
| blueprint.getIsMine() | IsMine | tinyint(1) | Mine flag |
|
||||
| blueprint.getIsWarehouse() | IsWarehouse | tinyint(1) | Warehouse flag |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### LOAD_ALL_DOOR_NUMBERS
|
||||
- **Query**: `SELECT * FROM static_building_doors ORDER BY doorMeshUUID ASC`
|
||||
- **Note**: Loads all door mesh-to-number mappings for building doors
|
||||
|
||||
### LOAD_ALL_BLUEPRINTS
|
||||
- **Query**: `SELECT * FROM static_building_blueprint`
|
||||
- **Note**: Loads all blueprint definitions for buildings
|
||||
|
||||
## Relationships
|
||||
|
||||
### Foreign Key Relationships
|
||||
- None explicitly defined in the handler code (these are likely static lookup tables)
|
||||
|
||||
### Associated Objects
|
||||
- **Blueprint**: Building construction data with mesh information and upgrade paths
|
||||
- **Door**: Door mesh mappings used for building construction
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
# Boon Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbBoonHandler` class. The boon system in Magicbane is used to manage item bonuses and enhancements that are associated with specific item bases.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbBoonHandler.java`
|
||||
**Class:** `dbBoonHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Boon Table
|
||||
- **Table Name:** `static_item_boons`
|
||||
- **Description:** Contains information about boons (bonuses/enhancements) that can be applied to item bases
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- itemBaseID (Foreign Key to obj_itembase)
|
||||
- boonType
|
||||
- boonValue
|
||||
- boonLevel
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Boon Amounts for Item Base
|
||||
```sql
|
||||
SELECT * FROM `static_item_boons` WHERE `itemBaseID` = ?
|
||||
```
|
||||
**File:** `dbBoonHandler.java`, Line ~28
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Item Base to Boons:** One-to-many relationship where each item base can have multiple boons associated with it
|
||||
- Foreign key: `static_item_boons.itemBaseID` references `obj_itembase.UID`
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `itemBaseID` | `static_item_boons.itemBaseID` | References the item base this boon belongs to |
|
||||
| `boonType` | `static_item_boons.boonType` | Type of boon (e.g., damage, defense) |
|
||||
| `boonValue` | `static_item_boons.boonValue` | Value of the boon |
|
||||
| `boonLevel` | `static_item_boons.boonLevel` | Level of the boon |
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
# Building Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbBuildingHandler` class. The building handler manages all aspects of building objects in Magicbane, including creation, modification, deletion, and various properties like health, protection state, and ownership.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbBuildingHandler.java`
|
||||
**Class:** `dbBuildingHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Building Table
|
||||
- **Table Name:** `obj_building`
|
||||
- **Description:** Core building information including location, mesh, health, and ownership details
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- parent (Foreign Key to obj_zone)
|
||||
- ownerUUID (Foreign Key to obj_character)
|
||||
- name
|
||||
- meshUUID (Foreign Key to static_building_mesh)
|
||||
- locX, locY, locZ (Location coordinates)
|
||||
- meshScale
|
||||
- currentHP
|
||||
- protectionState
|
||||
- currentGold
|
||||
- rank
|
||||
- upgradeDate
|
||||
- blueprintUUID (Foreign Key to static_building_blueprint)
|
||||
- w, rotY (Rotation data)
|
||||
- isDeleted
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `dyn_building_friendslist` | Stores friends that can access this building | BuildingID → obj_building.UID |
|
||||
| `dyn_building_condemnedlist` | Stores characters/guilds marked as condemned for this building | BuildingID → obj_building.UID |
|
||||
| `dyn_building_patrolpoints` | Stores patrol points for building guards | BuildingID → obj_building.UID |
|
||||
| `dyn_building_regions` | Stores region information for buildings | BuildingID → obj_building.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Create Building (Stored Procedure)
|
||||
```sql
|
||||
CALL `building_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
```
|
||||
**File:** `dbBuildingHandler.java`, Line ~38
|
||||
|
||||
### Get All Buildings for Zone
|
||||
```sql
|
||||
SELECT * FROM `obj_building` WHERE `parent` = ?
|
||||
```
|
||||
**File:** `dbBuildingHandler.java`, Line ~91
|
||||
|
||||
### Get Building by UUID
|
||||
```sql
|
||||
SELECT * FROM `obj_building` WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbBuildingHandler.java`, Line ~110
|
||||
|
||||
### Get Building by Mesh
|
||||
```sql
|
||||
SELECT * FROM `obj_building` WHERE `meshUUID` = ?
|
||||
```
|
||||
**File:** `dbBuildingHandler.java`, Line ~135
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Building to Zone:** Many-to-one relationship through `obj_building.parent` field
|
||||
2. **Building to Owner:** Many-to-one relationship through `obj_building.ownerUUID` field (references obj_character.UID)
|
||||
3. **Building to Blueprint:** Many-to-one relationship through `obj_building.blueprintUUID` field (references static_building_blueprint.Rank0UUID)
|
||||
4. **Building to Mesh:** Many-to-one relationship through `obj_building.meshUUID` field (references static_building_mesh.UID)
|
||||
5. **Building to Friends List:** One-to-many relationship through `dyn_building_friendslist.BuildingID`
|
||||
6. **Building to Condemned List:** One-to-many relationship through `dyn_building_condemnedlist.BuildingID`
|
||||
7. **Building to Patrol Points:** One-to-many relationship through `dyn_building_patrolpoints.BuildingID`
|
||||
8. **Building to Regions:** One-to-many relationship through `dyn_building_regions.BuildingID`
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `parent` | `obj_building.parent` | Zone parent ID |
|
||||
| `ownerUUID` | `obj_building.ownerUUID` | Owner character UID |
|
||||
| `name` | `obj_building.name` | Building name |
|
||||
| `meshUUID` | `obj_building.meshUUID` | Mesh identifier |
|
||||
| `locX` | `obj_building.locX` | X coordinate |
|
||||
| `locY` | `obj_building.locY` | Y coordinate |
|
||||
| `locZ` | `obj_building.locZ` | Z coordinate |
|
||||
| `meshScale` | `obj_building.meshScale` | Scale of mesh |
|
||||
| `currentHP` | `obj_building.currentHP` | Current health points |
|
||||
| `protectionState` | `obj_building.protectionState` | Protection state |
|
||||
| `currentGold` | `obj_building.currentGold` | Current gold amount |
|
||||
| `rank` | `obj_building.rank` | Building rank |
|
||||
| `upgradeDate` | `obj_building.upgradeDate` | Upgrade timestamp |
|
||||
| `blueprintUUID` | `obj_building.blueprintUUID` | Blueprint identifier |
|
||||
| `w` | `obj_building.w` | Rotation data |
|
||||
| `rotY` | `obj_building.rotY` | Y rotation angle |
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
# Building Location Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbBuildingLocationHandler` class. This handler manages building location data, specifically loading locations for buildings based on type and slot.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbBuildingLocationHandler.java`
|
||||
**Class:** `dbBuildingLocationHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table
|
||||
- **Table Name:** `static_building_location`
|
||||
- **Description:** Stores location data for building components including position and rotation information
|
||||
- **Columns:**
|
||||
- ID (Primary Key)
|
||||
- BuildingID
|
||||
- type
|
||||
- slot
|
||||
- unknown
|
||||
- locX
|
||||
- locY
|
||||
- locZ
|
||||
- w
|
||||
- rotX
|
||||
- rotY
|
||||
- rotZ
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Load Building Locations
|
||||
```sql
|
||||
SELECT `ID`, `BuildingID`, `type`, `slot`, `unknown`, `locX`, `locY`, `locZ`, `w`, `rotX`, `rotY`, `rotZ`
|
||||
FROM static_building_location
|
||||
WHERE type = 6 OR type = 8
|
||||
GROUP BY buildingID, slot
|
||||
ORDER BY buildingID, slot ASC;
|
||||
```
|
||||
**File:** `dbBuildingLocationHandler.java`, Line ~17
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Building Location to Building:** Many-to-one relationship via `BuildingID` field referencing `obj_building.UID`
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `id` | `static_building_location.ID` | Unique identifier |
|
||||
| `buildingID` | `static_building_location.BuildingID` | Reference to building |
|
||||
| `type` | `static_building_location.type` | Location type |
|
||||
| `slot` | `static_building_location.slot` | Slot number |
|
||||
| `unknown` | `static_building_location.unknown` | Unknown field |
|
||||
| `locX` | `static_building_location.locX` | X coordinate |
|
||||
| `locY` | `static_building_location.locY` | Y coordinate |
|
||||
| `locZ` | `static_building_location.locZ` | Z coordinate |
|
||||
| `w` | `static_building_location.w` | W rotation value |
|
||||
| `rotX` | `static_building_location.rotX` | X rotation |
|
||||
| `rotY` | `static_building_location.rotY` | Y rotation |
|
||||
| `rotZ` | `static_building_location.rotZ` | Z rotation |
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
# dbCSSessionHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbCSSessionHandler` class. The session handler manages user login sessions, tracking account activity, character associations, and session-based authentication.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbCSSessionHandler.java`
|
||||
**Class:** `dbCSSessionHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Session Table
|
||||
- **Table Name:** `dyn_cs_session`
|
||||
- **Description:** Stores information about active and inactive user sessions, including account associations and character details
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- accountID
|
||||
- characterID
|
||||
- sessionKey
|
||||
- lastLoginDate
|
||||
- lastLogoutDate
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_account` | Accounts associated with sessions | accountID → obj_account.UID |
|
||||
| `obj_character` | Characters associated with sessions | characterID → obj_character.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Create Session
|
||||
```sql
|
||||
INSERT INTO `dyn_cs_session` (`accountID`, `characterID`, `sessionKey`, `lastLoginDate`) VALUES(?,?,?,?)
|
||||
```
|
||||
**File:** `dbCSSessionHandler.java`, Line ~35
|
||||
|
||||
### Load Session by Account
|
||||
```sql
|
||||
SELECT * FROM `dyn_cs_session` WHERE `accountID` = ?
|
||||
```
|
||||
**File:** `dbCSSessionHandler.java`, Line ~50
|
||||
|
||||
### Load Session by Character
|
||||
```sql
|
||||
SELECT * FROM `dyn_cs_session` WHERE `characterID` = ?
|
||||
```
|
||||
**File:** `dbCSSessionHandler.java`, Line ~65
|
||||
|
||||
### Update Session Last Login
|
||||
```sql
|
||||
UPDATE `dyn_cs_session` SET `lastLoginDate`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbCSSessionHandler.java`, Line ~80
|
||||
|
||||
### Update Session Last Logout
|
||||
```sql
|
||||
UPDATE `dyn_cs_session` SET `lastLogoutDate`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbCSSessionHandler.java`, Line ~95
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Session to Account:** Many-to-one relationship via accountID field referencing obj_account.UID
|
||||
2. **Session to Character:** Many-to-one relationship via characterID field referencing obj_character.UID
|
||||
3. **Session to Login History:** One-to-many relationship via session UID (via dyn_login_history table)
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `accountID` | `dyn_cs_session.accountID` | Account UID associated with this session |
|
||||
| `characterID` | `dyn_cs_session.characterID` | Character UID associated with this session |
|
||||
| `sessionKey` | `dyn_cs_session.sessionKey` | Session identifier for authentication |
|
||||
| `lastLoginDate` | `dyn_cs_session.lastLoginDate` | Timestamp of last login |
|
||||
| `lastLogoutDate` | `dyn_cs_session.lastLogoutDate` | Timestamp of last logout |
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# Character Power Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbCharacterPowerHandler` class. This handler manages character power data, including adding, deleting, retrieving, and updating character powers.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbCharacterPowerHandler.java`
|
||||
**Class:** `dbCharacterPowerHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table
|
||||
- **Table Name:** `dyn_character_power`
|
||||
- **Description:** Stores dynamic power information for characters including power token, character ID, and training levels
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- CharacterID
|
||||
- powersBaseToken
|
||||
- trains
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Add Character Power
|
||||
```sql
|
||||
INSERT INTO `dyn_character_power` (`CharacterID`, `powersBaseToken`, `trains`) VALUES (?, ?, ?);
|
||||
```
|
||||
**File:** `dbCharacterPowerHandler.java`, Line ~20
|
||||
|
||||
### Delete Character Power
|
||||
```sql
|
||||
DELETE FROM `dyn_character_power` WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbCharacterPowerHandler.java`, Line ~41
|
||||
|
||||
### Get Character Power by ID
|
||||
```sql
|
||||
SELECT * FROM `dyn_character_power` WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbCharacterPowerHandler.java`, Line ~57
|
||||
|
||||
### Get All Powers for Character
|
||||
```sql
|
||||
SELECT * FROM `dyn_character_power` WHERE CharacterID = ?
|
||||
```
|
||||
**File:** `dbCharacterPowerHandler.java`, Line ~76
|
||||
|
||||
### Update Trains
|
||||
```sql
|
||||
UPDATE `dyn_character_power` SET `trains`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbCharacterPowerHandler.java`, Line ~98
|
||||
|
||||
### Update Database
|
||||
```sql
|
||||
UPDATE `dyn_character_power` SET `PowersBaseToken`=?, `CharacterID`=?, `trains`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbCharacterPowerHandler.java`, Line ~115
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Character Power to Character:** Many-to-one relationship via `CharacterID` field referencing `obj_character.UID`
|
||||
2. **Character Power to Power Base:** Many-to-one relationship via `powersBaseToken` field referencing `static_powers_base.token`
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `characterID` | `dyn_character_power.CharacterID` | Reference to character |
|
||||
| `powerToken` | `dyn_character_power.powersBaseToken` | Reference to power base |
|
||||
| `trains` | `dyn_character_power.trains` | Training level |
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
# Character Rune Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbCharacterRuneHandler` class. This handler manages character rune data, including adding, retrieving, deleting, and updating character runes.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbCharacterRuneHandler.java`
|
||||
**Class:** `dbCharacterRuneHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table
|
||||
- **Table Name:** `dyn_character_rune`
|
||||
- **Description:** Stores dynamic rune information for characters including character ID and rune base ID
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- CharacterID
|
||||
- RuneBaseID
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Add Character Rune
|
||||
```sql
|
||||
INSERT INTO `dyn_character_rune` (`CharacterID`, `RuneBaseID`) VALUES (?, ?);
|
||||
```
|
||||
**File:** `dbCharacterRuneHandler.java`, Line ~20
|
||||
|
||||
### Get Character Rune by ID
|
||||
```sql
|
||||
SELECT * FROM `dyn_character_rune` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbCharacterRuneHandler.java`, Line ~43
|
||||
|
||||
### Delete Character Rune
|
||||
```sql
|
||||
DELETE FROM `dyn_character_rune` WHERE `UID`=?;
|
||||
```
|
||||
**File:** `dbCharacterRuneHandler.java`, Line ~61
|
||||
|
||||
### Get All Runes for Character
|
||||
```sql
|
||||
SELECT * FROM `dyn_character_rune` WHERE `CharacterID` = ?
|
||||
```
|
||||
**File:** `dbCharacterRuneHandler.java`, Line ~74
|
||||
|
||||
### Update Database
|
||||
```sql
|
||||
UPDATE `dyn_character_rune` SET `CharacterID`=?, `RuneBaseID`=? WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbCharacterRuneHandler.java`, Line ~91
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Character Rune to Character:** Many-to-one relationship via `CharacterID` field referencing `obj_character.UID`
|
||||
2. **Character Rune to Rune Base:** Many-to-one relationship via `RuneBaseID` field referencing `static_rune_base.ID`
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `playerID` | `dyn_character_rune.CharacterID` | Reference to character |
|
||||
| `runeBaseID` | `dyn_character_rune.RuneBaseID` | Reference to rune base |
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# Character Skill Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbCharacterSkillHandler` class. This handler manages character skill data, including adding, deleting, retrieving, and updating character skills.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbCharacterSkillHandler.java`
|
||||
**Class:** `dbCharacterSkillHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table
|
||||
- **Table Name:** `dyn_character_skill`
|
||||
- **Description:** Stores dynamic skill information for characters including skill base ID, character ID, and training levels
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- CharacterID
|
||||
- skillsBaseID
|
||||
- trains
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Add Skill
|
||||
```sql
|
||||
INSERT INTO `dyn_character_skill` (`CharacterID`, `skillsBaseID`, `trains`) VALUES (?, ?, ?);
|
||||
```
|
||||
**File:** `dbCharacterSkillHandler.java`, Line ~20
|
||||
|
||||
### Delete Skill
|
||||
```sql
|
||||
DELETE FROM `dyn_character_skill` WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbCharacterSkillHandler.java`, Line ~43
|
||||
|
||||
### Get Skill by ID
|
||||
```sql
|
||||
SELECT * FROM `dyn_character_skill` WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbCharacterSkillHandler.java`, Line ~59
|
||||
|
||||
### Get All Skills for Character
|
||||
```sql
|
||||
SELECT * FROM `dyn_character_skill` WHERE `CharacterID` = ?
|
||||
```
|
||||
**File:** `dbCharacterSkillHandler.java`, Line ~80
|
||||
|
||||
### Update Trains
|
||||
```sql
|
||||
UPDATE `dyn_character_skill` SET `trains`=? WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbCharacterSkillHandler.java`, Line ~104
|
||||
|
||||
### Update Database
|
||||
```sql
|
||||
UPDATE `dyn_character_skill` SET `skillsBaseID`=?, `CharacterID`=?, `trains`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbCharacterSkillHandler.java`, Line ~123
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Character Skill to Character:** Many-to-one relationship via `CharacterID` field referencing `obj_character.UID`
|
||||
2. **Character Skill to Skill Base:** Many-to-one relationship via `skillsBaseID` field referencing `static_skills_base.ID`
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `characterID` | `dyn_character_skill.CharacterID` | Reference to character |
|
||||
| `skillBaseID` | `dyn_character_skill.skillsBaseID` | Reference to skill base |
|
||||
| `trains` | `dyn_character_skill.trains` | Training level |
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
# City Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbCityHandler` class. The city handler manages city-related data including city creation, zone information, and building structures within the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbCityHandler.java`
|
||||
**Class:** `dbCityHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main City Table
|
||||
- **Table Name:** `obj_city`
|
||||
- **Description:** Core city information including name, motto, and metadata
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- motto
|
||||
- treeOfLifeUUID
|
||||
- established
|
||||
- realmTaxDate
|
||||
- population
|
||||
- siegesWithstood
|
||||
- isNpc
|
||||
- isCapital
|
||||
- isNoobIsle
|
||||
- bindX
|
||||
- bindZ
|
||||
- bindRadius
|
||||
- radiusType
|
||||
- forceRename
|
||||
- open
|
||||
- hash
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_zone` | Zone information within cities | CityID → obj_city.UID |
|
||||
| `obj_building` | Building information within zones | ZoneID → obj_zone.UID |
|
||||
| `object` | Base object table that links to obj_city | UID → obj_city.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Load City Data
|
||||
```sql
|
||||
SELECT * FROM `object` o
|
||||
JOIN `obj_city` c ON o.`UID` = c.`UID`
|
||||
WHERE o.`type` = 'city' AND o.`parent` = ?
|
||||
```
|
||||
**File:** `dbCityHandler.java`, Line ~45
|
||||
|
||||
### Load Zones for City
|
||||
```sql
|
||||
SELECT * FROM `object` o
|
||||
JOIN `obj_zone` z ON o.`UID` = z.`UID`
|
||||
WHERE o.`type` = 'zone' AND o.`parent` = ?
|
||||
```
|
||||
**File:** `dbCityHandler.java`, Line ~60
|
||||
|
||||
### Load Buildings for Zone
|
||||
```sql
|
||||
SELECT * FROM `object` o
|
||||
JOIN `obj_building` b ON o.`UID` = b.`UID`
|
||||
WHERE o.`type` = 'building' AND o.`parent` = ?
|
||||
```
|
||||
**File:** `dbCityHandler.java`, Line ~75
|
||||
|
||||
### Create New City
|
||||
```sql
|
||||
CALL `city_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
```
|
||||
**File:** `dbCityHandler.java`, Line ~90
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **City to Object:** One-to-one (City is a type of object)
|
||||
2. **Zone to City:** Many-to-one (Multiple zones per city)
|
||||
3. **Building to Zone:** Many-to-one (Multiple buildings per zone)
|
||||
4. **City to Zones:** One-to-many (via `obj_zone.parent` field)
|
||||
5. **Zone to Buildings:** One-to-many (via `obj_building.parent` field)
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_city.name` | City name |
|
||||
| `motto` | `obj_city.motto` | City motto |
|
||||
| `established` | `obj_city.established` | Date established |
|
||||
| `population` | `obj_city.population` | Population count |
|
||||
| `isNpc` | `obj_city.isNpc` | NPC flag |
|
||||
| `bindX` | `obj_city.bindX` | X binding coordinate |
|
||||
| `bindZ` | `obj_city.bindZ` | Z binding coordinate |
|
||||
| `bindRadius` | `obj_city.bindRadius` | Binding radius |
|
||||
| `isCapital` | `obj_city.isCapital` | Capital city flag |
|
||||
| `isNoobIsle` | `obj_city.isNoobIsle` | Noob island flag |
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
# Contract Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbContractHandler` class. This handler manages contract data for NPCs, including loading contracts, their inventory sets, and sell lists.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbContractHandler.java`
|
||||
**Class:** `dbContractHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table
|
||||
- **Table Name:** `static_npc_contract`
|
||||
- **Description:** Stores static contract information for NPCs including contract ID, name, mob base ID, class ID, vendor dialog, and icon ID
|
||||
- **Columns:**
|
||||
- ID (Primary Key)
|
||||
- contractID
|
||||
- name
|
||||
- mobbaseID
|
||||
- classID
|
||||
- vendorDialog
|
||||
- iconID
|
||||
- allowedBuildingTypeID
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `static_npc_inventoryset` | Stores inventory items for contracts | inventorySet → static_npc_contract.inventorySet |
|
||||
| `static_npc_contract_selltype` | Stores sell type information for contracts | contractID → static_npc_contract.ID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Contract by ID
|
||||
```sql
|
||||
SELECT * FROM `static_npc_contract` WHERE `ID` = ?
|
||||
```
|
||||
**File:** `dbContractHandler.java`, Line ~17
|
||||
|
||||
### Load Contract Inventory
|
||||
```sql
|
||||
SELECT * FROM `static_npc_inventoryset` WHERE `inventorySet` = ?;
|
||||
```
|
||||
**File:** `dbContractHandler.java`, Line ~43
|
||||
|
||||
### Load Sell List for Contract
|
||||
```sql
|
||||
SELECT * FROM `static_npc_contract_selltype` WHERE `contractID` = ?;
|
||||
```
|
||||
**File:** `dbContractHandler.java`, Line ~65
|
||||
|
||||
### Update Allowed Buildings
|
||||
```sql
|
||||
UPDATE `static_npc_contract` SET `allowedBuildingTypeID`=? WHERE `contractID`=?
|
||||
```
|
||||
**File:** `dbContractHandler.java`, Line ~87
|
||||
|
||||
### Update Database
|
||||
```sql
|
||||
UPDATE `static_npc_contract` SET `contractID`=?, `name`=?, `mobbaseID`=?, `classID`=?, vendorDialog=?, iconID=?, allowedBuildingTypeID=? WHERE `ID`=?
|
||||
```
|
||||
**File:** `dbContractHandler.java`, Line ~100
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Contract to Mob Base:** Many-to-one relationship via `mobbaseID` field referencing `obj_mobbase.ID`
|
||||
2. **Contract to Vendor Dialog:** Many-to-one relationship via `vendorDialog` field referencing `obj_vendor_dialog.UID`
|
||||
3. **Contract to Inventory Set:** One-to-many relationship via `inventorySet` field
|
||||
4. **Contract to Sell Types:** One-to-many relationship via `contractID` field
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `contractID` | `static_npc_contract.contractID` | Contract identifier |
|
||||
| `name` | `static_npc_contract.name` | Contract name |
|
||||
| `mobbaseID` | `static_npc_contract.mobbaseID` | Reference to mob base |
|
||||
| `classID` | `static_npc_contract.classID` | Class identifier |
|
||||
| `vendorDialogID` | `static_npc_contract.vendorDialog` | Reference to vendor dialog |
|
||||
| `iconID` | `static_npc_contract.iconID` | Icon identifier |
|
||||
| `allowedBuildings` | `static_npc_contract.allowedBuildingTypeID` | Allowed building types |
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
# dbEffectsBaseHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbEffectsBaseHandler` class. This handler manages static data about power effects in Magicbane, including their base properties and modifiers.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbEffectsBaseHandler.java`
|
||||
**Class:** `dbEffectsBaseHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Effect Base Table
|
||||
- **Table Name:** `static_power_effectbase`
|
||||
- **Description:** Core table containing base information about power effects, including names and types
|
||||
- **Columns:**
|
||||
- IDString (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- effectType
|
||||
|
||||
### Modifier Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `static_power_effectmod` | Stores modifier properties for effects | EffectBaseID → static_power_effectbase.IDString |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get All Effects Base
|
||||
```sql
|
||||
SELECT * FROM static_power_effectbase ORDER BY `IDString` DESC
|
||||
```
|
||||
**File:** `dbEffectsBaseHandler.java`, Line ~25
|
||||
|
||||
### Get Effect Modifiers
|
||||
```sql
|
||||
SELECT * FROM static_power_effectmod WHERE `effectBaseID` = ?
|
||||
```
|
||||
**File:** `dbEffectsBaseHandler.java`, Line ~40
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Effect Base to Modifiers:** One-to-many relationship via effectBaseID field in static_power_effectmod referencing static_power_effectbase.IDString
|
||||
2. **Effect Base to Resources Cost:** Many-to-many relationship through static_power_effectcost table
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `IDString` | `static_power_effectbase.IDString` | Unique identifier for the effect |
|
||||
| `name` | `static_power_effectbase.name` | Display name of the effect |
|
||||
| `description` | `static_power_effectbase.description` | Description of the effect |
|
||||
| `effectType` | `static_power_effectbase.effectType` | Type of effect |
|
||||
| `modType` | `static_power_effectmod.modType` | Modifier type for effect modifiers |
|
||||
| `modValue` | `static_power_effectmod.modValue` | Value of the modifier |
|
||||
| `other fields...` | Various columns | Other properties related to effects and modifiers |
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
# dbEffectsResourceCostHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbEffectsResourceCostHandler` class. This handler manages the resource costs associated with power effects, including mana, health, and other resource types required to use specific powers.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbEffectsResourceCostHandler.java`
|
||||
**Class:** `dbEffectsResourceCostHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Resource Cost Table
|
||||
- **Table Name:** `static_power_effectcost`
|
||||
- **Description:** Stores resource cost information for power effects, defining what resources are required to use specific effects
|
||||
- **Columns:**
|
||||
- IDString (Primary Key)
|
||||
- resourceType
|
||||
- resourceAmount
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Resource Cost by Effect ID
|
||||
```sql
|
||||
SELECT * FROM static_power_effectcost WHERE `IDString` = ?
|
||||
```
|
||||
**File:** `dbEffectsResourceCostHandler.java`, Line ~25
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Effect Cost to Effect Base:** Many-to-one relationship via IDString field referencing static_power_effectbase.IDString
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `idString` | `static_power_effectcost.IDString` | Unique identifier linking to effect base |
|
||||
| `resourceType` | `static_power_effectcost.resourceType` | Type of resource required (mana, health, etc.) |
|
||||
| `resourceAmount` | `static_power_effectcost.resourceAmount` | Amount of resource required |
|
||||
| `other fields...` | Various columns | Other properties related to resource costs |
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
# dbEnchantmentHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbEnchantmentHandler` class. This handler manages item enchantments, which are special properties applied to items that modify their attributes or provide additional abilities.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbEnchantmentHandler.java`
|
||||
**Class:** `dbEnchantmentHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Enchantment Table
|
||||
- **Table Name:** `dyn_item_enchantment`
|
||||
- **Description:** Stores enchantment information for items, including the type of power action and rank level
|
||||
- **Columns:**
|
||||
- itemID (Primary Key)
|
||||
- powerAction
|
||||
- rank
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Enchantments by Item ID
|
||||
```sql
|
||||
SELECT * FROM dyn_item_enchantment WHERE `itemID` = ?
|
||||
```
|
||||
**File:** `dbEnchantmentHandler.java`, Line ~25
|
||||
|
||||
### Save Enchantment
|
||||
```sql
|
||||
INSERT INTO `dyn_item_enchantment` (`itemID`, `powerAction`, `rank`) VALUES(?,?,?)
|
||||
```
|
||||
**File:** `dbEnchantmentHandler.java`, Line ~40
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Enchantment to Item:** Many-to-one relationship via itemID field referencing obj_item.UID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `itemID` | `dyn_item_enchantment.itemID` | Unique identifier for the item |
|
||||
| `powerAction` | `dyn_item_enchantment.powerAction` | The power action associated with the enchantment |
|
||||
| `rank` | `dyn_item_enchantment.rank` | The rank or strength level of the enchantment |
|
||||
| `other fields...` | Various columns | Other properties related to item enchantments |
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
# Guild Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbGuildHandler` class. The guild system in Magicbane is complex, involving multiple related tables for managing guilds, their history, alliances, enemies, and member management.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbGuildHandler.java`
|
||||
**Class:** `dbGuildHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Guild Table
|
||||
- **Table Name:** `obj_guild`
|
||||
- **Description:** Core guild information including name, leader, tags, charter, and ownership details
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- leaderUID
|
||||
- backgroundColor01
|
||||
- backgroundColor02
|
||||
- symbolColor
|
||||
- backgroundDesign
|
||||
- symbol
|
||||
- charter
|
||||
- leadershipType
|
||||
- motto
|
||||
- ownedCity
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `dyn_character_guildhistory` | Tracks character's guild membership history | CharacterID → obj_character.UID, GuildID → obj_guild.UID |
|
||||
| `dyn_guild_allianceenemylist` | Stores alliance/enemy relationships between guilds | GuildID → obj_guild.UID, OtherGuildID → obj_guild.UID |
|
||||
| `dyn_guild_banishlist` | Lists characters banned from guilds | GuildID → obj_guild.UID, CharacterID → obj_character.UID |
|
||||
| `dyn_guild_characterkoslist` | Stores characters marked as KOS (Kill on Sight) for guilds | GuildID → obj_guild.UID, KOSCharacterID → obj_character.UID |
|
||||
| `dyn_guild_guildkoslist` | Stores guilds marked as KOS for other guilds | GuildID → obj_guild.UID, KOSGuildID → obj_guild.UID |
|
||||
| `object` | Base object table that links to obj_guild | UID → obj_guild.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Guild by ID
|
||||
```sql
|
||||
SELECT `obj_guild`.*, `object`.`parent`
|
||||
FROM `obj_guild`
|
||||
INNER JOIN `object` ON `object`.`UID` = `obj_guild`.`UID`
|
||||
WHERE `object`.`UID`=?
|
||||
```
|
||||
**File:** `dbGuildHandler.java`, Line ~450
|
||||
|
||||
### Get Guild History of Player
|
||||
```sql
|
||||
SELECT g.* FROM `obj_guild` g, `dyn_character_guildhistory` l
|
||||
WHERE g.`UID` = l.`GuildID` && l.`CharacterID` = ?
|
||||
```
|
||||
**File:** `dbGuildHandler.java`, Line ~200
|
||||
|
||||
### Get Guild Allies
|
||||
```sql
|
||||
SELECT g.* FROM `obj_guild` g, `dyn_guild_allianceenemylist` l
|
||||
WHERE l.isAlliance = 1 && l.OtherGuildID = g.UID && l.GuildID=?
|
||||
```
|
||||
**File:** `dbGuildHandler.java`, Line ~230
|
||||
|
||||
### Get Guild Enemies
|
||||
```sql
|
||||
SELECT g.* FROM `obj_guild` g, `dyn_guild_allianceenemylist` l
|
||||
WHERE l.isAlliance = 0 && l.OtherGuildID = g.UID && l.GuildID=?
|
||||
```
|
||||
**File:** `dbGuildHandler.java`, Line ~253
|
||||
|
||||
### Get Guild KOS Characters
|
||||
```sql
|
||||
SELECT c.* FROM `obj_character` c, `dyn_guild_characterkoslist` l
|
||||
WHERE c.`char_isActive` = 1 && l.`KOSCharacterID` = c.`UID` && l.`GuildID`=?
|
||||
```
|
||||
**File:** `dbGuildHandler.java`, Line ~273
|
||||
|
||||
### Get Guild KOS Guilds
|
||||
```sql
|
||||
SELECT g.* FROM `obj_guild` g, `dyn_guild_guildkoslist` l
|
||||
WHERE l.KOSGuildID = g.UID && l.GuildID = ?
|
||||
```
|
||||
**File:** `dbGuildHandler.java`, Line ~295
|
||||
|
||||
### Save Guild (Stored Procedure)
|
||||
```sql
|
||||
CALL `guild_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
```
|
||||
**File:** `dbGuildHandler.java`, Line ~483
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Guild to Character:** Many-to-many through `obj_character.guildUID` field
|
||||
2. **Guild to Guild History:** One-to-many (via `dyn_character_guildhistory.GuildID`)
|
||||
3. **Guild to Alliances/Enemies:** Many-to-many (via `dyn_guild_allianceenemylist`)
|
||||
4. **Guild to Bans List:** One-to-many (via `dyn_guild_banishlist.GuildID`)
|
||||
5. **Guild to KOS Characters:** One-to-many (via `dyn_guild_characterkoslist.GuildID`)
|
||||
6. **Guild to KOS Guilds:** One-to-many (via `dyn_guild_guildkoslist.GuildID`)
|
||||
7. **Guild to Sub-Guilds:** Parent-child relationship via `object.parent` field
|
||||
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_guild.name` | Guild name |
|
||||
| `leaderUID` | `obj_guild.leaderUID` | Leader character UID |
|
||||
| `backgroundColor01` | `obj_guild.backgroundColor01` | First background color |
|
||||
| `backgroundColor02` | `obj_guild.backgroundColor02` | Second background color |
|
||||
| `symbolColor` | `obj_guild.symbolColor` | Symbol color |
|
||||
| `backgroundDesign` | `obj_guild.backgroundDesign` | Background design ID |
|
||||
| `symbol` | `obj_guild.symbol` | Guild symbol ID |
|
||||
| `charter` | `obj_guild.charter` | Charter information |
|
||||
| `leadershipType` | `obj_guild.leadershipType` | Leadership type |
|
||||
| `motto` | `obj_guild.motto` | Guild motto |
|
||||
| `ownedCity` | `obj_guild.ownedCity` | Owned city ID |
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
# dbHeightMapHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbHeightMapHandler` class. This handler manages height map data for zones, which is used to determine terrain elevation in the game world.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbHeightMapHandler.java`
|
||||
**Class:** `dbHeightMapHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Height Map Table
|
||||
- **Table Name:** `static_zone_heightmap`
|
||||
- **Description:** Stores raw height map data for zones, representing terrain elevation information
|
||||
- **Columns:**
|
||||
- zoneLoadID (Primary Key)
|
||||
- heightMapData
|
||||
- width
|
||||
- height
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Height Map by Zone Load ID
|
||||
```sql
|
||||
SELECT * FROM static_zone_heightmap WHERE `zoneLoadID` = ?
|
||||
```
|
||||
**File:** `dbHeightMapHandler.java`, Line ~25
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Height Map to Zone:** Many-to-one relationship via zoneLoadID field referencing static_zone_load.zoneLoadID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `zoneLoadID` | `static_zone_heightmap.zoneLoadID` | Unique identifier for the zone |
|
||||
| `heightMapData` | `static_zone_heightmap.heightMapData` | Raw height map data for terrain elevation |
|
||||
| `width` | `static_zone_size.width` | Width dimension of the zone |
|
||||
| `height` | `static_zone_size.height` | Height dimension of the zone |
|
||||
| `other fields...` | Various columns | Other properties related to height maps |
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# dbItemBaseHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbItemBaseHandler` class. This handler manages static item base data, including item properties, stats, and appearance information.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbItemBaseHandler.java`
|
||||
**Class:** `dbItemBaseHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Item Base Table
|
||||
- **Table Name:** `static_itembase`
|
||||
- **Description:** Core table storing base properties of items, including names, descriptions, and appearance settings
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- itemClass
|
||||
- icon
|
||||
- mesh
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `static_item_bakedinstat` | Stores stat information for items | ItemBaseID → static_itembase.UID |
|
||||
| `static_itembase_animations` | Stores animation settings for items | ItemBaseID → static_itembase.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Item Base by UID
|
||||
```sql
|
||||
SELECT * FROM static_itembase WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbItemBaseHandler.java`, Line ~25
|
||||
|
||||
### Get Item Stats
|
||||
```sql
|
||||
SELECT * FROM static_item_bakedinstat WHERE `itemBaseID` = ?
|
||||
```
|
||||
**File:** `dbItemBaseHandler.java`, Line ~40
|
||||
|
||||
### Get Item Animations
|
||||
```sql
|
||||
SELECT * FROM static_itembase_animations WHERE `itemBaseID` = ?
|
||||
```
|
||||
**File:** `dbItemBaseHandler.java`, Line ~55
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Item Base to Stats:** One-to-many relationship via itemBaseID field in static_item_bakedinstat referencing static_itembase.UID
|
||||
2. **Item Base to Animations:** One-to-many relationship via itemBaseID field in static_itembase_animations referencing static_itembase.UID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `UID` | `static_itembase.UID` | Unique identifier for the item |
|
||||
| `name` | `static_itembase.name` | Name of the item |
|
||||
| `description` | `static_itembase.description` | Description of the item |
|
||||
| `itemClass` | `static_itembase.itemClass` | Class of the item |
|
||||
| `icon` | `static_itembase.icon` | Icon identifier for the item |
|
||||
| `mesh` | `static_itembase.mesh` | Mesh identifier for the item |
|
||||
| `fromUse` | `static_item_bakedinstat.fromUse` | Flag indicating if stat is from use |
|
||||
| `animation` | `static_itembase_animations.animation` | Animation associated with the item |
|
||||
| `rightHand` | `static_itembase_animations.rightHand` | Flag indicating right hand animation |
|
||||
| `runeSet` | `static_npc_runeSet.runeSet` | NPC rune set identifier |
|
||||
| `runeBase` | `static_npc_runeSet.runeBase` | Base rune identifier |
|
||||
| `other fields...` | Various columns | Other properties related to item base data |
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
# dbItemHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbItemHandler` class. This handler manages item data in players' inventories, including item properties, location information, and ownership details.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbItemHandler.java`
|
||||
**Class:** `dbItemHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Item Table
|
||||
- **Table Name:** `obj_item`
|
||||
- **Description:** Stores information about items in player inventories, including location, ownership, and attributes
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- ownerUID
|
||||
- containerID
|
||||
- itemBaseID
|
||||
- item_container
|
||||
- equipSlot
|
||||
- flags
|
||||
- customName
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Item by UID
|
||||
```sql
|
||||
SELECT * FROM obj_item WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbItemHandler.java`, Line ~25
|
||||
|
||||
### Save Item
|
||||
```sql
|
||||
INSERT INTO `obj_item` (`ownerUID`, `containerID`, `itemBaseID`, `item_container`, `equipSlot`, `flags`, `customName`) VALUES(?,?,?,?,?,?,?)
|
||||
```
|
||||
**File:** `dbItemHandler.java`, Line ~40
|
||||
|
||||
### Get Items by Owner
|
||||
```sql
|
||||
SELECT * FROM obj_item WHERE `ownerUID` = ?
|
||||
```
|
||||
**File:** `dbItemHandler.java`, Line ~55
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Item to Owner:** Many-to-one relationship via ownerUID field referencing obj_character.UID
|
||||
2. **Item to Container:** Many-to-one relationship via containerID field referencing obj_container.UID
|
||||
3. **Item to Item Base:** Many-to-one relationship via itemBaseID field referencing static_itembase.UID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `UID` | `obj_item.UID` | Unique identifier for the item |
|
||||
| `ownerUID` | `obj_item.ownerUID` | UID of the character who owns this item |
|
||||
| `containerID` | `obj_item.containerID` | Container ID where item is stored |
|
||||
| `itemBaseID` | `obj_item.itemBaseID` | UID of the base item definition |
|
||||
| `item_container` | `obj_item.item_container` | Container type (inventory, equip, bank, etc.) |
|
||||
| `equipSlot` | `obj_item.equipSlot` | Slot where item is equipped |
|
||||
| `flags` | `obj_item.flags` | Item flags for special properties |
|
||||
| `customName` | `obj_item.customName` | Custom name of the item |
|
||||
| `other fields...` | Various columns | Other item-specific properties |
|
||||
@@ -0,0 +1,54 @@
|
||||
# dbKitHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbKitHandler` class. The kit handler manages static data about game kits, which are predefined sets of items or abilities that players can obtain or use in the game.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbKitHandler.java`
|
||||
**Class:** `dbKitHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Kit Table
|
||||
- **Table Name:** `static_rune_validkit`
|
||||
- **Description:** Stores information about valid kits available in the game, including their properties and restrictions
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- kitName
|
||||
- description
|
||||
- raceRestriction
|
||||
- classRestriction
|
||||
- itemLimit
|
||||
- isAvailable
|
||||
|
||||
## Key Queries
|
||||
|
||||
### GET_ALL_KITS
|
||||
```sql
|
||||
SELECT * FROM `static_rune_validkit`
|
||||
```
|
||||
**File:** `dbKitHandler.java`, Line ~29
|
||||
|
||||
### GET_KIT_BY_NAME
|
||||
```sql
|
||||
SELECT * FROM `static_rune_validkit` WHERE `kitName`=?
|
||||
```
|
||||
**File:** `dbKitHandler.java`, Line ~45
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Kit to Race Restrictions:** Many-to-many relationship through raceRestriction field
|
||||
2. **Kit to Class Restrictions:** Many-to-many relationship through classRestriction field
|
||||
3. **Kit to Items:** One-to-many relationship via itemLimit referencing items in the game
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `kitName` | `static_rune_validkit.kitName` | Unique name identifier for the kit |
|
||||
| `description` | `static_rune_validkit.description` | Description of the kit's purpose and benefits |
|
||||
| `raceRestriction` | `static_rune_validkit.raceRestriction` | Race restriction for the kit |
|
||||
| `classRestriction` | `static_rune_validkit.classRestriction` | Class restriction for the kit |
|
||||
| `itemLimit` | `static_rune_validkit.itemLimit` | Maximum number of items allowed in this kit |
|
||||
| `isAvailable` | `static_rune_validkit.isAvailable` | Boolean flag indicating if kit is currently available |
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
# dbLootHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbLootHandler` class. The loot handler manages static loot tables and item generation data used in the game's loot system, including general tables, item tables, modifier tables, and booty sets.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbLootHandler.java`
|
||||
**Class:** `dbLootHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Tables
|
||||
- **Table Name:** `static_loot_gen`
|
||||
- **Description:** Stores general loot table entries for item generation
|
||||
- **Columns:**
|
||||
- genTable (Primary Key)
|
||||
- itemID
|
||||
- weight
|
||||
- minLevel
|
||||
- maxLevel
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `static_loot_item` | Stores item-specific loot table entries | One-to-many with genTable |
|
||||
| `static_loot_mod` | Stores modifier information for loot items | One-to-many with modTable |
|
||||
| `static_loot_modtype` | Defines modifier types used in loot systems | One-to-many with modType |
|
||||
| `static_loot_bootySet` | Stores booty set definitions for loot generation | One-to-many with bootySet |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### LOAD_GEN_ITEM_TABLES
|
||||
```sql
|
||||
SELECT * FROM `static_loot_gen`
|
||||
```
|
||||
**File:** `dbLootHandler.java`, Line ~32
|
||||
|
||||
### LOAD_ITEM_TABLES
|
||||
```sql
|
||||
SELECT * FROM `static_loot_item`
|
||||
```
|
||||
**File:** `dbLootHandler.java`, Line ~64
|
||||
|
||||
### LOAD_MOD_TABLES
|
||||
```sql
|
||||
SELECT * FROM `static_loot_mod`
|
||||
```
|
||||
**File:** `dbLootHandler.java`, Line ~96
|
||||
|
||||
### LOAD_MOD_TYPE_TABLES
|
||||
```sql
|
||||
SELECT * FROM `static_loot_modtype`
|
||||
```
|
||||
**File:** `dbLootHandler.java`, Line ~128
|
||||
|
||||
### LOAD_BOOTY_TABLES
|
||||
```sql
|
||||
SELECT * FROM static_loot_bootySet
|
||||
```
|
||||
**File:** `dbLootHandler.java`, Line ~160
|
||||
|
||||
### LOAD_ENCHANT_VALUES
|
||||
```sql
|
||||
SELECT `IDString`, `minMod` FROM `static_power_effectmod` WHERE `modType` = ?
|
||||
```
|
||||
**File:** `dbLootHandler.java`, Line ~192
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Loot Generation Tables:** The main loot tables are related through the genTable, itemTable, and modTable fields to form a hierarchical loot generation system
|
||||
2. **Item Tables:** Connected to general tables through itemID fields for specific item definitions
|
||||
3. **Modifier Tables:** Linked through modTable and modType fields for modifier definitions
|
||||
4. **Booty Sets:** Connected through bootySet field for specific booty set configurations
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `genTableID` | `static_loot_gen.genTable` | Unique identifier for the loot table |
|
||||
| `itemID` | `static_loot_gen.itemID` | Item ID for this loot entry |
|
||||
| `weight` | `static_loot_gen.weight` | Weight for random selection |
|
||||
| `minLevel` | `static_loot_gen.minLevel` | Minimum level requirement |
|
||||
| `maxLevel` | `static_loot_gen.maxLevel` | Maximum level requirement |
|
||||
| `itemTableID` | `static_loot_item.itemTable` | Item table identifier |
|
||||
| `modTableID` | `static_loot_mod.modTable` | Modifier table identifier |
|
||||
| `modTypeID` | `static_loot_modtype.modType` | Modifier type identifier |
|
||||
| `bootySetID` | `static_loot_bootySet.bootySet` | Booty set identifier |
|
||||
| `IDString` | `static_power_effectmod.IDString` | ID string for effect modifiers |
|
||||
| `minMod` | `static_power_effectmod.minMod` | Minimum modifier value |
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
# dbMenuHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbMenuHandler` class. The menu handler manages NPC menu options and their associated data, providing functionality to retrieve menu options based on menu IDs.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbMenuHandler.java`
|
||||
**Class:** `dbMenuHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table
|
||||
- **Table Name:** `static_npc_menuoption`
|
||||
- **Description:** Stores NPC menu option data including text, actions, and relationships to parent menus
|
||||
- **Columns:**
|
||||
- menuID (Primary Key)
|
||||
- optionText
|
||||
- actionType
|
||||
- actionValue
|
||||
- nextMenuID
|
||||
- conditionType
|
||||
- conditionValue
|
||||
|
||||
## Key Queries
|
||||
|
||||
### GET_MENU_OPTIONS
|
||||
```sql
|
||||
SELECT * FROM `static_npc_menuoption` WHERE menuID = ?
|
||||
```
|
||||
**File:** `dbMenuHandler.java`, Line ~25
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Menu Options to Menu:** One-to-many relationship via menuID field referencing parent menu structure
|
||||
2. **Menu Options to Next Menu:** Many-to-one relationship via nextMenuID field for navigation between menus
|
||||
3. **Menu Options to Conditions:** Zero-to-many relationship via conditionType and conditionValue fields for dynamic menu display
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `menuID` | `static_npc_menuoption.menuID` | Unique identifier for the parent menu |
|
||||
| `optionText` | `static_npc_menuoption.optionText` | Text displayed for this menu option |
|
||||
| `actionType` | `static_npc_menuoption.actionType` | Type of action to perform when selected |
|
||||
| `actionValue` | `static_npc_menuoption.actionValue` | Value associated with the action |
|
||||
| `nextMenuID` | `static_npc_menuoption.nextMenuID` | ID of the menu to navigate to when selected |
|
||||
| `conditionType` | `static_npc_menuoption.conditionType` | Type of condition for displaying this option |
|
||||
| `conditionValue` | `static_npc_menuoption.conditionValue` | Value associated with the condition |
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
# dbMineHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbMineHandler` class. The mine handler manages mine objects and their properties, including ownership, resource types, production types, and flags for various mine behaviors.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbMineHandler.java`
|
||||
**Class:** `dbMineHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table
|
||||
- **Table Name:** `obj_mine`
|
||||
- **Description:** Stores mine-specific data including owner, resource type, production type, and flags
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- mine_ownerUID
|
||||
- mine_resource
|
||||
- mine_type
|
||||
- flags
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_building` | Base building data for mines | One-to-one with obj_mine via UID |
|
||||
| `object` | Generic object data including parent relationships | One-to-one with obj_mine via UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### GET_MINE
|
||||
```sql
|
||||
SELECT `obj_building`.*, `object`.`parent` FROM `object` INNER JOIN `obj_building` ON `obj_building`.`UID` = `object`.`UID` WHERE `object`.`UID` = ?
|
||||
```
|
||||
**File:** `dbMineHandler.java`, Line ~25
|
||||
|
||||
### GET_ALL_MINES_FOR_SERVER
|
||||
```sql
|
||||
SELECT `obj_mine`.*, `object`.`parent` FROM `object` INNER JOIN `obj_mine` ON `obj_mine`.`UID` = `object`.`UID`
|
||||
```
|
||||
**File:** `dbMineHandler.java`, Line ~43
|
||||
|
||||
### CHANGE_OWNER
|
||||
```sql
|
||||
UPDATE `obj_mine` SET `mine_ownerUID`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbMineHandler.java`, Line ~57
|
||||
|
||||
### CHANGE_RESOURCE
|
||||
```sql
|
||||
UPDATE `obj_mine` SET `mine_resource`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbMineHandler.java`, Line ~71
|
||||
|
||||
### CHANGE_TYPE
|
||||
```sql
|
||||
UPDATE `obj_mine` SET `mine_type`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbMineHandler.java`, Line ~85
|
||||
|
||||
### SET_FLAGS
|
||||
```sql
|
||||
UPDATE `obj_mine` SET `flags`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbMineHandler.java`, Line ~99
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Mine to Building:** One-to-one relationship via UID field (mine data extends building data)
|
||||
2. **Mine to Owner:** Many-to-one relationship via mine_ownerUID referencing obj_character.UID
|
||||
3. **Mine to Resource:** Many-to-one relationship via mine_resource field linking to resource definitions
|
||||
4. **Mine to Parent Object:** One-to-one relationship through object table for parent-child hierarchies
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `mine_ownerUID` | `obj_mine.mine_ownerUID` | Character UID of the mine owner |
|
||||
| `mine_resource` | `obj_mine.mine_resource` | Resource type being mined |
|
||||
| `mine_type` | `obj_mine.mine_type` | Production type of the mine |
|
||||
| `flags` | `obj_mine.flags` | Bit flags for mine properties |
|
||||
| `UID` | `obj_mine.UID` | Unique identifier for the mine object |
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
# dbMobBaseHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbMobBaseHandler` class. This handler manages static data about mob (monster) base properties in Magicbane, including their characteristics, stats, and behaviors.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbMobBaseHandler.java`
|
||||
**Class:** `dbMobBaseHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Mob Base Table
|
||||
- **Table Name:** `static_mob_base`
|
||||
- **Description:** Core table storing base properties of mobs, including names, descriptions, and basic characteristics
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- mobType
|
||||
- level
|
||||
- health
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `static_mob_stats` | Stores stat information for mobs | MobBaseID → static_mob_base.UID |
|
||||
| `static_mob_loot` | Stores loot information for mobs | MobBaseID → static_mob_base.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Mob Base by UID
|
||||
```sql
|
||||
SELECT * FROM static_mob_base WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbMobBaseHandler.java`, Line ~25
|
||||
|
||||
### Get Mob Stats
|
||||
```sql
|
||||
SELECT * FROM static_mob_stats WHERE `mobBaseID` = ?
|
||||
```
|
||||
**File:** `dbMobBaseHandler.java`, Line ~40
|
||||
|
||||
### Get Mob Loot
|
||||
```sql
|
||||
SELECT * FROM static_mob_loot WHERE `mobBaseID` = ?
|
||||
```
|
||||
**File:** `dbMobBaseHandler.java`, Line ~55
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Mob Base to Stats:** One-to-many relationship via mobBaseID field in static_mob_stats referencing static_mob_base.UID
|
||||
2. **Mob Base to Loot:** One-to-many relationship via mobBaseID field in static_mob_loot referencing static_mob_base.UID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `UID` | `static_mob_base.UID` | Unique identifier for the mob |
|
||||
| `name` | `static_mob_base.name` | Name of the mob |
|
||||
| `description` | `static_mob_base.description` | Description of the mob |
|
||||
| `mobType` | `static_mob_base.mobType` | Type of mob |
|
||||
| `level` | `static_mob_base.level` | Level of the mob |
|
||||
| `health` | `static_mob_base.health` | Base health of the mob |
|
||||
| `other fields...` | Various columns | Other properties related to mob base data |
|
||||
@@ -0,0 +1,70 @@
|
||||
# dbMobHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbMobHandler` class. This handler manages dynamic mob data in the game world, including their current state, location, and behavior.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbMobHandler.java`
|
||||
**Class:** `dbMobHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Mob Table
|
||||
- **Table Name:** `dyn_mob`
|
||||
- **Description:** Stores current state information for mobs in the game world, including location, health, and status
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- mobBaseID
|
||||
- zoneUUID
|
||||
- x
|
||||
- y
|
||||
- z
|
||||
- health
|
||||
- isAlive
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_character` | Characters that may interact with mobs | OwnerUID → obj_character.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Mob by UID
|
||||
```sql
|
||||
SELECT * FROM dyn_mob WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbMobHandler.java`, Line ~25
|
||||
|
||||
### Save Mob
|
||||
```sql
|
||||
INSERT INTO `dyn_mob` (`mobBaseID`, `zoneUUID`, `x`, `y`, `z`, `health`, `isAlive`) VALUES(?,?,?,?,?,?,?)
|
||||
```
|
||||
**File:** `dbMobHandler.java`, Line ~40
|
||||
|
||||
### Get Mobs by Zone
|
||||
```sql
|
||||
SELECT * FROM dyn_mob WHERE `zoneUUID` = ?
|
||||
```
|
||||
**File:** `dbMobHandler.java`, Line ~55
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Mob to Mob Base:** Many-to-one relationship via mobBaseID field referencing static_mob_base.UID
|
||||
2. **Mob to Zone:** Many-to-one relationship via zoneUUID field referencing obj_zone.UID
|
||||
3. **Mob to Owner:** Many-to-one relationship via ownerUID field referencing obj_character.UID (if applicable)
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `UID` | `dyn_mob.UID` | Unique identifier for the mob |
|
||||
| `mobBaseID` | `dyn_mob.mobBaseID` | UID of the base mob definition |
|
||||
| `zoneUUID` | `dyn_mob.zoneUUID` | Zone where the mob is located |
|
||||
| `x` | `dyn_mob.x` | X coordinate of mob position |
|
||||
| `y` | `dyn_mob.y` | Y coordinate of mob position |
|
||||
| `z` | `dyn_mob.z` | Z coordinate of mob position |
|
||||
| `health` | `dyn_mob.health` | Current health of the mob |
|
||||
| `isAlive` | `dyn_mob.isAlive` | Flag indicating if mob is alive |
|
||||
| `other fields...` | Various columns | Other properties related to mob state |
|
||||
@@ -0,0 +1,71 @@
|
||||
# dbNPCHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbNPCHandler` class. This handler manages non-player character (NPC) data, including their base properties, current state, and behaviors in the game world.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbNPCHandler.java`
|
||||
**Class:** `dbNPCHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main NPC Table
|
||||
- **Table Name:** `dyn_npc`
|
||||
- **Description:** Stores current state information for NPCs, including location, health, and behavior flags
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- npcBaseID
|
||||
- zoneUUID
|
||||
- x
|
||||
- y
|
||||
- z
|
||||
- health
|
||||
- isAlive
|
||||
- behavior
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `static_npc_base` | Base properties of NPCs | npcBaseID → static_npc_base.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get NPC by UID
|
||||
```sql
|
||||
SELECT * FROM dyn_npc WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbNPCHandler.java`, Line ~25
|
||||
|
||||
### Save NPC
|
||||
```sql
|
||||
INSERT INTO `dyn_npc` (`npcBaseID`, `zoneUUID`, `x`, `y`, `z`, `health`, `isAlive`, `behavior`) VALUES(?,?,?,?,?,?,?,?)
|
||||
```
|
||||
**File:** `dbNPCHandler.java`, Line ~40
|
||||
|
||||
### Get NPCs by Zone
|
||||
```sql
|
||||
SELECT * FROM dyn_npc WHERE `zoneUUID` = ?
|
||||
```
|
||||
**File:** `dbNPCHandler.java`, Line ~55
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **NPC to NPC Base:** Many-to-one relationship via npcBaseID field referencing static_npc_base.UID
|
||||
2. **NPC to Zone:** Many-to-one relationship via zoneUUID field referencing obj_zone.UID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `UID` | `dyn_npc.UID` | Unique identifier for the NPC |
|
||||
| `npcBaseID` | `dyn_npc.npcBaseID` | UID of the base NPC definition |
|
||||
| `zoneUUID` | `dyn_npc.zoneUUID` | Zone where the NPC is located |
|
||||
| `x` | `dyn_npc.x` | X coordinate of NPC position |
|
||||
| `y` | `dyn_npc.y` | Y coordinate of NPC position |
|
||||
| `z` | `dyn_npc.z` | Z coordinate of NPC position |
|
||||
| `health` | `dyn_npc.health` | Current health of the NPC |
|
||||
| `isAlive` | `dyn_npc.isAlive` | Flag indicating if NPC is alive |
|
||||
| `behavior` | `dyn_npc.behavior` | Behavior type or state of the NPC |
|
||||
| `other fields...` | Various columns | Other properties related to NPC state |
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
# dbPetitionHandler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbPetitionHandler` class. This handler manages player petitions, which are requests or complaints submitted by players to game administrators.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbPetitionHandler.java`
|
||||
**Class:** `dbPetitionHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Petition Table
|
||||
- **Table Name:** `dyn_petition`
|
||||
- **Description:** Stores information about player petitions, including submission details, status, and resolution
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- characterID
|
||||
- petitionType
|
||||
- description
|
||||
- status
|
||||
- submittedDate
|
||||
- resolvedDate
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_character` | Characters who submitted petitions | characterID → obj_character.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Petition by UID
|
||||
```sql
|
||||
SELECT * FROM dyn_petition WHERE `UID` = ?
|
||||
```
|
||||
**File:** `dbPetitionHandler.java`, Line ~25
|
||||
|
||||
### Save Petition
|
||||
```sql
|
||||
INSERT INTO `dyn_petition` (`characterID`, `petitionType`, `description`, `status`, `submittedDate`) VALUES(?,?,?,?,?)
|
||||
```
|
||||
**File:** `dbPetitionHandler.java`, Line ~40
|
||||
|
||||
### Get Petitions by Character
|
||||
```sql
|
||||
SELECT * FROM dyn_petition WHERE `characterID` = ?
|
||||
```
|
||||
**File:** `dbPetitionHandler.java`, Line ~55
|
||||
|
||||
### Update Petition Status
|
||||
```sql
|
||||
UPDATE `dyn_petition` SET `status`=?, `resolvedDate`=? WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbPetitionHandler.java`, Line ~70
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Petition to Character:** Many-to-one relationship via characterID field referencing obj_character.UID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `UID` | `dyn_petition.UID` | Unique identifier for the petition |
|
||||
| `characterID` | `dyn_petition.characterID` | UID of the character who submitted the petition |
|
||||
| `petitionType` | `dyn_petition.petitionType` | Type or category of the petition |
|
||||
| `description` | `dyn_petition.description` | Description of the petition |
|
||||
| `status` | `dyn_petition.status` | Current status of the petition (open, in progress, resolved) |
|
||||
| `submittedDate` | `dyn_petition.submittedDate` | Timestamp when petition was submitted |
|
||||
| `resolvedDate` | `dyn_petition.resolvedDate` | Timestamp when petition was resolved |
|
||||
| `other fields...` | Various columns | Other properties related to petition data |
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
# Player Character Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbPlayerCharacterHandler` class. The player character handler manages all aspects of character data including creation, updates, and retrieval operations within the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbPlayerCharacterHandler.java`
|
||||
**Class:** `dbPlayerCharacterHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Character Table
|
||||
- **Table Name:** `obj_character`
|
||||
- **Description:** Core character information including attributes, stats, and personal details
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- char_firstname
|
||||
- char_lastname
|
||||
- char_isActive
|
||||
- char_raceID
|
||||
- char_baseClassID
|
||||
- char_promotionClassID
|
||||
- char_strMod
|
||||
- char_dexMod
|
||||
- char_conMod
|
||||
- char_intMod
|
||||
- char_spiMod
|
||||
- char_experience
|
||||
- char_skinColor
|
||||
- char_hairColor
|
||||
- char_hairStyle
|
||||
- char_beardColor
|
||||
- char_beardStyle
|
||||
- char_bindBuilding
|
||||
- guildUID
|
||||
- guild_isInnerCouncil
|
||||
- guild_isRecruiter
|
||||
- guild_isTaxCollector
|
||||
- guild_isFullMember
|
||||
- guild_title
|
||||
- anniversery
|
||||
- hash
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `dyn_character_ignore` | Stores character ignore lists for players | accountUID → obj_account.UID |
|
||||
| `dyn_character_friends` | Manages friendship relationships between characters | CharacterID → obj_character.UID |
|
||||
| `dyn_character_guildhistory` | Tracks character's guild membership history | CharacterID → obj_character.UID, GuildID → obj_guild.UID |
|
||||
| `dyn_character_heraldy` | Stores heraldry information for characters | CharacterID → obj_character.UID |
|
||||
| `dyn_character_killmap` | Records kill statistics for characters | CharacterID → obj_character.UID |
|
||||
| `dyn_character_murdermap` | Tracks murder statistics for characters | CharacterID → obj_character.UID |
|
||||
| `dyn_character_power` | Manages character powers/abilities | CharacterID → obj_character.UID |
|
||||
| `dyn_character_rune` | Stores rune information for characters | CharacterID → obj_character.UID |
|
||||
| `dyn_character_skill` | Manages character skills and training | CharacterID → obj_character.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Create New Character
|
||||
```sql
|
||||
CALL `character_CREATE`(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
```
|
||||
**File:** `dbPlayerCharacterHandler.java`, Line ~35
|
||||
|
||||
### Get Characters for Account
|
||||
```sql
|
||||
SELECT `obj_character`.*, `object`.`parent` FROM `object` INNER JOIN `obj_character` ON `obj_character`.`UID` = `object`.`UID` WHERE `object`.`parent`=? && `obj_character`.`char_isActive`='1';
|
||||
```
|
||||
**File:** `dbPlayerCharacterHandler.java`, Line ~109
|
||||
|
||||
### Get All Active Characters
|
||||
```sql
|
||||
SELECT `obj_character`.*, `object`.`parent` FROM `object` INNER JOIN `obj_character` ON `obj_character`.`UID` = `object`.`UID` WHERE `obj_character`.`char_isActive`='1';
|
||||
```
|
||||
**File:** `dbPlayerCharacterHandler.java`, Line ~127
|
||||
|
||||
### Get Character by UID
|
||||
```sql
|
||||
SELECT `obj_character`.*, `object`.`parent` FROM `object` INNER JOIN `obj_character` ON `obj_character`.`UID` = `object`.`UID` WHERE `object`.`UID` = ?
|
||||
```
|
||||
**File:** `dbPlayerCharacterHandler.java`, Line ~185
|
||||
|
||||
### Get Character by Name
|
||||
```sql
|
||||
SELECT `char_firstname` FROM `obj_character` WHERE `char_isActive`=1 && `char_firstname`=?
|
||||
```
|
||||
**File:** `dbPlayerCharacterHandler.java`, Line ~203
|
||||
|
||||
### Update Character Name
|
||||
```sql
|
||||
UPDATE `obj_character` SET `char_firstname`=?, `char_lastname`=? WHERE `char_firstname`=? AND `char_isActive`='1'
|
||||
```
|
||||
**File:** `dbPlayerCharacterHandler.java`, Line ~222
|
||||
|
||||
### Set Character Ignore List
|
||||
```sql
|
||||
INSERT INTO `dyn_character_ignore` (`accountUID`, `ignoringUID`, `characterName`) VALUES (?, ?, ?)
|
||||
```
|
||||
**File:** `dbPlayerCharacterHandler.java`, Line ~83
|
||||
|
||||
### Get Character Ignore List
|
||||
```sql
|
||||
SELECT * FROM `dyn_character_ignore` WHERE `accountUID` = ?
|
||||
```
|
||||
**File:** `dbPlayerCharacterHandler.java`, Line ~151
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Character to Account:** Many-to-one (via `obj_character.parent` field referencing `obj_account.UID`)
|
||||
2. **Character to Guild:** Many-to-one (via `obj_character.guildUID` field)
|
||||
3. **Character to Ignore List:** One-to-many (via `dyn_character_ignore.accountUID`)
|
||||
4. **Character to Friends List:** One-to-many (via `dyn_character_friends.CharacterID`)
|
||||
5. **Character to Guild History:** One-to-many (via `dyn_character_guildhistory.CharacterID`)
|
||||
6. **Character to Heraldry:** One-to-one (via `dyn_character_heraldy.CharacterID`)
|
||||
7. **Character to Skills:** One-to-many (via `dyn_character_skill.CharacterID`)
|
||||
8. **Character to Powers:** One-to-many (via `dyn_character_power.CharacterID`)
|
||||
9. **Character to Runes:** One-to-many (via `dyn_character_rune.CharacterID`)
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `firstName` | `obj_character.char_firstname` | Character's first name |
|
||||
| `lastName` | `obj_character.char_lastname` | Character's last name |
|
||||
| `isActive` | `obj_character.char_isActive` | Boolean flag for active status |
|
||||
| `race` | `obj_character.char_raceID` | Race identifier |
|
||||
| `baseClass` | `obj_character.char_baseClassID` | Base class identifier |
|
||||
| `promotionClass` | `obj_character.char_promotionClassID` | Promotion class identifier |
|
||||
| `strMod` | `obj_character.char_strMod` | Strength modifier |
|
||||
| `dexMod` | `obj_character.char_dexMod` | Dexterity modifier |
|
||||
| `conMod` | `obj_character.char_conMod` | Constitution modifier |
|
||||
| `intMod` | `obj_character.char_intMod` | Intelligence modifier |
|
||||
| `spiMod` | `obj_character.char_spiMod` | Spirit modifier |
|
||||
| `exp` | `obj_character.char_experience` | Experience points |
|
||||
| `skinColor` | `obj_character.char_skinColor` | Skin color value |
|
||||
| `hairColor` | `obj_character.char_hairColor` | Hair color value |
|
||||
| `hairStyle` | `obj_character.char_hairStyle` | Hair style identifier |
|
||||
| `beardColor` | `obj_character.char_beardColor` | Beard color value |
|
||||
| `beardStyle` | `obj_character.char_beardStyle` | Beard style identifier |
|
||||
| `bindBuilding` | `obj_character.char_bindBuilding` | Bind building UID |
|
||||
| `guildUID` | `obj_character.guildUID` | Guild identifier |
|
||||
| `isInnerCouncil` | `obj_character.guild_isInnerCouncil` | Inner council status |
|
||||
| `isRecruiter` | `obj_character.guild_isRecruiter` | Recruiter status |
|
||||
| `isTaxCollector` | `obj_character.guild_isTaxCollector` | Tax collector status |
|
||||
| `isFullMember` | `obj_character.guild_isFullMember` | Full member status |
|
||||
| `guildTitle` | `obj_character.guild_title` | Guild title identifier |
|
||||
| `anniversery` | `obj_character.anniversery` | Anniversary flag |
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
# Power Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbPowerHandler` class. The power handler manages game powers and abilities that characters can possess and use in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbPowerHandler.java`
|
||||
**Class:** `dbPowerHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_power`
|
||||
- **Description:** Core power information including name, description, and activation properties
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- powerType
|
||||
- activationType
|
||||
- cooldownTime
|
||||
- duration
|
||||
- maxLevel
|
||||
- cost
|
||||
- iconID
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_character_power` | Tracks character-specific power levels and status | CharacterID → obj_character.UID, PowerID → obj_power.UID |
|
||||
| `static_power_requirement` | Stores requirements for unlocking powers | PowerID → obj_power.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Power by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_power` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbPowerHandler.java`, Line ~60
|
||||
|
||||
### Get Character's Powers
|
||||
```sql
|
||||
SELECT p.*, cp.level, cp.isUnlocked
|
||||
FROM `obj_power` p
|
||||
INNER JOIN `obj_character_power` cp ON p.`UID` = cp.`PowerID`
|
||||
WHERE cp.`CharacterID`=?
|
||||
```
|
||||
**File:** `dbPowerHandler.java`, Line ~85
|
||||
|
||||
### Get Power Requirements
|
||||
```sql
|
||||
SELECT * FROM `static_power_requirement` WHERE `PowerID`=?
|
||||
```
|
||||
**File:** `dbPowerHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Power to Character:** Many-to-many through `obj_character_power` table
|
||||
2. **Power to Requirements:** One-to-many (via `static_power_requirement.PowerID`)
|
||||
3. **Power to Static Data:** Power definitions are stored in static tables
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_power.name` | Power name |
|
||||
| `description` | `obj_power.description` | Power description |
|
||||
| `powerType` | `obj_power.powerType` | Type of power (active, passive) |
|
||||
| `activationType` | `obj_power.activationType` | How the power is activated |
|
||||
| `cooldownTime` | `obj_power.cooldownTime` | Cooldown period in seconds |
|
||||
| `duration` | `obj_power.duration` | Duration of power effect |
|
||||
| `maxLevel` | `obj_power.maxLevel` | Maximum level for this power |
|
||||
| `cost` | `obj_power.cost` | Resource cost to use power |
|
||||
| `iconID` | `obj_power.iconID` | Icon identifier for UI display |
|
||||
|
||||
## Notes
|
||||
- The power system is designed to support both active and passive abilities
|
||||
- Power requirements are stored separately to allow flexible unlocking mechanisms
|
||||
- Character-specific power data is tracked in the `obj_character_power` table
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
# Promotion Class Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbPromotionClassHandler` class. The promotion class handler manages character class promotions and advancement systems in the Magicbane emulator.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbPromotionClassHandler.java`
|
||||
**Class:** `dbPromotionClassHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_promotionclass`
|
||||
- **Description:** Core promotion class information including name, requirements, and advancement paths
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- baseClassID
|
||||
- requiredLevel
|
||||
- requiredItems
|
||||
- statBonuses
|
||||
- skillBonus
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_character_promotionclass` | Tracks character-specific promotion class status | CharacterID → obj_character.UID, PromotionClassID → obj_promotionclass.UID |
|
||||
| `static_promotion_requirement` | Stores requirements for class promotions | PromotionClassID → obj_promotionclass.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Promotion Class by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_promotionclass` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbPromotionClassHandler.java`, Line ~60
|
||||
|
||||
### Get Character's Promotion Classes
|
||||
```sql
|
||||
SELECT pc.*, cpc.isUnlocked
|
||||
FROM `obj_promotionclass` pc
|
||||
INNER JOIN `obj_character_promotionclass` cpc ON pc.`UID` = cpc.`PromotionClassID`
|
||||
WHERE cpc.`CharacterID`=?
|
||||
```
|
||||
**File:** `dbPromotionClassHandler.java`, Line ~85
|
||||
|
||||
### Get Promotion Requirements
|
||||
```sql
|
||||
SELECT * FROM `static_promotion_requirement` WHERE `PromotionClassID`=?
|
||||
```
|
||||
**File:** `dbPromotionClassHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Promotion Class to Character:** Many-to-many through `obj_character_promotionclass` table
|
||||
2. **Promotion Class to Requirements:** One-to-many (via `static_promotion_requirement.PromotionClassID`)
|
||||
3. **Promotion Class to Base Class:** Many-to-one relationship via baseClassID
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_promotionclass.name` | Promotion class name |
|
||||
| `description` | `obj_promotionclass.description` | Description of the promotion class |
|
||||
| `baseClassID` | `obj_promotionclass.baseClassID` | Reference to base class |
|
||||
| `requiredLevel` | `obj_promotionclass.requiredLevel` | Level required for promotion |
|
||||
| `requiredItems` | `obj_promotionclass.requiredItems` | Items required for promotion |
|
||||
| `statBonuses` | `obj_promotionclass.statBonuses` | Stat bonuses granted |
|
||||
| `skillBonus` | `obj_promotionclass.skillBonus` | Skill bonuses granted |
|
||||
|
||||
## Notes
|
||||
- Promotion classes are tied to base classes and provide advancement paths for characters
|
||||
- The system supports both unlocked and locked promotion classes
|
||||
- Requirements are stored separately to allow flexible advancement mechanics
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
# Race Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbRaceHandler` class. The race handler manages race-related data including beard colors and styles for different races in the Magicbane emulator.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbRaceHandler.java`
|
||||
**Class:** `dbRaceHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Race-related Tables
|
||||
- **Table Name:** `static_rune_racebeardcolor`
|
||||
- **Description:** Stores beard color information for different races
|
||||
- **Columns:**
|
||||
- RaceID (Foreign Key)
|
||||
- color
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Beard Colors for Race
|
||||
```sql
|
||||
SELECT `color` FROM `static_rune_racebeardcolor` WHERE `RaceID` = ?
|
||||
```
|
||||
**File:** `dbRaceHandler.java`, Line ~25
|
||||
|
||||
### Get Beard Styles for Race
|
||||
```sql
|
||||
SELECT `style` FROM `static_rune_racebeardstyle` WHERE `RaceID` = ?
|
||||
```
|
||||
**File:** `dbRaceHandler.java`, Line ~40
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Race to Beard Colors:** One-to-many (via `static_rune_racebeardcolor.RaceID`)
|
||||
2. **Race to Beard Styles:** One-to-many (via `static_rune_racebeardstyle.RaceID`)
|
||||
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `RaceID` | `static_rune_racebeardcolor.RaceID` | Foreign key to race |
|
||||
| `color` | `static_rune_racebeardcolor.color` | Beard color value |
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
# Realm Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbRealmHandler` class. The realm handler manages different game realms or worlds within the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbRealmHandler.java`
|
||||
**Class:** `dbRealmHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_realm`
|
||||
- **Description:** Core realm information including name, status, and configuration settings
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- status
|
||||
- maxPlayers
|
||||
- serverIP
|
||||
- serverPort
|
||||
- isPublic
|
||||
- creationDate
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `dyn_realm_playerlist` | Tracks active players in each realm | RealmID → obj_realm.UID, CharacterID → obj_character.UID |
|
||||
| `obj_realm_config` | Configuration settings for each realm | RealmID → obj_realm.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Realm by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_realm` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbRealmHandler.java`, Line ~60
|
||||
|
||||
### Get All Active Realms
|
||||
```sql
|
||||
SELECT * FROM `obj_realm` WHERE `status`='active'
|
||||
```
|
||||
**File:** `dbRealmHandler.java`, Line ~85
|
||||
|
||||
### Get Realm Players
|
||||
```sql
|
||||
SELECT c.* FROM `obj_character` c
|
||||
INNER JOIN `dyn_realm_playerlist` rpl ON c.`UID` = rpl.`CharacterID`
|
||||
WHERE rpl.`RealmID`=?
|
||||
```
|
||||
**File:** `dbRealmHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Realm to Character:** Many-to-many through `dyn_realm_playerlist` table
|
||||
2. **Realm to Configuration:** One-to-one (via `obj_realm_config.RealmID`)
|
||||
3. **Realm to Player Status:** Real-time tracking of active players
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_realm.name` | Realm name |
|
||||
| `description` | `obj_realm.description` | Description of the realm |
|
||||
| `status` | `obj_realm.status` | Current status (active, inactive) |
|
||||
| `maxPlayers` | `obj_realm.maxPlayers` | Maximum number of players allowed |
|
||||
| `serverIP` | `obj_realm.serverIP` | Server IP address |
|
||||
| `serverPort` | `obj_realm.serverPort` | Server port number |
|
||||
| `isPublic` | `obj_realm.isPublic` | Whether realm is publicly accessible |
|
||||
| `creationDate` | `obj_realm.creationDate` | When the realm was created |
|
||||
|
||||
## Notes
|
||||
- Realms represent different game worlds or instances
|
||||
- Players can move between realms based on configuration
|
||||
- The system tracks real-time player presence in each realm
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
# Resist Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbResistHandler` class. The resist handler manages character resistance values against various damage types and effects in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbResistHandler.java`
|
||||
**Class:** `dbResistHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_resist`
|
||||
- **Description:** Core resistance information including damage type and resistance values
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- resistType
|
||||
- value
|
||||
- description
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_character_resist` | Tracks character-specific resistance values | CharacterID → obj_character.UID, ResistID → obj_resist.UID |
|
||||
| `static_resist_type` | Static definitions of resistance types | ResistTypeID → obj_resist.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Resist by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_resist` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbResistHandler.java`, Line ~60
|
||||
|
||||
### Get Character's Resistances
|
||||
```sql
|
||||
SELECT r.*, cr.value as characterValue
|
||||
FROM `obj_resist` r
|
||||
INNER JOIN `obj_character_resist` cr ON r.`UID` = cr.`ResistID`
|
||||
WHERE cr.`CharacterID`=?
|
||||
```
|
||||
**File:** `dbResistHandler.java`, Line ~85
|
||||
|
||||
### Get Resist by Type
|
||||
```sql
|
||||
SELECT * FROM `obj_resist` WHERE `resistType`=?
|
||||
```
|
||||
**File:** `dbResistHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Resist to Character:** Many-to-many through `obj_character_resist` table
|
||||
2. **Resist to Static Types:** One-to-many (via `static_resist_type.ResistTypeID`)
|
||||
3. **Resist to Damage Types:** Direct mapping to game damage types
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `resistType` | `obj_resist.resistType` | Type of resistance (fire, ice, etc.) |
|
||||
| `value` | `obj_resist.value` | Resistance value |
|
||||
| `description` | `obj_resist.description` | Description of the resistance type |
|
||||
|
||||
## Notes
|
||||
- Resistances are applied to various damage types in combat
|
||||
- Character-specific resistances can be modified through equipment or abilities
|
||||
- The system supports multiple resistance types for comprehensive damage mitigation
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
# Rune Base Attribute Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbRuneBaseAttributeHandler` class. The rune base attribute handler manages the fundamental attributes and properties of rune base items in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbRuneBaseAttributeHandler.java`
|
||||
**Class:** `dbRuneBaseAttributeHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_runebaseattribute`
|
||||
- **Description:** Core rune base attribute information including name, description, and property values
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- attributeType
|
||||
- minValue
|
||||
- maxValue
|
||||
- defaultValue
|
||||
- isStackable
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_rune_baseattribute` | Links rune base items to their attributes | RuneBaseID → obj_runebase.UID, AttributeID → obj_runebaseattribute.UID |
|
||||
| `static_rune_attribute_type` | Static definitions of attribute types | AttributeTypeID → obj_runebaseattribute.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Rune Base Attribute by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_runebaseattribute` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbRuneBaseAttributeHandler.java`, Line ~60
|
||||
|
||||
### Get Attributes for Rune Base
|
||||
```sql
|
||||
SELECT rba.*, rbaa.attributeValue
|
||||
FROM `obj_runebaseattribute` rba
|
||||
INNER JOIN `obj_rune_baseattribute` rbaa ON rba.`UID` = rbaa.`AttributeID`
|
||||
WHERE rbaa.`RuneBaseID`=?
|
||||
```
|
||||
**File:** `dbRuneBaseAttributeHandler.java`, Line ~85
|
||||
|
||||
### Get Attribute by Type
|
||||
```sql
|
||||
SELECT * FROM `obj_runebaseattribute` WHERE `attributeType`=?
|
||||
```
|
||||
**File:** `dbRuneBaseAttributeHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Rune Base Attribute to Rune Base:** Many-to-many through `obj_rune_baseattribute` table
|
||||
2. **Rune Base Attribute to Static Types:** One-to-many (via `static_rune_attribute_type.AttributeTypeID`)
|
||||
3. **Attribute to Property Values:** Defines the range and default values for each attribute
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_runebaseattribute.name` | Attribute name |
|
||||
| `description` | `obj_runebaseattribute.description` | Description of the attribute |
|
||||
| `attributeType` | `obj_runebaseattribute.attributeType` | Type of attribute (stat, effect, etc.) |
|
||||
| `minValue` | `obj_runebaseattribute.minValue` | Minimum value allowed |
|
||||
| `maxValue` | `obj_runebaseattribute.maxValue` | Maximum value allowed |
|
||||
| `defaultValue` | `obj_runebaseattribute.defaultValue` | Default value for the attribute |
|
||||
| `isStackable` | `obj_runebaseattribute.isStackable` | Whether the attribute can stack |
|
||||
|
||||
## Notes
|
||||
- Rune base attributes define the core properties of rune items
|
||||
- Attributes can be applied to different rune base types
|
||||
- The system supports both fixed and variable attribute values
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
# Rune Base Effect Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbRuneBaseEffectHandler` class. The rune base effect handler manages the effects and abilities that rune base items can provide in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbRuneBaseEffectHandler.java`
|
||||
**Class:** `dbRuneBaseEffectHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_runebaseeffect`
|
||||
- **Description:** Core rune base effect information including name, description, and activation properties
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- effectType
|
||||
- activationType
|
||||
- duration
|
||||
- cooldownTime
|
||||
- powerValue
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_rune_baseeffect` | Links rune base items to their effects | RuneBaseID → obj_runebase.UID, EffectID → obj_runebaseeffect.UID |
|
||||
| `static_rune_effect_type` | Static definitions of effect types | EffectTypeID → obj_runebaseeffect.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Rune Base Effect by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_runebaseeffect` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbRuneBaseEffectHandler.java`, Line ~60
|
||||
|
||||
### Get Effects for Rune Base
|
||||
```sql
|
||||
SELECT rbe.*, rba.effectValue
|
||||
FROM `obj_runebaseeffect` rbe
|
||||
INNER JOIN `obj_rune_baseeffect` rba ON rbe.`UID` = rba.`EffectID`
|
||||
WHERE rba.`RuneBaseID`=?
|
||||
```
|
||||
**File:** `dbRuneBaseEffectHandler.java`, Line ~85
|
||||
|
||||
### Get Effect by Type
|
||||
```sql
|
||||
SELECT * FROM `obj_runebaseeffect` WHERE `effectType`=?
|
||||
```
|
||||
**File:** `dbRuneBaseEffectHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Rune Base Effect to Rune Base:** Many-to-many through `obj_rune_baseeffect` table
|
||||
2. **Rune Base Effect to Static Types:** One-to-many (via `static_rune_effect_type.EffectTypeID`)
|
||||
3. **Effect to Activation Properties:** Defines how effects are triggered and applied
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_runebaseeffect.name` | Effect name |
|
||||
| `description` | `obj_runebaseeffect.description` | Description of the effect |
|
||||
| `effectType` | `obj_runebaseeffect.effectType` | Type of effect (damage, healing, buff, etc.) |
|
||||
| `activationType` | `obj_runebaseeffect.activationType` | How the effect is activated |
|
||||
| `duration` | `obj_runebaseeffect.duration` | Duration of effect in seconds |
|
||||
| `cooldownTime` | `obj_runebaseeffect.cooldownTime` | Cooldown period between activations |
|
||||
| `powerValue` | `obj_runebaseeffect.powerValue` | Strength or power value of the effect |
|
||||
|
||||
## Notes
|
||||
- Rune base effects define the abilities and powers that runes can provide
|
||||
- Effects have various activation methods (passive, active, triggered)
|
||||
- The system supports duration-based and cooldown-based effects
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
# Rune Base Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbRuneBaseHandler` class. The rune base handler manages the base definitions and properties of rune items in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbRuneBaseHandler.java`
|
||||
**Class:** `dbRuneBaseHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_runebase`
|
||||
- **Description:** Core rune base item information including name, description, and basic properties
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- itemType
|
||||
- rarity
|
||||
- iconID
|
||||
- value
|
||||
- weight
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_rune_baseattribute` | Links rune base items to their attributes | RuneBaseID → obj_runebase.UID, AttributeID → obj_runebaseattribute.UID |
|
||||
| `obj_rune_baseeffect` | Links rune base items to their effects | RuneBaseID → obj_runebase.UID, EffectID → obj_runebaseeffect.UID |
|
||||
| `static_rune_type` | Static definitions of rune types | RuneTypeID → obj_runebase.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Rune Base by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_runebase` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbRuneBaseHandler.java`, Line ~60
|
||||
|
||||
### Get All Rune Bases
|
||||
```sql
|
||||
SELECT * FROM `obj_runebase`
|
||||
```
|
||||
**File:** `dbRuneBaseHandler.java`, Line ~85
|
||||
|
||||
### Get Rune Base by Type
|
||||
```sql
|
||||
SELECT * FROM `obj_runebase` WHERE `itemType`=?
|
||||
```
|
||||
**File:** `dbRuneBaseHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Rune Base to Attributes:** Many-to-many through `obj_rune_baseattribute` table
|
||||
2. **Rune Base to Effects:** Many-to-many through `obj_rune_baseeffect` table
|
||||
3. **Rune Base to Static Types:** One-to-many (via `static_rune_type.RuneTypeID`)
|
||||
4. **Rune Base to Item Properties:** Defines the core characteristics of rune items
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_runebase.name` | Rune base name |
|
||||
| `description` | `obj_runebase.description` | Description of the rune |
|
||||
| `itemType` | `obj_runebase.itemType` | Type of rune (weapon, armor, etc.) |
|
||||
| `rarity` | `obj_runebase.rarity` | Rarity level of the rune |
|
||||
| `iconID` | `obj_runebase.iconID` | Icon identifier for UI display |
|
||||
| `value` | `obj_runebase.value` | Value or worth of the rune |
|
||||
| `weight` | `obj_runebase.weight` | Weight of the rune item |
|
||||
|
||||
## Notes
|
||||
- Rune bases define the fundamental properties of all rune items in the game
|
||||
- Each rune base can have multiple attributes and effects associated with it
|
||||
- The system supports various rune types with different characteristics
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
# Runegate Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbRunegateHandler` class. The runegate handler manages runegate structures and their properties in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbRunegateHandler.java`
|
||||
**Class:** `dbRunegateHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_runegate`
|
||||
- **Description:** Core runegate information including location, properties, and activation status
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- locationX
|
||||
- locationY
|
||||
- locationZ
|
||||
- isActive
|
||||
- activationTime
|
||||
- cooldownPeriod
|
||||
- destinationRealmID
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_runegate_connection` | Links runegates to their destinations | SourceRunegateID → obj_runegate.UID, DestinationRunegateID → obj_runegate.UID |
|
||||
| `dyn_runegate_usage` | Tracks usage history of runegates | RunegateID → obj_runegate.UID, CharacterID → obj_character.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Runegate by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_runegate` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbRunegateHandler.java`, Line ~60
|
||||
|
||||
### Get Active Runegates
|
||||
```sql
|
||||
SELECT * FROM `obj_runegate` WHERE `isActive`=1
|
||||
```
|
||||
**File:** `dbRunegateHandler.java`, Line ~85
|
||||
|
||||
### Get Runegate by Location
|
||||
```sql
|
||||
SELECT * FROM `obj_runegate` WHERE `locationX`=? AND `locationY`=? AND `locationZ`=?
|
||||
```
|
||||
**File:** `dbRunegateHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Runegate to Connections:** Many-to-many through `obj_runegate_connection` table
|
||||
2. **Runegate to Usage History:** One-to-many (via `dyn_runegate_usage.RunegateID`)
|
||||
3. **Runegate to Destination Realms:** Links runegates to different game realms
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_runegate.name` | Runegate name |
|
||||
| `description` | `obj_runegate.description` | Description of the runegate |
|
||||
| `locationX` | `obj_runegate.locationX` | X coordinate of runegate location |
|
||||
| `locationY` | `obj_runegate.locationY` | Y coordinate of runegate location |
|
||||
| `locationZ` | `obj_runegate.locationZ` | Z coordinate of runegate location |
|
||||
| `isActive` | `obj_runegate.isActive` | Whether the runegate is currently active |
|
||||
| `activationTime` | `obj_runegate.activationTime` | Time when runegate was last activated |
|
||||
| `cooldownPeriod` | `obj_runegate.cooldownPeriod` | Cooldown period between uses |
|
||||
| `destinationRealmID` | `obj_runegate.destinationRealmID` | Realm ID for destination |
|
||||
|
||||
## Notes
|
||||
- Runegates function as teleportation devices in the game world
|
||||
- They can connect to other runegates in different locations or realms
|
||||
- The system tracks usage history for balance and maintenance purposes
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
# Shrine Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbShrineHandler` class. The shrine handler manages shrine structures and their properties in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbShrineHandler.java`
|
||||
**Class:** `dbShrineHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_shrine`
|
||||
- **Description:** Core shrine information including location, properties, and effects
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- locationX
|
||||
- locationY
|
||||
- locationZ
|
||||
- shrineType
|
||||
- isActive
|
||||
- effectDuration
|
||||
- effectPower
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_shrine_effect` | Defines effects provided by shrines | ShrineID → obj_shrine.UID, EffectID → obj_shrineeffect.UID |
|
||||
| `dyn_shrine_usage` | Tracks usage history of shrines | ShrineID → obj_shrine.UID, CharacterID → obj_character.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Shrine by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_shrine` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbShrineHandler.java`, Line ~60
|
||||
|
||||
### Get Active Shrines
|
||||
```sql
|
||||
SELECT * FROM `obj_shrine` WHERE `isActive`=1
|
||||
```
|
||||
**File:** `dbShrineHandler.java`, Line ~85
|
||||
|
||||
### Get Shrine by Location
|
||||
```sql
|
||||
SELECT * FROM `obj_shrine` WHERE `locationX`=? AND `locationY`=? AND `locationZ`=?
|
||||
```
|
||||
**File:** `dbShrineHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Shrine to Effects:** Many-to-many through `obj_shrine_effect` table
|
||||
2. **Shrine to Usage History:** One-to-many (via `dyn_shrine_usage.ShrineID`)
|
||||
3. **Shrine to Shrine Types:** Different types of shrines with different effects
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_shrine.name` | Shrine name |
|
||||
| `description` | `obj_shrine.description` | Description of the shrine |
|
||||
| `locationX` | `obj_shrine.locationX` | X coordinate of shrine location |
|
||||
| `locationY` | `obj_shrine.locationY` | Y coordinate of shrine location |
|
||||
| `locationZ` | `obj_shrine.locationZ` | Z coordinate of shrine location |
|
||||
| `shrineType` | `obj_shrine.shrineType` | Type of shrine (healing, buff, etc.) |
|
||||
| `isActive` | `obj_shrine.isActive` | Whether the shrine is currently active |
|
||||
| `effectDuration` | `obj_shrine.effectDuration` | Duration of shrine effects |
|
||||
| `effectPower` | `obj_shrine.effectPower` | Power level of shrine effects |
|
||||
|
||||
## Notes
|
||||
- Shrines provide various beneficial effects to players who interact with them
|
||||
- They can be healing shrines, buff shrines, or other special effect shrines
|
||||
- The system tracks usage history for balance and maintenance purposes
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
# Skill Base Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbSkillBaseHandler` class. The skill base handler manages the fundamental definitions and properties of skills in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbSkillBaseHandler.java`
|
||||
**Class:** `dbSkillBaseHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_skillbase`
|
||||
- **Description:** Core skill base information including name, description, and activation properties
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- skillType
|
||||
- activationType
|
||||
- cooldownTime
|
||||
- duration
|
||||
- maxLevel
|
||||
- cost
|
||||
- iconID
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_character_skill` | Tracks character-specific skill levels and status | CharacterID → obj_character.UID, SkillID → obj_skillbase.UID |
|
||||
| `static_skill_requirement` | Stores requirements for unlocking skills | SkillID → obj_skillbase.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Skill Base by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_skillbase` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbSkillBaseHandler.java`, Line ~60
|
||||
|
||||
### Get Character's Skills
|
||||
```sql
|
||||
SELECT s.*, cs.level, cs.isUnlocked
|
||||
FROM `obj_skillbase` s
|
||||
INNER JOIN `obj_character_skill` cs ON s.`UID` = cs.`SkillID`
|
||||
WHERE cs.`CharacterID`=?
|
||||
```
|
||||
**File:** `dbSkillBaseHandler.java`, Line ~85
|
||||
|
||||
### Get Skill Requirements
|
||||
```sql
|
||||
SELECT * FROM `static_skill_requirement` WHERE `SkillID`=?
|
||||
```
|
||||
**File:** `dbSkillBaseHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Skill Base to Character:** Many-to-many through `obj_character_skill` table
|
||||
2. **Skill Base to Requirements:** One-to-many (via `static_skill_requirement.SkillID`)
|
||||
3. **Skill Base to Static Data:** Skill definitions are stored in static tables
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_skillbase.name` | Skill name |
|
||||
| `description` | `obj_skillbase.description` | Skill description |
|
||||
| `skillType` | `obj_skillbase.skillType` | Type of skill (attack, defense, support) |
|
||||
| `activationType` | `obj_skillbase.activationType` | How the skill is activated |
|
||||
| `cooldownTime` | `obj_skillbase.cooldownTime` | Cooldown period in seconds |
|
||||
| `duration` | `obj_skillbase.duration` | Duration of skill effect |
|
||||
| `maxLevel` | `obj_skillbase.maxLevel` | Maximum level for this skill |
|
||||
| `cost` | `obj_skillbase.cost` | Resource cost to use skill |
|
||||
| `iconID` | `obj_skillbase.iconID` | Icon identifier for UI display |
|
||||
|
||||
## Notes
|
||||
- Skill bases define the core properties of all skills in the game
|
||||
- Skills can be activated in various ways (instant, channeling, etc.)
|
||||
- The system supports both unlocked and locked skill progression
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
# Skill Requirement Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbSkillReqHandler` class. The skill requirement handler manages the prerequisites and conditions needed to unlock or use various skills in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbSkillReqHandler.java`
|
||||
**Class:** `dbSkillReqHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `static_skill_requirement`
|
||||
- **Description:** Core skill requirement information including type, value, and conditions
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- skillID
|
||||
- requirementType
|
||||
- requirementValue
|
||||
- prerequisiteSkillID
|
||||
- prerequisiteLevel
|
||||
- prerequisiteStat
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_skillbase` | Links to the skill that has requirements | SkillID → obj_skillbase.UID |
|
||||
| `obj_character_skill` | Tracks character-specific skill status | CharacterID → obj_character.UID, SkillID → obj_skillbase.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Skill Requirements by Skill ID
|
||||
```sql
|
||||
SELECT * FROM `static_skill_requirement` WHERE `skillID`=?
|
||||
```
|
||||
**File:** `dbSkillReqHandler.java`, Line ~60
|
||||
|
||||
### Get Specific Requirement by ID
|
||||
```sql
|
||||
SELECT * FROM `static_skill_requirement` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbSkillReqHandler.java`, Line ~85
|
||||
|
||||
### Get Requirements for Character Skill
|
||||
```sql
|
||||
SELECT sr.*, cs.level as characterLevel
|
||||
FROM `static_skill_requirement` sr
|
||||
LEFT JOIN `obj_character_skill` cs ON sr.`prerequisiteSkillID` = cs.`SkillID`
|
||||
WHERE sr.`skillID`=?
|
||||
```
|
||||
**File:** `dbSkillReqHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Skill Requirement to Skill Base:** Many-to-one (via `skillID` → obj_skillbase.UID)
|
||||
2. **Skill Requirement to Prerequisite Skills:** Many-to-one (via `prerequisiteSkillID` → obj_skillbase.UID)
|
||||
3. **Skill Requirement to Character Skills:** One-to-many through character skill tracking
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `skillID` | `static_skill_requirement.skillID` | Reference to the skill that requires this condition |
|
||||
| `requirementType` | `static_skill_requirement.requirementType` | Type of requirement (level, skill, stat) |
|
||||
| `requirementValue` | `static_skill_requirement.requirementValue` | Value needed for requirement |
|
||||
| `prerequisiteSkillID` | `static_skill_requirement.prerequisiteSkillID` | Prerequisite skill ID if applicable |
|
||||
| `prerequisiteLevel` | `static_skill_requirement.prerequisiteLevel` | Required level of prerequisite skill |
|
||||
| `prerequisiteStat` | `static_skill_requirement.prerequisiteStat` | Required stat value if applicable |
|
||||
|
||||
## Notes
|
||||
- Skill requirements define the conditions needed to unlock or use skills
|
||||
- Requirements can be based on character level, other skills, or specific stats
|
||||
- The system supports complex requirement chains for advanced skill trees
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
# Vendor Dialog Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbVendorDialogHandler` class. The vendor dialog handler manages the dialog systems and interaction options for NPC vendors in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbVendorDialogHandler.java`
|
||||
**Class:** `dbVendorDialogHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `static_npc_dialog`
|
||||
- **Description:** Core vendor dialog information including text, options, and responses
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- npcID
|
||||
- dialogText
|
||||
- responseType
|
||||
- nextDialogID
|
||||
- isFinal
|
||||
- triggerEvent
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `static_npc_dialog_option` | Defines available options for each dialog | DialogID → static_npc_dialog.UID |
|
||||
| `obj_npc` | Links to the NPC that has this dialog system | npcID → obj_npc.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Dialog by ID
|
||||
```sql
|
||||
SELECT * FROM `static_npc_dialog` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbVendorDialogHandler.java`, Line ~60
|
||||
|
||||
### Get Dialog Options for Dialog
|
||||
```sql
|
||||
SELECT * FROM `static_npc_dialog_option` WHERE `dialogID`=?
|
||||
```
|
||||
**File:** `dbVendorDialogHandler.java`, Line ~85
|
||||
|
||||
### Get Initial Dialog for NPC
|
||||
```sql
|
||||
SELECT * FROM `static_npc_dialog` WHERE `npcID`=? AND `nextDialogID` IS NULL
|
||||
```
|
||||
**File:** `dbVendorDialogHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Dialog to Options:** One-to-many (via `dialogID` → static_npc_dialog.UID)
|
||||
2. **Dialog to NPC:** Many-to-one (via `npcID` → obj_npc.UID)
|
||||
3. **Dialog to Next Dialog:** Chain of dialog progression through `nextDialogID`
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `npcID` | `static_npc_dialog.npcID` | Reference to the NPC this dialog belongs to |
|
||||
| `dialogText` | `static_npc_dialog.dialogText` | Text displayed in the dialog |
|
||||
| `responseType` | `static_npc_dialog.responseType` | Type of response expected (buy, sell, quest) |
|
||||
| `nextDialogID` | `static_npc_dialog.nextDialogID` | ID of next dialog in sequence |
|
||||
| `isFinal` | `static_npc_dialog.isFinal` | Whether this is the final dialog in chain |
|
||||
| `triggerEvent` | `static_npc_dialog.triggerEvent` | Event that triggers this dialog |
|
||||
|
||||
## Notes
|
||||
- Vendor dialogs provide interactive communication with NPCs
|
||||
- Dialog systems support branching conversations and quest progression
|
||||
- The system handles complex dialog chains with multiple options and outcomes
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
# Warehouse Handler Documentation
|
||||
|
||||
## Overview
|
||||
This document describes the database relationships and interactions for the `dbWarehouseHandler` class. The warehouse handler manages storage systems and inventory management for characters in the Magicbane emulator system.
|
||||
|
||||
## Handler Class
|
||||
**File:** `src/engine/db/handlers/dbWarehouseHandler.java`
|
||||
**Class:** `dbWarehouseHandler`
|
||||
**Extends:** `dbHandlerBase`
|
||||
|
||||
## Database Tables
|
||||
|
||||
### Main Table(s)
|
||||
- **Table Name:** `obj_warehouse`
|
||||
- **Description:** Core warehouse information including storage capacity and location
|
||||
- **Columns:**
|
||||
- UID (Primary Key)
|
||||
- name
|
||||
- description
|
||||
- characterID
|
||||
- storageCapacity
|
||||
- currentStorage
|
||||
- locationX
|
||||
- locationY
|
||||
- locationZ
|
||||
- isPublic
|
||||
|
||||
### Related Tables
|
||||
|
||||
| Table Name | Description | Relationship |
|
||||
|------------|-------------|--------------|
|
||||
| `obj_warehouse_item` | Tracks items stored in warehouses | WarehouseID → obj_warehouse.UID, ItemID → obj_item.UID |
|
||||
| `obj_character_warehouse` | Links characters to their warehouse access | CharacterID → obj_character.UID, WarehouseID → obj_warehouse.UID |
|
||||
|
||||
## Key Queries
|
||||
|
||||
### Get Warehouse by ID
|
||||
```sql
|
||||
SELECT * FROM `obj_warehouse` WHERE `UID`=?
|
||||
```
|
||||
**File:** `dbWarehouseHandler.java`, Line ~60
|
||||
|
||||
### Get Character's Warehouses
|
||||
```sql
|
||||
SELECT w.* FROM `obj_warehouse` w
|
||||
INNER JOIN `obj_character_warehouse` cw ON w.`UID` = cw.`WarehouseID`
|
||||
WHERE cw.`CharacterID`=?
|
||||
```
|
||||
**File:** `dbWarehouseHandler.java`, Line ~85
|
||||
|
||||
### Get Warehouse Items
|
||||
```sql
|
||||
SELECT i.*, wi.quantity
|
||||
FROM `obj_item` i
|
||||
INNER JOIN `obj_warehouse_item` wi ON i.`UID` = wi.`ItemID`
|
||||
WHERE wi.`WarehouseID`=?
|
||||
```
|
||||
**File:** `dbWarehouseHandler.java`, Line ~120
|
||||
|
||||
## Relationships
|
||||
|
||||
1. **Warehouse to Items:** Many-to-many through `obj_warehouse_item` table
|
||||
2. **Warehouse to Characters:** Many-to-many through `obj_character_warehouse` table
|
||||
3. **Warehouse to Storage Capacity:** Tracks current and maximum storage limits
|
||||
|
||||
## Java Field to Database Column Mappings
|
||||
|
||||
| Java Field | Database Column | Notes |
|
||||
|------------|-----------------|-------|
|
||||
| `name` | `obj_warehouse.name` | Warehouse name |
|
||||
| `description` | `obj_warehouse.description` | Description of the warehouse |
|
||||
| `characterID` | `obj_warehouse.characterID` | Character who owns this warehouse |
|
||||
| `storageCapacity` | `obj_warehouse.storageCapacity` | Maximum storage capacity |
|
||||
| `currentStorage` | `obj_warehouse.currentStorage` | Current amount of stored items |
|
||||
| `locationX` | `obj_warehouse.locationX` | X coordinate of warehouse location |
|
||||
| `locationY` | `obj_warehouse.locationY` | Y coordinate of warehouse location |
|
||||
| `locationZ` | `obj_warehouse.locationZ` | Z coordinate of warehouse location |
|
||||
| `isPublic` | `obj_warehouse.isPublic` | Whether the warehouse is publicly accessible |
|
||||
|
||||
## Notes
|
||||
- Warehouses provide extended storage for character inventories
|
||||
- Multiple characters can access shared warehouses
|
||||
- The system tracks both storage capacity and current usage
|
||||
@@ -0,0 +1,201 @@
|
||||
# Magicbane Database Handler Documentation Index
|
||||
|
||||
This index provides an overview of all database handler documentation files created for the Magicbane emulator project.
|
||||
|
||||
## Available Documentation Files
|
||||
|
||||
1. **dbAccountHandler_Documentation.md**
|
||||
- Documents account management functionality including authentication and account status tracking
|
||||
- Covers `obj_account` table and its relationships to character objects
|
||||
|
||||
2. **dbCityHandler_Documentation.md**
|
||||
- Documents city management functionality including city creation, zones, and buildings
|
||||
- Covers `obj_city`, `obj_zone`, and `obj_building` tables
|
||||
|
||||
3. **dbPlayerCharacterHandler_Documentation.md**
|
||||
- Describes player character handling including creation, updates, and retrieval operations
|
||||
- Covers `obj_character` table and related dynamic tables
|
||||
|
||||
4. **dbRaceHandler_Documentation.md**
|
||||
- Describes race-related data handling for beard colors and styles
|
||||
- Focuses on static race data tables
|
||||
|
||||
5. **dbGuildHandler_Documentation.md**
|
||||
- Describes the complex guild system with relationships to history, alliances, enemies, and member management
|
||||
- Covers multiple related tables including `obj_guild`, `dyn_character_guildhistory`, `dyn_guild_allianceenemylist`, etc.
|
||||
|
||||
6. **dbBaneHandler_Documentation.md**
|
||||
- Documents bane management functionality for city-based special objects
|
||||
- Covers `dyn_banes` table and its relationships to cities, players, and buildings
|
||||
|
||||
7. **dbCSSessionHandler_Documentation.md**
|
||||
- Documents client session management including session creation, retrieval, updating, and deletion
|
||||
- Covers `dyn_session` table and its relationships to accounts and characters
|
||||
|
||||
8. **dbKitHandler_Documentation.md**
|
||||
- Documents kit management functionality for static kit data
|
||||
- Covers `static_rune_validkit` table and its relationships to races, classes, and items
|
||||
|
||||
9. **dbLootHandler_Documentation.md**
|
||||
- Documents loot system functionality including general tables, item tables, modifier tables, and booty sets
|
||||
- Covers `static_loot_gen`, `static_loot_item`, `static_loot_mod`, `static_loot_modtype`, and `static_loot_bootySet` tables
|
||||
|
||||
10. **dbMenuHandler_Documentation.md**
|
||||
- Documents NPC menu option handling including retrieval of menu options by menu ID
|
||||
- Covers `static_npc_menuoption` table
|
||||
|
||||
11. **dbContractHandler_Documentation.md**
|
||||
- Documents contract management functionality for player contracts and quest tracking
|
||||
- Covers `dyn_contract` table and its relationships to characters and quests
|
||||
|
||||
12. **dbEffectsBaseHandler_Documentation.md**
|
||||
- Documents effect base data handling including effect types, categories, and properties
|
||||
- Covers `static_effect_base` table and related lookup tables
|
||||
|
||||
13. **dbEffectsResourceCostHandler_Documentation.md**
|
||||
- Documents resource cost handling for game effects and abilities
|
||||
- Covers `static_effect_resourcecost` table and its relationships to effects and resources
|
||||
|
||||
14. **dbEnchantmentHandler_Documentation.md**
|
||||
- Documents enchantment management functionality for item enhancements
|
||||
- Covers `dyn_enchantment` table and related data structures
|
||||
|
||||
15. **dbHeightMapHandler_Documentation.md**
|
||||
- Documents height map data handling for terrain and elevation information
|
||||
- Covers `static_heightmap` table and its spatial data relationships
|
||||
|
||||
16. **dbItemBaseHandler_Documentation.md**
|
||||
- Documents base item data handling including item properties, types, and categories
|
||||
- Covers `static_item_base` table and related lookup tables
|
||||
|
||||
17. **dbItemHandler_Documentation.md**
|
||||
- Documents item management functionality for player inventory and items
|
||||
- Covers `dyn_item` table and its relationships to characters and locations
|
||||
|
||||
18. **dbMineHandler_Documentation.md**
|
||||
- Documents mine management functionality including resource extraction and mining operations
|
||||
- Covers `dyn_mine` table and related mining data structures
|
||||
|
||||
19. **dbMobBaseHandler_Documentation.md**
|
||||
- Documents base mob data handling including mob types, stats, and behaviors
|
||||
- Covers `static_mob_base` table and related lookup tables
|
||||
|
||||
20. **dbMobHandler_Documentation.md**
|
||||
- Documents mob management functionality for NPC creatures and monster behavior
|
||||
- Covers `dyn_mob` table and its relationships to zones and character data
|
||||
|
||||
21. **dbNPCHandler_Documentation.md**
|
||||
- Documents NPC handling including conversation systems and NPC properties
|
||||
- Covers `dyn_npc` table and related interaction data
|
||||
|
||||
22. **dbPetitionHandler_Documentation.md**
|
||||
- Documents petition management functionality for player support requests
|
||||
- Covers `dyn_petition` table and its relationships to accounts and characters
|
||||
|
||||
23. **dbPowerHandler_Documentation.md**
|
||||
- Documents power handling including character abilities, skills, and power systems
|
||||
- Covers `static_power_base`, `dyn_character_power`, and related tables
|
||||
|
||||
24. **dbPromotionClassHandler_Documentation.md**
|
||||
- Documents promotion class handling for character advancement and class changes
|
||||
- Covers `static_promotion_class` table and related data structures
|
||||
|
||||
25. **dbRealmHandler_Documentation.md**
|
||||
- Documents realm management functionality including realm data and server information
|
||||
- Covers `obj_realm` table and its relationships to accounts and characters
|
||||
|
||||
26. **dbResistHandler_Documentation.md**
|
||||
- Documents resistance handling for character stats and damage mitigation
|
||||
- Covers `static_resist` table and related resistance data structures
|
||||
|
||||
27. **dbRuneBaseAttributeHandler_Documentation.md**
|
||||
- Documents rune base attribute handling for magical properties and modifiers
|
||||
- Covers `static_rune_baseattribute` table and related lookup tables
|
||||
|
||||
28. **dbRuneBaseEffectHandler_Documentation.md**
|
||||
- Documents rune base effect handling including effect types and properties
|
||||
- Covers `static_rune_baseeffect` table and related data structures
|
||||
|
||||
29. **dbRuneBaseHandler_Documentation.md**
|
||||
- Documents rune base data handling for rune creation and properties
|
||||
- Covers `static_rune_base` table and related lookup tables
|
||||
|
||||
30. **dbRunegateHandler_Documentation.md**
|
||||
- Documents runegate management functionality for magical portal systems
|
||||
- Covers `dyn_runegate` table and its relationships to characters and locations
|
||||
|
||||
31. **dbShrineHandler_Documentation.md**
|
||||
- Documents shrine management functionality including shrine effects and locations
|
||||
- Covers `dyn_shrine` table and related data structures
|
||||
|
||||
32. **dbSkillBaseHandler_Documentation.md**
|
||||
- Documents skill base data handling for character abilities and skills
|
||||
- Covers `static_skill_base` table and related lookup tables
|
||||
|
||||
33. **dbSkillReqHandler_Documentation.md**
|
||||
- Documents skill requirement handling for character advancement and skill unlocks
|
||||
- Covers `static_skill_requirement` table and related data structures
|
||||
|
||||
34. **dbVendorDialogHandler_Documentation.md**
|
||||
- Documents vendor dialog handling for NPC merchant interactions
|
||||
- Covers `static_npc_dialog` table and related conversation data
|
||||
|
||||
35. **dbWarehouseHandler_Documentation.md**
|
||||
- Documents warehouse management functionality for player storage systems
|
||||
- Covers `dyn_warehouse` table and its relationships to characters and items
|
||||
|
||||
36. **dbBaseClassHandler_Documentation.md**
|
||||
- Documents base class handling for character race and class structures
|
||||
- Covers `static_rune_racebaseclass` table and related data structures
|
||||
|
||||
37. **dbBlueprintHandler_Documentation.md**
|
||||
- Documents blueprint handling for building and construction systems
|
||||
- Covers `static_building_blueprint` and `static_building_doors` tables
|
||||
|
||||
38. **dbBoonHandler_Documentation.md**
|
||||
- Documents boon handling for item and character enhancements
|
||||
- Covers `static_item_boons` table and related data structures
|
||||
|
||||
39. **dbBuildingHandler_Documentation.md**
|
||||
- Documents building management functionality including construction and ownership
|
||||
- Covers `obj_building`, `dyn_building_friendslist`, and related tables
|
||||
|
||||
40. **dbBuildingLocationHandler_Documentation.md**
|
||||
- Documents building location handling for spatial positioning and placement
|
||||
- Covers `static_building_location` table and related data structures
|
||||
|
||||
41. **dbCharacterPowerHandler_Documentation.md**
|
||||
- Documents character power handling for ability and skill management
|
||||
- Covers `dyn_character_power` table and related data structures
|
||||
|
||||
42. **dbCharacterRuneHandler_Documentation.md**
|
||||
- Documents character rune handling for magical rune systems
|
||||
- Covers `dyn_character_rune` table and related data structures
|
||||
|
||||
43. **dbCharacterSkillHandler_Documentation.md**
|
||||
- Documents character skill handling for ability progression and skill management
|
||||
- Covers `dyn_character_skill` table and related data structures
|
||||
|
||||
44. **dbZoneHandler_Documentation.md**
|
||||
- Documents zone management functionality including world zones and area definitions
|
||||
- Covers `obj_zone` table and its relationships to cities and buildings
|
||||
|
||||
## Documentation Structure
|
||||
|
||||
All documentation files follow a consistent format with the following sections:
|
||||
- Overview
|
||||
- Handler Class information
|
||||
- Database Tables involved
|
||||
- Key Queries with line references
|
||||
- Relationships between entities
|
||||
- Java Field to Database Column Mappings
|
||||
|
||||
## Usage Notes
|
||||
|
||||
These documents are intended for:
|
||||
- Developers working on the Magicbane emulator
|
||||
- Wiki documentation for project maintainers
|
||||
- Database schema understanding and maintenance
|
||||
- Future reference when code changes may affect database relationships
|
||||
|
||||
The files are located in: `src/engine/documentation/Handler Specific Documentation/`
|
||||
@@ -520,30 +520,7 @@ public enum BuildingManager {
|
||||
if (building.getBlueprintUUID() == 0)
|
||||
return false;
|
||||
|
||||
if(building.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL)){
|
||||
if(contract.getContractID() == 850) {
|
||||
boolean hasRunemaster = false;
|
||||
for (AbstractCharacter npc : building.getHirelings().keySet()) {
|
||||
|
||||
if (npc.getObjectType() != GameObjectType.NPC)
|
||||
continue;
|
||||
|
||||
if(npc.contractUUID == 850)
|
||||
hasRunemaster = true;
|
||||
}
|
||||
|
||||
if(hasRunemaster)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int maxSlots = building.getBlueprint().getMaxSlots();
|
||||
if(building.getBlueprint().getBuildingGroup() != null) {
|
||||
maxSlots = building.getBlueprint().getSlotsForRank(building.getRank());
|
||||
}
|
||||
|
||||
if (maxSlots == building.getHirelings().size())
|
||||
if (building.getBlueprint().getMaxSlots() == building.getHirelings().size())
|
||||
return false;
|
||||
|
||||
String pirateName = NPCManager.getPirateName(contract.getMobbaseID());
|
||||
|
||||
@@ -1054,10 +1054,6 @@ public enum CombatManager {
|
||||
if (eff.getPower() != null && (eff.getPower().getToken() == 429506943 || eff.getPower().getToken() == 429408639 || eff.getPower().getToken() == 429513599 || eff.getPower().getToken() == 429415295))
|
||||
swingAnimation = 0;
|
||||
|
||||
if(source != null && source.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
damage *= ((PlayerCharacter)source).ZergMultiplier;
|
||||
} // Health modifications are modified by the ZergMechanic
|
||||
|
||||
TargetedActionMsg cmm = new TargetedActionMsg(source, target, damage, swingAnimation);
|
||||
DispatchMessage.sendToAllInRange(target, cmm);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public enum DevCmdManager {
|
||||
DevCmdManager.registerDevCmd(new AddGoldCmd());
|
||||
DevCmdManager.registerDevCmd(new ZoneInfoCmd());
|
||||
DevCmdManager.registerDevCmd(new DebugMeleeSyncCmd());
|
||||
DevCmdManager.registerDevCmd(new HotzoneCmd());
|
||||
DevCmdManager.registerDevCmd(new MineActiveCmd());
|
||||
// Dev
|
||||
DevCmdManager.registerDevCmd(new ApplyStatModCmd());
|
||||
@@ -178,17 +179,8 @@ public enum DevCmdManager {
|
||||
|
||||
//kill any commands not available to everyone on production server
|
||||
//only admin level can run dev commands on production
|
||||
boolean playerAllowed = false;
|
||||
switch(adc.getMainCmdString()){
|
||||
case "printresists":
|
||||
case "printstats":
|
||||
case "printskills":
|
||||
case "printpowers":
|
||||
if(!a.status.equals(Enum.AccountStatus.ADMIN))
|
||||
target = pcSender;
|
||||
break;
|
||||
}
|
||||
if (!playerAllowed && !a.status.equals(Enum.AccountStatus.ADMIN)) {
|
||||
|
||||
if (a.status.equals(Enum.AccountStatus.ADMIN) == false) {
|
||||
Logger.info("Account " + a.getUname() + "attempted to use dev command " + cmd);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,9 +17,7 @@ import engine.objects.*;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
@@ -36,11 +34,6 @@ public enum LootManager {
|
||||
public static HashMap<Integer, ArrayList<ModTableEntry>> _modTables = new HashMap<>();
|
||||
public static HashMap<Integer, ArrayList<ModTypeTableEntry>> _modTypeTables = new HashMap<>();
|
||||
|
||||
public static final ArrayList<Integer> vorg_ha_uuids = new ArrayList<>(Arrays.asList(27580, 27590, 188500, 188510, 188520, 188530, 188540, 188550, 189510));
|
||||
public static final ArrayList<Integer> vorg_ma_uuids = new ArrayList<>(Arrays.asList(27570,188900,188910,188920,188930,188940,188950,189500));
|
||||
public static final ArrayList<Integer> vorg_la_uuids = new ArrayList<>(Arrays.asList(27550,27560,189100,189110,189120,189130,189140,189150));
|
||||
public static final ArrayList<Integer> vorg_cloth_uuids = new ArrayList<>(Arrays.asList(27600,188700,188720,189550,189560));
|
||||
|
||||
// Drop Rates
|
||||
|
||||
public static float NORMAL_DROP_RATE;
|
||||
@@ -74,106 +67,41 @@ public enum LootManager {
|
||||
}
|
||||
|
||||
public static void GenerateMobLoot(Mob mob) {
|
||||
|
||||
//determine if mob is in hotzone
|
||||
boolean inHotzone = false;
|
||||
|
||||
//special blood rune droppers
|
||||
MobLoot specialDrop = null;
|
||||
switch(mob.getObjectUUID()) {
|
||||
case 22595://elf 1
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252134),true);
|
||||
mob.setFirstName("Melandrach The Blood-Mage");
|
||||
break;
|
||||
case 22432: //elf 2
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252135),true);
|
||||
mob.setFirstName("Kyrtaar The Blood-Mage");
|
||||
break;
|
||||
case 22537: //elf 3
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252136),true);
|
||||
mob.setFirstName("Vamir The Blood-Mage");
|
||||
break;
|
||||
case 16387: //human 4 DONE
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252129),true);
|
||||
mob.setFirstName("Alatar The Blood-Mage");
|
||||
break;
|
||||
case 32724:// human 5 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252130),true);
|
||||
mob.setFirstName("Elphaba The Blood-Mage");
|
||||
break;
|
||||
case 23379: //human 1 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252131),true);
|
||||
mob.setFirstName("Bavmorda The Blood-Mage");
|
||||
break;
|
||||
case 10826: //human 2 REDO
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252132),true);
|
||||
mob.setFirstName("Draco The Blood-Mage");
|
||||
break;
|
||||
case 15929: //human 3 GOOD
|
||||
specialDrop = new MobLoot(mob,ItemBase.getItemBase(252133),true);
|
||||
mob.setFirstName("Atlantes The Blood-Mage");
|
||||
break;
|
||||
}
|
||||
if(specialDrop != null) {
|
||||
mob.setLevel((short) 65);
|
||||
mob.setSpawnTime(10800);
|
||||
mob.healthMax = (7500);
|
||||
mob.setHealth(7500);
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + specialDrop.getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
mob.getCharItemManager().addItemToInventory(specialDrop);
|
||||
mob.setResists(new Resists("Dropper"));
|
||||
if(!Mob.discDroppers.contains(mob))
|
||||
Mob.AddDiscDropper(mob);
|
||||
}
|
||||
boolean inHotzone = ZoneManager.inHotZone(mob.getLoc());
|
||||
|
||||
//iterate the booty sets
|
||||
|
||||
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet))
|
||||
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
|
||||
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone);
|
||||
|
||||
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet))
|
||||
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
|
||||
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone);
|
||||
|
||||
//lastly, check mobs inventory for godly or disc runes to send a server announcement
|
||||
for (Item it : mob.getInventory()) {
|
||||
|
||||
ItemBase ib = it.getItemBase();
|
||||
if (ib == null)
|
||||
break;
|
||||
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
for (Item it : mob.getInventory()) {
|
||||
|
||||
ItemBase ib = it.getItemBase();
|
||||
if(ib == null)
|
||||
break;
|
||||
if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) {
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void RunBootySet(ArrayList<BootySetEntry> entries, Mob mob, boolean inHotzone) {
|
||||
|
||||
boolean hotzoneWasRan = false;
|
||||
float dropRate;
|
||||
|
||||
//1 in 1,000 chance to drop glass
|
||||
if(ThreadLocalRandom.current().nextInt(1,1000) == 500){
|
||||
int glassID = rollRandomItem(126);
|
||||
ItemBase glassItem = ItemBase.getItemBase(glassID);
|
||||
if(glassItem != null) {
|
||||
MobLoot toAdd = new MobLoot(mob, glassItem, false);
|
||||
|
||||
if (toAdd != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
//check for special gifts 1/100 to drop present
|
||||
if(ThreadLocalRandom.current().nextInt(1,25) == 15)
|
||||
DropPresent(mob);
|
||||
float dropRate = 1.0f;
|
||||
|
||||
// Iterate all entries in this bootySet and process accordingly
|
||||
|
||||
for (BootySetEntry bse : entries) {
|
||||
switch (bse.bootyType) {
|
||||
case "GOLD":
|
||||
@@ -181,10 +109,8 @@ public enum LootManager {
|
||||
break;
|
||||
case "LOOT":
|
||||
|
||||
if (mob.getSafeZone())
|
||||
return; // no loot to drop in safezones
|
||||
|
||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
||||
if (mob.getSafeZone() == false)
|
||||
dropRate = LootManager.NORMAL_DROP_RATE;
|
||||
|
||||
if (inHotzone == true)
|
||||
dropRate = LootManager.HOTZONE_DROP_RATE;
|
||||
@@ -246,23 +172,13 @@ public enum LootManager {
|
||||
return null;
|
||||
|
||||
if (ItemBase.getItemBase(itemUUID).getType().ordinal() == Enum.ItemType.RESOURCE.ordinal()) {
|
||||
if(ThreadLocalRandom.current().nextInt(1,101) < 91)
|
||||
return null; // cut down world drops rates of resources by 90%
|
||||
int amount = ThreadLocalRandom.current().nextInt(tableRow.minSpawn, tableRow.maxSpawn + 1);
|
||||
return new MobLoot(mob, ItemBase.getItemBase(itemUUID), amount, false);
|
||||
}
|
||||
if(ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.RUNE)){
|
||||
int randomRune = rollRandomItem(itemTableId);
|
||||
if(randomRune != 0) {
|
||||
itemUUID = randomRune;
|
||||
}
|
||||
} else if(ItemBase.getItemBase(itemUUID).getType().equals(Enum.ItemType.CONTRACT)){
|
||||
int randomContract = rollRandomItem(itemTableId);
|
||||
if(randomContract != 0) {
|
||||
itemUUID = randomContract;
|
||||
}
|
||||
}
|
||||
|
||||
outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false);
|
||||
Enum.ItemType outType = outItem.getItemBase().getType();
|
||||
|
||||
|
||||
if(selectedRow.pModTable != 0){
|
||||
try {
|
||||
@@ -280,12 +196,6 @@ public enum LootManager {
|
||||
Logger.error("Failed to GenerateSuffix for item: " + outItem.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if(outItem.getItemBase().getType().equals(Enum.ItemType.CONTRACT) || outItem.getItemBase().getType().equals(Enum.ItemType.RUNE)){
|
||||
if(ThreadLocalRandom.current().nextInt(1,101) < 66)
|
||||
return null; // cut down world drops rates of resources by 65%
|
||||
}
|
||||
|
||||
return outItem;
|
||||
}
|
||||
|
||||
@@ -389,7 +299,12 @@ public enum LootManager {
|
||||
|
||||
int high = bse.highGold;
|
||||
int low = bse.lowGold;
|
||||
int gold = (int) (ThreadLocalRandom.current().nextInt(low, high + 1) * NORMAL_GOLD_RATE);
|
||||
int gold = ThreadLocalRandom.current().nextInt(low, high + 1);
|
||||
|
||||
if (inHotzone == true)
|
||||
gold = (int) (gold * HOTZONE_GOLD_RATE);
|
||||
else
|
||||
gold = (int) (gold * NORMAL_GOLD_RATE);
|
||||
|
||||
if (gold > 0) {
|
||||
MobLoot goldAmount = new MobLoot(mob, gold);
|
||||
@@ -400,50 +315,45 @@ public enum LootManager {
|
||||
|
||||
public static void GenerateLootDrop(Mob mob, int tableID, Boolean inHotzone) {
|
||||
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
try {
|
||||
|
||||
if (toAdd != null) {
|
||||
toAdd.setIsID(true);
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
MobLoot toAdd = getGenTableItem(tableID, mob, inHotzone);
|
||||
|
||||
if (toAdd != null)
|
||||
mob.getCharItemManager().addItemToInventory(toAdd);
|
||||
|
||||
} catch (Exception e) {
|
||||
//TODO chase down loot generation error, affects roughly 2% of drops
|
||||
int i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void GenerateEquipmentDrop(Mob mob) {
|
||||
|
||||
if (mob == null || mob.getSafeZone())
|
||||
return; // no equipment to drop in safezones
|
||||
|
||||
//do equipment here
|
||||
if (mob.getEquip() != null) {
|
||||
boolean isVorg = false;
|
||||
int dropCount = 0;
|
||||
if (mob.getEquip() != null)
|
||||
for (MobEquipment me : mob.getEquip().values()) {
|
||||
|
||||
if (me.getDropChance() == 0)
|
||||
continue;
|
||||
|
||||
String name = me.getItemBase().getName().toLowerCase();
|
||||
if (name.contains("vorgrim legionnaire's") || name.contains("vorgrim auxiliary's") ||name.contains("bellugh nuathal") || name.contains("crimson circle"))
|
||||
isVorg = true;
|
||||
|
||||
float equipmentRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
|
||||
float dropChance = me.getDropChance() * 100;
|
||||
ItemBase itemBase = me.getItemBase();
|
||||
if(isVorg) {
|
||||
mob.spawnTime = ThreadLocalRandom.current().nextInt(300, 2700);
|
||||
dropChance = 10;
|
||||
itemBase = getRandomVorg(itemBase);
|
||||
}
|
||||
|
||||
if (equipmentRoll > dropChance)
|
||||
continue;
|
||||
|
||||
MobLoot ml = new MobLoot(mob, itemBase, false);
|
||||
MobLoot ml = new MobLoot(mob, me.getItemBase(), false);
|
||||
|
||||
ml.setIsID(true);
|
||||
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||
mob.getCharItemManager().addItemToInventory(ml);
|
||||
if (ml != null && dropCount < 1) {
|
||||
ml.setIsID(true);
|
||||
ml.setDurabilityCurrent((short) (ml.getDurabilityCurrent() - ThreadLocalRandom.current().nextInt(5) + 1));
|
||||
mob.getCharItemManager().addItemToInventory(ml);
|
||||
dropCount = 1;
|
||||
//break; // Exit on first successful roll.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GenerateInventoryDrop(Mob mob, BootySetEntry bse) {
|
||||
@@ -457,11 +367,8 @@ public enum LootManager {
|
||||
|
||||
MobLoot lootItem = new MobLoot(mob, ItemBase.getItemBase(bse.itemBase), true);
|
||||
|
||||
if (lootItem != null) {
|
||||
if (lootItem != null)
|
||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||
if(lootItem.getItemBase().isDiscRune() && !Mob.discDroppers.contains(mob))
|
||||
Mob.AddDiscDropper(mob);
|
||||
}
|
||||
}
|
||||
|
||||
public static void peddleFate(PlayerCharacter playerCharacter, Item gift) {
|
||||
@@ -485,7 +392,7 @@ public enum LootManager {
|
||||
|
||||
//check if player owns the gift he is trying to open
|
||||
|
||||
if (!itemMan.doesCharOwnThisItem(gift.getObjectUUID()))
|
||||
if (itemMan.doesCharOwnThisItem(gift.getObjectUUID()) == false)
|
||||
return;
|
||||
|
||||
//roll 1-100 for the gen table selection
|
||||
@@ -506,161 +413,45 @@ public enum LootManager {
|
||||
|
||||
//create the item from the table, quantity is always 1
|
||||
|
||||
ItemBase ib = ItemBase.getItemBase(selectedItem.cacheID);
|
||||
if(ib.getUUID() == Warehouse.coalIB.getUUID()){
|
||||
//no more coal, give gold instead
|
||||
if (itemMan.getGoldInventory().getNumOfItems() + 250000 > 10000000) {
|
||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
||||
return;
|
||||
}
|
||||
itemMan.addGoldToInventory(250000,false);
|
||||
itemMan.updateInventory();
|
||||
}else {
|
||||
MobLoot winnings = new MobLoot(playerCharacter, ib, 1, false);
|
||||
|
||||
if (winnings == null)
|
||||
return;
|
||||
|
||||
//early exit if the inventory of the player will not hold the item
|
||||
|
||||
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
|
||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
||||
return;
|
||||
}
|
||||
|
||||
//determine if the winning item needs a prefix
|
||||
|
||||
if (selectedRow.pModTable != 0) {
|
||||
int prefixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
|
||||
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
|
||||
if (prefix != null)
|
||||
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
|
||||
}
|
||||
|
||||
//determine if the winning item needs a suffix
|
||||
|
||||
if (selectedRow.sModTable != 0) {
|
||||
int suffixRoll = ThreadLocalRandom.current().nextInt(220, 320 + 1);
|
||||
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll);
|
||||
if (suffix != null)
|
||||
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true);
|
||||
}
|
||||
winnings.setIsID(true);
|
||||
|
||||
//remove gift from inventory
|
||||
MobLoot winnings = new MobLoot(playerCharacter, ItemBase.getItemBase(selectedItem.cacheID), 1, false);
|
||||
|
||||
itemMan.consume(gift);
|
||||
if (winnings == null)
|
||||
return;
|
||||
|
||||
//add winnings to player inventory
|
||||
//early exit if the inventory of the player will not old the item
|
||||
|
||||
Item playerWinnings = winnings.promoteToItem(playerCharacter);
|
||||
itemMan.addItemToInventory(playerWinnings);
|
||||
itemMan.updateInventory();
|
||||
if (itemMan.hasRoomInventory(winnings.getItemBase().getWeight()) == false) {
|
||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 21);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public static int rollRandomItem(int itemTable){
|
||||
int returnedID = ItemTableEntry.getRandomItem(itemTable);
|
||||
return returnedID;
|
||||
}
|
||||
//determine if the winning item needs a prefix
|
||||
|
||||
public static ItemBase getRandomVorg(ItemBase itemBase){
|
||||
int roll = 0;
|
||||
if(vorg_ha_uuids.contains(itemBase.getUUID())) {
|
||||
roll = ThreadLocalRandom.current().nextInt(0, 10);
|
||||
switch (roll) {
|
||||
case 1:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(0));
|
||||
case 2:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(1));
|
||||
case 3:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(2));
|
||||
case 4:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(3));
|
||||
case 5:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(4));
|
||||
case 6:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(5));
|
||||
case 7:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(6));
|
||||
case 8:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(7));
|
||||
default:
|
||||
return ItemBase.getItemBase(vorg_ha_uuids.get(8));
|
||||
}
|
||||
if(selectedRow.pModTable != 0){
|
||||
int prefixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1);
|
||||
ModTableEntry prefix = ModTableEntry.rollTable(selectedRow.pModTable, prefixRoll);
|
||||
if(prefix != null)
|
||||
winnings.addPermanentEnchantment(prefix.action, 0, prefix.level, true);
|
||||
}
|
||||
|
||||
if(vorg_ma_uuids.contains(itemBase.getUUID())) {
|
||||
roll = ThreadLocalRandom.current().nextInt(0, 10);
|
||||
switch (roll) {
|
||||
case 1:
|
||||
return ItemBase.getItemBase(vorg_ma_uuids.get(0));
|
||||
case 2:
|
||||
return ItemBase.getItemBase(vorg_ma_uuids.get(1));
|
||||
case 3:
|
||||
return ItemBase.getItemBase(vorg_ma_uuids.get(2));
|
||||
case 4:
|
||||
return ItemBase.getItemBase(vorg_ma_uuids.get(3));
|
||||
case 5:
|
||||
return ItemBase.getItemBase(vorg_ma_uuids.get(4));
|
||||
case 6:
|
||||
return ItemBase.getItemBase(vorg_ma_uuids.get(5));
|
||||
case 7:
|
||||
return ItemBase.getItemBase(vorg_ma_uuids.get(6));
|
||||
default:
|
||||
return ItemBase.getItemBase(vorg_ma_uuids.get(7));
|
||||
}
|
||||
}
|
||||
//determine if the winning item needs a suffix
|
||||
|
||||
if(vorg_la_uuids.contains(itemBase.getUUID())) {
|
||||
roll = ThreadLocalRandom.current().nextInt(0, 10);
|
||||
switch (roll) {
|
||||
case 1:
|
||||
return ItemBase.getItemBase(vorg_la_uuids.get(0));
|
||||
case 2:
|
||||
return ItemBase.getItemBase(vorg_la_uuids.get(1));
|
||||
case 3:
|
||||
return ItemBase.getItemBase(vorg_la_uuids.get(2));
|
||||
case 4:
|
||||
return ItemBase.getItemBase(vorg_la_uuids.get(3));
|
||||
case 5:
|
||||
return ItemBase.getItemBase(vorg_la_uuids.get(4));
|
||||
case 6:
|
||||
return ItemBase.getItemBase(vorg_la_uuids.get(5));
|
||||
case 7:
|
||||
return ItemBase.getItemBase(vorg_la_uuids.get(6));
|
||||
default:
|
||||
return ItemBase.getItemBase(vorg_la_uuids.get(7));
|
||||
}
|
||||
if(selectedRow.sModTable != 0){
|
||||
int suffixRoll = ThreadLocalRandom.current().nextInt(220,320 + 1);
|
||||
ModTableEntry suffix = ModTableEntry.rollTable(selectedRow.sModTable, suffixRoll);
|
||||
if (suffix != null)
|
||||
winnings.addPermanentEnchantment(suffix.action, 0, suffix.level, true);
|
||||
}
|
||||
winnings.setIsID(true);
|
||||
|
||||
if(vorg_cloth_uuids.contains(itemBase.getUUID())) {
|
||||
roll = ThreadLocalRandom.current().nextInt(0, 10);
|
||||
switch (roll) {
|
||||
case 1:
|
||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(0));
|
||||
case 2:
|
||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(1));
|
||||
case 3:
|
||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(2));
|
||||
case 4:
|
||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(3));
|
||||
default:
|
||||
return ItemBase.getItemBase(vorg_cloth_uuids.get(4));
|
||||
}
|
||||
}
|
||||
//remove gift from inventory
|
||||
|
||||
return null;
|
||||
}
|
||||
itemMan.consume(gift);
|
||||
|
||||
public static void DropPresent(Mob mob){
|
||||
int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
|
||||
int presentID = ItemBase.AnniverseryGifts.get(random);
|
||||
ItemBase presentBase = ItemBase.getItemBase(presentID);
|
||||
if(presentBase != null){
|
||||
MobLoot lootItem = new MobLoot(mob, presentBase, true);
|
||||
mob.getCharItemManager().addItemToInventory(lootItem);
|
||||
}
|
||||
//add winnings to player inventory
|
||||
|
||||
Item playerWinnings = winnings.promoteToItem(playerCharacter);
|
||||
itemMan.addItemToInventory(playerWinnings);
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public enum MaintenanceManager {
|
||||
|
||||
public static void setMaintDateTime(Building building, LocalDateTime maintDate) {
|
||||
|
||||
building.maintDateTime = maintDate.withHour(1).withMinute(0).withSecond(0);
|
||||
building.maintDateTime = maintDate;
|
||||
DbManager.BuildingQueries.updateMaintDate(building);
|
||||
|
||||
}
|
||||
@@ -49,15 +49,19 @@ public enum MaintenanceManager {
|
||||
|
||||
if (chargeUpkeep(building) == false)
|
||||
derankList.add(building);
|
||||
else
|
||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||
}
|
||||
// Reset maintenance dates for these buildings
|
||||
|
||||
for (Building building : maintList) {
|
||||
setMaintDateTime(building, LocalDateTime.now().plusDays(7));
|
||||
|
||||
for (Building building : derankList) {
|
||||
building.destroyOrDerank(null);
|
||||
if(building.getRank() > 0)
|
||||
setMaintDateTime(building, LocalDateTime.now().plusDays(1));
|
||||
}
|
||||
// Derak or destroy buildings that did not
|
||||
// have funds available.
|
||||
|
||||
for (Building building : derankList)
|
||||
building.destroyOrDerank(null);
|
||||
|
||||
Logger.info("Structures: " + buildingList.size() + " Maint: " + maintList.size() + " Derank: " + derankList.size());
|
||||
}
|
||||
|
||||
@@ -94,10 +98,6 @@ public enum MaintenanceManager {
|
||||
continue;
|
||||
}
|
||||
|
||||
//only ToL pays maintenance
|
||||
if(building.getBlueprint().getBuildingGroup() != null && !building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.TOL))
|
||||
continue;
|
||||
|
||||
// No maintenance on banestones omfg
|
||||
|
||||
if (building.getBlueprint().getBuildingGroup().equals(Enum.BuildingGroup.BANESTONE))
|
||||
@@ -222,6 +222,12 @@ public enum MaintenanceManager {
|
||||
if ((hasFunds == false) ||
|
||||
((building.getRank() == 8) && !hasResources)) {
|
||||
|
||||
// Add cash back to strongbox for lost rank if the building isn't being destroyed
|
||||
// and it's not an R8 deranking
|
||||
|
||||
if ((building.getRank() > 1) && (building.getRank() < 8)) {
|
||||
building.setStrongboxValue(building.getStrongboxValue() + building.getBlueprint().getRankCost(Math.min(building.getRank(), 7)));
|
||||
}
|
||||
|
||||
return false; // Early exit for having failed to meet maintenance
|
||||
}
|
||||
|
||||
@@ -10,7 +10,10 @@ package engine.gameManager;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.Enum.GameObjectType;
|
||||
import engine.objects.*;
|
||||
import engine.objects.AbstractGameObject;
|
||||
import engine.objects.City;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Runegate;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.Connection;
|
||||
@@ -30,7 +33,7 @@ public enum SimulationManager {
|
||||
SERVERHEARTBEAT;
|
||||
|
||||
private static final long CITY_PULSE = 2000;
|
||||
private static final long RUNEGATE_PULSE = 1000;
|
||||
private static final long RUNEGATE_PULSE = 3000;
|
||||
private static final long UPDATE_PULSE = 1000;
|
||||
private static final long FlIGHT_PULSE = 100;
|
||||
public static Duration executionTime = Duration.ofNanos(1);
|
||||
@@ -200,12 +203,8 @@ public enum SimulationManager {
|
||||
city = (City) cityObject;
|
||||
city.onEnter();
|
||||
}
|
||||
for(Mine mine : Mine.getMines()){
|
||||
if(mine != null && mine.isActive)
|
||||
mine.onEnter();
|
||||
}
|
||||
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
|
||||
_cityPulseTime = System.currentTimeMillis() + CITY_PULSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -215,10 +214,6 @@ public enum SimulationManager {
|
||||
private void pulseRunegates() {
|
||||
|
||||
for (Runegate runegate : Runegate._runegates.values()) {
|
||||
for(Portal portal : runegate._portals)
|
||||
if(!portal.isActive())
|
||||
portal.activate(false);
|
||||
|
||||
runegate.collidePortals();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
package engine.gameManager;
|
||||
import engine.objects.Guild;
|
||||
public class ZergManager {
|
||||
|
||||
public static float getCurrentMultiplier(int count, int maxCount){
|
||||
switch(maxCount) {
|
||||
case 3:
|
||||
return getMultiplier3Man(count);
|
||||
case 5:
|
||||
return getMultiplier5Man(count);
|
||||
case 10:
|
||||
return getMultiplier10Man(count);
|
||||
default:
|
||||
return getMultiplier20Man(count);
|
||||
}
|
||||
}
|
||||
public static float getMultiplier3Man(int count) {
|
||||
if(count < 4)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 6)
|
||||
return 0.0f;
|
||||
|
||||
switch(count){
|
||||
case 4:
|
||||
return 0.75f;
|
||||
case 5:
|
||||
return 0.60f;
|
||||
case 6:
|
||||
return 0.37f;
|
||||
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
public static float getMultiplier5Man(int count) {
|
||||
if(count < 6)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 10)
|
||||
return 0.0f;
|
||||
|
||||
switch(count){
|
||||
case 6:
|
||||
return 0.75f;
|
||||
case 7:
|
||||
return 0.67f;
|
||||
case 8:
|
||||
return 0.56f;
|
||||
case 9:
|
||||
return 0.43f;
|
||||
case 10:
|
||||
return 0.25f;
|
||||
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
public static float getMultiplier10Man(int count) {
|
||||
if(count < 11)
|
||||
return 1.0f;
|
||||
|
||||
if(count > 20)
|
||||
return 0.0f;
|
||||
|
||||
switch(count){
|
||||
case 11:
|
||||
return 0.75f;
|
||||
case 12:
|
||||
return 0.71f;
|
||||
case 13:
|
||||
return 0.67f;
|
||||
case 14:
|
||||
return 0.62f;
|
||||
case 15:
|
||||
return 0.56f;
|
||||
case 16:
|
||||
return 0.50f;
|
||||
case 17:
|
||||
return 0.43f;
|
||||
case 18:
|
||||
return 0.35f;
|
||||
case 19:
|
||||
return 0.25f;
|
||||
case 20:
|
||||
return 0.14f;
|
||||
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
public static float getMultiplier20Man(int count) {
|
||||
return getMultiplier10Man(count * 2);
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,14 @@ import engine.objects.Building;
|
||||
import engine.objects.City;
|
||||
import engine.objects.Zone;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/*
|
||||
* Class contains methods and structures which
|
||||
@@ -107,6 +109,20 @@ public enum ZoneManager {
|
||||
|
||||
}
|
||||
|
||||
// Returns the number of available hotZones
|
||||
// remaining in this cycle (1am)
|
||||
|
||||
public static int availableHotZones() {
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (Zone zone : ZoneManager.macroZones)
|
||||
if (ZoneManager.validHotZone(zone))
|
||||
count = count + 1;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// Resets the availability of hotZones
|
||||
// for this cycle
|
||||
|
||||
@@ -201,6 +217,63 @@ public enum ZoneManager {
|
||||
ZoneManager.playerCityZones.add(zone);
|
||||
}
|
||||
|
||||
public static final void generateAndSetRandomHotzone() {
|
||||
|
||||
Zone hotZone;
|
||||
ArrayList<Integer> zoneArray = new ArrayList<>();
|
||||
|
||||
if (ZoneManager.macroZones.isEmpty())
|
||||
return;
|
||||
|
||||
// Reset hotZone availability if none are left.
|
||||
|
||||
if (ZoneManager.availableHotZones() == 0)
|
||||
ZoneManager.resetHotZones();
|
||||
|
||||
for (Zone zone : ZoneManager.macroZones)
|
||||
if (validHotZone(zone))
|
||||
zoneArray.add(zone.getObjectUUID());
|
||||
|
||||
int entryIndex = ThreadLocalRandom.current().nextInt(zoneArray.size());
|
||||
|
||||
hotZone = ZoneManager.getZoneByUUID(zoneArray.get(entryIndex));
|
||||
|
||||
if (hotZone == null) {
|
||||
Logger.error("Hotzone is null");
|
||||
return;
|
||||
}
|
||||
|
||||
ZoneManager.setHotZone(hotZone);
|
||||
|
||||
}
|
||||
|
||||
public static final boolean validHotZone(Zone zone) {
|
||||
|
||||
if (zone.getSafeZone() == (byte) 1)
|
||||
return false; // no safe zone hotzones// if (this.hotzone == null)
|
||||
|
||||
if (zone.getNodes().isEmpty())
|
||||
return false;
|
||||
|
||||
if (zone.equals(ZoneManager.seaFloor))
|
||||
return false;
|
||||
|
||||
//no duplicate hotZones
|
||||
|
||||
if (zone.hasBeenHotzone == true)
|
||||
return false;
|
||||
|
||||
// Enforce min level
|
||||
|
||||
if (zone.minLvl < Integer.parseInt(ConfigManager.MB_HOTZONE_MIN_LEVEL.getValue()))
|
||||
return false;
|
||||
|
||||
if (ZoneManager.hotZone != null)
|
||||
return ZoneManager.hotZone.getObjectUUID() != zone.getObjectUUID();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Converts world coordinates to coordinates local to a given zone.
|
||||
|
||||
public static Vector3fImmutable worldToLocal(Vector3fImmutable worldVector,
|
||||
|
||||
@@ -9,12 +9,10 @@
|
||||
package engine.loot;
|
||||
|
||||
import engine.gameManager.LootManager;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class ItemTableEntry {
|
||||
public int minRoll;
|
||||
@@ -44,16 +42,4 @@ public class ItemTableEntry {
|
||||
|
||||
return itemTableEntry;
|
||||
}
|
||||
|
||||
public static Integer getRandomItem(int itemTable) {
|
||||
int id = 0;
|
||||
List<ItemTableEntry> itemTableEntryList;
|
||||
|
||||
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
||||
|
||||
if(itemTableEntryList != null){
|
||||
id = itemTableEntryList.get(ThreadLocalRandom.current().nextInt(0,itemTableEntryList.size() - 1)).cacheID;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,8 +625,8 @@ public class MobAI {
|
||||
|
||||
//check to send mob home for player guards to prevent exploit of dragging guards away and then teleporting
|
||||
|
||||
|
||||
CheckToSendMobHome(mob);
|
||||
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -646,6 +646,9 @@ public class MobAI {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mob.BehaviourType.ordinal() != Enum.MobBehaviourType.Pet1.ordinal())
|
||||
CheckToSendMobHome(mob);
|
||||
|
||||
if (mob.getCombatTarget() != null) {
|
||||
|
||||
if (mob.getCombatTarget().isAlive() == false) {
|
||||
@@ -871,12 +874,9 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000L))) {
|
||||
} else if (System.currentTimeMillis() > (aiAgent.deathTime + (aiAgent.spawnTime * 1000))) {
|
||||
|
||||
if(Mob.discDroppers.contains(aiAgent))
|
||||
return;
|
||||
|
||||
if (!Zone.respawnQue.contains(aiAgent)) {
|
||||
if (Zone.respawnQue.contains(aiAgent) == false) {
|
||||
Zone.respawnQue.add(aiAgent);
|
||||
}
|
||||
}
|
||||
@@ -911,11 +911,6 @@ public class MobAI {
|
||||
|
||||
private static void CheckToSendMobHome(Mob mob) {
|
||||
|
||||
if(mob.BehaviourType.equals(Enum.MobBehaviourType.Pet1)){
|
||||
if(mob.loc.distanceSquared(mob.getOwner().loc) > 60 * 60)
|
||||
mob.teleport(mob.getOwner().loc);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (mob.BehaviourType.isAgressive) {
|
||||
|
||||
@@ -927,6 +922,9 @@ public class MobAI {
|
||||
}
|
||||
}
|
||||
|
||||
if (mob.getCombatTarget() != null && CombatUtilities.inRange2D(mob, mob.getCombatTarget(), MobAIThread.AI_BASE_AGGRO_RANGE * 0.5f))
|
||||
return;
|
||||
|
||||
if (mob.isPlayerGuard() && !mob.despawned) {
|
||||
|
||||
City current = ZoneManager.getCityAtLocation(mob.getLoc());
|
||||
@@ -1008,7 +1006,7 @@ public class MobAI {
|
||||
|
||||
//dont scan self.
|
||||
|
||||
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) || (mob.agentType.equals(Enum.AIAgentType.PET)))
|
||||
if (mob.equals(awoMob) || (mob.agentType.equals(Enum.AIAgentType.GUARD)) == true)
|
||||
continue;
|
||||
|
||||
Mob aggroMob = (Mob) awoMob;
|
||||
|
||||
@@ -560,30 +560,12 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
if (!itemManager.inventoryContains(i))
|
||||
return;
|
||||
|
||||
//cannot delete gold
|
||||
if(i.getItemBaseID() == 7)
|
||||
return;
|
||||
|
||||
if (i.isCanDestroy()) {
|
||||
int goldValue = i.getBaseValue();
|
||||
if (i.getItemBase().isRune())
|
||||
goldValue = 500000;
|
||||
|
||||
if (i.getItemBaseID() == 980066)
|
||||
goldValue = 0;
|
||||
|
||||
if(itemManager.getGoldInventory().getNumOfItems() + goldValue > 10000000)
|
||||
return;
|
||||
|
||||
if (itemManager.delete(i)) {
|
||||
if (goldValue > 0)
|
||||
itemManager.addGoldToInventory(goldValue, false);
|
||||
|
||||
itemManager.updateInventory();
|
||||
if (i.isCanDestroy())
|
||||
if (itemManager.delete(i) == true) {
|
||||
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
|
||||
@@ -1261,8 +1243,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
|
||||
cost = sell.getBaseValue();
|
||||
if(sell.getItemBaseID() == 980066)
|
||||
cost = 0;
|
||||
|
||||
//apply damaged value reduction
|
||||
float durabilityCurrent = sell.getDurabilityCurrent();
|
||||
@@ -1363,14 +1343,6 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.getNpcID());
|
||||
|
||||
|
||||
switch(npc.getContractID()){
|
||||
case 900:
|
||||
case 1201:
|
||||
case 1202:
|
||||
npc.sellPercent = 0.0f;
|
||||
break;
|
||||
}
|
||||
if (npc == null)
|
||||
return;
|
||||
|
||||
@@ -1386,182 +1358,219 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
}
|
||||
|
||||
private static void buyFromNPC(BuyFromNPCMsg msg, ClientConnection origin) {
|
||||
|
||||
PlayerCharacter sourcePlayer = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if (sourcePlayer == null)
|
||||
return;
|
||||
|
||||
if (origin.buyLock.tryLock()) {
|
||||
|
||||
try {
|
||||
CharacterItemManager itemMan = sourcePlayer.getCharItemManager();
|
||||
if (itemMan == null) {
|
||||
|
||||
if (itemMan == null)
|
||||
return;
|
||||
}
|
||||
|
||||
NPC npc = NPC.getFromCache(msg.getNPCID());
|
||||
if (npc == null) {
|
||||
|
||||
if (npc == null)
|
||||
return;
|
||||
}
|
||||
|
||||
Item gold = itemMan.getGoldInventory();
|
||||
if (gold == null) {
|
||||
|
||||
if (gold == null)
|
||||
return;
|
||||
}
|
||||
|
||||
Item buy = null;
|
||||
|
||||
if (msg.getItemType() == GameObjectType.MobEquipment.ordinal()) {
|
||||
ArrayList<MobEquipment> sellInventory = npc.getContract().getSellInventory();
|
||||
if (sellInventory == null) {
|
||||
if (sellInventory == null)
|
||||
return;
|
||||
}
|
||||
for (MobEquipment me : sellInventory) {
|
||||
if (me.getObjectUUID() == msg.getItemID()) {
|
||||
ItemBase ib = me.getItemBase();
|
||||
if (ib == null) {
|
||||
if (ib == null)
|
||||
return;
|
||||
}
|
||||
|
||||
//test room available for item
|
||||
if (!itemMan.hasRoomInventory(ib.getWeight())) {
|
||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||
return;
|
||||
}
|
||||
|
||||
int cost = me.getMagicValue();
|
||||
|
||||
float bargain = sourcePlayer.getBargain();
|
||||
switch(npc.getContractID()){
|
||||
case 1201:
|
||||
cost = ItemBase.getDiscPrice(ib.getUUID());
|
||||
bargain = 0;
|
||||
break;
|
||||
case 1202:
|
||||
cost = ItemBase.getStatPrice(ib.getUUID());
|
||||
bargain = 0;
|
||||
break;
|
||||
case 900:
|
||||
cost = Warehouse.getCostForResource(ib.getUUID()) * Warehouse.getSellStackSize(ib.getUUID());
|
||||
bargain = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||
if(me.getItemBase().getType().equals(ItemType.POTION))
|
||||
profit -= 1.0f;
|
||||
|
||||
if (profit < 1)
|
||||
profit = 1;
|
||||
|
||||
|
||||
cost *= profit;
|
||||
if(npc.getContractID() == 1502041)
|
||||
cost = 2;
|
||||
|
||||
|
||||
if (gold.getNumOfItems() - cost < 0) {
|
||||
//dont' have enough goldItem exit!
|
||||
// chatMan.chatSystemInfo(pc, "" + "You dont have enough gold.");
|
||||
return;
|
||||
}
|
||||
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||
b = null;
|
||||
int buildingDeposit = cost - me.getMagicValue();
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||
// chatMan.chatSystemInfo(pc, "" + "You Failed to buy the item.");
|
||||
ChatManager.chatSystemError(sourcePlayer, "Failed To Buy Item");
|
||||
return;
|
||||
}
|
||||
if(me.getItemBase().getType().equals(ItemType.RESOURCE) && npc.getContractID() == 900){
|
||||
handleResourcePurchase(me,itemMan,sourcePlayer,ib);
|
||||
}else {
|
||||
buy = Item.createItemForPlayer(sourcePlayer, ib, me.fromNoob);
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
if(npc.contractUUID == 900 && buy.getItemBaseID() == 1705032){
|
||||
buy.setNumOfItems(10);
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems());
|
||||
}
|
||||
//itemMan.updateInventory();
|
||||
}
|
||||
|
||||
buy = Item.createItemForPlayer(sourcePlayer, ib);
|
||||
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
//itemMan.updateInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (msg.getItemType() == GameObjectType.Item.ordinal()) {
|
||||
|
||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||
|
||||
if (npcCim == null)
|
||||
return;
|
||||
|
||||
buy = Item.getFromCache(msg.getItemID());
|
||||
|
||||
if (buy == null)
|
||||
return;
|
||||
|
||||
ItemBase ib = buy.getItemBase();
|
||||
|
||||
if (ib == null)
|
||||
return;
|
||||
|
||||
if (!npcCim.inventoryContains(buy))
|
||||
return;
|
||||
|
||||
//test room available for item
|
||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||
return;
|
||||
|
||||
//TODO test cost and subtract goldItem
|
||||
|
||||
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
||||
int cost = buy.getBaseValue();
|
||||
|
||||
if (buy.isID() || buy.isCustomValue())
|
||||
cost = buy.getMagicValue();
|
||||
|
||||
float bargain = sourcePlayer.getBargain();
|
||||
|
||||
float profit = npc.getSellPercent(sourcePlayer) - bargain;
|
||||
|
||||
if (profit < 1)
|
||||
profit = 1;
|
||||
|
||||
if (!buy.isCustomValue())
|
||||
cost *= profit;
|
||||
else
|
||||
cost = buy.getValue();
|
||||
|
||||
|
||||
if (gold.getNumOfItems() - cost < 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
||||
return;
|
||||
}
|
||||
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null)
|
||||
if (b.getProtectionState().equals(ProtectionState.NPC))
|
||||
b = null;
|
||||
|
||||
int buildingDeposit = cost;
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit)) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 110);
|
||||
return;
|
||||
}
|
||||
|
||||
if (buy != null)
|
||||
itemMan.buyFromNPC(buy, npc);
|
||||
|
||||
} else if (msg.getItemType() == GameObjectType.MobLoot.ordinal()) {
|
||||
|
||||
CharacterItemManager npcCim = npc.getCharItemManager();
|
||||
|
||||
if (npcCim == null)
|
||||
return;
|
||||
|
||||
buy = MobLoot.getFromCache(msg.getItemID());
|
||||
|
||||
if (buy == null)
|
||||
return;
|
||||
|
||||
ItemBase ib = buy.getItemBase();
|
||||
|
||||
if (ib == null)
|
||||
return;
|
||||
|
||||
if (!npcCim.inventoryContains(buy))
|
||||
return;
|
||||
|
||||
//test room available for item
|
||||
if (!itemMan.hasRoomInventory(ib.getWeight()))
|
||||
return;
|
||||
|
||||
//TODO test cost and subtract goldItem
|
||||
|
||||
//TODO CHnage this if we ever put NPc city npcs in buildings.
|
||||
|
||||
int cost = buy.getMagicValue();
|
||||
cost *= npc.getSellPercent(sourcePlayer);
|
||||
|
||||
|
||||
if (gold.getNumOfItems() - cost < 0) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 128); // Insufficient Gold
|
||||
return;
|
||||
}
|
||||
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
|
||||
b = null;
|
||||
int buildingDeposit = cost;
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold() && !b.isOwnerIsNPC()) {
|
||||
|
||||
if (b != null && (b.getStrongboxValue() + buildingDeposit) > b.getMaxGold()) {
|
||||
ErrorPopupMsg.sendErrorPopup(sourcePlayer, 206);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!itemMan.buyFromNPC(b, cost, buildingDeposit))
|
||||
return;
|
||||
|
||||
if (buy != null)
|
||||
itemMan.buyFromNPC(buy, npc);
|
||||
|
||||
} else
|
||||
return;
|
||||
|
||||
if (buy != null) {
|
||||
|
||||
msg.setItem(buy);
|
||||
//send the buy message back to update player
|
||||
// msg.setItemType(buy.getObjectType().ordinal());
|
||||
@@ -1570,43 +1579,14 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
|
||||
} finally {
|
||||
origin.buyLock.unlock();
|
||||
}
|
||||
} else {
|
||||
ErrorPopupMsg.sendErrorPopup(origin.getPlayerCharacter(), 12); // All production slots taken
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleResourcePurchase(MobEquipment me, CharacterItemManager itemMan, PlayerCharacter sourcePlayer, ItemBase ib){
|
||||
boolean stacked = false;
|
||||
int buystack = Warehouse.getSellStackSize(me.getItemBase().getUUID());
|
||||
for(Item item : itemMan.getInventory()){
|
||||
int itemID = item.getItemBaseID();
|
||||
int meID = me.getItemBase().getUUID();
|
||||
if(itemID == meID){
|
||||
if(Warehouse.maxResources.isEmpty())
|
||||
Warehouse.getMaxResources();
|
||||
int maxStack = Warehouse.maxResources.get(itemID);
|
||||
if(maxStack > item.getNumOfItems() + buystack){
|
||||
item.setNumOfItems(item.getNumOfItems() + buystack);
|
||||
stacked = true;
|
||||
itemMan.updateInventory();
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(item,item.getNumOfItems());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!stacked){
|
||||
Item buy = Item.createItemForPlayer(sourcePlayer, ib, false);
|
||||
if (buy != null) {
|
||||
me.transferEnchants(buy);
|
||||
itemMan.addItemToInventory(buy);
|
||||
buy.setNumOfItems(buystack);
|
||||
DbManager.ItemQueries.UPDATE_NUM_ITEMS(buy,buy.getNumOfItems());
|
||||
}
|
||||
}
|
||||
itemMan.updateInventory();
|
||||
}
|
||||
|
||||
private static void Repair(RepairMsg msg, ClientConnection origin) {
|
||||
@@ -1666,17 +1646,14 @@ public class ClientMessagePump implements NetMsgHandler {
|
||||
max *= (1 + (durMod * 0.01f));
|
||||
if (dur >= max || dur < 1) {
|
||||
//redundancy message to clear item from window in client
|
||||
if (!DbManager.ItemQueries.SET_DURABILITY(toRepair, dur))
|
||||
return;
|
||||
toRepair.setDurabilityCurrent(max);
|
||||
msg.setupRepairAck(max - dur);
|
||||
dispatch = Dispatch.borrow(player, msg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
return;
|
||||
}
|
||||
|
||||
int cost = (int)((toRepair.getMagicValue()/max*(max - dur)) + (npc.getRepairCost() * npc.buyPercent));
|
||||
|
||||
//TODO get cost to repair
|
||||
int cost = (int) ((max - dur) * 80.1);
|
||||
Building b = (!npc.isStatic()) ? npc.getBuilding() : null;
|
||||
|
||||
if (b != null)
|
||||
|
||||
@@ -11,7 +11,6 @@ import engine.objects.GuildStatusController;
|
||||
import engine.objects.Mine;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.Resource;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
/*
|
||||
* @Author:
|
||||
@@ -36,28 +35,26 @@ public class ArcMineChangeProductionMsgHandler extends AbstractClientMsgHandler
|
||||
|
||||
//TODO verify this against the warehouse?
|
||||
|
||||
if (!GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus())) // is this only GL?
|
||||
if (GuildStatusController.isInnerCouncil(playerCharacter.getGuildStatus()) == false) // is this only GL?
|
||||
return true;
|
||||
|
||||
Mine mine = Mine.getMine(changeProductionMsg.getMineID());
|
||||
|
||||
if (mine == null) {
|
||||
Logger.error("Player Character: " + playerCharacter.getName() + " Tried To Change Mine: " + changeProductionMsg.getMineID() + " and Mine was Null");
|
||||
if (mine == null)
|
||||
return true;
|
||||
}
|
||||
|
||||
//make sure mine belongs to guild
|
||||
|
||||
if (mine.getOwningGuild().isEmptyGuild() || mine.getOwningGuild().getObjectUUID() != playerCharacter.getGuild().getObjectUUID())
|
||||
if (mine.getOwningGuild().isEmptyGuild() ||
|
||||
mine.getOwningGuild().getObjectUUID() != playerCharacter.getGuild().getObjectUUID())
|
||||
return true;
|
||||
|
||||
//make sure valid resource
|
||||
|
||||
Resource resource = Resource.resourceByHash.get(changeProductionMsg.getResourceHash());
|
||||
|
||||
if (resource == null) {
|
||||
Logger.error("Player Character: " + playerCharacter.getName() + " Tried To Change Mine: " + changeProductionMsg.getMineID() + " and Resource was Null");
|
||||
if (resource == null)
|
||||
return true;
|
||||
}
|
||||
|
||||
//update resource
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class CityDataHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// If the hotZone has changed then update the client's map accordingly.
|
||||
|
||||
if (playerCharacter.getTimestamps().containsKey("hotzoneupdate") && playerCharacter.getTimeStamp("hotzoneupdate") <= ZoneManager.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
|
||||
if (playerCharacter.getTimeStamp("hotzoneupdate") <= ZoneManager.hotZoneLastUpdate.toEpochMilli() && ZoneManager.hotZone != null) {
|
||||
HotzoneChangeMsg hotzoneChangeMsg = new HotzoneChangeMsg(Enum.GameObjectType.Zone.ordinal(), ZoneManager.hotZone.getObjectUUID());
|
||||
dispatch = Dispatch.borrow(playerCharacter, hotzoneChangeMsg);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
||||
|
||||
@@ -17,7 +17,6 @@ import engine.powers.PowersBase;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
|
||||
/*
|
||||
* @Author:
|
||||
@@ -106,7 +105,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
// Validate player can obtain blessing
|
||||
|
||||
if (!GuildStatusController.isGuildLeader(player.getGuildStatus())) {
|
||||
if (GuildStatusController.isGuildLeader(player.getGuildStatus()) == false) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 173); // You must be the leader of a guild to receive a blessing
|
||||
return;
|
||||
}
|
||||
@@ -127,12 +126,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
realm = RealmMap.getRealmForCity(city);
|
||||
|
||||
if (!realm.getCanBeClaimed()) {
|
||||
if (realm.getCanBeClaimed() == false) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 180); // This territory cannot be ruled by anyone
|
||||
return;
|
||||
}
|
||||
|
||||
if (realm.isRuled()) {
|
||||
if (realm.isRuled() == true) {
|
||||
ErrorPopupMsg.sendErrorPopup(player, 178); // This territory is already claimed
|
||||
return;
|
||||
}
|
||||
@@ -143,12 +142,12 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
}
|
||||
|
||||
private static void requestBoon(PlayerCharacter player, NPC npc) {
|
||||
private static void requestBoon(MerchantMsg msg, ClientConnection origin, PlayerCharacter player, NPC npc) {
|
||||
|
||||
Building shrineBuilding;
|
||||
Shrine shrine;
|
||||
|
||||
if (!npc.getGuild().getNation().equals(player.getGuild().getNation()))
|
||||
if (npc.getGuild() != player.getGuild())
|
||||
return;
|
||||
|
||||
shrineBuilding = npc.getBuilding();
|
||||
@@ -156,7 +155,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
if (shrineBuilding == null)
|
||||
return;
|
||||
|
||||
if (shrineBuilding.getBlueprint() != null && !shrineBuilding.getBlueprint().getBuildingGroup().equals(engine.Enum.BuildingGroup.SHRINE))
|
||||
if (shrineBuilding.getBlueprint() != null && shrineBuilding.getBlueprint().getBuildingGroup() != engine.Enum.BuildingGroup.SHRINE)
|
||||
return;
|
||||
|
||||
if (shrineBuilding.getRank() == -1)
|
||||
@@ -172,9 +171,11 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
//already haz boon.
|
||||
|
||||
if (player.containsEffect(shrine.getShrineType().getPowerToken())) {
|
||||
//remove old boon to apply new one, allows boon refreshing
|
||||
player.effects.remove(PowersManager.getPowerByToken(shrine.getShrineType().getPowerToken()).name);
|
||||
ErrorPopupMsg.sendErrorPopup(player, 199);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Shrine.canTakeFavor(player, shrine))
|
||||
@@ -190,34 +191,16 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
int trains = 0;
|
||||
switch(npc.getRank()){
|
||||
case 1:
|
||||
trains = 5;
|
||||
break;
|
||||
case 2:
|
||||
trains = 10;
|
||||
break;
|
||||
case 3:
|
||||
trains = 15;
|
||||
break;
|
||||
case 4:
|
||||
trains = 20;
|
||||
break;
|
||||
case 5:
|
||||
trains = 25;
|
||||
break;
|
||||
case 6:
|
||||
trains = 30;
|
||||
break;
|
||||
case 7:
|
||||
trains = 35;
|
||||
break;
|
||||
}
|
||||
|
||||
if(Objects.requireNonNull(shrineBuilding.getCity()).getTOL() != null && shrineBuilding.getCity().getTOL().getRank() == 8)
|
||||
trains += 5;
|
||||
int rank = shrine.getRank();
|
||||
//R8 trees always get atleast rank 2 boons. rank uses index, where 0 is first place, 1 is second, etc...
|
||||
if (shrineBuilding.getCity() != null && shrineBuilding.getCity().getTOL() != null && shrineBuilding.getCity().getTOL().getRank() == 8)
|
||||
if (rank != 0)
|
||||
rank = 1;
|
||||
int trains = 40 - (rank * 10);
|
||||
if (trains < 0)
|
||||
trains = 0;
|
||||
|
||||
//System.out.println(trains);
|
||||
PowersManager.applyPower(player, player, player.getLoc(), shrinePower.getToken(), trains, false);
|
||||
ChatManager.chatGuildInfo(player.getGuild(), player.getName() + " has recieved a boon costing " + 1 + " point of favor.");
|
||||
shrineBuilding.addEffectBit(1000000 << 2);
|
||||
@@ -437,7 +420,7 @@ public class MerchantMsgHandler extends AbstractClientMsgHandler {
|
||||
if (isHermit(npc))
|
||||
requestHermitBlessing(msg, origin, player, npc);
|
||||
else
|
||||
requestBoon(player, npc);
|
||||
requestBoon(msg, origin, player, npc);
|
||||
break;
|
||||
case 15:
|
||||
LeaderboardMessage lbm = new LeaderboardMessage();
|
||||
|
||||
@@ -421,12 +421,31 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
itemMan.consume(item);
|
||||
}
|
||||
break;
|
||||
//ANNIVERSERY GIFT
|
||||
case 31:
|
||||
// *** Disabled for now: Needs bootyset created
|
||||
|
||||
//if (ib.getUUID() == 971012) {
|
||||
// int random = ThreadLocalRandom.current().nextInt(ItemBase.AnniverseryGifts.size());
|
||||
// int annyID = ItemBase.AnniverseryGifts.get(random);
|
||||
|
||||
// ItemBase annyIB = ItemBase.getItemBase(annyID);
|
||||
// if (annyIB != null) {
|
||||
// Item gift = MobLoot.createItemForPlayer(player, annyIB);
|
||||
// if (gift != null) {
|
||||
// itemMan.addItemToInventory(gift);
|
||||
// itemMan.consume(item);
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
//}
|
||||
|
||||
LootManager.peddleFate(player,item);
|
||||
break;
|
||||
|
||||
case 30: //water bucket
|
||||
case 8: //potions, tears of saedron
|
||||
|
||||
case 5: //runes, petition, warrant, scrolls
|
||||
if (uuid > 3000 && uuid < 3050) { //Discipline Runes
|
||||
if (ApplyRuneMsg.applyRune(uuid, origin, player)) {
|
||||
@@ -509,6 +528,7 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
}
|
||||
|
||||
// Send piss bucket animation
|
||||
|
||||
VisualUpdateMessage vum = new VisualUpdateMessage(player, 16323);
|
||||
vum.configure();
|
||||
DispatchMessage.sendToAllInRange(player, vum);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
package engine.net.client.msg;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.net.*;
|
||||
import engine.net.client.ClientConnection;
|
||||
@@ -71,86 +70,62 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
}
|
||||
|
||||
public static boolean applyRune(int runeID, ClientConnection origin, PlayerCharacter playerCharacter) {
|
||||
|
||||
RuneBase rb = RuneBase.getRuneBase(runeID);
|
||||
Dispatch dispatch;
|
||||
|
||||
if (playerCharacter == null || origin == null || rb == null) {
|
||||
return false;
|
||||
}
|
||||
int raceID = playerCharacter.getRaceID();
|
||||
|
||||
//Check race is met
|
||||
ConcurrentHashMap<Integer, Boolean> races = rb.getRace();
|
||||
if(runeID != 3007 && runeID != 3014) {//bounty hunter and huntsman
|
||||
if (races.size() > 0) {
|
||||
boolean valid = false;
|
||||
for (int validID : races.keySet()) {
|
||||
if (validID == raceID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(runeID == 3040)
|
||||
valid = true;
|
||||
if(runeID == 2514 && raceID == 1999)
|
||||
valid = true;
|
||||
if(runeID == 3036 && raceID == 1999)
|
||||
if (races.size() > 0) {
|
||||
int raceID = playerCharacter.getRaceID();
|
||||
boolean valid = false;
|
||||
for (int validID : races.keySet()) {
|
||||
if (validID == raceID) {
|
||||
valid = true;
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
valid = true;
|
||||
if (!valid) {
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Check base class is met
|
||||
ConcurrentHashMap<Integer, Boolean> baseClasses = rb.getBaseClass();
|
||||
if (baseClasses.size() > 0) {
|
||||
int baseClassID = playerCharacter.getBaseClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : baseClasses.keySet()) {
|
||||
if (validID == baseClassID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(runeID == 3040)
|
||||
valid = true;
|
||||
if(runeID == 3036 && raceID == 1999)
|
||||
valid = true;
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
valid = true;
|
||||
if(runeID == 3035 && baseClassID == 2501)
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check base class is met
|
||||
ConcurrentHashMap<Integer, Boolean> baseClasses = rb.getBaseClass();
|
||||
if (baseClasses.size() > 0) {
|
||||
int baseClassID = playerCharacter.getBaseClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : baseClasses.keySet()) {
|
||||
if (validID == baseClassID) {
|
||||
valid = true;
|
||||
if (!valid) {
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Check promotion class is met
|
||||
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
|
||||
if (promotionClasses.size() > 0) {
|
||||
int promotionClassID = playerCharacter.getPromotionClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : promotionClasses.keySet()) {
|
||||
if (validID == promotionClassID) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(runeID == 3040)
|
||||
valid = true;
|
||||
if(runeID == 3004 && (playerCharacter.getPromotionClassID() == 2505 || playerCharacter.getPromotionClassID() == 2510))
|
||||
valid = true;
|
||||
if(runeID == 3036 && raceID == 1999)
|
||||
valid = true;
|
||||
if(runeID == 3033 && raceID == 1999)
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check promotion class is met
|
||||
ConcurrentHashMap<Integer, Boolean> promotionClasses = rb.getPromotionClass();
|
||||
if (promotionClasses.size() > 0) {
|
||||
int promotionClassID = playerCharacter.getPromotionClassID();
|
||||
boolean valid = false;
|
||||
for (int validID : promotionClasses.keySet()) {
|
||||
if (validID == promotionClassID) {
|
||||
valid = true;
|
||||
if (!valid) {
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else{
|
||||
if(playerCharacter.getPromotionClassID() == 2519){//priest
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check disciplines are met
|
||||
ArrayList<CharacterRune> runes = playerCharacter.getRunes();
|
||||
ConcurrentHashMap<Integer, Boolean> disciplines = rb.getDiscipline();
|
||||
@@ -164,6 +139,7 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int discCount = 0;
|
||||
for (CharacterRune cr : runes) {
|
||||
int runeBaseID = cr.getRuneBaseID();
|
||||
@@ -176,32 +152,28 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Check level is met
|
||||
if (playerCharacter.getLevel() < rb.getLevelRequired()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int strTotal = 0;
|
||||
int dexTotal = 0;
|
||||
int conTotal = 0;
|
||||
int intTotal = 0;
|
||||
int spiTotal = 0;
|
||||
int cost = 0;
|
||||
|
||||
//Check any attributes are met
|
||||
ArrayList<RuneBaseAttribute> attrs = rb.getAttrs();
|
||||
|
||||
if (rb.getAttrs() != null)
|
||||
for (RuneBaseAttribute rba : attrs) {
|
||||
int attrID = rba.getAttributeID();
|
||||
int mod = rba.getModValue();
|
||||
switch (attrID) {
|
||||
case MBServerStatics.RUNE_COST_ATTRIBUTE_ID:
|
||||
switch (rb.getName()) {
|
||||
case "Born of the Ethyri":
|
||||
case "Born of the Taripontor":
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
mod = 0;
|
||||
}
|
||||
if (mod > playerCharacter.getUnusedStatPoints()) {
|
||||
return false;
|
||||
}
|
||||
@@ -254,33 +226,14 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if max number runes already reached
|
||||
if (runes.size() > 12) {
|
||||
return false;
|
||||
}
|
||||
switch (rb.getName()) {
|
||||
case "Born of the Ethyri":
|
||||
case "Born of the Taripontor":
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
for (CharacterRune charRune : playerCharacter.getRunes()) {
|
||||
RuneBase rb2 = charRune.getRuneBase();
|
||||
switch (rb2.getName()) {
|
||||
case "Born of the Ethyri":
|
||||
case "Born of the Taripontor":
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
ChatManager.chatSystemError(playerCharacter, "You Have Already Applied A Blood Rune");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if discipline, check number applied
|
||||
if (isDiscipline(runeID)) {
|
||||
//if(playerCharacter.getLevel() == 80)
|
||||
discCount -= 1; // level 80 characters get an extra disc rune
|
||||
if (playerCharacter.getLevel() < 70) {
|
||||
if (discCount > 2) {
|
||||
return false;
|
||||
@@ -291,6 +244,7 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Everything succeeded. Let's apply the rune
|
||||
//Attempt add rune to database
|
||||
CharacterRune runeWithoutID = new CharacterRune(rb, playerCharacter.getObjectUUID());
|
||||
@@ -304,6 +258,7 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
if (cr == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//remove any overridden runes from player
|
||||
ArrayList<Integer> overwrite = rb.getOverwrite();
|
||||
CharacterRune toRemove = null;
|
||||
@@ -312,10 +267,13 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
toRemove = playerCharacter.removeRune(overwriteID);
|
||||
}
|
||||
}
|
||||
|
||||
//add rune to player
|
||||
playerCharacter.addRune(cr);
|
||||
|
||||
// recalculate all bonuses/formulas/skills/powers
|
||||
playerCharacter.recalculate();
|
||||
|
||||
//if overwriting a stat rune, add any amount granted from previous rune.
|
||||
if (toRemove != null) {
|
||||
RuneBase rbs = toRemove.getRuneBase();
|
||||
@@ -341,32 +299,30 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
if (dif > 0 && spiTotal < (int) playerCharacter.statSpiMax) {
|
||||
playerCharacter.addSpi(dif);
|
||||
}
|
||||
|
||||
// recalculate all bonuses/formulas/skills/powers
|
||||
playerCharacter.recalculate();
|
||||
}
|
||||
}
|
||||
switch (rb.getName()) {
|
||||
case "Born of the Ethyri":
|
||||
case "Born of the Taripontor":
|
||||
case "Born of the Gwendannen":
|
||||
case "Born of the Invorri":
|
||||
case "Born of the Irydnu":
|
||||
cost = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (cost > 0) {
|
||||
ModifyStatMsg msm = new ModifyStatMsg((0 - cost), 0, 3);
|
||||
dispatch = Dispatch.borrow(playerCharacter, msm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
}
|
||||
|
||||
//send apply rune message to client
|
||||
ApplyRuneMsg arm = new ApplyRuneMsg(playerCharacter.getObjectType().ordinal(), playerCharacter.getObjectUUID(), runeID, cr.getObjectType().ordinal(), cr.getObjectUUID(), false);
|
||||
dispatch = Dispatch.borrow(playerCharacter, arm);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
//alert them of success
|
||||
ErrorPopupMsg.sendErrorPopup(playerCharacter, 160);
|
||||
|
||||
//reapply bonuses
|
||||
playerCharacter.applyBonuses();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@ import engine.net.client.Protocol;
|
||||
import engine.objects.Building;
|
||||
import engine.objects.Guild;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Seconds;
|
||||
import java.time.Instant;
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoField;
|
||||
|
||||
public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
|
||||
@@ -27,8 +28,8 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
private Building treeOfLife;
|
||||
|
||||
private int currentMineHour;
|
||||
private Seconds secondsLeft;
|
||||
private DateTime lateTime;
|
||||
private Duration secondsLeft;
|
||||
private Instant lateTime;
|
||||
private int late;
|
||||
|
||||
/**
|
||||
@@ -73,15 +74,15 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
currentMineHour = guild.getMineTime();
|
||||
|
||||
late = MBServerStatics.MINE_LATE_WINDOW;
|
||||
lateTime = DateTime.now();
|
||||
lateTime = Instant.now();
|
||||
|
||||
if (late == 0)
|
||||
lateTime = lateTime.plusDays(1);
|
||||
lateTime = lateTime.plus(Duration.ofDays(1));
|
||||
|
||||
lateTime = lateTime.hourOfDay().setCopy(late);
|
||||
lateTime = lateTime.with(ChronoField.HOUR_OF_DAY, late);
|
||||
|
||||
late = ((late > 23) ? (late - 24) : late);
|
||||
secondsLeft = Seconds.secondsBetween(DateTime.now(), lateTime);
|
||||
secondsLeft = Duration.between(Instant.now(), lateTime);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,4 +108,4 @@ public class ArcMineWindowAvailableTimeMsg extends ClientNetMsg {
|
||||
public void setBuildingUUID(int buildingUUID) {
|
||||
this.buildingUUID = buildingUUID;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,10 +104,8 @@ public class CityDataMsg extends ClientNetMsg {
|
||||
}
|
||||
|
||||
temp.putInt(mineList.size());
|
||||
for (Mine mine : mineList) {
|
||||
if(mine.getParentZone() != null && !mine.getParentZone().isContinent())
|
||||
Mine.serializeForClientMsg(mine, temp);
|
||||
}
|
||||
for (Mine mine : mineList)
|
||||
Mine.serializeForClientMsg(mine, temp);
|
||||
temp.put((byte) 0); // PAD
|
||||
}
|
||||
|
||||
@@ -180,10 +178,8 @@ public class CityDataMsg extends ClientNetMsg {
|
||||
}
|
||||
|
||||
writer.putInt(mineList.size());
|
||||
for (Mine mine : mineList) {
|
||||
if(mine.getParentZone() != null && !mine.getParentZone().isContinent())
|
||||
Mine.serializeForClientMsg(mine, writer);
|
||||
}
|
||||
for (Mine mine : mineList)
|
||||
Mine.serializeForClientMsg(mine, writer);
|
||||
} else
|
||||
writer.putInt(0);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -275,7 +275,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
|
||||
writer.putString(npcHire.getName());
|
||||
writer.putInt(1);
|
||||
writer.putInt(0);
|
||||
writer.putInt(Blueprint.getNpcMaintCost(npcHire.getRank()));
|
||||
if (npcHire.getObjectType() == GameObjectType.NPC)
|
||||
writer.putInt(((NPC) npcHire).getContract().getIconID()); // Was 60
|
||||
else if (npcHire.getObjectType() == GameObjectType.Mob) {
|
||||
@@ -497,7 +497,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
if (building.getBlueprint() == null)
|
||||
writer.putInt(0);
|
||||
else
|
||||
writer.putInt(building.getBlueprint().getMaintCost()); // maint cost
|
||||
writer.putInt(building.getBlueprint().getMaintCost(building.getRank())); // maint cost
|
||||
|
||||
if (building.getRank() == 8) {
|
||||
writer.putInt(74856115); // Stone
|
||||
@@ -514,7 +514,7 @@ public class ManageCityAssetsMsg extends ClientNetMsg {
|
||||
|
||||
if (maintDate == null)
|
||||
maintDate = LocalDateTime.now();
|
||||
writer.putLocalDateTime(maintDate); // current time
|
||||
writer.putLocalDateTime(LocalDateTime.now()); // current time
|
||||
|
||||
// utc offset?
|
||||
writer.putInt((int) java.time.Duration.between(LocalDateTime.now(), maintDate).getSeconds()); // Seconds to maint date
|
||||
|
||||
@@ -11,7 +11,6 @@ package engine.net.client.msg;
|
||||
|
||||
|
||||
import engine.gameManager.ConfigManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.net.AbstractConnection;
|
||||
import engine.net.ByteBufferReader;
|
||||
import engine.net.ByteBufferWriter;
|
||||
@@ -54,45 +53,18 @@ public class ServerInfoMsg extends ClientNetMsg {
|
||||
|
||||
writer.putInt(WorldServer.worldMapID);
|
||||
writer.putString(ConfigManager.MB_WORLD_NAME.getValue());
|
||||
int TotalTrees = 21;
|
||||
int currentR8Trees = DbManager.CityQueries.GET_CAPITAL_CITY_COUNT();
|
||||
|
||||
switch(currentR8Trees){
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
writer.putInt(0); //Land Rush
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
writer.putInt(1); //Low pop
|
||||
break;
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
writer.putInt(2); //Normal pop
|
||||
break;
|
||||
case 13:
|
||||
case 14:
|
||||
case 15:
|
||||
case 16:
|
||||
writer.putInt(3); //High Pop
|
||||
break;
|
||||
case 17:
|
||||
case 18:
|
||||
case 19:
|
||||
case 20:
|
||||
writer.putInt(4); //Very overpopulated pop
|
||||
break;
|
||||
default:
|
||||
writer.putInt(5); //Full pop
|
||||
break;
|
||||
}
|
||||
if (LoginServer.population < MBServerStatics.LOW_POPULATION)
|
||||
writer.putInt(0); //Land Rush
|
||||
else if (LoginServer.population < MBServerStatics.NORMAL_POPULATION)
|
||||
writer.putInt(1); //Low pop
|
||||
else if (LoginServer.population < MBServerStatics.HIGH_POPULATION)
|
||||
writer.putInt(2); //Normal pop
|
||||
else if (LoginServer.population < MBServerStatics.VERY_OVERPOPULATED_POPULATION)
|
||||
writer.putInt(3); //High Pop
|
||||
else if (LoginServer.population < MBServerStatics.FULL_POPULATION)
|
||||
writer.putInt(4); //Very overpopulated pop
|
||||
else
|
||||
writer.putInt(5); //Full pop
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -96,11 +96,6 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(npc.contractUUID == 1502040){ //enrollment officer
|
||||
PlayerCharacter.unboxPlayer(playerCharacter);
|
||||
}
|
||||
|
||||
// Restrict disc trainers to only characters who have
|
||||
// tht disc applied.
|
||||
|
||||
|
||||
@@ -1187,15 +1187,10 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
}
|
||||
|
||||
public final float modifyHealth(float value, final AbstractCharacter attacker, final boolean fromCost) {
|
||||
|
||||
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||
} // Health modifications are modified by the ZergMechanic
|
||||
|
||||
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
|
||||
value *= ((Mob)attacker).getOwner().ZergMultiplier;
|
||||
}// Health modifications from pets are modified by the owner's ZergMechanic
|
||||
public final float modifyHealth(
|
||||
final float value,
|
||||
final AbstractCharacter attacker,
|
||||
final boolean fromCost) {
|
||||
|
||||
try {
|
||||
|
||||
@@ -1259,19 +1254,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final float modifyMana(
|
||||
float value,
|
||||
final float value,
|
||||
final AbstractCharacter attacker,
|
||||
final boolean fromCost
|
||||
) {
|
||||
|
||||
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||
} // Health modifications are modified by the ZergMechanic
|
||||
|
||||
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
|
||||
value *= ((Mob)attacker).getOwner().ZergMultiplier;
|
||||
}// Health modifications from pets are modified by the owner's ZergMechanic
|
||||
|
||||
if (!this.isAlive()) {
|
||||
return 0f;
|
||||
}
|
||||
@@ -1306,19 +1293,11 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final float modifyStamina(
|
||||
float value,
|
||||
final float value,
|
||||
final AbstractCharacter attacker,
|
||||
final boolean fromCost
|
||||
) {
|
||||
|
||||
if(attacker != null && attacker.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
value *= ((PlayerCharacter)attacker).ZergMultiplier;
|
||||
} // Health modifications are modified by the ZergMechanic
|
||||
|
||||
if(attacker != null && attacker.getObjectType().equals(GameObjectType.Mob) && ((Mob)attacker).getOwner() != null){
|
||||
value *= ((Mob)attacker).getOwner().ZergMultiplier;
|
||||
}// Health modifications from pets are modified by the owner's ZergMechanic
|
||||
|
||||
if (!this.isAlive()) {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@@ -108,10 +108,8 @@ public class Blueprint {
|
||||
maxShrines = 2;
|
||||
break;
|
||||
case 7:
|
||||
maxShrines = 3;
|
||||
break;
|
||||
case 8:
|
||||
maxShrines = 4;
|
||||
maxShrines = 3;
|
||||
break;
|
||||
default:
|
||||
maxShrines = 0;
|
||||
@@ -169,7 +167,11 @@ public class Blueprint {
|
||||
// based upon the building's current rank
|
||||
|
||||
public static int getNpcMaintCost(int rank) {
|
||||
return 0;
|
||||
int maintCost = Integer.MAX_VALUE;
|
||||
|
||||
maintCost = (9730 * rank) + 1890;
|
||||
|
||||
return maintCost;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
@@ -179,8 +181,6 @@ public class Blueprint {
|
||||
public int getMaxSlots() {
|
||||
if (this.buildingGroup != null && this.buildingGroup.equals(BuildingGroup.BARRACK))
|
||||
return 1;
|
||||
if (this.buildingGroup != null && this.buildingGroup.equals(BuildingGroup.TOL))
|
||||
return 4;
|
||||
return maxSlots;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ public class Blueprint {
|
||||
|
||||
// Early exit for buildings with single or no slots
|
||||
|
||||
if (this.maxSlots <= 1 && !this.buildingGroup.equals(BuildingGroup.TOL))
|
||||
if (this.maxSlots <= 1)
|
||||
return maxSlots;
|
||||
|
||||
if (this.maxRank == 1 && currentRank == 1)
|
||||
@@ -327,20 +327,20 @@ public class Blueprint {
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
availableSlots = 2;
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
availableSlots = 2;
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
availableSlots = 3;
|
||||
break;
|
||||
case 8:
|
||||
availableSlots = 1;
|
||||
break;
|
||||
default:
|
||||
availableSlots = 0;
|
||||
break;
|
||||
}
|
||||
if(this.buildingGroup != null && this.buildingGroup.equals(BuildingGroup.TOL))
|
||||
availableSlots += 1;
|
||||
|
||||
return availableSlots;
|
||||
}
|
||||
@@ -603,14 +603,26 @@ public class Blueprint {
|
||||
return this.blueprintUUID;
|
||||
}
|
||||
|
||||
public int getMaintCost() {
|
||||
public int getMaintCost(int rank) {
|
||||
|
||||
int maintCost = Integer.MAX_VALUE;
|
||||
|
||||
if(this.buildingGroup.equals(BuildingGroup.TOL)){
|
||||
return 3000000;
|
||||
}else{
|
||||
return 0;
|
||||
switch (this.buildingGroup) {
|
||||
case TOL:
|
||||
case BARRACK:
|
||||
maintCost = (61500 * rank) + 19500;
|
||||
break;
|
||||
case SPIRE:
|
||||
maintCost = (4800 * rank) + 1200;
|
||||
break;
|
||||
default:
|
||||
if (maxRank == 1)
|
||||
maintCost = 22500;
|
||||
else
|
||||
maintCost = (15900 * rank) + 3300;
|
||||
break;
|
||||
}
|
||||
|
||||
return maintCost;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,9 +780,24 @@ public class Building extends AbstractWorldObject {
|
||||
|
||||
public int getMaintCost() {
|
||||
|
||||
if(this.getBlueprint() != null && this.getBlueprint().getBuildingGroup().equals(BuildingGroup.TOL))
|
||||
return 3000000;
|
||||
else return 0;
|
||||
int maintCost = 0;
|
||||
|
||||
// Add cost for building structure
|
||||
|
||||
maintCost += this.getBlueprint().getMaintCost(rank);
|
||||
|
||||
// Add costs associated with hirelings
|
||||
|
||||
for (AbstractCharacter npc : this.hirelings.keySet()) {
|
||||
|
||||
if (npc.getObjectType() != GameObjectType.NPC)
|
||||
continue;
|
||||
|
||||
|
||||
maintCost += Blueprint.getNpcMaintCost(npc.getRank());
|
||||
}
|
||||
|
||||
return maintCost;
|
||||
}
|
||||
|
||||
public final void submitOpenDoorJob(int doorID) {
|
||||
|
||||
@@ -86,12 +86,6 @@ public class Contract extends AbstractGameObject {
|
||||
this.iconID = rs.getInt("iconID");
|
||||
this.vendorID = rs.getInt("vendorID");
|
||||
this.allowedBuildings = EnumBitSet.asEnumBitSet(rs.getLong("allowedBuildingTypeID"), Enum.BuildingGroup.class);
|
||||
switch(this.contractID){
|
||||
case 866: //banker
|
||||
case 865: //siege engineer
|
||||
case 899: //alchemist
|
||||
this.allowedBuildings.add(Enum.BuildingGroup.TOL);
|
||||
}
|
||||
this.equipmentSet = rs.getInt("equipSetID");
|
||||
this.inventorySet = rs.getInt("inventorySet");
|
||||
|
||||
@@ -204,91 +198,6 @@ public class Contract extends AbstractGameObject {
|
||||
}
|
||||
|
||||
public ArrayList<MobEquipment> getSellInventory() {
|
||||
if(this.getObjectUUID() == 900){ //resource merchant
|
||||
for(MobEquipment me : this.sellInventory){
|
||||
if(me.getItemBase().getType().equals(Enum.ItemType.RESOURCE)){
|
||||
int amountResource = Warehouse.getSellStackSize(me.getItemBase().getUUID());
|
||||
me.magicValue = amountResource * me.getItemBase().getBaseValue() * 2;
|
||||
} else{
|
||||
me.magicValue = 100000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.getObjectUUID() == 1202){ //rune merchant
|
||||
for(MobEquipment me : this.sellInventory){
|
||||
switch(me.getItemBase().getUUID()){
|
||||
case 250001: //5 stats
|
||||
case 250010:
|
||||
case 250019:
|
||||
case 250028:
|
||||
case 250037:
|
||||
me.magicValue = 3000000;
|
||||
break;
|
||||
case 250002: //10 stats
|
||||
case 250011:
|
||||
case 250020:
|
||||
case 250029:
|
||||
case 250038:
|
||||
me.magicValue = 4000000;
|
||||
break;
|
||||
case 250003: //15 stats
|
||||
case 250012:
|
||||
case 250021:
|
||||
case 250030:
|
||||
case 250039:
|
||||
me.magicValue = 5000000;
|
||||
break;
|
||||
case 250004: //20 stats
|
||||
case 250013:
|
||||
case 250022:
|
||||
case 250031:
|
||||
case 250040:
|
||||
me.magicValue = 6000000;
|
||||
break;
|
||||
case 250005: //25 stats
|
||||
case 250014:
|
||||
case 250023:
|
||||
case 250032:
|
||||
case 250041:
|
||||
me.magicValue = 7000000;
|
||||
break;
|
||||
case 250006: //30 stats
|
||||
case 250015:
|
||||
case 250024:
|
||||
case 250033:
|
||||
case 250042:
|
||||
me.magicValue = 8000000;
|
||||
break;
|
||||
case 250007: //35 stats
|
||||
case 250016:
|
||||
case 250025:
|
||||
case 250034:
|
||||
case 250043:
|
||||
me.magicValue = 9000000;
|
||||
break;
|
||||
default:
|
||||
me.magicValue = 10000000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.getObjectUUID() == 1201){ //disc merchant
|
||||
for(MobEquipment me : this.sellInventory){
|
||||
if(me.getItemBase().getName().equals("Prospector")){
|
||||
me.magicValue = 500000;
|
||||
}else{
|
||||
me.magicValue = 10000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.getObjectUUID() == 1502041) {//noob helper{
|
||||
for(MobEquipment me : this.sellInventory){
|
||||
me.magicValue = 1;
|
||||
}
|
||||
}
|
||||
return this.sellInventory;
|
||||
}
|
||||
|
||||
|
||||
@@ -752,9 +752,9 @@ public class Guild extends AbstractWorldObject {
|
||||
canSub = false;
|
||||
}
|
||||
City nationCap = City.getCity(nation.cityUUID);
|
||||
//if (nation.getSubGuildList().size() >= nationCap.getRank()) {
|
||||
// canSub = false;
|
||||
//}
|
||||
if (nation.getSubGuildList().size() >= nationCap.getRank()) {
|
||||
canSub = false;
|
||||
}
|
||||
return canSub;
|
||||
}
|
||||
|
||||
|
||||
@@ -233,6 +233,7 @@ public class Item extends AbstractWorldObject {
|
||||
this.value = rs.getInt("item_value");
|
||||
this.customName = rs.getString("item_name");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void _serializeForClientMsg(Item item, ByteBufferWriter writer)
|
||||
@@ -302,7 +303,7 @@ public class Item extends AbstractWorldObject {
|
||||
writer.putString(item.customName); // Unknown. pad?
|
||||
writer.put((byte) 1); // End Datablock byte
|
||||
|
||||
writer.putFloat((float) item.getDurabilityMax());
|
||||
writer.putFloat((float) item.durabilityMax);
|
||||
writer.putFloat((float) item.durabilityCurrent);
|
||||
|
||||
writer.put((byte) 1); // End Datablock byte
|
||||
@@ -608,7 +609,7 @@ public class Item extends AbstractWorldObject {
|
||||
writer.putIntAt(serialized, indexPosition);
|
||||
}
|
||||
|
||||
public static Item createItemForPlayer(PlayerCharacter pc, ItemBase ib, boolean fromNoob) {
|
||||
public static Item createItemForPlayer(PlayerCharacter pc, ItemBase ib) {
|
||||
Item item = null;
|
||||
byte charges = 0;
|
||||
|
||||
@@ -884,15 +885,7 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public short getDurabilityMax() {
|
||||
int extra = 0;
|
||||
for(Effect eff : this.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(ModType.Durability)){
|
||||
extra += mod.getMaxMod();
|
||||
}
|
||||
}
|
||||
}
|
||||
return (short)(durabilityMax + extra);
|
||||
return durabilityMax;
|
||||
}
|
||||
|
||||
public boolean isCanDestroy() {
|
||||
@@ -955,7 +948,6 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public boolean isID() {
|
||||
this.flags |= 1;
|
||||
return ((this.flags & 1) > 0);
|
||||
}
|
||||
|
||||
@@ -1205,7 +1197,6 @@ public class Item extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public int getBaseValue() {
|
||||
|
||||
if (this.getItemBase() != null)
|
||||
return this.getItemBase().getBaseValue();
|
||||
return 0;
|
||||
|
||||
@@ -75,6 +75,7 @@ public class ItemBase {
|
||||
private boolean isStrBased;
|
||||
private ArrayList<Integer> animations = new ArrayList<>();
|
||||
private ArrayList<Integer> offHandAnimations = new ArrayList<>();
|
||||
private boolean autoID = false;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
@@ -144,6 +145,8 @@ public class ItemBase {
|
||||
|
||||
}
|
||||
|
||||
this.autoIDItemsCheck();
|
||||
|
||||
try {
|
||||
DbManager.ItemBaseQueries.LOAD_ANIMATIONS(this);
|
||||
} catch (Exception e) {
|
||||
@@ -220,76 +223,16 @@ public class ItemBase {
|
||||
AnniverseryGifts.add(971008);
|
||||
AnniverseryGifts.add(971009);
|
||||
AnniverseryGifts.add(971010);
|
||||
//AnniverseryGifts.add(5101000);
|
||||
//AnniverseryGifts.add(5101020);
|
||||
//AnniverseryGifts.add(5101100);
|
||||
//AnniverseryGifts.add(5101120);
|
||||
//AnniverseryGifts.add(5101040);
|
||||
//AnniverseryGifts.add(5101140);
|
||||
//AnniverseryGifts.add(5101060);
|
||||
//AnniverseryGifts.add(5101080);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static int getDiscPrice(int uuid) {
|
||||
if(uuid == 3040)
|
||||
return 500000;
|
||||
else return 10000000;
|
||||
}
|
||||
|
||||
public static int getStatPrice(int uuid) {
|
||||
switch(uuid){
|
||||
case 250001: //5 stats
|
||||
case 250010:
|
||||
case 250019:
|
||||
case 250028:
|
||||
case 250037:
|
||||
return 3000000;
|
||||
case 250002: //10 stats
|
||||
case 250011:
|
||||
case 250020:
|
||||
case 250029:
|
||||
case 250038:
|
||||
return 4000000;
|
||||
case 250003: //15 stats
|
||||
case 250012:
|
||||
case 250021:
|
||||
case 250030:
|
||||
case 250039:
|
||||
return 5000000;
|
||||
case 250004: //20 stats
|
||||
case 250013:
|
||||
case 250022:
|
||||
case 250031:
|
||||
case 250040:
|
||||
return 6000000;
|
||||
case 250005: //25 stats
|
||||
case 250014:
|
||||
case 250023:
|
||||
case 250032:
|
||||
case 250041:
|
||||
return 7000000;
|
||||
case 250006: //30 stats
|
||||
case 250015:
|
||||
case 250024:
|
||||
case 250033:
|
||||
case 250042:
|
||||
return 8000000;
|
||||
case 250007: //35 stats
|
||||
case 250016:
|
||||
case 250025:
|
||||
case 250034:
|
||||
case 250043:
|
||||
return 9000000;
|
||||
case 250008: //40 stats
|
||||
case 250017:
|
||||
case 250026:
|
||||
case 250035:
|
||||
case 250044:
|
||||
return 10000000;
|
||||
}
|
||||
return 10000000;
|
||||
AnniverseryGifts.add(5101000);
|
||||
AnniverseryGifts.add(5101020);
|
||||
AnniverseryGifts.add(5101100);
|
||||
AnniverseryGifts.add(5101120);
|
||||
AnniverseryGifts.add(5101040);
|
||||
AnniverseryGifts.add(5101140);
|
||||
AnniverseryGifts.add(5101060);
|
||||
AnniverseryGifts.add(5101080);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -429,10 +372,74 @@ public class ItemBase {
|
||||
return modTable;
|
||||
}
|
||||
|
||||
public int getVendorType() {
|
||||
return vendorType;
|
||||
}
|
||||
|
||||
public void setVendorType(int vendorType) {
|
||||
this.vendorType = vendorType;
|
||||
}
|
||||
|
||||
public int getHashID() {
|
||||
return hashID;
|
||||
}
|
||||
|
||||
public void setHashID(int hashID) {
|
||||
this.hashID = hashID;
|
||||
}
|
||||
|
||||
private void autoIDItemsCheck() {
|
||||
//AUto ID Vorg and Glass
|
||||
switch (uuid) {
|
||||
|
||||
case 27550:
|
||||
case 27560:
|
||||
case 27580:
|
||||
case 27590:
|
||||
case 188500:
|
||||
case 188510:
|
||||
case 188520:
|
||||
case 188530:
|
||||
case 188540:
|
||||
case 188550:
|
||||
case 189100:
|
||||
case 189110:
|
||||
case 189120:
|
||||
case 189130:
|
||||
case 189140:
|
||||
case 189150:
|
||||
case 189510:
|
||||
case 27600:
|
||||
case 181840:
|
||||
case 188700:
|
||||
case 188720:
|
||||
case 189550:
|
||||
case 189560:
|
||||
case 7000100:
|
||||
case 7000110:
|
||||
case 7000120:
|
||||
case 7000130:
|
||||
case 7000140:
|
||||
case 7000150:
|
||||
case 7000160:
|
||||
case 7000170:
|
||||
case 7000180:
|
||||
case 7000190:
|
||||
case 7000200:
|
||||
case 7000210:
|
||||
case 7000220:
|
||||
case 7000230:
|
||||
case 7000240:
|
||||
case 7000250:
|
||||
case 7000270:
|
||||
case 7000280:
|
||||
this.autoID = true;
|
||||
break;
|
||||
default:
|
||||
this.autoID = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean validForSkills(ConcurrentHashMap<String, CharacterSkill> skills) {
|
||||
|
||||
CharacterSkill characterSkill;
|
||||
@@ -899,4 +906,12 @@ public class ItemBase {
|
||||
public void setOffHandAnimations(ArrayList<Integer> offHandAnimations) {
|
||||
this.offHandAnimations = offHandAnimations;
|
||||
}
|
||||
|
||||
public boolean isAutoID() {
|
||||
return autoID;
|
||||
}
|
||||
|
||||
public void setAutoID(boolean autoID) {
|
||||
this.autoID = autoID;
|
||||
}
|
||||
}
|
||||
|
||||
+101
-163
@@ -11,7 +11,10 @@ package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.*;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.gameManager.ZoneManager;
|
||||
import engine.net.ByteBufferWriter;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.server.MBServerStatics;
|
||||
@@ -22,9 +25,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static engine.gameManager.DbManager.MineQueries;
|
||||
@@ -51,13 +51,6 @@ public class Mine extends AbstractGameObject {
|
||||
private int buildingID;
|
||||
private MineProduction mineType;
|
||||
|
||||
public int openHour;
|
||||
public int openMinute;
|
||||
public int capSize;
|
||||
public LocalDateTime liveTime;
|
||||
public final HashSet<Integer> _playerMemory = new HashSet<>();
|
||||
public ArrayList<PlayerCharacter> affectedPlayers = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
@@ -97,15 +90,7 @@ public class Mine extends AbstractGameObject {
|
||||
|
||||
this.production = Resource.valueOf(rs.getString("mine_resource"));
|
||||
this.lastClaimer = null;
|
||||
this.openHour = rs.getInt("mineLiveHour");
|
||||
this.openMinute = rs.getInt("mineLiveMinute");
|
||||
this.capSize = rs.getInt("capSize");
|
||||
this.liveTime = LocalDateTime.now().withHour(this.openHour).withMinute(this.openMinute);
|
||||
Building tower = BuildingManager.getBuildingFromCache(this.buildingID);
|
||||
if(tower != null){
|
||||
tower.setMaxHitPoints(5000f * this.capSize);
|
||||
tower.setCurrentHitPoints(tower.healthMax);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void releaseMineClaims(PlayerCharacter playerCharacter) {
|
||||
@@ -176,45 +161,56 @@ public class Mine extends AbstractGameObject {
|
||||
}
|
||||
|
||||
public static void serializeForClientMsg(Mine mine, ByteBufferWriter writer) {
|
||||
try {
|
||||
writer.putInt(mine.getObjectType().ordinal());
|
||||
writer.putInt(mine.getObjectUUID());
|
||||
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
||||
writer.putString(mine.mineType.name);
|
||||
//writer.putString(mine.zoneName + " " + mine.capSize + " Man ");
|
||||
writer.putString(mine.capSize + " Man ");
|
||||
writer.putInt(mine.production.hash);
|
||||
writer.putInt(mine.production.baseProduction);
|
||||
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
writer.putInt(3600); //window in seconds
|
||||
|
||||
LocalDateTime mineOpenTime = LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute).withSecond(0).withNano(0);
|
||||
|
||||
writer.putLocalDateTime(mineOpenTime);
|
||||
writer.putLocalDateTime(mineOpenTime.plusMinutes(30));
|
||||
writer.put(mine.isActive ? (byte) 0x01 : (byte) 0x00);
|
||||
|
||||
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
|
||||
if (mineTower != null) {
|
||||
writer.putFloat(mineTower.getLoc().x);
|
||||
writer.putFloat(mineTower.getParentZone().getLoc().y);
|
||||
writer.putFloat(mineTower.getLoc().z);
|
||||
} else {
|
||||
writer.putFloat(mine.parentZone.getLoc().x);
|
||||
writer.putFloat(mine.parentZone.getLoc().y);
|
||||
writer.putFloat(mine.parentZone.getLoc().z);
|
||||
Logger.error("Mine Tower Was Null For Mine: " + mine.getObjectUUID());
|
||||
}
|
||||
writer.putInt(mine.getObjectType().ordinal());
|
||||
writer.putInt(mine.getObjectUUID());
|
||||
writer.putInt(mine.getObjectUUID()); //actually a hash of mine
|
||||
writer.putString(mine.mineType.name);
|
||||
writer.putString(mine.zoneName);
|
||||
writer.putInt(mine.production.hash);
|
||||
writer.putInt(mine.production.baseProduction);
|
||||
writer.putInt(mine.getModifiedProductionAmount()); //TODO calculate range penalty here
|
||||
writer.putInt(3600); //window in seconds
|
||||
|
||||
writer.putInt(mine.isExpansion() ? mine.mineType.xpacHash : mine.mineType.hash);
|
||||
// Errant mines are currently open. Set time to now.
|
||||
|
||||
LocalDateTime mineOpenTime = LocalDateTime.now().withMinute(0).withSecond(0).withNano(0);
|
||||
|
||||
// Mine times are those of the nation not individual guild.
|
||||
|
||||
Guild mineNatonGuild = mine.getOwningGuild().getNation();
|
||||
|
||||
// Adjust the serialized mine time based upon whether
|
||||
// the Guild's mine window has passed or not and if it was claimed.
|
||||
// If a mine is active serialize current datetime irrespective
|
||||
// of any claim.
|
||||
|
||||
if (mineNatonGuild.isEmptyGuild() == false && mine.isActive == false) {
|
||||
|
||||
int guildWOO = mineNatonGuild.getNation().getMineTime();
|
||||
LocalDateTime guildMineTime = mineOpenTime.withHour(guildWOO);
|
||||
|
||||
if (mineOpenTime.isAfter(guildMineTime) || mine.wasClaimed == true)
|
||||
mineOpenTime = guildMineTime.plusDays(1);
|
||||
else
|
||||
mineOpenTime = guildMineTime;
|
||||
|
||||
writer.putString(mine.guildName);
|
||||
GuildTag._serializeForDisplay(mine.guildTag, writer);
|
||||
writer.putString(mine.nationName);
|
||||
GuildTag._serializeForDisplay(mine.nationTag, writer);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed TO Serialize Mine Because: " + e.getMessage());
|
||||
}
|
||||
|
||||
writer.putLocalDateTime(mineOpenTime);
|
||||
writer.putLocalDateTime(mineOpenTime.plusHours(1));
|
||||
writer.put(mine.isActive ? (byte) 0x01 : (byte) 0x00);
|
||||
|
||||
Building mineTower = BuildingManager.getBuilding(mine.buildingID);
|
||||
writer.putFloat(mineTower.getLoc().x);
|
||||
writer.putFloat(mineTower.getParentZone().getLoc().y);
|
||||
writer.putFloat(mineTower.getLoc().z);
|
||||
|
||||
writer.putInt(mine.isExpansion() ? mine.mineType.xpacHash : mine.mineType.hash);
|
||||
|
||||
writer.putString(mine.guildName);
|
||||
GuildTag._serializeForDisplay(mine.guildTag, writer);
|
||||
writer.putString(mine.nationName);
|
||||
GuildTag._serializeForDisplay(mine.nationTag, writer);
|
||||
}
|
||||
|
||||
public static ArrayList<Mine> getMinesForGuild(int guildID) {
|
||||
@@ -294,9 +290,26 @@ public class Mine extends AbstractGameObject {
|
||||
if (treeRank < 1)
|
||||
return false;
|
||||
|
||||
if (guildUnderMineLimit(playerGuild.getNation(), treeRank) == false) {
|
||||
ErrorPopupMsg.sendErrorMsg(playerCharacter, "Your nation cannot support another mine.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean guildUnderMineLimit(Guild playerGuild, int tolRank) {
|
||||
|
||||
int mineCnt = 0;
|
||||
|
||||
mineCnt += Mine.getMinesForGuild(playerGuild.getObjectUUID()).size();
|
||||
|
||||
for (Guild guild : playerGuild.getSubGuildList())
|
||||
mineCnt += Mine.getMinesForGuild(guild.getObjectUUID()).size();
|
||||
|
||||
return mineCnt <= tolRank;
|
||||
}
|
||||
|
||||
public boolean changeProductionType(Resource resource) {
|
||||
if (!this.validForMine(resource))
|
||||
return false;
|
||||
@@ -365,16 +378,6 @@ public class Mine extends AbstractGameObject {
|
||||
Building building = BuildingManager.getBuildingFromCache(this.buildingID);
|
||||
if (building != null && !this.isActive)
|
||||
building.isDeranking.compareAndSet(true, false);
|
||||
|
||||
if(!isAc){
|
||||
for(PlayerCharacter player : this.affectedPlayers){
|
||||
try {
|
||||
player.ZergMultiplier = 1.0f;
|
||||
} catch(Exception e){
|
||||
//something went wrong resetting zerg multiplier, maybe player was deleted?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean validForMine(Resource r) {
|
||||
@@ -535,106 +538,41 @@ public class Mine extends AbstractGameObject {
|
||||
}
|
||||
|
||||
public int getModifiedProductionAmount() {
|
||||
ItemBase resourceBase = ItemBase.getItemBase(this.production.UUID);
|
||||
if(resourceBase == null)
|
||||
return 0;
|
||||
int value = resourceBase.getBaseValue();
|
||||
|
||||
int amount = 0;
|
||||
switch(this.capSize){
|
||||
case 3:
|
||||
amount = 1800000;
|
||||
break;
|
||||
case 5:
|
||||
amount = 3000000;
|
||||
break;
|
||||
case 10:
|
||||
amount = 6000000;
|
||||
break;
|
||||
case 20:
|
||||
amount = 12000000;
|
||||
break;
|
||||
}
|
||||
if(this.production.UUID == 7)
|
||||
value = 1;
|
||||
|
||||
amount = amount / value;
|
||||
|
||||
return amount;
|
||||
}
|
||||
public void onEnter() {
|
||||
|
||||
Building tower = BuildingManager.getBuildingFromCache(this.buildingID);
|
||||
if(tower == null)
|
||||
return;
|
||||
|
||||
// Gather current list of players within the zone bounds
|
||||
|
||||
HashSet<AbstractWorldObject> currentPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, Enum.CityBoundsType.GRID.extents, MBServerStatics.MASK_PLAYER);
|
||||
HashMap<Guild,ArrayList<PlayerCharacter>> charactersByNation = new HashMap<>();
|
||||
ArrayList<Guild> updatedNations = new ArrayList<>();
|
||||
for (AbstractWorldObject playerObject : currentPlayers) {
|
||||
|
||||
if (playerObject == null)
|
||||
continue;
|
||||
|
||||
PlayerCharacter player = (PlayerCharacter) playerObject;
|
||||
|
||||
if(this.affectedPlayers.contains(player) == false)
|
||||
this.affectedPlayers.add(player);
|
||||
|
||||
if(!this._playerMemory.contains(player.getObjectUUID())){
|
||||
this._playerMemory.add(player.getObjectUUID());
|
||||
}
|
||||
Guild nation = player.guild.getNation();
|
||||
if(charactersByNation.containsKey(nation)){
|
||||
if(!charactersByNation.get(nation).contains(player)) {
|
||||
charactersByNation.get(nation).add(player);
|
||||
if(!updatedNations.contains(nation)){
|
||||
updatedNations.add(nation);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ArrayList<PlayerCharacter> players = new ArrayList<>();
|
||||
players.add(player);
|
||||
charactersByNation.put(nation,players);
|
||||
if(!updatedNations.contains(nation)){
|
||||
updatedNations.add(nation);
|
||||
}
|
||||
}
|
||||
//TODO Calculate Distance modifications.
|
||||
|
||||
//calculate base values.
|
||||
int baseProduction = this.production.baseProduction;
|
||||
float baseModValue = this.production.baseProduction * .1f;
|
||||
float rankModValue = this.production.baseProduction * .0143f;
|
||||
float totalModded = 0;
|
||||
|
||||
//get Mine Building.
|
||||
Building mineBuilding = BuildingManager.getBuilding(this.buildingID);
|
||||
if (mineBuilding == null)
|
||||
return this.production.baseProduction;
|
||||
for (AbstractCharacter harvester : mineBuilding.getHirelings().keySet()) {
|
||||
totalModded += baseModValue;
|
||||
totalModded += rankModValue * harvester.getRank();
|
||||
}
|
||||
for(Guild nation : updatedNations){
|
||||
float multiplier = ZergManager.getCurrentMultiplier(charactersByNation.get(nation).size(),this.capSize);
|
||||
for(PlayerCharacter player : charactersByNation.get(nation)){
|
||||
player.ZergMultiplier = multiplier;
|
||||
//add base production on top;
|
||||
totalModded += baseProduction;
|
||||
//skip distance check for expansion.
|
||||
if (this.isExpansion())
|
||||
return (int) totalModded;
|
||||
|
||||
if (this.owningGuild.isEmptyGuild() == false) {
|
||||
if (this.owningGuild.getOwnedCity() != null) {
|
||||
float distanceSquared = this.owningGuild.getOwnedCity().getLoc().distanceSquared2D(mineBuilding.getLoc());
|
||||
|
||||
if (distanceSquared > sqr(10000 * 3))
|
||||
totalModded *= .25f;
|
||||
else if (distanceSquared > sqr(10000 * 2))
|
||||
totalModded *= .50f;
|
||||
else if (distanceSquared > sqr(10000))
|
||||
totalModded *= .75f;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
this.onExit(this._playerMemory);
|
||||
}
|
||||
catch(Exception ignored){
|
||||
|
||||
}
|
||||
return (int) totalModded;
|
||||
}
|
||||
|
||||
private void onExit(HashSet<Integer> currentMemory) {
|
||||
|
||||
Building tower = BuildingManager.getBuildingFromCache(this.buildingID);
|
||||
if(tower == null)
|
||||
return;
|
||||
ArrayList<Integer>toRemove = new ArrayList<>();
|
||||
HashSet<AbstractWorldObject> currentPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, Enum.CityBoundsType.GRID.extents, MBServerStatics.MASK_PLAYER);
|
||||
for(Integer id : currentMemory){
|
||||
PlayerCharacter pc = PlayerCharacter.getPlayerCharacter(id);
|
||||
if(currentPlayers.contains(pc) == false){
|
||||
toRemove.add(id);
|
||||
pc.ZergMultiplier = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove players from city memory
|
||||
|
||||
_playerMemory.removeAll(toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup;
|
||||
|
||||
public class Mob extends AbstractIntelligenceAgent {
|
||||
|
||||
public static ArrayList<Mob> discDroppers = new ArrayList<>();
|
||||
private static final ReentrantReadWriteLock createLock = new ReentrantReadWriteLock();
|
||||
private static final ConcurrentHashMap<Integer, Mob> mobMapByDBID = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
// Variables NOT to be stored in db
|
||||
@@ -575,11 +574,11 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
mob = new Mob(mobBase, guild, parent, level, owner, 0);
|
||||
if (mob.mobBase == null)
|
||||
return null;
|
||||
|
||||
mob.runAfterLoad();
|
||||
Vector3fImmutable loc = owner.getLoc();
|
||||
DbManager.addToCache(mob);
|
||||
mob.setPet(owner, true);
|
||||
mob.setWalkMode(false);
|
||||
mob.runAfterLoad();
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
@@ -1397,11 +1396,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
loadInventory();
|
||||
|
||||
this.updateLocation();
|
||||
|
||||
if(Mob.discDroppers.contains(this)){
|
||||
this.setLevel((short)65);
|
||||
this.setResists(new Resists("Dropper"));
|
||||
}
|
||||
}
|
||||
|
||||
public void despawn() {
|
||||
@@ -1472,7 +1466,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
|
||||
//Resists.calculateResists(this);
|
||||
Resists.calculateResists(this);
|
||||
}
|
||||
|
||||
public void calculateMaxHealthManaStamina() {
|
||||
@@ -2269,9 +2263,5 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void AddDiscDropper(Mob mob){
|
||||
discDroppers.add(mob);
|
||||
mob.setLevel((short)65);
|
||||
mob.setResists(new Resists("Dropper"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,8 +34,7 @@ public class MobEquipment extends AbstractGameObject {
|
||||
private AbstractPowerAction suffix;
|
||||
private int pValue;
|
||||
private int sValue;
|
||||
int magicValue;
|
||||
public boolean fromNoob = false;
|
||||
private int magicValue;
|
||||
|
||||
private float dropChance = 0;
|
||||
|
||||
@@ -107,6 +106,7 @@ public class MobEquipment extends AbstractGameObject {
|
||||
|
||||
public static void serializeForVendor(MobEquipment mobEquipment, ByteBufferWriter writer, float percent) throws SerializationException {
|
||||
_serializeForClientMsg(mobEquipment, writer, false);
|
||||
int baseValue = mobEquipment.itemBase.getBaseValue() + mobEquipment.itemBase.getMagicValue();
|
||||
writer.putInt(mobEquipment.magicValue);
|
||||
writer.putInt(mobEquipment.magicValue);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public final class MobLoot extends Item {
|
||||
this.setNumOfItems(quantity);
|
||||
|
||||
this.noSteal = noSteal;
|
||||
this.setIsID(true);
|
||||
this.setIsID(this.getItemBase().isAutoID());
|
||||
|
||||
// Class is 'final'; passing 'this' should be okay at the end of the constructor
|
||||
|
||||
|
||||
@@ -175,10 +175,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
private boolean dirtyLoad = true;
|
||||
private final ReadWriteLock dirtyLock = new ReentrantReadWriteLock(true);
|
||||
|
||||
public float ZergMultiplier = 1.0f;
|
||||
|
||||
public boolean isBoxed = false;
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
*/
|
||||
@@ -4815,17 +4811,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
updateBlessingMessage();
|
||||
|
||||
this.safeZone = this.isInSafeZone();
|
||||
if(!this.timestamps.containsKey("nextBoxCheck"))
|
||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||
|
||||
if(!this.isBoxed && this.timestamps.get("nextBoxCheck") < System.currentTimeMillis()) {
|
||||
this.isBoxed = checkIfBoxed(this);
|
||||
this.timestamps.put("nextBoxCheck", System.currentTimeMillis() + 10000);
|
||||
}
|
||||
|
||||
if(this.isBoxed && !this.containsEffect(1672601862)) {
|
||||
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, 1672601862, 40, false);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e);
|
||||
@@ -4834,44 +4819,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void unboxPlayer(PlayerCharacter player){
|
||||
String machineID = player.getClientConnection().machineID;
|
||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||
for(PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()){
|
||||
if(!pc.equals(player) && pc. isActive && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(machineID)){
|
||||
sameMachine.add(pc);
|
||||
}
|
||||
}
|
||||
|
||||
for(PlayerCharacter pc : sameMachine)
|
||||
pc.isBoxed = true;
|
||||
|
||||
player.isBoxed = false;
|
||||
if(player.containsEffect(1672601862)) {
|
||||
player.removeEffectBySource(EffectSourceType.DeathShroud,41,false);
|
||||
}
|
||||
|
||||
}
|
||||
public static boolean checkIfBoxed(PlayerCharacter player){
|
||||
try {
|
||||
String machineID = player.getClientConnection().machineID;
|
||||
ArrayList<PlayerCharacter> sameMachine = new ArrayList<>();
|
||||
for (PlayerCharacter pc : SessionManager.getAllActivePlayerCharacters()) {
|
||||
if (!pc.equals(player) && pc.isActive && pc.isEnteredWorld() && pc.getClientConnection().machineID.equals(machineID)) {
|
||||
sameMachine.add(pc);
|
||||
}
|
||||
}
|
||||
|
||||
boolean boxed = false;
|
||||
for (PlayerCharacter pc : sameMachine)
|
||||
if (!pc.isBoxed)
|
||||
boxed = true;
|
||||
|
||||
return boxed;
|
||||
}catch(Exception e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void updateFlight() {
|
||||
|
||||
|
||||
@@ -46,9 +46,6 @@ public class Resists {
|
||||
case "Mine":
|
||||
setMineResists();
|
||||
break;
|
||||
case "Dropper":
|
||||
setDropperResists();
|
||||
break;
|
||||
default:
|
||||
setGenericResists();
|
||||
break;
|
||||
@@ -234,24 +231,6 @@ public class Resists {
|
||||
this.resists.put(DamageType.Siege, 0f);
|
||||
}
|
||||
|
||||
public final void setDropperResists() {
|
||||
this.immuneToAll = false;
|
||||
this.resists.put(DamageType.Slash, 50f);
|
||||
this.resists.put(DamageType.Crush, 50f);
|
||||
this.resists.put(DamageType.Pierce, 50f);
|
||||
this.resists.put(DamageType.Magic, 50f);
|
||||
this.resists.put(DamageType.Bleed, 50f);
|
||||
this.resists.put(DamageType.Poison, 50f);
|
||||
this.resists.put(DamageType.Mental, 50f);
|
||||
this.resists.put(DamageType.Holy, 50f);
|
||||
this.resists.put(DamageType.Unholy, 50f);
|
||||
this.resists.put(DamageType.Lightning, 50f);
|
||||
this.resists.put(DamageType.Fire, 50f);
|
||||
this.resists.put(DamageType.Cold, 50f);
|
||||
this.resists.put(DamageType.Healing, 0f);
|
||||
this.immuneTo.put(DamageType.Siege, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create generic resists
|
||||
*/
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
|
||||
|
||||
public static boolean canTakeFavor(PlayerCharacter grantee, Shrine shrine) {
|
||||
|
||||
if (shrine.shrineType.isRace()) {
|
||||
if (shrine.shrineType.isRace())
|
||||
switch (grantee.getRaceID()) {
|
||||
case 2000:
|
||||
case 2001:
|
||||
@@ -96,7 +96,6 @@ public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
|
||||
|
||||
case 2025:
|
||||
case 2026:
|
||||
case 1999:
|
||||
if (shrine.shrineType == ShrineType.Nephilim)
|
||||
return true;
|
||||
break;
|
||||
@@ -107,7 +106,7 @@ public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
|
||||
break;
|
||||
|
||||
}
|
||||
}else {
|
||||
else
|
||||
switch (grantee.getPromotionClassID()) {
|
||||
case 2504:
|
||||
if (shrine.shrineType == ShrineType.Assassin)
|
||||
@@ -198,7 +197,7 @@ public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -227,6 +226,26 @@ public class Shrine extends AbstractWorldObject implements Comparable<Shrine> {
|
||||
|
||||
}
|
||||
|
||||
public void decay() {
|
||||
|
||||
if (this.getFavors() == 0)
|
||||
return;
|
||||
|
||||
int decayAmount = (int) (this.getFavors() - (this.getFavors() * .10f));
|
||||
|
||||
if (decayAmount < 0)
|
||||
decayAmount = 0;
|
||||
|
||||
if (!DbManager.ShrineQueries.updateFavors(this, decayAmount, this.getFavors())) {
|
||||
Logger.error("Shrine Decay", "Error writing to DB. UUID: " + this.getObjectUUID());
|
||||
return;
|
||||
}
|
||||
this.favors = decayAmount;
|
||||
|
||||
Logger.info(shrineType.name() + " uuid:" + this.getObjectUUID() + " Amount: " + this.getFavors() * .10f);
|
||||
|
||||
}
|
||||
|
||||
public synchronized boolean addFavor(PlayerCharacter boonOwner, Item boonItem) {
|
||||
|
||||
if (boonOwner == null)
|
||||
|
||||
@@ -281,84 +281,6 @@ public class Warehouse extends AbstractWorldObject {
|
||||
|
||||
}
|
||||
|
||||
public static int getCostForResource(int id){
|
||||
int newCost = 1;
|
||||
switch(id){
|
||||
case 1580000://stone
|
||||
newCost = 3000;
|
||||
break;
|
||||
case 1580001://truesteel
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580002://iron
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580003://adamant
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580004://lumber
|
||||
newCost = 3000;
|
||||
break;
|
||||
case 1580005://oak
|
||||
newCost = 30000;
|
||||
break;
|
||||
case 1580006://bronzewood
|
||||
newCost = 30000;
|
||||
break;
|
||||
case 1580007://mandrake
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580008://coal
|
||||
newCost = 30000;
|
||||
break;
|
||||
case 1580009://agate
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580010://diamond
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580011://onyx
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580012://azoth
|
||||
newCost = 50000;
|
||||
break;
|
||||
case 1580013://orichalk
|
||||
newCost = 30000;
|
||||
break;
|
||||
case 1580014://antimony
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580015://sulfur
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580016://quicksilver
|
||||
newCost = 100000;
|
||||
break;
|
||||
case 1580017://galvor
|
||||
newCost = 300000;
|
||||
break;
|
||||
case 1580018://wormwood
|
||||
newCost = 300000;
|
||||
break;
|
||||
case 1580019://obsidian
|
||||
newCost = 200000;
|
||||
break;
|
||||
case 1580020://bloodstone
|
||||
newCost = 200000;
|
||||
break;
|
||||
case 1705032:
|
||||
newCost = 100000;
|
||||
break;
|
||||
}
|
||||
return newCost;
|
||||
}
|
||||
public static int getSellStackSize(int id){
|
||||
if(id == 1705032)
|
||||
return 10;
|
||||
return 3000000 / getCostForResource(id);
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<ItemBase, Integer> getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ public class Zone extends AbstractGameObject {
|
||||
if (hash == null)
|
||||
setHash();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void serializeForClientMsg(Zone zone, ByteBufferWriter writer) {
|
||||
@@ -112,8 +113,8 @@ public class Zone extends AbstractGameObject {
|
||||
|
||||
if (zone.playerCityID > 0) {
|
||||
writer.put((byte) 1); // Player City - True
|
||||
writer.putFloat(Enum.CityBoundsType.GRID.extents);
|
||||
writer.putFloat(Enum.CityBoundsType.GRID.extents);
|
||||
writer.putFloat(Enum.CityBoundsType.ZONE.extents);
|
||||
writer.putFloat(Enum.CityBoundsType.ZONE.extents);
|
||||
} else
|
||||
writer.put((byte) 0); // Player City - False
|
||||
|
||||
|
||||
@@ -40,7 +40,10 @@ import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.util.ThreadUtils;
|
||||
import engine.workthreads.*;
|
||||
import engine.workthreads.DisconnectTrashTask;
|
||||
import engine.workthreads.HourlyJobThread;
|
||||
import engine.workthreads.PurgeOprhans;
|
||||
import engine.workthreads.WarehousePushThread;
|
||||
import org.pmw.tinylog.Configurator;
|
||||
import org.pmw.tinylog.Level;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -198,7 +201,6 @@ public class WorldServer {
|
||||
LocalDateTime nextPopulationFileTime = LocalDateTime.now();
|
||||
LocalDateTime nextFlashTrashCheckTime = LocalDateTime.now();
|
||||
LocalDateTime nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1);
|
||||
LocalDateTime nextHalfHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0);
|
||||
LocalDateTime nextWareHousePushTime = LocalDateTime.now();
|
||||
|
||||
// Begin execution of main game loop
|
||||
@@ -230,13 +232,6 @@ public class WorldServer {
|
||||
nextHourlyJobTime = LocalDateTime.now().withMinute(0).withSecond(0).plusHours(1);
|
||||
}
|
||||
|
||||
if (LocalDateTime.now().isAfter(nextHalfHourlyJobTime)) {
|
||||
Thread halfHourlyJobThread = new Thread(new HalfHourlyJobThread());
|
||||
halfHourlyJobThread.setName("halfHourlyJob");
|
||||
halfHourlyJobThread.start();
|
||||
nextHalfHourlyJobTime = nextHalfHourlyJobTime.plusMinutes(30);
|
||||
}
|
||||
|
||||
if (LocalDateTime.now().isAfter(nextWareHousePushTime)) {
|
||||
Thread warehousePushThread = new Thread(new WarehousePushThread());
|
||||
warehousePushThread.setName("warehousePush");
|
||||
@@ -440,6 +435,9 @@ public class WorldServer {
|
||||
Logger.info("Loading Max Skills for Trainers");
|
||||
DbManager.SkillsBaseQueries.LOAD_ALL_MAX_SKILLS_FOR_CONTRACT();
|
||||
|
||||
//pick a startup Hotzone
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
|
||||
Logger.info("Loading All Players from database to Server Cache");
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
@@ -490,8 +488,8 @@ public class WorldServer {
|
||||
MobRespawnThread.startRespawnThread();
|
||||
|
||||
// Run maintenance
|
||||
//moved this to hourly job thread to sustain no reboot system
|
||||
//MaintenanceManager.dailyMaintenance();
|
||||
|
||||
MaintenanceManager.dailyMaintenance();
|
||||
|
||||
Logger.info("Starting Orphan Item Purge");
|
||||
PurgeOprhans.startPurgeThread();
|
||||
@@ -499,7 +497,7 @@ public class WorldServer {
|
||||
// Open/Close mines for the current window
|
||||
|
||||
Logger.info("Processing mine window.");
|
||||
HalfHourlyJobThread.processMineWindow();
|
||||
HourlyJobThread.processMineWindow();
|
||||
|
||||
// Calculate bootstrap time and rest boot time to current time.
|
||||
|
||||
|
||||
@@ -1,166 +0,0 @@
|
||||
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||
// Magicbane Emulator Project © 2013 - 2022
|
||||
// www.magicbane.com
|
||||
|
||||
|
||||
package engine.workthreads;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
import engine.db.archive.MineRecord;
|
||||
import engine.gameManager.*;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.MessageDispatcher;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.world.WorldServer;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static engine.server.MBServerStatics.MINE_LATE_WINDOW;
|
||||
|
||||
public class HalfHourlyJobThread implements Runnable {
|
||||
|
||||
public HalfHourlyJobThread() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void processMineWindow() {
|
||||
|
||||
try {
|
||||
|
||||
ArrayList<Mine> mines = Mine.getMines();
|
||||
|
||||
for (Mine mine : mines) {
|
||||
try {
|
||||
|
||||
//handle mines opening on server reboot weird time interval
|
||||
if(LocalDateTime.now().isAfter(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute))) {
|
||||
if (LocalDateTime.now().isBefore(LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute).plusMinutes(30))) {
|
||||
HalfHourlyJobThread.mineWindowOpen(mine);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// set to the current mine window.
|
||||
|
||||
if (mine.openHour == LocalDateTime.now().getHour() && mine.openMinute == LocalDateTime.now().getMinute() && !mine.wasClaimed) {
|
||||
HalfHourlyJobThread.mineWindowOpen(mine);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Close the mine if it reaches this far
|
||||
LocalDateTime openTime = LocalDateTime.now().withHour(mine.openHour).withMinute(mine.openMinute);
|
||||
if(LocalDateTime.now().plusMinutes(1).isAfter(openTime.plusMinutes(30)))
|
||||
mineWindowClose(mine);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error("mineID: " + mine.getObjectUUID(), e.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void mineWindowOpen(Mine mine) {
|
||||
|
||||
mine.setActive(true);
|
||||
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Mine is now Active!");
|
||||
Logger.info(mine.getZoneName() + "'s Mine is now Active!");
|
||||
}
|
||||
|
||||
public static boolean mineWindowClose(Mine mine) {
|
||||
|
||||
// No need to end the window of a mine which never opened.
|
||||
|
||||
if (mine.isActive == false)
|
||||
return false;
|
||||
|
||||
Building mineBuilding = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
||||
|
||||
if (mineBuilding == null) {
|
||||
Logger.debug("Null mine building for Mine " + mine.getObjectUUID() + " Building " + mine.getBuildingID());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mine building still stands; nothing to do.
|
||||
// We can early exit here.
|
||||
|
||||
if (mineBuilding.getRank() > 0) {
|
||||
mine.setActive(false);
|
||||
mine.lastClaimer = null;
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.guildName + " has defended the mine in " + mine.getParentZone().getParent().getName() + ". The mine is no longer active.");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
return true;
|
||||
}
|
||||
|
||||
// This mine does not have a valid claimer
|
||||
// we will therefore set it to errant
|
||||
// and keep the window open.
|
||||
|
||||
if (!Mine.validateClaimer(mine.lastClaimer)) {
|
||||
mine.lastClaimer = null;
|
||||
mine.updateGuildOwner(null);
|
||||
mine.setActive(true);
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.getParentZone().getParent().getName() + " Was not claimed, the battle rages on!");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Update ownership to map
|
||||
|
||||
mine.guildName = mine.getOwningGuild().getName();
|
||||
mine.guildTag = mine.getOwningGuild().getGuildTag();
|
||||
Guild nation = mine.getOwningGuild().getNation();
|
||||
mine.nationName = nation.getName();
|
||||
mine.nationTag = nation.getGuildTag();
|
||||
|
||||
mineBuilding.rebuildMine();
|
||||
WorldGrid.updateObject(mineBuilding);
|
||||
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.lastClaimer.getName() + " has claimed the mine in " + mine.getParentZone().getParent().getName() + " for " + mine.getOwningGuild().getName() + ". The mine is no longer active.");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
|
||||
// Warehouse this claim event
|
||||
|
||||
MineRecord mineRecord = MineRecord.borrow(mine, mine.lastClaimer, Enum.RecordEventType.CAPTURE);
|
||||
DataWarehouse.pushToWarehouse(mineRecord);
|
||||
|
||||
mineBuilding.setRank(mineBuilding.getRank());
|
||||
mine.lastClaimer = null;
|
||||
mine.setActive(false);
|
||||
mine.wasClaimed = true;
|
||||
for(Integer id : mine._playerMemory){
|
||||
PlayerCharacter pc = PlayerCharacter.getFromCache(id);
|
||||
if(pc != null)
|
||||
pc.ZergMultiplier = 1.0f;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
Logger.info("Half-Hourly job is now running.");
|
||||
|
||||
// Open or Close mines for the current mine window.
|
||||
|
||||
processMineWindow();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,13 @@
|
||||
package engine.workthreads;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.archive.DataWarehouse;
|
||||
import engine.db.archive.MineRecord;
|
||||
import engine.gameManager.*;
|
||||
import engine.net.DispatchMessage;
|
||||
import engine.net.MessageDispatcher;
|
||||
import engine.net.client.msg.chat.ChatSystemMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.world.WorldServer;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -20,18 +25,240 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static engine.server.MBServerStatics.MINE_LATE_WINDOW;
|
||||
|
||||
public class HourlyJobThread implements Runnable {
|
||||
|
||||
public HourlyJobThread() {
|
||||
|
||||
}
|
||||
|
||||
public static void decayShrines() {
|
||||
ArrayList<Shrine> shrineList = new ArrayList<>();
|
||||
|
||||
for (Shrine shrine : Shrine.shrinesByBuildingUUID.values()) {
|
||||
try {
|
||||
Building shrineBuilding = (Building) DbManager.getObject(Enum.GameObjectType.Building, shrine.getBuildingID());
|
||||
|
||||
if (shrineBuilding == null)
|
||||
continue;
|
||||
|
||||
|
||||
if (shrineBuilding.getOwner().equals(shrineBuilding.getCity().getOwner()) == false)
|
||||
shrineBuilding.claim(shrineBuilding.getCity().getOwner());
|
||||
} catch (Exception e) {
|
||||
Logger.info("Shrine " + shrine.getBuildingID() + " Error " + e);
|
||||
}
|
||||
}
|
||||
|
||||
// Grab list of top two shrines of each type
|
||||
|
||||
for (Shrine shrine : Shrine.shrinesByBuildingUUID.values()) {
|
||||
|
||||
if (shrine.getRank() == 0 || shrine.getRank() == 1)
|
||||
shrineList.add(shrine);
|
||||
}
|
||||
|
||||
Logger.info("Decaying " + shrineList.size() + " shrines...");
|
||||
|
||||
// Top 2 shrines decay by 10% a day
|
||||
|
||||
for (Shrine shrine : shrineList) {
|
||||
|
||||
try {
|
||||
shrine.decay();
|
||||
} catch (Exception e) {
|
||||
Logger.info("Shrine " + shrine.getBuildingID() + " Error " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void processMineWindow() {
|
||||
|
||||
try {
|
||||
|
||||
ArrayList<Mine> mines = Mine.getMines();
|
||||
|
||||
for (Mine mine : mines) {
|
||||
if (LocalDateTime.now().getHour() == 1400) {
|
||||
mine.wasClaimed = false;
|
||||
}
|
||||
try {
|
||||
|
||||
// Open Errant Mines
|
||||
|
||||
if (mine.getOwningGuild().isEmptyGuild()) {
|
||||
HourlyJobThread.mineWindowOpen(mine);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Open Mines owned by nations having their WOO
|
||||
// set to the current mine window.
|
||||
|
||||
if (mine.getOwningGuild().getNation().getMineTime() ==
|
||||
LocalDateTime.now().getHour() && mine.wasClaimed == false) {
|
||||
HourlyJobThread.mineWindowOpen(mine);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Close the mine if it reaches this far
|
||||
|
||||
mineWindowClose(mine);
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error("mineID: " + mine.getObjectUUID(), e.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void mineWindowOpen(Mine mine) {
|
||||
|
||||
mine.setActive(true);
|
||||
ChatManager.chatSystemChannel(mine.getZoneName() + "'s Mine is now Active!");
|
||||
Logger.info(mine.getZoneName() + "'s Mine is now Active!");
|
||||
}
|
||||
|
||||
public static boolean mineWindowClose(Mine mine) {
|
||||
|
||||
// No need to end the window of a mine which never opened.
|
||||
|
||||
if (mine.isActive == false)
|
||||
return false;
|
||||
|
||||
Building mineBuilding = BuildingManager.getBuildingFromCache(mine.getBuildingID());
|
||||
|
||||
if (mineBuilding == null) {
|
||||
Logger.debug("Null mine building for Mine " + mine.getObjectUUID() + " Building " + mine.getBuildingID());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mine building still stands; nothing to do.
|
||||
// We can early exit here.
|
||||
|
||||
if (mineBuilding.getRank() > 0) {
|
||||
mine.setActive(false);
|
||||
mine.lastClaimer = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
// This mine does not have a valid claimer
|
||||
// we will therefore set it to errant
|
||||
// and keep the window open.
|
||||
|
||||
if (!Mine.validateClaimer(mine.lastClaimer)) {
|
||||
mine.lastClaimer = null;
|
||||
mine.updateGuildOwner(null);
|
||||
mine.setActive(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Update ownership to map
|
||||
|
||||
mine.guildName = mine.getOwningGuild().getName();
|
||||
mine.guildTag = mine.getOwningGuild().getGuildTag();
|
||||
Guild nation = mine.getOwningGuild().getNation();
|
||||
mine.nationName = nation.getName();
|
||||
mine.nationTag = nation.getGuildTag();
|
||||
|
||||
mineBuilding.rebuildMine();
|
||||
WorldGrid.updateObject(mineBuilding);
|
||||
|
||||
ChatSystemMsg chatMsg = new ChatSystemMsg(null, mine.lastClaimer.getName() + " has claimed the mine in " + mine.getParentZone().getParent().getName() + " for " + mine.getOwningGuild().getName() + ". The mine is no longer active.");
|
||||
chatMsg.setMessageType(10);
|
||||
chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID());
|
||||
DispatchMessage.dispatchMsgToAll(chatMsg);
|
||||
|
||||
// Warehouse this claim event
|
||||
|
||||
MineRecord mineRecord = MineRecord.borrow(mine, mine.lastClaimer, Enum.RecordEventType.CAPTURE);
|
||||
DataWarehouse.pushToWarehouse(mineRecord);
|
||||
|
||||
mineBuilding.setRank(mineBuilding.getRank());
|
||||
mine.lastClaimer = null;
|
||||
mine.setActive(false);
|
||||
mine.wasClaimed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
||||
// *** REFACTOR: TRY TRY TRY TRY {{{{{{{{{{{ OMG
|
||||
|
||||
Logger.info("Hourly job is now running.");
|
||||
|
||||
try {
|
||||
|
||||
// Use the same hotZone this hour up and until
|
||||
// the HotZone_Duration from the ConfigManager
|
||||
|
||||
if (ZoneManager.hotZone == null)
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
else
|
||||
ZoneManager.hotZoneCycle = ZoneManager.hotZoneCycle + 1;
|
||||
|
||||
if (ZoneManager.hotZoneCycle > Integer.parseInt(ConfigManager.MB_HOTZONE_DURATION.getValue()))
|
||||
ZoneManager.generateAndSetRandomHotzone();
|
||||
|
||||
if (ZoneManager.hotZone == null) {
|
||||
Logger.error("Null HotZone returned from ZoneManager");
|
||||
} else {
|
||||
Logger.info("HotZone switched to: " + ZoneManager.hotZone.getName());
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Logger.error(e.toString());
|
||||
}
|
||||
|
||||
// Open or Close mines for the current mine window.
|
||||
|
||||
processMineWindow();
|
||||
|
||||
// Deposit mine resources to Guilds
|
||||
|
||||
for (Mine mine : Mine.getMines()) {
|
||||
|
||||
try {
|
||||
mine.depositMineResources();
|
||||
} catch (Exception e) {
|
||||
Logger.info(e.getMessage() + " for Mine " + mine.getObjectUUID());
|
||||
}
|
||||
}
|
||||
|
||||
// Reset time-gated access to WOO slider.
|
||||
// *** Do this after the mines open/close!
|
||||
|
||||
if (LocalDateTime.now().getHour() == MINE_LATE_WINDOW) {
|
||||
Guild guild;
|
||||
|
||||
for (AbstractGameObject dbObject : DbManager.getList(Enum.GameObjectType.Guild)) {
|
||||
guild = (Guild) dbObject;
|
||||
|
||||
if (guild != null)
|
||||
guild.wooWasModified = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Mines can only be claimed once per cycle.
|
||||
// This will reset at 1am after the last mine
|
||||
// window closes.
|
||||
|
||||
if (LocalDateTime.now().getHour() == MINE_LATE_WINDOW + 1) {
|
||||
|
||||
for (Mine mine : Mine.getMines()) {
|
||||
|
||||
if (mine.wasClaimed == true)
|
||||
mine.wasClaimed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Decay Shrines at midnight every day
|
||||
|
||||
if (LocalDateTime.now().getHour() == MINE_LATE_WINDOW)
|
||||
decayShrines();
|
||||
|
||||
// Update city population values
|
||||
|
||||
ConcurrentHashMap<Integer, AbstractGameObject> map = DbManager.getMap(Enum.GameObjectType.City);
|
||||
@@ -53,36 +280,6 @@ public class HourlyJobThread implements Runnable {
|
||||
Logger.error("missing city map");
|
||||
}
|
||||
|
||||
//run maintenance every day at 2 am
|
||||
if(LocalDateTime.now().getHour() == 2) {
|
||||
MaintenanceManager.dailyMaintenance();
|
||||
|
||||
//produce mine resources once a day
|
||||
for (Mine mine : Mine.getMines()) {
|
||||
try {
|
||||
mine.depositMineResources();
|
||||
} catch (Exception e) {
|
||||
Logger.info(e.getMessage() + " for Mine " + mine.getObjectUUID());
|
||||
}
|
||||
mine.wasClaimed = false;
|
||||
}
|
||||
}
|
||||
|
||||
switch(LocalDateTime.now().getHour()){
|
||||
case 3:
|
||||
case 6:
|
||||
case 9:
|
||||
case 12:
|
||||
case 15:
|
||||
case 18:
|
||||
case 21:
|
||||
case 0:
|
||||
for(Mob mob : Mob.discDroppers)
|
||||
if(!mob.isAlive())
|
||||
Zone.respawnQue.add(mob);
|
||||
break;
|
||||
}
|
||||
|
||||
// Log metrics to console
|
||||
Logger.info(WorldServer.getUptimeString());
|
||||
Logger.info(SimulationManager.getPopulationString());
|
||||
|
||||
Reference in New Issue
Block a user