diff --git a/800OTClient/modules/game_console/console.lua b/800OTClient/modules/game_console/console.lua index f76a218..100a544 100644 --- a/800OTClient/modules/game_console/console.lua +++ b/800OTClient/modules/game_console/console.lua @@ -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) diff --git a/800OTClient/modules/game_textmessage/textmessage.lua b/800OTClient/modules/game_textmessage/textmessage.lua index 47f9fdf..5e1a0b0 100644 --- a/800OTClient/modules/game_textmessage/textmessage.lua +++ b/800OTClient/modules/game_textmessage/textmessage.lua @@ -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 diff --git a/800OTClient/modules/gamelib/util.lua b/800OTClient/modules/gamelib/util.lua index e3abf07..6ce6ed7 100644 --- a/800OTClient/modules/gamelib/util.lua +++ b/800OTClient/modules/gamelib/util.lua @@ -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 \ No newline at end of file diff --git a/800OTClient/packet.log b/800OTClient/packet.log index fb94095..f019813 100644 --- a/800OTClient/packet.log +++ b/800OTClient/packet.log @@ -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 + diff --git a/config.lua b/config.lua index 0b99dbb..144eef2 100644 --- a/config.lua +++ b/config.lua @@ -52,7 +52,7 @@ serverName = "Tibianus" statusTimeout = 5000 replaceKickOnLogin = true maxPacketsPerSecond = 50 -packetCompression = true +packetCompression = false autoStackCumulatives = true moneyRate = 1 diff --git a/data/items800/items.srv b/data/items800/items.srv index 5f4271c..de50640 100644 --- a/data/items800/items.srv +++ b/data/items800/items.srv @@ -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" diff --git a/src/container.cpp b/src/container.cpp index 6165e59..ed7c219 100644 --- a/src/container.cpp +++ b/src/container.cpp @@ -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) { diff --git a/src/item.cpp b/src/item.cpp index d0d5c28..02419d5 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -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()) { diff --git a/src/item.h b/src/item.h index cca12ae..ccb00f0 100644 --- a/src/item.h +++ b/src/item.h @@ -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); diff --git a/src/items.cpp b/src/items.cpp index eb275cc..6c475f7 100644 --- a/src/items.cpp +++ b/src/items.cpp @@ -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") { diff --git a/src/items.h b/src/items.h index 9690ab8..3127697 100644 --- a/src/items.h +++ b/src/items.h @@ -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;