mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 17:49:20 +02:00
introduce coloured loot message
This commit is contained in:
parent
1c35d04337
commit
eed5309ed0
@ -647,6 +647,11 @@ function addTabText(text, speaktype, tab, creatureName)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if tab == serverTab then
|
||||||
|
local highlightText = toHighlightedText(text, speaktype.color)
|
||||||
|
label:setColoredText(highlightText)
|
||||||
|
end
|
||||||
|
|
||||||
label.name = creatureName
|
label.name = creatureName
|
||||||
consoleBuffer.onMouseRelease = function(self, mousePos, mouseButton)
|
consoleBuffer.onMouseRelease = function(self, mousePos, mouseButton)
|
||||||
processMessageMenu(mousePos, mouseButton, nil, nil, nil, tab)
|
processMessageMenu(mousePos, mouseButton, nil, nil, nil, tab)
|
||||||
|
@ -93,12 +93,20 @@ function displayMessage(mode, text)
|
|||||||
|
|
||||||
if msgtype.screenTarget then
|
if msgtype.screenTarget then
|
||||||
local label = messagesPanel:recursiveGetChildById(msgtype.screenTarget)
|
local label = messagesPanel:recursiveGetChildById(msgtype.screenTarget)
|
||||||
|
if mode == 20 then
|
||||||
|
local highlightData = toHighlightedText(text, msgtype.color)
|
||||||
|
label:setColoredText(highlightData)
|
||||||
|
label:setVisible(true)
|
||||||
|
removeEvent(label.hideEvent)
|
||||||
|
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, calculateVisibleTime(text))
|
||||||
|
else
|
||||||
label:setText(text)
|
label:setText(text)
|
||||||
label:setColor(msgtype.color)
|
label:setColor(msgtype.color)
|
||||||
label:setVisible(true)
|
label:setVisible(true)
|
||||||
removeEvent(label.hideEvent)
|
removeEvent(label.hideEvent)
|
||||||
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, calculateVisibleTime(text))
|
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, calculateVisibleTime(text))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function displayPrivateMessage(text)
|
function displayPrivateMessage(text)
|
||||||
|
@ -9,3 +9,32 @@ function dirtostring(dir)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function toHighlightedText(text, color)
|
||||||
|
local tmpData = {}
|
||||||
|
|
||||||
|
for i, part in ipairs(text:split("[")) do
|
||||||
|
if i == 1 then
|
||||||
|
table.insert(tmpData, part)
|
||||||
|
table.insert(tmpData, color)
|
||||||
|
else
|
||||||
|
for j, part2 in ipairs(part:split("]")) do
|
||||||
|
if j == 1 then
|
||||||
|
local text = part2:split(":")
|
||||||
|
if #text == 2 then
|
||||||
|
table.insert(tmpData, part2:split(":")[2])
|
||||||
|
table.insert(tmpData, part2:split(":")[1])
|
||||||
|
else
|
||||||
|
table.insert(tmpData, '[' .. part2 .. ']')
|
||||||
|
table.insert(tmpData, color)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
table.insert(tmpData, part2)
|
||||||
|
table.insert(tmpData, color)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return tmpData
|
||||||
|
end
|
@ -3259,3 +3259,15 @@ ProtocolGame parse message exception (21 bytes, 0 unread, last opcode is 0x0b (1
|
|||||||
6a 02 7e a4 79 06 01 3a
|
6a 02 7e a4 79 06 01 3a
|
||||||
0b 01
|
0b 01
|
||||||
|
|
||||||
|
ProtocolGame parse message exception (25 bytes, 1 unread, last opcode is 0xd2 (210), prev opcode is 0xffffffff (-1), proto: 792): InputMessage eof reached
|
||||||
|
18 00 15 00
|
||||||
|
d2 01 00 00 00 0d 00 4b 69 6e 67 20 54 69 62 69 61 6e 75 73 00
|
||||||
|
|
||||||
|
ProtocolGame parse message exception (16 bytes, 1 unread, last opcode is 0xd2 (210), prev opcode is 0xffffffff (-1), proto: 792): InputMessage eof reached
|
||||||
|
10 00 0c 00
|
||||||
|
d2 08 00 00 00 04 00 56 65 72 64 00
|
||||||
|
|
||||||
|
ProtocolGame parse message exception (19 bytes, 1 unread, last opcode is 0xd2 (210), prev opcode is 0xffffffff (-1), proto: 792): InputMessage eof reached
|
||||||
|
18 00 0f 00
|
||||||
|
d2 2a 05 00 00 07 00 44 72 75 69 64 6b 65 00
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ serverName = "Tibianus"
|
|||||||
statusTimeout = 5000
|
statusTimeout = 5000
|
||||||
replaceKickOnLogin = true
|
replaceKickOnLogin = true
|
||||||
maxPacketsPerSecond = 50
|
maxPacketsPerSecond = 50
|
||||||
packetCompression = true
|
packetCompression = false
|
||||||
autoStackCumulatives = true
|
autoStackCumulatives = true
|
||||||
moneyRate = 1
|
moneyRate = 1
|
||||||
|
|
||||||
|
@ -14826,7 +14826,7 @@ TypeID = 3280
|
|||||||
Name = "a fire sword"
|
Name = "a fire sword"
|
||||||
Description = "The blade is a magic flame"
|
Description = "The blade is a magic flame"
|
||||||
Flags = {MultiUse,Take,Weapon}
|
Flags = {MultiUse,Take,Weapon}
|
||||||
Attributes = {Weight=2300,Brightness=3,LightColor=199,WeaponType=SWORD,Attack=35,Defense=20}
|
Attributes = {Weight=2300,Brightness=3,LightColor=199,WeaponType=SWORD,Attack=35,Defense=20,Cost=4000}
|
||||||
|
|
||||||
TypeID = 3281
|
TypeID = 3281
|
||||||
Name = "a giant sword"
|
Name = "a giant sword"
|
||||||
@ -15373,7 +15373,7 @@ Attributes = {Weight=2950,SlotType=HEAD,ArmorValue=7}
|
|||||||
TypeID = 3386
|
TypeID = 3386
|
||||||
Name = "a dragon scale mail"
|
Name = "a dragon scale mail"
|
||||||
Flags = {Take,Armor}
|
Flags = {Take,Armor}
|
||||||
Attributes = {Weight=11400,SlotType=BODY,ArmorValue=15}
|
Attributes = {Weight=11400,SlotType=BODY,ArmorValue=15,Cost=30000}
|
||||||
|
|
||||||
TypeID = 3387
|
TypeID = 3387
|
||||||
Name = "a demon helmet"
|
Name = "a demon helmet"
|
||||||
@ -15591,7 +15591,7 @@ Attributes = {Weight=5200,Defense=27}
|
|||||||
TypeID = 3428
|
TypeID = 3428
|
||||||
Name = "a tower shield"
|
Name = "a tower shield"
|
||||||
Flags = {Take,Shield}
|
Flags = {Take,Shield}
|
||||||
Attributes = {Weight=8200,Defense=32}
|
Attributes = {Weight=8200,Defense=32,Cost=8000}
|
||||||
|
|
||||||
TypeID = 3429
|
TypeID = 3429
|
||||||
Name = "a black shield"
|
Name = "a black shield"
|
||||||
|
@ -156,8 +156,19 @@ std::ostringstream& Container::getContentDescription(std::ostringstream& os) con
|
|||||||
os << ", ";
|
os << ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item->getCost() >= 50000) {
|
||||||
|
os << "[#BA90C7:" << item->getNameDescription() << "]";
|
||||||
|
}
|
||||||
|
else if (item->getCost() >= 15000) {
|
||||||
|
os << "[#F3E84A:" << item->getNameDescription() << "]";
|
||||||
|
}
|
||||||
|
else if (item->getCost() >= 1000) {
|
||||||
|
os << "[#629AC4:" << item->getNameDescription() << "]";
|
||||||
|
}
|
||||||
|
else {
|
||||||
os << item->getNameDescription();
|
os << item->getNameDescription();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (firstitem) {
|
if (firstitem) {
|
||||||
os << "nothing";
|
os << "nothing";
|
||||||
|
@ -1182,6 +1182,12 @@ std::string Item::getWeightDescription() const
|
|||||||
return getWeightDescription(weight);
|
return getWeightDescription(weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t Item::getCost() const
|
||||||
|
{
|
||||||
|
const ItemType& it = items[id];
|
||||||
|
return it.cost;
|
||||||
|
}
|
||||||
|
|
||||||
bool Item::canDecay() const
|
bool Item::canDecay() const
|
||||||
{
|
{
|
||||||
if (isRemoved()) {
|
if (isRemoved()) {
|
||||||
|
@ -565,6 +565,7 @@ class Item : virtual public Thing
|
|||||||
std::string getDescription(int32_t lookDistance) const final;
|
std::string getDescription(int32_t lookDistance) const final;
|
||||||
std::string getNameDescription() const;
|
std::string getNameDescription() const;
|
||||||
std::string getWeightDescription() const;
|
std::string getWeightDescription() const;
|
||||||
|
uint32_t getCost() const;
|
||||||
|
|
||||||
//serialization
|
//serialization
|
||||||
virtual Attr_ReadValue readAttr(AttrTypes_t attr, PropStream& propStream);
|
virtual Attr_ReadValue readAttr(AttrTypes_t attr, PropStream& propStream);
|
||||||
|
@ -423,6 +423,8 @@ bool Items::loadItems()
|
|||||||
items[id].lightColor = script.readNumber();
|
items[id].lightColor = script.readNumber();
|
||||||
} else if (identifier == "extrahitchance") {
|
} else if (identifier == "extrahitchance") {
|
||||||
items[id].extraHitChance = script.readNumber();
|
items[id].extraHitChance = script.readNumber();
|
||||||
|
} else if (identifier == "cost") {
|
||||||
|
items[id].cost = script.readNumber();
|
||||||
} else if (identifier == "extraattack") {
|
} else if (identifier == "extraattack") {
|
||||||
items[id].extraAttack = script.readNumber();
|
items[id].extraAttack = script.readNumber();
|
||||||
} else if (identifier == "totalexpiretime") {
|
} else if (identifier == "totalexpiretime") {
|
||||||
|
@ -208,6 +208,7 @@ class ItemType
|
|||||||
uint32_t minReqLevel = 0;
|
uint32_t minReqLevel = 0;
|
||||||
uint32_t minReqMagicLevel = 0;
|
uint32_t minReqMagicLevel = 0;
|
||||||
uint32_t charges = 0;
|
uint32_t charges = 0;
|
||||||
|
uint32_t cost = 0;
|
||||||
int32_t attackStrength = 0;
|
int32_t attackStrength = 0;
|
||||||
int32_t attackVariation = 0;
|
int32_t attackVariation = 0;
|
||||||
int32_t manaConsumption = 0;
|
int32_t manaConsumption = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user