Before you do this, it's best if you backup your files just in case.
I heard that there were a few requests for scrolling in Rev 7 so here it is:
Add this to the bottom of InventoryPacket.cpp:
Add this in Initializing.cpp:Code:void InventoryPacket::useScroll(Player* player, vector <Player*> players, char s){ Packet packet = Packet(); packet.addHeader(0x7A); packet.addInt(player->getPlayerid()); packet.addInt(s); packet.sendTo(player, players, 1); }After:Code:else if(strcmp("moveTo", pCur->Value()) == 0){ cons.moveTo = strval((char*)pCur->GetText()); } else if(strcmp("success", pCur->Value()) == 0){ cons.success = strval((char*)pCur->GetText()); } else if(strcmp("cursed", pCur->Value()) == 0){ cons.cursed = strval((char*)pCur->GetText()); } else if(strcmp("iSTR", pCur->Value()) == 0){ cons.istr = strval((char*)pCur->GetText()); } else if(strcmp("iDEX", pCur->Value()) == 0){ cons.idex = strval((char*)pCur->GetText()); } else if(strcmp("iINT", pCur->Value()) == 0){ cons.iint = strval((char*)pCur->GetText()); } else if(strcmp("iLUK", pCur->Value()) == 0){ cons.iluk = strval((char*)pCur->GetText()); } else if(strcmp("iHP", pCur->Value()) == 0){ cons.ihp = strval((char*)pCur->GetText()); } else if(strcmp("iMP", pCur->Value()) == 0){ cons.imp = strval((char*)pCur->GetText()); } else if(strcmp("iWAtk", pCur->Value()) == 0){ cons.iwatk = strval((char*)pCur->GetText()); } else if(strcmp("iMAtk", pCur->Value()) == 0){ cons.imatk = strval((char*)pCur->GetText()); } else if(strcmp("iWDef", pCur->Value()) == 0){ cons.iwdef = strval((char*)pCur->GetText()); } else if(strcmp("iMDef", pCur->Value()) == 0){ cons.imdef = strval((char*)pCur->GetText()); } else if(strcmp("iAcc", pCur->Value()) == 0){ cons.iacc = strval((char*)pCur->GetText()); } else if(strcmp("iAvo", pCur->Value()) == 0){ cons.iavo = strval((char*)pCur->GetText()); } else if(strcmp("iHand", pCur->Value()) == 0){ cons.ihand = strval((char*)pCur->GetText()); } else if(strcmp("iJump", pCur->Value()) == 0){ cons.ijump = strval((char*)pCur->GetText()); } else if(strcmp("iSpeed", pCur->Value()) == 0){ cons.ispeed = strval((char*)pCur->GetText()); }Add this to InventoryPacket.h:Code:else if(strcmp("MPR", pCur->Value()) == 0){ cons.mpr = strval((char*)pCur->GetText()); }
Add this to Player.cpp under Player::handleRequest :Code:static void useScroll(Player* player, vector <Player*> players, char s);
Find your struct ConsumeInfo code in Drops.h and replace it with this:Code:case 0x65: Inventory::useScroll(this, buf+2); break;
Add this to the bottom of Inventory.cpp:Code:struct ConsumeInfo { short hp; short mp; short hpr; short mpr; int moveTo; int success; int cursed; short istr; short idex; short iint; short iluk; short ihp; short imp; short iwatk; short imatk; short iwdef; short imdef; short iacc; short iavo; short ihand; short ijump; short ispeed; };
Add this to Inventory.h:Code:void Inventory::useScroll(Player* player, unsigned char* packet){ short slot = getShort(packet+4); short eslot = getShort(packet+6); int itemid=0; Equip* equip = NULL; for(int i=0; i<player->inv->getItemNum(); i++){ if(player->inv->getItem(i)->pos == slot && player->inv->getItem(i)->inv == 2) { itemid = player->inv->getItem(i)->id; break; } } for(int i=0; i<player->inv->getEquipNum(); i++){ if(player->inv->getEquip(i)->pos == eslot) { equip = player->inv->getEquip(i); break; } } bool cursed=false; if(itemid == 0 || equip == NULL) return; if(equip->slots > 0){ if(Drops::items.find(itemid) == Drops::items.end()) return; takeItemSlot(player, slot, 2, 1); equip->slots--; if(rand()%100<Drops::consumes[itemid].success){ InventoryPacket::useScroll(player, Maps::info[player->getMap()].Players ,true); equip->istr+=Drops::consumes[itemid].istr; equip->idex+=Drops::consumes[itemid].idex; equip->iint+=Drops::consumes[itemid].iint; equip->iluk+=Drops::consumes[itemid].iluk; equip->ihp+=Drops::consumes[itemid].ihp; equip->imp+=Drops::consumes[itemid].imp; equip->iwatk+=Drops::consumes[itemid].iwatk; equip->imatk+=Drops::consumes[itemid].imatk; equip->iwdef+=Drops::consumes[itemid].iwdef; equip->imdef+=Drops::consumes[itemid].imdef; equip->iacc+=Drops::consumes[itemid].iacc; equip->iavo+=Drops::consumes[itemid].iavo; equip->ihand+=Drops::consumes[itemid].ihand; equip->ijump+=Drops::consumes[itemid].ijump; equip->ispeed+=Drops::consumes[itemid].ispeed; equip->scrolls++; } else{ if(rand()%100<Drops::consumes[itemid].cursed){ cursed = true; for(int i=0; i<player->inv->getEquipNum(); i++){ if(player->inv->getEquip(i)->pos == eslot){ InventoryPacket::moveItem(player, 1, eslot, 0); player->inv->deleteEquip(i); break; } } } InventoryPacket::useScroll(player, Maps::info[player->getMap()].Players , false); } } if(!cursed) InventoryPacket::addEquip(player, equip, 1); InventoryPacket::updatePlayer(player); }
And finally, download Rev 8 and copy the Items folder to your Rev 7 folder so that you get the new scroll files.Code:static void useScroll(Player* player, unsigned char* packet);
And that's it. Build and it should work.. if you get errors, try to reread this closely or make sure you didnt do copy errors.
All credits to KoolK for TitanMS and this scrolling code in Rev 8! I just took the code and refined it to be put into Rev 7.





