Jump to content

Custom Race Starting Items


iSparky

Recommended Posts

Custom Race Starting Items v1

 

# New players Starting Items ( Human )
# Default: False
EnableHumanReward = False
# Human Fighter
HumanFighterHelmID = 
HumanFighterChestID = 
HumanFighterLegsID = 
HumanFighterBootsID = 
HumanFighterGlovesID = 
HumanFighterWeaponID = 
# Human Mage
HumanMageHelmID = 
HumanMageChestID = 
HumanMageLegsID = 
HumanMageBootsID = 
HumanMageGlovesID = 
HumanMageWeaponID = 

# New players Starting Items ( Elf )
# Default: False
EnableElfReward = False
# Elf Fighter
ElfFighterHelmID = 
ElfFighterChestID = 
ElfFighterLegsID = 
ElfFighterBootsID = 
ElfFighterGlovesID = 
ElfFighterWeaponID = 
# Elf Mage
ElfMageHelmID = 
ElfMageChestID = 
ElfMageLegsID = 
ElfMageBootsID = 
ElfMageGlovesID = 
ElfMageWeaponID = 

# New players Starting Items ( DarkElf )
# Default: False
EnableDEReward = False
# DarkElf Fighter
DEFighterHelmID = 
DEFighterChestID = 
DEFighterLegsID = 
DEFighterBootsID = 
DEFighterGlovesID = 
DEFighterWeaponID = 
# DarkElf Mage
DEMageHelmID = 
DEMageChestID = 
DEMageLegsID = 
DEMageBootsID = 
DEMageGlovesID = 
DEMageWeaponID = 

# New players Starting Items ( Orc )
# Default: False
EnableOrcReward = False
# Orc Fighter
OrcFighterHelmID = 
OrcFighterChestID = 
OrcFighterLegsID = 
OrcFighterBootsID = 
OrcFighterGlovesID = 
OrcFighterWeaponID =
# Orc Mage
OrcMageHelmID = 
OrcMageChestID = 
OrcMageLegsID = 
OrcMageBootsID = 
OrcMageGlovesID = 
OrcMageWeaponID = 

# New players Starting Items ( Dwarf )
# Default: False
EnableDwarfReward = False
# Dwarf Fighter
DwarfFighterHelmID = 
DwarfFighterChestID = 
DwarfFighterLegsID = 
DwarfFighterBootsID = 
DwarfFighterGlovesID = 
DwarfFighterWeaponID = 

http://pastebin.com/ywGtFmGY

 

 

Credits : (Me) iSparky

Edit: Ignore this :P

 

@@ -233,8 +498,7 @@
               
                // Shortcuts
                newChar.registerShortCut(new L2ShortCut(0, 0, 3, 2, -1, 1)); // Attack
-               newChar.registerShortCut(new L2ShortCut(3, 0, 3, 5, -1, 1)); // Take
-               newChar.registerShortCut(new L2ShortCut(10, 0, 3, 0, -1, 1)); // Sit
+               newChar.registerShortCut(new L2ShortCut(1, 0, 3, 5, -1, 1)); // Take
               
                final ItemTable itemTable = ItemTable.getInstance();
                final L2Item[] items = template.getItems();
Edited by iSparky
Link to comment
Share on other sites

Can you message me the better way ? :)

At me works like this :P

I know i can do it like this:

if (newChar.getRace() == Race.human || newChar.isMageClass())
{
newChar.getInventory().addItem("Start Human Mage Item", Config.HUMAN_M_HELM_ID, Config.REWARD_COUNT, newChar, null);
}
else
{
newChar.getInventory().addItem("Start Human Fighter Item", Config.HUMAN_F_HELM_ID, Config.REWARD_COUNT, newChar, null);
}

But i want to Equip this items :D

Edited by iSparky
Link to comment
Share on other sites

bad coded , too much configs also but still a nice idea.. Everybody has their programming style. Others prefer a straight short code and others they achieve their idea circleing the code.. Well as an exercise its good but if you want to apply that on a project you must organize it a bit. I am not a good coder too i also sometimes add strange methods and using useless stuff.. Exercising its the best option.. Thanks for these share.

