mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 01:29:21 +02:00
fix debug caused by SendIcons. Fix max stamina. Fix character say. Fully finish 7.81 basic implementation.
This commit is contained in:
parent
527debe319
commit
05af593814
@ -52,7 +52,7 @@ timeBetweenExActions = 1000
|
|||||||
|
|
||||||
-- Map
|
-- Map
|
||||||
-- NOTE: set mapName WITHOUT .otbm at the end
|
-- NOTE: set mapName WITHOUT .otbm at the end
|
||||||
mapName = "mymap"
|
mapName = "map"
|
||||||
mapAuthor = "CipSoft"
|
mapAuthor = "CipSoft"
|
||||||
|
|
||||||
-- MySQL
|
-- MySQL
|
||||||
|
@ -1125,6 +1125,7 @@ CREATE TABLE `players` (
|
|||||||
`lookhead` int(11) NOT NULL DEFAULT '0',
|
`lookhead` int(11) NOT NULL DEFAULT '0',
|
||||||
`looklegs` int(11) NOT NULL DEFAULT '0',
|
`looklegs` int(11) NOT NULL DEFAULT '0',
|
||||||
`looktype` int(11) NOT NULL DEFAULT '136',
|
`looktype` int(11) NOT NULL DEFAULT '136',
|
||||||
|
`lookaddons` int(11) NOT NULL DEFAULT '0',
|
||||||
`maglevel` int(11) NOT NULL DEFAULT '0',
|
`maglevel` int(11) NOT NULL DEFAULT '0',
|
||||||
`mana` int(11) NOT NULL DEFAULT '0',
|
`mana` int(11) NOT NULL DEFAULT '0',
|
||||||
`manamax` int(11) NOT NULL DEFAULT '0',
|
`manamax` int(11) NOT NULL DEFAULT '0',
|
||||||
@ -1147,6 +1148,7 @@ CREATE TABLE `players` (
|
|||||||
`onlinetime` int(11) NOT NULL DEFAULT '0',
|
`onlinetime` int(11) NOT NULL DEFAULT '0',
|
||||||
`deletion` bigint(15) NOT NULL DEFAULT '0',
|
`deletion` bigint(15) NOT NULL DEFAULT '0',
|
||||||
`balance` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
|
`balance` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`stamina` smallint(5) NOT NULL DEFAULT '3360',
|
||||||
`skill_fist` int(10) UNSIGNED NOT NULL DEFAULT '10',
|
`skill_fist` int(10) UNSIGNED NOT NULL DEFAULT '10',
|
||||||
`skill_fist_tries` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
|
`skill_fist_tries` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
`skill_club` int(10) UNSIGNED NOT NULL DEFAULT '10',
|
`skill_club` int(10) UNSIGNED NOT NULL DEFAULT '10',
|
||||||
|
@ -7783,7 +7783,7 @@ int LuaScriptInterface::luaPlayerSetStamina(lua_State* L)
|
|||||||
uint16_t stamina = getNumber<uint16_t>(L, 2);
|
uint16_t stamina = getNumber<uint16_t>(L, 2);
|
||||||
Player* player = getUserdata<Player>(L, 1);
|
Player* player = getUserdata<Player>(L, 1);
|
||||||
if (player) {
|
if (player) {
|
||||||
player->staminaMinutes = std::min<uint16_t>(2520, stamina);
|
player->staminaMinutes = std::min<uint16_t>(3360, stamina);
|
||||||
player->sendStats();
|
player->sendStats();
|
||||||
pushBoolean(L, true);
|
pushBoolean(L, true);
|
||||||
}
|
}
|
||||||
|
@ -1046,7 +1046,7 @@ class Player final : public Creature, public Cylinder
|
|||||||
int32_t shieldBlockCount = 0;
|
int32_t shieldBlockCount = 0;
|
||||||
int32_t idleTime = 0;
|
int32_t idleTime = 0;
|
||||||
|
|
||||||
uint16_t staminaMinutes = 2520;
|
uint16_t staminaMinutes = 3360;
|
||||||
uint16_t maxWriteLen = 0;
|
uint16_t maxWriteLen = 0;
|
||||||
|
|
||||||
uint8_t soul = 0;
|
uint8_t soul = 0;
|
||||||
|
@ -1168,11 +1168,12 @@ void ProtocolGame::sendChannel(uint16_t channelId, const std::string& channelNam
|
|||||||
writeToOutputBuffer(msg);
|
writeToOutputBuffer(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ProtocolGame::sendIcons(uint16_t icons)
|
void ProtocolGame::sendIcons(uint16_t icons)
|
||||||
{
|
{
|
||||||
NetworkMessage msg;
|
NetworkMessage msg;
|
||||||
msg.addByte(0xA2);
|
msg.addByte(0xA2);
|
||||||
msg.addByte(static_cast<uint8_t>(icons));
|
msg.add<uint16_t>(icons);
|
||||||
writeToOutputBuffer(msg);
|
writeToOutputBuffer(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1204,6 +1205,8 @@ void ProtocolGame::sendContainer(uint8_t cid, const Container* container, bool h
|
|||||||
writeToOutputBuffer(msg);
|
writeToOutputBuffer(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ProtocolGame::sendTradeItemRequest(const std::string& traderName, const Item* item, bool ack)
|
void ProtocolGame::sendTradeItemRequest(const std::string& traderName, const Item* item, bool ack)
|
||||||
{
|
{
|
||||||
NetworkMessage msg;
|
NetworkMessage msg;
|
||||||
@ -1277,14 +1280,61 @@ void ProtocolGame::sendCreatureTurn(const Creature* creature, uint32_t stackPos)
|
|||||||
void ProtocolGame::sendCreatureSay(const Creature* creature, SpeakClasses type, const std::string& text, const Position* pos/* = nullptr*/)
|
void ProtocolGame::sendCreatureSay(const Creature* creature, SpeakClasses type, const std::string& text, const Position* pos/* = nullptr*/)
|
||||||
{
|
{
|
||||||
NetworkMessage msg;
|
NetworkMessage msg;
|
||||||
AddCreatureSpeak(msg, creature, type, text, 0, pos);
|
msg.addByte(0xAA);
|
||||||
|
|
||||||
|
static uint32_t statementId = 0;
|
||||||
|
msg.add<uint32_t>(++statementId);
|
||||||
|
|
||||||
|
msg.addString(creature->getName());
|
||||||
|
|
||||||
|
//Add level only for players
|
||||||
|
if (const Player* speaker = creature->getPlayer()) {
|
||||||
|
msg.add<uint16_t>(speaker->getLevel());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg.add<uint16_t>(0x00);
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.addByte(type);
|
||||||
|
if (pos) {
|
||||||
|
msg.addPosition(*pos);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg.addPosition(creature->getPosition());
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.addString(text);
|
||||||
writeToOutputBuffer(msg);
|
writeToOutputBuffer(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::sendToChannel(const Creature* creature, SpeakClasses type, const std::string& text, uint16_t channelId)
|
void ProtocolGame::sendToChannel(const Creature* creature, SpeakClasses type, const std::string& text, uint16_t channelId)
|
||||||
{
|
{
|
||||||
NetworkMessage msg;
|
NetworkMessage msg;
|
||||||
AddCreatureSpeak(msg, creature, type, text, channelId);
|
msg.addByte(0xAA);
|
||||||
|
|
||||||
|
static uint32_t statementId = 0;
|
||||||
|
msg.add<uint32_t>(++statementId);
|
||||||
|
if (!creature) {
|
||||||
|
msg.add<uint32_t>(0x00);
|
||||||
|
}
|
||||||
|
else if (type == TALKTYPE_CHANNEL_R2) {
|
||||||
|
msg.add<uint32_t>(0x00);
|
||||||
|
type = TALKTYPE_CHANNEL_R1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg.addString(creature->getName());
|
||||||
|
//Add level only for players
|
||||||
|
if (const Player* speaker = creature->getPlayer()) {
|
||||||
|
msg.add<uint16_t>(speaker->getLevel());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msg.add<uint16_t>(0x00);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.addByte(type);
|
||||||
|
msg.add<uint16_t>(channelId);
|
||||||
|
msg.addString(text);
|
||||||
writeToOutputBuffer(msg);
|
writeToOutputBuffer(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1294,16 +1344,13 @@ void ProtocolGame::sendPrivateMessage(const Player* speaker, SpeakClasses type,
|
|||||||
msg.addByte(0xAA);
|
msg.addByte(0xAA);
|
||||||
static uint32_t statementId = 0;
|
static uint32_t statementId = 0;
|
||||||
msg.add<uint32_t>(++statementId);
|
msg.add<uint32_t>(++statementId);
|
||||||
if (type == TALKTYPE_RVR_ANSWER) {
|
if (speaker) {
|
||||||
msg.addString("Gamemaster");
|
msg.addString(speaker->getName());
|
||||||
} else {
|
msg.add<uint16_t>(speaker->getLevel());
|
||||||
if (speaker) {
|
}
|
||||||
msg.addString(speaker->getName());
|
else {
|
||||||
} else {
|
msg.add<uint32_t>(0x00);
|
||||||
msg.add<uint32_t>(0x00);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.addByte(type);
|
msg.addByte(type);
|
||||||
msg.addString(text);
|
msg.addString(text);
|
||||||
writeToOutputBuffer(msg);
|
writeToOutputBuffer(msg);
|
||||||
@ -1890,53 +1937,6 @@ void ProtocolGame::AddCreatureLight(NetworkMessage& msg, const Creature* creatur
|
|||||||
msg.addByte(lightInfo.color);
|
msg.addByte(lightInfo.color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProtocolGame::AddCreatureSpeak(NetworkMessage& msg, const Creature* creature, SpeakClasses type, const std::string& text, uint16_t channelId, const Position* pos /*= nullptr*/)
|
|
||||||
{
|
|
||||||
msg.addByte(0xAA);
|
|
||||||
static uint32_t statementId = 0;
|
|
||||||
msg.add<uint32_t>(++statementId);
|
|
||||||
|
|
||||||
if (type != TALKTYPE_RVR_ANSWER) {
|
|
||||||
if (type != TALKTYPE_CHANNEL_R2) {
|
|
||||||
if (creature) {
|
|
||||||
msg.addString(creature->getName());
|
|
||||||
} else {
|
|
||||||
msg.add<uint16_t>(0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
msg.add<uint16_t>(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
msg.addByte(type);
|
|
||||||
switch (type) {
|
|
||||||
case TALKTYPE_SAY:
|
|
||||||
case TALKTYPE_WHISPER:
|
|
||||||
case TALKTYPE_YELL:
|
|
||||||
case TALKTYPE_MONSTER_SAY:
|
|
||||||
case TALKTYPE_MONSTER_YELL:
|
|
||||||
if (!pos) {
|
|
||||||
msg.addPosition(creature->getPosition());
|
|
||||||
} else {
|
|
||||||
msg.addPosition(*pos);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case TALKTYPE_CHANNEL_Y:
|
|
||||||
case TALKTYPE_CHANNEL_R1:
|
|
||||||
case TALKTYPE_CHANNEL_R2:
|
|
||||||
case TALKTYPE_CHANNEL_O:
|
|
||||||
msg.add<uint16_t>(channelId);
|
|
||||||
break;
|
|
||||||
case TALKTYPE_RVR_CHANNEL:
|
|
||||||
msg.add<uint32_t>(0);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
msg.addString(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
//tile
|
//tile
|
||||||
void ProtocolGame::RemoveTileThing(NetworkMessage& msg, const Position& pos, uint32_t stackpos)
|
void ProtocolGame::RemoveTileThing(NetworkMessage& msg, const Position& pos, uint32_t stackpos)
|
||||||
{
|
{
|
||||||
|
@ -234,7 +234,6 @@ class ProtocolGame final : public Protocol
|
|||||||
void AddPlayerSkills(NetworkMessage& msg);
|
void AddPlayerSkills(NetworkMessage& msg);
|
||||||
void AddWorldLight(NetworkMessage& msg, const LightInfo& lightInfo);
|
void AddWorldLight(NetworkMessage& msg, const LightInfo& lightInfo);
|
||||||
void AddCreatureLight(NetworkMessage& msg, const Creature* creature);
|
void AddCreatureLight(NetworkMessage& msg, const Creature* creature);
|
||||||
void AddCreatureSpeak(NetworkMessage& msg, const Creature* creature, SpeakClasses type, const std::string& text, uint16_t channelId, const Position* pos = nullptr);
|
|
||||||
|
|
||||||
//tiles
|
//tiles
|
||||||
static void RemoveTileThing(NetworkMessage& msg, const Position& pos, uint32_t stackpos);
|
static void RemoveTileThing(NetworkMessage& msg, const Position& pos, uint32_t stackpos);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user