From 6624800f1cd5280dba7b43e0c7b5629bf6ac4062 Mon Sep 17 00:00:00 2001 From: ErikasKontenis Date: Wed, 4 Mar 2020 21:17:00 +0200 Subject: [PATCH] fix npcs to make ClientVersion statements --- data/npc/gen-t-furniture-containers-s.ndb | 6 +++--- data/npc/gen-t-furniture-pottery-s.ndb | 2 +- src/behaviourdatabase.cpp | 5 +++++ src/behaviourdatabase.h | 1 + 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/data/npc/gen-t-furniture-containers-s.ndb b/data/npc/gen-t-furniture-containers-s.ndb index c776774..892d0bd 100644 --- a/data/npc/gen-t-furniture-containers-s.ndb +++ b/data/npc/gen-t-furniture-containers-s.ndb @@ -18,9 +18,9 @@ "barrel" -> Type=2793, Amount=1, Price=12, "Do you want to buy a barrel for %P gold?", Topic=81 "trough" -> Type=2792, Amount=1, Price=7, "Do you want to buy a trough for %P gold?", Topic=81 "trunk" -> Type=2794, Amount=1, Price=10, "Do you want to buy a trunk for %P gold?", Topic=81 -"armor","rack" -> Type=6114, Amount=1, Price=90, "Do you want to buy an armor rack for %P gold?", Topic=81 -"weapon","rack" -> Type=6115, Amount=1, Price=90, "Do you want to buy a weapon rack for %P gold?", Topic=81 -"bookcase" -> Type=6372, Amount=1, Price=70, "Do you want to buy a bookcase for %P gold?", Topic=81 +"armor","rack" -> Type=6114, Amount=1, Price=90, "Do you want to buy an armor rack for %P gold?", Topic=81 +"weapon","rack" -> Type=6115, Amount=1, Price=90, "Do you want to buy a weapon rack for %P gold?", Topic=81 +"bookcase",ClientVersion>=790 -> Type=6372, Amount=1, Price=70, "Do you want to buy a bookcase for %P gold?", Topic=81 Topic=81,"yes",Premium,CountMoney>=Price -> "Here you are.", DeleteMoney, Create(Type) Topic=81,"yes",CountMoney>=Price -> "I'm sorry, but you need a premium account if you want to buy furniture." diff --git a/data/npc/gen-t-furniture-pottery-s.ndb b/data/npc/gen-t-furniture-pottery-s.ndb index e920942..55e3c8f 100644 --- a/data/npc/gen-t-furniture-pottery-s.ndb +++ b/data/npc/gen-t-furniture-pottery-s.ndb @@ -13,7 +13,7 @@ "large", "amphora" -> Type=2805, Amount=1, Price=50, "Do you want to buy a large amphora for %P gold?", Topic=81 "amphora" -> Type=2893, Amount=1, Price=4, "Do you want to buy an amphora for %P gold?", Topic=81 "coal","basin" -> Type=2806, Amount=1, Price=25, "Do you want to buy a coal basin for %P gold?", Topic=81 -"oven" -> Type=6371, Amount=1, Price=80, "Do you want to buy an oven for %P gold?", Topic=81 +"oven",ClientVersion>=790 -> Type=6371, Amount=1, Price=80, "Do you want to buy an oven for %P gold?", Topic=81 Topic=81,"yes",Premium,CountMoney>=Price -> "Here you are.", DeleteMoney, Create(Type) Topic=81,"yes",CountMoney>=Price -> "I'm sorry, but you need a premium account if you want to buy furniture." diff --git a/src/behaviourdatabase.cpp b/src/behaviourdatabase.cpp index a948179..59c4b3a 100644 --- a/src/behaviourdatabase.cpp +++ b/src/behaviourdatabase.cpp @@ -572,6 +572,9 @@ NpcBehaviourNode* BehaviourDatabase::readValue(ScriptReader& script) node = new NpcBehaviourNode(); node->type = BEHAVIOUR_TYPE_SLOTITEM; searchType = BEHAVIOUR_PARAMETER_ONE; + } else if (identifier == "clientversion") { + node = new NpcBehaviourNode(); + node->type = BEHAVIOUR_TYPE_CLIENTVERSION; } if (searchType == BEHAVIOUR_PARAMETER_ONE) { @@ -1221,6 +1224,8 @@ int32_t BehaviourDatabase::evaluate(NpcBehaviourNode* node, Player* player, cons return checkOperation(player, node, message); case BEHAVIOUR_TYPE_BALANCE: return player->getBankBalance(); + case BEHAVIOUR_TYPE_CLIENTVERSION: + return g_game.getClientVersion(); case BEHAVIOUR_TYPE_MESSAGE_TRANSFERTOPLAYERNAME_STATE: { std::string lowerMessage = asLowerCaseString(message); if (lowerMessage.find("to ") != std::string::npos) { diff --git a/src/behaviourdatabase.h b/src/behaviourdatabase.h index ad525bd..4ab3423 100644 --- a/src/behaviourdatabase.h +++ b/src/behaviourdatabase.h @@ -94,6 +94,7 @@ enum NpcBehaviourType_t BEHAVIOUR_TYPE_EXPIRINGQUESTVALUE, // get/set expiring quest value BEHAVIOUR_TYPE_SLOTITEM, // get slot item BEHAVIOUR_TYPE_PZFREE, // is player pz not locked + BEHAVIOUR_TYPE_CLIENTVERSION, // get client version }; enum NpcBehaviourOperator_t