浏览代码

more conflict fixes

tags/v0.3.0
Big Bad Waffle 5 年前
父节点
当前提交
d56b4e0976
共有 14 个文件被更改,包括 4029 次插入316 次删除
  1. +14
    -44
      src/client/js/objects/objects.js
  2. +34
    -127
      src/server/components/aggro.js
  3. +2
    -2
      src/server/components/chest.js
  4. +2
    -2
      src/server/components/effects.js
  5. +5
    -81
      src/server/components/inventory.js
  6. +1
    -1
      src/server/components/mob.js
  7. +14
    -20
      src/server/components/sound.js
  8. +3
    -29
      src/server/components/spellbook.js
  9. +1
    -1
      src/server/components/stats.js
  10. +2
    -2
      src/server/config/maps/dungeon/zone.js
  11. +3944
    -0
      src/server/config/maps/fjolarok/src_server_config_maps_fjolarok_map.json
  12. +5
    -5
      src/server/config/spells/spellTemplate.js
  13. +1
    -1
      src/server/world/map.js
  14. +1
    -1
      src/server/world/physics.js

+ 14
- 44
src/client/js/objects/objects.js 查看文件

@@ -25,33 +25,21 @@ define([
events.on('onTilesVisible', this.onTilesVisible.bind(this));

//Get saved value for showNames, or use the value set above
<<<<<<< HEAD
let showNames = window.localStorage.getItem('iwd_opt_shownames');
this.showNames = showNames ? (showNames === 'true') : this.showNames;
=======
var showNames = window.localStorage.getItem('iwd_opt_shownames');
this.showNames = showNames ? (showNames == 'true') : this.showNames;
config.showNames = this.showNames;
>>>>>>> 555-new-dungeon
},

getLocation: function (x, y) {
let objects = this.objects;
let oLen = objects.length;

<<<<<<< HEAD
let closest = 999;
let mob = null;
for (let i = 0; i < oLen; i++) {
let o = objects[i];
if ((!o.stats) || (o.nonSelectable))
=======
var closest = 999;
var mob = null;
for (var i = 0; i < oLen; i++) {
var o = objects[i];
if ((!o.stats) || (o.nonSelectable) || (o == window.player) || (!o.sprite.visible))
>>>>>>> 555-new-dungeon
if ((!o.stats) || (o.nonSelectable) || (o === window.player) || (!o.sprite.visible))
continue;

let dx = Math.abs(o.x - x);
@@ -70,13 +58,8 @@ define([
getClosest: function (x, y, maxDistance, reverse, fromMob) {
let objects = this.objects;

<<<<<<< HEAD
let list = objects.filter(function (o) {
if ((!o.stats) || (o.nonSelectable) || (o === window.player))
=======
var list = objects.filter(function (o) {
if ((!o.stats) || (o.nonSelectable) || (o == window.player) || (!o.sprite.visible))
>>>>>>> 555-new-dungeon
if ((!o.stats) || (o.nonSelectable) || (o === window.player) || (!o.sprite.visible))
return false;

let dx = Math.abs(o.x - x);
@@ -149,11 +132,7 @@ define([
let components = template.components || [];
delete template.components;

<<<<<<< HEAD
let syncTypes = ['portrait'];
=======
var syncTypes = ['portrait', 'area'];
>>>>>>> 555-new-dungeon
let syncTypes = ['portrait', 'area'];

for (let p in template) {
let value = template[p];
@@ -221,7 +200,7 @@ define([
}

if (renderer.sprites) {
var isVisible = ((obj.self) || ((renderer.sprites[obj.x]) && (renderer.sprites[obj.x][obj.y].length > 0)));
let isVisible = ((obj.self) || ((renderer.sprites[obj.x]) && (renderer.sprites[obj.x][obj.y].length > 0)));
obj.setVisible(isVisible);
}

@@ -272,8 +251,8 @@ define([
if ((p === 'x') || (p === 'y'))
moved = true;

if (p == 'casting') {
if (obj == window.player)
if (p === 'casting') {
if (obj === window.player)
events.emit('onGetSelfCasting', value);
else
events.emit('onGetTargetCasting', value);
@@ -325,7 +304,7 @@ define([
}

if (obj.sprite) {
var isVisible = ((!!obj.player) || (renderer.sprites[obj.x][obj.y].length > 0));
let isVisible = ((!!obj.player) || (renderer.sprites[obj.x][obj.y].length > 0));
obj.setVisible(isVisible);
}

@@ -363,21 +342,12 @@ define([

let showNames = this.showNames;

<<<<<<< HEAD
let objects = this.objects;
let oLen = objects.length;
for (let i = 0; i < oLen; i++) {
let obj = objects[i];
let ns = obj.nameSprite;
if ((!ns) || (obj.dead))
=======
var objects = this.objects;
var oLen = objects.length;
for (var i = 0; i < oLen; i++) {
var obj = objects[i];
var ns = obj.nameSprite;
if ((!ns) || (obj.dead) || ((obj.sprite) && (!obj.sprite.visible)))
>>>>>>> 555-new-dungeon
continue;

ns.visible = showNames;
@@ -386,13 +356,13 @@ define([
},

onTilesVisible: function (tiles, visible) {
var objects = this.objects;
var oLen = objects.length;
for (var i = 0; i < oLen; i++) {
var o = objects[i];
let objects = this.objects;
let oLen = objects.length;
for (let i = 0; i < oLen; i++) {
let o = objects[i];

var onPos = tiles.some(function (t) {
return ((t.x == o.x) && (t.y == o.y));
let onPos = tiles.some(function (t) {
return ((t.x === o.x) && (t.y === o.y));
});
if (!onPos)
continue;


+ 34
- 127
src/server/components/aggro.js 查看文件

@@ -83,7 +83,6 @@ module.exports = {
}
}

<<<<<<< HEAD
let x = obj.x;
let y = obj.y;

@@ -97,58 +96,6 @@ module.exports = {
let iLen = inRange.length;
for (let i = 0; i < iLen; i++) {
let enemy = inRange[i];
=======
move: function (obj, x, y, range) {
obj = obj || this.obj;
var aggro = obj.aggro;

if (obj.dead)
return;

var result = {
success: true
};
obj.fireEvent('beforeAggro', result);
if (!result.success)
return;

//If we're attacking something, don't try and look for more trouble. SAVE THE CPU!
// this only counts for mobs, players can have multiple attackers
var list = aggro.list;
if (obj.isMob) {
var lLen = list.length;
for (var i = 0; i < lLen; i++) {
var l = list[i];

var lThreat = l.obj.aggro.getHighest();
if (lThreat) {
l.obj.aggro.list.forEach(function (a) {
a.obj.aggro.unIgnore(lThreat);
});
}

l.obj.aggro.unIgnore(obj);
if (l.threat > 0)
return;
}
} else {
var lLen = list.length;
for (var i = 0; i < lLen; i++) {
var targetAggro = list[i].obj.aggro;
//Maybe the aggro component has been removed?
if (targetAggro)
targetAggro.unIgnore(obj);
}
}

x = (x == null) ? obj.x : x;
y = (y == null) ? obj.y : y;

//find mobs in range
range = range || aggro.range;
var faction = aggro.faction;
var inRange = aggro.physics.getArea(x - range, y - range, x + range, y + range, (c => (((!c.player) || (!obj.player)) && (!obj.dead) && (c.aggro) && (c.aggro.willAutoAttack(obj)))));
>>>>>>> 555-new-dungeon

//The length could change
let lLen = list.length;
@@ -191,7 +138,6 @@ module.exports = {
return true;
},

<<<<<<< HEAD
willAutoAttack: function (target) {
if (this.obj === target)
return false;
@@ -199,16 +145,6 @@ module.exports = {
let faction = target.aggro.faction;
if (!faction || !this.faction)
return false;
=======
//Do we have LoS?
if (!aggro.physics.hasLos(x, y, enemy.x, enemy.y))
continue;

if (enemy.aggro.tryEngage(obj))
aggro.tryEngage(enemy, 0);
}
},
>>>>>>> 555-new-dungeon

let rep = this.obj.reputation;
if (!rep) {
@@ -276,7 +212,6 @@ module.exports = {
return true;
},

<<<<<<< HEAD
getFirstAttacker: function () {
let first = this.list.find(l => ((l.obj.player) && (l.damage > 0)));
if (first)
@@ -287,13 +222,6 @@ module.exports = {
die: function () {
let list = this.list;
let lLen = list.length;
=======
list.push(l);

if (obj.player)
this.move(obj, this.obj.x, this.obj.y, ~~(this.range / 2));
}
>>>>>>> 555-new-dungeon

for (let i = 0; i < lLen; i++) {
let l = list[i];
@@ -312,6 +240,7 @@ module.exports = {

this.list = [];
},

unAggro: function (obj, amount) {
let list = this.list;
let lLen = list.length;
@@ -385,7 +314,6 @@ module.exports = {
}
}

<<<<<<< HEAD
if (highest)
return highest.obj;
@@ -393,6 +321,39 @@ module.exports = {
return true;
},

getFurthest: function () {
let furthest = null;
let distance = 0;

let list = this.list;
let lLen = list.length;

let thisObj = this.obj;
let x = thisObj.x;
let y = thisObj.y;

for (let i = 0; i < lLen; i++) {
let l = list[i];
let obj = l.obj;

if (this.ignoreList.some(o => o === obj))
continue;

let oDistance = Math.max(Math.abs(x - obj.x), Math.abs(y - obj.y));
if (oDistance > distance) {
furthest = l;
distance = oDistance;
}
}

return furthest.obj;
},

getRandom: function () {
let useList = this.list.filter(l => (!this.ignoreList.some(o => (o === l.obj))));
return useList[~~(Math.random() * useList.length)];
},

update: function () {
let list = this.list;
let lLen = list.length;
@@ -408,60 +369,6 @@ module.exports = {
l.threat -= this.threatDecay;
if (l.threat < 0)
l.threat = 0;
=======
if (highest)
return highest.obj;
else {
//We have aggro but can't reach our target. Don't let the mob run away as if not in combat!
return true;
}
},

getFurthest: function () {
var furthest = null;
var distance = 0;

var list = this.list;
var lLen = list.length;

var thisObj = this.obj;
var x = thisObj.x;
var y = thisObj.y;

for (var i = 0; i < lLen; i++) {
var l = list[i];
var obj = l.obj;

if (this.ignoreList.some(o => o == obj))
continue;

var oDistance = Math.max(Math.abs(x - obj.x), Math.abs(y - obj.y));
if (oDistance > distance) {
furthest = l;
distance = oDistance;
}
}

return furthest.obj;
},

getRandom: function () {
var useList = this.list.filter(l => (!this.ignoreList.some(o => (o == l.obj))));
return useList[~~(Math.random() * useList.length)];
},

update: function () {
var list = this.list;
var lLen = list.length;

for (var i = 0; i < lLen; i++) {
var l = list[i];
if (l.obj.destroyed) {
this.unAggro(l.obj);
i--;
lLen--;
}
>>>>>>> 555-new-dungeon
}
}
}


+ 2
- 2
src/server/components/chest.js 查看文件

@@ -6,7 +6,7 @@ module.exports = {
ttl: -1,

init: function (blueprint) {
if (blueprint.ownerName != null)
if (blueprint.has('ownerName'))
this.ownerName = blueprint.ownerName;

if (blueprint.ttl)
@@ -24,7 +24,7 @@ module.exports = {
if (this.ttl > 0) {
this.ttl--;

if (this.ttl == 0)
if (!this.ttl)
this.obj.destroyed = true;
}
},


+ 2
- 2
src/server/components/effects.js 查看文件

@@ -127,8 +127,8 @@ module.exports = {
} return false;
},

addEffect: function (options) {
if ((options.ttl != null) && (options.ttl == 0))
addEffect: function (options, source) {
if ((options.has('ttl')) && (options.ttl === 0))
return;

options.caster = options.caster || source;


+ 5
- 81
src/server/components/inventory.js 查看文件

@@ -645,10 +645,7 @@ module.exports = {
}, this);
},

createBag: function (x, y, items, ownerId) {
if (!ownerId)
ownerId = -1;

createBag: function (x, y, items, ownerName) {
let bagCell = 50;

let topQuality = 0;
@@ -678,62 +675,17 @@ module.exports = {
y: y,
properties: {
cpnChest: {
ownerId: ownerId,
ownerName: ownerName,
ttl: 1710
},
cpnInventory: {
items: extend([], items)
}
<<<<<<< HEAD
=======
}, this);
},

createBag: function (x, y, items, ownerName) {
var bagCell = 50;

var topQuality = 0;
var iLen = items.length;
for (var i = 0; i < iLen; i++) {
var quality = items[i].quality;
items[i].fromMob = !!this.obj.mob;
if (quality > topQuality)
topQuality = quality;
>>>>>>> 555-new-dungeon
}
}]);

<<<<<<< HEAD
return obj;
},
=======
if (topQuality == 0)
bagCell = 50;
else if (topQuality == 1)
bagCell = 51;
else if (topQuality == 2)
bagCell = 128;
else if (topQuality == 3)
bagCell = 52;
else
bagCell = 53;

var obj = this.obj.instance.objects.buildObjects([{
sheetName: 'objects',
cell: bagCell,
x: x,
y: y,
properties: {
cpnChest: {
ownerName: ownerName,
ttl: this.obj.instance.instanced ? -1 : 1710
},
cpnInventory: {
items: extend(true, [], items)
}
}
}]);
>>>>>>> 555-new-dungeon

hasSpace: function () {
if (this.inventorySize !== -1) {
@@ -918,27 +870,15 @@ module.exports = {
return item;
},

dropBag: function (ownerId, killSource) {
dropBag: function (ownerName, killSource) {
if (!this.blueprint)
return;

//Only drop loot if this player is in the zone
let playerObject = this.obj.instance.objects.find(o => o.serverId === ownerId);
let playerObject = this.obj.instance.objects.find(o => o.name === ownerName);
if (!playerObject)
return;

//Get player's spells' statTypes
let stats = [];
playerObject.spellbook.spells.forEach(function (s) {
let spellStatType = s.statType;
if (!(spellStatType instanceof Array))
spellStatType = [spellStatType];
spellStatType.forEach(function (ss) {
if (stats.indexOf(ss) === -1)
stats.push(ss);
});
});

let items = this.items;
let iLen = items.length;
for (let i = 0; i < iLen; i++) {
@@ -946,22 +886,11 @@ module.exports = {
delete items[i].pos;
}

<<<<<<< HEAD
let blueprint = this.blueprint;
let magicFind = (blueprint.magicFind || 0);

let savedItems = extend([], this.items);
this.items = [];
=======
dropBag: function (ownerName, killSource) {
if (!this.blueprint)
return;

//Only drop loot if this player is in the zone
var playerObject = this.obj.instance.objects.find(o => o.name == ownerName);
if (!playerObject)
return;
>>>>>>> 555-new-dungeon

let dropEvent = {
chanceMultiplier: 1,
@@ -1023,13 +952,8 @@ module.exports = {
playerObject.fireEvent('beforeTargetDeath', this.obj, this.items);
this.obj.instance.eventEmitter.emit('onBeforeDropBag', this.obj, this.items, killSource);

<<<<<<< HEAD
if (this.items.length > 0)
this.createBag(this.obj.x, this.obj.y, this.items, ownerId);
=======
if (this.items.length > 0)
this.createBag(this.obj.x, this.obj.y, this.items, ownerName);
>>>>>>> 555-new-dungeon
this.createBag(this.obj.x, this.obj.y, this.items, ownerName);

this.items = savedItems;
},


+ 1
- 1
src/server/components/mob.js 查看文件

@@ -88,7 +88,7 @@ module.exports = {
let toNode = this.patrol[this.patrolTargetNode];
toX = toNode[0];
toY = toNode[1];
if ((toX - obj.x == 0) && (toY - obj.y == 0)) {
if ((toX - obj.x === 0) && (toY - obj.y === 0)) {
this.patrolTargetNode++;
if (this.patrolTargetNode >= this.patrol.length)
this.patrolTargetNode = 0;


+ 14
- 20
src/server/components/sound.js 查看文件

@@ -1,20 +1,14 @@
define([

], function (

) {
return {
type: 'sound',

sound: null,
volume: 0,

simplify: function () {
return {
type: 'sound',
sound: this.sound,
volume: this.volume
};
}
};
});
module.exports = {
type: 'sound',

sound: null,
volume: 0,

simplify: function () {
return {
type: 'sound',
sound: this.sound,
volume: this.volume
};
}
};

+ 3
- 29
src/server/components/spellbook.js 查看文件

@@ -115,9 +115,9 @@ module.exports = {
}

if (!builtSpell.castOnDeath) {
if ((this.closestRange == -1) || (builtSpell.range < this.closestRange))
if ((this.closestRange === -1) || (builtSpell.range < this.closestRange))
this.closestRange = builtSpell.range;
if ((this.furthestRange == -1) || (builtSpell.range > this.furthestRange))
if ((this.furthestRange === -1) || (builtSpell.range > this.furthestRange))
this.furthestRange = builtSpell.range;
}

@@ -382,32 +382,6 @@ module.exports = {
}

return success;

let stats = this.obj.stats.values;
stats.mana -= spell.manaCost;
let cd = {
cd: spell.cdMax
};

let isAttack = (spell.type == 'melee');
if ((Math.random() * 100) < stats[isAttack ? 'attackSpeed' : 'castSpeed'])
cd.cd = 1;

this.obj.fireEvent('beforeSetSpellCooldown', cd);

spell.cd = cd.cd;

if (this.obj.player) {
let syncer = this.obj.syncer;
syncer.setObject(true, 'stats', 'values', 'mana', this.obj.stats.values.mana);
this.obj.instance.syncer.queue('onGetSpellCooldowns', {
id: this.obj.id,
spell: action.spell,
cd: (spell.cd * 350)
}, [this.obj.serverId]);
}

return true;
},

getClosestRange: function (spellNum) {
@@ -569,7 +543,7 @@ module.exports = {

stopCasting: function (ignore) {
this.spells.forEach(function (s) {
if ((!s.castTimeMax) || (!s.castTime) || (s == ignore))
if ((!s.castTimeMax) || (!s.castTime) || (s === ignore))
return;

s.castTime = 0;


+ 1
- 1
src/server/components/stats.js 查看文件

@@ -574,7 +574,7 @@ module.exports = {
for (let i = 0; i < aLen; i++) {
let a = aggroList[i];

if ((!a.threat) || (a.obj.serverId == null))
if ((!a.threat) || (!a.obj.has('serverId')))
continue;

this.obj.inventory.dropBag(a.obj.name, killSource);


+ 2
- 2
src/server/config/maps/dungeon/zone.js 查看文件

@@ -1,4 +1,4 @@
var balance = {
let balance = {
mobs: {
violetSerpent: {
level: 5,
@@ -249,7 +249,7 @@ module.exports = {
max: 6
}
}
}
};
}
}
}


+ 3944
- 0
src/server/config/maps/fjolarok/src_server_config_maps_fjolarok_map.json
文件差异内容过多而无法显示
查看文件


+ 5
- 5
src/server/config/spells/spellTemplate.js 查看文件

@@ -35,7 +35,7 @@ module.exports = {

castBase: function (action) {
if (this.castTimeMax > 0) {
if ((!this.currentAction) || (this.currentAction.target != action.target)) {
if ((!this.currentAction) || (this.currentAction.target !== action.target)) {
this.currentAction = action;
this.castTime = this.castTimeMax;
this.obj.syncer.set(false, null, 'casting', 0);
@@ -81,7 +81,7 @@ module.exports = {
cd: this.cdMax
};

let isAttack = (this.type == 'melee');
let isAttack = (this.type === 'melee');
if ((Math.random() * 100) < this.obj.stats.values[isAttack ? 'attackSpeed' : 'castSpeed'])
cd.cd = 1;

@@ -99,7 +99,7 @@ module.exports = {
},

calcDps: function (target, noSync) {
if ((!this.values) || (this.spellType == 'buff'))
if ((!this.values) || (this.spellType === 'buff'))
return;

if ((!this.damage) && (!this.healing))
@@ -123,7 +123,7 @@ module.exports = {
noCrit: true
}).amount;

let isAttack = (this.type == 'melee');
let isAttack = (this.type === 'melee');

let statValues = this.obj.stats.values;

@@ -141,7 +141,7 @@ module.exports = {

if (this.damage)
this.values.dmg = ~~(dmg * 100) / 100 + '/tick';
else
else
this.values.heal = ~~(dmg * 100) / 100 + '/tick';

if (!noSync)


+ 1
- 1
src/server/world/map.js 查看文件

@@ -337,7 +337,7 @@ module.exports = {
if (blueprint.blocking)
this.collisionMap[blueprint.x][blueprint.y] = 1;

if ((blueprint.properties.cpnNotice) || (blueprint.properties.cpnLightPatch) || (layerName === 'rooms') || (layerName == 'hiddenRooms')) {
if ((blueprint.properties.cpnNotice) || (blueprint.properties.cpnLightPatch) || (layerName === 'rooms') || (layerName === 'hiddenRooms')) {
blueprint.y++;
blueprint.width = cell.width / mapScale;
blueprint.height = cell.height / mapScale;


+ 1
- 1
src/server/world/physics.js 查看文件

@@ -530,7 +530,7 @@ module.exports = {
let yj = vj[1];

let doesIntersect = (
((yi > y) != (yj > y)) &&
((yi > y) !== (yj > y)) &&
(x < ((((xj - xi) * (y - yi)) / (yj - yi)) + xi))
);



正在加载...
取消
保存