zude96 1 Postado Dezembro 15, 2016 Share Postado Dezembro 15, 2016 (editado) Eae Galera Do Xtibia Bom Esse é o Meu Primeiro Post De Um Conteudo Pra Vocês Bom, Como Esse Sistema Funciona ? O Player Vai Digitar o Comando !fly e em Seguinda ele Fala Fly up Pra Subir Pra Descer é o Fly Down Vá em Data/lib e Crie um Arquivo Chamando 075-fly.lua e Cole Isso Dentro Spoiler FLY_STORAGE = getConfigValue("flyStorage")flyBlackSQM = falsenonFlyableBorder = {7576, 7577}changeSpeed = trueflySpeed = 800waterSpeed = 150ITEM_FLYTILE = 460ITEM_WATERTILE = 4625FLY_OUTFIT = {lookType = 239, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}WATER = {4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619}RANGEX = 1RANGEY = 1 ret ={"You are now flying.","You are not flying anymore.","You cannot stop flying here.","You are not flying.","You cannot up here.","You cannot down here.","You cannot go to there."}storPos = {x = 1200, y = 1201, z = 1202}function isWalkable(pos, creature, proj, pz)if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false endif getTopCreature(pos).uid > 0 and creature then return false endif getTileInfo(pos).protection and pz then return false, true endlocal n = not proj and 3 or 2for i = 0, 255 dopos.stackpos = ilocal tile = getTileThingByPos(pos)if tile.itemid ~= 0 and not isCreature(tile.uid) thenif hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) thenreturn falseendendendreturn trueendfunction getAreaToRemove(pos1, pos2)local t = getDirectionTo(pos1, pos2)local pos ={[0] ={{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[2] ={{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z}},[1] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[3] ={{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}},[7] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}},[6] = {{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[5] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z}},[4] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}}}return pos[t]endfunction doCreateTile(pos)doAreaCombatHealth(0, 0, pos, 0, 0, 0, 255)end Agora Vá em Data/Talkactions e Crie Um Arquivo Chamado fly.lua e Cole Isso Dentro Spoiler function onSay(cid, words, param)local pos = getCreaturePosition(cid)pos.stackpos = 0if(words == "!fly") thenif getCreatureStorage(cid, FLY_STORAGE) > 0 thenif not isWalkable(getCreaturePosition(cid)) or getThingFromPos(pos).itemid == ITEM_FLYTILE or getThingFromPos(pos).itemid == ITEM_WATERTILE thendoPlayerSendCancel(cid, ret[3])return trueenddoChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))doCreatureSetStorage(cid, FLY_STORAGE, 0)doRemoveCondition(cid, CONDITION_OUTFIT)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ret[2])return trueelsedoCreatureSetStorage(cid, FLY_STORAGE, 1)doRemoveConditions(cid, true)doSetCreatureOutfit(cid, FLY_OUTFIT, -1)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ret[1])if changeSpeed thendoChangeSpeed(cid, flySpeed)endreturn trueendelseif(words == "fly") thenif param == "up" thenpos.z = pos.z - 1doCreateTile(pos)if getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])return trueendif(getCreaturePosition(cid).z == 0) or (getThingFromPos(pos).itemid ~= ITEM_FLYTILE and getThingFromPos(pos).itemid > 0) or (getTileInfo(pos).house) thendoPlayerSendCancel(cid, ret[5])return trueendlocal tpos = postpos.stackpos = 253if isCreature(getThingFromPos(tpos).uid) thendoPlayerSendCancel(cid, ret[5])return trueendlocal toCreate = {}for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 thentable.insert(toCreate, area)endendif getThingFromPos(pos).itemid < 1 thenfor _, create in ipairs(toCreate) docreate.stackpos = 0doCreateItem(ITEM_FLYTILE, 1, create)enddoTeleportThing(cid, pos)if changeSpeed thendoChangeSpeed(cid, flySpeed)endpos.z = pos.z + 1doSendMagicEffect(pos, CONST_ME_BLOCKHIT)for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endendelsedoPlayerSendCancel(cid, ret[7])endelseif param == "down" thenpos.z = pos.z + 1doCreateTile(pos)if getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])return trueendif getCreaturePosition(cid).z == 14 thendoPlayerSendCancel(cid, ret[6])return trueendif(getTileInfo(pos).house) thendoPlayerSendCancel(cid, ret[6])return trueendlocal cpos = getCreaturePosition(cid)cpos.stackpos = 0if getThingFromPos(cpos).itemid ~= ITEM_FLYTILE thendoPlayerSendCancel(cid, ret[6])return trueendlocal tpos = postpos.stackpos = 253if isCreature(getThingFromPos(tpos).uid) thendoPlayerSendCancel(cid, ret[6])return trueendlocal toCreate = {}for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area) local thing = getThingFromPos(area)if(thing.itemid < 1 or isInArray(WATER, thing.itemid)) thentable.insert(toCreate, area) endendlocal x = falseif isWalkable(pos) or getThingFromPos(pos).itemid < 1 or isInArray(WATER, getThingFromPos(pos).itemid) thenfor _, create in ipairs(toCreate) doif isInArray(WATER, getThingFromPos(create).itemid) thendoTransformItem(getThingFromPos(create).uid, ITEM_WATERTILE)x = (create.z == pos.z and true or false)elsedoCreateItem(ITEM_FLYTILE, 1, create)endenddoTeleportThing(cid, pos)doSendMagicEffect(pos, (x and CONST_ME_WATERSPLASH or getThingFromPos(pos).itemid == ITEM_WATERTILE and CONST_ME_WATERSPLASH or CONST_ME_NONE))if changeSpeed thendoChangeSpeed(cid, (x and (-getCreatureSpeed(cid) + waterSpeed + getCreatureBaseSpeed(cid)) or (-getCreatureSpeed(cid) + flySpeed + getCreatureBaseSpeed(cid))))endpos.z = pos.z - 1doSendMagicEffect(pos, CONST_ME_BLOCKHIT)for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dolocal thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)endendelsedoPlayerSendCancel(cid, ret[7])endendendreturn trueend Agora Vá em Data/Movements/Scripts e Crie um Arquivo Chamado fly.lua e Cole Isso Dentro Spoiler function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)if isInArray({ITEM_FLYTILE, ITEM_WATERTILE}, item.itemid) thenif not isPlayer(cid) thendoTeleportThing(cid, fromPosition)return trueendif getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])doTeleportThing(cid, fromPosition)return trueend local toPos = toPositiontoPos.stackpos = 0if not flyBlackSQM thentoPos.z = 7doCreateTile(toPos)if getThingFromPos(toPos).itemid < 1 or getThingFromPos(toPos).itemid == ITEM_FLYTILE thendoTeleportThing(cid, fromPosition)return trueendtoPos.z = toPosition.zendif(getTileInfo(toPos).house) thendoTeleportThing(cid, fromPosition)return trueendif nonFlyableBorder and type(nonFlyableBorder) == "table" thenfor i = toPos.z, 14 dotoPos.z = itoPos.stackpos = 1doCreateTile(toPos)if isInArray(nonFlyableBorder, getThingFromPos(toPos).itemid) thendoTeleportThing(cid, fromPosition)return trueendendtoPos.z = getCreaturePosition(cid).ztoPos.stackpos = 0endfor _, area in ipairs(getArea(toPos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 or thing.itemid == ITEM_FLYTILE thendoCreateItem(ITEM_FLYTILE, 1, area)elseif thing.itemid == ITEM_WATERTILE or isInArray(WATER, thing.itemid) thendoTransformItem(thing.uid, ITEM_WATERTILE)endendendreturn trueendfunction onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)local area = getAreaToRemove(fromPosition, toPosition)for _, arear in ipairs(area) dodoCreateTile(arear)local thing = getThingFromPos(arear)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endendreturn trueend feito Isso Vá em Data/creaturescripts/scripts/ e vá no login.lua e coloque essa Função Spoiler function onLogin(cid)if getCreatureStorage(cid, FLY_STORAGE) > 0 thenlocal storpos = {x = getCreatureStorage(cid, storPos.x), y = getCreatureStorage(cid, storPos.y), z = getCreatureStorage(cid, storPos.z), stackpos = 0}doCreateTile(storpos)local thing = getThingFromPos(storpos)if thing.itemid < 1 or isInArray(WATER, thing.itemid) thenfor _, area in ipairs(getArea(storpos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 thendoCreateItem(ITEM_FLYTILE, 1, area)elseif isInArray(WATER, getThingFromPos(area).itemid) thendoTransformItem(getThingFromPos(area).uid, ITEM_WATERTILE)endendenddoRemoveConditions(cid, true)doSetCreatureOutfit(cid, FLY_OUTFIT, -1)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You are now flying.")doTeleportThing(cid, storpos)return trueendend e Essa Aqui Tambem Spoiler registerCreatureEvent(cid, "PlayerLogout") Agora Crie Um Arquivo No CreatureScripts Com O Nome De logout.lua e Cole Isso Dentro Spoiler function onLogout(cid)if getCreatureStorage(cid, FLY_STORAGE) > 0 thenlocal pos = getCreaturePosition(cid)pos.stackpos = 0for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endenddoCreatureSetStorage(cid, storPos.x, pos.x)doCreatureSetStorage(cid, storPos.y, pos.y)doCreatureSetStorage(cid, storPos.z, pos.z)endreturn trueend Agora Vá no Talkactions.xml e Cole Isso Dentro Spoiler <talkaction words="!fly;fly" case-sensitive="no" event="script" value="fly.lua"/> Em Seguida Vá no Movements.xml e Cole Isso Dentro Spoiler <movevent type="StepIn" itemid="460" event="script" value="fly.lua"/><movevent type="StepOut" itemid="460" event="script" value="fly.lua"/><movevent type="StepIn" itemid="4609-4619" event="script" value="fly.lua"/><movevent type="StepIn" itemid="4625" event="script" value="fly.lua"/> Agora em creaturescripts.xml e Cole isso Spoiler <event type="logout" name="PlayerLogout" event="script" value="logout.lua"/> Agora o Trabalho Vai Ser Nas Sources Vá no game.cpp e Procure Por Essa Função Spoiler bool Game::combatBlockHit(CombatType_t combatType, Creature* attacker, Creature* target,int32_t& healthChange, bool checkDefense, bool checkArmor) Substitua Por Essa Spoiler bool Game::combatBlockHit(CombatType_t combatType, Creature* attacker, Creature* target,int32_t& healthChange, bool checkDefense, bool checkArmor){if(healthChange > 0)return false;const Position& targetPos = target->getPosition();const SpectatorVec& list = getSpectators(targetPos);if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR){std::string value;MagicEffect_t eff = MAGIC_EFFECT_POFF;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)eff = MAGIC_EFFECT_NONE; addMagicEffect(list, targetPos, eff, target->isGhost());return true;}int32_t damage = -healthChange;BlockType_t blockType = target->blockHit(attacker, combatType, damage, checkDefense, checkArmor);healthChange = -damage;if(blockType == BLOCK_DEFENSE){addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF);return true;}else if(blockType == BLOCK_ARMOR){addMagicEffect(list, targetPos, MAGIC_EFFECT_BLOCKHIT);return true;}else if(blockType != BLOCK_IMMUNITY)return false;MagicEffect_t effect = MAGIC_EFFECT_NONE;switch(combatType){case COMBAT_UNDEFINEDDAMAGE:break;case COMBAT_ENERGYDAMAGE:case COMBAT_FIREDAMAGE:case COMBAT_PHYSICALDAMAGE:case COMBAT_ICEDAMAGE:case COMBAT_DEATHDAMAGE:case COMBAT_EARTHDAMAGE:case COMBAT_HOLYDAMAGE:{effect = MAGIC_EFFECT_BLOCKHIT;break;}default:{effect = MAGIC_EFFECT_POFF;std::string value;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)effect = MAGIC_EFFECT_NONE;break;}}addMagicEffect(list, targetPos, effect);return true;} Ainda em game.cpp Procure por Essa Função Spoiler bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange,MagicEffect_t hitEffect/* = MAGIC_EFFECT_UNKNOWN*/, TextColor_t hitColor/* = TEXTCOLOR_UNKNOWN*/, bool force/* = false*/) e Substitua Por Essa Spoiler bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange,MagicEffect_t hitEffect/* = MAGIC_EFFECT_UNKNOWN*/, TextColor_t hitColor/* = TEXTCOLOR_UNKNOWN*/, bool force/* = false*/){const Position& targetPos = target->getPosition();if(healthChange > 0){if(!force && target->getHealth() <= 0)return false;bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_HEALTHGAIN, combatType, healthChange))deny = true;}if(deny)return false;target->gainHealth(attacker, healthChange);if(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE) && !target->isGhost() &&(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE_MONSTER) || !target->getMonster())){char buffer[20];sprintf(buffer, "+%d", healthChange);const SpectatorVec& list = getSpectators(targetPos);if(combatType != COMBAT_HEALING)addMagicEffect(list, targetPos, MAGIC_EFFECT_WRAPS_BLUE);addAnimatedText(list, targetPos, TEXTCOLOR_GREEN, buffer);}}else{const SpectatorVec& list = getSpectators(targetPos);if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR){std::string value;MagicEffect_t eff = MAGIC_EFFECT_POFF;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)eff = MAGIC_EFFECT_NONE;addMagicEffect(list, targetPos, eff);return true;}int32_t damage = -healthChange;if(damage != 0){if(target->hasCondition(CONDITION_MANASHIELD) && combatType != COMBAT_UNDEFINEDDAMAGE){int32_t manaDamage = std::min(target->getMana(), damage);damage = std::max((int32_t)0, damage - manaDamage);if(manaDamage != 0){bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANALOSS, combatType, manaDamage))deny = true;}if(deny)return false;target->drainMana(attacker, combatType, manaDamage);char buffer[20];sprintf(buffer, "%d", manaDamage);addMagicEffect(list, targetPos, MAGIC_EFFECT_LOSE_ENERGY);addAnimatedText(list, targetPos, TEXTCOLOR_BLUE, buffer);}}damage = std::min(target->getHealth(), damage);if(damage > 0){bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_HEALTHLOSS, combatType, damage))deny = true;}if(deny)return false;target->drainHealth(attacker, combatType, damage);addCreatureHealth(list, target);TextColor_t textColor = TEXTCOLOR_NONE;MagicEffect_t magicEffect = MAGIC_EFFECT_NONE;switch(combatType){case COMBAT_PHYSICALDAMAGE:{Item* splash = NULL;switch(target->getRace()){case RACE_VENOM:textColor = TEXTCOLOR_LIGHTGREEN;magicEffect = MAGIC_EFFECT_POISON;splash = Item::CreateItem(ITEM_SMALLSPLASH, FLUID_GREEN);break;case RACE_BLOOD:textColor = TEXTCOLOR_RED;magicEffect = MAGIC_EFFECT_DRAW_BLOOD;splash = Item::CreateItem(ITEM_SMALLSPLASH, FLUID_BLOOD);break;case RACE_UNDEAD:textColor = TEXTCOLOR_GREY;magicEffect = MAGIC_EFFECT_HIT_AREA;break;case RACE_FIRE:textColor = TEXTCOLOR_ORANGE;magicEffect = MAGIC_EFFECT_DRAW_BLOOD;break;case RACE_ENERGY:textColor = TEXTCOLOR_PURPLE;magicEffect = MAGIC_EFFECT_PURPLEENERGY;break;default:break;}if(splash){internalAddItem(NULL, target->getTile(), splash, INDEX_WHEREEVER, FLAG_NOLIMIT);startDecay(splash);}break;}case COMBAT_ENERGYDAMAGE:{textColor = TEXTCOLOR_PURPLE;magicEffect = MAGIC_EFFECT_ENERGY_DAMAGE;break;}case COMBAT_EARTHDAMAGE:{textColor = TEXTCOLOR_LIGHTGREEN;magicEffect = MAGIC_EFFECT_POISON_RINGS;break;}case COMBAT_DROWNDAMAGE:{textColor = TEXTCOLOR_LIGHTBLUE;magicEffect = MAGIC_EFFECT_LOSE_ENERGY;break;}case COMBAT_FIREDAMAGE:{textColor = TEXTCOLOR_ORANGE;magicEffect = MAGIC_EFFECT_HITBY_FIRE;break;}case COMBAT_ICEDAMAGE:{textColor = TEXTCOLOR_TEAL;magicEffect = MAGIC_EFFECT_ICEATTACK;break;}case COMBAT_HOLYDAMAGE:{textColor = TEXTCOLOR_YELLOW;magicEffect = MAGIC_EFFECT_HOLYDAMAGE;break;}case COMBAT_DEATHDAMAGE:{textColor = TEXTCOLOR_DARKRED;magicEffect = MAGIC_EFFECT_SMALLCLOUDS;break;}case COMBAT_LIFEDRAIN:{textColor = TEXTCOLOR_RED;magicEffect = MAGIC_EFFECT_WRAPS_RED;break;}default:break;}if(hitEffect != MAGIC_EFFECT_UNKNOWN)magicEffect = hitEffect;if(hitColor != TEXTCOLOR_UNKNOWN)textColor = hitColor;if(textColor < TEXTCOLOR_NONE && magicEffect < MAGIC_EFFECT_NONE){char buffer[20];sprintf(buffer, "%d", damage);addMagicEffect(list, targetPos, magicEffect);addAnimatedText(list, targetPos, textColor, buffer);}}}}return true;} Agora Procure Por Essa Função Spoiler bool Game::combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange) Substitua Por Essa Spoiler bool Game::combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange) { const Position& targetPos = target->getPosition(); if(manaChange > 0) { bool deny = false; CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE); for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it) { if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANAGAIN, COMBAT_HEALING, manaChange)) deny = true; } if(deny) return false; target->changeMana(manaChange); if(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE) && !target->isGhost() && (g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE_MONSTER) || !target->getMonster())) { char buffer[20]; sprintf(buffer, "+%d", manaChange); const SpectatorVec& list = getSpectators(targetPos); addAnimatedText(list, targetPos, TEXTCOLOR_DARKPURPLE, buffer); } } else { const SpectatorVec& list = getSpectators(targetPos); if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR) { std::string value; MagicEffect_t eff = MAGIC_EFFECT_POFF; if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0) eff = MAGIC_EFFECT_NONE; addMagicEffect(list, targetPos, eff); return false; } int32_t manaLoss = std::min(target->getMana(), -manaChange); BlockType_t blockType = target->blockHit(attacker, COMBAT_MANADRAIN, manaLoss); if(blockType != BLOCK_NONE) { addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF); return false; } if(manaLoss > 0) { bool deny = false; CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE); for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it) { if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANALOSS, COMBAT_UNDEFINEDDAMAGE, manaChange)) deny = true; } if(deny) return false; target->drainMana(attacker, COMBAT_MANADRAIN, manaLoss); char buffer[20]; sprintf(buffer, "%d", manaLoss); addAnimatedText(list, targetPos, TEXTCOLOR_BLUE, buffer); } } return true; } Agora vá em configmanager.cpp e procure por essa Função Spoiler m_confBool[ADDONS_PREMIUM] = getGlobalBool("addonsOnlyPremium", true); e em baixo dela Adicione iSSO Spoiler m_confNumber[FLY_STORAGE] = getGlobalNumber("flyStorage", 0); Agora Vá em configmanager.h e Procure por Essa Função Spoiler HOUSE_CLEAN_OLD e em baixo dela Adicione Isso Spoiler FLY_STORAGE, E Pra Terminar Adicione Essa Storage no Config.lua Spoiler flyStorage = 65535 Como esse Foi Meu Primeiro Post Então Não Tenho Muita Experiencia Aqui, Não Consegui por o Gif, Mais Vou Por Link Das Imagens Do Fly up e Down Spoiler http://prnt.sc/djl4vt http://prnt.sc/djl55x http://prnt.sc/djl57w http://prnt.sc/djl5m0 http://prnt.sc/djl5ma Pra Configurar a Outfit Que Fica após vc digitar o Comando !fly, Vá em Data/lib 075-fly.lua e altere Nessa Linha Spoiler FLY_OUTFIT = {lookType = 239, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0} Creditos: Otland.net Darkhaos Editado Dezembro 15, 2016 por zude96 Link para o comentário Compartilhar em outros sites More sharing options...
Wicke 60 Postado Dezembro 15, 2016 Share Postado Dezembro 15, 2016 12 minutos atrás, zude96 disse: Eae Galera Do Xtibia Bom Esse é o Meu Primeiro Post De Um Conteudo Pra Vocês Bom, Como Esse Sistema Funciona ? O Player Vai Digitar o Comando !fly e em Seguinda ele Fala Fly up Pra Subir Pra Descer é o Fly Down Vá em Data/lib e Crie um Arquivo Chamando 075-fly.lua e Cole Isso Dentro Mostrar conteúdo oculto FLY_STORAGE = getConfigValue("flyStorage")flyBlackSQM = falsenonFlyableBorder = {7576, 7577}changeSpeed = trueflySpeed = 800waterSpeed = 150ITEM_FLYTILE = 460ITEM_WATERTILE = 4625FLY_OUTFIT = {lookType = 239, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}WATER = {4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619}RANGEX = 1RANGEY = 1 ret ={"You are now flying.","You are not flying anymore.","You cannot stop flying here.","You are not flying.","You cannot up here.","You cannot down here.","You cannot go to there."}storPos = {x = 1200, y = 1201, z = 1202}function isWalkable(pos, creature, proj, pz)if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false endif getTopCreature(pos).uid > 0 and creature then return false endif getTileInfo(pos).protection and pz then return false, true endlocal n = not proj and 3 or 2for i = 0, 255 dopos.stackpos = ilocal tile = getTileThingByPos(pos)if tile.itemid ~= 0 and not isCreature(tile.uid) thenif hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) thenreturn falseendendendreturn trueendfunction getAreaToRemove(pos1, pos2)local t = getDirectionTo(pos1, pos2)local pos ={[0] ={{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[2] ={{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z}},[1] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[3] ={{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}},[7] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}},[6] = {{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[5] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z}},[4] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}}}return pos[t]endfunction doCreateTile(pos)doAreaCombatHealth(0, 0, pos, 0, 0, 0, 255)end Agora Vá em Data/Talkactions e Crie Um Arquivo Chamado fly.lua e Cole Isso Dentro Mostrar conteúdo oculto function onSay(cid, words, param)local pos = getCreaturePosition(cid)pos.stackpos = 0if(words == "!fly") thenif getCreatureStorage(cid, FLY_STORAGE) > 0 thenif not isWalkable(getCreaturePosition(cid)) or getThingFromPos(pos).itemid == ITEM_FLYTILE or getThingFromPos(pos).itemid == ITEM_WATERTILE thendoPlayerSendCancel(cid, ret[3])return trueenddoChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))doCreatureSetStorage(cid, FLY_STORAGE, 0)doRemoveCondition(cid, CONDITION_OUTFIT)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ret[2])return trueelsedoCreatureSetStorage(cid, FLY_STORAGE, 1)doRemoveConditions(cid, true)doSetCreatureOutfit(cid, FLY_OUTFIT, -1)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ret[1])if changeSpeed thendoChangeSpeed(cid, flySpeed)endreturn trueendelseif(words == "fly") thenif param == "up" thenpos.z = pos.z - 1doCreateTile(pos)if getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])return trueendif(getCreaturePosition(cid).z == 0) or (getThingFromPos(pos).itemid ~= ITEM_FLYTILE and getThingFromPos(pos).itemid > 0) or (getTileInfo(pos).house) thendoPlayerSendCancel(cid, ret[5])return trueendlocal tpos = postpos.stackpos = 253if isCreature(getThingFromPos(tpos).uid) thendoPlayerSendCancel(cid, ret[5])return trueendlocal toCreate = {}for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 thentable.insert(toCreate, area)endendif getThingFromPos(pos).itemid < 1 thenfor _, create in ipairs(toCreate) docreate.stackpos = 0doCreateItem(ITEM_FLYTILE, 1, create)enddoTeleportThing(cid, pos)if changeSpeed thendoChangeSpeed(cid, flySpeed)endpos.z = pos.z + 1doSendMagicEffect(pos, CONST_ME_BLOCKHIT)for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endendelsedoPlayerSendCancel(cid, ret[7])endelseif param == "down" thenpos.z = pos.z + 1doCreateTile(pos)if getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])return trueendif getCreaturePosition(cid).z == 14 thendoPlayerSendCancel(cid, ret[6])return trueendif(getTileInfo(pos).house) thendoPlayerSendCancel(cid, ret[6])return trueendlocal cpos = getCreaturePosition(cid)cpos.stackpos = 0if getThingFromPos(cpos).itemid ~= ITEM_FLYTILE thendoPlayerSendCancel(cid, ret[6])return trueendlocal tpos = postpos.stackpos = 253if isCreature(getThingFromPos(tpos).uid) thendoPlayerSendCancel(cid, ret[6])return trueendlocal toCreate = {}for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area) local thing = getThingFromPos(area)if(thing.itemid < 1 or isInArray(WATER, thing.itemid)) thentable.insert(toCreate, area) endendlocal x = falseif isWalkable(pos) or getThingFromPos(pos).itemid < 1 or isInArray(WATER, getThingFromPos(pos).itemid) thenfor _, create in ipairs(toCreate) doif isInArray(WATER, getThingFromPos(create).itemid) thendoTransformItem(getThingFromPos(create).uid, ITEM_WATERTILE)x = (create.z == pos.z and true or false)elsedoCreateItem(ITEM_FLYTILE, 1, create)endenddoTeleportThing(cid, pos)doSendMagicEffect(pos, (x and CONST_ME_WATERSPLASH or getThingFromPos(pos).itemid == ITEM_WATERTILE and CONST_ME_WATERSPLASH or CONST_ME_NONE))if changeSpeed thendoChangeSpeed(cid, (x and (-getCreatureSpeed(cid) + waterSpeed + getCreatureBaseSpeed(cid)) or (-getCreatureSpeed(cid) + flySpeed + getCreatureBaseSpeed(cid))))endpos.z = pos.z - 1doSendMagicEffect(pos, CONST_ME_BLOCKHIT)for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dolocal thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)endendelsedoPlayerSendCancel(cid, ret[7])endendendreturn trueend Agora Vá em Data/Movements/Scripts e Crie um Arquivo Chamado fly.lua e Cole Isso Dentro Mostrar conteúdo oculto function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)if isInArray({ITEM_FLYTILE, ITEM_WATERTILE}, item.itemid) thenif not isPlayer(cid) thendoTeleportThing(cid, fromPosition)return trueendif getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])doTeleportThing(cid, fromPosition)return trueend local toPos = toPositiontoPos.stackpos = 0if not flyBlackSQM thentoPos.z = 7doCreateTile(toPos)if getThingFromPos(toPos).itemid < 1 or getThingFromPos(toPos).itemid == ITEM_FLYTILE thendoTeleportThing(cid, fromPosition)return trueendtoPos.z = toPosition.zendif(getTileInfo(toPos).house) thendoTeleportThing(cid, fromPosition)return trueendif nonFlyableBorder and type(nonFlyableBorder) == "table" thenfor i = toPos.z, 14 dotoPos.z = itoPos.stackpos = 1doCreateTile(toPos)if isInArray(nonFlyableBorder, getThingFromPos(toPos).itemid) thendoTeleportThing(cid, fromPosition)return trueendendtoPos.z = getCreaturePosition(cid).ztoPos.stackpos = 0endfor _, area in ipairs(getArea(toPos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 or thing.itemid == ITEM_FLYTILE thendoCreateItem(ITEM_FLYTILE, 1, area)elseif thing.itemid == ITEM_WATERTILE or isInArray(WATER, thing.itemid) thendoTransformItem(thing.uid, ITEM_WATERTILE)endendendreturn trueendfunction onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)local area = getAreaToRemove(fromPosition, toPosition)for _, arear in ipairs(area) dodoCreateTile(arear)local thing = getThingFromPos(arear)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endendreturn trueend feito Isso Vá em Data/creaturescripts/scripts/ e vá no login.lua e coloque essa Função Mostrar conteúdo oculto function onLogin(cid)if getCreatureStorage(cid, FLY_STORAGE) > 0 thenlocal storpos = {x = getCreatureStorage(cid, storPos.x), y = getCreatureStorage(cid, storPos.y), z = getCreatureStorage(cid, storPos.z), stackpos = 0}doCreateTile(storpos)local thing = getThingFromPos(storpos)if thing.itemid < 1 or isInArray(WATER, thing.itemid) thenfor _, area in ipairs(getArea(storpos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 thendoCreateItem(ITEM_FLYTILE, 1, area)elseif isInArray(WATER, getThingFromPos(area).itemid) thendoTransformItem(getThingFromPos(area).uid, ITEM_WATERTILE)endendenddoRemoveConditions(cid, true)doSetCreatureOutfit(cid, FLY_OUTFIT, -1)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You are now flying.")doTeleportThing(cid, storpos)return trueendend e Essa Aqui Tambem Mostrar conteúdo oculto registerCreatureEvent(cid, "PlayerLogout") Agora Crie Um Arquivo No CreatureScripts Com O Nome De logout.lua e Cole Isso Dentro Mostrar conteúdo oculto function onLogout(cid)if getCreatureStorage(cid, FLY_STORAGE) > 0 thenlocal pos = getCreaturePosition(cid)pos.stackpos = 0for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endenddoCreatureSetStorage(cid, storPos.x, pos.x)doCreatureSetStorage(cid, storPos.y, pos.y)doCreatureSetStorage(cid, storPos.z, pos.z)endreturn trueend Agora Vá no Talkactions.xml e Cole Isso Dentro Mostrar conteúdo oculto <talkaction words="!fly;fly" case-sensitive="no" event="script" value="fly.lua"/> Em Seguida Vá no Movements.xml e Cole Isso Dentro Mostrar conteúdo oculto <movevent type="StepIn" itemid="460" event="script" value="fly.lua"/><movevent type="StepOut" itemid="460" event="script" value="fly.lua"/><movevent type="StepIn" itemid="4609-4619" event="script" value="fly.lua"/><movevent type="StepIn" itemid="4625" event="script" value="fly.lua"/> Agora em creaturescripts.xml e Cole isso Mostrar conteúdo oculto <event type="logout" name="PlayerLogout" event="script" value="logout.lua"/> Agora o Trabalho Vai Ser Nas Sources Vá no game.cpp e Procure Por Essa Função Mostrar conteúdo oculto bool Game::combatBlockHit(CombatType_t combatType, Creature* attacker, Creature* target,int32_t& healthChange, bool checkDefense, bool checkArmor) Substitua Por Essa Mostrar conteúdo oculto bool Game::combatBlockHit(CombatType_t combatType, Creature* attacker, Creature* target,int32_t& healthChange, bool checkDefense, bool checkArmor){if(healthChange > 0)return false;const Position& targetPos = target->getPosition();const SpectatorVec& list = getSpectators(targetPos);if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR){std::string value;MagicEffect_t eff = MAGIC_EFFECT_POFF;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)eff = MAGIC_EFFECT_NONE; addMagicEffect(list, targetPos, eff, target->isGhost());return true;}int32_t damage = -healthChange;BlockType_t blockType = target->blockHit(attacker, combatType, damage, checkDefense, checkArmor);healthChange = -damage;if(blockType == BLOCK_DEFENSE){addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF);return true;}else if(blockType == BLOCK_ARMOR){addMagicEffect(list, targetPos, MAGIC_EFFECT_BLOCKHIT);return true;}else if(blockType != BLOCK_IMMUNITY)return false;MagicEffect_t effect = MAGIC_EFFECT_NONE;switch(combatType){case COMBAT_UNDEFINEDDAMAGE:break;case COMBAT_ENERGYDAMAGE:case COMBAT_FIREDAMAGE:case COMBAT_PHYSICALDAMAGE:case COMBAT_ICEDAMAGE:case COMBAT_DEATHDAMAGE:case COMBAT_EARTHDAMAGE:case COMBAT_HOLYDAMAGE:{effect = MAGIC_EFFECT_BLOCKHIT;break;}default:{effect = MAGIC_EFFECT_POFF;std::string value;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)effect = MAGIC_EFFECT_NONE;break;}}addMagicEffect(list, targetPos, effect);return true;} Ainda em game.cpp Procure por Essa Função Mostrar conteúdo oculto bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange,MagicEffect_t hitEffect/* = MAGIC_EFFECT_UNKNOWN*/, TextColor_t hitColor/* = TEXTCOLOR_UNKNOWN*/, bool force/* = false*/) e Substitua Por Essa Mostrar conteúdo oculto bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange,MagicEffect_t hitEffect/* = MAGIC_EFFECT_UNKNOWN*/, TextColor_t hitColor/* = TEXTCOLOR_UNKNOWN*/, bool force/* = false*/){const Position& targetPos = target->getPosition();if(healthChange > 0){if(!force && target->getHealth() <= 0)return false;bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_HEALTHGAIN, combatType, healthChange))deny = true;}if(deny)return false;target->gainHealth(attacker, healthChange);if(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE) && !target->isGhost() &&(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE_MONSTER) || !target->getMonster())){char buffer[20];sprintf(buffer, "+%d", healthChange);const SpectatorVec& list = getSpectators(targetPos);if(combatType != COMBAT_HEALING)addMagicEffect(list, targetPos, MAGIC_EFFECT_WRAPS_BLUE);addAnimatedText(list, targetPos, TEXTCOLOR_GREEN, buffer);}}else{const SpectatorVec& list = getSpectators(targetPos);if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR){std::string value;MagicEffect_t eff = MAGIC_EFFECT_POFF;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)eff = MAGIC_EFFECT_NONE;addMagicEffect(list, targetPos, eff);return true;}int32_t damage = -healthChange;if(damage != 0){if(target->hasCondition(CONDITION_MANASHIELD) && combatType != COMBAT_UNDEFINEDDAMAGE){int32_t manaDamage = std::min(target->getMana(), damage);damage = std::max((int32_t)0, damage - manaDamage);if(manaDamage != 0){bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANALOSS, combatType, manaDamage))deny = true;}if(deny)return false;target->drainMana(attacker, combatType, manaDamage);char buffer[20];sprintf(buffer, "%d", manaDamage);addMagicEffect(list, targetPos, MAGIC_EFFECT_LOSE_ENERGY);addAnimatedText(list, targetPos, TEXTCOLOR_BLUE, buffer);}}damage = std::min(target->getHealth(), damage);if(damage > 0){bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_HEALTHLOSS, combatType, damage))deny = true;}if(deny)return false;target->drainHealth(attacker, combatType, damage);addCreatureHealth(list, target);TextColor_t textColor = TEXTCOLOR_NONE;MagicEffect_t magicEffect = MAGIC_EFFECT_NONE;switch(combatType){case COMBAT_PHYSICALDAMAGE:{Item* splash = NULL;switch(target->getRace()){case RACE_VENOM:textColor = TEXTCOLOR_LIGHTGREEN;magicEffect = MAGIC_EFFECT_POISON;splash = Item::CreateItem(ITEM_SMALLSPLASH, FLUID_GREEN);break;case RACE_BLOOD:textColor = TEXTCOLOR_RED;magicEffect = MAGIC_EFFECT_DRAW_BLOOD;splash = Item::CreateItem(ITEM_SMALLSPLASH, FLUID_BLOOD);break;case RACE_UNDEAD:textColor = TEXTCOLOR_GREY;magicEffect = MAGIC_EFFECT_HIT_AREA;break;case RACE_FIRE:textColor = TEXTCOLOR_ORANGE;magicEffect = MAGIC_EFFECT_DRAW_BLOOD;break;case RACE_ENERGY:textColor = TEXTCOLOR_PURPLE;magicEffect = MAGIC_EFFECT_PURPLEENERGY;break;default:break;}if(splash){internalAddItem(NULL, target->getTile(), splash, INDEX_WHEREEVER, FLAG_NOLIMIT);startDecay(splash);}break;}case COMBAT_ENERGYDAMAGE:{textColor = TEXTCOLOR_PURPLE;magicEffect = MAGIC_EFFECT_ENERGY_DAMAGE;break;}case COMBAT_EARTHDAMAGE:{textColor = TEXTCOLOR_LIGHTGREEN;magicEffect = MAGIC_EFFECT_POISON_RINGS;break;}case COMBAT_DROWNDAMAGE:{textColor = TEXTCOLOR_LIGHTBLUE;magicEffect = MAGIC_EFFECT_LOSE_ENERGY;break;}case COMBAT_FIREDAMAGE:{textColor = TEXTCOLOR_ORANGE;magicEffect = MAGIC_EFFECT_HITBY_FIRE;break;}case COMBAT_ICEDAMAGE:{textColor = TEXTCOLOR_TEAL;magicEffect = MAGIC_EFFECT_ICEATTACK;break;}case COMBAT_HOLYDAMAGE:{textColor = TEXTCOLOR_YELLOW;magicEffect = MAGIC_EFFECT_HOLYDAMAGE;break;}case COMBAT_DEATHDAMAGE:{textColor = TEXTCOLOR_DARKRED;magicEffect = MAGIC_EFFECT_SMALLCLOUDS;break;}case COMBAT_LIFEDRAIN:{textColor = TEXTCOLOR_RED;magicEffect = MAGIC_EFFECT_WRAPS_RED;break;}default:break;}if(hitEffect != MAGIC_EFFECT_UNKNOWN)magicEffect = hitEffect;if(hitColor != TEXTCOLOR_UNKNOWN)textColor = hitColor;if(textColor < TEXTCOLOR_NONE && magicEffect < MAGIC_EFFECT_NONE){char buffer[20];sprintf(buffer, "%d", damage);addMagicEffect(list, targetPos, magicEffect);addAnimatedText(list, targetPos, textColor, buffer);}}}}return true;} Agora Procure Por Essa Função Mostrar conteúdo oculto bool Game::combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange) Substitua Por Essa Mostrar conteúdo oculto bool Game::combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange) { const Position& targetPos = target->getPosition(); if(manaChange > 0) { bool deny = false; CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE); for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it) { if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANAGAIN, COMBAT_HEALING, manaChange)) deny = true; } if(deny) return false; target->changeMana(manaChange); if(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE) && !target->isGhost() && (g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE_MONSTER) || !target->getMonster())) { char buffer[20]; sprintf(buffer, "+%d", manaChange); const SpectatorVec& list = getSpectators(targetPos); addAnimatedText(list, targetPos, TEXTCOLOR_DARKPURPLE, buffer); } } else { const SpectatorVec& list = getSpectators(targetPos); if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR) { std::string value; MagicEffect_t eff = MAGIC_EFFECT_POFF; if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0) eff = MAGIC_EFFECT_NONE; addMagicEffect(list, targetPos, eff); return false; } int32_t manaLoss = std::min(target->getMana(), -manaChange); BlockType_t blockType = target->blockHit(attacker, COMBAT_MANADRAIN, manaLoss); if(blockType != BLOCK_NONE) { addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF); return false; } if(manaLoss > 0) { bool deny = false; CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE); for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it) { if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANALOSS, COMBAT_UNDEFINEDDAMAGE, manaChange)) deny = true; } if(deny) return false; target->drainMana(attacker, COMBAT_MANADRAIN, manaLoss); char buffer[20]; sprintf(buffer, "%d", manaLoss); addAnimatedText(list, targetPos, TEXTCOLOR_BLUE, buffer); } } return true; } Agora vá em configmanager.cpp e procure por essa Função Mostrar conteúdo oculto m_confBool[ADDONS_PREMIUM] = getGlobalBool("addonsOnlyPremium", true); e em baixo dela Adicione iSSO Mostrar conteúdo oculto m_confNumber[FLY_STORAGE] = getGlobalNumber("flyStorage", 0); Agora Vá em configmanager.h e Procure por Essa Função Mostrar conteúdo oculto HOUSE_CLEAN_OLD e em baixo dela Adicione Isso Mostrar conteúdo oculto FLY_STORAGE, E Pra Terminar Adicione Essa Storage no Config.lua Ocultar conteúdo flyStorage = 65535 Creditos: Otland.net Darkhaos Bem legal Se puder colocar um Gif ou imagens dando up e down pra deixar mas legal o post agradecemos! Link para o comentário Compartilhar em outros sites More sharing options...
zude96 1 Postado Dezembro 15, 2016 Autor Share Postado Dezembro 15, 2016 (editado) ok logo Postarei as Gifs Editado Dezembro 15, 2016 por zude96 Link para o comentário Compartilhar em outros sites More sharing options...
Tangela 0 Postado Dezembro 17, 2016 Share Postado Dezembro 17, 2016 Em 14/12/2016 at 23:36, zude96 disse: Eae Galera Do Xtibia Bom Esse é o Meu Primeiro Post De Um Conteudo Pra Vocês Bom, Como Esse Sistema Funciona ? O Player Vai Digitar o Comando !fly e em Seguinda ele Fala Fly up Pra Subir Pra Descer é o Fly Down Vá em Data/lib e Crie um Arquivo Chamando 075-fly.lua e Cole Isso Dentro Mostrar conteúdo oculto FLY_STORAGE = getConfigValue("flyStorage")flyBlackSQM = falsenonFlyableBorder = {7576, 7577}changeSpeed = trueflySpeed = 800waterSpeed = 150ITEM_FLYTILE = 460ITEM_WATERTILE = 4625FLY_OUTFIT = {lookType = 239, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}WATER = {4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619}RANGEX = 1RANGEY = 1 ret ={"You are now flying.","You are not flying anymore.","You cannot stop flying here.","You are not flying.","You cannot up here.","You cannot down here.","You cannot go to there."}storPos = {x = 1200, y = 1201, z = 1202}function isWalkable(pos, creature, proj, pz)if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false endif getTopCreature(pos).uid > 0 and creature then return false endif getTileInfo(pos).protection and pz then return false, true endlocal n = not proj and 3 or 2for i = 0, 255 dopos.stackpos = ilocal tile = getTileThingByPos(pos)if tile.itemid ~= 0 and not isCreature(tile.uid) thenif hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) thenreturn falseendendendreturn trueendfunction getAreaToRemove(pos1, pos2)local t = getDirectionTo(pos1, pos2)local pos ={[0] ={{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[2] ={{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z}},[1] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[3] ={{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}},[7] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}},[6] = {{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y + 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z}},[5] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x - 1, y = pos1.y, z = pos1.z},{x = pos1.x - 1, y = pos1.y + 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z}},[4] ={{x = pos1.x - 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y - 1, z = pos1.z},{x = pos1.x + 1, y = pos1.y, z = pos1.z},{x = pos1.x + 1, y = pos1.y + 1, z = pos1.z}}}return pos[t]endfunction doCreateTile(pos)doAreaCombatHealth(0, 0, pos, 0, 0, 0, 255)end Agora Vá em Data/Talkactions e Crie Um Arquivo Chamado fly.lua e Cole Isso Dentro Mostrar conteúdo oculto function onSay(cid, words, param)local pos = getCreaturePosition(cid)pos.stackpos = 0if(words == "!fly") thenif getCreatureStorage(cid, FLY_STORAGE) > 0 thenif not isWalkable(getCreaturePosition(cid)) or getThingFromPos(pos).itemid == ITEM_FLYTILE or getThingFromPos(pos).itemid == ITEM_WATERTILE thendoPlayerSendCancel(cid, ret[3])return trueenddoChangeSpeed(cid, -getCreatureSpeed(cid) + getCreatureBaseSpeed(cid))doCreatureSetStorage(cid, FLY_STORAGE, 0)doRemoveCondition(cid, CONDITION_OUTFIT)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ret[2])return trueelsedoCreatureSetStorage(cid, FLY_STORAGE, 1)doRemoveConditions(cid, true)doSetCreatureOutfit(cid, FLY_OUTFIT, -1)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, ret[1])if changeSpeed thendoChangeSpeed(cid, flySpeed)endreturn trueendelseif(words == "fly") thenif param == "up" thenpos.z = pos.z - 1doCreateTile(pos)if getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])return trueendif(getCreaturePosition(cid).z == 0) or (getThingFromPos(pos).itemid ~= ITEM_FLYTILE and getThingFromPos(pos).itemid > 0) or (getTileInfo(pos).house) thendoPlayerSendCancel(cid, ret[5])return trueendlocal tpos = postpos.stackpos = 253if isCreature(getThingFromPos(tpos).uid) thendoPlayerSendCancel(cid, ret[5])return trueendlocal toCreate = {}for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 thentable.insert(toCreate, area)endendif getThingFromPos(pos).itemid < 1 thenfor _, create in ipairs(toCreate) docreate.stackpos = 0doCreateItem(ITEM_FLYTILE, 1, create)enddoTeleportThing(cid, pos)if changeSpeed thendoChangeSpeed(cid, flySpeed)endpos.z = pos.z + 1doSendMagicEffect(pos, CONST_ME_BLOCKHIT)for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endendelsedoPlayerSendCancel(cid, ret[7])endelseif param == "down" thenpos.z = pos.z + 1doCreateTile(pos)if getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])return trueendif getCreaturePosition(cid).z == 14 thendoPlayerSendCancel(cid, ret[6])return trueendif(getTileInfo(pos).house) thendoPlayerSendCancel(cid, ret[6])return trueendlocal cpos = getCreaturePosition(cid)cpos.stackpos = 0if getThingFromPos(cpos).itemid ~= ITEM_FLYTILE thendoPlayerSendCancel(cid, ret[6])return trueendlocal tpos = postpos.stackpos = 253if isCreature(getThingFromPos(tpos).uid) thendoPlayerSendCancel(cid, ret[6])return trueendlocal toCreate = {}for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area) local thing = getThingFromPos(area)if(thing.itemid < 1 or isInArray(WATER, thing.itemid)) thentable.insert(toCreate, area) endendlocal x = falseif isWalkable(pos) or getThingFromPos(pos).itemid < 1 or isInArray(WATER, getThingFromPos(pos).itemid) thenfor _, create in ipairs(toCreate) doif isInArray(WATER, getThingFromPos(create).itemid) thendoTransformItem(getThingFromPos(create).uid, ITEM_WATERTILE)x = (create.z == pos.z and true or false)elsedoCreateItem(ITEM_FLYTILE, 1, create)endenddoTeleportThing(cid, pos)doSendMagicEffect(pos, (x and CONST_ME_WATERSPLASH or getThingFromPos(pos).itemid == ITEM_WATERTILE and CONST_ME_WATERSPLASH or CONST_ME_NONE))if changeSpeed thendoChangeSpeed(cid, (x and (-getCreatureSpeed(cid) + waterSpeed + getCreatureBaseSpeed(cid)) or (-getCreatureSpeed(cid) + flySpeed + getCreatureBaseSpeed(cid))))endpos.z = pos.z - 1doSendMagicEffect(pos, CONST_ME_BLOCKHIT)for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dolocal thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)endendelsedoPlayerSendCancel(cid, ret[7])endendendreturn trueend Agora Vá em Data/Movements/Scripts e Crie um Arquivo Chamado fly.lua e Cole Isso Dentro Mostrar conteúdo oculto function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)if isInArray({ITEM_FLYTILE, ITEM_WATERTILE}, item.itemid) thenif not isPlayer(cid) thendoTeleportThing(cid, fromPosition)return trueendif getCreatureStorage(cid, FLY_STORAGE) < 1 thendoPlayerSendCancel(cid, ret[4])doTeleportThing(cid, fromPosition)return trueend local toPos = toPositiontoPos.stackpos = 0if not flyBlackSQM thentoPos.z = 7doCreateTile(toPos)if getThingFromPos(toPos).itemid < 1 or getThingFromPos(toPos).itemid == ITEM_FLYTILE thendoTeleportThing(cid, fromPosition)return trueendtoPos.z = toPosition.zendif(getTileInfo(toPos).house) thendoTeleportThing(cid, fromPosition)return trueendif nonFlyableBorder and type(nonFlyableBorder) == "table" thenfor i = toPos.z, 14 dotoPos.z = itoPos.stackpos = 1doCreateTile(toPos)if isInArray(nonFlyableBorder, getThingFromPos(toPos).itemid) thendoTeleportThing(cid, fromPosition)return trueendendtoPos.z = getCreaturePosition(cid).ztoPos.stackpos = 0endfor _, area in ipairs(getArea(toPos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 or thing.itemid == ITEM_FLYTILE thendoCreateItem(ITEM_FLYTILE, 1, area)elseif thing.itemid == ITEM_WATERTILE or isInArray(WATER, thing.itemid) thendoTransformItem(thing.uid, ITEM_WATERTILE)endendendreturn trueendfunction onStepOut(cid, item, position, lastPosition, fromPosition, toPosition, actor)local area = getAreaToRemove(fromPosition, toPosition)for _, arear in ipairs(area) dodoCreateTile(arear)local thing = getThingFromPos(arear)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endendreturn trueend feito Isso Vá em Data/creaturescripts/scripts/ e vá no login.lua e coloque essa Função Mostrar conteúdo oculto function onLogin(cid)if getCreatureStorage(cid, FLY_STORAGE) > 0 thenlocal storpos = {x = getCreatureStorage(cid, storPos.x), y = getCreatureStorage(cid, storPos.y), z = getCreatureStorage(cid, storPos.z), stackpos = 0}doCreateTile(storpos)local thing = getThingFromPos(storpos)if thing.itemid < 1 or isInArray(WATER, thing.itemid) thenfor _, area in ipairs(getArea(storpos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid < 1 thendoCreateItem(ITEM_FLYTILE, 1, area)elseif isInArray(WATER, getThingFromPos(area).itemid) thendoTransformItem(getThingFromPos(area).uid, ITEM_WATERTILE)endendenddoRemoveConditions(cid, true)doSetCreatureOutfit(cid, FLY_OUTFIT, -1)doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You are now flying.")doTeleportThing(cid, storpos)return trueendend e Essa Aqui Tambem Mostrar conteúdo oculto registerCreatureEvent(cid, "PlayerLogout") Agora Crie Um Arquivo No CreatureScripts Com O Nome De logout.lua e Cole Isso Dentro Mostrar conteúdo oculto function onLogout(cid)if getCreatureStorage(cid, FLY_STORAGE) > 0 thenlocal pos = getCreaturePosition(cid)pos.stackpos = 0for _, area in ipairs(getArea(pos, RANGEX, RANGEY)) dodoCreateTile(area)local thing = getThingFromPos(area)if thing.itemid == ITEM_FLYTILE thendoRemoveItem(thing.uid)elseif thing.itemid == ITEM_WATERTILE thendoTransformItem(thing.uid, WATER[1])endenddoCreatureSetStorage(cid, storPos.x, pos.x)doCreatureSetStorage(cid, storPos.y, pos.y)doCreatureSetStorage(cid, storPos.z, pos.z)endreturn trueend Agora Vá no Talkactions.xml e Cole Isso Dentro Mostrar conteúdo oculto <talkaction words="!fly;fly" case-sensitive="no" event="script" value="fly.lua"/> Em Seguida Vá no Movements.xml e Cole Isso Dentro Mostrar conteúdo oculto <movevent type="StepIn" itemid="460" event="script" value="fly.lua"/><movevent type="StepOut" itemid="460" event="script" value="fly.lua"/><movevent type="StepIn" itemid="4609-4619" event="script" value="fly.lua"/><movevent type="StepIn" itemid="4625" event="script" value="fly.lua"/> Agora em creaturescripts.xml e Cole isso Mostrar conteúdo oculto <event type="logout" name="PlayerLogout" event="script" value="logout.lua"/> Agora o Trabalho Vai Ser Nas Sources Vá no game.cpp e Procure Por Essa Função Mostrar conteúdo oculto bool Game::combatBlockHit(CombatType_t combatType, Creature* attacker, Creature* target,int32_t& healthChange, bool checkDefense, bool checkArmor) Substitua Por Essa Mostrar conteúdo oculto bool Game::combatBlockHit(CombatType_t combatType, Creature* attacker, Creature* target,int32_t& healthChange, bool checkDefense, bool checkArmor){if(healthChange > 0)return false;const Position& targetPos = target->getPosition();const SpectatorVec& list = getSpectators(targetPos);if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR){std::string value;MagicEffect_t eff = MAGIC_EFFECT_POFF;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)eff = MAGIC_EFFECT_NONE; addMagicEffect(list, targetPos, eff, target->isGhost());return true;}int32_t damage = -healthChange;BlockType_t blockType = target->blockHit(attacker, combatType, damage, checkDefense, checkArmor);healthChange = -damage;if(blockType == BLOCK_DEFENSE){addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF);return true;}else if(blockType == BLOCK_ARMOR){addMagicEffect(list, targetPos, MAGIC_EFFECT_BLOCKHIT);return true;}else if(blockType != BLOCK_IMMUNITY)return false;MagicEffect_t effect = MAGIC_EFFECT_NONE;switch(combatType){case COMBAT_UNDEFINEDDAMAGE:break;case COMBAT_ENERGYDAMAGE:case COMBAT_FIREDAMAGE:case COMBAT_PHYSICALDAMAGE:case COMBAT_ICEDAMAGE:case COMBAT_DEATHDAMAGE:case COMBAT_EARTHDAMAGE:case COMBAT_HOLYDAMAGE:{effect = MAGIC_EFFECT_BLOCKHIT;break;}default:{effect = MAGIC_EFFECT_POFF;std::string value;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)effect = MAGIC_EFFECT_NONE;break;}}addMagicEffect(list, targetPos, effect);return true;} Ainda em game.cpp Procure por Essa Função Mostrar conteúdo oculto bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange,MagicEffect_t hitEffect/* = MAGIC_EFFECT_UNKNOWN*/, TextColor_t hitColor/* = TEXTCOLOR_UNKNOWN*/, bool force/* = false*/) e Substitua Por Essa Mostrar conteúdo oculto bool Game::combatChangeHealth(CombatType_t combatType, Creature* attacker, Creature* target, int32_t healthChange,MagicEffect_t hitEffect/* = MAGIC_EFFECT_UNKNOWN*/, TextColor_t hitColor/* = TEXTCOLOR_UNKNOWN*/, bool force/* = false*/){const Position& targetPos = target->getPosition();if(healthChange > 0){if(!force && target->getHealth() <= 0)return false;bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_HEALTHGAIN, combatType, healthChange))deny = true;}if(deny)return false;target->gainHealth(attacker, healthChange);if(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE) && !target->isGhost() &&(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE_MONSTER) || !target->getMonster())){char buffer[20];sprintf(buffer, "+%d", healthChange);const SpectatorVec& list = getSpectators(targetPos);if(combatType != COMBAT_HEALING)addMagicEffect(list, targetPos, MAGIC_EFFECT_WRAPS_BLUE);addAnimatedText(list, targetPos, TEXTCOLOR_GREEN, buffer);}}else{const SpectatorVec& list = getSpectators(targetPos);if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR){std::string value;MagicEffect_t eff = MAGIC_EFFECT_POFF;if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0)eff = MAGIC_EFFECT_NONE;addMagicEffect(list, targetPos, eff);return true;}int32_t damage = -healthChange;if(damage != 0){if(target->hasCondition(CONDITION_MANASHIELD) && combatType != COMBAT_UNDEFINEDDAMAGE){int32_t manaDamage = std::min(target->getMana(), damage);damage = std::max((int32_t)0, damage - manaDamage);if(manaDamage != 0){bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANALOSS, combatType, manaDamage))deny = true;}if(deny)return false;target->drainMana(attacker, combatType, manaDamage);char buffer[20];sprintf(buffer, "%d", manaDamage);addMagicEffect(list, targetPos, MAGIC_EFFECT_LOSE_ENERGY);addAnimatedText(list, targetPos, TEXTCOLOR_BLUE, buffer);}}damage = std::min(target->getHealth(), damage);if(damage > 0){bool deny = false;CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE);for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it){if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_HEALTHLOSS, combatType, damage))deny = true;}if(deny)return false;target->drainHealth(attacker, combatType, damage);addCreatureHealth(list, target);TextColor_t textColor = TEXTCOLOR_NONE;MagicEffect_t magicEffect = MAGIC_EFFECT_NONE;switch(combatType){case COMBAT_PHYSICALDAMAGE:{Item* splash = NULL;switch(target->getRace()){case RACE_VENOM:textColor = TEXTCOLOR_LIGHTGREEN;magicEffect = MAGIC_EFFECT_POISON;splash = Item::CreateItem(ITEM_SMALLSPLASH, FLUID_GREEN);break;case RACE_BLOOD:textColor = TEXTCOLOR_RED;magicEffect = MAGIC_EFFECT_DRAW_BLOOD;splash = Item::CreateItem(ITEM_SMALLSPLASH, FLUID_BLOOD);break;case RACE_UNDEAD:textColor = TEXTCOLOR_GREY;magicEffect = MAGIC_EFFECT_HIT_AREA;break;case RACE_FIRE:textColor = TEXTCOLOR_ORANGE;magicEffect = MAGIC_EFFECT_DRAW_BLOOD;break;case RACE_ENERGY:textColor = TEXTCOLOR_PURPLE;magicEffect = MAGIC_EFFECT_PURPLEENERGY;break;default:break;}if(splash){internalAddItem(NULL, target->getTile(), splash, INDEX_WHEREEVER, FLAG_NOLIMIT);startDecay(splash);}break;}case COMBAT_ENERGYDAMAGE:{textColor = TEXTCOLOR_PURPLE;magicEffect = MAGIC_EFFECT_ENERGY_DAMAGE;break;}case COMBAT_EARTHDAMAGE:{textColor = TEXTCOLOR_LIGHTGREEN;magicEffect = MAGIC_EFFECT_POISON_RINGS;break;}case COMBAT_DROWNDAMAGE:{textColor = TEXTCOLOR_LIGHTBLUE;magicEffect = MAGIC_EFFECT_LOSE_ENERGY;break;}case COMBAT_FIREDAMAGE:{textColor = TEXTCOLOR_ORANGE;magicEffect = MAGIC_EFFECT_HITBY_FIRE;break;}case COMBAT_ICEDAMAGE:{textColor = TEXTCOLOR_TEAL;magicEffect = MAGIC_EFFECT_ICEATTACK;break;}case COMBAT_HOLYDAMAGE:{textColor = TEXTCOLOR_YELLOW;magicEffect = MAGIC_EFFECT_HOLYDAMAGE;break;}case COMBAT_DEATHDAMAGE:{textColor = TEXTCOLOR_DARKRED;magicEffect = MAGIC_EFFECT_SMALLCLOUDS;break;}case COMBAT_LIFEDRAIN:{textColor = TEXTCOLOR_RED;magicEffect = MAGIC_EFFECT_WRAPS_RED;break;}default:break;}if(hitEffect != MAGIC_EFFECT_UNKNOWN)magicEffect = hitEffect;if(hitColor != TEXTCOLOR_UNKNOWN)textColor = hitColor;if(textColor < TEXTCOLOR_NONE && magicEffect < MAGIC_EFFECT_NONE){char buffer[20];sprintf(buffer, "%d", damage);addMagicEffect(list, targetPos, magicEffect);addAnimatedText(list, targetPos, textColor, buffer);}}}}return true;} Agora Procure Por Essa Função Mostrar conteúdo oculto bool Game::combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange) Substitua Por Essa Mostrar conteúdo oculto bool Game::combatChangeMana(Creature* attacker, Creature* target, int32_t manaChange) { const Position& targetPos = target->getPosition(); if(manaChange > 0) { bool deny = false; CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE); for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it) { if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANAGAIN, COMBAT_HEALING, manaChange)) deny = true; } if(deny) return false; target->changeMana(manaChange); if(g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE) && !target->isGhost() && (g_config.getBool(ConfigManager::SHOW_HEALING_DAMAGE_MONSTER) || !target->getMonster())) { char buffer[20]; sprintf(buffer, "+%d", manaChange); const SpectatorVec& list = getSpectators(targetPos); addAnimatedText(list, targetPos, TEXTCOLOR_DARKPURPLE, buffer); } } else { const SpectatorVec& list = getSpectators(targetPos); if(!target->isAttackable() || Combat::canDoCombat(attacker, target) != RET_NOERROR) { std::string value; MagicEffect_t eff = MAGIC_EFFECT_POFF; if(target->getStorage(g_config.getNumber(ConfigManager::FLY_STORAGE), value) && atoi(value.c_str()) > 0) eff = MAGIC_EFFECT_NONE; addMagicEffect(list, targetPos, eff); return false; } int32_t manaLoss = std::min(target->getMana(), -manaChange); BlockType_t blockType = target->blockHit(attacker, COMBAT_MANADRAIN, manaLoss); if(blockType != BLOCK_NONE) { addMagicEffect(list, targetPos, MAGIC_EFFECT_POFF); return false; } if(manaLoss > 0) { bool deny = false; CreatureEventList statsChangeEvents = target->getCreatureEvents(CREATURE_EVENT_STATSCHANGE); for(CreatureEventList::iterator it = statsChangeEvents.begin(); it != statsChangeEvents.end(); ++it) { if(!(*it)->executeStatsChange(target, attacker, STATSCHANGE_MANALOSS, COMBAT_UNDEFINEDDAMAGE, manaChange)) deny = true; } if(deny) return false; target->drainMana(attacker, COMBAT_MANADRAIN, manaLoss); char buffer[20]; sprintf(buffer, "%d", manaLoss); addAnimatedText(list, targetPos, TEXTCOLOR_BLUE, buffer); } } return true; } Agora vá em configmanager.cpp e procure por essa Função Mostrar conteúdo oculto m_confBool[ADDONS_PREMIUM] = getGlobalBool("addonsOnlyPremium", true); e em baixo dela Adicione iSSO Mostrar conteúdo oculto m_confNumber[FLY_STORAGE] = getGlobalNumber("flyStorage", 0); Agora Vá em configmanager.h e Procure por Essa Função Mostrar conteúdo oculto HOUSE_CLEAN_OLD e em baixo dela Adicione Isso Mostrar conteúdo oculto FLY_STORAGE, E Pra Terminar Adicione Essa Storage no Config.lua Mostrar conteúdo oculto flyStorage = 65535 Como esse Foi Meu Primeiro Post Então Não Tenho Muita Experiencia Aqui, Não Consegui por o Gif, Mais Vou Por Link Das Imagens Do Fly up e Down Ocultar conteúdo http://prnt.sc/djl4vt http://prnt.sc/djl55x http://prnt.sc/djl57w http://prnt.sc/djl5m0 http://prnt.sc/djl5ma Pra Configurar a Outfit Que Fica após vc digitar o Comando !fly, Vá em Data/lib 075-fly.lua e altere Nessa Linha Ocultar conteúdo FLY_OUTFIT = {lookType = 239, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0} Creditos: Otland.net Darkhaos Me explica 1 coisa q não entendi todos personagems vão tar com o msm newtype no fly? Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados