Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[C++] Nap-Hold Elixírek tiltása adott mapindexen
#1
Thumbs Up 
Kérdezték tőlem privátban, hogy hogyan lehetne ezt megoldani, itt van rá egy megoldás.  Cool


char_item.cpp

Rákerestek erre:
Code:
                            case ITEM_AUTO_HP_RECOVERY_S:
                            case ITEM_AUTO_HP_RECOVERY_M:
                            case ITEM_AUTO_HP_RECOVERY_L:
                            case ITEM_AUTO_HP_RECOVERY_X:
                            case ITEM_AUTO_SP_RECOVERY_S:
                            case ITEM_AUTO_SP_RECOVERY_M:
                            case ITEM_AUTO_SP_RECOVERY_L:
                            case ITEM_AUTO_SP_RECOVERY_X:
                            // ą«˝Ăą«˝ĂÇĎÁö¸¸ ŔĚŔüżˇ ÇĎ´ř °É °íġ±â´Â ą«Ľ·°í...
                            // ±×·ˇĽ­ ±×łÉ Çϵĺ ÄÚµů. Ľ±ą° »óŔÚżë ŔÚµżą°ľŕ ľĆŔĚĹ۵é.
                            case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_XS:
                            case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_S:
                            case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_XS:
                            case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_S:
                            case FUCKING_BRAZIL_ITEM_AUTO_SP_RECOVERY_S:
                            case FUCKING_BRAZIL_ITEM_AUTO_HP_RECOVERY_S:

A case-ek alá kell ezt írni:
Code:
                                    /////////////////////////////////////////////
                                    if (GetMapIndex() == 113 || GetMapIndex() == 112) /////elixírek tiltása
                                    {
                                            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("elixir tiltas"));
                                            return false;
                                    }
                                    ////////////////////////////////////////////


A példámmal OX map-on tiltjuk az elixíreket, viszont kiegészíthető több mapindexre is.



Így fog kinézni (részlet):
Code:
                            case ITEM_AUTO_HP_RECOVERY_S:
                            case ITEM_AUTO_HP_RECOVERY_M:
                            case ITEM_AUTO_HP_RECOVERY_L:
                            case ITEM_AUTO_HP_RECOVERY_X:
                            case ITEM_AUTO_SP_RECOVERY_S:
                            case ITEM_AUTO_SP_RECOVERY_M:
                            case ITEM_AUTO_SP_RECOVERY_L:
                            case ITEM_AUTO_SP_RECOVERY_X:
                            // ą«˝Ăą«˝ĂÇĎÁö¸¸ ŔĚŔüżˇ ÇĎ´ř °É °íġ±â´Â ą«Ľ·°í...
                            // ±×·ˇĽ­ ±×łÉ Çϵĺ ÄÚµů. Ľ±ą° »óŔÚżë ŔÚµżą°ľŕ ľĆŔĚĹ۵é.
                            case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_XS:
                            case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_S:
                            case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_XS:
                            case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_S:
                            case FUCKING_BRAZIL_ITEM_AUTO_SP_RECOVERY_S:
                            case FUCKING_BRAZIL_ITEM_AUTO_HP_RECOVERY_S:
                                {
                                    if (CArenaManager::instance().IsArenaMap(GetMapIndex()) == true)
                                    {
                                        ChatPacket(CHAT_TYPE_INFO, LC_TEXT("´ë·ĂŔ忡Ľ­ »çżëÇĎ˝Ç Ľö ľř˝Ŕ´Ď´Ů."));
                                        return false;
                                    }
                                    
                                    /////////////////////////////////////////////
                                    switch(ch->GetMapIndex()) /////elixírek tiltása
                                    {
                                        case 113:  ///ox map
                                            
                                            ChatPacket(CHAT_TYPE_INFO, LC_TEXT("elixir tiltas"));
                                            return false;
                                    }
                                    ////////////////////////////////////////////

                                    EAffectTypes type = AFFECT_NONE;
                                    bool isSpecialPotion = false;

                                    switch (item->GetVnum())
                                    {
                                        case ITEM_AUTO_HP_RECOVERY_X:
                                            isSpecialPotion = true;

                                        case ITEM_AUTO_HP_RECOVERY_S:
                                        case ITEM_AUTO_HP_RECOVERY_M:
                                        case ITEM_AUTO_HP_RECOVERY_L:
                                        case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_XS:
                                        case REWARD_BOX_ITEM_AUTO_HP_RECOVERY_S:
                                        case FUCKING_BRAZIL_ITEM_AUTO_HP_RECOVERY_S:
                                            type = AFFECT_AUTO_HP_RECOVERY;
                                            break;

                                        case ITEM_AUTO_SP_RECOVERY_X:
                                            isSpecialPotion = true;

                                        case ITEM_AUTO_SP_RECOVERY_S:
                                        case ITEM_AUTO_SP_RECOVERY_M:
                                        case ITEM_AUTO_SP_RECOVERY_L:
                                        case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_XS:
                                        case REWARD_BOX_ITEM_AUTO_SP_RECOVERY_S:
                                        case FUCKING_BRAZIL_ITEM_AUTO_SP_RECOVERY_S:
                                            type = AFFECT_AUTO_SP_RECOVERY;
                                            break;
                                    }





locale_string.txt-be:
Code:
"elixir tiltas";
"Az elixírt nem használhatod ezen a területen!";


Üdv, Pisti95
[Image: 1453876818-b8928becdb9a3058b7c9ff22ccc5caf6.jpeg]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)