forgottenserver/data/scripts/spells/#example.lua

20 lines
513 B
Lua
Raw Permalink Normal View History

Revscriptsys Spells (#2584) * Spell handling through lua - Basics are done, but this is still wip * work on reload for spell - just a few tiny changes * spell __newindex function - this include __newindex for spell - Spell does now return Userdata instead of tabledata * added Spell Functions - It includes all necessary Spell functions now * made use of dynamic_cast - There is still a cleanup todo, there are still several const_cast which I need to switch over - applied createFunctions for Spell * added a few safety checks - cleaned up some functions - changed const_cast to dynamic_cast - exclusive InstantSpell & RuneSpell functions will not crash the server if not used appropriate * erased duplicate - erased duplicated g_spells->clear(true); * enabled strings on Spell creation - now you can use Spell("rune") & Spell("instant") aswell * shortened down luaSpellGroup - created stringToSpellGroup(), so I could get rid of repetitive stuff. * combined charges and hasCharges - if we set a rune :charges(1) or higher it'll automaticly mean that it should use charges aswell. However if we don't set :charges or :charges(0) it means the rune is infinite. * Final Spell handling - changed so Spells are getting pushed as Spell now and not as InstantSpell or RuneSpell - corrected the methods :allowFarUse :blockWalls and :checkFloor - corrected RuneSpell* Spells::getRuneSpell(uint32_t id) it now can be accessed by either runeId or spellId - corrected InstantSpell* Spells::getInstantSpellById(uint32_t spellId) it now returns the correct InstantSpell * compiler error fix * little update - removed switch since it's just SPELL_INSTANT and SPELL_RUNE anyway - changed RuneSpell* Spells::getRuneSpell(uint32_t id) so it doesn't try to re initialize it again * Spells #example.lua - added Spells #example.lua * safety move - moved those 2 variables inside the if statements for safety.
2019-05-26 21:16:33 +02:00
local conjureRune = Spell(SPELL_INSTANT)
function conjureRune.onCastSpell(creature, variant)
return creature:conjureItem(2260, 2275, 25)
end
conjureRune:name("Test")
conjureRune:id(221)
conjureRune:words("adori mas test")
conjureRune:level(30)
conjureRune:mana(530)
conjureRune:group("support")
conjureRune:soul(3)
conjureRune:isAggressive(false)
conjureRune:cooldown(2000)
conjureRune:groupCooldown(2000)
conjureRune:needLearn(false)
conjureRune:vocation("sorcerer", "master sorcerer")
Revscriptsys Spells (#2584) * Spell handling through lua - Basics are done, but this is still wip * work on reload for spell - just a few tiny changes * spell __newindex function - this include __newindex for spell - Spell does now return Userdata instead of tabledata * added Spell Functions - It includes all necessary Spell functions now * made use of dynamic_cast - There is still a cleanup todo, there are still several const_cast which I need to switch over - applied createFunctions for Spell * added a few safety checks - cleaned up some functions - changed const_cast to dynamic_cast - exclusive InstantSpell & RuneSpell functions will not crash the server if not used appropriate * erased duplicate - erased duplicated g_spells->clear(true); * enabled strings on Spell creation - now you can use Spell("rune") & Spell("instant") aswell * shortened down luaSpellGroup - created stringToSpellGroup(), so I could get rid of repetitive stuff. * combined charges and hasCharges - if we set a rune :charges(1) or higher it'll automaticly mean that it should use charges aswell. However if we don't set :charges or :charges(0) it means the rune is infinite. * Final Spell handling - changed so Spells are getting pushed as Spell now and not as InstantSpell or RuneSpell - corrected the methods :allowFarUse :blockWalls and :checkFloor - corrected RuneSpell* Spells::getRuneSpell(uint32_t id) it now can be accessed by either runeId or spellId - corrected InstantSpell* Spells::getInstantSpellById(uint32_t spellId) it now returns the correct InstantSpell * compiler error fix * little update - removed switch since it's just SPELL_INSTANT and SPELL_RUNE anyway - changed RuneSpell* Spells::getRuneSpell(uint32_t id) so it doesn't try to re initialize it again * Spells #example.lua - added Spells #example.lua * safety move - moved those 2 variables inside the if statements for safety.
2019-05-26 21:16:33 +02:00
conjureRune:register()