All pastes #481991 Raw Edit

Wedding

public text v1 · immutable
·published 2007-05-11 03:15 UTC
rendered paste body
add to config:
...
    /** Wedding system */
    public static boolean ALLOW_WEDDING;
    public static int WEDDING_PRICE;
    public static boolean WEDDING_PUNISH_INFIDELITY;
    public static boolean WEDDING_TELEPORT;
    public static int WEDDING_TELEPORT_PRICE;
    public static int WEDDING_TELEPORT_INTERVAL;
    public static boolean WEDDING_SAMESEX;
    public static boolean WEDDING_FORMALWEAR;
    public static int WEDDING_DIVORCE_COSTS;
...
                ALLOW_WEDDING                   = Boolean.valueOf(optionsSettings.getProperty("AllowWedding", "False"));
...
                WEDDING_PRICE                                       = Integer.parseInt(altSettings.getProperty("WeddingPrice", "500000"));
                WEDDING_PUNISH_INFIDELITY                           = Boolean.parseBoolean(altSettings.getProperty("WeddingPunishInfidelity", "true"));                
                WEDDING_TELEPORT                                    = Boolean.parseBoolean(altSettings.getProperty("WeddingTeleport", "true"));
                WEDDING_TELEPORT_PRICE                              = Integer.parseInt(altSettings.getProperty("WeddingTeleportPrice", "500000"));
                WEDDING_TELEPORT_INTERVAL                           = Integer.parseInt(altSettings.getProperty("WeddingTeleportInterval", "120"));
                WEDDING_SAMESEX                                     = Boolean.parseBoolean(altSettings.getProperty("WeddingAllowSameSex", "true"));
                WEDDING_FORMALWEAR                                  = Boolean.parseBoolean(altSettings.getProperty("WeddingFormalWear", "true"));
                WEDDING_DIVORCE_COSTS                               = Integer.parseInt(altSettings.getProperty("WeddingDivorceCosts", "20"));


add to game server:
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
..
        // Couple manager
        if(!Config.ALLOW_WEDDING)
        {
            CoupleManager.getInstance();
            if ( _log.isDebugEnabled())_log.debug("CoupleManager initialized");
        }
..
        if(Config.ALLOW_WEDDING)
            _voicedCommandHandler.registerVoicedCommandHandler(new Wedding());

addtol2pcistance

...
    private boolean _maried = false;
    private int _partnerId = 0;
    private int _coupleId = 0;
    private boolean _engagerequest = false;
    private int _engageid = 0;
    private boolean _maryrequest = false;
    private boolean _maryaccepted = false;
...
    public boolean isWearingFormalWear()
    {
        return _IsWearingFormalWear;
    }

    public void setIsWearingFormalWear(boolean value)
    {
        _IsWearingFormalWear = value;
    }

    public boolean isMaried()
    {
        return _maried;
    }
    
    public void setMaried(boolean state)
    {
        _maried = state;
    }

    public boolean isEngageRequest()
    {
        return _engagerequest;
    }
    
    public void setEngageRequest(boolean state,int playerid)
    {
        _engagerequest = state;
        _engageid = playerid;
    }
    
    public void setMaryRequest(boolean state)
    {
        _maryrequest = state;
    }

    public boolean isMaryRequest()
    {
        return _maryrequest;
    }

    public void setMaryAccepted(boolean state)
    {
        _maryaccepted = state;
    }

    public boolean isMaryAccepted()
    {
        return _maryaccepted;
    }
    
    public int getEngageId()
    {
        return _engageid;
    }
    
    public int getPartnerId()
    {
        return _partnerId;
    }
    
    public void setPartnerId(int partnerid)
    {
        _partnerId = partnerid;
    }
    
    public int getCoupleId()
    {
        return _coupleId;
    }
    
    public void setCoupleId(int coupleId)
    {
        _coupleId = coupleId;
    }

    public void EngageAnswer(int answer)
    {
        if(_engagerequest==false)
            return;
        else if(_engageid==0)
            return;
        else
        {
            L2PcInstance ptarget = (L2PcInstance)L2World.getInstance().findObject(_engageid);
            setEngageRequest(false,0);
            if(ptarget!=null)
            {
                if (answer == 1)
                {
                    CoupleManager.getInstance().createCouple(ptarget, L2PcInstance.this);
                    ptarget.sendMessage("Engage accepted.");
                }
                else
                    ptarget.sendMessage("Engage declined.");
            }
        }
    }

add to inventory:
...
    final class FormalWearListener implements PaperdollListener
    {
        public void notifyUnequiped(int slot, L2ItemInstance item)
        {
            if (!(getOwner() != null
                    && getOwner() instanceof L2PcInstance))
                return;
            
            L2PcInstance owner = (L2PcInstance)getOwner(); 

            if (item.getItemId() == 6408)
                owner.setIsWearingFormalWear(false);
        }
        public void notifyEquiped(int slot, L2ItemInstance item)
        {
            if (!(getOwner() != null
                    && getOwner() instanceof L2PcInstance))
                return;
            
            L2PcInstance owner = (L2PcInstance)getOwner(); 

            // If player equip Formal Wear unequip weapons and abort cast/attack 
            if (item.getItemId() == 6408) 
            {
                owner.setIsWearingFormalWear(true);
            } 
            else 
            {
                if (!owner.isWearingFormalWear())
                    return;
            }
        }
    }
    
    /**