Vahsi Uzman 1
Vahsi Uzman
kralhakan2009 1
kralhakan2009
farkmt2official 1
farkmt2official
Bvural41 1
Bvural41
Fethi Polat 1
Fethi Polat
Scarlet 1
Scarlet
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Hikaye Ekle

[C++ - Python]Ingame Channel Game Uzerinden | rMelih

  • Konuyu başlatan Konuyu başlatan rMelih
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 13
  • Görüntüleme Görüntüleme 4K
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Ayyıldız2 | 2008 TR Yapısı • 1-99 Orta Emek Destan • Oto Avsız • 10 Temmuz 21:00 HEMEN TIKLA!

Oncelikle merhaba iyi forumlar,yabancı forumda gördügüm Hızlı Kanal Degistirme Sistemini Paylasacagim.Sistem game'nize göre calıstıgı ıcın sorunsuzdur.

Not: Önceden paylasıldıysa söyleyin editliyeyim.Bu aralar yogunum paylaşılan konulara bakmaya fırsatım olmuyor.

game/src > cmd.cpp acilir aratilir :

Kod:
ACMD(do_warp);

altina eklenir:

Kod:
ACMD(do_channel_switch);

tekrar aratılır:

Kod:
{ "mall_close",    do_mall_close,        0,            POS_DEAD,    GM_PLAYER    },

altina eklenir :

Kod:
{ "channel",        do_channel_switch,        0,            POS_DEAD,    GM_PLAYER    },


game/src > cmd_general.cpp acilir ve aratilir :

Kod:
ACMD(do_set_run_mode)
Kod:
        {
            ch->SetNowWalking(false);
            ch->SetWalking(false);
[CENTER]        }[/CENTER]


altina eklenir

Kod:
ACMD(do_channel_switch)
Kod:
        {
    
            char arg1[256];
            one_argument(argument, arg1, sizeof(arg1));


            if (!*arg1)
                    return;
            
            int new_ch;
            str_to_number(new_ch, arg1);
            if( new_ch <1 || new_ch >4)   // REPLACE 2 WITH YOUR MAX_CHANNEL 
                return;
            if (!ch->IsPC())
                return;
            ch->ChannelSwitch(new_ch);
            
[CENTER]        }[/CENTER]


game/src > char.h acilir ve aratilir :
Kod:
void                StartWarpNPCEvent();

altina eklenir :

Kod:
void                            ChannelSwitch(int new_ch);


game/src > char.cpp acilir ve aratilir:


Kod:
EVENTFUNC(warp_npc_event)
Kod:
        {
            char_event_info* info = dynamic_cast<char_event_info*>( event->info );
            if ( info == NULL )
            {
                sys_err( "warp_npc_event> <Factor> Null pointer" );
                return 0;
            }


            LPCHARACTER    ch = info->ch;


            if (ch == NULL) { // <Factor>
                return 0;
            }    


            if (!ch->GetSectree())
            {
                ch->m_pkWarpNPCEvent = NULL;
                return 0;
            }


            FuncCheckWarp f(ch);
            if (f.Valid())
                ch->GetSectree()->ForEachAround(f);


            return passes_per_sec / 2;
[CENTER]        }[/CENTER]


altina eklenir :

