UID194640
帖子
精華
主題
積分16180
現金
積極性
威望
違規
熱心
推廣次數
閱讀權限30
註冊時間2009-9-5
在線時間 小時
最後登錄1970-1-1
TA的每日心情 | 開心 2020-10-27 09:10 PM |
---|
簽到天數: 2555 天 連續簽到: 1 天 [LV.Master]伴壇終老
|
樓主 |
發表於 2011-7-29 20:33:38
|
顯示全部樓層
回復 he01204046
哪個沒效果=.=?
我弄好像有呢
rgrg1234 發表於 2011-7-29 02:29 PM
我照你說的方式打...測試就是沒效果...附上程式碼- int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, clr_type clrtype)
- {
- struct party_data *p;
- int m;
- + struct s_mapiterator* i_pc = mapit_getallusers();
- + TBL_PC* pl_sd;
- nullpo_ret(sd);
- if( !mapindex || !mapindex_id2name(mapindex) )
- {
- ShowDebug("pc_setpos: Passed mapindex(%d) is invalid!\n", mapindex);
- return 1;
- }
- if( pc_isdead(sd) )
- { //Revive dead people before warping them
- pc_setstand(sd);
- pc_setrestartvalue(sd,1);
- }
- m = map_mapindex2mapid(mapindex);
- if( map[m].flag.src4instance && sd->status.party_id && (p = party_search(sd->status.party_id)) != NULL && p->instance_id )
- {
- // Request the mapid of this src map into the instance of the party
- int im = instance_map2imap(m, p->instance_id);
- if( im < 0 )
- ; // Player will enter the src map for instances
- else
- { // Changes destiny to the instance map, not the source map
- m = im;
- mapindex = map_id2index(m);
- }
- }
- sd->state.changemap = (sd->mapindex != mapindex);
- if( sd->state.changemap )
- { // Misc map-changing settings
- sd->state.pmap = sd->bl.m;
- if (sd->sc.count)
- { // Cancel some map related stuff.
- if (sd->sc.data[SC_JAILED])
- return 1; //You may not get out!
- status_change_end(&sd->bl, SC_MIRACLE, INVALID_TIMER);
- status_change_end(&sd->bl, SC_BOSSMAPINFO, INVALID_TIMER);
- status_change_end(&sd->bl, SC_WARM, INVALID_TIMER);
- status_change_end(&sd->bl, SC_NEUTRALBARRIER_MASTER, INVALID_TIMER);
- status_change_end(&sd->bl, SC_NEUTRALBARRIER, INVALID_TIMER);
- status_change_end(&sd->bl, SC_STEALTHFIELD_MASTER, INVALID_TIMER);
- status_change_end(&sd->bl, SC_STEALTHFIELD, INVALID_TIMER);
- status_change_end(&sd->bl, SC_SUN_COMFORT, INVALID_TIMER);
- status_change_end(&sd->bl, SC_MOON_COMFORT, INVALID_TIMER);
- status_change_end(&sd->bl, SC_STAR_COMFORT, INVALID_TIMER);
- if (sd->sc.data[SC_KNOWLEDGE]) {
- struct status_change_entry *sce = sd->sc.data[SC_KNOWLEDGE];
- if (sce->timer != INVALID_TIMER)
- delete_timer(sce->timer, status_change_timer);
- sce->timer = add_timer(gettick() + skill_get_time(SG_KNOWLEDGE, sce->val1), status_change_timer, sd->bl.id, SC_KNOWLEDGE);
- }
- if (sd->sc.data[SC__SHADOWFORM])
- {
- struct map_session_data *s_sd = map_id2sd(sd->sc.data[SC__SHADOWFORM]->val2);
- if( s_sd )
- s_sd->shadowform_id = 0;
- status_change_end(&sd->bl,SC__SHADOWFORM,-1);
- }
- if (sd->sc.data[SC_CURSEDCIRCLE_ATKER])
- status_change_end(&sd->bl,SC_CURSEDCIRCLE_ATKER,-1);
- }
- if( sd->shadowform_id )
- {
- struct block_list *s_bl = map_id2bl(sd->shadowform_id);
- if( s_bl ) status_change_end(s_bl,SC__SHADOWFORM,-1);
- sd->shadowform_id = 0;
- }
- if (battle_config.clear_unit_onwarp&BL_PC)
- skill_clear_unitgroup(&sd->bl);
- party_send_dot_remove(sd); //minimap dot fix [Kevin]
- guild_send_dot_remove(sd);
- bg_send_dot_remove(sd);
- if (sd->regen.state.gc)
- sd->regen.state.gc = 0;
- }
- if( m < 0 )
- {
- uint32 ip;
- uint16 port;
- //if can't find any map-servers, just abort setting position.
- if(!sd->mapindex || map_mapname2ipport(mapindex,&ip,&port))
- return 2;
- if (sd->npc_id)
- npc_event_dequeue(sd);
- npc_script_event(sd, NPCE_LOGOUT);
- //remove from map, THEN change x/y coordinates
- unit_remove_map_pc(sd,clrtype);
- sd->mapindex = mapindex;
- sd->bl.x=x;
- sd->bl.y=y;
- pc_clean_skilltree(sd);
- chrif_save(sd,2);
- chrif_changemapserver(sd, ip, (short)port);
- //Free session data from this map server [Kevin]
- unit_free_pc(sd);
- return 0;
- }
- if( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
- {
- ShowError("pc_setpos: attempt to place player %s (%d:%d) on invalid coordinates (%s-%d,%d)\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(mapindex),x,y);
- x = y = 0; // make it random
- }
- if( x == 0 && y == 0 )
- {// pick a random walkable cell
- do {
- x=rand()%(map[m].xs-2)+1;
- y=rand()%(map[m].ys-2)+1;
- } while(map_getcell(m,x,y,CELL_CHKNOPASS));
- }
- if(sd->bl.prev != NULL){
- unit_remove_map_pc(sd,clrtype);
- clif_changemap(sd,map[m].index,x,y); // [MouseJstr]
- } else if(sd->state.active)
- //Tag player for rewarping after map-loading is done. [Skotlex]
- sd->state.rewarp = 1;
-
- sd->mapindex = mapindex;
- sd->bl.m = m;
- sd->bl.x = sd->ud.to_x = x;
- sd->bl.y = sd->ud.to_y = y;
- if( sd->status.guild_id > 0 && map[m].flag.gvg_castle )
- { // Increased guild castle regen [Valaris]
- struct guild_castle *gc = guild_mapindex2gc(sd->mapindex);
- if(gc && gc->guild_id == sd->status.guild_id)
- sd->regen.state.gc = 1;
- }
- if( sd->status.pet_id > 0 && sd->pd && sd->pd->pet.intimate > 0 )
- {
- sd->pd->bl.m = m;
- sd->pd->bl.x = sd->pd->ud.to_x = x;
- sd->pd->bl.y = sd->pd->ud.to_y = y;
- sd->pd->ud.dir = sd->ud.dir;
- }
- if( merc_is_hom_active(sd->hd) )
- {
- sd->hd->bl.m = m;
- sd->hd->bl.x = sd->hd->ud.to_x = x;
- sd->hd->bl.y = sd->hd->ud.to_y = y;
- sd->hd->ud.dir = sd->ud.dir;
- }
- if( sd->md )
- {
- sd->md->bl.m = m;
- sd->md->bl.x = sd->md->ud.to_x = x;
- sd->md->bl.y = sd->md->ud.to_y = y;
- sd->md->ud.dir = sd->ud.dir;
- + for( pl_sd = (TBL_PC*)mapit_first(i_pc); mapit_exists(i_pc); pl_sd = (TBL_PC*)mapit_next(i_pc) )
- + status_calc_pc(pl_sd,0);
- }
- if( sd->ed )
- {
- sd->ed->bl.m = m;
- sd->ed->bl.x = sd->ed->ud.to_x = x;
- sd->ed->bl.y = sd->ed->ud.to_y = y;
- sd->ed->ud.dir = sd->ud.dir;
- }
- return 0;
- }
複製代碼 |
|