A Project for Chronicle 4 based on L2JServer.


    Custom MOD

    Share

    anderuimm

    Posts : 3
    Join date : 2014-10-16

    Custom MOD

    Post  anderuimm on 16th October 2014, 22:48

    It's something relatively simple: I want to create a column in the table called accounts is_vip (1 INT​​) will define if the account is VIP. The possible values ​​for this column will be 0 or 1, and it will be set through a WEB management system that will create after.

    Using the value of this column I want to be able to limit a player so he can not have characters above a certain level.

    When character reach that level (in the example, lvl39) it can no longer gain XP and get a message saying you must be VIP for that, then will be teleported to nearest village.

    Below two diff codes that I hardcoded to do the recalls, but as I have no knowledge of some parts of Java could not finish others:


    Code:
    Index: trunk/Lisvus_GameServer/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
    ===================================================================
    --- trunk/Lisvus_GameServer/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java   (revision 505)
    +++ trunk/Lisvus_GameServer/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java   (working copy)
    @@ -294,6 +294,19 @@
                activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
                activeChar.sendMessage("You have been teleported to the nearest town due to being in a siege zone.");
            }
    +       
    +        /**
    +        * Recall non-VIPs after lvl39
    +        */
    +        if(!activeChar.isVIP() && activeChar.getLevel() >= 39)
    +      {
    +         activeChar.teleToLocation(MapRegionTable.TeleportWhereType.Town);
    +         activeChar.sendMessage("You have reached the max character level to normal accounts. You must be VIP to continue playing without limitations.");
    +      }
    +        else
    +           {
    +           activeChar.sendMessage("Thanks for subscribe. Good day for you!");
    +         }
     
            if (activeChar.getClanJoinExpiryTime() > System.currentTimeMillis())
     

    Code:
    Index: trunk/Lisvus_GameServer/java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java
    ===================================================================
    --- trunk/Lisvus_GameServer/java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java   (revision 505)
    +++ trunk/Lisvus_GameServer/java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java   (working copy)
    @@ -64,10 +64,18 @@
            {
                if (!super.addExp(value))
                    return false;
    -
    -            StatusUpdate su = new StatusUpdate(getActiveChar().getObjectId());
    -            su.addAttribute(StatusUpdate.EXP, (int)getExp());
    -            getActiveChar().sendPacket(su);
    +         // Leveling block to non-VIP accounts
    +         if(!activeChar.isVIP() && activeChar.getLevel() >= 39)
    +         {
    +            getActiveChar().teleToLocation(MapRegionTable.TeleportWhereType.Town);
    +            getActiveChar().sendMessage("You have reached the max character level to normal accounts.  You must be VIP to continue playing without limitations.");
    +         }
    +         else
    +         {            
    +            StatusUpdate su = new StatusUpdate(getActiveChar().getObjectId());
    +            su.addAttribute(StatusUpdate.EXP, (int)getExp());
    +            getActiveChar().sendPacket(su);
    +         }
            }
     
            // Set new karma

    PS.: isVIP() must check if accounts.is_vip == 1

    fissban

    Posts : 81
    Join date : 2013-12-10

    Re: Custom MOD

    Post  fissban on 17th October 2014, 04:41

    You should just add a field in characters.sql more L2PcInstance and then add this value to be read in the methods of reading and updating data in the sql and if not adjust a default value you should also add this field in which it is created.

    The forms of queries are at the beginning of class before mentioned and you would stay and then just check where they are used to make the changes.

    ---
    use google translator

    anderuimm

    Posts : 3
    Join date : 2014-10-16

    Re: Custom MOD

    Post  anderuimm on 17th October 2014, 14:50

    If I add the field in the table "characters" the status "vip account" willn't be seen by all characters within the same account, unless I create a method for this, which complicates the situation. So it should be added in the table "accounts".

    I want to create a read function to the field "accounts.is_vip" inside "L2PcInstance" to add the value within the array "player." for it to be read later as "activeChar.isVIP" inside my functions, in the same way that setNoble, but I still don't know how to do because I don't quite understand how works the interaction of Java with data collection from the database to pull data from the table "accounts".


    ---
    ps.: I'm already using Google Translator, but translations from PT-BR to EN-US are bad.

    fissban

    Posts : 81
    Join date : 2013-12-10

    Re: Custom MOD

    Post  fissban on 17th October 2014, 20:46

    acount no, characters

    anderuimm

    Posts : 3
    Join date : 2014-10-16

    Re: Custom MOD

    Post  anderuimm on 19th October 2014, 05:10

    fissban wrote:acount no, characters

    I think you misunderstand what I wrote before. I don't want to use the table "characters" because the VIP will apply to the entire account, not just a character.

    So I have to make the object of the character in accounts table if is the account VIP or not... could even be in another table as "accounts_vip", but that would require even more changes to the database.

    Sponsored content

    Re: Custom MOD

    Post  Sponsored content


      Current date/time is 18th November 2017, 17:33