Форум администраторов игровых серверов

Форум администраторов игровых серверов (https://forum.zone-game.info/TT.php)
-   Работа со скриптами (https://forum.zone-game.info/forumdisplay.php?f=37)
-   -   Глобальный вопрос (https://forum.zone-game.info/showthread.php?t=24834)

CreazyGreen 11.12.2012 19:26

Re: Глобальный вопрос
 
Цитата:

Сообщение от Zubastic (Сообщение 253727)
Вон вам зашарили исходники, берите и пилите их.

Где??? )))

CreazyGreen 15.12.2012 04:18

Re: Глобальный вопрос
 
Доброй ночи если так можно сказать в 5 утра) в продолжение темы есть один тот же вопросик, вот java эффекта купола, как исключить наложение купала на двери? Если не трудно покажите пожалуйста кодом

/*     */ package l2p.gameserver.skills.effects;
/*     */ 
/*     */ import java.util.logging.Logger;
/*     */ import l2p.gameserver.ai.CtrlEvent;
/*     */ import l2p.gameserver.ai.L2CharacterAI;
/*     */ import l2p.gameserver.cache.Msg;
/*     */ import l2p.gameserver.geodata.GeoEngine;
/*     */ import l2p.gameserver.model.EffectList;
/*     */ import l2p.gameserver.model.L2Character;
/*     */ import l2p.gameserver.model.L2Effect;
/*     */ import l2p.gameserver.model.L2Player;
/*     */ import l2p.gameserver.model.L2RoundTerritoryWithSkill;
/*     */ import l2p.gameserver.model.L2Skill;
/*     */ import l2p.gameserver.model.L2Skill.SkillTargetType;
/*     */ import l2p.gameserver.model.L2Spawn;
/*     */ import l2p.gameserver.model.L2World;
/*     */ import l2p.gameserver.model.Reflection;
/*     */ import l2p.gameserver.model.instances.L2NpcInstance;
/*     */ import l2p.gameserver.serverpackets.L2GameServerPacket;
/*     */ import l2p.gameserver.serverpackets.MagicSkillLaunched;
/*     */ import l2p.gameserver.skills.Env;
/*     */ import l2p.gameserver.tables.NpcTable;
/*     */ import l2p.gameserver.templates.L2NpcTemplate;
/*     */ import l2p.util.GArray;
/*     */ import l2p.util.Location;
/*     */ 
/*     */ public final class EffectSymbol extends L2Effect
/*     */ {
/*  25 */   private static final Logger log = Logger.getLogger(EffectSymbol.class.getName());
/*     */   L2RoundTerritoryWithSkill _territory;
/*     */   L2NpcInstance _symbol;
/*     */ 
/*     */   public EffectSymbol(Env env, EffectTemplate template)
/*     */   {
/*  31 */     super(env, template);
/*     */   }
/*     */ 
/*     */   public boolean checkCondition()
/*     */   {
/*  37 */     if (getSkill().getTargetType() != L2Skill.SkillTargetType.TARGET_SELF)
/*     */     {
/*  39 */       log.severe("Symbol skill with target != self, id = " + getSkill().getId());
/*  40 */       return false;
/*     */     }
/*  42 */     L2Skill skill = getSkill().getFirstAddedSkill();
/*  43 */     if (skill == null)
/*     */     {
/*  45 */       log.severe("Not implemented symbol skill, id = " + getSkill().getId());
/*  46 */       return false;
/*     */     }
/*  48 */     return super.checkCondition();
/*     */   }
/*     */ 
/*     */   public void onStart()
/*     */   {
/*  54 */     super.onStart();
/*  55 */     L2Skill skill = getSkill().getFirstAddedSkill();
/*     */ 
/*  57 */     skill.setIsMagic(getSkill().isMagic());
/*  58 */     Location loc = this._effected.getLoc();
/*  59 */     if ((this._effected.isPlayer()) && (((L2Player)this._effected).getGroundSkillLoc() != null))
/*     */     {
/*  61 */       loc = ((L2Player)this._effected).getGroundSkillLoc();
/*  62 */       ((L2Player)this._effected).setGroundSkillLoc(null);
/*     */     }
/*  64 */     this._territory = new L2RoundTerritoryWithSkill(this._effected.getObjectId(), loc.x, loc.y, this._skill.getSkillRadius(), loc.z - 200, loc.z + 200, this._effector, skill);
/*  65 */     L2World.addTerritory(this._territory);
/*  66 */     L2NpcTemplate template = NpcTable.getTemplate(this._skill.getSymbolId());
/*     */     try
/*     */     {
/*  69 */       L2Spawn spawn = new L2Spawn(template);
/*  70 */       spawn.setLoc(loc);
/*  71 */       spawn.setReflection(this._effected.getReflection().getId());
/*  72 */       spawn.setAmount(1);
/*  73 */       spawn.init();
/*  74 */       spawn.stopRespawn();
/*  75 */       this._symbol = spawn.getLastSpawn();
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/*  79 */       e.printStackTrace();
/*     */     }
/*  81 */     for (L2Character cha : L2World.getAroundCharacters(this._symbol, this._skill.getSkillRadius() + 200, 400))
/*     */     {
/*  83 */       cha.updateTerritories();
/*     */     }
/*     */   }
/*     */ 
/*     */   public void onExit()
/*     */   {
/*  90 */     super.onExit();
/*  91 */     L2World.removeTerritory(this._territory);
/*  92 */     if (this._symbol == null)
/*     */     {
/*  94 */       return;
/*     */     }
/*  96 */     for (L2Character cha : L2World.getAroundCharacters(this._symbol, this._skill.getSkillRadius() + 200, 400))
/*     */     {
/*  98 */       cha.updateTerritories();
/*     */     }
/* 100 */     this._symbol.deleteMe();
/* 101 */     this._symbol = null;
/*     */   }
/*     */ 
/*     */   public boolean onActionTime()
/*     */   {
/* 107 */     if (this._template._counter <= 1)
/*     */     {
/* 109 */       return false;
/*     */     }
/* 111 */     L2Character effector = getEffector();
/* 112 */     L2Skill skill = getSkill().getFirstAddedSkill();
/* 113 */     L2NpcInstance symbol = this._symbol;
/* 114 */     double mpConsume = getSkill().getMpConsume();
/* 115 */     if ((effector == null) || (skill == null) || (symbol == null))
/*     */     {
/* 117 */       return false;
/*     */     }
/* 119 */     if (mpConsume > effector.getCurrentMp())
/*     */     {
/* 121 */       effector.sendPacket(new L2GameServerPacket[] { Msg.NOT_ENOUGH_MP });
/* 122 */       return false;
/*     */     }
/* 124 */     effector.reduceCurrentMp(mpConsume, effector);
/*     */ 
/* 126 */     for (L2Character cha : L2World.getAroundCharacters(symbol, getSkill().getSkillRadius(), 200))
/*     */     {
/* 128 */       if ((cha.getEffectList().getEffectsBySkill(skill) == null) && (skill.checkTarget(effector, cha, cha, false, false) == null))
/*     */       {
/* 130 */         if ((!skill.isOffensive()) || (GeoEngine.canSeeTarget(symbol, cha, false)))
/*     */         {
/* 134 */           GArray targets = new GArray(1);
/* 135 */           targets.add(cha);
/* 136 */           effector.callSkill(skill, targets, false);
/* 137 */           effector.broadcastPacket(new L2GameServerPacket[] { new MagicSkillLaunched(this._symbol.getObjectId(), getSkill().getDisplayId(), getSkill().getDisplayLevel(), cha, true) });
/* 138 */           cha.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, effector, Integer.valueOf(1));
/*     */         }
/*     */       }
/*     */     }
/* 141 */     return true;
/*     */   }
/*     */ }
Code: Java

