• 01-04.05.2026 - DOUBLE EXP / SKILL EVENT!

7.6+ Spell Book

Status
Zamknięty.

MiZ

User
Zarejestrowany
Dołączył
Marzec 3, 2011
Posty
13
Liczba reakcji
0
Witam :)
Nigdzie na 4um nie widzia?em tego Kodu C++ "Spell Book" wi?c go dodaje.
W const76.h pod:
[highlight=cpp]enum item_t
{[/highlight]
dodaj:
[highlight=cpp]ITEM_SPELL_BOOK = 2175;[/highlight]
Game.cpp
pod:
[highlight=cpp]extern std::vector< std::pair<unsigned long, unsigned long> > bannedIPs;[/highlight]
dodaj:
[highlight=cpp]typedef std::vector<std::string> StringVector;[/highlight]
Powy?ej:
[highlight=cpp]actions.UseItem(player,pos,stackpos,itemid,index);
[/highlight]
dodaj:
[highlight=cpp]if(itemid == ITEM_SPELL_BOOK){
if(((abs(player->pos.x - pos.x) > 1) || (abs(player->pos.y - pos.y) > 1) || (player->pos.z != pos.z)) && player->access < ACCESSLVL_GM){
player->sendCancel("Sorry, not possible.");
return false;
}
else if(setSpellbookText(player, item))
return true;
}[/highlight]
Dodaj na Botton:
[highlight=cpp]bool Game::setSpellbookText(Player* player, Item* item)
{
std::stringstream text;
item->setText("");
for(StringVector::iterator it = player->learnedSpells.begin(); it != player->learnedSpells.end(); ++it){
if(it != player->learnedSpells.end()){
std::map<std::string, Spell*>* tmp = spells.getAllSpells();
if(tmp){
std::map<std::string, Spell*>::iterator sit = tmp->find((*it));
if(sit != tmp->end()){
InstantSpell* instant = dynamic_cast<InstantSpell*>(sit->second);
if(instant){
text << "\'" << instant->getName() << "' · \'" << instant->getWords() << "\' · mana: " << instant->getMana() << " · level: " << instant->getMagLv();
text << "\n";
}
}
}
}
}
item->setText(text.str());
player->sendTextWindow(item, strlen(text.str().c_str()), true);
return true;
}[/highlight]
Game.h
pod:
[highlight=cpp]~Game();[/highlight]
dodaj:
[highlight=cpp]bool setSpellbookText(Player* player, Item* item);[/highlight]
Autor - SpellBook.
Pozdrawia
MiZ
 
Status
Zamknięty.
Back
Do góry