• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ slavi cast system

johnsamir

Advanced OT User
Joined
Oct 13, 2009
Messages
1,031
Solutions
6
Reaction score
181
Location
Nowhere
hi
has somebody this repo? Live casting system by slavidodo · Pull Request #2230 · otland/forgottenserver (https://github.com/otland/forgottenserver/pull/2230/files#diff-71ab3d0cd534a1608f1c652185c8a8e1247c81813161673bedf7f5433dad2483)
do not need the commits, just the repo to review the code. im working on this and im facing few problems in
player.h due to few changes like move protocolgame from . to protocolgamebase &spectator. i have added libraries and classes and things seems to be definied but
few codes seems to be undeclared in spite i have added the libraries class and friend class nothing changed

edit: i know that protocolgamebase spectator etc is outdated do i made all from my own protocolgame.cpp reviewing slavi but not using the ones he used because they're old and in my filles the are re-defined // re- named or code changed

like for example here in iologindata.cpp
Lua:
std::ostringstream query;
    if (login) {
        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)
{
    Database& db = Database::getInstance();
    std::ostringstream query;
    query << "UPDATE `players_online` set `cast_spectators` = " << spectators << " WHERE `player_id` = " << guid;
    db.executeQuery(query.str());
}

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());
}
had to do this

Code:
void IOLoginData::startCast(uint32_t guid, std::string password)
{
    Database& db = Database::getInstance();
    std::string query = fmt::format("UPDATE `players_online` SET `cast_on` = 1, `cast_password` = '{}', `cast_spectators` = 0 WHERE `player_id` = {:d}", db.escapeString(password), guid);
    db.executeQuery(query);
}

void IOLoginData::updateCast(uint32_t guid, uint32_t spectators)
{
    Database& db = Database::getInstance();
    std::string query = fmt::format("UPDATE `players_online` SET `cast_spectators` = {:d} WHERE `player_id` = {:d}", spectators, guid);
    db.executeQuery(query);
}

void IOLoginData::stopCast(uint32_t guid)
{
    std::string query = fmt::format("UPDATE `players_online` SET `cast_on` = 0, `cast_password` = '', `cast_spectators` = 0 WHERE `player_id` = {:d}", guid);
    Database::getInstance().executeQuery(query);
}

or in protocolgame. to protocolgambase and spectator
Code:
void checkCreatureAsKnown(uint32_t id, bool& known, uint32_t& removedKnown);

to
Code:
    std::unordered_set<uint32_t> knownCreatureSet;

for example in player.h

Code:
#ifndef FS_PLAYER_H
#define FS_PLAYER_H

#include "creature.h"
#include "cylinder.h"
#include "depotlocker.h"
#include "enums.h"
#include "groups.h"
#include "guild.h"
#include "protocolgame.h"
#include "protocolgamebase.h"
#include "protocolspectator.h"
#include "guild.h"
#include "town.h"
#include "vocation.h"
#include "mounts.h"


#include "auras.h"
#include "wings.h"
#include "shaders.h"

#include <bitset>
#

class DepotChest;
class House;
class NetworkMessage;
class Npc;
class Party;
class SchedulerTask;

//cast
class Guild;
class Vocation;
class ProtocolGame;
class ProtocolgameBase;

Code:
    friend class Game;
    friend class Npc;
    friend class LuaScriptInterface;
    friend class Map;
    friend class Actions;
    friend class IOLoginData;

    friend class Player;
    //cast
    friend class ProtocolGame;
    friend class ProtocolGameBase;
    friend class Guild;
    friend class Vocation;

player.hand get this errors like example prototolgame has no memeber sendquestline or sendaddmarker

why if i have it in protocolgamebase
Code:
    void ProtocolGameBase::sendAddMarker(const Position & pos, uint8_t markType, const std::string & desc)
    {
        NetworkMessage msg;
        msg.addByte(0xDD);
        msg.addPosition(pos);
        msg.addByte(markType);
        msg.addString(desc);
        writeToOutputBuffer(msg);
    }

Code:
void sendOpenPrivateChannel(const std::string& receiver) {
    if (client) {
        client->sendOpenPrivateChannel(receiver);
    }
}
void sendOutfitWindow() {
    if (client) {
        client->sendOutfitWindow();
    }
}
void sendCloseContainer(uint8_t cid) {
    if (client) {
        client->sendCloseContainer(cid);
    }
}

void sendChannel(uint16_t channelId, const std::string& channelName) {
    if (client) {
        client->sendChannel(channelId, channelName);
    }
}
void sendTutorial(uint8_t tutorialId) {
    if (client) {
        client->sendTutorial(tutorialId);
    }
}
void sendAddMarker(const Position& pos, uint8_t markType, const std::string& desc) {
    if (client) {
        client->sendAddMarker(pos, markType, desc);
    }
}
void sendQuestLog() {
    if (client) {
        client->sendQuestLog();
    }
}
void sendQuestLine(const Quest* quest) {
    if (client) {
        client->sendQuestLine(quest);
    }
}
 
Last edited:
Back
Top