Fix npc trade and npc chat

master
Eduardo Bart 12 years ago
parent 0a49f58e50
commit 9ad9d88e10

@ -239,7 +239,7 @@ end
function addPrivateText(text, speaktype, name, isPrivateCommand, creatureName) function addPrivateText(text, speaktype, name, isPrivateCommand, creatureName)
local focus = false local focus = false
if speaktype.speakType == SpeakNpcFrom then if speaktype.npcChat then
name = 'NPCs' name = 'NPCs'
focus = true focus = true
end end

@ -39,6 +39,7 @@ function init()
reset() reset()
-- load only the first time (avoid load/save between reloads) -- load only the first time (avoid load/save between reloads)
--[[
if G.minimapFirstLoad then if G.minimapFirstLoad then
G.minimapFirstLoad = false G.minimapFirstLoad = false
if g_resources.fileExists('/minimap.otcm') then if g_resources.fileExists('/minimap.otcm') then
@ -53,7 +54,7 @@ function init()
connect(g_app, { onTerminate = function() connect(g_app, { onTerminate = function()
g_map.saveOtcm('/minimap.otcm') g_map.saveOtcm('/minimap.otcm')
end}) end})
end end]]--
end end
function terminate() function terminate()

@ -10,7 +10,7 @@ NPCItemBox < UICheckBox
color: #aaaaaa color: #aaaaaa
text-align: center text-align: center
text-offset: 0 20 text-offset: 0 20
@onCheckChange: NPCTrade.onItemBoxChecked(self) @onCheckChange: modules.game_npctrade.onItemBoxChecked(self)
Item Item
id: item id: item
@ -176,7 +176,7 @@ MainWindow
minimum: 1 minimum: 1
maximum: 100 maximum: 100
step: 1 step: 1
@onValueChange: NPCTrade.onQuantityValueChange(self:getValue()) @onValueChange: modules.game_npctrade.onQuantityValueChange(self:getValue())
FlatPanel FlatPanel
id: buyOptions id: buyOptions
@ -204,7 +204,7 @@ MainWindow
margin-top: -2 margin-top: -2
margin-left: 5 margin-left: 5
margin-right: 5 margin-right: 5
@onTextChange: NPCTrade.onSearchTextChange() @onTextChange: modules.game_npctrade.onSearchTextChange()
CheckBox CheckBox
id: buyWithBackpack id: buyWithBackpack
@ -214,7 +214,7 @@ MainWindow
anchors.right: parent.right anchors.right: parent.right
margin-left: 5 margin-left: 5
margin-top: 5 margin-top: 5
@onCheckChange: NPCTrade.onBuyWithBackpackChange() @onCheckChange: modules.game_npctrade.onBuyWithBackpackChange()
CheckBox CheckBox
id: ignoreCapacity id: ignoreCapacity
@ -224,7 +224,7 @@ MainWindow
anchors.right: parent.right anchors.right: parent.right
margin-left: 5 margin-left: 5
margin-top: 5 margin-top: 5
@onCheckChange: NPCTrade.onIgnoreCapacityChange() @onCheckChange: modules.game_npctrade.onIgnoreCapacityChange()
CheckBox CheckBox
id: ignoreEquipped id: ignoreEquipped
@ -236,7 +236,7 @@ MainWindow
margin-top: 5 margin-top: 5
visible: false visible: false
checked: true checked: true
@onCheckChange: NPCTrade.onIgnoreEquippedChange() @onCheckChange: modules.game_npctrade.onIgnoreEquippedChange()
CheckBox CheckBox
id: showAllItems id: showAllItems
@ -248,7 +248,7 @@ MainWindow
margin-top: 5 margin-top: 5
visible: false visible: false
checked: true checked: true
@onCheckChange: NPCTrade.onShowAllItemsChange() @onCheckChange: modules.game_npctrade.onShowAllItemsChange()
Button Button
id: tradeButton id: tradeButton
@ -257,7 +257,7 @@ MainWindow
anchors.right: next.left anchors.right: next.left
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
margin-right: 10 margin-right: 10
@onClick: NPCTrade.onTradeClick() @onClick: modules.game_npctrade.onTradeClick()
Button Button
!text: tr('Close') !text: tr('Close')

@ -62,8 +62,8 @@ void buildMessageModesMap(int version) {
messageModesMap[Otc::MessageSay] = 1; messageModesMap[Otc::MessageSay] = 1;
messageModesMap[Otc::MessageWhisper] = 2; messageModesMap[Otc::MessageWhisper] = 2;
messageModesMap[Otc::MessageYell] = 3; messageModesMap[Otc::MessageYell] = 3;
messageModesMap[Otc::MessageNpcFrom] = 4; messageModesMap[Otc::MessageNpcTo] = 4;
messageModesMap[Otc::MessageNpcTo] = 5; messageModesMap[Otc::MessageNpcFrom] = 5;
messageModesMap[Otc::MessagePrivateFrom] = 6; messageModesMap[Otc::MessagePrivateFrom] = 6;
messageModesMap[Otc::MessagePrivateTo] = 6; messageModesMap[Otc::MessagePrivateTo] = 6;
messageModesMap[Otc::MessageChannel] = 7; messageModesMap[Otc::MessageChannel] = 7;

@ -574,7 +574,13 @@ void ProtocolGame::parseOpenNpcTrade(const InputMessagePtr& msg)
if(g_game.getFeature(Otc::GameNameOnNpcTrade)) if(g_game.getFeature(Otc::GameNameOnNpcTrade))
npcName = msg->getString(); npcName = msg->getString();
int listCount = msg->getU8(); int listCount;
if(g_game.getClientVersion() >= 960)
listCount = msg->getU16();
else
listCount = msg->getU8();
for(int i = 0; i < listCount; ++i) { for(int i = 0; i < listCount; ++i) {
uint16 itemId = msg->getU16(); uint16 itemId = msg->getU16();
uint8 count = msg->getU8(); uint8 count = msg->getU8();
@ -953,6 +959,7 @@ void ProtocolGame::parseTalk(const InputMessagePtr& msg)
case Otc::MessageYell: case Otc::MessageYell:
case Otc::MessageMonsterSay: case Otc::MessageMonsterSay:
case Otc::MessageMonsterYell: case Otc::MessageMonsterYell:
case Otc::MessageNpcTo:
case Otc::MessageNpcFrom: case Otc::MessageNpcFrom:
case Otc::MessageBarkLow: case Otc::MessageBarkLow:
case Otc::MessageBarkLoud: case Otc::MessageBarkLoud:

Loading…
Cancel
Save