99nets全国最大稀有游戏社区! 广告服务

99NETS网游模拟娱乐社区

 找回密码
 立即注册
搜索
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
查看: 17598|回复: 1
打印 上一主题 下一主题

[天堂java教學] 每日任務教學

[复制链接]

骑士

Rank: 3Rank: 3

UID
130957
帖子
127
威望
0
久币
0
贡献
0
阅读权限
30
在线时间
5 小时
注册时间
2018-3-30
跳转到指定楼层
楼主
发表于 2018-8-12 18:36:55 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
1.創建任務類(處理任務)
L1PcQuestGroup.java

文章轉載至天堂技術論壇http://bbs.t1fb.net/forum.php?mod=viewthread&tid=204
  1. package com.lineage.server.model;

  2. import java.util.concurrent.ConcurrentHashMap;

  3. import org.apache.commons.logging.Log;
  4. import org.apache.commons.logging.LogFactory;

  5. import com.lineage.server.datatables.readwrite.read.DTRCharQuest;
  6. import com.lineage.server.model.Instance.L1PcInstance;
  7. import com.lineage.server.staticobj.STOTime;

  8. public class L1PcQuestGroup {

  9. private static final Log _log = LogFactory.getLog(L1PcQuestGroup.class);

  10. public static final int QUEST_NOT = 0; // 任務尚未開始
  11. public static final int QUEST_END = 255; // 任務已經結束

  12. private final DTRCharQuest _cqr = DTRCharQuest.get();
  13. private L1PcInstance _owner = null;
  14. private ConcurrentHashMap<Integer, L1PcQuest> _questGroup = null;

  15. /**
  16. * 任務紀錄模組
  17. *
  18. * @param owner
  19. */
  20. public L1PcQuestGroup(final L1PcInstance owner) {
  21. this._owner = owner;
  22. }

  23. /**
  24. * 傳回執行任務者
  25. *
  26. * @return
  27. */
  28. public L1PcInstance get_owner() {
  29. return this._owner;
  30. }

  31. /**
  32. * 傳回任務梯度
  33. *
  34. * @param quest_id
  35. * 任務編號
  36. * @return 梯度
  37. */
  38. public int get_step(final int quest_id) {
  39. try {
  40. this._questGroup = this._cqr.getQuests(this._owner.getId()); // 即時讀取任務組(必須)
  41. if (this._questGroup == null) {
  42. return 0;
  43. }

  44. final L1PcQuest quest = this._questGroup.get(new Integer(quest_id)); // 讀取指定Id的任務信息
  45. if (quest == null) {
  46. return 0;
  47. }

  48. final int step = quest.getStep();
  49. return step;

  50. } catch (final Exception e) {
  51. _log.error(e.getLocalizedMessage(), e);
  52. }

  53. return 0;
  54. }

  55. /**
  56. * 傳回任務完成數量
  57. *
  58. * @param quest_id
  59. * 任務編號
  60. * @return 數量
  61. */
  62. public int get_count(final int quest_id) {
  63. try {
  64. this._questGroup = this._cqr.getQuests(this._owner.getId()); // 即時讀取任務組(必須)
  65. if (this._questGroup == null) {
  66. return 0;
  67. }

  68. final L1PcQuest quest = this._questGroup.get(new Integer(quest_id)); // 讀取指定Id的任務信息
  69. if (quest == null) {
  70. return 0;
  71. }

  72. final int count = quest.getCount();
  73. return count;

  74. } catch (final Exception e) {
  75. _log.error(e.getLocalizedMessage(), e);
  76. }

  77. return 0;
  78. }

  79. /**
  80. * 傳回任務執行起始時間
  81. *
  82. * @param quest_id
  83. * 任務編號
  84. * @return 起始時間
  85. */
  86. public int get_startTime(final int quest_id) {
  87. try {
  88. this._questGroup = this._cqr.getQuests(this._owner.getId()); // 即時讀取任務組(必須)
  89. if (this._questGroup == null) {
  90. return 0;
  91. }

  92. final L1PcQuest quest = this._questGroup.get(new Integer(quest_id)); // 讀取指定Id的任務信息
  93. if (quest == null) {
  94. return 0;
  95. }

  96. final int startTime = quest.getStartTime();
  97. return startTime;

  98. } catch (final Exception e) {
  99. _log.error(e.getLocalizedMessage(), e);
  100. }

  101. return 0;
  102. }

  103. /**
  104. * 傳回任務所需道具
  105. *
  106. * @param quest_id
  107. * 任務編號
  108. * @return 所需道具
  109. */
  110. public int get_targetItem(final int quest_id) {
  111. try {
  112. this._questGroup = this._cqr.getQuests(this._owner.getId()); // 即時讀取任務組(必須)
  113. if (this._questGroup == null) {
  114. return 0;
  115. }

  116. final L1PcQuest quest = this._questGroup.get(new Integer(quest_id)); // 讀取指定Id的任務信息
  117. if (quest == null) {
  118. return 0;
  119. }

  120. final int targetItem = quest.getTargetItem();
  121. return targetItem;

  122. } catch (final Exception e) {
  123. _log.error(e.getLocalizedMessage(), e);
  124. }

  125. return 0;
  126. }

  127. /**
  128. * 傳回任務所需道具數量
  129. *
  130. * @param quest_id
  131. * 任務編號
  132. * @return 道具數量
  133. */
  134. public int get_itemCount(final int quest_id) {
  135. try {
  136. this._questGroup = this._cqr.getQuests(this._owner.getId()); // 即時讀取任務組(必須)
  137. if (this._questGroup == null) {
  138. return 0;
  139. }

  140. final L1PcQuest quest = this._questGroup.get(new Integer(quest_id)); // 讀取指定Id的任務信息
  141. if (quest == null) {
  142. return 0;
  143. }

  144. final int itemCount = quest.getItemCount();
  145. return itemCount;

  146. } catch (final Exception e) {
  147. _log.error(e.getLocalizedMessage(), e);
  148. }

  149. return 0;
  150. }

  151. /**
  152. * 傳回任務目標地圖
  153. *
  154. * @param quest_id
  155. * 任務編號
  156. * @return 目標地圖
  157. */
  158. public int get_targetMap(final int quest_id) {
  159. try {
  160. this._questGroup = this._cqr.getQuests(this._owner.getId()); // 即時讀取任務組(必須)
  161. if (this._questGroup == null) {
  162. return 0;
  163. }

  164. final L1PcQuest quest = this._questGroup.get(new Integer(quest_id)); // 讀取指定Id的任務信息
  165. if (quest == null) {
  166. return 0;
  167. }

  168. final int targetMap = quest.getTargetMap();
  169. return targetMap;

  170. } catch (final Exception e) {
  171. _log.error(e.getLocalizedMessage(), e);
  172. }

  173. return 0;
  174. }

  175. /**
  176. * 傳回任務目標怪物
  177. *
  178. * @param quest_id
  179. * 任務編號
  180. * @return 目標怪物
  181. */
  182. public int get_targetMob(final int quest_id) {
  183. try {
  184. this._questGroup = this._cqr.getQuests(this._owner.getId()); // 即時讀取任務組(必須)
  185. if (this._questGroup == null) {
  186. return 0;
  187. }

  188. final L1PcQuest quest = this._questGroup.get(new Integer(quest_id)); // 讀取指定Id的任務信息
  189. if (quest == null) {
  190. return 0;
  191. }

  192. final int targetMob = quest.getTargetMob();
  193. return targetMob;

  194. } catch (final Exception e) {
  195. _log.error(e.getLocalizedMessage(), e);
  196. }

  197. return 0;
  198. }

  199. /**
  200. * 該任務是否開始 (get_step 大於0 小於255 傳回任務已經開始)
  201. *
  202. * @param quest_id
  203. * 任務編號
  204. * @return true:已經開始 false:尚未開始
  205. */
  206. public boolean isStart(final int quest_id) {
  207. try {
  208. final int step = this.get_step(quest_id);
  209. // 大於0 小於255
  210. if (step > QUEST_NOT && step < QUEST_END) {
  211. return true;
  212. }

  213. } catch (final Exception e) {
  214. _log.error(e.getLocalizedMessage(), e);
  215. }

  216. return false;
  217. }

  218. /**
  219. * 該任務是否結束
  220. *
  221. * @param quest_id
  222. * 任務編號
  223. * @return true:已經結束 false:尚未結束
  224. */
  225. public boolean isEnd(final int quest_id) {
  226. try {
  227. if (this.get_step(quest_id) == QUEST_END) {
  228. return true;
  229. }

  230. } catch (final Exception e) {
  231. _log.error(e.getLocalizedMessage(), e);
  232. }

  233. return false;
  234. }

  235. /**
  236. * 增加任務梯度(只用做單純的step切換時使用,只變更step信息其他不變)
  237. *
  238. * @param questId
  239. * 任務編號
  240. * @param addStep
  241. * 增加的梯度值
  242. */
  243. public void add_step(final int questId, final int addStep) {
  244. final int quest_id = questId;
  245. final int step = this.get_step(quest_id) + addStep;
  246. final int addNum = 0;
  247. final int startTime = this.get_startTime(questId);
  248. final int targetItem = this.get_targetItem(quest_id);
  249. final int itemCount = this.get_itemCount(quest_id);
  250. final int targetMap = this.get_targetMap(quest_id);
  251. final int targetMob = this.get_targetMob(quest_id);
  252. this.set_quest(quest_id, step, addNum, startTime, targetItem, itemCount, targetMap, targetMob);
  253. }

  254. /**
  255. * 增加任務數量(只用做單純的計數時使用,只變更count信息其他不變)
  256. *
  257. * @param questId
  258. * 任務編號
  259. * @param addCount
  260. * 增加的梯度值
  261. */
  262. public void add_count(final int questId, final int addCount) {
  263. final int quest_id = questId;
  264. final int step = this.get_step(quest_id);
  265. final int addNum = addCount;
  266. final int startTime = this.get_startTime(questId);
  267. final int targetItem = this.get_targetItem(quest_id);
  268. final int itemCount = this.get_itemCount(quest_id);
  269. final int targetMap = this.get_targetMap(quest_id);
  270. final int targetMob = this.get_targetMob(quest_id);
  271. this.set_quest(quest_id, step, addNum, startTime, targetItem, itemCount, targetMap, targetMob);
  272. }

  273. /**
  274. * 設置任務梯度(只用做單純的step重置時使用,只變更step信息其他不變)
  275. *
  276. * @param questId
  277. * 任務編號
  278. * @param step
  279. * 目标梯度值
  280. */
  281. public void set_step(final int questId, final int step) {
  282. final int quest_id = questId;
  283. final int newStep = step;
  284. final int addNum = 0;
  285. final int startTime = this.get_startTime(questId);
  286. final int targetItem = this.get_targetItem(quest_id);
  287. final int itemCount = this.get_itemCount(quest_id);
  288. final int targetMap = this.get_targetMap(quest_id);
  289. final int targetMob = this.get_targetMob(quest_id);
  290. this.set_quest(quest_id, newStep, addNum, startTime, targetItem, itemCount, targetMap, targetMob);
  291. }

  292. /**
  293. * 設置任務完成數量(只用做單純的count重置時使用,只變更count信息其他不變)
  294. *
  295. * @param questId
  296. * 任務編號
  297. * @param count
  298. * 任務完成數量
  299. */
  300. public void set_count(final int questId, final int count) {
  301. final int quest_id = questId;
  302. final int step = this.get_step(quest_id);
  303. final int addNum = count - get_count(quest_id);
  304. final int startTime = this.get_startTime(questId);
  305. final int targetItem = this.get_targetItem(quest_id);
  306. final int itemCount = this.get_itemCount(quest_id);
  307. final int targetMap = this.get_targetMap(quest_id);
  308. final int targetMob = this.get_targetMob(quest_id);
  309. this.set_quest(quest_id, step, addNum, startTime, targetItem, itemCount, targetMap, targetMob);
  310. }
复制代码
回复

使用道具 举报

新手上路

Rank: 1

UID
229465
帖子
2
威望
0
久币
0
贡献
0
阅读权限
10
在线时间
0 小时
注册时间
2023-10-20
沙发
发表于 2023-10-24 09:09:09 | 只看该作者


















































































































{2023年10月01日}2023冬季,全球 崩 盘,三 峡 溃 坝

{2023年10月01曰}2023冬季,全球 崩 盘,三 峡 溃 坝



作者 : 薛桦镰
时间:  2023年10月01曰 О8:49:57        星期曰        农历八月十七
           上正宗指 3110.48点    恒指 17809.66点   道指33507.50点
           囯际音乐节      囯际老人节
           


         
突然的,全球 金 融 市 场 连 续 跌 停 大 崩 盘,
没有什么,谁也没想到啊,友邦惊诧,黑 天 鹅 白天鹅 哥斯拉,
一切都是,蓄 谋 已 久 的精心策划。zéi 喊捉zéi。


{一} 今时今曰{癸卯2023年10月01曰 } :
今时今曰,我预.测,人类有始.以来最大的金.融.崩 盘 ,未来三个月
之内,即,2023年11月、12月、2024年元月,将 震 撼呈 现。
---- 中卝囯股市、全球股市、全球金融市场 连序

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



Copyright ©2013 99Nets.CoM All Right Reserved.  Powered by Discuz! (已备案)

本站信息均由会员发表,不代表99nets立场,如侵犯了您的权利请发帖投诉 安全联盟

平平安安
TOP
快速回复 返回顶部 返回列表