if(d != null) { wpreloadtime = getWeaponReloadTime(d.reloadtime); int wid = psd.abilityVal(23); if(wid > 0) restoreWeapons(wid); else restoreWeapons(); } pvd = new PlayerViewData(); if(uiavatarenabled) pvd.set(thead, tface, tbody, tdeco, accs, tskin); else pvd.set(i.head, i.face, i.body, i.deco, accs, i.skin); rank = i.getRank(true).idx; if(!tryon) { userinfo = new UserInfo(); userinfo.set(i); userinfo.reduce(); } updatePlayerViewData(); boolean ride = true; if(stage != null && (stage.getStageMode() == 9 || stage.getStageMode() == 10)) ride = false; if(ride) { AccessoryData a = set.getAccs(accs); if(vehicle != null) rideOffVehicle(true); if(a != null && a.vehicle != 0 && (vehicle == null || vehicle.vehicleid != a.vehicle)) { VehicleContext vc = getVehicleContext(a.vehicle); rideVehicle(vc); } } if(psd.altitudeAutoSet && stageEntry != null) psd.altitude = stageEntry.loc.y; } public void setLevel(int _level) { psd.setLevel(_level); level = _level; HP = psd.MAXHP; MP = psd.MAXMP; updateStatus(); resetStaticStatusModifiers(); } public void setAvatar(ga2.data.NPCInfo.ChangeAvatarInfo info) { if(info == null) { return; } else { short accs = info.accs == -1 ? userinfo.accs : info.accs; short body = info.body == -1 ? userinfo.body : info.body; short deco = info.deco == -1 ? userinfo.deco : info.deco; short face = info.face == -1 ? userinfo.face : info.face; short head = info.head == -1 ? userinfo.head : info.head; int skin = info.skin == 0 ? userinfo.skin : info.skin; pvd.set(head, face, body, deco, accs, skin); return; } } boolean restoreWeapons() { boolean unlimit = stage != null && stage.unlimitedweapon; if(wp == null || !unlimit && wpnum <= 0) return false; if(unlimit && wpnum == 0) wpnum = wp.maxstock; int c = Math.min(wpnum, wp.maxstock); for(int l = 0; l < c; l++) wpstock[l] = wpid; for(int l = c; l < wpstock.length; l++) wpstock[l] = 0; return true; } boolean restoreWeapons(int wid) { WeaponData w = GameSetting.getSetting().getWeapon(wid); int c = w.maxstock; for(int l = 0; l < c; l++) wpstock[l] = wid; for(int l = c; l < wpstock.length; l++) wpstock[l] = 0; return true; } public int countWeapons() { for(int l = wpstock.length - 1; l >= 0; l--) if(wpstock[l] != 0) return l + 1; return 0; } public int getWeaponReloadTime(int defsec) { float t = (float)(defsec * 1000) * wpreloadrate; if(stage != null) switch(stage.getStageMode()) { case 8: // '\b' case 9: // '\t' default: break; case 7: // '\007' t *= 0.5F; break; case 10: // '\n' if(stage.unlimitedweapon) t = 100F; break; } return Math.max(100, (int)t); } public void decreaseWeaponHolding(int num) { if(stage.isServer() && holding != null) sendEvent(BasicAmpedEvent.create(holding.getID(), 36, new int[] { num })); } public void increaseWeapon(int num) { if(stage.isServer()) sendEvent(BasicAmpedEvent.create(getID(), 36, new int[] { num, -1 })); } public void setSpecial(int sp) { if(sp == psd.special) return; psd.setSpecial(sp); updateStatus(); initScripts(); resetStaticStatusModifiers(); if(sp <= 0) { if(userinfo != null) pvd.set(userinfo.head, userinfo.face, userinfo.body, userinfo.deco, (short)psd.accs, userinfo.skin); } else { NPCInfo npcInfo = GameSetting.getSetting().getNPCInfo(sp); if(npcInfo.changeavatar) pvd.set(npcInfo.head, npcInfo.face, npcInfo.body, npcInfo.deco, (short)psd.accs, npcInfo.skin); else if(npcInfo.resetavator && userinfo != null) pvd.set(userinfo.head, userinfo.face, userinfo.body, userinfo.deco, (short)psd.accs, userinfo.skin); } updatePlayerViewData(); updateMatrix(); updateBounds(); if(ctr instanceof AiController) { AiController aiCtr = (AiController)ctr; if(aiCtr.npcInfo != null) aiCtr.makeAttackList(aiCtr.npcInfo.tecFilter); } }