CreazyGreen 16.12.2012 14:06

Re: Глобальный вопрос
 
Что не кто из ява монстров форума не знает? или не хочет раскрывать свои тайны)) пипол подскажи плз вопрос очень волнует! заранее всем биг спс!

Zubastic 16.12.2012 16:01

Re: Глобальный вопрос
 
Посмотрел еще раз.
По идее двери вообще не должны браться. Проверяй это место.
/* 126 */     for (L2Character cha : L2World.getAroundCharacters(symbol, getSkill().getSkillRadius(), 200))
/*     */     {
/* 128 */       if ((cha.getEffectList().getEffectsBySkill(skill) == null) && (skill.checkTarget(effector, cha, cha, false, false) == null))
/*     */       {
/* 130 */         if ((!skill.isOffensive()) || (GeoEngine.canSeeTarget(symbol, cha, false)))
/*     */         {
/* 134 */           GArray targets = new GArray(1);
/* 135 */           targets.add(cha);
/* 136 */           effector.callSkill(skill, targets, false);
/* 137 */           effector.broadcastPacket(new L2GameServerPacket[] { new MagicSkillLaunched(this._symbol.getObjectId(), getSkill().getDisplayId(), getSkill().getDisplayLevel(), cha, true) });
/* 138 */           cha.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, effector, Integer.valueOf(1));
/*     */         }
/*     */       }
/*     */     }
Code: Java


Текущее время: 20:19. Часовой пояс GMT +3.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd. Перевод: zCarot