Enchanting
#1
I'm currently working on enchanting for mcserver.

Working:
- opening window
- drop item in the slot 0 when the player close the window


Current Question: How can i send the three enchanting fields to the player?
Reply
Thanks given by:
#2
Thugie is also working on this.

It seems you have to use the cWindow:SetPropertie function.

Btw here is documentation for the protocol of you need it: http://wiki.vg/Protocol#Window_Property
Reply
Thanks given by:
#3
(01-19-2014, 09:17 PM)STR_Warrior Wrote: Thugie is also working on this.
Ah yes i see now his thread.

(01-19-2014, 09:17 PM)STR_Warrior Wrote: It seems you have to use the cWindow:SetPropertie function.
Thanks.

SetProperty is working. Now the enchantments are available.

Now i must get if a item in the slot. I tried:
Code:
if (this->m_ParentWindow.GetSlot(a_Player, 0)->m_ItemType == -1)
But with this the slot is always empty.

Now I'm checking for items who can be enchanted.

Sometimes this isn't working:
Code:
if (this->m_ParentWindow.GetSlot(a_Player, 0)->m_ItemType == 268)
This check for a wooden sword. But sometimes it is the itemtype -1 and not 268..
Give it a other method for the checking?
Reply
Thanks given by:
#4
itemtype -1 means there is no item there, it's empty.

Also, you should use E_ITEM_WOODEN_SWORD instead of 268
Reply
Thanks given by: daniel0916
#5
Instead of checking if m_ItemType is -1, you should use the IsEmpty() function. An empty item may be also one that has a valid m_ItemType, but the m_ItemCount is zero.
Reply
Thanks given by: daniel0916
#6
Okay, but when i click on the item in the console it comes the message that the item is a wooden sword but when i do the item in the enchant slot it is -1. But when i click on the item then it is a wooden sword. Have someone a idea why?

How can i get the item which is currently in the enchantment table?
Reply
Thanks given by:
#7
There is a GetSlot() function.
Reply
Thanks given by:
#8
(01-20-2014, 03:05 AM)tonibm19 Wrote: There is a GetSlot() function.

I use this. But often when i put a sword into the enchantment table it returns -1 and not the item..
Code:
this->m_ParentWindow.GetSlot(a_Player, 0)->m_ItemType

2. Question:
How can i delete the property? because when you put the item out the enchantments should be away.

I tried:
Code:
this->m_ParentWindow.SetProperty(0, NULL);
        this->m_ParentWindow.SetProperty(1, NULL);
        this->m_ParentWindow.SetProperty(2, NULL);
Reply
Thanks given by:
#9
Enchanting Packet is also added to the 1.7 Protocol.
Reply
Thanks given by:
#10
try
this->m_ParentWindow.SetProperty(0, nil);
this->m_ParentWindow.SetProperty(1, nil);
this->m_ParentWindow.SetProperty(2, nil);
Reply
Thanks given by:




Users browsing this thread: 20 Guest(s)