Vodkart 1515 Postado Junho 25, 2012 Share Postado Junho 25, 2012 (editado) Explicação: É o sistema de casamento conhecido, porém foi reformulado para funcionar em versões mais recentes. Descrição: O sistema conta com: Item: Os jogadores que se casar receberão um Wedding ring com seus nomes e data do casamento. Outfit: jogadores que se casam recebem outfit, caso se divorciem, perder as outfits. Look: o look mostra com quem é casado Combate: Os jogador não pode atacar seu patner Comandos: /marriage info -- mostra em uma janela o preço do casamento/divórcio e o level minimo para casar. /marriage status -- mostra com quem é casado e a data do casamento Outra coisa bem importante é que os dois jogadores NÃO precisam estar online para se divorciarem, exemplo: JOÃO e casado com MARIA, JOÃO vai até o npc e paga um preço para de divorciar, só quem pede o divorcio que paga a taxa, logo MARIA não precisa pagar nada pois seu Ex-Patner JOÃO já pagou. O que ela precisa fazer é "assinar" com o npc o seu divorcio também. Como casar? Player1: Player2: Na sua db execute: CREATE TABLE marriage_system ( id INTEGER NOT NULL, player_id INTEGER NOT NULL, partner VARCHAR( 255 ) NOT NULL, marriage_date INTEGER NOT NULL, PRIMARY KEY ( id ) ); Caso você ter a outfit Husband e Wife(de casamento) no seu servidor abra o spoiler: vá na pasta Data > Xml > outfits.xml e adicione isso na outfit: quest="150420" ficando assim: <outfit id="23" quest="150420"> <list gender="0" lookType="329" name="Wife"/> <list gender="1" lookType="328" name="Husband"/> </outfit> Mods: MarriageSystem.xml <?xml version="1.0" encoding="UTF-8"?> <mod name="MarriageSystem" version="1.0" author="Vodkart" contact="xtibia.com" enabled="yes"> <config name="marry_func"><![CDATA[ marry_config = { OnlyDifferentSex = false, Marry_Price = 300000, Divorce_Price = 100000, Level = 50, MaxSqm = 7, -- to marry Text = {'I love you!','My love!','Baby dear!'}, RingID = 10502, TimeAccept = 30, storage1 = 300235, storage2 = 300236, storage3 = 300237 } function isMarried(cid) local m = db.getResult("SELECT `player_id` FROM `marriage_system` WHERE `player_id` = '"..getPlayerGUID(cid).."';") if(m:getID() == -1) then local e = db.getResult("SELECT `partner` FROM `marriage_system` WHERE `partner` = '"..getPlayerGUID(cid).."';") if(e:getID() == -1) then return false end end return true end function isPatner(cid) local p = db.getResult("SELECT `partner` FROM `marriage_system` WHERE `player_id` = '"..getPlayerGUID(cid).."';") if(p:getID() == -1) then return true end return false end function Ponline(player) local rows = db.getResult("SELECT `online` FROM `players` WHERE `id` = " .. player .. ";") local on = rows:getDataInt("online") if on ~= 0 then return TRUE else return FALSE end end function getPartner(cid) if isPatner(cid) then a = db.getResult("SELECT `player_id` FROM `marriage_system` WHERE `partner` = '"..getPlayerGUID(cid).."';") b = "player_id" else a = db.getResult("SELECT `partner` FROM `marriage_system` WHERE `player_id` = '"..getPlayerGUID(cid).."';") b = "partner" end local query = a return getPlayerNameByGUID(query:getDataString(b)) end function doMarry(cid, patner) return db.executeQuery("INSERT INTO `marriage_system` (`player_id`, `partner`, `marriage_date`) VALUES ('".. getPlayerGUID(cid) .."', '"..patner.."', '".. os.time() .."');") end function doDivorcePlayer(cid) if isPatner(cid) then pid,player = getPlayerGUIDByName(getPartner(cid)),getPlayerByNameWildcard(getPartner(cid)) else pid,player = getPlayerGUID(cid),cid end return db.executeQuery("DELETE FROM `marriage_system` WHERE `player_id` = '" .. pid .. "';") end function getMarryDate(cid) local player = isPatner(cid) and getPlayerGUIDByName(getPartner(cid)) or getPlayerGUID(cid) local date = db.getResult("SELECT `marriage_date` FROM `marriage_system` WHERE `player_id` = '"..player.."';") return os.date("%d %B %Y %X ", date:getDataInt("marriage_date")) end ]]></config> <talkaction words="/marriage;!marriage" event="buffer"><![CDATA[ domodlib('marry_func') param = string.lower(param) if (param == "") then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"invalid command, for more information enter !marriage info") elseif(param == "info") then doShowTextDialog(cid,2160,"Marriage Info:\n\nLevel Minimum: "..marry_config.Level.."\nMarriage Cost: "..marry_config.Marry_Price.."\nDivorce Cost: "..marry_config.Divorce_Price.."\n\nMarried Players have a special buffs as a wedding gift given by the union\n\nThis bonus is only given if the married players are nearby.") elseif(param == "status") then doPlayerPopupFYI(cid,""..(isMarried(cid) and "Marriage Status".."\n\nMarried with: ["..getPartner(cid).."]\n\nThe date of his marriage was: "..getMarryDate(cid).."" or "you are not married").."") end return true ]]></talkaction> <event type="login" name="MarryRegister" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "MarryLook") registerCreatureEvent(cid, "MarryNoAttack") return true end]]></event> <event type="look" name="MarryLook" event="script"><![CDATA[ domodlib('marry_func') function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and isMarried(thing.uid) then doPlayerSetSpecialDescription(thing.uid,'.\n'..(getPlayerSex(thing.uid) == 0 and 'She' or 'He')..' is married to '..getPartner(thing.uid)) end return true end]]></event> <event type="combat" name="MarryNoAttack" event="script"><![CDATA[ domodlib('marry_func') if isPlayer(cid) and isPlayer(target) and isMarried(cid) and isMarried(target) then if (getCreatureName(target) == getPartner(cid))then doPlayerSendCancel(cid, "You may not attack this player.") return false end end return true ]]></event> </mod> Npc: Em Npc/Data Celest.xml <?xml version="1.0"?> <npc name="Celest" script="data/npc/scripts/marriagesystem.lua" walkinterval="50000" floorchange="0"> <health now="1000" max="1000"/> <look type="130" head="0" body="114" legs="114" feet="0" addons="0"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. You can {marriage} or may {divorce}."/> </parameters> </npc> Npc/Data/Script marriagesystem.lua domodlib('marry_func') local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid msg,players = string.lower(msg), {getPlayerGUID(cid)} if msgcontains(msg, 'marry') or msgcontains(msg, 'marriage') then if isMarried(cid) then npcHandler:say("Sorry, You already is wedded.", cid) elseif getPlayerStorageValue(cid, marry_config.storage3) >= 1 then npcHandler:say("you must sign the {divorce}.", cid) elseif getPlayerStorageValue(cid, marry_config.storage1) >= os.time() then local pid = getPlayerStorageValue(cid, marry_config.storage2) npcHandler:say(getPlayerNameByGUID(pid).." has set a wedding date with you. Do you want to {proceed} or {cancel} the wedding?", cid) talkState[talkUser] = 2 else npcHandler:say("Would you like to get married?", cid) talkState[talkUser] = 1 end elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then npcHandler:say("And what\'s the name of your future partner?", cid) talkState[talkUser] = 3 elseif talkState[talkUser] == 3 then local player = getPlayerByNameWildcard(msg) if(not player)then npcHandler:say(msg.." is offline or does not exist.", cid) return true elseif isMarried(player) then npcHandler:say("He already is wedded.", cid) return true elseif getPlayerStorageValue(cid, marry_config.storage3) >= 1 or getPlayerStorageValue(player, marry_config.storage3) >= 1 then npcHandler:say((getPlayerStorageValue(cid, marry_config.storage1) >= 1 and "You" or "He").." must sign the divorce.", cid) return true elseif getPlayerLevel(cid) < marry_config.Level or getPlayerLevel(player) < marry_config.Level then npcHandler:say("players must to be level "..marry_config.Level, cid) return true elseif getPlayerStorageValue(player, marry_config.storage1) >= os.time() then npcHandler:say(msg.." already have a wedding invitation, wait.", cid) return true elseif getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(player)) > marry_config.MaxSqm then npcHandler:say("you are far away from each other to get married.", cid) return true elseif marry_config.OnlyDifferentSex and getPlayerSex(cid) == getPlayerSex(player) then npcHandler:say("you can only marry the opposite sex", cid) return true elseif not doPlayerRemoveMoney(cid, marry_config.Marry_Price) then npcHandler:say("Sorry, but you do not have "..marry_config.Marry_Price.." gp(s) to ask "..msg.." in marriage.", cid) return true end setPlayerStorageValue(player, marry_config.storage1,os.time()+marry_config.TimeAccept) setPlayerStorageValue(player, marry_config.storage2, getPlayerGUID(cid)) npcHandler:say("you asked "..msg.." in marriage, wait a answer!", cid) doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(cid).." asked you in marriage.") talkState[talkUser] = 0 elseif msgcontains(msg, "proceed") and talkState[talkUser] == 2 then player = getPlayerStorageValue(cid, marry_config.storage2) if getPlayerStorageValue(cid, marry_config.storage1) >= os.time() then if not isMarried(cid) then if Ponline(player) then x = getPlayerByNameWildcard(getPlayerNameByGUID(player)) if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(x)) <= marry_config.MaxSqm then table.insert(players, player) doMarry(cid, player) for i = 1, #players do local ring = doPlayerAddItem(getPlayerByNameWildcard(getPlayerNameByGUID(players[i])), marry_config.RingID, 1) doItemSetAttribute(ring, "description", getCreatureName(cid) .. " & " .. getPartner(cid) .. " forever - married on " ..getMarryDate(cid).. ".") doCreatureSay(getPlayerByNameWildcard(getPlayerNameByGUID(players[i])), marry_config.Text[math.random(1,#marry_config.Text)], TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(getPlayerByNameWildcard(getPlayerNameByGUID(players[i]))), 35) setPlayerStorageValue(getPlayerByNameWildcard(getPlayerNameByGUID(players[i])), marry_config.storage3, 1) setPlayerStorageValue(getPlayerByNameWildcard(getPlayerNameByGUID(players[i])), 150420, 1) end npcHandler:say("Congratulations! Now you may kiss your partner! to see the status of marriage enter !marriage status", cid) talkState[talkUser] = 0 else npcHandler:say("you're far away from her suitor.", cid) end else npcHandler:say("suitor offline.", cid) end else npcHandler:say("you are not married.", cid) talkState[talkUser] = 0 end else npcHandler:say("you do not received none wedding invitation.", cid) talkState[talkUser] = 0 end elseif msgcontains(msg, "cancel") and talkState[talkUser] == 2 then player = getPlayerStorageValue(cid, marry_config.storage2) if getPlayerStorageValue(cid, marry_config.storage1) >= os.time() then if not isMarried(cid) then setPlayerStorageValue(cid, marry_config.storage1, -1) npcHandler:say("You just refuse the wedding invitation from player "..getPlayerNameByGUID(player), cid) if Ponline(player) then doPlayerSendTextMessage(getPlayerByNameWildcard(getPlayerNameByGUID(player)), MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(cid).." rejected his marriage proposal.") end else npcHandler:say("you are already married.", cid) talkState[talkUser] = 0 end else npcHandler:say("you do not received none wedding invitation.", cid) talkState[talkUser] = 0 end elseif msgcontains(msg, "divorce") then if isMarried(cid) then npcHandler:say("Would you like to divorce of your partner for "..marry_config.Divorce_Price.." gp(s) ? {yes}", cid) talkState[talkUser] = 6 elseif getPlayerStorageValue(cid, marry_config.storage3) >= 1 then npcHandler:say("you must sign here to end your marriage, ok? {yes}", cid) talkState[talkUser] = 7 else npcHandler:say("you are not married", cid) talkState[talkUser] = 0 end elseif msgcontains(msg, "yes") and talkState[talkUser] == 6 then if isMarried(cid) then if doPlayerRemoveMoney(cid, marry_config.Divorce_Price) then npcHandler:say("Congratulations, you end up divorcing from player: "..getPartner(cid), cid) setPlayerStorageValue(cid, 150420, -1) setPlayerStorageValue(cid, marry_config.storage3, -1) pguid = getPlayerGUIDByName(getPartner(cid)) if Ponline(pguid) then setPlayerStorageValue(getPlayerByNameWildcard(getPlayerNameByGUID(pguid)), 150420, -1) else db.executeQuery("DELETE FROM `player_storage` WHERE `player_id` = " .. pguid .. " AND `key` = 150420;") end doDivorcePlayer(cid) else npcHandler:say("Sorry, you do not have "..marry_config.Divorce_Price.." gp(s).", cid) end else npcHandler:say("you are not married.", cid) end elseif msgcontains(msg, "yes") and talkState[talkUser] == 7 then npcHandler:say("Congratulations, you end up divorcing.", cid) setPlayerStorageValue(cid, marry_config.storage3, -1) elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("tudo bem então.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Configuração: marry_config = {OnlyDifferentSex = false, -- se precisa ser do sexo oposto Marry_Price = 300000, -- qnto vai custar o pedido de casamento Divorce_Price = 100000, -- quanto vai custar o divórcio Level = 50, -- que level precisa ser para casar MaxSqm = 7, -- aqui é quantos sqm eles precisam estar perto um do outro para se casar Text = {'I love you!','My love!','Baby dear!'}, -- frases que vão sair ao se casar RingID = 10502, -- ring que receberão ao se casar TimeAccept = 30, -- tempo que o jogador tem para aceitar o pedido de casamento storage1 = 300235, -- n mexa storage2 = 300236, -- n mexa storage3 = 300237 -- n mexa } Editado Junho 25, 2012 por Vodkart Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/ Compartilhar em outros sites More sharing options...
joao33 29 Postado Junho 27, 2012 Share Postado Junho 27, 2012 Vodkart muito bom o sistema Eu uso esse aqui: http://www.xtibia.com/forum/topic/186117-new-marriage-system/ Bom ele é quase = ao seu + é por talkactions e tipow vc pode ir upando seu casamento e ganha exp extra dependendo do level do casamento. Bom pq eu to postando aqui? teria como você da 1 olhada no script e fazer algum sistema sei la quando a pessoa se casar ganhar o outfit ou alguma quest que ganhe ele ou comprar do npc ( apenas para quem for casado) Obrigado Caso nao tenha gostado do link acima ( talvez possa prejudicar seu tutorial n sei) me manda pm que eu retiro Obrigado novamente Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1285567 Compartilhar em outros sites More sharing options...
darkeagleot 3 Postado Junho 29, 2012 Share Postado Junho 29, 2012 Legal, mas onde eu coloco a configuração ? Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286220 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Junho 29, 2012 Autor Share Postado Junho 29, 2012 Legal, mas onde eu coloco a configuração ? a configuração está em MODS ali eu só estava explicando oq cada linha faz Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286233 Compartilhar em outros sites More sharing options...
darkeagleot 3 Postado Junho 29, 2012 Share Postado Junho 29, 2012 No meu não esta funcionando... nao sei pq Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286239 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Junho 29, 2012 Autor Share Postado Junho 29, 2012 erros? seu server é linux? Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286240 Compartilhar em outros sites More sharing options...
darkeagleot 3 Postado Junho 29, 2012 Share Postado Junho 29, 2012 Não, ele inicia normalmente mas quando eu vou aonde era pra ter o NPC (eu coloquei pelo REMERES) ele não está la Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286242 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Junho 29, 2012 Autor Share Postado Junho 29, 2012 eu não entendo de mapper mais tenta da /n celest e ve se o npc aparece Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286246 Compartilhar em outros sites More sharing options...
KUNGLOW 14 Postado Junho 29, 2012 Share Postado Junho 29, 2012 (editado) VodKart esse npc tem fazer os players casar pagando em vez de dinheiro removendo um item? @ EDIT Não funcionou o NPC pergunta o nome do player eu falo e nada acontece. (estou do lado do player) Editado Junho 29, 2012 por KUNGLOW Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286251 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Junho 29, 2012 Autor Share Postado Junho 29, 2012 VodKart esse npc tem fazer os players casar pagando em vez de dinheiro removendo um item? @ EDIT Não funcionou o NPC pergunta o nome do player eu falo e nada acontece. (estou do lado do player) Acho que você não soube instalar, em servidores linux acho que não funciona mesmo. Seu eu abrir aqui 10 servidores de 8.6 a 9.1, eu tenho certeza que vai funcionar porque eu já testei em diferentes servers. Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286390 Compartilhar em outros sites More sharing options...
joao33 29 Postado Junho 30, 2012 Share Postado Junho 30, 2012 Vodkart ve la o topico do otro marriage system plx? eu deixei 1 mensagem la do negocio do outfit quando o player descasa ele fica com o outfit ainda vlw Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286520 Compartilhar em outros sites More sharing options...
darkeagleot 3 Postado Junho 30, 2012 Share Postado Junho 30, 2012 acho que o erro ta na DB, como eu coloco esse codigo na db ? Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286617 Compartilhar em outros sites More sharing options...
Mulizeu 86 Postado Julho 1, 2012 Share Postado Julho 1, 2012 (editado) Vlw por me dizer q ia postar! Brincadeira minha nega =] bacana msm, gostei =] deu um upgrade! Editado Julho 1, 2012 por mulizeu Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1286841 Compartilhar em outros sites More sharing options...
RHCP 24 Postado Julho 3, 2012 Share Postado Julho 3, 2012 O sistema funciona em linux, no meu debian rodou que foi uma beleza, só não mostrou quando dá o look, mas de resto, tá ok. Como faço pro gesior mostrar com quem tá casado? Outra coisa, aquele comando !love seria legalzinho kk Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1288202 Compartilhar em outros sites More sharing options...
Vodkart 1515 Postado Julho 6, 2012 Autor Share Postado Julho 6, 2012 então cara, eu não sei programar em php, então sobre o gesior eu n vou consegui te ajudar :T sobre o comando love até pode ser colocado no script, easy '-' M i s s reagiu a isso 1 Link para o comentário https://xtibia.com/forum/topic/188712-marriage-system-npc/#findComment-1289192 Compartilhar em outros sites More sharing options...
Posts Recomendados