diff --git a/New Text Document.txt b/New Text Document.txt new file mode 100644 index 0000000..3667316 --- /dev/null +++ b/New Text Document.txt @@ -0,0 +1 @@ +next: 17538 \ No newline at end of file diff --git a/data/actions/actions.xml b/data/actions/actions.xml index 6fed2ba..3e360fa 100644 --- a/data/actions/actions.xml +++ b/data/actions/actions.xml @@ -186,9 +186,11 @@ + + diff --git a/data/actions/scripts/misc/botanist_container.lua b/data/actions/scripts/misc/botanist_container.lua index 4eb510a..6699252 100644 --- a/data/actions/scripts/misc/botanist_container.lua +++ b/data/actions/scripts/misc/botanist_container.lua @@ -15,6 +15,16 @@ function onUse(player, item, fromPosition, target, toPosition) item:transform(4869, 1) target:getPosition():sendMagicEffect(10) return true + elseif target:getId() == 5658 and player:getStorageValue(17535) == 1 then + if player:getStorageValue(17536) < os.time() then + item:transform(5937, 1) + target:getPosition():sendMagicEffect(10) + player:setStorageValue(17536, os.time() + 20 * 60 * 60) -- 20 hour + return true + else + player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You just collected a fragile griffinclaw. At least wait for the rest of the plant to recover a bit before gathering more.") + return true + end end return false end diff --git a/data/actions/scripts/misc/ceirons_waterskin.lua b/data/actions/scripts/misc/ceirons_waterskin.lua new file mode 100644 index 0000000..e23aaf2 --- /dev/null +++ b/data/actions/scripts/misc/ceirons_waterskin.lua @@ -0,0 +1,12 @@ +function onUse(player, item, fromPosition, target, toPosition) + if not target:isItem() then + return false + end + + if target:getId() == 5662 and Game.isItemThere({x = 33024, y = 32672, z = 6}, 5662) then + item:transform(5939, 1) + target:getPosition():sendMagicEffect(2) + return true + end + return false +end diff --git a/data/globalevents/scripts/startup.lua b/data/globalevents/scripts/startup.lua index 5910452..beaa0d2 100644 --- a/data/globalevents/scripts/startup.lua +++ b/data/globalevents/scripts/startup.lua @@ -1,3 +1,12 @@ +local function setBloomingGriffinclaw() + local position = {x = 32024, y = 32830, z = 4} + if Game.isItemThere(position,5687) then + Game.removeItemOnMap(position, 5687) + Game.createItem(5658, 1, position) + Game.sendMagicEffect(position, 15) + end +end + function onStartup() math.randomseed(os.mtime()) @@ -47,4 +56,18 @@ function onStartup() until not result.next(resultId) result.free(resultId) end + + -- blooming griffinclaw + local dayNow = tonumber(os.date("%d", os.time())) + if (dayNow == 1) then + setGlobalStorageValue(1, 0) + end + + if getGlobalStorageValue(1) == 0 then + local randomDay = math.random(dayNow, 28) + if (randomDay == 28) then + setGlobalStorageValue(1, 1) + addEvent(setBloomingGriffinclaw, 10000) + end + end end diff --git a/data/items/items.srv b/data/items/items.srv index b55aa76..705bf3b 100644 --- a/data/items/items.srv +++ b/data/items/items.srv @@ -7431,12 +7431,12 @@ Flags = {Door,Top,SeparationEvent,Unmove} TypeID = 1682 Name = "a closed door" -Flags = {Door,Unpass,Unmove,Unthrow,Unlay} +Description = "It is locked" +Flags = {UseEvent,Door,Unpass,Unmove,Unthrow,Unlay} TypeID = 1683 Name = "a closed door" -Description = "It is locked" -Flags = {UseEvent,Door,Unpass,Unmove,Unthrow,Unlay} +Flags = {Door,Unpass,Unmove,Unthrow,Unlay} TypeID = 1684 Name = "an open door" @@ -7470,12 +7470,12 @@ Flags = {Top,SeparationEvent,Door,Unmove} TypeID = 1691 Name = "a closed door" -Flags = {Door,Unpass,Unmove,Unthrow,Unlay} +Description = "It is locked" +Flags = {UseEvent,Door,Unpass,Unmove,Unthrow,Unlay} TypeID = 1692 Name = "a closed door" -Description = "It is locked" -Flags = {UseEvent,Door,Unpass,Unmove,Unthrow,Unlay} +Flags = {Door,Unpass,Unmove,Unthrow,Unlay} TypeID = 1693 Name = "an open door" @@ -26857,11 +26857,13 @@ Attributes = {Weight=2000} TypeID = 5938 Name = "Ceiron's waterskin" +Description = "It is empty" Flags = {Take} Attributes = {Weight=700} TypeID = 5939 Name = "Ceiron's waterskin" +Description = "It contains a special sample of water from a hydra cave" Flags = {Take} Attributes = {Weight=700} diff --git a/data/lib/core/game.lua b/data/lib/core/game.lua index 29cacef..12c7c92 100644 --- a/data/lib/core/game.lua +++ b/data/lib/core/game.lua @@ -117,9 +117,32 @@ if not globalStorageTable then end function Game.getStorageValue(key) - return globalStorageTable[key] + -- Return from local table if possible + if globalStorageTable[key] ~= nil then + return globalStorageTable[key] + end + + -- Else look for it on the DB + local dbData = db.storeQuery("SELECT `value` FROM `global_storage` WHERE `key` = " .. key .. " LIMIT 1;") + if dbData ~= false then + local value = result.getNumber(dbData, "value") + if value ~= nil then + -- Save it to globalStorageTable + globalStorageTable[key] = value + return value + end + end + + return nil end function Game.setStorageValue(key, value) globalStorageTable[key] = value + + local dbData = db.storeQuery("SELECT `value` FROM `global_storage` WHERE `key` = " .. key .. " LIMIT 1;") + if dbData ~= false then + db.query("UPDATE `global_storage` SET `value`='".. value .."' WHERE `key` = " .. key .. " LIMIT 1;") + else + db.query("INSERT INTO `global_storage` (`key`, `value`) VALUES (" .. key .. ", " .. value .. ");") + end end diff --git a/data/npc/ceiron.npc b/data/npc/ceiron.npc index db06ad2..6c52251 100644 --- a/data/npc/ceiron.npc +++ b/data/npc/ceiron.npc @@ -17,5 +17,82 @@ VANISH,! -> "May Crunor bless and guide you, %N." "bye" -> "May Crunor bless and guide you, %N.", Idle "farewell" -> * +"addon",QuestValue(17535)=10 -> "I am proud to see you with the Faolan gift." +"outfit",QuestValue(17535)=10 -> * +"addon",QuestValue(17535)=0 -> "What are you thinking! I would never allow you to slay my beloved friends for the sake of your narcism. Only Faolan can grant you a fur like this one.", Topic=1 +"outfit",QuestValue(17535)=0 -> * +Topic=1,"faolan" -> "I know where the great wolf mother lives, but I will not tell that to just anyone. You have to earn my respect first. Are you willing to help me?", Topic=2 +Topic=2,"yes" -> "I hope that I am not asking too much of you with this task. I heard of a flower which is currently unique in Tibia and can survive at only one place. ...", + "This place is somewhere in the bleak mountains of Nargor. I would love to have a sample of its blossom, but the problem is that it seldom actually blooms. ...", + "I cannot afford to travel there each day just to check whether the time has already come, besides I have no idea where to start looking. ...", + "I would be deeply grateful if you could support me in this matter and collect a sample of the blooming Griffinclaw for me. ...", + "Have you understood everything I told you and will fulfill this task for me?", Topic=3 +Topic=2 -> "Maybe another time." +Topic=3,"yes" -> Type=4867, Amount=1, "Alright then. Take this botanist's container and return to me once you were able to retrieve a sample. Don't lose patience!", Create(Type), SetQuestValue(17535,1) +Topic=3 -> "Maybe another time." +"task",QuestValue(17535)=1 -> Type=5937, Amount=1, "Were you able to obtain a sample of the Griffinclaw?", Topic=4 +"mission",QuestValue(17535)=1 -> * +"griffinclaw",QuestValue(17535)=1 -> * +Topic=4,"yes",Count(Type)>=Amount -> "Crunor be praised! The Griffinclaw really exists! Now, I will make sure that it will not become extinct. If you are ready to help me again, just ask me for a task.", Delete(Type), SetQuestValue(17535,2) +Topic=4,"yes" -> "Sorry, you do not have it." +Topic=4 -> "Maybe another time." + +"task",QuestValue(17535)=2 -> "Listen, your next task is not exactly easy either. ...", + "In the mountains between Ankrahmun and Tiquanda are two hydra lairs. The northern one has many waterfalls whereas the southern one has just tiny water trickles. ...", + "However, these trickles are said to contain water as pure and clean as nowhere else in Tibia. ...", + "If you could reach one of these trickles and retrieve a water sample for me, it would be a great help. ...", + "It is important that you take the water directly from the trickle, not from the pond - else it will not be so pure anymore. ...", + "Have you understood everything I told you and will you fulfill this task for me?", Topic=5 +"mission",QuestValue(17535)=2 -> * +Topic=5,"yes" -> Type=5938, Amount=1, "Great! Here, take my waterskin and try to fill it with water from this special trickle. Don't lose my waterskin, I will not accept some random dirty waterskin.", Create(Type), SetQuestValue(17535,3) +Topic=5 -> "Maybe another time." + +"waterskin",QuestValue(17535)=3 -> Type=5938, Amount=1, Price=1000, "Have you lost my waterskin? Would you like to buy another one for %P gold?", Topic=6 +Topic=6,"yes",CountMoney>=Price -> "Here, better don't lose it.", DeleteMoney, Create(Type) +Topic=6,"yes" -> "I am sorry, but you do not have enough gold." +Topic=6 -> "Maybe another time." + +"task",QuestValue(17535)=3 -> Type=5939, Amount=1, "Did you bring me a sample of the water from the hydra cave?", Topic=7 +"mission",QuestValue(17535)=3 -> * +"water",QuestValue(17535)=3 -> * +Topic=7,"yes",Count(Type)>=Amount -> "Good work, %N! This water looks indeed extremely clear. I will examine it right away. If you are ready to help me again, just ask me for a task.", Delete(Type), SetQuestValue(17535,4) +Topic=7,"yes" -> "Sorry, you do not have it." +Topic=7 -> "Maybe another time." + +"task",QuestValue(17535)=4 -> "I'm glad that you are still with me, %N. Especially because my next task might require even more patience from your side than the ones before. ...", + "Demons... these unholy creatures should have never been able to walk the earth. They are a brood fuelled only by hatred and malice. ...", + "Even if slain, their evil spirit is not fully killed. It needs a blessed stake to release their last bit of fiendishness and turn them into dust. ...", + "It does not work all the time, but if you succeed, their vicious spirit is finally defeated. ...", + "I want proof that you are on the right side against Zathroth. Bring me 100 ounces of demon dust and I shall be convinced. ...", + "You'll probably need to ask a priest for help to obtain a blessed stake. ...", + "Have you understood everything I told you and will you fulfil this task for me?", Topic=8 +"mission",QuestValue(17535)=4 -> * +Topic=8,"yes" -> "Good! I will eagerly await your return.", SetQuestValue(17535,5) +Topic=8 -> "Maybe another time." + +"task",QuestValue(17535)=5 -> Type=5906, Amount=100, "Were you really able to collect 100 ounces of demon dust?", Topic=9 +"mission",QuestValue(17535)=5 -> * +"demon","dust",QuestValue(17535)=5 -> * +Topic=9,"yes",Count(Type)>=Amount -> "I'm very impressed, %N. With this task you have proven that you are not only on the right side, but also quite powerful. If you are ready to help me again, just ask me for a task.", Delete(Type), SetQuestValue(17535,6) +Topic=9,"yes" -> "Sorry, you do not have that many." +Topic=9 -> "Maybe another time." + +"task",QuestValue(17535)=6 -> "I have one final task for you, %N. Many months ago, I was trying to free the war wolves which are imprisoned inside the orc fortress. ...", + "Unfortunately, my intrusion was discovered and I had to run for my life. During my escape, I lost my favourite wolf tooth chain. ...", + "It should still be somewhere in the fortress if the orcs did not try to eat it. I really wish you could retrieve it for me. ...", + "It has the letter 'C' carved into one of the teeth. Please look for it. ...", + "Have you understood everything I told you and will you fulfil this task for me?", Topic=10 +"mission",QuestValue(17535)=6 -> * +Topic=10,"yes" -> "Good! I will eagerly await your return.", SetQuestValue(17535,7) +Topic=10 -> "Maybe another time." + +"task",QuestValue(17535)=7 -> Type=5940, Amount=1, "Have you really found my wolf tooth chain??", Topic=11 +"mission",QuestValue(17535)=7 -> * +"wolf ","tooth","chain",QuestValue(17535)=7 -> * +Topic=11,"yes",Count(Type)>=Amount -> "Crunor be praised! You found my beloved chain! %N, you really earned my respect and I consider you as a friend from now on. Remind me to tell you about Faolan sometime.", Delete(Type), SetQuestValue(17535,8) +Topic=11,"yes" -> "Sorry, you do not have it." +Topic=11 -> "Maybe another time." + +"faolan",QuestValue(17535)=8 -> "Right, I will keep my promise. Faolan roams Tibia freely, but her favourite sleeping cave is on Cormaya. I will cast a spell on you that enables you to speak the wolf language for a while.", SetQuestValue(17535,9), EffectOpp(13) } diff --git a/data/npc/helor.npc b/data/npc/helor.npc index bdbed88..4fbb2f0 100644 --- a/data/npc/helor.npc +++ b/data/npc/helor.npc @@ -4,7 +4,7 @@ Name = "Helor" Outfit = (134,57-79-95-98) Home = [32572,32753,6] -Radius = 0 +Radius = 1 Behaviour = { ADDRESS,"hello$",! -> "Be greeted in the name of the gods, traveller." diff --git a/data/npc/majesticwarwolf.npc b/data/npc/majesticwarwolf.npc index d1ac110..2682eb0 100644 --- a/data/npc/majesticwarwolf.npc +++ b/data/npc/majesticwarwolf.npc @@ -6,14 +6,22 @@ Home = [33355,31991,8] Radius = 4 Behaviour = { -ADDRESS,"hello$",! -> NOP -ADDRESS,"hi$",! -> NOP +ADDRESS,"hello$",QuestValue(17535)>8,! -> "Interesting. A human who can speak the language of wolves." +ADDRESS,"hi$",QuestValue(17535)>8,! -> * ADDRESS,! -> Idle BUSY,"hello$",! -> NOP BUSY,"hi$",! -> * BUSY,! -> NOP -VANISH,! -> NOP +VANISH,! -> "YOOOOUHHOOOUU!" -"bye" -> Idle +"bye" -> "YOOOOUHHOOOUU!", Idle + +"addon",QuestValue(17535)=9 -> "I can see in your eyes that you are a honest and friendly person, %N. You were patient enough to learn our language and I will grant you a special gift. Will you accept it?", Topic=1 +"outfit",QuestValue(17535)=9 -> * +Topic=1,"yes", -> "From now on, you shall be known as %N, the bear warrior. You shall be strong and proud as Angros, the great dark bear. He shall guide your path.", SetQuestValue(17535,10), AddOutfitAddon(144,1), AddOutfitAddon(148,1) +Topic=1 -> "Maybe another time." + +"addon",QuestValue(17535)=10 -> "I am proud to see you as strong as the Angros!" +"outfit",QuestValue(17535)=10 -> * } diff --git a/data/npc/myra.npc b/data/npc/myra.npc index d184173..3b2905a 100644 --- a/data/npc/myra.npc +++ b/data/npc/myra.npc @@ -4,7 +4,7 @@ Name = "Myra" Outfit = (140,115-0-19-95) Home = [32580,32751,6] -Radius = 0 +Radius = 1 Behaviour = { ADDRESS,"hello$",! -> "Greetings." diff --git a/data/npc/tom.npc b/data/npc/tom.npc index 2c68c77..3aca645 100644 --- a/data/npc/tom.npc +++ b/data/npc/tom.npc @@ -43,7 +43,9 @@ VANISH,! -> "Doh?" "rat" -> Type=3994, Amount=1, Price=2, "I'll give you %P gold for a dead rat. Do you accept?", Topic=1 "rabbit" -> Type=4173, Amount=1, Price=2, "I'll give you %P gold for a dead rabbit. Do you accept?", Topic=1 "wolf" -> Type=4007, Amount=1, Price=5, "Do you want to sell a dead wolf for %P gold?", Topic=1 -"minotaur leather" -> Type=5878, Amount=1, Price=12, "Do you want to sell a minotaur leather for %P gold?", Topic=1 +"minotaur","leather" -> Type=5878, Amount=1, Price=12, "Do you want to sell a minotaur leather for %P gold?", Topic=1 +"wolf","paw" -> Type=5897, Amount=1, Price=7, "Do you want to sell a wolf paw for %P gold?", Topic=1 +"bear","paw" -> Type=5896, Amount=1, Price=10, "Do you want to sell a bear paw for %P gold?", Topic=1 %1,1<%1,"rat",Questvalue(224)=0 -> Type=3994, Amount=%1, Price=2*%1, "I'll give you %P gold for %A dead rats. Do you accept?", Topic=2 %1,1<%1,"rabbit",Questvalue(224)=0 -> Type=4173, Amount=%1, Price=2*%1, "I'll give you %P gold for %A dead rabbits. Do you accept?", Topic=2 @@ -51,7 +53,9 @@ VANISH,! -> "Doh?" %1,1<%1,"rabbit" -> Type=4173, Amount=%1, Price=2*%1, "I'll give you %P gold for %A dead rabbits. Do you accept?", Topic=1 %1,1<%1,"wolf" -> Type=4007, Amount=%1, Price=5*%1, "Do you want to sell %A dead wolves for %P gold?", Topic=1 %1,1<%1,"wolves" -> Type=4007, Amount=%1, Price=5*%1, "Do you want to sell %A dead wolves for %P gold?", Topic=1 -%1,1<%1,"minotaur leather" -> Type=5878, Amount=%1, Price=12*%1, "Do you want to sell %A minotaur leathers for %P gold?", Topic=1 +%1,1<%1,"minotaur","leather" -> Type=5878, Amount=%1, Price=12*%1, "Do you want to sell %A minotaur leathers for %P gold?", Topic=1 +%1,1<%1,"wolf","paw" -> Type=5897, Amount=%1, Price=7*%1, "Do you want to sell %A wolf paws for %P gold?", Topic=1 +%1,1<%1,"bear","paw" -> Type=5896, Amount=%1, Price=10*%1, "Do you want to sell %A bear paws for %P gold?", Topic=1 Topic=1,"yes",Count(Type)>=Amount -> "Ok. Corpse for me, gold for you.", Delete(Type), CreateMoney Topic=1,"yes" -> "Sorry, you do not have a fresh one." diff --git a/data/npc/ustan.npc b/data/npc/ustan.npc index 732b8c0..9f2e99f 100644 --- a/data/npc/ustan.npc +++ b/data/npc/ustan.npc @@ -2,9 +2,9 @@ # ustan.npc: Datenbank für den Druidenlehrer Ustan Name = "Ustan" -Outfit = (132,0-24-13-76) +Outfit = (144,0-24-13-76-1) Home = [32580,32757,6] -Radius = 0 +Radius = 1 Behaviour = { ADDRESS,"hello$",! -> "Crunor's blessing, traveller." @@ -140,4 +140,31 @@ Topic=3,"yes",Level Amount=SpellLevel(String), "You have t Topic=3,"yes",CountMoney "Sorry, you do not have enough gold." Topic=3,"yes" -> "Here you are. Look in your spellbook for the pronunciation of this spell.", DeleteMoney, EffectOpp(13), TeachSpell(String) Topic=3 -> "Maybe next time." + +"wolf","tooth","chain" -> Type=3012, Amount=1, Price=100, "Do you want to sell a wolf tooth chain for %P gold?", Topic=4 +"wolf","paw" -> Type=5897, Amount=1, Price=70, "Do you want to sell a wolf paw for %P gold?", Topic=4 +"bear","paw" -> Type=5896, Amount=1, Price=100, "Do you want to sell a bear paw for %P gold?", Topic=4 + +%1,1<%1,"wolf","tooth","chain" -> Type=3012, Amount=%1, Price=100*%1, "Do you want to sell %A wolf tooth chains for %P gold?", Topic=4 +%1,1<%1,"wolf","paw" -> Type=5897, Amount=%1, Price=70*%1, "Do you want to sell %A wolf paws for %P gold?", Topic=4 +%1,1<%1,"bear","paw" -> Type=5896, Amount=%1, Price=100*%1, "Do you want to sell %A bear paws for %P gold?", Topic=4 + +Topic=4,"yes",Count(Type)>=Amount -> "Here you are.", Delete(Type), CreateMoney +Topic=4,"yes" -> "Sorry, you do not have it." +Topic=4,"yes",Amount>1 -> "Sorry, you do not have so many." +Topic=4 -> "Maybe another time." + +"addon",QuestValue(18504)=0,premium -> "Would you like to wear bear paws like I do? No problem, just bring me 50 bear paws and 50 wolf paws and I'll fit them on.", SetQuestValue(18504,1) +"paws",QuestValue(18504)=0,premium -> * +"addon",QuestValue(18504)=0 -> "Addons can be wear only by premium players." +"paws",QuestValue(18504)=0 -> * + +"addon",QuestValue(18504)=1 -> "Have you brought 50 bear paws and 50 wolf paws?", Topic=5 +"paws",QuestValue(18504)=1 -> * +Topic=5,"yes",Count(5897)>=50,Count(5896)>=50 -> "Excellent! Like promised, here are your bear paws.", DeleteAmount(5897,50), DeleteAmount(5896,50), SetQuestValue(18504,2), AddOutfitAddon(148,1), AddOutfitAddon(144,1) +Topic=5,"yes" -> "You don't have required ingredients." +Topic=5 -> "Maybe another time." + +"addon",QuestValue(18504)=2 -> "I see that you like your new bear paws!" +"paws",QuestValue(18504)=2 -> * } diff --git a/data/world/map.otbm b/data/world/map.otbm index d17ebd3..4f2d055 100644 Binary files a/data/world/map.otbm and b/data/world/map.otbm differ diff --git a/data/world/spawns.xml b/data/world/spawns.xml index 473ab58..3fbca28 100644 --- a/data/world/spawns.xml +++ b/data/world/spawns.xml @@ -3153,16 +3153,25 @@ + + + + + + + + + @@ -3185,6 +3194,9 @@ + + + diff --git a/sabrehaven.sql b/sabrehaven.sql index d6a4e7e..c89fa9f 100644 --- a/sabrehaven.sql +++ b/sabrehaven.sql @@ -1362,6 +1362,25 @@ INSERT INTO `server_config` (`config`, `value`) VALUES -- -------------------------------------------------------- +-- +-- Table structure for table `global_storage` +-- + +CREATE TABLE IF NOT EXISTS `global_storage` ( + `key` int(10) unsigned NOT NULL DEFAULT '0', + `value` int(11) DEFAULT NULL, + PRIMARY KEY (`key`) +) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8; + +-- +-- Dumping data for table `global_storage` +-- + +INSERT INTO `global_storage` (`key`, `value`) VALUES +(1, 0); -- key 1 = blooming griffinclaw; value 0 = not started in this month, value 1 = already started once + +-- -------------------------------------------------------- + -- -- Table structure for table `tile_store` --