Link to comment
Share on other sites

It is a good idea for starting items for each class...

But maybe is more "clean", if you put fewer lines.

For example, make all fighter race to get the same items, apart of weapon if you want.

And the same on mage...

or something better, make 2 item with name "Fighter Items" or "Mage Items" give this in inventory, and then, with 2 click give all that you want... (with class check for item).

Edited by 'Baggos'
Link to comment
Share on other sites

 

or something better, make 2 item with name "Fighter Items" or "Mage Items" give this in inventory, and then, with 2 click give all that you want... (with class check for item).

 

Trust me i have do that on Live server and some people ask me "Gm why i have no items -.-"

 

and if you put items at inventory they never open the bag to watch starting items ;)

 

i think its a better way to equip the items :)

Link to comment
Share on other sites

On part with fewer lines:

Do something like that... I do not give a try if will be work exactly so, just i give you my idea for fewer lines.

 

Ingore the Items... is a example...

Because i like your idea, i want to you find a easy way...

if (Config.STARTINGS_ITEMS_RACES)
   {
  if (!newChar.isMageClass())
  {
  if (newChar.getRace() == Race.Human)
        {
         newChar.getInventory().addItem("Angel Slayer", 6367, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Light", 6379, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Boots", 6380, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Gloves", 6381, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Helmet", 6382, 1, newChar, newChar);
         newChar.getInventory().addItem("TEO Necklace", 920, 1, newChar, newChar );
         newChar.getInventory().addItem("TEO Earring", 858, 2, newChar, newChar);
         newChar.getInventory().addItem("TEO Ring", 889, 2, newChar, newChar );
        }
  if (newChar.getRace() == Race.Elf)
        {
         newChar.getInventory().addItem("Angel Slayer", 6367, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Light", 6379, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Boots", 6380, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Gloves", 6381, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Helmet", 6382, 1, newChar, newChar);
         newChar.getInventory().addItem("TEO Necklace", 920, 1, newChar, newChar );
         newChar.getInventory().addItem("TEO Earring", 858, 2, newChar, newChar);
         newChar.getInventory().addItem("TEO Ring", 889, 2, newChar, newChar );
         }
   if (newChar.getRace() == Race.DarkElf)
        {
         newChar.getInventory().addItem("Angel Slayer", 6367, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Light", 6379, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Boots", 6380, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Gloves", 6381, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Helmet", 6382, 1, newChar, newChar);
         newChar.getInventory().addItem("TEO Necklace", 920, 1, newChar, newChar );
         newChar.getInventory().addItem("TEO Earring", 858, 2, newChar, newChar);
         newChar.getInventory().addItem("TEO Ring", 889, 2, newChar, newChar );
         }
   if (newChar.getRace() == Race.Orc)
        {
         newChar.getInventory().addItem("Angel Slayer", 6367, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Light", 6379, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Boots", 6380, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Gloves", 6381, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Helmet", 6382, 1, newChar, newChar);
         newChar.getInventory().addItem("TEO Necklace", 920, 1, newChar, newChar );
         newChar.getInventory().addItem("TEO Earring", 858, 2, newChar, newChar);
         newChar.getInventory().addItem("TEO Ring", 889, 2, newChar, newChar );
         }
  
   if (newChar.getRace() == Race.Dwarf)
        {
         newChar.getInventory().addItem("Angel Slayer", 6367, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Light", 6379, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Boots", 6380, 1, newChar, newChar);
         newChar.getInventory().addItem("Dragonic Gloves", 6381, 1, newChar, newChar );
         newChar.getInventory().addItem("Dragonic Helmet", 6382, 1, newChar, newChar);
         newChar.getInventory().addItem("TEO Necklace", 920, 1, newChar, newChar );
         newChar.getInventory().addItem("TEO Earring", 858, 2, newChar, newChar);
         newChar.getInventory().addItem("TEO Ring", 889, 2, newChar, newChar );
         }
  
   else
        {
         newChar.getInventory().addItem("Arcana Mace Acumen", 6608, 1, newChar, newChar);
         newChar.getInventory().addItem("DC Robe", 2407, 1, newChar, newChar );
         newChar.getInventory().addItem("DC Gloves", 5767, 1, newChar, newChar);
         newChar.getInventory().addItem("DC Boots", 5779, 1, newChar, newChar );
         newChar.getInventory().addItem("DC Helmet", 512, 1, newChar, newChar);
         newChar.getInventory().addItem("TEO Necklace", 920, 1, newChar, newChar );
         newChar.getInventory().addItem("TEO Earring", 858, 2, newChar, newChar);
         newChar.getInventory().addItem("TEO Ring", 889, 2, newChar, newChar );
        }
Edited by 'Baggos'
Link to comment
Share on other sites

If you want a clean code, use xml... for example:

<?xml version="1.0" encoding="UTF-8"?>
<list>
    <template race="-1" classId="-1">
        <equipment slot="rhand" item="12345"/>
        <equipment slot="lhand" item="12345"/>
        <inventory>
            <item id="1234" count="12313" />
            <item id="567" count="2222" />
        </inventory>
        <shortCut slot="1" page="1" type="1" id="5555" level="-1" charType="1">
    </template>
</list>

Everything is optional and gives a lot more flexibility... you can set an default template which will be used by all races, you can define an special template for a specific race/class while all others uses the default, you can inherit an template and so on... the only limit will be your imagination :lol:

Link to comment
Share on other sites

If you want a clean code, use xml... for example:

<?xml version="1.0" encoding="UTF-8"?>
<list>
    <template race="-1" classId="-1">
        <equipment slot="rhand" item="12345"/>
        <equipment slot="lhand" item="12345"/>
        <inventory>
            <item id="1234" count="12313" />
            <item id="567" count="2222" />
        </inventory>
        <shortCut slot="1" page="1" type="1" id="5555" level="-1" charType="1">
    </template>
</list>

Everything is optional and gives a lot more flexibility... you can set an default template which will be used by all races, you can define an special template for a specific race/class while all others uses the default, you can inherit an template and so on... the only limit will be your imagination :lol:

Yes... A better way... and equipment items! ;)

Link to comment
Share on other sites

add items on arrays and use a loop to equip everything with one method.

it will not be more than 5 lines

Link to comment
Share on other sites

well i will exlain you what i was saying,

there will be a loop for the ids of an array. ( ids will be all ids for mage class for example )

 

on this loop you will add on players inventory one by one the items using .getInventory().addItem(..blabla.) and then force them to auto equip on character using .getInventory().equipItem(id here);

you will propably need also inventory update and broadcastUserInfo each time you loop.

 

its just an idea, and code will be much better, try it alone and if you cant do it, i will help you!

Link to comment
Share on other sites

As I said before, there is no need for equip part, since it's already there, few lines below :P

 

 

            if (item.isEquipable())
            {
                if (newChar.getActiveWeaponItem() == null || !(item.getItem().getType2() != Item.TYPE2_WEAPON))
                    newChar.getInventory().equipItemAndRecord(item);
            }
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




  • Posts

    • Thank you 😊👍 working great! 
    • MidnightSell team WTB/WTS GOLD TWW EU/US all servers Cataclysm all servers Payment Visa/Master/Btc/Eth/Trc-20/Erc-20 (all payments within 10 min) For all question pls dm Discord https://discord.gg/h8AN57qJjK Or Telegram @MidnightSell
    • GOSTEI MUITO DO VIASUAL DO SERVE COMO POSSO ADQUIRI ESSA REV PACK   
    • Helly everyone . I use L2jmobius interlude , i did everything , installed the db compiled the Build in eclipse Gameserver seems to lead OK , but it fails to connect to loginserver When i click to start the loginserver it says  "Loginserver terminated abnormally" This is wheat gameserver shows me :    [05/10 17:25:12] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:12] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:17] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:17] LoginServerThread: LoginServer not available, trying to reconnect... [05/10 17:25:22] LoginServerThread: Connecting to login on 127.0.0.1:9014 [05/10 17:25:22] LoginServerThread: LoginServer not available, trying to reconnect...   And This is my login config file:   # --------------------------------------------------------------------------- # Login Server Settings # --------------------------------------------------------------------------- # This is the server configuration file. Here you can set up the connection information for your server. # This was written with the assumption that you are behind a router. # Dumbed Down Definitions... # LAN (LOCAL area network) - typically consists of computers connected to the same router as you. # WAN (WIDE area network) - typically consists of computers OUTSIDE of your router (ie. the internet). # x.x.x.x - Format of an IP address. Do not include the x'es into settings. Must be real numbers. # --------------------------------------------------------------------------- # Networking # --------------------------------------------------------------------------- # Bind ip of the LoginServer, use 0.0.0.0 to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 0.0.0.0 LoginserverHostname = 0.0.0.0 # Default: 2106 LoginserverPort = 2106 # The address on which login will listen for GameServers, use * to bind on all available IPs # WARNING: <u><b><font color="red">Please don't change default IPs here if you don't know what are you doing!</font></b></u> # WARNING: <u><b><font color="red">External/Internal IPs are now inside "ipconfig.xml" file.</font></b></u> # Default: 127.0.0.1 LoginHostname = 127.0.0.1 # The port on which login will listen for GameServers # Default: 9014 LoginPort = 9014 # --------------------------------------------------------------------------- # Database # --------------------------------------------------------------------------- # Specify the JDBC driver class for your database. # Default: org.mariadb.jdbc.Driver Driver = org.mariadb.jdbc.Driver # Database URL # Default: jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true URL = jdbc:mariadb://localhost/l2jmobiusinterlude?useUnicode=true&characterEncoding=utf-8&useSSL=false&connectTimeout=10000&interactiveClient=true&sessionVariables=wait_timeout=600,interactive_timeout=600&autoReconnect=true # Database user info. Default is "root" but it's not recommended. Login = root # Database user password, leave empty for no password. Password = root # Maximum number of database connections to maintain in the pool. # Default: 5 MaximumDatabaseConnections = 5 # Determine whether database connections should be tested for availability. # Default: False TestDatabaseConnections = False # --------------------------------------------------------------------------- # Automatic Database Backup Settings # --------------------------------------------------------------------------- # Generate database backups when server restarts or shuts down.  BackupDatabase = False # Path to MySQL bin folder. Only necessary on Windows. MySqlBinLocation = C:/xampp/mysql/bin/ # Path where MySQL backups are stored. BackupPath = ../backup/ # Maximum number of days that backups will be kept. # Old files in backup folder will be deleted. # Set to 0 to disable. BackupDays = 30 # --------------------------------------------------------------------------- # Thread Configuration # --------------------------------------------------------------------------- # Defines the number of threads in the scheduled thread pool. # If set to -1, this will be determined by available processors divided by 2. ScheduledThreadPoolSize = 2 # Defines the number of threads in the instant thread pool. # If set to -1, this will be determined by available processors divided by 2. InstantThreadPoolSize = 2 # --------------------------------------------------------------------------- # Security # --------------------------------------------------------------------------- # How many times you can provide an invalid account/pass before the IP gets banned. # Default: 5 LoginTryBeforeBan = 5 # Time you won't be able to login back again after LoginTryBeforeBan tries to login. # Default: 900 (15 minutes) LoginBlockAfterBan = 900 # If set to True any GameServer can register on your login's free slots # Default: True AcceptNewGameServer = True # Flood Protection. All values are in milliseconds. # Default: True EnableFloodProtection = True # Default: 15 FastConnectionLimit = 15 # Default: 700 NormalConnectionTime = 700 # Default: 350 FastConnectionTime = 350 # Default: 50 MaxConnectionPerIP = 50 # --------------------------------------------------------------------------- # Misc Login Settings # --------------------------------------------------------------------------- # If False, the license (after the login) will not be shown. # Default: True ShowLicence = True # Default: True AutoCreateAccounts = True # Datapack root directory. # Defaults to current directory from which the server is started. DatapackRoot = . # --------------------------------------------------------------------------- # Scheduled Login Restart # --------------------------------------------------------------------------- # Enable disable scheduled login restart. # Default: False LoginRestartSchedule = False # Time in hours. # Default: 24 LoginRestartTime = 24    
  • Topics

×
×
  • Create New...