Kod:
void CHARACTER::ChannelSwitch(int new_ch){
Kod:
            long lAddr;
            long lMapIndex;
            WORD wPort;
            long x = this->GetX();
            long y = this->GetY();


            if (!CMapLocation::instance().Get(x, y, lMapIndex, lAddr, wPort))
            {
                    sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName());
                    return;
            }
            if(lMapIndex >= 10000){
                return;
            }
            
            std::map<WORD, int>micha;
            
            for(int i = 0; i < 4; i++){ //replace with maximum channels -1   actual 1300x - 1330x
                for(int i2 = 2; i2 < 9; i2++){ //replace with your core values actual  13x02 - 13x08
                    micha[13*1000 + i*100 + i2] = i+1;
                }        
            }
            //micha[13002] = 1;
            int chan;
            if(micha.find(wPort) != micha.end()){
                chan = micha[wPort];
            }else{return;}
            Stop();
            Save();
            
            if(GetSectree()){
                GetSectree()->RemoveEntity(this);
                ViewCleanup();
                EncodeRemovePacket(this);
            }
            TPacketGCWarp p;


            p.bHeader    = HEADER_GC_WARP;
            p.lX    = x;
            p.lY    = y;
            p.lAddr    = lAddr;
            p.wPort    = (wPort - 100*(chan-1) + 100*(new_ch-1));
            
            sys_err("x : %d y: %d, addr: %d, port: %d , newPort: %d", x, y, lAddr, wPort, (wPort - 100*chan + 100*new_ch));


            GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
[CENTER]        }[/CENTER]

source ile işimiz bitti simdi gecelim client'e.

root > game.py acilir ve aratilir :
Kod:
onPressKeyDict[app.DIK_F4]    = lambda : self.__PressQuickSlot(7)

altina eklenir :

Kod:
onPressKeyDict[app.DIK_F7]    = lambda : self.__switch_channel()


game.py'nin en altına gelip eklenir :
Kod:
def __switch_channel(self):[/CENTER]
        import uiChannel
        a = uiChannel.ChannelChanger()
[CENTER]        a.Show()

ve
uiChannel.py root'un icine atilir bu kadar.

Teşekkürler.

İndir :
Kod:
http://dosya.co/qdvbhrintrq1/H%C4%B1zl%C4%B1_Kanal_rMelih.rar.html
Kod:
https://www.virustotal.com/tr/url/50770556cf40f2cf11a22aae991476cbfb48c83470d7f4f143e9f18aa2e7bef4/analysis/1458584484/
 

En Çok Reaksiyon Alan Mesajlar

konudakini biraz düzeltmeye çalıştım ama denemedim.
Kod:
void CHARACTER::ChannelSwitch(int iNewChannel)
{
	if (!GetDesc())
		return;


	long lAddr, lMapIndex;
	long x = GetX(); long y = GetY();  
	WORD wPort;
	
	if (!CMapLocation::Instance().Get(x, y, lMapIndex, lAddr, wPort)) {
	    sys_err("cannot find map location index %d x %d y %d name %s", lMapIndex, x, y, GetName());
	    return;
	}
	
	if (lMapIndex >= 10000)
		return;
	
	int iNewPort = 0;
	int iPorts[] = { 1000, 2000, 3000, 4000 };
	for (int i = 0; i < sizeof(iPorts)/sizeof(iPorts[0]); i++) {
		if (iNewChannel == i + 1){
			iNewPort = iPorts[i];
			break;
		}
	}


	if (!iNewPort)
	    return;
		
	Stop();
	Save();
	
	if (GetSectree()) {
	    GetSectree()->RemoveEntity(this);
	    ViewCleanUp();
	    EncodeRemovePacket(this);
	}
	
	TPacketGCWarp p;
	p.bHeader 	= HEADER_GC_WARP;
	p.lX 		= x;
	p.lY 		= y;
	p.lAddr		= lAddr;
	p.wPort		= iNewPort;
	
	GetDesc()->Packet(&p, sizeof(TPacketGCWarp));
}


Daha önce paylaştığım sorunsuz olan;
Öğeyi görmek için üye olmalısınız.
Bunda ch düşme sorunu vardı sanırsam yazın birisi ch düşürmenin nasıl yapıldığını paylaşmıştı kapatmışlardı konuyu paylaşan kişi ikinizden birisiydi sanırım :D @ZacqooLeaven; @blackdragonx61; @Emrah Kartal;

Edit : En sağlam ch değiştiriciyi Koray abi paylaştı sayfalarda arayıp bulabilirsiniz rubinumum kullandığı sanırım. @pasha37b;
 
Son düzenleme:
Durum
Üzgünüz bu konu cevaplar için kapatılmıştır...

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst