mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 09:39:20 +02:00
introduce coloured loot message
This commit is contained in:
parent
1c35d04337
commit
eed5309ed0
@ -646,7 +646,12 @@ function addTabText(text, speaktype, tab, creatureName)
|
||||
label:setColoredText(highlightData)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if tab == serverTab then
|
||||
local highlightText = toHighlightedText(text, speaktype.color)
|
||||
label:setColoredText(highlightText)
|
||||
end
|
||||
|
||||
label.name = creatureName
|
||||
consoleBuffer.onMouseRelease = function(self, mousePos, mouseButton)
|
||||
processMessageMenu(mousePos, mouseButton, nil, nil, nil, tab)
|
||||
|
@ -92,12 +92,20 @@ function displayMessage(mode, text)
|
||||
end
|
||||
|
||||
if msgtype.screenTarget then
|
||||
local label = messagesPanel:recursiveGetChildById(msgtype.screenTarget)
|
||||
label:setText(text)
|
||||
label:setColor(msgtype.color)
|
||||
label:setVisible(true)
|
||||
removeEvent(label.hideEvent)
|
||||
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, calculateVisibleTime(text))
|
||||
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:setColor(msgtype.color)
|
||||
label:setVisible(true)
|
||||
removeEvent(label.hideEvent)
|
||||
label.hideEvent = scheduleEvent(function() label:setVisible(false) end, calculateVisibleTime(text))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -8,4 +8,33 @@ function dirtostring(dir)
|
||||
return k
|
||||
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
|
||||
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
|
||||
replaceKickOnLogin = true
|
||||
maxPacketsPerSecond = 50
|
||||
packetCompression = true
|
||||
packetCompression = false
|
||||
autoStackCumulatives = true
|
||||
moneyRate = 1
|
||||
|
||||
|
@ -14826,7 +14826,7 @@ TypeID = 3280
|
||||
Name = "a fire sword"
|
||||
Description = "The blade is a magic flame"
|
||||
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
|
||||
Name = "a giant sword"
|
||||
@ -15373,7 +15373,7 @@ Attributes = {Weight=2950,SlotType=HEAD,ArmorValue=7}
|
||||
TypeID = 3386
|
||||
Name = "a dragon scale mail"
|
||||
Flags = {Take,Armor}
|
||||
Attributes = {Weight=11400,SlotType=BODY,ArmorValue=15}
|
||||
Attributes = {Weight=11400,SlotType=BODY,ArmorValue=15,Cost=30000}
|
||||
|
||||
TypeID = 3387
|
||||
Name = "a demon helmet"
|
||||
@ -15591,7 +15591,7 @@ Attributes = {Weight=5200,Defense=27}
|
||||
TypeID = 3428
|
||||
Name = "a tower shield"
|
||||
Flags = {Take,Shield}
|
||||
Attributes = {Weight=8200,Defense=32}
|
||||
Attributes = {Weight=8200,Defense=32,Cost=8000}
|
||||
|
||||
TypeID = 3429
|
||||
Name = "a black shield"
|
||||
|
@ -155,8 +155,19 @@ std::ostringstream& Container::getContentDescription(std::ostringstream& os) con
|
||||
} else {
|
||||
os << ", ";
|
||||
}
|
||||
|
||||
os << item->getNameDescription();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
if (firstitem) {
|
||||
|
@ -1182,6 +1182,12 @@ std::string Item::getWeightDescription() const
|
||||
return getWeightDescription(weight);
|
||||
}
|
||||
|
||||
uint32_t Item::getCost() const
|
||||
{
|
||||
const ItemType& it = items[id];
|
||||
return it.cost;
|
||||
}
|
||||
|
||||
bool Item::canDecay() const
|
||||
{
|
||||
if (isRemoved()) {
|
||||
|
@ -565,6 +565,7 @@ class Item : virtual public Thing
|
||||
std::string getDescription(int32_t lookDistance) const final;
|
||||
std::string getNameDescription() const;
|
||||
std::string getWeightDescription() const;
|
||||
uint32_t getCost() const;
|
||||
|
||||
//serialization
|
||||
virtual Attr_ReadValue readAttr(AttrTypes_t attr, PropStream& propStream);
|
||||
|
@ -423,6 +423,8 @@ bool Items::loadItems()
|
||||
items[id].lightColor = script.readNumber();
|
||||
} else if (identifier == "extrahitchance") {
|
||||
items[id].extraHitChance = script.readNumber();
|
||||
} else if (identifier == "cost") {
|
||||
items[id].cost = script.readNumber();
|
||||
} else if (identifier == "extraattack") {
|
||||
items[id].extraAttack = script.readNumber();
|
||||
} else if (identifier == "totalexpiretime") {
|
||||
|
@ -208,6 +208,7 @@ class ItemType
|
||||
uint32_t minReqLevel = 0;
|
||||
uint32_t minReqMagicLevel = 0;
|
||||
uint32_t charges = 0;
|
||||
uint32_t cost = 0;
|
||||
int32_t attackStrength = 0;
|
||||
int32_t attackVariation = 0;
|
||||
int32_t manaConsumption = 0;
|
||||
@ -222,7 +223,7 @@ class ItemType
|
||||
int32_t runeLevel = 0;
|
||||
int32_t nutrition = 0;
|
||||
int32_t destroyTarget = 0;
|
||||
|
||||
|
||||
CombatType_t combatType = COMBAT_NONE;
|
||||
CombatType_t damageType = COMBAT_NONE;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user