Diff
checker
文本
文本
图像
文档
Excel
文件夹
Legal
Enterprise
桌面版
定价
登录
下载 Diffchecker 桌面版
比较文本
查找两个文本文件之间的差异
工具
历史
实时编辑器
折叠未更改行
关闭换行
视图
拆分
统一
比对精度
智能
单词
字符
语法高亮
选择语法
忽略
文本转换
转到第一个差异
编辑输入
Diffchecker Desktop
运行Diffchecker最安全的方式。获取Diffchecker桌面应用:您的差异永远不会离开您的电脑!
获取桌面版
Untitled diff
创建于
9年前
差异永不过期
清除
导出
分享
解释
0 删除
行
总计
删除
字符
总计
删除
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
75 行
全部复制
7 添加
行
总计
添加
字符
总计
添加
要继续使用此功能,请升级到
Diff
checker
Pro
查看价格
82 行
全部复制
void Player::removeExperience(uint64_t exp, bool sendText/* = false*/)
void Player::removeExperience(uint64_t exp, bool sendText/* = false*/)
{
{
if (experience == 0 || exp == 0) {
if (experience == 0 || exp == 0) {
return;
return;
}
}
g_events->eventPlayerOnLoseExperience(this, exp);
g_events->eventPlayerOnLoseExperience(this, exp);
if (exp == 0) {
if (exp == 0) {
return;
return;
}
}
uint64_t lostExp = experience;
uint64_t lostExp = experience;
experience = std::max<int64_t>(0, experience - exp);
experience = std::max<int64_t>(0, experience - exp);
if (sendText) {
if (sendText) {
lostExp -= experience;
lostExp -= experience;
std::string expString = std::to_string(lostExp) + (lostExp != 1 ? " experience points." : " experience point.");
std::string expString = std::to_string(lostExp) + (lostExp != 1 ? " experience points." : " experience point.");
TextMessage message(MESSAGE_EXPERIENCE, "You lost " + expString);
TextMessage message(MESSAGE_EXPERIENCE, "You lost " + expString);
message.position = position;
message.position = position;
message.primary.value = lostExp;
message.primary.value = lostExp;
message.primary.color = TEXTCOLOR_RED;
message.primary.color = TEXTCOLOR_RED;
sendTextMessage(message);
sendTextMessage(message);
SpectatorHashSet spectators;
SpectatorHashSet spectators;
g_game.map.getSpectators(spectators, position, false, true);
g_game.map.getSpectators(spectators, position, false, true);
spectators.erase(this);
spectators.erase(this);
if (!spectators.empty()) {
if (!spectators.empty()) {
message.type = MESSAGE_EXPERIENCE_OTHERS;
message.type = MESSAGE_EXPERIENCE_OTHERS;
message.text = getName() + " lost " + expString;
message.text = getName() + " lost " + expString;
for (Creature* spectator : spectators) {
for (Creature* spectator : spectators) {
spectator->getPlayer()->sendTextMessage(message);
spectator->getPlayer()->sendTextMessage(message);
}
}
}
}
}
}
uint32_t oldLevel = level;
uint32_t oldLevel = level;
uint64_t currLevelExp = Player::getExpForLevel(level);
uint64_t currLevelExp = Player::getExpForLevel(level);
while (level > 1 && experience < currLevelExp) {
while (level > 1 && experience < currLevelExp) {
--level;
--level;
healthMax = std::max<int32_t>(0, healthMax - vocation->getHPGain());
healthMax = std::max<int32_t>(0, healthMax - vocation->getHPGain());
manaMax = std::max<int32_t>(0, manaMax - vocation->getManaGain());
manaMax = std::max<int32_t>(0, manaMax - vocation->getManaGain());
capacity = std::max<int32_t>(0, capacity - vocation->getCapGain());
capacity = std::max<int32_t>(0, capacity - vocation->getCapGain());
currLevelExp = Player::getExpForLevel(level);
currLevelExp = Player::getExpForLevel(level);
}
}
if (oldLevel != level) {
if (oldLevel != level) {
health = healthMax;
health = healthMax;
mana = manaMax;
mana = manaMax;
updateBaseSpeed();
updateBaseSpeed();
setBaseSpeed(getBaseSpeed());
setBaseSpeed(getBaseSpeed());
g_game.changeSpeed(this, 0);
g_game.changeSpeed(this, 0);
g_game.addCreatureHealth(this);
g_game.addCreatureHealth(this);
if (party) {
if (party) {
party->updateSharedExperience();
party->updateSharedExperience();
}
}
std::ostringstream ss;
std::ostringstream ss;
ss << "You were downgraded from Level " << oldLevel << " to Level " << level << '.';
ss << "You were downgraded from Level " << oldLevel << " to Level " << level << '.';
sendTextMessage(MESSAGE_EVENT_ADVANCE, ss.str());
sendTextMessage(MESSAGE_EVENT_ADVANCE, ss.str());
复制
已复制
复制
已复制
if (passiveDamageBonus > 0)
{
passiveDamageBonus--;
std::ostringstream msgPassive;
msgPassive << "Your passive damage bonus has reduced from " << passiveDamageBonus + 1 << "% to " << passiveDamageBonus << "%.";
sendTextMessage(MESSAGE_EVENT_ADVANCE, msgPassive.str());
}
}
}
uint64_t nextLevelExp = Player::getExpForLevel(level + 1);
uint64_t nextLevelExp = Player::getExpForLevel(level + 1);
if (nextLevelExp > currLevelExp) {
if (nextLevelExp > currLevelExp) {
levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp);
levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp);
} else {
} else {
levelPercent = 0;
levelPercent = 0;
}
}
sendStats();
sendStats();
}
}
已保存差异
原始文本
打开文件
void Player::removeExperience(uint64_t exp, bool sendText/* = false*/) { if (experience == 0 || exp == 0) { return; } g_events->eventPlayerOnLoseExperience(this, exp); if (exp == 0) { return; } uint64_t lostExp = experience; experience = std::max<int64_t>(0, experience - exp); if (sendText) { lostExp -= experience; std::string expString = std::to_string(lostExp) + (lostExp != 1 ? " experience points." : " experience point."); TextMessage message(MESSAGE_EXPERIENCE, "You lost " + expString); message.position = position; message.primary.value = lostExp; message.primary.color = TEXTCOLOR_RED; sendTextMessage(message); SpectatorHashSet spectators; g_game.map.getSpectators(spectators, position, false, true); spectators.erase(this); if (!spectators.empty()) { message.type = MESSAGE_EXPERIENCE_OTHERS; message.text = getName() + " lost " + expString; for (Creature* spectator : spectators) { spectator->getPlayer()->sendTextMessage(message); } } } uint32_t oldLevel = level; uint64_t currLevelExp = Player::getExpForLevel(level); while (level > 1 && experience < currLevelExp) { --level; healthMax = std::max<int32_t>(0, healthMax - vocation->getHPGain()); manaMax = std::max<int32_t>(0, manaMax - vocation->getManaGain()); capacity = std::max<int32_t>(0, capacity - vocation->getCapGain()); currLevelExp = Player::getExpForLevel(level); } if (oldLevel != level) { health = healthMax; mana = manaMax; updateBaseSpeed(); setBaseSpeed(getBaseSpeed()); g_game.changeSpeed(this, 0); g_game.addCreatureHealth(this); if (party) { party->updateSharedExperience(); } std::ostringstream ss; ss << "You were downgraded from Level " << oldLevel << " to Level " << level << '.'; sendTextMessage(MESSAGE_EVENT_ADVANCE, ss.str()); } uint64_t nextLevelExp = Player::getExpForLevel(level + 1); if (nextLevelExp > currLevelExp) { levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp); } else { levelPercent = 0; } sendStats(); }
更改后文本
打开文件
void Player::removeExperience(uint64_t exp, bool sendText/* = false*/) { if (experience == 0 || exp == 0) { return; } g_events->eventPlayerOnLoseExperience(this, exp); if (exp == 0) { return; } uint64_t lostExp = experience; experience = std::max<int64_t>(0, experience - exp); if (sendText) { lostExp -= experience; std::string expString = std::to_string(lostExp) + (lostExp != 1 ? " experience points." : " experience point."); TextMessage message(MESSAGE_EXPERIENCE, "You lost " + expString); message.position = position; message.primary.value = lostExp; message.primary.color = TEXTCOLOR_RED; sendTextMessage(message); SpectatorHashSet spectators; g_game.map.getSpectators(spectators, position, false, true); spectators.erase(this); if (!spectators.empty()) { message.type = MESSAGE_EXPERIENCE_OTHERS; message.text = getName() + " lost " + expString; for (Creature* spectator : spectators) { spectator->getPlayer()->sendTextMessage(message); } } } uint32_t oldLevel = level; uint64_t currLevelExp = Player::getExpForLevel(level); while (level > 1 && experience < currLevelExp) { --level; healthMax = std::max<int32_t>(0, healthMax - vocation->getHPGain()); manaMax = std::max<int32_t>(0, manaMax - vocation->getManaGain()); capacity = std::max<int32_t>(0, capacity - vocation->getCapGain()); currLevelExp = Player::getExpForLevel(level); } if (oldLevel != level) { health = healthMax; mana = manaMax; updateBaseSpeed(); setBaseSpeed(getBaseSpeed()); g_game.changeSpeed(this, 0); g_game.addCreatureHealth(this); if (party) { party->updateSharedExperience(); } std::ostringstream ss; ss << "You were downgraded from Level " << oldLevel << " to Level " << level << '.'; sendTextMessage(MESSAGE_EVENT_ADVANCE, ss.str()); if (passiveDamageBonus > 0) { passiveDamageBonus--; std::ostringstream msgPassive; msgPassive << "Your passive damage bonus has reduced from " << passiveDamageBonus + 1 << "% to " << passiveDamageBonus << "%."; sendTextMessage(MESSAGE_EVENT_ADVANCE, msgPassive.str()); } } uint64_t nextLevelExp = Player::getExpForLevel(level + 1); if (nextLevelExp > currLevelExp) { levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp); } else { levelPercent = 0; } sendStats(); }
查找差异