- Mesaj
- 438
- Çözümler
- 42
- Beğeni
- 213
- Puan
- 844
- Ticaret Puanı
- 0
Linkleri görebilmek için
giriş yap veya kayıt ol.
Linkleri görebilmek için
giriş yap veya kayıt ol.
Kaynak: Polonya metin2 forumu.
Görsel büyük oldugu için konuya dahil edememişsin
bir sıkıntı oluşmadı hatta tıkladığın slottan önceki slotlara item bile koymuyor baya kullanışlı bir sistem olmuş@kaydadeger envanter doluyken aynı işlemi yapmayı dener misiniz? Sadece bir slot boş kalsın.
//char_item.cpp icinde bulun
for (WORD i = index; i < INVENTORY_MAX_NUM; ++i)
if (IsEmptyItemGrid(TItemPos(INVENTORY, i), size))
return i;
//hemen asagisina ekleyin:
for (WORD i = index; i >= 0; --i)
if (IsEmptyItemGrid(TItemPos(INVENTORY, i), size))
return i;
#char.h dosyasinda asagidaki satiri bulun
int GetEmptyInventoryFromIndex(WORD index, BYTE size) const;
#asagisina ekleyin
int GetEmptyInventoryFromIndexBackwards(WORD Index, BYTE size) const;
#char_item.cpp dosyasinda asagidaki fonksiyonu bulun
int CHARACTER::GetEmptyInventoryFromIndex(WORD index, BYTE size) const
#bu fonksiyonun hemen bitimine asagidaki fonksiyonu ekleyin
int CHARACTER::GetEmptyInventoryFromIndexBackwards(WORD index, BYTE size) const
{
if (index <= 0)
return -1;
for (WORD i = index; i >= 0; --i)
if (IsEmptyItemGrid(TItemPos(INVENTORY, i), size))
return i;
return -1;
}
#cmd_general.cpp dosyasinda asagidaki satiri bulun
ACMD(do_split_items)
#asagidaki kodla degistirin
ACMD(do_split_items)
{
if (!ch)
return;
const char* command;
char arg1[256], arg2[256], arg3[256];
command = two_arguments(argument, arg1, sizeof(arg1), arg2, sizeof(arg2));
one_argument(command, arg3, sizeof(arg3));
if (!*arg1 || !*arg2 || !*arg3)
{
ch->ChatPacket(CHAT_TYPE_INFO, "ERROR: WRONG COMMAND USE! PLEASE REPORT THIS TO A GM!");
return;
}
if (!ch->CanWarp())
{
ch->ChatPacket(CHAT_TYPE_INFO, "Wait a few seconds before using this!");
return;
}
WORD originalCell;
WORD count;
WORD startingCell;
str_to_number(originalCell, arg1);
str_to_number(count, arg2);
str_to_number(startingCell, arg3);
LPITEM item = ch->GetInventoryItem(originalCell);
if (item != NULL)
{
WORD itemCount = item->GetCount();
WORD lastEmptyCell = startingCell;
BYTE searchForward = 1;
int emptyPos;
while (itemCount > 0)
{
if (searchForward == 1)
{
emptyPos = ch->GetEmptyInventoryFromIndex(lastEmptyCell, item->GetSize());
if (emptyPos == -1)
{
searchForward = 0;
lastEmptyCell = startingCell;
}
}
if (searchForward == 0)
{
emptyPos = ch->GetEmptyInventoryFromIndexBackwards(lastEmptyCell, item->GetSize());
if (emptyPos == -1)
{
ch->ChatPacket(CHAT_TYPE_INFO, "INVENTORY IS FULL");
break;
}
}
if (ch->MoveItem(TItemPos(INVENTORY, originalCell), TItemPos(INVENTORY, emptyPos), count))
{
itemCount -= count;
//This is where our original item has less item count than the number we are substracting everytime
//This means we need to determine if we are gonna do a swapping
//After doing a swapping we simply exit from the function
if (count > itemCount)
{
//FORWARD SWAPPING CONDITION
if (searchForward == 1 && (originalCell > startingCell) && (emptyPos > originalCell))
{
ch->MoveItem(TItemPos(INVENTORY, emptyPos), TItemPos(INVENTORY, originalCell), (count - itemCount));
return;
}
//BACKWARD SWAPPING CONDITION
if (searchForward == 0 && (originalCell > emptyPos))
{
ch->MoveItem(TItemPos(INVENTORY, emptyPos), TItemPos(INVENTORY, originalCell), (count - itemCount));
return;
}
//If not doing any swapping make sure that amount of item we will carry is equal to our itemcount
count = itemCount;
}
}
else
{
ch->ChatPacket(CHAT_TYPE_INFO, "ERROR WHEN MOVING ITEM");
return;
}
lastEmptyCell = emptyPos;
}
}
}
sistemi kurdum ama neden tepki yok
vermiyorsyserr.txt?