Friend.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. Friend = {}
  2. -- 获取是否添加仇敌
  3. function Friend.enemyaddbefore(actor,killRid)
  4. -- error("开始添加仇敌")
  5. local enemyValue = ConfigDataManager.getTableValue("cfg_global","value","id",1801)
  6. addenemy(actor,killRid,enemyValue)
  7. -- error("添加仇敌结束")
  8. end
  9. function frienddegreechange(actor,targetId,friendType,likeLevel)
  10. local msgData = {targetId = targetId, friendType = friendType, likeLevel = likeLevel}
  11. sendluamsg(actor,LuaMessageIdToClient.FRIEND_DEGREE_CHANGE,msgData)
  12. end
  13. -- 给好友送花
  14. function Friend.sendflower(actor,msgID,msgData)
  15. local flowerCfgId = tonumber(msgData[1])
  16. local flowerTable = {61200001, 61200002, 61200003}
  17. local isFlower = table.contains(flowerTable,flowerCfgId)
  18. if not isFlower then
  19. info(actor, actor:toString() .. "花的配置id不对")
  20. return
  21. end
  22. local haveCount = getbagitemcountbyid(actor,flowerCfgId)
  23. if haveCount < 1 then
  24. noticeTip.noticeinfo(actor, StringIdConst.TEXT346)
  25. return
  26. end
  27. local useParam = ConfigDataManager.getTableValue("cfg_item", "useParam", "id", flowerCfgId)
  28. local useParamTable = string.split(useParam,'#')
  29. local deleteFlower = removeitemfrombag(actor,flowerCfgId,1,0,9999,'好友')
  30. if not deleteFlower then
  31. noticeTip.noticeinfo(actor, StringIdConst.TEXT347)
  32. return
  33. end
  34. local intimacyLevel = tonumber(useParamTable[1])
  35. local miracleCoinCfgId = tonumber(useParamTable[2])
  36. local miracleCoinCount = tonumber(useParamTable[3])
  37. local charmValueCfgId = tonumber(useParamTable[4])
  38. local charmValueCount = tonumber(useParamTable[5])
  39. additemtobag(actor,miracleCoinCfgId,miracleCoinCount, 0, 9999, '好友')
  40. additemtootherbag(actor,charmValueCfgId,charmValueCount)
  41. local degree = setfrienddegree(actor,msgData[2],intimacyLevel)
  42. sendluamsg(actor,msgID,degree)
  43. end