Skip to content
This repository was archived by the owner on Oct 30, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
407 changes: 407 additions & 0 deletions SQL/luni-2015-11-1.sql

Large diffs are not rendered by default.

22 changes: 20 additions & 2 deletions Source/CharactersDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ListCharacterInfo CharactersTable::getCharacterInfo(long long objid){
qrs << "SELECT ";
qrs << "`accountID`, `objectID`, `name`, `unapprovedName`, `nameRejected`, `freeToPlay`, `gmlevel`, ";
qrs << "`shirtColor`, `shirtStyle`, `pantsColor`, `hairStyle`, `hairColor`, `lh`, `rh`, `eyebrows`, `eyes`, `mouth`, ";
qrs << "`lastZoneId`, `mapInstance`, `mapClone`, `x`, `y`, `z` ";
qrs << "`lastZoneId`, `mapInstance`, `mapClone`, `x`, `y`, `z`, `level`, `uScore`, `health`, `maxHealth` ";
qrs << "FROM `characters` WHERE `objectID` = '" << std::to_string(objid) << "';";
std::string qrss = qrs.str();
auto qr = Database::Query(qrss);
Expand All @@ -81,7 +81,7 @@ ListCharacterInfo CharactersTable::getCharacterInfo(std::string name){
qrs << "SELECT ";
qrs << "`accountID`, `objectID`, `name`, `unapprovedName`, `nameRejected`, `freeToPlay`, `gmlevel`, ";
qrs << "`shirtColor`, `shirtStyle`, `pantsColor`, `hairStyle`, `hairColor`, `lh`, `rh`, `eyebrows`, `eyes`, `mouth`, ";
qrs << "`lastZoneId`, `mapInstance`, `mapClone`, `x`, `y`, `z` ";
qrs << "`lastZoneId`, `mapInstance`, `mapClone`, `x`, `y`, `z`, `level`, `uScore`, `health`, `maxHealth` ";
qrs << "FROM `characters` WHERE `name` = '" << name << "';";
std::string qrss = qrs.str();
auto qr = Database::Query(qrss);
Expand All @@ -104,6 +104,10 @@ ListCharacterInfo CharactersTable::getCharacterInfo(MYSQL_RES *res){
if (std::stoi(r[4]) == 1) i.info.nameRejected = true;
if (std::stoi(r[5]) == 1) i.info.isFreeToPlay = true;
i.info.gmlevel = std::stoi(r[6]);
i.info.level = std::stoul(r[23]);
i.info.uScore = std::stoll(r[24]);
i.info.health = std::stoul(r[25]);
i.info.maxHealth = std::stof(r[26]);
//Style
i.style.shirtColor = std::stoul(r[7]);
i.style.shirtStyle = std::stoul(r[8]);
Expand Down Expand Up @@ -216,6 +220,20 @@ void CharactersTable::mapTable(std::unordered_map<std::string, compare<ColData *
Database::addColToMap(data, "mapClone", new ColData("int(11)", false, "", "NULL", ""));
Database::addColToMap(data, "level", new ColData("int(3)", false, "", "1", ""));
Database::addColToMap(data, "uScore", new ColData("int(32)", false, "", "0", ""));
Database::addColToMap(data, "health", new ColData("int(10)", false, "", "5", ""));
Database::addColToMap(data, "maxHealth", new ColData("float", false, "", "5.0", ""));
}

void CharactersTable::levelUp(long long objectId){
auto qr1 = Database::Query("SELECT `level` FROM `characters` WHERE `objectId` = '" + std::to_string(objectId) + "';");
if (mysql_num_rows(qr1) > 0){
auto r = mysql_fetch_row(qr1);
auto level = std::stoi(r[0]) + 1;
Database::Query("UPDATE `characters` SET `level` = '" + std::to_string(level) + "' WHERE `objectId` = '" + std::to_string(objectId) + "';");
}
else{
Logger::log("DBT", "CHAR", "Unable to Level Up Char: " + std::to_string(objectId), LOG_ERROR);
}
}

void FriendsTable::requestFriend(long long sender, long long reciever){
Expand Down
5 changes: 5 additions & 0 deletions Source/CharactersDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ struct CharacterInfo{
std::string unapprovedName;
bool nameRejected = false;
bool isFreeToPlay = false;
unsigned int level = 1;
long long uScore = 0;
unsigned int health = 5;
float maxHealth = 5.0F;
};

struct ListCharacterInfo{
Expand All @@ -62,6 +66,7 @@ class CharactersTable : public MySQLTable{
static long long add(CharacterStyle style, unsigned int accountid, CharacterInfo names);
static bool unapprovedNameExists(std::string unapprovedname);
static void setGMlevel(long long objid, unsigned short newLevel);
static void levelUp(long long objectId);

std::string getName();
void mapTable(std::unordered_map<std::string, compare<ColData *> *> * data);
Expand Down
14 changes: 11 additions & 3 deletions Source/Common/Utility/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,18 @@ MySQLSettings Configuration::getMySQLSettings(){

void Configuration::setServerSettings(CONNECT_INFO& connection, Settings& settings, std::string& name){
IniSection * AuthConfig = this->ini->getSection(name);

IniSection * WorldConfig = this-> ini->getSection(name);
int listen_port;
int redirect_port;
//This config option is actually useless, since the client ALWAYS connects to port 1001 initially
int listen_port = AuthConfig->getIntValue("listen_port", 1001);
int redirect_port = AuthConfig->getIntValue("redirect_port", 2002);
if (name == "World"){
listen_port = WorldConfig->getIntValue("listen_port", 2002);
redirect_port = WorldConfig->getIntValue("redirect_port", 2004);
}
else{
listen_port = AuthConfig->getIntValue("listen_port", 1001);
redirect_port = AuthConfig->getIntValue("redirect_port", 2002);
}

connection.listenPort = listen_port;
connection.redirectPort = redirect_port;
Expand Down
2 changes: 1 addition & 1 deletion Source/WorldConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void WorldServerPackets::CreateCharacter(SystemAddress address, long long charob
writeRaw(xml, "\"></char>");
std::stringstream adddata;
adddata << "<lvl";
adddata << " l=\"6\""; //TODO: make dynamic
adddata << " l=\"1\""; //TODO: make dynamic
adddata << "/>";
writeRaw(xml, adddata.str());
writeRaw(xml, "<flag/>");
Expand Down
12 changes: 6 additions & 6 deletions Source/WorldLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ void parsePacket(RakPeerInterface* rakServer, SystemAddress &systemAddress, RakN
}
case 1734:
//Level UP

CharactersTable::levelUp(objid);
break;
default:
Logger::log("WRLD", "GAMEMESSAGE", "Unknown Game Message: " + std::to_string(msgid));
Expand Down Expand Up @@ -1122,11 +1122,11 @@ void parsePacket(RakPeerInterface* rakServer, SystemAddress &systemAddress, RakN
c1->setPosition(pos);

CharacterComponent * c4 = player->getComponent4();
c4->setLevel(6);
c4->setLevel(cinfo.info.level);
PLAYER_INFO pi;
pi.accountID = s.accountid;
pi.isFreeToPlay = cinfo.info.isFreeToPlay;
pi.legoScore = 600;
pi.legoScore = cinfo.info.uScore;
c4->setInfo(pi);
PLAYER_STYLE ps;
ps.eyebrowsStyle = cinfo.style.eyebrows;
Expand All @@ -1140,9 +1140,9 @@ void parsePacket(RakPeerInterface* rakServer, SystemAddress &systemAddress, RakN

DestructibleComponent * c7 = player->getComponent7();
COMPONENT7_DATA4 d4 = c7->getData4();
d4.health = 5;
d4.maxHealthN = 5.0F;
d4.maxHealth = 5.0F;
d4.health = cinfo.info.health;
d4.maxHealthN = cinfo.info.maxHealth;
d4.maxHealth = cinfo.info.maxHealth;
c7->setData4(d4);

InventoryComponent * c17 = player->getComponent17();
Expand Down
2 changes: 2 additions & 0 deletions Start/start.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
LUNIServer.exe --world

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, if you put double quotes around the file name you won't have to rename it
"LUNI Server.exe" --world

2 changes: 2 additions & 0 deletions Start/start1.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
LUNIServer.exe --auth
8 changes: 6 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LUNI
# LUNI

## Setup Instructions
You should be familiar with the setup of LUNI before working with this repository.
Expand All @@ -17,7 +17,11 @@ You should be familiar with the setup of LUNI before working with this repositor
5. When Login, Character Creation and World loading succeded, wou will notice to be in Venture Explorer without being able to move or see your character. This is actually the correct behaviour.
- The game has a mission at the beginning to press shift to "wake up", which is not implemented yet.
- So for the time being please use /tp <zoneid> to get to another world or try adding mission 1727 to the missions table to have that mission already done

## To Open The Server
1. Rename "LUNI Server.exe" to "LUNIServer.exe"
2. Copy "start.bat" and "start1.bat" to Debug Folder
3. Execute "start.bat"
4. Execute "start1.bat"
## Reporting Bugs

Please report any bugs that you may encounter here in the issues tracker. Please check any existing issues first if it has already been reported.
Expand Down