peonso / tibialegacyserver

Tibia Legacy Server is a OpenTibia 7.72 real map server.
32 stars 29 forks source link

Rashid proposal #45

Closed tarantonio closed 8 years ago

tarantonio commented 8 years ago

You want a Rashid NPC here and I have a working Rashid on my private server:

rashid.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rashid" script="Rashid.lua" walkinterval="25" access="3" lookdir="2">
<look type="128" head="114" body="101" legs="122" feet="115"/>
    <mana now="800" max="800"/>
    <health now="200" max="200"/>

<parameters>
    <parameter key="message_greet" value="Hello |PLAYERNAME|, I buy many items, you are abble to choise between armors, weapons, helmets, shields, boots, amulets and dolls, What do you offer me?" />
    <parameter key="message_farewell" value="Good bye |PLAYERNAME|!" />

    <parameter key="module_keywords" value="1" />
    <parameter key="keywords" value="weapons;armors;helmets;shields;boots;amulets;dolls" />

    <parameter key="keyword_reply1" value="I buy these weapons, daramanian mace, daramanian waraxe, guardian halberd, heavy machete, silver dagger and war axe." />
    <parameter key="keyword_reply2" value="I buy these armors, dragon scale mail, dwarven armor, golden armor, leopard armor and magic plate armor." />
    <parameter key="keyword_reply3" value="I buy these helmets, beholder helmet and devil helmet." />
    <parameter key="keyword_reply4" value="i buy these shields, bone shield, dark shield, demon shield, medusa shield, scarab shield and mastermind shield." />
    <parameter key="keyword_reply5" value="I buy these boots, crocodile boots, traper boots and steel boots." />
    <parameter key="keyword_reply6" value="I buy these amulets, ancient amulet, crystal necklace, crystal ring, demonbone amulet, emerald amulet, golden ring, platinum amulet, ring of the sky, ruby necklace, scarab amulet and silver brooch." />
    <parameter key="keyword_reply7" value="I buy these dolls, doll and voodoo doll." />  
    </parameters>
</npc>

rashid.lua

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
-- OTServ event handling functions end

local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)

shopModule:addSellableItem({'dragon scale mail'}, 2492, 40000, 'dragon scale mail')
shopModule:addSellableItem({'dwarven armor'}, 2503, 30000, 'dwarven armor')
shopModule:addSellableItem({'golden armor'}, 2466, 20000, 'golden armor')
shopModule:addSellableItem({'leopard armor'}, 3968, 1000, 'leopard armor')
shopModule:addSellableItem({'magic plate armor'}, 2472, 90000, 'magic plate armor')

shopModule:addSellableItem({'golden legs'}, 2470, 70000, 'golden legs')

shopModule:addSellableItem({'bone shield'}, 25480, 'bone shield')
shopModule:addSellableItem({'dark shield'}, 252400, 'dark shield')
shopModule:addSellableItem({'demon shield'}, 2520, 30000, 'demon shield')
shopModule:addSellableItem({'medusa shield'}, 2536, 9000, 'medusa shield')
shopModule:addSellableItem({'scarab shield'}, 2540, 2000, 'scarab shield')
shopModule:addSellableItem({'mastermind shield'}, 2514,50000, 'mastermind shield')

shopModule:addSellableItem({'beholder helmet'}, 3972, 7500, 'beholder helmet')
shopModule:addSellableItem({'devil helmet'}, 2462, 1000, 'devil helmet')

shopModule:addSellableItem({'crocodile boots'}, 3892, 1000, 'crocodile boots')
shopModule:addSellableItem({'traper boots'}, 2642000, 'traper boots')
shopModule:addSellableItem({'steel boots'}, 2645, 30000, 'steel boots')

shopModule:addSellableItem({'daramanian mace'}, 2439, 110, 'daramanian mace')
shopModule:addSellableItem({'daramanian waraxe'}, 2440, 1000, 'daramanian waraxe')
shopModule:addSellableItem({'guardian halberd'}, 2427, 11000, 'guardian halberd')
shopModule:addSellableItem({'heavy machete'}, 2442, 90, 'heavy machete')
shopModule:addSellableItem({'silver dagger'}, 2402, 500, 'silver dagger')
shopModule:addSellableItem({'war axe'}, 2454, 9000, 'war axe')

shopModule:addSellableItem({'ancient amulet'}, 2142, 200, 'ancient amulet')
shopModule:addSellableItem({'crystal necklace'}, 2125, 400, 'crystal necklace')
shopModule:addSellableItem({'crystal ring'}, 2124, 250, 'crystal ring')
shopModule:addSellableItem({'demonbone amulet'}, 2136, 32000, 'demonbone amulet')
shopModule:addSellableItem({'emerald bangle'}, 2127, 800, 'emerald bangle')
shopModule:addSellableItem({'golden ring'}, 2179, 8000, 'golden ring')
shopModule:addSellableItem({'platinum amulet'}, 2172500, 'platinum amulet')
shopModule:addSellableItem({'ring of the sky'}, 2123, 30000, 'ring of the sky')
shopModule:addSellableItem({'ruby necklace'}, 2133, 2000, 'ruby necklace')
shopModule:addSellableItem({'scarab amulet'}, 2135, 200, 'scarab amulet')
shopModule:addSellableItem({'silver brooch'}, 2134, 150,'silver brooch')

shopModule:addSellableItem({'doll'},2100 , 200, 'doll')
shopModule:addSellableItem({'voodoo doll'}, 3955, 400, 'voodoo doll')

npcHandler:addModule(FocusModule:new())

function greetCallback(cid)
    if getPlayerStorageValue(cid, 250) == 5 then -- Can buy/sell? Yes (change storage in your server)
        return true
    else -- Can't buy
        npcHandler:say('I\'m sorry, you aren\'t an Arch Postman. I only trade with honoured members of the Tibian Postmaster\'s Guild')
        return false
    end
end 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())```
peonso commented 8 years ago

Gonna add this to the extra scripts folder, wanna keep the default files as close to 7.72 as possible. You get the global scripts to set a random daily respaw?

tarantonio commented 8 years ago

Rashid was added in 8.1 update. In my server I added Rashid at first, and he only wanted to trade with players with the Postman missions completed. Now I got him out because it's not 7.72 related. I don't have daily respawns for 7.72 but I can try to give you some scripts to work on.