Wedding question

Support for the latest build of L2J Server, get help here with installations, upgrades, problems.
Do not post bugs reports here, use viewforum.php?f=77 instead.
There is no support for other server builds than the official provided by l2jserver.com
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
User avatar
papadkostas
Posts: 128
Joined: Fri Jul 02, 2010 8:34 am
Location: Greece
Contact:

Wedding question

Post by papadkostas »

hey all :D
i wanted to make when someone trying to gotolove, send a message to partner that his love coming to him with a system message..
i got edited some lines of wedding.java(almost at the EOF)
but i'm not sure(eclipse didnt showed me any warning/error) if its the right way to do this..or if i can make it much more short edit that the one i did!
and by the way dont flame me plz for a such an easy question for you..
cause i'm just a newbie that tryes to learn and be a better one in future and help our community :|
excuse me that i didnt used

Code: Select all

  but i didnt know how and if it is possible to highlight with color!
red colored = added code  :) 

EscapeFinalizer ef = new EscapeFinalizer(activeChar,[color=#FF0000]partner,[/color] partner.getX(), partner.getY(), partner.getZ(), partner.isIn7sDungeon());
        // continue execution later
        activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(ef, teleportTimer));
        activeChar.forceIsCasting(GameTimeController.getGameTicks() + teleportTimer / GameTimeController.MILLIS_IN_TICK);
        
        return true;
    }
    
    static class EscapeFinalizer implements Runnable
    {
        private L2PcInstance _activeChar;
       [color=#FF0000]private L2PcInstance _partnerId;[/color]
        private int _partnerx;
        private int _partnery;
        private int _partnerz;
        private boolean _to7sDungeon;
        
        EscapeFinalizer(L2PcInstance activeChar,L2PcInstance partnerId, int x, int y, int z, boolean to7sDungeon)
        {
            _activeChar = activeChar;
          [color=#FF0000] _partnerId = partnerId;[/color]
            _partnerx = x;
            _partnery = y;
            _partnerz = z;
            _to7sDungeon = to7sDungeon;
        }
        
        public void run()
        {
            if (_activeChar.isDead())
                return;
            
            if(SiegeManager.getInstance().getSiege(_partnerx, _partnery, _partnerz) != null && SiegeManager.getInstance().getSiege(_partnerx, _partnery, _partnerz).getIsInProgress())
            {
                _activeChar.sendMessage("Your partner is in siege, you can't go to your partner.");
                return;
            }
            
            _activeChar.setIsIn7sDungeon(_to7sDungeon);
            _activeChar.enableAllSkills();
            _activeChar.setIsCastingNow(false);
            
            try
            {
                _activeChar.teleToLocation(_partnerx, _partnery, _partnerz);
              [color=#FF0000] _partnerId.sendMessage("Your partner is teleporting to you!");[/color]
            }
and..thanks for your time!  :wink:
I'm learning as fast..as roadrunner - Beeep Beeeep
Image
Deadmeat
Posts: 286
Joined: Fri Sep 22, 2006 1:03 am
Location: Red Rock, Mars

Re: Wedding question

Post by Deadmeat »

Try this, add the 6 lines that say add this line.

Code: Select all

    static class EscapeFinalizer implements Runnable    {        private L2PcInstance _activeChar;        private int _partnerx;        private int _partnery;        private int _partnerz;        private boolean _to7sDungeon;        L2PcInstance partner;      <----Add this Line        partner = L2World.getInstance().getPlayer(_partnerId);    <----Add this Line        EscapeFinalizer(L2PcInstance activeChar, int x, int y, int z, boolean to7sDungeon)        {            _activeChar = activeChar;            _partnerx = x;            _partnery = y;            _partnerz = z;            _to7sDungeon = to7sDungeon;        }                public void run()        {            if (_activeChar.isDead())                return;                        if(SiegeManager.getInstance().getSiege(_partnerx, _partnery, _partnerz) != null && SiegeManager.getInstance().getSiege(_partnerx, _partnery, _partnerz).getIsInProgress())            {                _activeChar.sendMessage("Your partner is in siege, you can't go to your partner.");                return;            }                        _activeChar.setIsIn7sDungeon(_to7sDungeon);            _activeChar.enableAllSkills();            _activeChar.setIsCastingNow(false);                        try            {                _activeChar.teleToLocation(_partnerx, _partnery, _partnerz);                if (partner != null)   <----Add this Line                {     <----Add this Line                   partner.sendMessage("Your partner is teleporting to you!");   <----Add this Line                }     <----Add this Line            }            catch (Exception e)            {                _log.log(Level.SEVERE, "", e);            }        }    }
Last edited by Deadmeat on Tue Jan 11, 2011 6:02 am, edited 1 time in total.
User avatar
papadkostas
Posts: 128
Joined: Fri Jul 02, 2010 8:34 am
Location: Greece
Contact:

Re: Wedding question

Post by papadkostas »

:D i'll try it ..and i'll post what happened in both case's..
thank you :wink:
I'm learning as fast..as roadrunner - Beeep Beeeep
Image
Ralm
Posts: 154
Joined: Sat Dec 25, 2010 10:09 pm
Location: Portugal

Re: Wedding question

Post by Ralm »

Nice add =) I like it.

I allways saw wedding mod a bit simple. Lets do it more funny and usefull =)
My teachers XD: jurchiks
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Wedding question

Post by jurchiks »

What, no null checks?
...
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Deadmeat
Posts: 286
Joined: Fri Sep 22, 2006 1:03 am
Location: Red Rock, Mars

Re: Wedding question

Post by Deadmeat »

send message is with the teleport command what do you need the null check for?
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Wedding question

Post by jurchiks »

L2World.getInstance().getPlayer(_partnerId);
this can easily give you a null
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Deadmeat
Posts: 286
Joined: Fri Sep 22, 2006 1:03 am
Location: Red Rock, Mars

Re: Wedding question

Post by Deadmeat »

No problem I added a null check for partner.

Turn line numbers off so you can see the code without word wrap.
User avatar
jurchiks
Posts: 6769
Joined: Sat Sep 19, 2009 4:16 pm
Location: Eastern Europe

Re: Wedding question

Post by jurchiks »

Ahh, the null check should be before the EscapeFinalizer is initialized, because partner.getX() can already throw a NPE.
I'm rewriting the wedding mod, there's lots of useless stuff there.
If you have problems, FIRST TRY SOLVING THEM YOURSELF, and if you get errors, TRY TO ANALYZE THEM, and ONLY if you can't help it, THEN ask here.
Otherwise you will never learn anything if all you do is copy-paste!
Discussion breeds innovation.
Post Reply