Fix npc trade and npc chat

This commit is contained in:
Eduardo Bart 2012-07-26 12:42:15 -03:00
parent 0a49f58e50
commit 9ad9d88e10
5 changed files with 21 additions and 13 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -574,7 +574,13 @@ void ProtocolGame::parseOpenNpcTrade(const InputMessagePtr& msg)
if(g_game.getFeature(Otc::GameNameOnNpcTrade))
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) {
uint16 itemId = msg->getU16();
uint8 count = msg->getU8();
@ -953,6 +959,7 @@ void ProtocolGame::parseTalk(const InputMessagePtr& msg)
case Otc::MessageYell:
case Otc::MessageMonsterSay:
case Otc::MessageMonsterYell:
case Otc::MessageNpcTo:
case Otc::MessageNpcFrom:
case Otc::MessageBarkLow:
case Otc::MessageBarkLoud: