Page 1 of 1

Telnet enchant shirt

Posted: Tue Nov 04, 2014 12:24 am
by dasoldier
datapack: 10490
Server: 6670

Hey,

I cannot get the telnet command working for enchanting the shirt of a online player.

Code: Select all

enchant username 13 18
it will say Item failed to enchant.

All the enchant commands are working for me except this one.

Greetings,
Dasoldier

Re: Telnet enchant shirt

Posted: Tue Nov 04, 2014 2:02 am
by elitovec
i'm looking for telnet app!
Do you have telnet app?
Can you give me and others?
sorry fo my eng :oops:

Re: Telnet enchant shirt

Posted: Tue Nov 04, 2014 10:21 pm
by Zoey76
elitovec wrote:i'm looking for telnet app!
Do you have telnet app?
Can you give me and others?
sorry fo my eng :oops:
http://www.chiark.greenend.org.uk/~sgta ... nload.html

Re: Telnet enchant shirt

Posted: Sun Nov 09, 2014 7:25 pm
by dasoldier
Since no one knows how to solve this problem some additional information.

When we go to gameserver/model/itemcontainer/Invertory.java
we will see

Code: Select all

public static final int PAPERDOLL_UNDER = 0;
This will make the itemtype 0.

Then we go to data/scripts/handlers/telnethandlers/PlayerHandler.java

And we find this part.

Code: Select all

                if ((player != null) && (itemType > 0))                {                    success = setEnchant(player, enchant, itemType);                    if (success)                    {                        _print.println("Item enchanted successfully.");                    }                }                else if (!su
Now if i change this

Code: Select all

if ((player != null) && (itemType > 0))
To this

Code: Select all

if (((player != null) && (itemType > 0)) || (itemType == 0))
Now i'm able to enchant the shirt.
But when i try to enchant a empty slot it will take the weapon slot, and then it will enchant that item instead saying "item failed to enchant".
When i try to enchant the weapon when nothing is equipped the telnet console will say nothing, not failed or successfully.

update:
changed itemtype to -1
still the same result happens.

Code: Select all

        else if (command.startsWith("enchant"))        {            StringTokenizer st = new StringTokenizer(command.substring(8), " ");            int enchant = 0, itemType = -1;                        try            {                L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken());                itemType = Integer.parseInt(st.nextToken());                enchant = Integer.parseInt(st.nextToken());                                switch (itemType)                {                    case 1:                        itemType = Inventory.PAPERDOLL_HEAD;                        break;                    case 2:                        itemType = Inventory.PAPERDOLL_CHEST;                        break;                    case 3:                        itemType = Inventory.PAPERDOLL_GLOVES;                        break;                    case 4:                        itemType = Inventory.PAPERDOLL_FEET;                        break;                    case 5:                        itemType = Inventory.PAPERDOLL_LEGS;                        break;                    case 6:                        itemType = Inventory.PAPERDOLL_RHAND;                        break;                    case 7:                        itemType = Inventory.PAPERDOLL_LHAND;                        break;                    case 8:                        itemType = Inventory.PAPERDOLL_LEAR;                        break;                    case 9:                        itemType = Inventory.PAPERDOLL_REAR;                        break;                    case 10:                        itemType = Inventory.PAPERDOLL_LFINGER;                        break;                    case 11:                        itemType = Inventory.PAPERDOLL_RFINGER;                        break;                    case 12:                        itemType = Inventory.PAPERDOLL_NECK;                        break;                    case 13:                        itemType = Inventory.PAPERDOLL_UNDER;                        break;                    case 14:                        itemType = Inventory.PAPERDOLL_CLOAK;                        break;                    case 15:                        itemType = Inventory.PAPERDOLL_BELT;                        break;                    default:                        itemType = -1;                }                                if (enchant > 65535)                {                    enchant = 65535;                }                else if (enchant < 0)                {                    enchant = 0;                }                                boolean success = false;                                if ((player != null) && (itemType != -1))                {                    success = setEnchant(player, enchant, itemType);                    if (success)                    {                        _print.println("Item enchanted successfully.");                    }                }                else if (!success)                {                    _print.println("Item failed to enchant.");                }            }            catch (Exception e)            {                            }        }

Re: Telnet enchant shirt

Posted: Mon Nov 10, 2014 12:22 am
by AntV
I'm not quite sure you want this code to achieve, but the following part:

Code: Select all

if ((player != null) && (itemType != -1))                {                    success = setEnchant(player, enchant, itemType);                    if (success)                    {                        _print.println("Item enchanted successfully.");                    }                }                else if (!success)                {                    _print.println("Item failed to enchant.");                }
Means if itemType was -1 it won't enchant anything.
Also the else if, should be simple else, or a nested if, because the way you have it, success is always false.

Let me clarify; the if else is an else to the first if, not the second.

Re: Telnet enchant shirt

Posted: Mon Nov 10, 2014 2:07 am
by dasoldier
Ive changed that just to try nothing else.
this should be the good one.

Code: Select all

if ((player != null) && (itemType > 0))
The problem is shirt enchant will not work with the current code.

Any idea's that i can try would be usefull.