New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live casting system #2230
Live casting system #2230
Changes from 3 commits
7b23d47
6c09d5a
27c8571
060ce4f
daa78d5
0ecc4c0
77d5204
a029b2f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
function onUpdateDatabase() | ||
return false | ||
print("> Updating database to version 20 (live casting support)") | ||
db.query("ALTER TABLE `players_online` ADD COLUMN `cast_on` tinyint(1) default '0' NOT NULL, ADD COLUMN `cast_password` varchar(40) default NULL, ADD COLUMN `cast_spectators` int(5) default '0' NOT NULL;") | ||
return true | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function onUpdateDatabase() | ||
return false | ||
end | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
function onSay(player, words, param) | ||
local defaultParam = param | ||
|
||
param = param:lower() | ||
if param == '' or param == "on" then | ||
if not player:isLiveCasting() then | ||
player:startLiveCasting() | ||
end | ||
elseif param == "off" then | ||
if player:isLiveCasting() then | ||
player:stopLiveCasting() | ||
end | ||
else -- a password | ||
if not player:isLiveCasting() then | ||
player:startLiveCasting(defaultParam) | ||
end | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. EOF |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function onSay(player, words, param) | ||
if not player:isLiveCasting() then | ||
return true | ||
end | ||
|
||
if words == "!start" then | ||
player:startLiveCasting(param) | ||
elseif words == "!pause" then | ||
player:pauseLiveCasting(param) -- param is reason | ||
elseif words == "!kick" then -- where param is spectator name | ||
player:kickCastSpectator(param) | ||
elseif words == "!ban" then | ||
player:banCastSpectator(param) | ||
elseif words == "!unban" then | ||
player:unBanCastSpectator(param) | ||
elseif words == "!mute" then | ||
player:muteCastSpectator(param) | ||
elseif words == "!unmute" then | ||
player:unMuteCastSpectator(param) | ||
end | ||
|
||
return false | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. EOF |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
/** | ||
* The Forgotten Server - a free and open-source MMORPG server emulator | ||
* Copyright (C) 2017 Mark Samman <mark.samman@gmail.com> | ||
* | ||
|
@@ -111,6 +111,7 @@ bool ConfigManager::load() | |
|
||
integer[SQL_PORT] = getGlobalNumber(L, "mysqlPort", 3306); | ||
integer[GAME_PORT] = getGlobalNumber(L, "gameProtocolPort", 7172); | ||
integer[CAST_PORT] = getGlobalNumber(L, "loveCastProtocolPort", 7173); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you in love? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you teach me how do you do comment like this ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Files changes -> go to a line, put the marker next to a line number and click the blue + box :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you |
||
integer[LOGIN_PORT] = getGlobalNumber(L, "loginProtocolPort", 7171); | ||
integer[STATUS_PORT] = getGlobalNumber(L, "statusProtocolPort", 7171); | ||
|
||
|
@@ -131,6 +132,7 @@ bool ConfigManager::load() | |
boolean[WARN_UNSAFE_SCRIPTS] = getGlobalBoolean(L, "warnUnsafeScripts", true); | ||
boolean[CONVERT_UNSAFE_SCRIPTS] = getGlobalBoolean(L, "convertUnsafeScripts", true); | ||
boolean[CLASSIC_EQUIPMENT_SLOTS] = getGlobalBoolean(L, "classicEquipmentSlots", false); | ||
boolean[LIVE_CAST_ENABLED] = getGlobalBoolean(L, "liveCastEnabled", true); | ||
|
||
string[DEFAULT_PRIORITY] = getGlobalString(L, "defaultPriority", "high"); | ||
string[SERVER_NAME] = getGlobalString(L, "serverName", ""); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** | ||
/** | ||
* The Forgotten Server - a free and open-source MMORPG server emulator | ||
* Copyright (C) 2017 Mark Samman <mark.samman@gmail.com> | ||
* | ||
|
@@ -183,16 +183,37 @@ void IOLoginData::updateOnlineStatus(uint32_t guid, bool login) | |
if (g_config.getBoolean(ConfigManager::ALLOW_CLONES)) { | ||
return; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing Space |
||
std::ostringstream query; | ||
if (login) { | ||
query << "INSERT INTO `players_online` VALUES (" << guid << ')'; | ||
query << "INSERT INTO `players_online` (`player_id`, `cast_on`, `cast_password`, `cast_spectators`) VALUES (" << guid << ", 0, '', 0)"; | ||
} else { | ||
query << "DELETE FROM `players_online` WHERE `player_id` = " << guid; | ||
} | ||
Database::getInstance().executeQuery(query.str()); | ||
} | ||
|
||
void IOLoginData::startCast(uint32_t guid, std::string password) | ||
{ | ||
Database& db = Database::getInstance(); | ||
std::ostringstream query; | ||
query << "UPDATE `players_online` set `cast_on` = 1, `cast_password` = " << db.escapeString(password) << ", `cast_spectators` = 0 WHERE `player_id` = " << guid; | ||
db.executeQuery(query.str()); | ||
} | ||
|
||
void IOLoginData::updateCast(uint32_t guid, uint32_t spectators) | ||
{ | ||
std::ostringstream query; | ||
query << "UPDATE `players_online` set `cast_spectators = " << spectators << " WHERE `player_id` = " << guid; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. query << "UPDATE You are missing "`" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can u make a pr, I can't have a pc for a while. Thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, if I did this correct |
||
} | ||
|
||
void IOLoginData::stopCast(uint32_t guid) | ||
{ | ||
std::ostringstream query; | ||
query << "UPDATE `players_online` set `cast_on` = 0, `cast_password` = '', `cast_spectators` = 0 WHERE `player_id` = " << guid; | ||
Database::getInstance().executeQuery(query.str()); | ||
} | ||
|
||
bool IOLoginData::preloadPlayer(Player* player, const std::string& name) | ||
{ | ||
Database& db = Database::getInstance(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'd like you to make a pr (in my repo) fixing thus as I am not able now.